@openmrs/esm-report-builder 0.1.1-pre.245 → 0.1.1-pre.249

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/dist/6696.js CHANGED
@@ -1,4 +1,4 @@
1
- (globalThis.webpackChunk_openmrs_esm_report_builder=globalThis.webpackChunk_openmrs_esm_report_builder||[]).push([["6696"],{7581(e){e.exports=function(e,t,r){t.prototype.isToday=function(){var e="YYYY-MM-DD",t=r();return this.format(e)===t.format(e)}}},5238(e){e.exports=function(e,t,r){var n=t.prototype,a=function(e){var t=e.date,a=e.utc,o={};if(!(null===t||t instanceof Date||t instanceof Array||n.$utils().u(t)||"Object"!==t.constructor.name)){if(!Object.keys(t).length)return new Date;var i=a?r.utc():r();Object.keys(t).forEach(function(e){var r;o["date"===(r=n.$utils().p(e))?"day":r]=t[e]});var s=o.day||(o.year||o.month>=0?1:i.date()),l=o.year||i.year(),u=o.month>=0?o.month:o.year||o.day?0:i.month(),c=o.hour||0,d=o.minute||0,m=o.second||0,p=o.millisecond||0;return a?new Date(Date.UTC(l,u,s,c,d,m,p)):new Date(l,u,s,c,d,m,p)}return t},o=n.parse;n.parse=function(e){e.date=a.bind(this)(e),o.bind(this)(e)};var i=n.set,s=n.add,l=n.subtract,u=function(e,t,r,n){void 0===n&&(n=1);var a=Object.keys(t),o=this;return a.forEach(function(r){o=e.bind(o)(t[r]*n,r)}),o};n.set=function(e,t){return t=void 0===t?e:t,"Object"===e.constructor.name?u.bind(this)(function(e,t){return i.bind(this)(t,e)},t,e):i.bind(this)(e,t)},n.add=function(e,t){return"Object"===e.constructor.name?u.bind(this)(s,e,t):s.bind(this)(e,t)},n.subtract=function(e,t){return"Object"===e.constructor.name?u.bind(this)(s,e,t,-1):l.bind(this)(e,t)}}},3826(e){e.exports=function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,a,o){var i=a.prototype;o.utc=function(e){var t={date:e,utc:!0,args:arguments};return new a(t)},i.utc=function(t){var r=o(this.toDate(),{locale:this.$L,utc:!0});return t?r.add(this.utcOffset(),e):r},i.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var s=i.parse;i.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),s.call(this,e)};var l=i.init;i.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else l.call(this)};var u=i.utcOffset;i.utcOffset=function(n,a){var o=this.$utils().u;if(o(n))return this.$u?0:o(this.$offset)?u.call(this):this.$offset;if("string"==typeof n&&null===(n=function(e){void 0===e&&(e="");var n=e.match(t);if(!n)return null;var a=(""+n[0]).match(r)||["-",0,0],o=a[0],i=60*a[1]+ +a[2];return 0===i?0:"+"===o?i:-i}(n)))return this;var i=16>=Math.abs(n)?60*n:n;if(0===i)return this.utc(a);var s=this.clone();if(a)return s.$offset=i,s.$u=!1,s;var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(s=this.local().add(i+l,e)).$offset=i,s.$x.$localOffset=l,s};var c=i.format;i.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,t)},i.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var d=i.toDate;i.toDate=function(e){return"s"===e&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var m=i.diff;i.diff=function(e,t,r){if(e&&this.$u===e.$u)return m.call(this,e,t,r);var n=this.local(),a=o(e).local();return m.call(n,a,t,r)}}}()},2849(e){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;function n(e){if(!e||"[object Object]"!==r.call(e)||e.nodeType||e.setInterval)return!1;var n,a=t.call(e,"constructor"),o=t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!a&&!o)return!1;for(n in e);return void 0===n||t.call(e,n)}e.exports=function e(){var t,r,a,o,i,s,l=arguments[0]||{},u=1,c=arguments.length,d=!1;for("boolean"==typeof l&&(d=l,l=arguments[1]||{},u=2),"object"!=typeof l&&"function"!=typeof l&&(l={});u<c;u++)if(null!=(t=arguments[u]))for(r in t)a=l[r],l!==(o=t[r])&&(d&&o&&(n(o)||(i=Array.isArray(o)))?(i?(i=!1,s=a&&Array.isArray(a)?a:[]):s=a&&n(a)?a:{},l[r]=e(d,s,o)):void 0!==o&&(l[r]=o));return l}},6767(e,t,r){!function(t){"use strict";var n=r(6974);function a(e){return function(t,r){return"object"==typeof t&&(r=t,t=null),null==t&&(t=new Date().toString()),r||(r={}),e.call(this,t,r)}}var o=e.exports={generate:a(function(e,t){return new n(e,t)})};t&&(t.fn.geopattern=a(function(e,r){return this.each(function(){var n=t(this).attr("data-title-sha");n&&(r=t.extend({hash:n},r));var a=o.generate(e,r);t(this).css("background-image",a.toDataUrl())})}))}("u">typeof jQuery?jQuery:null)},2467(e){"use strict";e.exports={hex2rgb:function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,r,n){return t+t+r+r+n+n});var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},rgb2hex:function(e){return"#"+["r","g","b"].map(function(t){return("0"+e[t].toString(16)).slice(-2)}).join("")},rgb2hsl:function(e){var t,r,n=e.r,a=e.g,o=e.b,i=Math.max(n/=255,a/=255,o/=255),s=Math.min(n,a,o),l=(i+s)/2;if(i===s)t=r=0;else{var u=i-s;switch(r=l>.5?u/(2-i-s):u/(i+s),i){case n:t=(a-o)/u+6*(a<o);break;case a:t=(o-n)/u+2;break;case o:t=(n-a)/u+4}t/=6}return{h:t,s:r,l:l}},hsl2rgb:function(e){function t(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}var r,n,a,o=e.h,i=e.s,s=e.l;if(0===i)r=n=a=s;else{var l=s<.5?s*(1+i):s+i-s*i,u=2*s-l;r=t(u,l,o+1/3),n=t(u,l,o),a=t(u,l,o-1/3)}return{r:Math.round(255*r),g:Math.round(255*n),b:Math.round(255*a)}},rgb2rgbString:function(e){return"rgb("+[e.r,e.g,e.b].join(",")+")"}}},6974(e,t,r){"use strict";var n=r(2849),a=r(2467),o=r(6743),i=r(8502),s={baseColor:"#933c3c"},l=["octogons","overlappingCircles","plusSigns","xes","sineWaves","hexagons","overlappingRings","plaid","triangles","squares","concentricCircles","diamonds","tessellation","nestedSquares","mosaicSquares","chevrons"],u="#000";function c(e,t,r){return parseInt(e.substr(t,r||1),16)}function d(e,t,r,n,a){return(parseFloat(e)-t)*(a-n)/(r-t)+n}function m(e){return e%2==0?"#ddd":"#222"}function p(e){return d(e,0,15,.02,.15)}var f=e.exports=function(e,t){return this.opts=n({},s,t),this.hash=t.hash||o(e),this.svg=new i,this.generateBackground(),this.generatePattern(),this};function h(e){return[[e,0,e,3*e],[0,e,3*e,e]]}function g(e){return[0,0,e,e,0,e,0,0].join(",")}function y(e,t,r,n,a){var o=g(n),i=p(a[0]),s=m(a[0]),l={stroke:u,"stroke-opacity":.02,"fill-opacity":i,fill:s};e.polyline(o,l).transform({translate:[t+n,r],scale:[-1,1]}),e.polyline(o,l).transform({translate:[t+n,r+2*n],scale:[1,-1]}),l={stroke:u,"stroke-opacity":.02,"fill-opacity":i=p(a[1]),fill:s=m(a[1])},e.polyline(o,l).transform({translate:[t+n,r+2*n],scale:[-1,-1]}),e.polyline(o,l).transform({translate:[t+n,r],scale:[1,1]})}function v(e,t,r,n,a){var o=p(a),i=m(a),s=g(n),l={stroke:u,"stroke-opacity":.02,"fill-opacity":o,fill:i};e.polyline(s,l).transform({translate:[t,r+n],scale:[1,-1]}),e.polyline(s,l).transform({translate:[t+2*n,r+n],scale:[-1,-1]}),e.polyline(s,l).transform({translate:[t,r+n],scale:[1,1]}),e.polyline(s,l).transform({translate:[t+2*n,r+n],scale:[-1,1]})}f.prototype.toSvg=function(){return this.svg.toString()},f.prototype.toString=function(){return this.toSvg()},f.prototype.toBase64=function(){var e=this.toSvg();return"u">typeof window&&"function"==typeof window.btoa?window.btoa(e):new Buffer(e).toString("base64")},f.prototype.toDataUri=function(){return"data:image/svg+xml;base64,"+this.toBase64()},f.prototype.toDataUrl=function(){return'url("'+this.toDataUri()+'")'},f.prototype.generateBackground=function(){var e,t,r,n;this.opts.color?r=a.hex2rgb(this.opts.color):(t=d(c(this.hash,14,3),0,4095,0,359),n=c(this.hash,17),(e=a.rgb2hsl(a.hex2rgb(this.opts.baseColor))).h=(360*e.h-t+360)%360/360,n%2==0?e.s=Math.min(1,(100*e.s+n)/100):e.s=Math.max(0,(100*e.s-n)/100),r=a.hsl2rgb(e)),this.color=a.rgb2hex(r),this.svg.rect(0,0,"100%","100%",{fill:a.rgb2rgbString(r)})},f.prototype.generatePattern=function(){var e=this.opts.generator;if(e){if(0>l.indexOf(e))throw Error("The generator "+e+" does not exist.")}else e=l[c(this.hash,20)];return this["geo"+e.slice(0,1).toUpperCase()+e.slice(1)]()},f.prototype.geoHexagons=function(){var e,t,r,n,a,o,i,s,l,f=d(c(this.hash,0),0,15,8,60),h=f*Math.sqrt(3),g=2*f,y=(s=f/2,[0,l=Math.sin(60*Math.PI/180)*f,s,0,s+f,0,2*f,l,s+f,2*l,s,2*l,0,l].join(","));for(this.svg.setWidth(3*g+3*f),this.svg.setHeight(6*h),t=0,i=0;i<6;i++)for(o=0;o<6;o++)a=c(this.hash,t),e=o%2==0?i*h:i*h+h/2,r=p(a),n={fill:m(a),"fill-opacity":r,stroke:u,"stroke-opacity":.02},this.svg.polyline(y,n).transform({translate:[o*f*1.5-g/2,e-h/2]}),0===o&&this.svg.polyline(y,n).transform({translate:[6*f*1.5-g/2,e-h/2]}),0===i&&(e=o%2==0?6*h:6*h+h/2,this.svg.polyline(y,n).transform({translate:[o*f*1.5-g/2,e-h/2]})),0===o&&0===i&&this.svg.polyline(y,n).transform({translate:[6*f*1.5-g/2,5*h+h/2]}),t++},f.prototype.geoSineWaves=function(){var e,t,r,n,a,o,i,s=Math.floor(d(c(this.hash,0),0,15,100,400)),l=Math.floor(d(c(this.hash,1),0,15,30,100)),u=Math.floor(d(c(this.hash,2),0,15,3,30));for(this.svg.setWidth(s),this.svg.setHeight(36*u),t=0;t<36;t++)r=p(o=c(this.hash,t)),e=m(o),i=s/4*.7,a={fill:"none",stroke:e,opacity:r,"stroke-width":""+u+"px"},n="M0 "+l+" C "+i+" 0, "+(s/2-i)+" 0, "+s/2+" "+l+" S "+(s-i)+" "+2*l+", "+s+" "+l+" S "+(1.5*s-i)+" 0, "+1.5*s+", "+l,this.svg.path(n,a).transform({translate:[-s/4,u*t-1.5*l]}),this.svg.path(n,a).transform({translate:[-s/4,u*t-1.5*l+36*u]})},f.prototype.geoChevrons=function(){var e,t,r,n,a,o,i,s=d(c(this.hash,0),0,15,30,80),l=d(c(this.hash,0),0,15,30,80),f=(e=.66*l,[[0,0,s/2,l-e,s/2,l,0,e,0,0],[s/2,l-e,s,0,s,e,s/2,l,s/2,l-e]].map(function(e){return e.join(",")}));for(this.svg.setWidth(6*s),this.svg.setHeight(6*l*.66),t=0,i=0;i<6;i++)for(o=0;o<6;o++)r=p(a=c(this.hash,t)),n={stroke:u,"stroke-opacity":.02,fill:m(a),"fill-opacity":r,"stroke-width":1},this.svg.group(n).transform({translate:[o*s,i*l*.66-l/2]}).polyline(f).end(),0===i&&this.svg.group(n).transform({translate:[o*s,6*l*.66-l/2]}).polyline(f).end(),t+=1},f.prototype.geoPlusSigns=function(){var e,t,r,n,a,o,i,s,l=d(c(this.hash,0),0,15,10,25),f=3*l,g=h(l);for(this.svg.setWidth(12*l),this.svg.setHeight(12*l),r=0,s=0;s<6;s++)for(i=0;i<6;i++)n=p(o=c(this.hash,r)),t=m(o),e=+(s%2!=0),a={fill:t,stroke:u,"stroke-opacity":.02,"fill-opacity":n},this.svg.group(a).transform({translate:[i*f-i*l+e*l-l,s*f-s*l-f/2]}).rect(g).end(),0===i&&this.svg.group(a).transform({translate:[4*f-i*l+e*l-l,s*f-s*l-f/2]}).rect(g).end(),0===s&&this.svg.group(a).transform({translate:[i*f-i*l+e*l-l,4*f-s*l-f/2]}).rect(g).end(),0===i&&0===s&&this.svg.group(a).transform({translate:[4*f-i*l+e*l-l,4*f-s*l-f/2]}).rect(g).end(),r++},f.prototype.geoXes=function(){var e,t,r,n,a,o,i,s=d(c(this.hash,0),0,15,10,25),l=h(s),u=3*s*.943;for(this.svg.setWidth(3*u),this.svg.setHeight(3*u),t=0,i=0;i<6;i++)for(o=0;o<6;o++)r=p(a=c(this.hash,t)),e=o%2==0?i*u-.5*u:i*u-.5*u+u/4,n={fill:m(a),opacity:r},this.svg.group(n).transform({translate:[o*u/2-u/2,e-i*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),0===o&&this.svg.group(n).transform({translate:[6*u/2-u/2,e-i*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),0===i&&(e=o%2==0?6*u-u/2:6*u-u/2+u/4,this.svg.group(n).transform({translate:[o*u/2-u/2,e-6*u/2],rotate:[45,u/2,u/2]}).rect(l).end()),5===i&&this.svg.group(n).transform({translate:[o*u/2-u/2,e-11*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),0===o&&0===i&&this.svg.group(n).transform({translate:[6*u/2-u/2,e-6*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),t++},f.prototype.geoOverlappingCircles=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,25,200)/2;for(this.svg.setWidth(6*i),this.svg.setHeight(6*i),e=0,o=0;o<6;o++)for(a=0;a<6;a++)t=p(n=c(this.hash,e)),r={fill:m(n),opacity:t},this.svg.circle(a*i,o*i,i,r),0===a&&this.svg.circle(6*i,o*i,i,r),0===o&&this.svg.circle(a*i,6*i,i,r),0===a&&0===o&&this.svg.circle(6*i,6*i,i,r),e++},f.prototype.geoOctogons=function(){var e,t,r,n,a,o,i,s=d(c(this.hash,0),0,15,10,60),l=[e=.33*s,0,s-e,0,s,e,s,s-e,s-e,s,e,s,0,s-e,0,e,e,0].join(",");for(this.svg.setWidth(6*s),this.svg.setHeight(6*s),r=0,i=0;i<6;i++)for(o=0;o<6;o++)n=p(a=c(this.hash,r)),t=m(a),this.svg.polyline(l,{fill:t,"fill-opacity":n,stroke:u,"stroke-opacity":.02}).transform({translate:[o*s,i*s]}),r+=1},f.prototype.geoSquares=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,10,60);for(this.svg.setWidth(6*i),this.svg.setHeight(6*i),t=0,o=0;o<6;o++)for(a=0;a<6;a++)r=p(n=c(this.hash,t)),e=m(n),this.svg.rect(a*i,o*i,i,i,{fill:e,"fill-opacity":r,stroke:u,"stroke-opacity":.02}),t+=1},f.prototype.geoConcentricCircles=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,10,60),s=i/5;for(this.svg.setWidth((i+s)*6),this.svg.setHeight((i+s)*6),t=0,o=0;o<6;o++)for(a=0;a<6;a++)r=p(n=c(this.hash,t)),e=m(n),this.svg.circle(a*i+a*s+(i+s)/2,o*i+o*s+(i+s)/2,i/2,{fill:"none",stroke:e,opacity:r,"stroke-width":s+"px"}),r=p(n=c(this.hash,39-t)),e=m(n),this.svg.circle(a*i+a*s+(i+s)/2,o*i+o*s+(i+s)/2,i/4,{fill:e,"fill-opacity":r}),t+=1},f.prototype.geoOverlappingRings=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,10,60),s=i/4;for(this.svg.setWidth(6*i),this.svg.setHeight(6*i),e=0,o=0;o<6;o++)for(a=0;a<6;a++)t=p(n=c(this.hash,e)),r={fill:"none",stroke:m(n),opacity:t,"stroke-width":s+"px"},this.svg.circle(a*i,o*i,i-s/2,r),0===a&&this.svg.circle(6*i,o*i,i-s/2,r),0===o&&this.svg.circle(a*i,6*i,i-s/2,r),0===a&&0===o&&this.svg.circle(6*i,6*i,i-s/2,r),e+=1},f.prototype.geoTriangles=function(){var e,t,r,n,a,o,i,s,l=d(c(this.hash,0),0,15,15,80),f=l/2*Math.sqrt(3),h=[s=l/2,0,l,f,0,f,s,0].join(",");for(this.svg.setWidth(3*l),this.svg.setHeight(6*f),e=0,i=0;i<6;i++)for(o=0;o<6;o++)t=p(a=c(this.hash,e)),n={fill:m(a),"fill-opacity":t,stroke:u,"stroke-opacity":.02},r=i%2==0?180*(o%2==0):180*(o%2!=0),this.svg.polyline(h,n).transform({translate:[o*l*.5-l/2,f*i],rotate:[r,l/2,f/2]}),0===o&&this.svg.polyline(h,n).transform({translate:[6*l*.5-l/2,f*i],rotate:[r,l/2,f/2]}),e+=1},f.prototype.geoDiamonds=function(){var e,t,r,n,a,o,i,s=d(c(this.hash,0),0,15,10,50),l=d(c(this.hash,1),0,15,10,50),f=[s/2,0,s,l/2,s/2,l,0,l/2].join(",");for(this.svg.setWidth(6*s),this.svg.setHeight(3*l),t=0,i=0;i<6;i++)for(o=0;o<6;o++)r=p(a=c(this.hash,t)),n={fill:m(a),"fill-opacity":r,stroke:u,"stroke-opacity":.02},e=i%2==0?0:s/2,this.svg.polyline(f,n).transform({translate:[o*s-s/2+e,l/2*i-l/2]}),0===o&&this.svg.polyline(f,n).transform({translate:[6*s-s/2+e,l/2*i-l/2]}),0===i&&this.svg.polyline(f,n).transform({translate:[o*s-s/2+e,l/2*6-l/2]}),0===o&&0===i&&this.svg.polyline(f,n).transform({translate:[6*s-s/2+e,l/2*6-l/2]}),t+=1},f.prototype.geoNestedSquares=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,4,12),s=7*i;for(this.svg.setWidth((s+i)*6+6*i),this.svg.setHeight((s+i)*6+6*i),e=0,o=0;o<6;o++)for(a=0;a<6;a++)t=p(n=c(this.hash,e)),r={fill:"none",stroke:m(n),opacity:t,"stroke-width":i+"px"},this.svg.rect(a*s+a*i*2+i/2,o*s+o*i*2+i/2,s,s,r),t=p(n=c(this.hash,39-e)),r={fill:"none",stroke:m(n),opacity:t,"stroke-width":i+"px"},this.svg.rect(a*s+a*i*2+i/2+2*i,o*s+o*i*2+i/2+2*i,3*i,3*i,r),e+=1},f.prototype.geoMosaicSquares=function(){var e,t,r,n=d(c(this.hash,0),0,15,15,50);for(this.svg.setWidth(8*n),this.svg.setHeight(8*n),e=0,r=0;r<4;r++)for(t=0;t<4;t++)t%2==0?r%2==0?v(this.svg,t*n*2,r*n*2,n,c(this.hash,e)):y(this.svg,t*n*2,r*n*2,n,[c(this.hash,e),c(this.hash,e+1)]):r%2==0?y(this.svg,t*n*2,r*n*2,n,[c(this.hash,e),c(this.hash,e+1)]):v(this.svg,t*n*2,r*n*2,n,c(this.hash,e)),e+=1},f.prototype.geoPlaid=function(){var e,t,r,n,a,o,i=0,s=0;for(t=0;t<36;)i+=c(this.hash,t)+5,r=p(o=c(this.hash,t+1)),e=m(o),n=o+5,this.svg.rect(0,i,"100%",n,{opacity:r,fill:e}),i+=n,t+=2;for(t=0;t<36;)s+=c(this.hash,t)+5,r=p(o=c(this.hash,t+1)),e=m(o),a=o+5,this.svg.rect(s,0,a,"100%",{opacity:r,fill:e}),s+=a,t+=2;this.svg.setWidth(s),this.svg.setHeight(i)},f.prototype.geoTessellation=function(){var e,t,r,n,a=d(c(this.hash,0),0,15,5,40),o=a*Math.sqrt(3),i=2*a,s=a/2*Math.sqrt(3),l=[0,0,s,a/2,0,a,0,0].join(","),f=3*a+2*s,h=2*o+2*a;for(this.svg.setWidth(f),this.svg.setHeight(h),e=0;e<20;e++)switch(t=p(n=c(this.hash,e)),r={stroke:u,"stroke-opacity":.02,fill:m(n),"fill-opacity":t,"stroke-width":1},e){case 0:this.svg.rect(-a/2,-a/2,a,a,r),this.svg.rect(f-a/2,-a/2,a,a,r),this.svg.rect(-a/2,h-a/2,a,a,r),this.svg.rect(f-a/2,h-a/2,a,a,r);break;case 1:this.svg.rect(i/2+s,o/2,a,a,r);break;case 2:this.svg.rect(-a/2,h/2-a/2,a,a,r),this.svg.rect(f-a/2,h/2-a/2,a,a,r);break;case 3:this.svg.rect(i/2+s,1.5*o+a,a,a,r);break;case 4:this.svg.polyline(l,r).transform({translate:[a/2,-a/2],rotate:[0,a/2,s/2]}),this.svg.polyline(l,r).transform({translate:[a/2,h- -a/2],rotate:[0,a/2,s/2],scale:[1,-1]});break;case 5:this.svg.polyline(l,r).transform({translate:[f-a/2,-a/2],rotate:[0,a/2,s/2],scale:[-1,1]}),this.svg.polyline(l,r).transform({translate:[f-a/2,h+a/2],rotate:[0,a/2,s/2],scale:[-1,-1]});break;case 6:this.svg.polyline(l,r).transform({translate:[f/2+a/2,o/2]});break;case 7:this.svg.polyline(l,r).transform({translate:[f-f/2-a/2,o/2],scale:[-1,1]});break;case 8:this.svg.polyline(l,r).transform({translate:[f/2+a/2,h-o/2],scale:[1,-1]});break;case 9:this.svg.polyline(l,r).transform({translate:[f-f/2-a/2,h-o/2],scale:[-1,-1]});break;case 10:this.svg.polyline(l,r).transform({translate:[a/2,h/2-a/2]});break;case 11:this.svg.polyline(l,r).transform({translate:[f-a/2,h/2-a/2],scale:[-1,1]});break;case 12:this.svg.rect(0,0,a,a,r).transform({translate:[a/2,a/2],rotate:[-30,0,0]});break;case 13:this.svg.rect(0,0,a,a,r).transform({scale:[-1,1],translate:[-f+a/2,a/2],rotate:[-30,0,0]});break;case 14:this.svg.rect(0,0,a,a,r).transform({translate:[a/2,h/2-a/2-a],rotate:[30,0,a]});break;case 15:this.svg.rect(0,0,a,a,r).transform({scale:[-1,1],translate:[-f+a/2,h/2-a/2-a],rotate:[30,0,a]});break;case 16:this.svg.rect(0,0,a,a,r).transform({scale:[1,-1],translate:[a/2,-h+h/2-a/2-a],rotate:[30,0,a]});break;case 17:this.svg.rect(0,0,a,a,r).transform({scale:[-1,-1],translate:[-f+a/2,-h+h/2-a/2-a],rotate:[30,0,a]});break;case 18:this.svg.rect(0,0,a,a,r).transform({scale:[1,-1],translate:[a/2,-h+a/2],rotate:[-30,0,0]});break;case 19:this.svg.rect(0,0,a,a,r).transform({scale:[-1,-1],translate:[-f+a/2,-h+a/2],rotate:[-30,0,0]})}}},6743(e){"use strict";function t(){var e=0x67452301,t=0xefcdab89,r=0x98badcfe,n=0x10325476,a=0xc3d2e1f0,o=new Uint32Array(80),i=0,s=24,l=0;function u(){for(var s,l,u=16;u<80;u++){var c=o[u-3]^o[u-8]^o[u-14]^o[u-16];o[u]=c<<1|c>>>31}var d=e,m=t,p=r,f=n,h=a;for(u=0;u<80;u++){u<20?(s=f^m&(p^f),l=0x5a827999):u<40?(s=m^p^f,l=0x6ed9eba1):u<60?(s=m&p|f&(m|p),l=0x8f1bbcdc):(s=m^p^f,l=0xca62c1d6);var g=(d<<5|d>>>27)+s+h+l+(0|o[u]);h=f,f=p,p=m<<30|m>>>2,m=d,d=g}for(u=0,e=e+d|0,t=t+m|0,r=r+p|0,n=n+f|0,a=a+h|0,i=0;u<16;u++)o[u]=0}function c(e){o[i]|=(255&e)<<s,s?s-=8:(i++,s=24),16===i&&u()}function d(e){for(var t="",r=28;r>=0;r-=4)t+=(e>>r&15).toString(16);return t}return{update:function(e){if("string"==typeof e){var t=e.length;l+=8*t;for(var r=0;r<t;r++)c(e.charCodeAt(r));return}var n=e.length;l+=8*n;for(var a=0;a<n;a++)c(e[a])},digest:function(){c(128),(i>14||14===i&&s<24)&&u(),i=14,s=24,c(0),c(0),c(l>0xffffffffff?l/0x10000000000:0),c(l>0xffffffff?l/0x100000000:0);for(var o=24;o>=0;o-=8)c(l>>o);return d(e)+d(t)+d(r)+d(n)+d(a)}}}e.exports=function(e){if(void 0===e)return t();var r=t();return r.update(e),r.digest()}},8502(e,t,r){"use strict";var n=r(2849),a=r(6541);function o(){return this.width=100,this.height=100,this.svg=a("svg"),this.context=[],this.setAttributes(this.svg,{xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height}),this}e.exports=o,o.prototype.currentContext=function(){return this.context[this.context.length-1]||this.svg},o.prototype.end=function(){return this.context.pop(),this},o.prototype.currentNode=function(){var e=this.currentContext();return e.lastChild||e},o.prototype.transform=function(e){return this.currentNode().setAttribute("transform",Object.keys(e).map(function(t){return t+"("+e[t].join(",")+")"}).join(" ")),this},o.prototype.setAttributes=function(e,t){Object.keys(t).forEach(function(r){e.setAttribute(r,t[r])})},o.prototype.setWidth=function(e){this.svg.setAttribute("width",Math.floor(e))},o.prototype.setHeight=function(e){this.svg.setAttribute("height",Math.floor(e))},o.prototype.toString=function(){return this.svg.toString()},o.prototype.rect=function(e,t,r,o,i){var s=this;if(Array.isArray(e))return e.forEach(function(e){s.rect.apply(s,e.concat(i))}),this;var l=a("rect");return this.currentContext().appendChild(l),this.setAttributes(l,n({x:e,y:t,width:r,height:o},i)),this},o.prototype.circle=function(e,t,r,o){var i=a("circle");return this.currentContext().appendChild(i),this.setAttributes(i,n({cx:e,cy:t,r:r},o)),this},o.prototype.path=function(e,t){var r=a("path");return this.currentContext().appendChild(r),this.setAttributes(r,n({d:e},t)),this},o.prototype.polyline=function(e,t){var r=this;if(Array.isArray(e))return e.forEach(function(e){r.polyline(e,t)}),this;var o=a("polyline");return this.currentContext().appendChild(o),this.setAttributes(o,n({points:e},t)),this},o.prototype.group=function(e){var t=a("g");return this.currentContext().appendChild(t),this.context.push(t),this.setAttributes(t,n({},e)),this}},6541(e){"use strict";var t=e.exports=function(e){return this instanceof t?(this.tagName=e,this.attributes=Object.create(null),this.children=[],this.lastChild=null,this):new t(e)};t.prototype.appendChild=function(e){return this.children.push(e),this.lastChild=e,this},t.prototype.setAttribute=function(e,t){return this.attributes[e]=t,this},t.prototype.toString=function(){var e=this;return["<",e.tagName,Object.keys(e.attributes).map(function(t){return[" ",t,'="',e.attributes[t],'"'].join("")}).join(""),">",e.children.map(function(e){return e.toString()}).join(""),"</",e.tagName,">"].join("")}},8067(e,t){"use strict";t.pathToRegexp=function(e,t={}){let{delimiter:c="/",end:d=!0,sensitive:m=!1,trailing:p=!0}=t,f=new l("^"),h=[e],g=0;for(;h.length;){let e=h.shift();if(Array.isArray(e)){h.push(...e);continue}let l="object"==typeof e?e:function(e,t={}){let{encodePath:o=r}=t,l=[...e],u=[],c=0,d=0;function m(){let t="";if(n.test(l[c]))do t+=l[c++];while(a.test(l[c]));else if('"'===l[c]){let r=c;for(;c<l.length;){if('"'===l[++c]){c++,r=0;break}"\\"===l[c]&&c++,t+=l[c]}if(r)throw new s(`Unterminated quote at index ${r}`,e)}if(!t)throw new s(`Missing parameter name at index ${c}`,e);return t}for(;c<l.length;){let e=l[c++];"{}()[]+?!".includes(e)?u.push({type:e,index:c,value:e}):"\\"===e?u.push({type:"escape",index:c,value:l[c++]}):":"===e?u.push({type:"param",index:c,value:m()}):"*"===e?u.push({type:"wildcard",index:c,value:m()}):u.push({type:"char",index:c,value:e})}return u.push({type:"end",index:c,value:""}),new i(function t(r){let n=[];for(;;){let a=u[d++];if(a.type===r)break;if("char"===a.type||"escape"===a.type){let e=a.value,t=u[d];for(;"char"===t.type||"escape"===t.type;)e+=t.value,t=u[++d];n.push({type:"text",value:o(e)});continue}if("param"===a.type||"wildcard"===a.type){n.push({type:a.type,name:a.value});continue}if("{"===a.type){n.push({type:"group",tokens:t("}")});continue}throw new s(`Unexpected ${a.type} at index ${a.index}, expected ${r}`,e)}return n}("end"),e)}(e,t);!function e(t,r,n,a){for(;r<t.length;){let o=t[r++];if("group"===o.type){e(o.tokens,0,n.slice(),n=>e(t,r,n,a));continue}n.push(o)}a(n)}(l.tokens,0,[],e=>{if(g++>=256)throw new s("Too many path combinations",l.originalPath);let t=f;for(let r of function(e,t,r){let n=[],a="",i="",l=0,c=0,d=0;for(;d<e.length;){let m=e[d++];if("text"===m.type){n.push({source:o(m.value)}),a+=m.value,2===l&&(i+=m.value),m.value.includes(t)&&(c=0);continue}if("param"===m.type||"wildcard"===m.type){if(l&&!a)throw new s(`Missing text before "${m.name}" ${m.type}`,r);"param"===m.type?(n.push({source:c?`(${u(t,a)}+?)`:!function(r,n){for(;r<e.length;){let a=e[r++];if(a.type===n)return!0;if("text"===a.type&&a.value.includes(t))break}return!1}(d,"wildcard")?`(${u(t,"")}+?)`:`(${u(t,function(t){let r="";for(;t<e.length;){let n=e[t++];if("text"!==n.type)break;r+=n.value}return r}(d))}+?)`,key:m}),c|=l=1):(n.push({source:2&c?`(${u(a,"")}+?)`:1&c?`(${u(i,"")}+?)`:i?`(${u(i,"")}+?|${u(t,"")}+?)`:"([^]+?)",key:m}),i="",c|=l=2),a="";continue}throw TypeError(`Unknown token type: ${m.type}`)}return n}(e,c,l.originalPath))t=t.add(r.source,r.key);t.add("")})}let y=[],v=function e(t,r){t.key&&r.push(t.key);let n=Object.keys(t.children),a=n.map(n=>e(t.children[n],r)).join("|");return t.source+(n.length<2?a:`(?:${a})`)}(f,y);return p&&(v+="(?:"+o(c)+"$)?"),{regexp:new RegExp(v+=d?"$":"(?="+o(c)+"|$)",m?"":"i"),keys:y}};let r=e=>e,n=/^[$_\p{ID_Start}]$/u,a=/^[$\u200c\u200d\p{ID_Continue}]$/u;function o(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}class i{constructor(e,t){this.tokens=e,this.originalPath=t}}class s extends TypeError{constructor(e,t){let r=e;t&&(r+=`: ${t}`),super(r+="; visit https://git.new/pathToRegexpError for info"),this.originalPath=t}}class l{constructor(e,t){this.source=e,this.key=t,this.children=Object.create(null)}add(e,t){var r;let n=e+":"+(t?t.name:"");return(r=this.children)[n]||(r[n]=new l(e,t))}}function u(e,t){return t.length>e.length?u(t,e):(e===t&&(t=""),t.length>1)?`(?:(?!${o(e)}|${o(t)})[^])`:e.length>1?`(?:(?!${o(e)})[^${o(t)}])`:`[^${o(e+t)}]`}},3904(e,t,r){"use strict";let n=Symbol("SemVer ANY");class a{static get ANY(){return n}constructor(e,t){if(t=o(t),e instanceof a)if(!!t.loose===e.loose)return e;else e=e.value;u("comparator",e=e.trim().split(/\s+/).join(" "),t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===n?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){let t=this.options.loose?i[s.COMPARATORLOOSE]:i[s.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===n||e===n)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof a))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):!((t=o(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))}}e.exports=a;let o=r(8587),{safeRe:i,t:s}=r(9718),l=r(2111),u=r(7272),c=r(3908),d=r(8311)},8311(e,t,r){"use strict";let n=/\s+/g;class a{constructor(e,t){if(t=i(t),e instanceof a)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else return new a(e.raw,t);if(e instanceof s)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(n," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!b(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1){for(const e of this.set)if(1===e.length&&w(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(v,"");let t=((this.options.includePrerelease&&g)|(this.options.loose&&y))+":"+e,r=o.get(t);if(r)return r;let n=this.options.loose,a=n?d[p.HYPHENRANGELOOSE]:d[p.HYPHENRANGE];l("hyphen replace",e=e.replace(a,$(this.options.includePrerelease))),l("comparator trim",e=c(e)),l("tilde trim",e=e.replace(d[p.TILDETRIM],f)),l("caret trim",e=e.replace(d[p.CARETTRIM],h));let i=e.split(" ").map(e=>D(e,this.options)).join(" ").split(/\s+/).map(e=>O(e,this.options));n&&(i=i.filter(e=>(l("loose invalid filter",e,this.options),!!e.match(d[p.COMPARATORLOOSE])))),l("range list",i);let u=new Map;for(let e of i.map(e=>new s(e,this.options))){if(b(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");let m=[...u.values()];return o.set(t,m),m}intersects(e,t){if(!(e instanceof a))throw TypeError("a Range is required");return this.set.some(r=>E(r,t)&&e.set.some(e=>E(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(N(this.set[t],e,this.options))return!0;return!1}}e.exports=a;let o=new(r(8794)),i=r(8587),s=r(3904),l=r(7272),u=r(3908),c=r(5924),{safeRe:d,src:m,t:p,tildeTrimReplace:f,caretTrimReplace:h}=r(9718),{FLAG_INCLUDE_PRERELEASE:g,FLAG_LOOSE:y}=r(6874),v=RegExp(m[p.BUILD],"g"),b=e=>"<0.0.0-0"===e.value,w=e=>""===e.value,E=(e,t)=>{let r=!0,n=e.slice(),a=n.pop();for(;r&&n.length;)r=n.every(e=>a.intersects(e,t)),a=n.pop();return r},D=(e,t)=>(l("comp",e=e.replace(d[p.BUILD],""),t),l("caret",e=C(e,t)),l("tildes",e=_(e,t)),l("xrange",e=P(e,t)),l("stars",e=T(e,t)),e),x=e=>!e||"x"===e.toLowerCase()||"*"===e,_=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(" "),S=(e,t)=>{let r=t.loose?d[p.TILDELOOSE]:d[p.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,a,o,i)=>{let s;return l("tilde",e,t,r,a,o,i),x(r)?s="":x(a)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:x(o)?s=`>=${r}.${a}.0${n} <${r}.${+a+1}.0-0`:i?(l("replaceTilde pr",i),s=`>=${r}.${a}.${o}-${i} <${r}.${+a+1}.0-0`):s=`>=${r}.${a}.${o} <${r}.${+a+1}.0-0`,l("tilde return",s),s})},C=(e,t)=>e.trim().split(/\s+/).map(e=>k(e,t)).join(" "),k=(e,t)=>{l("caret",e,t);let r=t.loose?d[p.CARETLOOSE]:d[p.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,a,o,i)=>{let s;return l("caret",e,t,r,a,o,i),x(r)?s="":x(a)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:x(o)?s="0"===r?`>=${r}.${a}.0${n} <${r}.${+a+1}.0-0`:`>=${r}.${a}.0${n} <${+r+1}.0.0-0`:i?(l("replaceCaret pr",i),s="0"===r?"0"===a?`>=${r}.${a}.${o}-${i} <${r}.${a}.${+o+1}-0`:`>=${r}.${a}.${o}-${i} <${r}.${+a+1}.0-0`:`>=${r}.${a}.${o}-${i} <${+r+1}.0.0-0`):(l("no pr"),s="0"===r?"0"===a?`>=${r}.${a}.${o} <${r}.${a}.${+o+1}-0`:`>=${r}.${a}.${o} <${r}.${+a+1}.0-0`:`>=${r}.${a}.${o} <${+r+1}.0.0-0`),l("caret return",s),s})},P=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>R(e,t)).join(" ")),R=(e,t)=>{e=e.trim();let r=t.loose?d[p.XRANGELOOSE]:d[p.XRANGE];return e.replace(r,(r,n,a,o,i,s)=>{let u,c,d;if(l("xRange",e,r,n,a,o,i,s),u=a,c=o,d=i,x(u)&&!x(c)||x(c)&&d&&!x(d))return e;let m=x(a),p=m||x(o),f=p||x(i);return"="===n&&f&&(n=""),s=t.includePrerelease?"-0":"",m?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&f?(p&&(o=0),i=0,">"===n?(n=">=",p?(a=+a+1,o=0):o=+o+1,i=0):"<="===n&&(n="<",p?a=+a+1:o=+o+1),"<"===n&&(s="-0"),r=`${n+a}.${o}.${i}${s}`):p?r=`>=${a}.0.0${s} <${+a+1}.0.0-0`:f&&(r=`>=${a}.${o}.0${s} <${a}.${+o+1}.0-0`),l("xRange return",r),r})},T=(e,t)=>(l("replaceStars",e,t),e.trim().replace(d[p.STAR],"")),O=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(d[t.includePrerelease?p.GTE0PRE:p.GTE0],"")),$=e=>(t,r,n,a,o,i,s,l,u,c,d,m)=>(r=x(n)?"":x(a)?`>=${n}.0.0${e?"-0":""}`:x(o)?`>=${n}.${a}.0${e?"-0":""}`:i?`>=${r}`:`>=${r}${e?"-0":""}`,l=x(u)?"":x(c)?`<${+u+1}.0.0-0`:x(d)?`<${u}.${+c+1}.0-0`:m?`<=${u}.${c}.${d}-${m}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`,`${r} ${l}`.trim()),N=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==s.ANY&&e[r].semver.prerelease.length>0){let n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}},3908(e,t,r){"use strict";let n=r(7272),{MAX_LENGTH:a,MAX_SAFE_INTEGER:o}=r(6874),{safeRe:i,t:s}=r(9718),l=r(8587),{compareIdentifiers:u}=r(1123);class c{constructor(e,t){if(t=l(t),e instanceof c)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else e=e.version;else if("string"!=typeof e)throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>a)throw TypeError(`version is longer than ${a} characters`);n("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?i[s.LOOSE]:i[s.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>o||this.major<0)throw TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<o)return t}return e}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(n("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return(e instanceof c||(e=new c(e,this.options)),this.major<e.major)?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:+(this.patch>e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return -1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],a=e.prerelease[t];if(n("prerelease compare",t,r,a),void 0===r&&void 0===a)return 0;if(void 0===a)return 1;if(void 0===r)return -1;else if(r===a)continue;else return u(r,a)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{let r=this.build[t],a=e.build[t];if(n("build compare",t,r,a),void 0===r&&void 0===a)return 0;if(void 0===a)return 1;if(void 0===r)return -1;else if(r===a)continue;else return u(r,a)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw Error("invalid increment argument: identifier is empty");if(t){let e=`-${t}`.match(this.options.loose?i[s.PRERELEASELOOSE]:i[s.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(0!==this.minor||0!==this.patch||0===this.prerelease.length)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(0!==this.patch||0===this.prerelease.length)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{let e=+!!Number(r);if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),((e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let t=0;t<r.length;t++)if(0!==u(e[t],r[t]))return!1;return!0})(this.prerelease,t)?isNaN(this.prerelease[t.split(".").length])&&(this.prerelease=n):this.prerelease=n}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=c},2111(e,t,r){"use strict";let n=r(4641),a=r(3999),o=r(5580),i=r(4089),s=r(7059),l=r(5200);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return n(e,r,u);case"!=":return a(e,r,u);case">":return o(e,r,u);case">=":return i(e,r,u);case"<":return s(e,r,u);case"<=":return l(e,r,u);default:throw TypeError(`Invalid operator: ${t}`)}}},560(e,t,r){"use strict";let n=r(3908);e.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))},4641(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0===n(e,t,r)},5580(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>n(e,t,r)>0},4089(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>n(e,t,r)>=0},7059(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0>n(e,t,r)},5200(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0>=n(e,t,r)},3999(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0!==n(e,t,r)},7638(e,t,r){"use strict";let n=r(8311);e.exports=(e,t,r)=>{try{t=new n(t,r)}catch(e){return!1}return t.test(e)}},6874(e){"use strict";e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||0x1fffffffffffff,WHITESPACE_CHARACTERS:[" ","\n","\v","\f","\r"," ","\xa0"," "," "," "," "," "," "," "," "," "," "," "," ","\u2028","\u2029"," "," "," ","\uFEFF"],RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},7272(e){"use strict";e.exports="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}},1123(e){"use strict";let t=/^[0-9]+$/,r=(e,r)=>{if("number"==typeof e&&"number"==typeof r)return e===r?0:e<r?-1:1;let n=t.test(e),a=t.test(r);return n&&a&&(e*=1,r*=1),e===r?0:n&&!a?-1:a&&!n?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},8794(e){"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(void 0!==t)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},8587(e){"use strict";let t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},9718(e,t,r){"use strict";let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:a,MAX_LENGTH:o}=r(6874),i=r(7272),s=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],d=t.t={},m=0,p="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",o],[p,a]],h=(e,t,r)=>{let n=(e=>{for(let[t,r]of f)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),a=m++;i(e,a,t),d[e]=a,u[a]=t,c[a]=n,s[a]=new RegExp(t,r?"g":void 0),l[a]=new RegExp(n,r?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),h("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${p}+`),h("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),h("FULL",`^${u[d.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),h("LOOSE",`^${u[d.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),h("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?`+`(?:${u[d.BUILD]})?`+"(?:$|[^\\d])"),h("COERCERTL",u[d.COERCE],!0),h("COERCERTLFULL",u[d.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},5924(e,t,r){"use strict";let{MAX_LENGTH:n,MAX_SAFE_BUILD_LENGTH:a,WHITESPACE_CHARACTERS:o}=r(6874),i=new Uint8Array(65536);for(let e of o)i[e.charCodeAt(0)]=1;let s=e=>void 0!==e&&1===i[e.charCodeAt(0)],l=e=>"v"===e||"="===e||s(e),u=e=>void 0!==e&&e>="0"&&e<="9",c=e=>void 0!==e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),d=e=>u(e)||c(e)||"-"===e,m=e=>u(e)||"x"===e||"X"===e||"*"===e,p=(e,t,r,n)=>{if(!u(e[t]))return t;if(t>=n.start&&t<n.end)return Math.min(t+r,n.end);if(t>=n.previousStart&&t<n.previousEnd)return Math.min(t+r,n.previousEnd);let a=t+1;for(;u(e[a]);)a++;return n.previousStart=n.start,n.previousEnd=n.end,n.start=t,n.end=a,Math.min(t+r,a)},f=(e,t,r,a)=>r||"0"!==e[t]?p(e,t,r?n:n+1,a):t+1,h=(e,t,r,o)=>{let i=p(e,t,n,o);if(c(e[i])||"-"===e[i]){let t=i+1,r=t+a;for(;t<r&&d(e[t]);)t++;return t}return f(e,t,r,o)},g=(e,t,r,n)=>{let a="-"===e[t];if(!r&&!a)return t;let o=t+ +!!a,i=h(e,o,r,n);if(i===o){if(!r||!a)return t;i=h(e,t,r,n)}for(;"."===e[i];){let t=h(e,i+1,r,n);if(t===i+1)break;i=t}return i},y=(e,t)=>{let r=t;for(;r-t<a&&d(e[r]);)r++;return r},v=(e,t)=>{if("+"!==e[t])return t;let r=y(e,t+1);if(r===t+1)return t;for(;"."===e[r];){let t=y(e,r+1);if(t===r+1)break;r=t}return r},b=(e,t,r)=>u(e[t])?f(e,t,!1,r):m(e[t])?t+1:t,w=(e,t,r)=>{let n=((e,t,r)=>{let n=t;for(let a=0;a<3;a++){let o=f(e,n,!0,r);if(o===n)return t;if(n=o,a<2){if("."!==e[n])return t;n++}}let a=g(e,n,!0,r);return v(e,a)})(e,t,r);return n!==t?n:((e,t,r)=>{let n=b(e,t,r);for(let t=0;t<2;t++){if("."!==e[n])return n;let t=b(e,n+1,r);if(t===n+1)return n;n=t}let a=g(e,n,!1,r);return v(e,a)})(e,t,r)},E=(e,t)=>{let r=t;return s(e[r])&&r++,("<"===e[r]||">"===e[r])&&r++,"="===e[r]&&r++,s(e[r])?r:-1};e.exports=e=>{let t="",r=0,n=0,a={start:-1,end:-1,previousStart:-1,previousEnd:-1};for(;n<e.length;){let o=n;if("<"===e[n]||">"===e[n])n++;else if(!l(e[n])&&!m(e[n])){n++;continue}for(;n<e.length&&l(e[n]);)n++;if(!m(e[n]))continue;let i=E(e,o);-1!==i&&(t+=e.slice(r,i),r=i+1),n=w(e,n,a)}return t+e.slice(r)}},5067(e,t,r){"use strict";let n,a,o,i,s,l,u,c,d,m;r.r(t),r.d(t,{GenderUnknownIcon:()=>di,evaluateAsNumber:()=>iL,getImportMapOverrideMap:()=>oN,StockManagementPictogram:()=>xp,ChemistryIcon:()=>cJ,BabyIcon:()=>cB,DashboardExtension:()=>mi,openmrsComponentDecorator:()=>lZ,tryRegisterExtension:()=>ci,pictogramIds:()=>DK,ActivityIcon:()=>cI,compile:()=>iU,removeRouteMapOverride:()=>o7,TableBatchActions:()=>cD,getAsyncLifecycle:()=>lq,subscribeOpenmrsEvent:()=>im,PasswordIcon:()=>dT,Assessment2Pictogram:()=>Dq,CloseIcon:()=>c4,setupRouteMapOverrides:()=>ir,useFeatureFlag:()=>ub,reset:()=>sY,ConceptDictionaryPictogram:()=>D0,LabOrderIcon:()=>dg,VisitMode:()=>ib,isTranslationInspectorRecording:()=>aj,useLocations:()=>uW,getLifecycle:()=>lY,formatDatetime:()=>wz,getVisitsForPatient:()=>ik,formatPartialDate:()=>wV,CustomOverflowMenu:()=>cR,LocationIcon:()=>dv,GroupIcon:()=>dl,createUseStore:()=>lv,VisitStatus:()=>iw,getSessionLocation:()=>os,getCurrentImportMap:()=>oz,usePatient:()=>uq,useRenderableExtensions:()=>uQ,getOpenedWindowIndexByWorkspace:()=>s6,setLeftNav:()=>sJ,clearHistory:()=>aq,clearConfigErrors:()=>au,formatTime:()=>wH,isDevEnabled:()=>og,CohortsPictogram:()=>DQ,closeWorkspaceGroup2:()=>xB,getCurrentRouteMap:()=>o3,ConfigurableLink:()=>ld,sessionStore:()=>a5,setSessionLocale:()=>ou,subscribeSnackbarShown:()=>_,getLoggedInUser:()=>oi,GenderMaleIcon:()=>dn,getExtensionSlotConfigFromStore:()=>n_,evaluateAsNumberAsync:()=>iF,getImportMapDefaultMap:()=>oO,unregisterExtensionRendering:()=>sh,implementerToolsConfigStore:()=>nA,Type:()=>nc,InPatientPictogram:()=>D7,cleanupObsoleteFeatureFlags:()=>se,getAttachmentsUrl:()=>is,showSnackbar:()=>xP,PatientBannerActionsMenu:()=>DF,PatientSearchPictogram:()=>xo,DocumentAttachmentIcon:()=>c5,Snackbar:()=>xx,CardiologyPictogram:()=>DX,ImageMedicalIcon:()=>dd,ActionableNotificationComponent:()=>Da,DiagnosisTags:()=>EU,openChildWorkspaceInWindow:()=>xZ,iconIds:()=>cN,PatientsPictogram:()=>xi,interpolateUrl:()=>aU,setupHistory:()=>aG,subscribeToastShown:()=>x,detachAll:()=>sH,convertToLocaleCalendar:()=>wK,DocumentIcon:()=>c6,configInternalStore:()=>nv,ActionMenuButton2:()=>_y,setupDynamicOfflineDataHandler:()=>_V,makeUrl:()=>a2,oneOf:()=>ay,selectPreferredName:()=>Dk,MobileCheckIcon:()=>d_,createErrorHandler:()=>k,parseDate:()=>wM,getAttachmentByUuid:()=>io,LeftNavMenu:()=>EY,getExtensionRegistration:()=>sB,dispatchToastShown:()=>w,ShoppingCartAddItemIcon:()=>mn,ReferralOrderIcon:()=>dj,ReportIcon:()=>dL,getImportMapNextPageMap:()=>o$,registerExtension:()=>sV,setupOfflineSync:()=>_B,DownloadIcon:()=>c9,useConnectivity:()=>_K,provide:()=>nQ,ShoppingCartArrowDownIcon:()=>dz,featureFlagsStore:()=>i8,jsep:()=>iR,GeriatricsPictogram:()=>D9,SearchIcon:()=>dV,reportError:()=>C,slugify:()=>oU,isOmrsDateToday:()=>w$,getExtensionStore:()=>sg,BloodBankPictogram:()=>DJ,TriagePictogram:()=>xg,Workspace2:()=>x3,refetchCurrentUser:()=>on,CheckmarkOutlineIcon:()=>cq,registerExtensionSlot:()=>sZ,AllergiesIcon:()=>d7,ArrowDownIcon:()=>cj,useOpenmrsInfinite:()=>uR,getExtensionConfigFromExtensionSlotStore:()=>nk,OpenmrsDatePicker:()=>E_,getExtensionConfigFromStore:()=>nC,getDynamicOfflineDataEntries:()=>_U,getLocaleDisplayName:()=>b6,messageOmrsServiceWorker:()=>_H,navigate:()=>aH,launchWorkspace2:()=>xV,getGroupByWindowName:()=>s3,CustomOverflowMenuItem:()=>cT,isUrl:()=>ag,CaretDownIcon:()=>cW,ArrowLeftIcon:()=>cA,FacilityPictogram:()=>D5,ViewOffIcon:()=>d5,updateInternalExtensionStore:()=>su,dispatchActionableNotificationShown:()=>v,resetRouteMapOverrides:()=>ie,formatDurationBetween:()=>w0,defaultVisitCustomRepresentation:()=>iE,getBreadcrumbsFor:()=>aC,useOpenmrsPagination:()=>uE,Pagination:()=>DD,CheckmarkFilledIcon:()=>cY,clearCurrentUser:()=>oa,showModal:()=>E7,ChevronUpIcon:()=>c1,saveVisit:()=>iS,useAttachments:()=>un,Pictogram:()=>xE,useExtensionSlot:()=>l_,ChevronDownIcon:()=>cX,OpenmrsDateRangePicker:()=>ES,deleteAttachmentPermanently:()=>iu,getVisitTypes:()=>iv,OverflowMenuHorizontalIcon:()=>dP,EventScheduleIcon:()=>de,getSessionStore:()=>ot,ProcedureOrderIcon:()=>dI,preloadImport:()=>oH,registerWorkspaceWindows2:()=>s9,useOnVisible:()=>uz,setSessionLocation:()=>ol,userHasAccess:()=>oo,ChartAverageIcon:()=>cG,getFeatureFlag:()=>st,UserAvatarIcon:()=>d4,renderExtension:()=>li,useFhirInfinite:()=>uj,toVisitTypeObject:()=>ig,useSession:()=>u0,EmergencyDepartmentPictogram:()=>D6,Notification:()=>Dr,dispatchSnackbarShown:()=>b,formatDate:()=>wU,workspace2StoreActions:()=>xJ,SwitcherIcon:()=>dW,esmStyleGuideSchema:()=>cb,getImportMapDisabledOverrides:()=>oI,useAssignedExtensionIds:()=>ut,CaretRightIcon:()=>cz,evaluateAsType:()=>iB,PageHeader:()=>Dw,TranslateIcon:()=>dX,setUserProperties:()=>oc,MovementIcon:()=>dk,renderInlineNotifications:()=>Dd,subscribePrecacheStaticDependencies:()=>_z,PaymentsDeskPictogram:()=>xs,usePrimaryIdentifierCode:()=>uJ,useLayoutType:()=>uL,getCurrentUser:()=>oe,closeWorkspaceInWindow:()=>xG,XrayPictogram:()=>xy,CaretUpIcon:()=>cK,renderActionableNotifications:()=>Dp,OpenmrsAppContext:()=>l5,setupModals:()=>E8,getDefaultsFromConfigSchema:()=>function e(t){let r={};for(let n of Object.keys(t))if(_I(t[n])&&t[n].hasOwnProperty("_default"))r[n]=t[n]._default;else{if(n.startsWith("_"))continue;_I(t[n])?r[n]=e(t[n]):r[n]=t[n]}return r},subscribeTo:()=>W,recordConfigDerivationError:()=>nM,useAbortController:()=>l8,Extension:()=>lm,getFhirServerPaginationHandlers:()=>uS,useConnectedExtensions:()=>uu,registerApp:()=>cl,HospitalBedIcon:()=>dc,useExtensionInternalStore:()=>ug,configExtensionStore:()=>nw,getSynchronizationItems:()=>_W,getExtensionSlotsConfigStore:()=>nD,registerExtensionRendering:()=>sf,RenderIfValueIsTruthy:()=>l9,registerFeatureFlag:()=>i7,useFhirFetchAll:()=>uM,restBaseUrl:()=>a0,CalendarHeatMapIcon:()=>cV,isImportMapOverrideDisabled:()=>oM,resetConfigSystem:()=>ac,getExtensionInternalStore:()=>ss,registerGlobalStore:()=>V,evaluateAsBoolean:()=>ij,PatientBannerPatientInfo:()=>DA,addRouteMapOverride:()=>o8,getDefaultCalendar:()=>wF,SettingsIcon:()=>dU,DrugOrderIcon:()=>c8,ProgramsIcon:()=>dM,useAssignedExtensions:()=>lx,CloseFilledIcon:()=>c2,canAccessStorage:()=>_N,registerDefaultCalendar:()=>wL,TreeViewAltIcon:()=>d0,OverflowMenuVerticalIcon:()=>dR,clearConfigDerivationError:()=>nj,getConfigStore:()=>nE,InformationSquareIcon:()=>df,EmptyCard:()=>EK,ChevronLeftIcon:()=>cQ,RadiologyIcon:()=>mr,useCandidateExtensions:()=>ur,renderToasts:()=>xN,isDesktop:()=>uF,integrateBreakpoints:()=>cp,RegistrationPictogram:()=>xc,CardHeader:()=>cg,getExtensionRegistrationFrom:()=>sF,InformationIcon:()=>dm,SystemAdministrationPictogram:()=>xf,TrashCanIcon:()=>dQ,useShallowStableValue:()=>lp,PatientDocumentsPictogram:()=>xa,useOpenmrsSWR:()=>uK,Assessment1Pictogram:()=>DY,finishRegisteringAllApps:()=>cu,importDynamic:()=>oW,useFhirPagination:()=>u_,useVisitContextStore:()=>u8,ArrowUpIcon:()=>cF,matchTranslations:()=>aL,showActionableNotification:()=>Df,useForceUpdate:()=>uw,useVisit:()=>u7,PatientBannerPatientIdentifiers:()=>DN,TransferPictogram:()=>xh,usePagination:()=>uG,Breakpoint:()=>cc,PatientBannerToggleContactDetailsButton:()=>_v,CloseOutlineIcon:()=>c3,openmrsFetchAll:()=>ov,ObstetricsPictogram:()=>xn,parseDateInput:()=>wZ,ReportsPictogram:()=>xd,getConfig:()=>n1,attach:()=>sU,getLocale:()=>b5,isUrlWithTemplateParameters:()=>ah,useEmrConfiguration:()=>uf,useLeftNav:()=>uB,ToolsIcon:()=>dJ,ErrorState:()=>EG,detach:()=>sW,setCurrentVisit:()=>i_,ConditionsIcon:()=>mt,SaveIcon:()=>dB,useConfig:()=>ul,validator:()=>nd,CalendarIcon:()=>cU,getHistory:()=>aZ,StickyNoteAddIcon:()=>dK,useWorkspace2Store:()=>xX,getPatientName:()=>Dx,getVisitStore:()=>ix,getCoreTranslation:()=>aV,registerModuleWithConfigSystem:()=>nY,updateOpenedWorkspaceInWindow:()=>xY,registerModuleLoad:()=>nq,getBreadcrumbs:()=>ax,extractVariableNames:()=>i6,translateFrom:()=>aB,useStoreWithActions:()=>ly,EditIcon:()=>c7,getCandidateExtensions:()=>sG,shallowEqual:()=>R,subscribeNotificationShown:()=>E,MaximizeIcon:()=>dw,promptForClosingWorkspaces:()=>xz,WarningIcon:()=>d8,fhirBaseUrl:()=>a1,matchLocale:()=>_$,usePatientPhoto:()=>DU,registerBreadcrumb:()=>aE,EventsIcon:()=>dt,createGlobalStore:()=>F,subscribeToFeatureFlag:()=>sr,useExtensionStore:()=>uv,createAttachment:()=>il,useLeftNavStore:()=>uV,TableIcon:()=>dY,Icon:()=>mo,InformationFilledIcon:()=>dp,getCurrentPageMap:()=>oT,LaboratoryPictogram:()=>xe,temporaryConfigStore:()=>nb,toDateObjectStrict:()=>wN,defineConfigSchema:()=>nZ,filterBreadcrumbs:()=>aS,invalidateImplementerToolsConfig:()=>nN,PatientBannerContactDetails:()=>__,getAssignedExtensions:()=>sK,promptForClosingWorkspacesInWindow:()=>xK,PatientPhoto:()=>Dz,MaterialOrderIcon:()=>db,MicroscopeIcon:()=>dx,visitTypesUrl:()=>iy,getOpenedWindowWidth:()=>x1,scheduleRecomputation:()=>sE,PharmacyPictogram:()=>xl,AttachmentIcon:()=>me,MoneyIcon:()=>dS,getAttachments:()=>ii,PageHeaderContent:()=>DE,MedicationIcon:()=>dE,PrinterIcon:()=>dN,PatientListsPictogram:()=>xb,useAppContext:()=>l7,isOpenmrsRoutes:()=>oZ,AppointmentsAltPictogram:()=>DZ,GenericOrderTypeIcon:()=>ds,batchExtensionUpdates:()=>sb,useExtensionSlotStore:()=>lE,ViewIcon:()=>d9,formattedName:()=>DC,sessionEndpoint:()=>a4,duration:()=>wX,resetImportMapOverrides:()=>oL,TableOfContentsIcon:()=>dZ,CaretLeftIcon:()=>cH,getTranslationOverrides:()=>n4,isVersionSatisfied:()=>_A,EmptyCardIllustration:()=>Ez,PenIcon:()=>d$,recordTranslationSighting:()=>aA,validators:()=>av,setupImportMapOverrides:()=>oV,showToast:()=>xI,useDefineAppContext:()=>l6,verifyTotpCode:()=>od,getGlobalStore:()=>U,useOnClickOutside:()=>uH,getWindowByWorkspaceName:()=>s2,ArrowRightIcon:()=>cL,disableTranslationInspector:()=>aM,loadLifeCycles:()=>cn,registerBreadcrumbs:()=>aD,MotherIcon:()=>dC,extensionNamespaceSeparator:()=>aO,fetchCurrentPatient:()=>ic,Toast:()=>xR,MessageQueueIcon:()=>dD,TwoFactorAuthenticationIcon:()=>d1,Pharmacy2Pictogram:()=>xu,goBackInHistory:()=>aY,GroupAccessIcon:()=>du,getExtensionRenderingsStore:()=>sl,setImplementerToolsConfigRecomputer:()=>n$,getAsyncExtensionLifecycle:()=>lX,setupApiModule:()=>ob,renderLoadingSpinner:()=>_S,showNotification:()=>Dm,getModalRegistration:()=>s1,ListCheckedIcon:()=>dy,ResponsiveWrapper:()=>xD,GynaecologyPictogram:()=>D8,ShoppingCartIcon:()=>dH,getRouteMapNextPageMap:()=>o5,MetadataExportPictogram:()=>xr,updateVisit:()=>iC,backendDependencies:()=>oy,MaybePictogram:()=>xw,createParcelMounter:()=>la,openmrsFetch:()=>a3,useStore:()=>lg,isOpenmrsAppRoutes:()=>oG,ExportedWorkspace:()=>_d,DentistryPictogram:()=>D2,HomePictogram:()=>xv,ServiceQueuesPictogram:()=>xm,createExportedWorkspaceWindow:()=>x2,setFeatureFlag:()=>sn,toLanguageTag:()=>b3,DigitalTrustPictogram:()=>D3,NumericObservation:()=>Dv,attachmentUrl:()=>ia,interpolateString:()=>aW,inRange:()=>af,useExtensionSlotMeta:()=>uy,AppointmentsPictogram:()=>DG,renderSnackbars:()=>xk,getRegisteredWorkspace2Names:()=>x0,logout:()=>om,toLocationObject:()=>ip,ChartLineIcon:()=>cZ,UserHasAccess:()=>u1,evaluateAsBooleanAsync:()=>iA,createDashboard:()=>ms,getLocations:()=>ih,useExtensionContext:()=>uh,getExtensionsConfigStore:()=>nS,getRouteMapDefaultMap:()=>o6,age:()=>DR,isOmrsDateStrict:()=>wO,registerWorkspaceGroups2:()=>s5,usePaginationInfo:()=>uZ,evaluateAsync:()=>iM,useOpenmrsFetchAll:()=>uN,removeImportMapOverride:()=>oA,useVisitTypes:()=>ct,ageAsDuration:()=>DP,getExtensionNameFromId:()=>sL,DataEntryPictogram:()=>D4,renderParcel:()=>ln,ResetIcon:()=>dF,RenewIcon:()=>dA,useWorkspace2Context:()=>xQ,subscribeActionableNotificationShown:()=>D,ErrorCard:()=>EZ,GenderFemaleIcon:()=>dr,enableImportMapOverride:()=>oF,enableTranslationInspector:()=>aI,retry:()=>_L,ComponentContext:()=>lu,ExtensionSlot:()=>lC,unsetLeftNav:()=>sX,addImportMapOverride:()=>oj,MaybeIcon:()=>ma,useCustomOverflowMenu:()=>cP,PedestrianFamilyIcon:()=>dO,CtScanPictogram:()=>D1,dispatchNotificationShown:()=>y,leftNavStore:()=>sq,OpenmrsFetchError:()=>a6,UserFollowIcon:()=>d2,launchWorkspaceGroup2:()=>xF,ChevronRightIcon:()=>c0,UserXrayIcon:()=>d3,GenderOtherIcon:()=>da,formatDuration:()=>wG,toOmrsIsoString:()=>wI,Labs2Pictogram:()=>xt,workspace2Store:()=>s4,setUserLanguage:()=>or,useBodyScrollLock:()=>ua,SyringeIcon:()=>dG,LocationPicker:()=>Eq,useDebounce:()=>uc,TimeIcon:()=>dq,getExtensionSlotConfig:()=>nx,AddIcon:()=>cM,getRouteMapOverrideMap:()=>o9,processConfig:()=>n2,InventoryManagementIcon:()=>dh,registerWorkspaces2:()=>s8,UserIcon:()=>d6,formatPatientName:()=>DS,fireOpenmrsEvent:()=>id,registerModal:()=>s0,registerTranslationNamespace:()=>nJ,displayName:()=>D_,createLocalStore:()=>B,evaluate:()=>iI,defineExtensionConfigSchema:()=>nX,getSyncLifecycle:()=>lJ,renderWorkspaceWindowsAndMenu:()=>_R,evaluateAsTypeAsync:()=>iV});let p="openmrs:notification-shown",f="openmrs:actionable-notification-shown",h="openmrs:toast-shown",g="openmrs:snack-bar-shown";function y(e){window.dispatchEvent(new CustomEvent(p,{detail:e}))}function v(e){window.dispatchEvent(new CustomEvent(f,{detail:e}))}function b(e){window.dispatchEvent(new CustomEvent(g,{detail:e}))}function w(e){window.dispatchEvent(new CustomEvent(h,{detail:e}))}function E(e){let t=t=>e(t.detail);return window.addEventListener(p,t),()=>window.removeEventListener(p,t)}function D(e){let t=t=>e(t.detail);return window.addEventListener(f,t),()=>window.removeEventListener(f,t)}function x(e){let t=t=>e(t.detail);return window.addEventListener(h,t),()=>window.removeEventListener(h,t)}function _(e){let t=t=>e(t.detail);return window.addEventListener(g,t),()=>window.removeEventListener(g,t)}function S(e,t){let{message:r}=P(e);return"string"==typeof r&&r?r:t}function C(e){let t=P(e);setTimeout(()=>{throw t})}function k(){let e=Error();return t=>{let r=P(t);r.stack+=`
1
+ (globalThis.webpackChunk_openmrs_esm_report_builder=globalThis.webpackChunk_openmrs_esm_report_builder||[]).push([["6696"],{7581(e){e.exports=function(e,t,r){t.prototype.isToday=function(){var e="YYYY-MM-DD",t=r();return this.format(e)===t.format(e)}}},5238(e){e.exports=function(e,t,r){var n=t.prototype,a=function(e){var t=e.date,a=e.utc,o={};if(!(null===t||t instanceof Date||t instanceof Array||n.$utils().u(t)||"Object"!==t.constructor.name)){if(!Object.keys(t).length)return new Date;var i=a?r.utc():r();Object.keys(t).forEach(function(e){var r;o["date"===(r=n.$utils().p(e))?"day":r]=t[e]});var s=o.day||(o.year||o.month>=0?1:i.date()),l=o.year||i.year(),u=o.month>=0?o.month:o.year||o.day?0:i.month(),c=o.hour||0,d=o.minute||0,m=o.second||0,p=o.millisecond||0;return a?new Date(Date.UTC(l,u,s,c,d,m,p)):new Date(l,u,s,c,d,m,p)}return t},o=n.parse;n.parse=function(e){e.date=a.bind(this)(e),o.bind(this)(e)};var i=n.set,s=n.add,l=n.subtract,u=function(e,t,r,n){void 0===n&&(n=1);var a=Object.keys(t),o=this;return a.forEach(function(r){o=e.bind(o)(t[r]*n,r)}),o};n.set=function(e,t){return t=void 0===t?e:t,"Object"===e.constructor.name?u.bind(this)(function(e,t){return i.bind(this)(t,e)},t,e):i.bind(this)(e,t)},n.add=function(e,t){return"Object"===e.constructor.name?u.bind(this)(s,e,t):s.bind(this)(e,t)},n.subtract=function(e,t){return"Object"===e.constructor.name?u.bind(this)(s,e,t,-1):l.bind(this)(e,t)}}},3826(e){e.exports=function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,a,o){var i=a.prototype;o.utc=function(e){var t={date:e,utc:!0,args:arguments};return new a(t)},i.utc=function(t){var r=o(this.toDate(),{locale:this.$L,utc:!0});return t?r.add(this.utcOffset(),e):r},i.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var s=i.parse;i.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),s.call(this,e)};var l=i.init;i.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else l.call(this)};var u=i.utcOffset;i.utcOffset=function(n,a){var o=this.$utils().u;if(o(n))return this.$u?0:o(this.$offset)?u.call(this):this.$offset;if("string"==typeof n&&null===(n=function(e){void 0===e&&(e="");var n=e.match(t);if(!n)return null;var a=(""+n[0]).match(r)||["-",0,0],o=a[0],i=60*a[1]+ +a[2];return 0===i?0:"+"===o?i:-i}(n)))return this;var i=16>=Math.abs(n)?60*n:n;if(0===i)return this.utc(a);var s=this.clone();if(a)return s.$offset=i,s.$u=!1,s;var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(s=this.local().add(i+l,e)).$offset=i,s.$x.$localOffset=l,s};var c=i.format;i.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,t)},i.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var d=i.toDate;i.toDate=function(e){return"s"===e&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var m=i.diff;i.diff=function(e,t,r){if(e&&this.$u===e.$u)return m.call(this,e,t,r);var n=this.local(),a=o(e).local();return m.call(n,a,t,r)}}}()},2849(e){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;function n(e){if(!e||"[object Object]"!==r.call(e)||e.nodeType||e.setInterval)return!1;var n,a=t.call(e,"constructor"),o=t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!a&&!o)return!1;for(n in e);return void 0===n||t.call(e,n)}e.exports=function e(){var t,r,a,o,i,s,l=arguments[0]||{},u=1,c=arguments.length,d=!1;for("boolean"==typeof l&&(d=l,l=arguments[1]||{},u=2),"object"!=typeof l&&"function"!=typeof l&&(l={});u<c;u++)if(null!=(t=arguments[u]))for(r in t)a=l[r],l!==(o=t[r])&&(d&&o&&(n(o)||(i=Array.isArray(o)))?(i?(i=!1,s=a&&Array.isArray(a)?a:[]):s=a&&n(a)?a:{},l[r]=e(d,s,o)):void 0!==o&&(l[r]=o));return l}},6767(e,t,r){!function(t){"use strict";var n=r(6974);function a(e){return function(t,r){return"object"==typeof t&&(r=t,t=null),null==t&&(t=new Date().toString()),r||(r={}),e.call(this,t,r)}}var o=e.exports={generate:a(function(e,t){return new n(e,t)})};t&&(t.fn.geopattern=a(function(e,r){return this.each(function(){var n=t(this).attr("data-title-sha");n&&(r=t.extend({hash:n},r));var a=o.generate(e,r);t(this).css("background-image",a.toDataUrl())})}))}("u">typeof jQuery?jQuery:null)},2467(e){"use strict";e.exports={hex2rgb:function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,r,n){return t+t+r+r+n+n});var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},rgb2hex:function(e){return"#"+["r","g","b"].map(function(t){return("0"+e[t].toString(16)).slice(-2)}).join("")},rgb2hsl:function(e){var t,r,n=e.r,a=e.g,o=e.b,i=Math.max(n/=255,a/=255,o/=255),s=Math.min(n,a,o),l=(i+s)/2;if(i===s)t=r=0;else{var u=i-s;switch(r=l>.5?u/(2-i-s):u/(i+s),i){case n:t=(a-o)/u+6*(a<o);break;case a:t=(o-n)/u+2;break;case o:t=(n-a)/u+4}t/=6}return{h:t,s:r,l:l}},hsl2rgb:function(e){function t(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}var r,n,a,o=e.h,i=e.s,s=e.l;if(0===i)r=n=a=s;else{var l=s<.5?s*(1+i):s+i-s*i,u=2*s-l;r=t(u,l,o+1/3),n=t(u,l,o),a=t(u,l,o-1/3)}return{r:Math.round(255*r),g:Math.round(255*n),b:Math.round(255*a)}},rgb2rgbString:function(e){return"rgb("+[e.r,e.g,e.b].join(",")+")"}}},6974(e,t,r){"use strict";var n=r(2849),a=r(2467),o=r(6743),i=r(8502),s={baseColor:"#933c3c"},l=["octogons","overlappingCircles","plusSigns","xes","sineWaves","hexagons","overlappingRings","plaid","triangles","squares","concentricCircles","diamonds","tessellation","nestedSquares","mosaicSquares","chevrons"],u="#000";function c(e,t,r){return parseInt(e.substr(t,r||1),16)}function d(e,t,r,n,a){return(parseFloat(e)-t)*(a-n)/(r-t)+n}function m(e){return e%2==0?"#ddd":"#222"}function p(e){return d(e,0,15,.02,.15)}var f=e.exports=function(e,t){return this.opts=n({},s,t),this.hash=t.hash||o(e),this.svg=new i,this.generateBackground(),this.generatePattern(),this};function h(e){return[[e,0,e,3*e],[0,e,3*e,e]]}function g(e){return[0,0,e,e,0,e,0,0].join(",")}function y(e,t,r,n,a){var o=g(n),i=p(a[0]),s=m(a[0]),l={stroke:u,"stroke-opacity":.02,"fill-opacity":i,fill:s};e.polyline(o,l).transform({translate:[t+n,r],scale:[-1,1]}),e.polyline(o,l).transform({translate:[t+n,r+2*n],scale:[1,-1]}),l={stroke:u,"stroke-opacity":.02,"fill-opacity":i=p(a[1]),fill:s=m(a[1])},e.polyline(o,l).transform({translate:[t+n,r+2*n],scale:[-1,-1]}),e.polyline(o,l).transform({translate:[t+n,r],scale:[1,1]})}function v(e,t,r,n,a){var o=p(a),i=m(a),s=g(n),l={stroke:u,"stroke-opacity":.02,"fill-opacity":o,fill:i};e.polyline(s,l).transform({translate:[t,r+n],scale:[1,-1]}),e.polyline(s,l).transform({translate:[t+2*n,r+n],scale:[-1,-1]}),e.polyline(s,l).transform({translate:[t,r+n],scale:[1,1]}),e.polyline(s,l).transform({translate:[t+2*n,r+n],scale:[-1,1]})}f.prototype.toSvg=function(){return this.svg.toString()},f.prototype.toString=function(){return this.toSvg()},f.prototype.toBase64=function(){var e=this.toSvg();return"u">typeof window&&"function"==typeof window.btoa?window.btoa(e):new Buffer(e).toString("base64")},f.prototype.toDataUri=function(){return"data:image/svg+xml;base64,"+this.toBase64()},f.prototype.toDataUrl=function(){return'url("'+this.toDataUri()+'")'},f.prototype.generateBackground=function(){var e,t,r,n;this.opts.color?r=a.hex2rgb(this.opts.color):(t=d(c(this.hash,14,3),0,4095,0,359),n=c(this.hash,17),(e=a.rgb2hsl(a.hex2rgb(this.opts.baseColor))).h=(360*e.h-t+360)%360/360,n%2==0?e.s=Math.min(1,(100*e.s+n)/100):e.s=Math.max(0,(100*e.s-n)/100),r=a.hsl2rgb(e)),this.color=a.rgb2hex(r),this.svg.rect(0,0,"100%","100%",{fill:a.rgb2rgbString(r)})},f.prototype.generatePattern=function(){var e=this.opts.generator;if(e){if(0>l.indexOf(e))throw Error("The generator "+e+" does not exist.")}else e=l[c(this.hash,20)];return this["geo"+e.slice(0,1).toUpperCase()+e.slice(1)]()},f.prototype.geoHexagons=function(){var e,t,r,n,a,o,i,s,l,f=d(c(this.hash,0),0,15,8,60),h=f*Math.sqrt(3),g=2*f,y=(s=f/2,[0,l=Math.sin(60*Math.PI/180)*f,s,0,s+f,0,2*f,l,s+f,2*l,s,2*l,0,l].join(","));for(this.svg.setWidth(3*g+3*f),this.svg.setHeight(6*h),t=0,i=0;i<6;i++)for(o=0;o<6;o++)a=c(this.hash,t),e=o%2==0?i*h:i*h+h/2,r=p(a),n={fill:m(a),"fill-opacity":r,stroke:u,"stroke-opacity":.02},this.svg.polyline(y,n).transform({translate:[o*f*1.5-g/2,e-h/2]}),0===o&&this.svg.polyline(y,n).transform({translate:[6*f*1.5-g/2,e-h/2]}),0===i&&(e=o%2==0?6*h:6*h+h/2,this.svg.polyline(y,n).transform({translate:[o*f*1.5-g/2,e-h/2]})),0===o&&0===i&&this.svg.polyline(y,n).transform({translate:[6*f*1.5-g/2,5*h+h/2]}),t++},f.prototype.geoSineWaves=function(){var e,t,r,n,a,o,i,s=Math.floor(d(c(this.hash,0),0,15,100,400)),l=Math.floor(d(c(this.hash,1),0,15,30,100)),u=Math.floor(d(c(this.hash,2),0,15,3,30));for(this.svg.setWidth(s),this.svg.setHeight(36*u),t=0;t<36;t++)r=p(o=c(this.hash,t)),e=m(o),i=s/4*.7,a={fill:"none",stroke:e,opacity:r,"stroke-width":""+u+"px"},n="M0 "+l+" C "+i+" 0, "+(s/2-i)+" 0, "+s/2+" "+l+" S "+(s-i)+" "+2*l+", "+s+" "+l+" S "+(1.5*s-i)+" 0, "+1.5*s+", "+l,this.svg.path(n,a).transform({translate:[-s/4,u*t-1.5*l]}),this.svg.path(n,a).transform({translate:[-s/4,u*t-1.5*l+36*u]})},f.prototype.geoChevrons=function(){var e,t,r,n,a,o,i,s=d(c(this.hash,0),0,15,30,80),l=d(c(this.hash,0),0,15,30,80),f=(e=.66*l,[[0,0,s/2,l-e,s/2,l,0,e,0,0],[s/2,l-e,s,0,s,e,s/2,l,s/2,l-e]].map(function(e){return e.join(",")}));for(this.svg.setWidth(6*s),this.svg.setHeight(6*l*.66),t=0,i=0;i<6;i++)for(o=0;o<6;o++)r=p(a=c(this.hash,t)),n={stroke:u,"stroke-opacity":.02,fill:m(a),"fill-opacity":r,"stroke-width":1},this.svg.group(n).transform({translate:[o*s,i*l*.66-l/2]}).polyline(f).end(),0===i&&this.svg.group(n).transform({translate:[o*s,6*l*.66-l/2]}).polyline(f).end(),t+=1},f.prototype.geoPlusSigns=function(){var e,t,r,n,a,o,i,s,l=d(c(this.hash,0),0,15,10,25),f=3*l,g=h(l);for(this.svg.setWidth(12*l),this.svg.setHeight(12*l),r=0,s=0;s<6;s++)for(i=0;i<6;i++)n=p(o=c(this.hash,r)),t=m(o),e=+(s%2!=0),a={fill:t,stroke:u,"stroke-opacity":.02,"fill-opacity":n},this.svg.group(a).transform({translate:[i*f-i*l+e*l-l,s*f-s*l-f/2]}).rect(g).end(),0===i&&this.svg.group(a).transform({translate:[4*f-i*l+e*l-l,s*f-s*l-f/2]}).rect(g).end(),0===s&&this.svg.group(a).transform({translate:[i*f-i*l+e*l-l,4*f-s*l-f/2]}).rect(g).end(),0===i&&0===s&&this.svg.group(a).transform({translate:[4*f-i*l+e*l-l,4*f-s*l-f/2]}).rect(g).end(),r++},f.prototype.geoXes=function(){var e,t,r,n,a,o,i,s=d(c(this.hash,0),0,15,10,25),l=h(s),u=3*s*.943;for(this.svg.setWidth(3*u),this.svg.setHeight(3*u),t=0,i=0;i<6;i++)for(o=0;o<6;o++)r=p(a=c(this.hash,t)),e=o%2==0?i*u-.5*u:i*u-.5*u+u/4,n={fill:m(a),opacity:r},this.svg.group(n).transform({translate:[o*u/2-u/2,e-i*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),0===o&&this.svg.group(n).transform({translate:[6*u/2-u/2,e-i*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),0===i&&(e=o%2==0?6*u-u/2:6*u-u/2+u/4,this.svg.group(n).transform({translate:[o*u/2-u/2,e-6*u/2],rotate:[45,u/2,u/2]}).rect(l).end()),5===i&&this.svg.group(n).transform({translate:[o*u/2-u/2,e-11*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),0===o&&0===i&&this.svg.group(n).transform({translate:[6*u/2-u/2,e-6*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),t++},f.prototype.geoOverlappingCircles=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,25,200)/2;for(this.svg.setWidth(6*i),this.svg.setHeight(6*i),e=0,o=0;o<6;o++)for(a=0;a<6;a++)t=p(n=c(this.hash,e)),r={fill:m(n),opacity:t},this.svg.circle(a*i,o*i,i,r),0===a&&this.svg.circle(6*i,o*i,i,r),0===o&&this.svg.circle(a*i,6*i,i,r),0===a&&0===o&&this.svg.circle(6*i,6*i,i,r),e++},f.prototype.geoOctogons=function(){var e,t,r,n,a,o,i,s=d(c(this.hash,0),0,15,10,60),l=[e=.33*s,0,s-e,0,s,e,s,s-e,s-e,s,e,s,0,s-e,0,e,e,0].join(",");for(this.svg.setWidth(6*s),this.svg.setHeight(6*s),r=0,i=0;i<6;i++)for(o=0;o<6;o++)n=p(a=c(this.hash,r)),t=m(a),this.svg.polyline(l,{fill:t,"fill-opacity":n,stroke:u,"stroke-opacity":.02}).transform({translate:[o*s,i*s]}),r+=1},f.prototype.geoSquares=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,10,60);for(this.svg.setWidth(6*i),this.svg.setHeight(6*i),t=0,o=0;o<6;o++)for(a=0;a<6;a++)r=p(n=c(this.hash,t)),e=m(n),this.svg.rect(a*i,o*i,i,i,{fill:e,"fill-opacity":r,stroke:u,"stroke-opacity":.02}),t+=1},f.prototype.geoConcentricCircles=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,10,60),s=i/5;for(this.svg.setWidth((i+s)*6),this.svg.setHeight((i+s)*6),t=0,o=0;o<6;o++)for(a=0;a<6;a++)r=p(n=c(this.hash,t)),e=m(n),this.svg.circle(a*i+a*s+(i+s)/2,o*i+o*s+(i+s)/2,i/2,{fill:"none",stroke:e,opacity:r,"stroke-width":s+"px"}),r=p(n=c(this.hash,39-t)),e=m(n),this.svg.circle(a*i+a*s+(i+s)/2,o*i+o*s+(i+s)/2,i/4,{fill:e,"fill-opacity":r}),t+=1},f.prototype.geoOverlappingRings=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,10,60),s=i/4;for(this.svg.setWidth(6*i),this.svg.setHeight(6*i),e=0,o=0;o<6;o++)for(a=0;a<6;a++)t=p(n=c(this.hash,e)),r={fill:"none",stroke:m(n),opacity:t,"stroke-width":s+"px"},this.svg.circle(a*i,o*i,i-s/2,r),0===a&&this.svg.circle(6*i,o*i,i-s/2,r),0===o&&this.svg.circle(a*i,6*i,i-s/2,r),0===a&&0===o&&this.svg.circle(6*i,6*i,i-s/2,r),e+=1},f.prototype.geoTriangles=function(){var e,t,r,n,a,o,i,s,l=d(c(this.hash,0),0,15,15,80),f=l/2*Math.sqrt(3),h=[s=l/2,0,l,f,0,f,s,0].join(",");for(this.svg.setWidth(3*l),this.svg.setHeight(6*f),e=0,i=0;i<6;i++)for(o=0;o<6;o++)t=p(a=c(this.hash,e)),n={fill:m(a),"fill-opacity":t,stroke:u,"stroke-opacity":.02},r=i%2==0?180*(o%2==0):180*(o%2!=0),this.svg.polyline(h,n).transform({translate:[o*l*.5-l/2,f*i],rotate:[r,l/2,f/2]}),0===o&&this.svg.polyline(h,n).transform({translate:[6*l*.5-l/2,f*i],rotate:[r,l/2,f/2]}),e+=1},f.prototype.geoDiamonds=function(){var e,t,r,n,a,o,i,s=d(c(this.hash,0),0,15,10,50),l=d(c(this.hash,1),0,15,10,50),f=[s/2,0,s,l/2,s/2,l,0,l/2].join(",");for(this.svg.setWidth(6*s),this.svg.setHeight(3*l),t=0,i=0;i<6;i++)for(o=0;o<6;o++)r=p(a=c(this.hash,t)),n={fill:m(a),"fill-opacity":r,stroke:u,"stroke-opacity":.02},e=i%2==0?0:s/2,this.svg.polyline(f,n).transform({translate:[o*s-s/2+e,l/2*i-l/2]}),0===o&&this.svg.polyline(f,n).transform({translate:[6*s-s/2+e,l/2*i-l/2]}),0===i&&this.svg.polyline(f,n).transform({translate:[o*s-s/2+e,l/2*6-l/2]}),0===o&&0===i&&this.svg.polyline(f,n).transform({translate:[6*s-s/2+e,l/2*6-l/2]}),t+=1},f.prototype.geoNestedSquares=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,4,12),s=7*i;for(this.svg.setWidth((s+i)*6+6*i),this.svg.setHeight((s+i)*6+6*i),e=0,o=0;o<6;o++)for(a=0;a<6;a++)t=p(n=c(this.hash,e)),r={fill:"none",stroke:m(n),opacity:t,"stroke-width":i+"px"},this.svg.rect(a*s+a*i*2+i/2,o*s+o*i*2+i/2,s,s,r),t=p(n=c(this.hash,39-e)),r={fill:"none",stroke:m(n),opacity:t,"stroke-width":i+"px"},this.svg.rect(a*s+a*i*2+i/2+2*i,o*s+o*i*2+i/2+2*i,3*i,3*i,r),e+=1},f.prototype.geoMosaicSquares=function(){var e,t,r,n=d(c(this.hash,0),0,15,15,50);for(this.svg.setWidth(8*n),this.svg.setHeight(8*n),e=0,r=0;r<4;r++)for(t=0;t<4;t++)t%2==0?r%2==0?v(this.svg,t*n*2,r*n*2,n,c(this.hash,e)):y(this.svg,t*n*2,r*n*2,n,[c(this.hash,e),c(this.hash,e+1)]):r%2==0?y(this.svg,t*n*2,r*n*2,n,[c(this.hash,e),c(this.hash,e+1)]):v(this.svg,t*n*2,r*n*2,n,c(this.hash,e)),e+=1},f.prototype.geoPlaid=function(){var e,t,r,n,a,o,i=0,s=0;for(t=0;t<36;)i+=c(this.hash,t)+5,r=p(o=c(this.hash,t+1)),e=m(o),n=o+5,this.svg.rect(0,i,"100%",n,{opacity:r,fill:e}),i+=n,t+=2;for(t=0;t<36;)s+=c(this.hash,t)+5,r=p(o=c(this.hash,t+1)),e=m(o),a=o+5,this.svg.rect(s,0,a,"100%",{opacity:r,fill:e}),s+=a,t+=2;this.svg.setWidth(s),this.svg.setHeight(i)},f.prototype.geoTessellation=function(){var e,t,r,n,a=d(c(this.hash,0),0,15,5,40),o=a*Math.sqrt(3),i=2*a,s=a/2*Math.sqrt(3),l=[0,0,s,a/2,0,a,0,0].join(","),f=3*a+2*s,h=2*o+2*a;for(this.svg.setWidth(f),this.svg.setHeight(h),e=0;e<20;e++)switch(t=p(n=c(this.hash,e)),r={stroke:u,"stroke-opacity":.02,fill:m(n),"fill-opacity":t,"stroke-width":1},e){case 0:this.svg.rect(-a/2,-a/2,a,a,r),this.svg.rect(f-a/2,-a/2,a,a,r),this.svg.rect(-a/2,h-a/2,a,a,r),this.svg.rect(f-a/2,h-a/2,a,a,r);break;case 1:this.svg.rect(i/2+s,o/2,a,a,r);break;case 2:this.svg.rect(-a/2,h/2-a/2,a,a,r),this.svg.rect(f-a/2,h/2-a/2,a,a,r);break;case 3:this.svg.rect(i/2+s,1.5*o+a,a,a,r);break;case 4:this.svg.polyline(l,r).transform({translate:[a/2,-a/2],rotate:[0,a/2,s/2]}),this.svg.polyline(l,r).transform({translate:[a/2,h- -a/2],rotate:[0,a/2,s/2],scale:[1,-1]});break;case 5:this.svg.polyline(l,r).transform({translate:[f-a/2,-a/2],rotate:[0,a/2,s/2],scale:[-1,1]}),this.svg.polyline(l,r).transform({translate:[f-a/2,h+a/2],rotate:[0,a/2,s/2],scale:[-1,-1]});break;case 6:this.svg.polyline(l,r).transform({translate:[f/2+a/2,o/2]});break;case 7:this.svg.polyline(l,r).transform({translate:[f-f/2-a/2,o/2],scale:[-1,1]});break;case 8:this.svg.polyline(l,r).transform({translate:[f/2+a/2,h-o/2],scale:[1,-1]});break;case 9:this.svg.polyline(l,r).transform({translate:[f-f/2-a/2,h-o/2],scale:[-1,-1]});break;case 10:this.svg.polyline(l,r).transform({translate:[a/2,h/2-a/2]});break;case 11:this.svg.polyline(l,r).transform({translate:[f-a/2,h/2-a/2],scale:[-1,1]});break;case 12:this.svg.rect(0,0,a,a,r).transform({translate:[a/2,a/2],rotate:[-30,0,0]});break;case 13:this.svg.rect(0,0,a,a,r).transform({scale:[-1,1],translate:[-f+a/2,a/2],rotate:[-30,0,0]});break;case 14:this.svg.rect(0,0,a,a,r).transform({translate:[a/2,h/2-a/2-a],rotate:[30,0,a]});break;case 15:this.svg.rect(0,0,a,a,r).transform({scale:[-1,1],translate:[-f+a/2,h/2-a/2-a],rotate:[30,0,a]});break;case 16:this.svg.rect(0,0,a,a,r).transform({scale:[1,-1],translate:[a/2,-h+h/2-a/2-a],rotate:[30,0,a]});break;case 17:this.svg.rect(0,0,a,a,r).transform({scale:[-1,-1],translate:[-f+a/2,-h+h/2-a/2-a],rotate:[30,0,a]});break;case 18:this.svg.rect(0,0,a,a,r).transform({scale:[1,-1],translate:[a/2,-h+a/2],rotate:[-30,0,0]});break;case 19:this.svg.rect(0,0,a,a,r).transform({scale:[-1,-1],translate:[-f+a/2,-h+a/2],rotate:[-30,0,0]})}}},6743(e){"use strict";function t(){var e=0x67452301,t=0xefcdab89,r=0x98badcfe,n=0x10325476,a=0xc3d2e1f0,o=new Uint32Array(80),i=0,s=24,l=0;function u(){for(var s,l,u=16;u<80;u++){var c=o[u-3]^o[u-8]^o[u-14]^o[u-16];o[u]=c<<1|c>>>31}var d=e,m=t,p=r,f=n,h=a;for(u=0;u<80;u++){u<20?(s=f^m&(p^f),l=0x5a827999):u<40?(s=m^p^f,l=0x6ed9eba1):u<60?(s=m&p|f&(m|p),l=0x8f1bbcdc):(s=m^p^f,l=0xca62c1d6);var g=(d<<5|d>>>27)+s+h+l+(0|o[u]);h=f,f=p,p=m<<30|m>>>2,m=d,d=g}for(u=0,e=e+d|0,t=t+m|0,r=r+p|0,n=n+f|0,a=a+h|0,i=0;u<16;u++)o[u]=0}function c(e){o[i]|=(255&e)<<s,s?s-=8:(i++,s=24),16===i&&u()}function d(e){for(var t="",r=28;r>=0;r-=4)t+=(e>>r&15).toString(16);return t}return{update:function(e){if("string"==typeof e){var t=e.length;l+=8*t;for(var r=0;r<t;r++)c(e.charCodeAt(r));return}var n=e.length;l+=8*n;for(var a=0;a<n;a++)c(e[a])},digest:function(){c(128),(i>14||14===i&&s<24)&&u(),i=14,s=24,c(0),c(0),c(l>0xffffffffff?l/0x10000000000:0),c(l>0xffffffff?l/0x100000000:0);for(var o=24;o>=0;o-=8)c(l>>o);return d(e)+d(t)+d(r)+d(n)+d(a)}}}e.exports=function(e){if(void 0===e)return t();var r=t();return r.update(e),r.digest()}},8502(e,t,r){"use strict";var n=r(2849),a=r(6541);function o(){return this.width=100,this.height=100,this.svg=a("svg"),this.context=[],this.setAttributes(this.svg,{xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height}),this}e.exports=o,o.prototype.currentContext=function(){return this.context[this.context.length-1]||this.svg},o.prototype.end=function(){return this.context.pop(),this},o.prototype.currentNode=function(){var e=this.currentContext();return e.lastChild||e},o.prototype.transform=function(e){return this.currentNode().setAttribute("transform",Object.keys(e).map(function(t){return t+"("+e[t].join(",")+")"}).join(" ")),this},o.prototype.setAttributes=function(e,t){Object.keys(t).forEach(function(r){e.setAttribute(r,t[r])})},o.prototype.setWidth=function(e){this.svg.setAttribute("width",Math.floor(e))},o.prototype.setHeight=function(e){this.svg.setAttribute("height",Math.floor(e))},o.prototype.toString=function(){return this.svg.toString()},o.prototype.rect=function(e,t,r,o,i){var s=this;if(Array.isArray(e))return e.forEach(function(e){s.rect.apply(s,e.concat(i))}),this;var l=a("rect");return this.currentContext().appendChild(l),this.setAttributes(l,n({x:e,y:t,width:r,height:o},i)),this},o.prototype.circle=function(e,t,r,o){var i=a("circle");return this.currentContext().appendChild(i),this.setAttributes(i,n({cx:e,cy:t,r:r},o)),this},o.prototype.path=function(e,t){var r=a("path");return this.currentContext().appendChild(r),this.setAttributes(r,n({d:e},t)),this},o.prototype.polyline=function(e,t){var r=this;if(Array.isArray(e))return e.forEach(function(e){r.polyline(e,t)}),this;var o=a("polyline");return this.currentContext().appendChild(o),this.setAttributes(o,n({points:e},t)),this},o.prototype.group=function(e){var t=a("g");return this.currentContext().appendChild(t),this.context.push(t),this.setAttributes(t,n({},e)),this}},6541(e){"use strict";var t=e.exports=function(e){return this instanceof t?(this.tagName=e,this.attributes=Object.create(null),this.children=[],this.lastChild=null,this):new t(e)};t.prototype.appendChild=function(e){return this.children.push(e),this.lastChild=e,this},t.prototype.setAttribute=function(e,t){return this.attributes[e]=t,this},t.prototype.toString=function(){var e=this;return["<",e.tagName,Object.keys(e.attributes).map(function(t){return[" ",t,'="',e.attributes[t],'"'].join("")}).join(""),">",e.children.map(function(e){return e.toString()}).join(""),"</",e.tagName,">"].join("")}},8067(e,t){"use strict";t.pathToRegexp=function(e,t={}){let{delimiter:c="/",end:d=!0,sensitive:m=!1,trailing:p=!0}=t,f=new l("^"),h=[e],g=0;for(;h.length;){let e=h.shift();if(Array.isArray(e)){h.push(...e);continue}let l="object"==typeof e?e:function(e,t={}){let{encodePath:o=r}=t,l=[...e],u=[],c=0,d=0;function m(){let t="";if(n.test(l[c]))do t+=l[c++];while(a.test(l[c]));else if('"'===l[c]){let r=c;for(;c<l.length;){if('"'===l[++c]){c++,r=0;break}"\\"===l[c]&&c++,t+=l[c]}if(r)throw new s(`Unterminated quote at index ${r}`,e)}if(!t)throw new s(`Missing parameter name at index ${c}`,e);return t}for(;c<l.length;){let e=l[c++];"{}()[]+?!".includes(e)?u.push({type:e,index:c,value:e}):"\\"===e?u.push({type:"escape",index:c,value:l[c++]}):":"===e?u.push({type:"param",index:c,value:m()}):"*"===e?u.push({type:"wildcard",index:c,value:m()}):u.push({type:"char",index:c,value:e})}return u.push({type:"end",index:c,value:""}),new i(function t(r){let n=[];for(;;){let a=u[d++];if(a.type===r)break;if("char"===a.type||"escape"===a.type){let e=a.value,t=u[d];for(;"char"===t.type||"escape"===t.type;)e+=t.value,t=u[++d];n.push({type:"text",value:o(e)});continue}if("param"===a.type||"wildcard"===a.type){n.push({type:a.type,name:a.value});continue}if("{"===a.type){n.push({type:"group",tokens:t("}")});continue}throw new s(`Unexpected ${a.type} at index ${a.index}, expected ${r}`,e)}return n}("end"),e)}(e,t);!function e(t,r,n,a){for(;r<t.length;){let o=t[r++];if("group"===o.type){e(o.tokens,0,n.slice(),n=>e(t,r,n,a));continue}n.push(o)}a(n)}(l.tokens,0,[],e=>{if(g++>=256)throw new s("Too many path combinations",l.originalPath);let t=f;for(let r of function(e,t,r){let n=[],a="",i="",l=0,c=0,d=0;for(;d<e.length;){let m=e[d++];if("text"===m.type){n.push({source:o(m.value)}),a+=m.value,2===l&&(i+=m.value),m.value.includes(t)&&(c=0);continue}if("param"===m.type||"wildcard"===m.type){if(l&&!a)throw new s(`Missing text before "${m.name}" ${m.type}`,r);"param"===m.type?(n.push({source:c?`(${u(t,a)}+?)`:!function(r,n){for(;r<e.length;){let a=e[r++];if(a.type===n)return!0;if("text"===a.type&&a.value.includes(t))break}return!1}(d,"wildcard")?`(${u(t,"")}+?)`:`(${u(t,function(t){let r="";for(;t<e.length;){let n=e[t++];if("text"!==n.type)break;r+=n.value}return r}(d))}+?)`,key:m}),c|=l=1):(n.push({source:2&c?`(${u(a,"")}+?)`:1&c?`(${u(i,"")}+?)`:i?`(${u(i,"")}+?|${u(t,"")}+?)`:"([^]+?)",key:m}),i="",c|=l=2),a="";continue}throw TypeError(`Unknown token type: ${m.type}`)}return n}(e,c,l.originalPath))t=t.add(r.source,r.key);t.add("")})}let y=[],v=function e(t,r){t.key&&r.push(t.key);let n=Object.keys(t.children),a=n.map(n=>e(t.children[n],r)).join("|");return t.source+(n.length<2?a:`(?:${a})`)}(f,y);return p&&(v+="(?:"+o(c)+"$)?"),{regexp:new RegExp(v+=d?"$":"(?="+o(c)+"|$)",m?"":"i"),keys:y}};let r=e=>e,n=/^[$_\p{ID_Start}]$/u,a=/^[$\u200c\u200d\p{ID_Continue}]$/u;function o(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}class i{constructor(e,t){this.tokens=e,this.originalPath=t}}class s extends TypeError{constructor(e,t){let r=e;t&&(r+=`: ${t}`),super(r+="; visit https://git.new/pathToRegexpError for info"),this.originalPath=t}}class l{constructor(e,t){this.source=e,this.key=t,this.children=Object.create(null)}add(e,t){var r;let n=e+":"+(t?t.name:"");return(r=this.children)[n]||(r[n]=new l(e,t))}}function u(e,t){return t.length>e.length?u(t,e):(e===t&&(t=""),t.length>1)?`(?:(?!${o(e)}|${o(t)})[^])`:e.length>1?`(?:(?!${o(e)})[^${o(t)}])`:`[^${o(e+t)}]`}},3904(e,t,r){"use strict";let n=Symbol("SemVer ANY");class a{static get ANY(){return n}constructor(e,t){if(t=o(t),e instanceof a)if(!!t.loose===e.loose)return e;else e=e.value;u("comparator",e=e.trim().split(/\s+/).join(" "),t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===n?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){let t=this.options.loose?i[s.COMPARATORLOOSE]:i[s.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===n||e===n)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof a))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):!((t=o(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))}}e.exports=a;let o=r(8587),{safeRe:i,t:s}=r(9718),l=r(2111),u=r(7272),c=r(3908),d=r(8311)},8311(e,t,r){"use strict";let n=/\s+/g;class a{constructor(e,t){if(t=i(t),e instanceof a)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else return new a(e.raw,t);if(e instanceof s)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(n," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!b(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1){for(const e of this.set)if(1===e.length&&w(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(v,"");let t=((this.options.includePrerelease&&g)|(this.options.loose&&y))+":"+e,r=o.get(t);if(r)return r;let n=this.options.loose,a=n?d[p.HYPHENRANGELOOSE]:d[p.HYPHENRANGE];l("hyphen replace",e=e.replace(a,$(this.options.includePrerelease))),l("comparator trim",e=c(e)),l("tilde trim",e=e.replace(d[p.TILDETRIM],f)),l("caret trim",e=e.replace(d[p.CARETTRIM],h));let i=e.split(" ").map(e=>D(e,this.options)).join(" ").split(/\s+/).map(e=>O(e,this.options));n&&(i=i.filter(e=>(l("loose invalid filter",e,this.options),!!e.match(d[p.COMPARATORLOOSE])))),l("range list",i);let u=new Map;for(let e of i.map(e=>new s(e,this.options))){if(b(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");let m=[...u.values()];return o.set(t,m),m}intersects(e,t){if(!(e instanceof a))throw TypeError("a Range is required");return this.set.some(r=>E(r,t)&&e.set.some(e=>E(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(N(this.set[t],e,this.options))return!0;return!1}}e.exports=a;let o=new(r(8794)),i=r(8587),s=r(3904),l=r(7272),u=r(3908),c=r(5924),{safeRe:d,src:m,t:p,tildeTrimReplace:f,caretTrimReplace:h}=r(9718),{FLAG_INCLUDE_PRERELEASE:g,FLAG_LOOSE:y}=r(6874),v=RegExp(m[p.BUILD],"g"),b=e=>"<0.0.0-0"===e.value,w=e=>""===e.value,E=(e,t)=>{let r=!0,n=e.slice(),a=n.pop();for(;r&&n.length;)r=n.every(e=>a.intersects(e,t)),a=n.pop();return r},D=(e,t)=>(l("comp",e=e.replace(d[p.BUILD],""),t),l("caret",e=C(e,t)),l("tildes",e=_(e,t)),l("xrange",e=P(e,t)),l("stars",e=T(e,t)),e),x=e=>!e||"x"===e.toLowerCase()||"*"===e,_=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(" "),S=(e,t)=>{let r=t.loose?d[p.TILDELOOSE]:d[p.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,a,o,i)=>{let s;return l("tilde",e,t,r,a,o,i),x(r)?s="":x(a)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:x(o)?s=`>=${r}.${a}.0${n} <${r}.${+a+1}.0-0`:i?(l("replaceTilde pr",i),s=`>=${r}.${a}.${o}-${i} <${r}.${+a+1}.0-0`):s=`>=${r}.${a}.${o} <${r}.${+a+1}.0-0`,l("tilde return",s),s})},C=(e,t)=>e.trim().split(/\s+/).map(e=>k(e,t)).join(" "),k=(e,t)=>{l("caret",e,t);let r=t.loose?d[p.CARETLOOSE]:d[p.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,a,o,i)=>{let s;return l("caret",e,t,r,a,o,i),x(r)?s="":x(a)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:x(o)?s="0"===r?`>=${r}.${a}.0${n} <${r}.${+a+1}.0-0`:`>=${r}.${a}.0${n} <${+r+1}.0.0-0`:i?(l("replaceCaret pr",i),s="0"===r?"0"===a?`>=${r}.${a}.${o}-${i} <${r}.${a}.${+o+1}-0`:`>=${r}.${a}.${o}-${i} <${r}.${+a+1}.0-0`:`>=${r}.${a}.${o}-${i} <${+r+1}.0.0-0`):(l("no pr"),s="0"===r?"0"===a?`>=${r}.${a}.${o} <${r}.${a}.${+o+1}-0`:`>=${r}.${a}.${o} <${r}.${+a+1}.0-0`:`>=${r}.${a}.${o} <${+r+1}.0.0-0`),l("caret return",s),s})},P=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>R(e,t)).join(" ")),R=(e,t)=>{e=e.trim();let r=t.loose?d[p.XRANGELOOSE]:d[p.XRANGE];return e.replace(r,(r,n,a,o,i,s)=>{let u,c,d;if(l("xRange",e,r,n,a,o,i,s),u=a,c=o,d=i,x(u)&&!x(c)||x(c)&&d&&!x(d))return e;let m=x(a),p=m||x(o),f=p||x(i);return"="===n&&f&&(n=""),s=t.includePrerelease?"-0":"",m?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&f?(p&&(o=0),i=0,">"===n?(n=">=",p?(a=+a+1,o=0):o=+o+1,i=0):"<="===n&&(n="<",p?a=+a+1:o=+o+1),"<"===n&&(s="-0"),r=`${n+a}.${o}.${i}${s}`):p?r=`>=${a}.0.0${s} <${+a+1}.0.0-0`:f&&(r=`>=${a}.${o}.0${s} <${a}.${+o+1}.0-0`),l("xRange return",r),r})},T=(e,t)=>(l("replaceStars",e,t),e.trim().replace(d[p.STAR],"")),O=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(d[t.includePrerelease?p.GTE0PRE:p.GTE0],"")),$=e=>(t,r,n,a,o,i,s,l,u,c,d,m)=>(r=x(n)?"":x(a)?`>=${n}.0.0${e?"-0":""}`:x(o)?`>=${n}.${a}.0${e?"-0":""}`:i?`>=${r}`:`>=${r}${e?"-0":""}`,l=x(u)?"":x(c)?`<${+u+1}.0.0-0`:x(d)?`<${u}.${+c+1}.0-0`:m?`<=${u}.${c}.${d}-${m}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`,`${r} ${l}`.trim()),N=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==s.ANY&&e[r].semver.prerelease.length>0){let n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}},3908(e,t,r){"use strict";let n=r(7272),{MAX_LENGTH:a,MAX_SAFE_INTEGER:o}=r(6874),{safeRe:i,t:s}=r(9718),l=r(8587),{compareIdentifiers:u}=r(1123);class c{constructor(e,t){if(t=l(t),e instanceof c)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else e=e.version;else if("string"!=typeof e)throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>a)throw TypeError(`version is longer than ${a} characters`);n("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?i[s.LOOSE]:i[s.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>o||this.major<0)throw TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<o)return t}return e}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(n("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return(e instanceof c||(e=new c(e,this.options)),this.major<e.major)?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:+(this.patch>e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return -1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],a=e.prerelease[t];if(n("prerelease compare",t,r,a),void 0===r&&void 0===a)return 0;if(void 0===a)return 1;if(void 0===r)return -1;else if(r===a)continue;else return u(r,a)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{let r=this.build[t],a=e.build[t];if(n("build compare",t,r,a),void 0===r&&void 0===a)return 0;if(void 0===a)return 1;if(void 0===r)return -1;else if(r===a)continue;else return u(r,a)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw Error("invalid increment argument: identifier is empty");if(t){let e=`-${t}`.match(this.options.loose?i[s.PRERELEASELOOSE]:i[s.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(0!==this.minor||0!==this.patch||0===this.prerelease.length)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(0!==this.patch||0===this.prerelease.length)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{let e=+!!Number(r);if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),((e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let t=0;t<r.length;t++)if(0!==u(e[t],r[t]))return!1;return!0})(this.prerelease,t)?isNaN(this.prerelease[t.split(".").length])&&(this.prerelease=n):this.prerelease=n}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=c},2111(e,t,r){"use strict";let n=r(4641),a=r(3999),o=r(5580),i=r(4089),s=r(7059),l=r(5200);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return n(e,r,u);case"!=":return a(e,r,u);case">":return o(e,r,u);case">=":return i(e,r,u);case"<":return s(e,r,u);case"<=":return l(e,r,u);default:throw TypeError(`Invalid operator: ${t}`)}}},560(e,t,r){"use strict";let n=r(3908);e.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))},4641(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0===n(e,t,r)},5580(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>n(e,t,r)>0},4089(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>n(e,t,r)>=0},7059(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0>n(e,t,r)},5200(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0>=n(e,t,r)},3999(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0!==n(e,t,r)},7638(e,t,r){"use strict";let n=r(8311);e.exports=(e,t,r)=>{try{t=new n(t,r)}catch(e){return!1}return t.test(e)}},6874(e){"use strict";e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||0x1fffffffffffff,WHITESPACE_CHARACTERS:[" ","\n","\v","\f","\r"," ","\xa0"," "," "," "," "," "," "," "," "," "," "," "," ","\u2028","\u2029"," "," "," ","\uFEFF"],RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},7272(e){"use strict";e.exports="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}},1123(e){"use strict";let t=/^[0-9]+$/,r=(e,r)=>{if("number"==typeof e&&"number"==typeof r)return e===r?0:e<r?-1:1;let n=t.test(e),a=t.test(r);return n&&a&&(e*=1,r*=1),e===r?0:n&&!a?-1:a&&!n?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},8794(e){"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(void 0!==t)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},8587(e){"use strict";let t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},9718(e,t,r){"use strict";let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:a,MAX_LENGTH:o}=r(6874),i=r(7272),s=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],d=t.t={},m=0,p="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",o],[p,a]],h=(e,t,r)=>{let n=(e=>{for(let[t,r]of f)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),a=m++;i(e,a,t),d[e]=a,u[a]=t,c[a]=n,s[a]=new RegExp(t,r?"g":void 0),l[a]=new RegExp(n,r?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),h("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${p}+`),h("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),h("FULL",`^${u[d.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),h("LOOSE",`^${u[d.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),h("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?`+`(?:${u[d.BUILD]})?`+"(?:$|[^\\d])"),h("COERCERTL",u[d.COERCE],!0),h("COERCERTLFULL",u[d.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},5924(e,t,r){"use strict";let{MAX_LENGTH:n,MAX_SAFE_BUILD_LENGTH:a,WHITESPACE_CHARACTERS:o}=r(6874),i=new Uint8Array(65536);for(let e of o)i[e.charCodeAt(0)]=1;let s=e=>void 0!==e&&1===i[e.charCodeAt(0)],l=e=>"v"===e||"="===e||s(e),u=e=>void 0!==e&&e>="0"&&e<="9",c=e=>void 0!==e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),d=e=>u(e)||c(e)||"-"===e,m=e=>u(e)||"x"===e||"X"===e||"*"===e,p=(e,t,r,n)=>{if(!u(e[t]))return t;if(t>=n.start&&t<n.end)return Math.min(t+r,n.end);if(t>=n.previousStart&&t<n.previousEnd)return Math.min(t+r,n.previousEnd);let a=t+1;for(;u(e[a]);)a++;return n.previousStart=n.start,n.previousEnd=n.end,n.start=t,n.end=a,Math.min(t+r,a)},f=(e,t,r,a)=>r||"0"!==e[t]?p(e,t,r?n:n+1,a):t+1,h=(e,t,r,o)=>{let i=p(e,t,n,o);if(c(e[i])||"-"===e[i]){let t=i+1,r=t+a;for(;t<r&&d(e[t]);)t++;return t}return f(e,t,r,o)},g=(e,t,r,n)=>{let a="-"===e[t];if(!r&&!a)return t;let o=t+ +!!a,i=h(e,o,r,n);if(i===o){if(!r||!a)return t;i=h(e,t,r,n)}for(;"."===e[i];){let t=h(e,i+1,r,n);if(t===i+1)break;i=t}return i},y=(e,t)=>{let r=t;for(;r-t<a&&d(e[r]);)r++;return r},v=(e,t)=>{if("+"!==e[t])return t;let r=y(e,t+1);if(r===t+1)return t;for(;"."===e[r];){let t=y(e,r+1);if(t===r+1)break;r=t}return r},b=(e,t,r)=>u(e[t])?f(e,t,!1,r):m(e[t])?t+1:t,w=(e,t,r)=>{let n=((e,t,r)=>{let n=t;for(let a=0;a<3;a++){let o=f(e,n,!0,r);if(o===n)return t;if(n=o,a<2){if("."!==e[n])return t;n++}}let a=g(e,n,!0,r);return v(e,a)})(e,t,r);return n!==t?n:((e,t,r)=>{let n=b(e,t,r);for(let t=0;t<2;t++){if("."!==e[n])return n;let t=b(e,n+1,r);if(t===n+1)return n;n=t}let a=g(e,n,!1,r);return v(e,a)})(e,t,r)},E=(e,t)=>{let r=t;return s(e[r])&&r++,("<"===e[r]||">"===e[r])&&r++,"="===e[r]&&r++,s(e[r])?r:-1};e.exports=e=>{let t="",r=0,n=0,a={start:-1,end:-1,previousStart:-1,previousEnd:-1};for(;n<e.length;){let o=n;if("<"===e[n]||">"===e[n])n++;else if(!l(e[n])&&!m(e[n])){n++;continue}for(;n<e.length&&l(e[n]);)n++;if(!m(e[n]))continue;let i=E(e,o);-1!==i&&(t+=e.slice(r,i),r=i+1),n=w(e,n,a)}return t+e.slice(r)}},5067(e,t,r){"use strict";let n,a,o,i,s,l,u,c,d,m;r.r(t),r.d(t,{GenderUnknownIcon:()=>di,evaluateAsNumber:()=>iL,getImportMapOverrideMap:()=>oN,StockManagementPictogram:()=>xh,ChemistryIcon:()=>cJ,BabyIcon:()=>cB,DashboardExtension:()=>mi,openmrsComponentDecorator:()=>lZ,tryRegisterExtension:()=>ci,pictogramIds:()=>DZ,ActivityIcon:()=>cI,compile:()=>iU,removeRouteMapOverride:()=>o7,TableBatchActions:()=>cD,getAsyncLifecycle:()=>lq,subscribeOpenmrsEvent:()=>im,PasswordIcon:()=>dT,Assessment2Pictogram:()=>DX,CloseIcon:()=>c4,setupRouteMapOverrides:()=>ir,useFeatureFlag:()=>ub,reset:()=>sY,ConceptDictionaryPictogram:()=>D4,LabOrderIcon:()=>dg,VisitMode:()=>ib,isTranslationInspectorRecording:()=>aj,useLocations:()=>uW,getLifecycle:()=>lY,formatDatetime:()=>wz,getVisitsForPatient:()=>ik,formatPartialDate:()=>wV,CustomOverflowMenu:()=>cR,LocationIcon:()=>dv,GroupIcon:()=>dl,createUseStore:()=>lv,VisitStatus:()=>iw,getSessionLocation:()=>os,getCurrentImportMap:()=>oz,usePatient:()=>uq,useRenderableExtensions:()=>uQ,setLeftNav:()=>sJ,clearHistory:()=>aq,clearConfigErrors:()=>au,formatTime:()=>wH,isDevEnabled:()=>og,CohortsPictogram:()=>D1,closeWorkspaceGroup2:()=>xU,getCurrentRouteMap:()=>o3,ConfigurableLink:()=>ld,sessionStore:()=>a5,setSessionLocale:()=>ou,subscribeSnackbarShown:()=>_,getLoggedInUser:()=>oi,GenderMaleIcon:()=>dn,getExtensionSlotConfigFromStore:()=>n_,evaluateAsNumberAsync:()=>iF,getImportMapDefaultMap:()=>oO,unregisterExtensionRendering:()=>sh,implementerToolsConfigStore:()=>nA,Type:()=>nc,InPatientPictogram:()=>xt,cleanupObsoleteFeatureFlags:()=>se,getAttachmentsUrl:()=>is,showSnackbar:()=>xT,PatientBannerActionsMenu:()=>DV,PatientSearchPictogram:()=>xs,DocumentAttachmentIcon:()=>c5,Snackbar:()=>xS,CardiologyPictogram:()=>D0,ImageMedicalIcon:()=>dd,ActionableNotificationComponent:()=>Di,DiagnosisTags:()=>EH,openChildWorkspaceInWindow:()=>xq,iconIds:()=>cN,PatientsPictogram:()=>xl,interpolateUrl:()=>aU,setupHistory:()=>aG,subscribeToastShown:()=>x,detachAll:()=>sH,convertToLocaleCalendar:()=>wK,DocumentIcon:()=>c6,configInternalStore:()=>nv,ActionMenuButton2:()=>_b,setupDynamicOfflineDataHandler:()=>_W,makeUrl:()=>a2,oneOf:()=>ay,selectPreferredName:()=>DR,MobileCheckIcon:()=>d_,createErrorHandler:()=>k,parseDate:()=>wM,getAttachmentByUuid:()=>io,LeftNavMenu:()=>EJ,getExtensionRegistration:()=>sB,dispatchToastShown:()=>w,ShoppingCartAddItemIcon:()=>mn,ReferralOrderIcon:()=>dj,ReportIcon:()=>dL,getImportMapNextPageMap:()=>o$,registerExtension:()=>sV,setupOfflineSync:()=>_U,DownloadIcon:()=>c9,useConnectivity:()=>_Z,provide:()=>nQ,ShoppingCartArrowDownIcon:()=>dz,featureFlagsStore:()=>i8,jsep:()=>iR,GeriatricsPictogram:()=>D7,SearchIcon:()=>dV,reportError:()=>C,slugify:()=>oU,isOmrsDateToday:()=>w$,getExtensionStore:()=>sg,BloodBankPictogram:()=>DQ,TriagePictogram:()=>xv,Workspace2:()=>x5,refetchCurrentUser:()=>on,CheckmarkOutlineIcon:()=>cq,registerExtensionSlot:()=>sZ,AllergiesIcon:()=>d7,ArrowDownIcon:()=>cj,useOpenmrsInfinite:()=>uR,getExtensionConfigFromExtensionSlotStore:()=>nk,OpenmrsDatePicker:()=>E_,getExtensionConfigFromStore:()=>nC,getDynamicOfflineDataEntries:()=>_H,getLocaleDisplayName:()=>b6,messageOmrsServiceWorker:()=>_K,navigate:()=>aH,launchWorkspace2:()=>xW,getGroupByWindowName:()=>s3,CustomOverflowMenuItem:()=>cT,isUrl:()=>ag,CaretDownIcon:()=>cW,ArrowLeftIcon:()=>cA,FacilityPictogram:()=>D8,ViewOffIcon:()=>d5,updateInternalExtensionStore:()=>su,dispatchActionableNotificationShown:()=>v,resetRouteMapOverrides:()=>ie,formatDurationBetween:()=>w0,defaultVisitCustomRepresentation:()=>iE,getBreadcrumbsFor:()=>aC,useOpenmrsPagination:()=>uE,Pagination:()=>D_,CheckmarkFilledIcon:()=>cY,clearCurrentUser:()=>oa,showModal:()=>Dt,ChevronUpIcon:()=>c1,saveVisit:()=>iS,useAttachments:()=>un,Pictogram:()=>xx,useExtensionSlot:()=>l_,ChevronDownIcon:()=>cX,OpenmrsDateRangePicker:()=>ES,deleteAttachmentPermanently:()=>iu,getVisitTypes:()=>iv,OverflowMenuHorizontalIcon:()=>dP,EventScheduleIcon:()=>de,getSessionStore:()=>ot,ProcedureOrderIcon:()=>dI,preloadImport:()=>oH,registerWorkspaceWindows2:()=>s9,useOnVisible:()=>uz,setSessionLocation:()=>ol,userHasAccess:()=>oo,ChartAverageIcon:()=>cG,getFeatureFlag:()=>st,UserAvatarIcon:()=>d4,renderExtension:()=>li,useFhirInfinite:()=>uj,toVisitTypeObject:()=>ig,useSession:()=>u0,EmergencyDepartmentPictogram:()=>D9,Notification:()=>Da,dispatchSnackbarShown:()=>b,formatDate:()=>wU,workspace2StoreActions:()=>xQ,SwitcherIcon:()=>dW,esmStyleGuideSchema:()=>cb,getImportMapDisabledOverrides:()=>oI,useAssignedExtensionIds:()=>ut,CaretRightIcon:()=>cz,evaluateAsType:()=>iB,PageHeader:()=>DD,TranslateIcon:()=>dX,setUserProperties:()=>oc,MovementIcon:()=>dk,renderInlineNotifications:()=>Dp,subscribePrecacheStaticDependencies:()=>_G,PaymentsDeskPictogram:()=>xu,usePrimaryIdentifierCode:()=>uJ,useLayoutType:()=>uL,getCurrentUser:()=>oe,closeWorkspaceInWindow:()=>xY,XrayPictogram:()=>xb,CaretUpIcon:()=>cK,renderActionableNotifications:()=>Dh,OpenmrsAppContext:()=>l5,setupModals:()=>De,getDefaultsFromConfigSchema:()=>function e(t){let r={};for(let n of Object.keys(t))if(_j(t[n])&&t[n].hasOwnProperty("_default"))r[n]=t[n]._default;else{if(n.startsWith("_"))continue;_j(t[n])?r[n]=e(t[n]):r[n]=t[n]}return r},subscribeTo:()=>W,recordConfigDerivationError:()=>nM,useAbortController:()=>l8,Extension:()=>lm,getFhirServerPaginationHandlers:()=>uS,useConnectedExtensions:()=>uu,registerApp:()=>cl,HospitalBedIcon:()=>dc,useExtensionInternalStore:()=>ug,configExtensionStore:()=>nw,getSynchronizationItems:()=>_z,getExtensionSlotsConfigStore:()=>nD,registerExtensionRendering:()=>sf,RenderIfValueIsTruthy:()=>l9,registerFeatureFlag:()=>i7,useFhirFetchAll:()=>uM,restBaseUrl:()=>a0,CalendarHeatMapIcon:()=>cV,isImportMapOverrideDisabled:()=>oM,resetConfigSystem:()=>ac,getExtensionInternalStore:()=>ss,registerGlobalStore:()=>V,evaluateAsBoolean:()=>ij,PatientBannerPatientInfo:()=>DF,addRouteMapOverride:()=>o8,getDefaultCalendar:()=>wF,SettingsIcon:()=>dU,DrugOrderIcon:()=>c8,ProgramsIcon:()=>dM,useAssignedExtensions:()=>lx,CloseFilledIcon:()=>c2,canAccessStorage:()=>_M,registerDefaultCalendar:()=>wL,TreeViewAltIcon:()=>d0,OverflowMenuVerticalIcon:()=>dR,clearConfigDerivationError:()=>nj,getConfigStore:()=>nE,InformationSquareIcon:()=>df,EmptyCard:()=>EZ,ChevronLeftIcon:()=>cQ,RadiologyIcon:()=>mr,useCandidateExtensions:()=>ur,renderToasts:()=>xM,isDesktop:()=>uF,integrateBreakpoints:()=>cp,RegistrationPictogram:()=>xm,CardHeader:()=>cg,getExtensionRegistrationFrom:()=>sF,InformationIcon:()=>dm,SystemAdministrationPictogram:()=>xg,TrashCanIcon:()=>dQ,useShallowStableValue:()=>lp,PatientDocumentsPictogram:()=>xi,useOpenmrsSWR:()=>uK,Assessment1Pictogram:()=>DJ,finishRegisteringAllApps:()=>cu,importDynamic:()=>oW,useFhirPagination:()=>u_,useVisitContextStore:()=>u8,ArrowUpIcon:()=>cF,matchTranslations:()=>aL,showActionableNotification:()=>Dg,useForceUpdate:()=>uw,useVisit:()=>u7,PatientBannerPatientIdentifiers:()=>DM,getOpenedWindowIndexByWindowName:()=>s6,TransferPictogram:()=>xy,usePagination:()=>uG,Breakpoint:()=>cc,PatientBannerToggleContactDetailsButton:()=>_w,CloseOutlineIcon:()=>c3,openmrsFetchAll:()=>ov,ObstetricsPictogram:()=>xo,parseDateInput:()=>wZ,ReportsPictogram:()=>xp,getConfig:()=>n1,attach:()=>sU,getLocale:()=>b5,isUrlWithTemplateParameters:()=>ah,useEmrConfiguration:()=>uf,useLeftNav:()=>uB,ToolsIcon:()=>dJ,ErrorState:()=>EY,detach:()=>sW,setCurrentVisit:()=>i_,ConditionsIcon:()=>mt,SaveIcon:()=>dB,useConfig:()=>ul,validator:()=>nd,CalendarIcon:()=>cU,getHistory:()=>aZ,StickyNoteAddIcon:()=>dK,useWorkspace2Store:()=>x0,getPatientName:()=>DS,getVisitStore:()=>ix,getCoreTranslation:()=>aV,registerModuleWithConfigSystem:()=>nY,updateOpenedWorkspaceInWindow:()=>xJ,registerModuleLoad:()=>nq,getBreadcrumbs:()=>ax,extractVariableNames:()=>i6,translateFrom:()=>aB,useStoreWithActions:()=>ly,EditIcon:()=>c7,getCandidateExtensions:()=>sG,shallowEqual:()=>R,subscribeNotificationShown:()=>E,MaximizeIcon:()=>dw,promptForClosingWorkspaces:()=>xG,WarningIcon:()=>d8,fhirBaseUrl:()=>a1,matchLocale:()=>_I,usePatientPhoto:()=>DH,registerBreadcrumb:()=>aE,EventsIcon:()=>dt,createGlobalStore:()=>F,subscribeToFeatureFlag:()=>sr,useExtensionStore:()=>uv,createAttachment:()=>il,useLeftNavStore:()=>uV,TableIcon:()=>dY,Icon:()=>mo,InformationFilledIcon:()=>dp,getCurrentPageMap:()=>oT,LaboratoryPictogram:()=>xr,temporaryConfigStore:()=>nb,toDateObjectStrict:()=>wN,defineConfigSchema:()=>nZ,filterBreadcrumbs:()=>aS,invalidateImplementerToolsConfig:()=>nN,PatientBannerContactDetails:()=>_C,getAssignedExtensions:()=>sK,promptForClosingWorkspacesInWindow:()=>xZ,PatientPhoto:()=>DG,MaterialOrderIcon:()=>db,MicroscopeIcon:()=>dx,visitTypesUrl:()=>iy,getOpenedWindowWidth:()=>x2,scheduleRecomputation:()=>sE,PharmacyPictogram:()=>xc,AttachmentIcon:()=>me,MoneyIcon:()=>dS,getAttachments:()=>ii,PageHeaderContent:()=>Dx,MedicationIcon:()=>dE,PrinterIcon:()=>dN,PatientListsPictogram:()=>xE,useAppContext:()=>l7,isOpenmrsRoutes:()=>oZ,AppointmentsAltPictogram:()=>Dq,GenericOrderTypeIcon:()=>ds,batchExtensionUpdates:()=>sb,useExtensionSlotStore:()=>lE,ViewIcon:()=>d9,formattedName:()=>DP,sessionEndpoint:()=>a4,duration:()=>wX,resetImportMapOverrides:()=>oL,TableOfContentsIcon:()=>dZ,CaretLeftIcon:()=>cH,getTranslationOverrides:()=>n4,isVersionSatisfied:()=>_F,EmptyCardIllustration:()=>EG,PenIcon:()=>d$,recordTranslationSighting:()=>aA,validators:()=>av,setupImportMapOverrides:()=>oV,showToast:()=>xj,useDefineAppContext:()=>l6,verifyTotpCode:()=>od,getGlobalStore:()=>U,useOnClickOutside:()=>uH,getWindowByWorkspaceName:()=>s2,ArrowRightIcon:()=>cL,disableTranslationInspector:()=>aM,loadLifeCycles:()=>cn,registerBreadcrumbs:()=>aD,MotherIcon:()=>dC,extensionNamespaceSeparator:()=>aO,fetchCurrentPatient:()=>ic,Toast:()=>xO,MessageQueueIcon:()=>dD,TwoFactorAuthenticationIcon:()=>d1,Pharmacy2Pictogram:()=>xd,goBackInHistory:()=>aY,GroupAccessIcon:()=>du,getExtensionRenderingsStore:()=>sl,setImplementerToolsConfigRecomputer:()=>n$,getAsyncExtensionLifecycle:()=>lX,setupApiModule:()=>ob,renderLoadingSpinner:()=>_k,showNotification:()=>Df,getModalRegistration:()=>s1,ListCheckedIcon:()=>dy,ResponsiveWrapper:()=>x_,GynaecologyPictogram:()=>xe,ShoppingCartIcon:()=>dH,getRouteMapNextPageMap:()=>o5,MetadataExportPictogram:()=>xa,updateVisit:()=>iC,backendDependencies:()=>oy,MaybePictogram:()=>xD,createParcelMounter:()=>la,openmrsFetch:()=>a3,useStore:()=>lg,isOpenmrsAppRoutes:()=>oG,ExportedWorkspace:()=>_p,DentistryPictogram:()=>D6,HomePictogram:()=>xw,ServiceQueuesPictogram:()=>xf,createExportedWorkspaceWindow:()=>x6,setFeatureFlag:()=>sn,toLanguageTag:()=>b3,DigitalTrustPictogram:()=>D5,NumericObservation:()=>Dw,attachmentUrl:()=>ia,interpolateString:()=>aW,inRange:()=>af,useExtensionSlotMeta:()=>uy,AppointmentsPictogram:()=>DY,renderSnackbars:()=>xR,getRegisteredWorkspace2Names:()=>x4,logout:()=>om,toLocationObject:()=>ip,ChartLineIcon:()=>cZ,UserHasAccess:()=>u1,evaluateAsBooleanAsync:()=>iA,createDashboard:()=>ms,getLocations:()=>ih,useExtensionContext:()=>uh,getExtensionsConfigStore:()=>nS,getRouteMapDefaultMap:()=>o6,age:()=>DO,isOmrsDateStrict:()=>wO,registerWorkspaceGroups2:()=>s5,usePaginationInfo:()=>uZ,evaluateAsync:()=>iM,useOpenmrsFetchAll:()=>uN,removeImportMapOverride:()=>oA,useVisitTypes:()=>ct,ageAsDuration:()=>DT,getExtensionNameFromId:()=>sL,DataEntryPictogram:()=>D3,renderParcel:()=>ln,ResetIcon:()=>dF,RenewIcon:()=>dA,useWorkspace2Context:()=>x1,subscribeActionableNotificationShown:()=>D,ErrorCard:()=>Eq,GenderFemaleIcon:()=>dr,enableImportMapOverride:()=>oF,enableTranslationInspector:()=>aI,retry:()=>_B,ComponentContext:()=>lu,ExtensionSlot:()=>lC,unsetLeftNav:()=>sX,addImportMapOverride:()=>oj,MaybeIcon:()=>ma,useCustomOverflowMenu:()=>cP,PedestrianFamilyIcon:()=>dO,CtScanPictogram:()=>D2,dispatchNotificationShown:()=>y,leftNavStore:()=>sq,OpenmrsFetchError:()=>a6,UserFollowIcon:()=>d2,launchWorkspaceGroup2:()=>xV,ChevronRightIcon:()=>c0,UserXrayIcon:()=>d3,GenderOtherIcon:()=>da,formatDuration:()=>wG,toOmrsIsoString:()=>wI,Labs2Pictogram:()=>xn,workspace2Store:()=>s4,setUserLanguage:()=>or,useBodyScrollLock:()=>ua,SyringeIcon:()=>dG,LocationPicker:()=>EX,useDebounce:()=>uc,TimeIcon:()=>dq,getExtensionSlotConfig:()=>nx,AddIcon:()=>cM,getRouteMapOverrideMap:()=>o9,processConfig:()=>n2,InventoryManagementIcon:()=>dh,registerWorkspaces2:()=>s8,UserIcon:()=>d6,formatPatientName:()=>Dk,fireOpenmrsEvent:()=>id,registerModal:()=>s0,registerTranslationNamespace:()=>nJ,displayName:()=>DC,createLocalStore:()=>B,evaluate:()=>iI,defineExtensionConfigSchema:()=>nX,getSyncLifecycle:()=>lJ,renderWorkspaceWindowsAndMenu:()=>_O,evaluateAsTypeAsync:()=>iV});let p="openmrs:notification-shown",f="openmrs:actionable-notification-shown",h="openmrs:toast-shown",g="openmrs:snack-bar-shown";function y(e){window.dispatchEvent(new CustomEvent(p,{detail:e}))}function v(e){window.dispatchEvent(new CustomEvent(f,{detail:e}))}function b(e){window.dispatchEvent(new CustomEvent(g,{detail:e}))}function w(e){window.dispatchEvent(new CustomEvent(h,{detail:e}))}function E(e){let t=t=>e(t.detail);return window.addEventListener(p,t),()=>window.removeEventListener(p,t)}function D(e){let t=t=>e(t.detail);return window.addEventListener(f,t),()=>window.removeEventListener(f,t)}function x(e){let t=t=>e(t.detail);return window.addEventListener(h,t),()=>window.removeEventListener(h,t)}function _(e){let t=t=>e(t.detail);return window.addEventListener(g,t),()=>window.removeEventListener(g,t)}function S(e,t){let{message:r}=P(e);return"string"==typeof r&&r?r:t}function C(e){let t=P(e);setTimeout(()=>{throw t})}function k(){let e=Error();return t=>{let r=P(t);r.stack+=`
2
2
  Async stacktrace:
3
3
  ${e.stack}`,C(t)}}function P(e){let t;if(e instanceof Error)return e;if(null===e)return Error("'null' was thrown as an error");if("object"==typeof e){try{t=`Object thrown as error: ${JSON.stringify(e)}`}catch(r){t=`Object thrown as error with the following properties: ${Object.keys(e)}`}return Error(t)}if(void 0===e)return Error("'undefined' was thrown as an error");return Error(e.toString())}function R(e,t){if(e===t||Object.is(e,t))return!0;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}if(Array.isArray(t)||"object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);return r.length===n.length&&r.every(r=>e[r]===t[r])}function T(e,t){let r;try{r=e()}catch(e){return}return{getItem:e=>{var n;let a=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),o=null!=(n=r.getItem(e))?n:null;return o instanceof Promise?o.then(a):a(o)},setItem:(e,n)=>r.setItem(e,JSON.stringify(n,null==t?void 0:t.replacer)),removeItem:e=>r.removeItem(e)}}window.onerror=function(e,t,r,n,a){return console.error("Unexpected error: ",a??e),w({description:S(a,"Oops! An unexpected error occurred."),kind:"error",title:"Error"}),!1},window.onunhandledrejection=function(e){console.error("Unhandled rejection: ",e.reason),w({description:S(e.reason,"Oops! An unhandled promise rejection occurred."),kind:"error",title:"Error"})};let O=e=>t=>{try{let r=e(t);if(r instanceof Promise)return r;return{then:e=>O(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>O(t)(e)}}},$=e=>{let t,r=new Set,n=(e,n)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=n?n:"object"!=typeof a||null===a)?a:Object.assign({},t,a),r.forEach(r=>r(t,e))}},a=()=>t,o={setState:n,getState:a,getInitialState:()=>i,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},i=t=e(n,a,o);return o},N=e=>e?$(e):$;function I(){try{return"u">typeof process&&("true"===process.env.VITEST||void 0!==process.env.JEST_WORKER_ID)||"u">typeof globalThis&&("__vitest_worker__"in globalThis||"__jest__"in globalThis)}catch{return!1}}let M={},j=Symbol.for("openmrs.esm-state.instanceCount"),A=globalThis,L=(A[j]??0)+1;function F(e,t,r="none"){let n=M[e];if(n)return n.active?I()||console.error(`Attempted to override the existing store ${e}. Make sure that stores are only created once.`):n.value.setState(t,!0),n.active=!0,n.value;{let n=H(e,t,r);return M[e]={value:n,active:!0},n}}function B(e){return N()(()=>e)}function V(e,t){let r=M[e];return r?(r.active?I()||console.error(`Attempted to override the existing store ${e}. Make sure that stores are only created once.`):r.value=t,r.active=!0,r.value):(M[e]={value:t,active:!0},t)}function U(e,t,r="none"){let n=M[e];if(!n){let n=H(e,t??{},r);return M[e]={value:n,active:!1},n}return n.value}function W(...e){let[t,r,n]=e,a=void 0===n?r:n,o=void 0===n?e=>e:r,i=o(t.getState());return a(i),t.subscribe(e=>{let t=o(e);R(i,t)||(i=t,a(t))})}function H(e,t,r){return"sessionStorage"===r?N()(((e,t)=>{if("getStorage"in t||"serialize"in t||"deserialize"in t)return console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),(r,n,a)=>{let o,i,s={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},l=!1,u=new Set,c=new Set;try{o=s.getStorage()}catch(e){}if(!o)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...e)},n,a);let d=O(s.serialize),m=()=>{let e,t=d({state:s.partialize({...n()}),version:s.version}).then(e=>o.setItem(s.name,e)).catch(t=>{e=t});if(e)throw e;return t},p=a.setState;a.setState=(e,t)=>{p(e,t),m()};let f=e((...e)=>{r(...e),m()},n,a),h=()=>{var e;if(!o)return;l=!1,u.forEach(e=>e(n()));let t=(null==(e=s.onRehydrateStorage)?void 0:e.call(s,n()))||void 0;return O(o.getItem.bind(o))(s.name).then(e=>{if(e)return s.deserialize(e)}).then(e=>{if(e)if("number"!=typeof e.version||e.version===s.version)return e.state;else{if(s.migrate)return s.migrate(e.state,e.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}}).then(e=>{var t;return r(i=s.merge(e,null!=(t=n())?t:f),!0),m()}).then(()=>{null==t||t(i,void 0),l=!0,c.forEach(e=>e(i))}).catch(e=>{null==t||t(void 0,e)})};return a.persist={setOptions:e=>{s={...s,...e},e.getStorage&&(o=e.getStorage())},clearStorage:()=>{null==o||o.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:e=>(u.add(e),()=>{u.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},h(),i||f};return(r,n,a)=>{let o,i={storage:T(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},s=!1,l=new Set,u=new Set,c=i.storage;if(!c)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),r(...e)},n,a);let d=()=>{let e=i.partialize({...n()});return c.setItem(i.name,{state:e,version:i.version})},m=a.setState;a.setState=(e,t)=>{m(e,t),d()};let p=e((...e)=>{r(...e),d()},n,a);a.getInitialState=()=>p;let f=()=>{var e,t;if(!c)return;s=!1,l.forEach(e=>{var t;return e(null!=(t=n())?t:p)});let a=(null==(t=i.onRehydrateStorage)?void 0:t.call(i,null!=(e=n())?e:p))||void 0;return O(c.getItem.bind(c))(i.name).then(e=>{if(e)if("number"!=typeof e.version||e.version===i.version)return[!1,e.state];else{if(i.migrate)return[!0,i.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;let[a,s]=e;if(r(o=i.merge(s,null!=(t=n())?t:p),!0),a)return d()}).then(()=>{null==a||a(o,void 0),o=n(),s=!0,u.forEach(e=>e(o))}).catch(e=>{null==a||a(void 0,e)})};return a.persist={setOptions:e=>{i={...i,...e},e.storage&&(c=e.storage)},clearStorage:()=>{null==c||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>f(),hasHydrated:()=>s,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},i.skipHydration||f(),o||p}})(()=>t,{name:e,storage:T(()=>sessionStorage)})):N()(()=>t)}A[j]=L,L>1&&!I()&&console.error(`Detected ${L} copies of @openmrs/esm-framework running on this page. Each copy keeps its own store registry, so stores, configuration and extension state are not shared between them. This usually means a frontend module loaded its own bundled framework instead of the one the app shell provides.`),globalThis.setTimeout?.(()=>{"u">typeof window&&"development"===window.spaEnv&&(window.stores=M)},1e3);let z=function(e){return void 0===e};var K,G,Z,Y,q,J,X,Q,ee,et,er,en,ea="object"==typeof global&&global&&global.Object===Object&&global,eo="object"==typeof self&&self&&self.Object===Object&&self,ei=ea||eo||Function("return this")(),es=ei.Symbol,el=Object.prototype,eu=el.hasOwnProperty,ec=el.toString,ed=es?es.toStringTag:void 0;let em=function(e){var t=eu.call(e,ed),r=e[ed];try{e[ed]=void 0;var n=!0}catch(e){}var a=ec.call(e);return n&&(t?e[ed]=r:delete e[ed]),a};var ep=Object.prototype.toString,ef=es?es.toStringTag:void 0;let eh=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ef&&ef in Object(e)?em(e):ep.call(e)},eg=function(e,t){return function(r){return e(t(r))}};var ey=eg(Object.getPrototypeOf,Object);let ev=function(e){return null!=e&&"object"==typeof e};var eb=Object.prototype,ew=Function.prototype.toString,eE=eb.hasOwnProperty,eD=ew.call(Object);let ex=function(e){if(!ev(e)||"[object Object]"!=eh(e))return!1;var t=ey(e);if(null===t)return!0;var r=eE.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&ew.call(r)==eD},e_=function(e,t){return e===t||e!=e&&t!=t},eS=function(e,t){for(var r=e.length;r--;)if(e_(e[r][0],t))return r;return -1};var eC=Array.prototype.splice;function ek(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ek.prototype.clear=function(){this.__data__=[],this.size=0},ek.prototype.delete=function(e){var t=this.__data__,r=eS(t,e);return!(r<0)&&(r==t.length-1?t.pop():eC.call(t,r,1),--this.size,!0)},ek.prototype.get=function(e){var t=this.__data__,r=eS(t,e);return r<0?void 0:t[r][1]},ek.prototype.has=function(e){return eS(this.__data__,e)>-1},ek.prototype.set=function(e,t){var r=this.__data__,n=eS(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};let eP=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},eR=function(e){if(!eP(e))return!1;var t=eh(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};var eT=ei["__core-js_shared__"],eO=(K=/[^.]+$/.exec(eT&&eT.keys&&eT.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"",e$=Function.prototype.toString;let eN=function(e){if(null!=e){try{return e$.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var eI=/^\[object .+?Constructor\]$/,eM=Object.prototype,ej=Function.prototype.toString,eA=eM.hasOwnProperty,eL=RegExp("^"+ej.call(eA).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let eF=function(e){return!!eP(e)&&(!eO||!(eO in e))&&(eR(e)?eL:eI).test(eN(e))},eB=function(e,t){var r=null==e?void 0:e[t];return eF(r)?r:void 0};var eV=eB(ei,"Map"),eU=eB(Object,"create"),eW=Object.prototype.hasOwnProperty,eH=Object.prototype.hasOwnProperty;function ez(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ez.prototype.clear=function(){this.__data__=eU?eU(null):{},this.size=0},ez.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},ez.prototype.get=function(e){var t=this.__data__;if(eU){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return eW.call(t,e)?t[e]:void 0},ez.prototype.has=function(e){var t=this.__data__;return eU?void 0!==t[e]:eH.call(t,e)},ez.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=eU&&void 0===t?"__lodash_hash_undefined__":t,this};let eK=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},eG=function(e,t){var r=e.__data__;return eK(t)?r["string"==typeof t?"string":"hash"]:r.map};function eZ(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function eY(e){var t=this.__data__=new ek(e);this.size=t.size}eZ.prototype.clear=function(){this.size=0,this.__data__={hash:new ez,map:new(eV||ek),string:new ez}},eZ.prototype.delete=function(e){var t=eG(this,e).delete(e);return this.size-=!!t,t},eZ.prototype.get=function(e){return eG(this,e).get(e)},eZ.prototype.has=function(e){return eG(this,e).has(e)},eZ.prototype.set=function(e,t){var r=eG(this,e),n=r.size;return r.set(e,t),this.size+=+(r.size!=n),this},eY.prototype.clear=function(){this.__data__=new ek,this.size=0},eY.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},eY.prototype.get=function(e){return this.__data__.get(e)},eY.prototype.has=function(e){return this.__data__.has(e)},eY.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ek){var n=r.__data__;if(!eV||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new eZ(n)}return r.set(e,t),this.size=r.size,this};var eq=function(){try{var e=eB(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();let eJ=function(e,t,r){"__proto__"==t&&eq?eq(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},eX=function(e,t,r){(void 0===r||e_(e[t],r))&&(void 0!==r||t in e)||eJ(e,t,r)},eQ=function(e,t,r){for(var n=-1,a=Object(e),o=r(e),i=o.length;i--;){var s=o[++n];if(!1===t(a[s],s,a))break}return e};var e0="object"==typeof exports&&exports&&!exports.nodeType&&exports,e1=e0&&"object"==typeof module&&module&&!module.nodeType&&module,e4=e1&&e1.exports===e0?ei.Buffer:void 0,e2=e4?e4.allocUnsafe:void 0;let e3=function(e,t){if(t)return e.slice();var r=e.length,n=e2?e2(r):new e.constructor(r);return e.copy(n),n};var e6=ei.Uint8Array;let e5=function(e){var t=new e.constructor(e.byteLength);return new e6(t).set(new e6(e)),t},e9=function(e,t){var r=t?e5(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)},e8=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t};var e7=Object.create,te=function(){function e(){}return function(t){if(!eP(t))return{};if(e7)return e7(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),tt=Object.prototype;let tr=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||tt)},tn=function(e){return"function"!=typeof e.constructor||tr(e)?{}:te(ey(e))},ta=function(e){return ev(e)&&"[object Arguments]"==eh(e)};var to=Object.prototype,ti=to.hasOwnProperty,ts=to.propertyIsEnumerable,tl=ta(function(){return arguments}())?ta:function(e){return ev(e)&&ti.call(e,"callee")&&!ts.call(e,"callee")},tu=Array.isArray;let tc=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},td=function(e){return null!=e&&tc(e.length)&&!eR(e)};var tm="object"==typeof exports&&exports&&!exports.nodeType&&exports,tp=tm&&"object"==typeof module&&module&&!module.nodeType&&module,tf=tp&&tp.exports===tm?ei.Buffer:void 0;let th=(tf?tf.isBuffer:void 0)||function(){return!1};var tg={};tg["[object Float32Array]"]=tg["[object Float64Array]"]=tg["[object Int8Array]"]=tg["[object Int16Array]"]=tg["[object Int32Array]"]=tg["[object Uint8Array]"]=tg["[object Uint8ClampedArray]"]=tg["[object Uint16Array]"]=tg["[object Uint32Array]"]=!0,tg["[object Arguments]"]=tg["[object Array]"]=tg["[object ArrayBuffer]"]=tg["[object Boolean]"]=tg["[object DataView]"]=tg["[object Date]"]=tg["[object Error]"]=tg["[object Function]"]=tg["[object Map]"]=tg["[object Number]"]=tg["[object Object]"]=tg["[object RegExp]"]=tg["[object Set]"]=tg["[object String]"]=tg["[object WeakMap]"]=!1;let ty=function(e){return function(t){return e(t)}};var tv="object"==typeof exports&&exports&&!exports.nodeType&&exports,tb=tv&&"object"==typeof module&&module&&!module.nodeType&&module,tw=tb&&tb.exports===tv&&ea.process,tE=function(){try{var e=tb&&tb.require&&tb.require("util").types;if(e)return e;return tw&&tw.binding&&tw.binding("util")}catch(e){}}(),tD=tE&&tE.isTypedArray,tx=tD?ty(tD):function(e){return ev(e)&&tc(e.length)&&!!tg[eh(e)]};let t_=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var tS=Object.prototype.hasOwnProperty;let tC=function(e,t,r){var n=e[t];tS.call(e,t)&&e_(n,r)&&(void 0!==r||t in e)||eJ(e,t,r)},tk=function(e,t,r,n){var a=!r;r||(r={});for(var o=-1,i=t.length;++o<i;){var s=t[o],l=n?n(r[s],e[s],s,r,e):void 0;void 0===l&&(l=e[s]),a?eJ(r,s,l):tC(r,s,l)}return r},tP=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var tR=/^(?:0|[1-9]\d*)$/;let tT=function(e,t){var r=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==r||"symbol"!=r&&tR.test(e))&&e>-1&&e%1==0&&e<t};var tO=Object.prototype.hasOwnProperty;let t$=function(e,t){var r=tu(e),n=!r&&tl(e),a=!r&&!n&&th(e),o=!r&&!n&&!a&&tx(e),i=r||n||a||o,s=i?tP(e.length,String):[],l=s.length;for(var u in e)(t||tO.call(e,u))&&!(i&&("length"==u||a&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||tT(u,l)))&&s.push(u);return s},tN=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t};var tI=Object.prototype.hasOwnProperty;let tM=function(e){if(!eP(e))return tN(e);var t=tr(e),r=[];for(var n in e)"constructor"==n&&(t||!tI.call(e,n))||r.push(n);return r},tj=function(e){return td(e)?t$(e,!0):tM(e)},tA=function(e,t,r,n,a,o,i){var s=t_(e,r),l=t_(t,r),u=i.get(l);if(u)return void eX(e,r,u);var c=o?o(s,l,r+"",e,t,i):void 0,d=void 0===c;if(d){var m=tu(l),p=!m&&th(l),f=!m&&!p&&tx(l);(c=l,m||p||f)?tu(s)?c=s:ev(s)&&td(s)?c=e8(s):p?(d=!1,c=e3(l,!0)):f?(d=!1,c=e9(l,!0)):c=[]:ex(l)||tl(l)?(c=s,tl(s))?c=tk(s,tj(s)):(!eP(s)||eR(s))&&(c=tn(l)):d=!1}d&&(i.set(l,c),a(c,l,n,o,i),i.delete(l)),eX(e,r,c)},tL=function e(t,r,n,a,o){t!==r&&eQ(r,function(i,s){if(o||(o=new eY),eP(i))tA(t,r,s,n,e,a,o);else{var l=a?a(t_(t,s),i,s+"",t,r,o):void 0;void 0===l&&(l=i),eX(t,s,l)}},tj)},tF=function(e){return e},tB=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)};var tV=Math.max;let tU=function(e,t,r){return t=tV(void 0===t?e.length-1:t,0),function(){for(var n=arguments,a=-1,o=tV(n.length-t,0),i=Array(o);++a<o;)i[a]=n[t+a];a=-1;for(var s=Array(t+1);++a<t;)s[a]=n[a];return s[t]=r(i),tB(e,this,s)}};var tW=Date.now,tH=(G=eq?function(e,t){return eq(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:tF,Z=0,Y=0,function(){var e=tW(),t=16-(e-Y);if(Y=e,t>0){if(++Z>=800)return arguments[0]}else Z=0;return G.apply(void 0,arguments)});let tz=function(e,t,r){if(!eP(r))return!1;var n=typeof t;return("number"==n?!!(td(r)&&tT(t,r.length)):"string"==n&&t in r)&&e_(r[t],e)},tK=function(e){var t;return tH(tU(t=function(t,r){var n=-1,a=r.length,o=a>1?r[a-1]:void 0,i=a>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,i&&tz(r[0],r[1],i)&&(o=a<3?void 0:o,a=1),t=Object(t);++n<a;){var s=r[n];s&&e(t,s,n,o)}return t},void 0,tF),t+"")};var tG=tK(function(e,t,r,n){tL(e,t,r,n)});function tZ(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new eZ;++t<r;)this.add(e[t])}tZ.prototype.add=tZ.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},tZ.prototype.has=function(e){return this.__data__.has(e)};let tY=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1},tq=function(e,t,r,n,a,o){var i=1&r,s=e.length,l=t.length;if(s!=l&&!(i&&l>s))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,m=!0,p=2&r?new tZ:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var f=e[d],h=t[d];if(n)var g=i?n(h,f,d,t,e,o):n(f,h,d,e,t,o);if(void 0!==g){if(g)continue;m=!1;break}if(p){if(!tY(t,function(e,t){if(!p.has(t)&&(f===e||a(f,e,r,n,o)))return p.push(t)})){m=!1;break}}else if(!(f===h||a(f,h,r,n,o))){m=!1;break}}return o.delete(e),o.delete(t),m},tJ=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r},tX=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r};var tQ=es?es.prototype:void 0,t0=tQ?tQ.valueOf:void 0;let t1=function(e,t,r,n,a,o,i){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":if(e.byteLength!=t.byteLength||!o(new e6(e),new e6(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return e_(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=tJ;case"[object Set]":var l=1&n;if(s||(s=tX),e.size!=t.size&&!l)break;var u=i.get(e);if(u)return u==t;n|=2,i.set(e,t);var c=tq(s(e),s(t),n,a,o,i);return i.delete(e),c;case"[object Symbol]":if(t0)return t0.call(e)==t0.call(t)}return!1},t4=function(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e},t2=function(e,t,r){var n=t(e);return tu(e)?n:t4(n,r(e))},t3=function(e,t){for(var r=-1,n=null==e?0:e.length,a=0,o=[];++r<n;){var i=e[r];t(i,r,e)&&(o[a++]=i)}return o},t6=function(){return[]};var t5=Object.prototype.propertyIsEnumerable,t9=Object.getOwnPropertySymbols,t8=t9?function(e){return null==e?[]:t3(t9(e=Object(e)),function(t){return t5.call(e,t)})}:t6,t7=eg(Object.keys,Object),re=Object.prototype.hasOwnProperty;let rt=function(e){if(!tr(e))return t7(e);var t=[];for(var r in Object(e))re.call(e,r)&&"constructor"!=r&&t.push(r);return t},rr=function(e){return td(e)?t$(e):rt(e)},rn=function(e){return t2(e,rr,t8)};var ra=Object.prototype.hasOwnProperty;let ro=function(e,t,r,n,a,o){var i=1&r,s=rn(e),l=s.length;if(l!=rn(t).length&&!i)return!1;for(var u=l;u--;){var c=s[u];if(!(i?c in t:ra.call(t,c)))return!1}var d=o.get(e),m=o.get(t);if(d&&m)return d==t&&m==e;var p=!0;o.set(e,t),o.set(t,e);for(var f=i;++u<l;){var h=e[c=s[u]],g=t[c];if(n)var y=i?n(g,h,c,t,e,o):n(h,g,c,e,t,o);if(!(void 0===y?h===g||a(h,g,r,n,o):y)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){var v=e.constructor,b=t.constructor;v!=b&&"constructor"in e&&"constructor"in t&&!("function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b)&&(p=!1)}return o.delete(e),o.delete(t),p};var ri=eB(ei,"DataView"),rs=eB(ei,"Promise"),rl=eB(ei,"Set"),ru=eB(ei,"WeakMap"),rc="[object Map]",rd="[object Promise]",rm="[object Set]",rp="[object WeakMap]",rf="[object DataView]",rh=eN(ri),rg=eN(eV),ry=eN(rs),rv=eN(rl),rb=eN(ru),rw=eh;(ri&&rw(new ri(new ArrayBuffer(1)))!=rf||eV&&rw(new eV)!=rc||rs&&rw(rs.resolve())!=rd||rl&&rw(new rl)!=rm||ru&&rw(new ru)!=rp)&&(rw=function(e){var t=eh(e),r="[object Object]"==t?e.constructor:void 0,n=r?eN(r):"";if(n)switch(n){case rh:return rf;case rg:return rc;case ry:return rd;case rv:return rm;case rb:return rp}return t});let rE=rw;var rD="[object Arguments]",rx="[object Array]",r_="[object Object]",rS=Object.prototype.hasOwnProperty;let rC=function(e,t,r,n,a,o){var i=tu(e),s=tu(t),l=i?rx:rE(e),u=s?rx:rE(t);l=l==rD?r_:l,u=u==rD?r_:u;var c=l==r_,d=u==r_,m=l==u;if(m&&th(e)){if(!th(t))return!1;i=!0,c=!1}if(m&&!c)return o||(o=new eY),i||tx(e)?tq(e,t,r,n,a,o):t1(e,t,l,r,n,a,o);if(!(1&r)){var p=c&&rS.call(e,"__wrapped__"),f=d&&rS.call(t,"__wrapped__");if(p||f){var h=p?e.value():e,g=f?t.value():t;return o||(o=new eY),a(h,g,r,n,o)}}return!!m&&(o||(o=new eY),ro(e,t,r,n,a,o))},rk=function(e,t){return function e(t,r,n,a,o){return t===r||(null!=t&&null!=r&&(ev(t)||ev(r))?rC(t,r,n,a,e,o):t!=t&&r!=r)}(e,t)},rP=function(e,t){for(var r=-1,n=null==e?0:e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a},rR=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e};var rT=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)t4(t,t8(e)),e=ey(e);return t}:t6;let rO=function(e){return t2(e,tj,rT)};var r$=Object.prototype.hasOwnProperty;let rN=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&r$.call(e,"index")&&(r.index=e.index,r.input=e.input),r},rI=function(e,t){var r=t?e5(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)};var rM=/\w*$/;let rj=function(e){var t=new e.constructor(e.source,rM.exec(e));return t.lastIndex=e.lastIndex,t};var rA=es?es.prototype:void 0,rL=rA?rA.valueOf:void 0;let rF=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return e5(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return rI(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return e9(e,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return rj(e);case"[object Symbol]":return rL?Object(rL.call(e)):{}}};var rB=tE&&tE.isMap,rV=rB?ty(rB):function(e){return ev(e)&&"[object Map]"==rE(e)},rU=tE&&tE.isSet,rW=rU?ty(rU):function(e){return ev(e)&&"[object Set]"==rE(e)},rH="[object Arguments]",rz="[object Function]",rK="[object Object]",rG={};rG[rH]=rG["[object Array]"]=rG["[object ArrayBuffer]"]=rG["[object DataView]"]=rG["[object Boolean]"]=rG["[object Date]"]=rG["[object Float32Array]"]=rG["[object Float64Array]"]=rG["[object Int8Array]"]=rG["[object Int16Array]"]=rG["[object Int32Array]"]=rG["[object Map]"]=rG["[object Number]"]=rG[rK]=rG["[object RegExp]"]=rG["[object Set]"]=rG["[object String]"]=rG["[object Symbol]"]=rG["[object Uint8Array]"]=rG["[object Uint8ClampedArray]"]=rG["[object Uint16Array]"]=rG["[object Uint32Array]"]=!0,rG["[object Error]"]=rG[rz]=rG["[object WeakMap]"]=!1;let rZ=function e(t,r,n,a,o,i){var s,l=1&r,u=2&r,c=4&r;if(n&&(s=o?n(t,a,o,i):n(t)),void 0!==s)return s;if(!eP(t))return t;var d=tu(t);if(d){if(s=rN(t),!l)return e8(t,s)}else{var m,p,f,h,g=rE(t),y=g==rz||"[object GeneratorFunction]"==g;if(th(t))return e3(t,l);if(g==rK||g==rH||y&&!o){if(s=u||y?{}:tn(t),!l)return u?(p=(m=s)&&tk(t,tj(t),m),tk(t,rT(t),p)):(h=(f=s)&&tk(t,rr(t),f),tk(t,t8(t),h))}else{if(!rG[g])return o?t:{};s=rF(t,g,l)}}i||(i=new eY);var v=i.get(t);if(v)return v;i.set(t,s),rW(t)?t.forEach(function(a){s.add(e(a,r,n,a,t,i))}):rV(t)&&t.forEach(function(a,o){s.set(o,e(a,r,n,o,t,i))});var b=c?u?rO:rn:u?tj:rr,w=d?void 0:b(t);return rR(w||t,function(a,o){w&&(a=t[o=a]),tC(s,o,e(a,r,n,o,t,i))}),s},rY=function(e){return"symbol"==typeof e||ev(e)&&"[object Symbol]"==eh(e)};var rq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rJ=/^\w*$/;let rX=function(e,t){if(tu(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||rY(e))||rJ.test(e)||!rq.test(e)||null!=t&&e in Object(t)};function rQ(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var r=function(){var n=arguments,a=t?t.apply(this,n):n[0],o=r.cache;if(o.has(a))return o.get(a);var i=e.apply(this,n);return r.cache=o.set(a,i)||o,i};return r.cache=new(rQ.Cache||eZ),r}rQ.Cache=eZ;var r0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r1=/\\(\\)?/g,r4=(J=(q=rQ(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(r0,function(e,r,n,a){t.push(n?a.replace(r1,"$1"):r||e)}),t},function(e){return 500===J.size&&J.clear(),e})).cache,q),r2=1/0,r3=es?es.prototype:void 0,r6=r3?r3.toString:void 0;let r5=function e(t){if("string"==typeof t)return t;if(tu(t))return rP(t,e)+"";if(rY(t))return r6?r6.call(t):"";var r=t+"";return"0"==r&&1/t==-r2?"-0":r},r9=function(e,t){return tu(e)?e:rX(e,t)?[e]:r4(null==e?"":r5(e))},r8=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var r7=1/0;let ne=function(e){if("string"==typeof e||rY(e))return e;var t=e+"";return"0"==t&&1/e==-r7?"-0":t},nt=function(e,t){t=r9(t,e);for(var r=0,n=t.length;null!=e&&r<n;)e=e[ne(t[r++])];return r&&r==n?e:void 0},nr=function(e,t,r){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(r=r>a?a:r)<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(a);++n<a;)o[n]=e[n+t];return o};var nn=Object.prototype.hasOwnProperty;let na=function(e,t){t=r9(t,e);var r,n=-1,a=t.length;if(!a)return!0;for(;++n<a;){var o=ne(t[n]);if("__proto__"===o&&!nn.call(e,"__proto__")||("constructor"===o||"prototype"===o)&&n<a-1)return!1}var i=(r=t).length<2?e:nt(e,nr(r,0,-1));return null==i||delete i[ne(r8(t))]},no=function(e){return ex(e)?void 0:e};var ni=es?es.isConcatSpreadable:void 0;let ns=function(e){return tu(e)||tl(e)||!!(ni&&e&&e[ni])},nl=function e(t,r,n,a,o){var i=-1,s=t.length;for(n||(n=ns),o||(o=[]);++i<s;){var l=t[i];r>0&&n(l)?r>1?e(l,r-1,n,a,o):t4(o,l):a||(o[o.length]=l)}return o};var nu=tH(tU(X=function(e,t){var r={};if(null==e)return r;var n=!1;t=rP(t,function(t){return t=r9(t,e),n||(n=t.length>1),t}),tk(e,rO(e),r),n&&(r=rZ(r,7,no));for(var a=t.length;a--;)na(r,t[a]);return r},void 0,function(e){return(null==e?0:e.length)?nl(e,1):[]}),X+""),nc=((Q={}).Array="Array",Q.Boolean="Boolean",Q.ConceptUuid="ConceptUuid",Q.Number="Number",Q.Object="Object",Q.String="String",Q.UUID="UUID",Q.PersonAttributeTypeUuid="PersonAttributeTypeUuid",Q.PatientIdentifierTypeUuid="PatientIdentifierTypeUuid",Q);function nd(e,t){return r=>{if(!e(r))if("function"==typeof t)return t(r);else return t}}let nm=nd(e=>Array.isArray(e),"must be an array"),np=nd(e=>"boolean"==typeof e,"must be a boolean"),nf=nd(e=>"number"==typeof e,"must be a number"),nh=nd(e=>"string"==typeof e,"must be a string"),ng=nd(e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,"must be an object (not an array or null)"),ny=nd(e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[0-9a-f]{36}$/i.test(e),"must be a valid UUID or a 36-character hexadecimal string"),nv=F("config-internal",{providedConfigs:[],schemas:{},moduleLoaded:{},moduleStarted:{}}),nb=F("temporary-config",{config:function(){try{return JSON.parse(localStorage.getItem("openmrs:temporaryConfig")||"{}")}catch(e){return{}}}()});nb.subscribe(e=>{var t=e.config;try{localStorage.setItem("openmrs:temporaryConfig",JSON.stringify(t))}catch(e){}});let nw=F("config-store-of-extension-state",{mountedExtensions:[]});function nE(e){return U(`config-module-${e}`,{config:null,loaded:!1,translationOverridesLoaded:!1})}function nD(){return U("config-extension-slots",{slots:{}})}function nx(e){return n_(nD().getState(),e)}function n_(e,t){return e.slots[t]??{loaded:!1,config:{}}}function nS(){return U("config-extensions",{configs:{}})}function nC(e,t,r){return e.configs[t]?.[r]??{loaded:!1,config:null}}function nk(e,t,r){return e.configure?.[r]??null}let nP=N()(()=>({config:{}})),nR=0,nT=!0,nO=!1;function n$(e){n=e}function nN(){nT=!0,nR>0&&nI()}function nI(){if(nT&&n&&!nO){nO=!0,nT=!1;try{n()}catch(e){nT=!0,nM(e),console.error("Failed to derive the implementer tools config",e)}finally{nO=!1}}}function nM(e){nP.setState({derivationError:e instanceof Error?e.message:String(e)})}function nj(){nP.getState().derivationError&&nP.setState({derivationError:void 0})}let nA=V("config-implementer-tools",{...nP,getState:()=>(0===nR&&nI(),nP.getState()),setState:(...e)=>(nT=!1,nP.setState(...e)),subscribe(e){nR++,nI();let t=nP.subscribe(e),r=!1;return()=>{!r&&(r=!0,nR--),t()}}});function nL(e,t){if(Array.isArray(t))return t}function nF(e,t){return tG({},e,t,nL)}let nB=[],nV=new Set,nU=null,nW=new WeakMap;function nH(){n=()=>{var e,t;let r,n;return e=nv.getState(),t=nb.getState(),r=nA.getState(),n={config:function(e,t){let r=function(e){let t={};for(let[r,n]of Object.entries(e)){let e=n5.get(r);if(e&&e.schema===n)t[r]=e.annotated;else{let e=function e(t){return t.hasOwnProperty("_default")?{...t,_value:t._default,_source:"default"}:as(t)?Object.keys(t).reduce((r,n)=>(r[n]=e(t[n]),r),{}):{}}(rZ(n,5));n5.set(r,{schema:n,annotated:e}),t[r]=e}}return t}(e.schemas),n=[...e.providedConfigs.map(e=>[e.config,e.source]),[t.config,"temporary config"]],a=new Set(Object.keys(r));for(let[e]of n)for(let t of Object.keys(e))a.add(t);let o={};for(let e of a){let t=r[e],a=n.map(([t])=>t[e]),i=n.map(([,e])=>e),s=n6.get(e);if(s&&s.annotatedSchema===t&&s.configSlices.length===a.length&&s.configSlices.every((e,t)=>e===a[t])&&s.sources.every((e,t)=>e===i[t])){o[e]=s.result;continue}let l=t??{};n.forEach(([,e],t)=>{let r=a[t];void 0!==r&&(l=nF(l,function e(t,r){return as(t)?Object.keys(t).reduce((n,a)=>(n[a]=e(t[a],r),n),{}):{_value:t,_source:r}}(r,e)))}),n6.set(e,{annotatedSchema:t,configSlices:a,sources:i,result:l}),o[e]=l}return o}(e,t)},void(rk(r.config,n.config)||nA.setState(n))},nz(),nB.push(nv.subscribe(nz),nb.subscribe(nz),nw.subscribe(nz))}function nz(){nj();try{!function(){let e=nv.getState(),t=nb.getState(),r=nw.getState();if(nU?.configState===e&&nU.tempConfigState===t)return nG(e,r,t,nU.slotConfigs,!0);!function(e,t){for(let r of Object.keys(e.schemas)){let n,a=nE(r),o=e.schemas[r],i=!!e.moduleLoaded[r],s=nK.get(r);if(s&&s.schema===o&&s.moduleLoaded===i&&s.providedConfigs===e.providedConfigs&&s.temporaryConfig===t.config)n=s.state;else{let a=i?function(e,t,r){let n=t.schemas[e],a=n7(e,n9(t,r));at(n,a,e);let o=ao(n,a);return ar(n,o,e),delete o.extensionSlots,o}(r,e,t):function(e,t,r){let n=ao(ap,n7(e,n9(t,r)));return ar(ap,n,e),delete n.extensionSlots,n}(r,e,t);n={translationOverridesLoaded:!0,loaded:i,config:a},nK.set(r,{schema:o,moduleLoaded:i,providedConfigs:e.providedConfigs,temporaryConfig:t.config,state:n})}let l=a.getState();l.loaded===n.loaded&&l.translationOverridesLoaded===n.translationOverridesLoaded&&rk(l.config,n.config)||a.setState(n)}}(e,t);let n=function(e,t){let r=ae(n9(e,t)),n=Object.keys(r).reduce((e,t)=>(r[t]?.extensionSlots&&(e[t]=r[t]?.extensionSlots),e),{});var a=n;for(let[e,t]of Object.entries(a))for(let[r,n]of Object.entries(t))!function(e,t,r){let n=`${t}.extensionSlots.${r}`,a=`Extension slot config '${n}'`,o=Object.keys(e).filter(e=>!["add","remove","order","configure"].includes(e));o.length&&al(n,a+`' contains invalid keys '${o.join("', '")}'`),!e.add||Array.isArray(e.add)&&e.add.every(e=>"string"==typeof e)||al(n,a+".add' is invalid. Must be an array of strings (extension IDs)"),!e.remove||Array.isArray(e.remove)&&e.remove.every(e=>"string"==typeof e)||al(n,a+".remove' is invalid. Must be an array of strings (extension IDs)"),!e.order||Array.isArray(e.order)&&e.order.every(e=>"string"==typeof e)||al(n,a+".order' is invalid. Must be an array of strings (extension IDs)"),e.configure&&!as(e.configure)&&al(n,a+".configure' is invalid. Must be an object with extension IDs for keys")}(n,e,r);let o={},i={};for(let e of Object.values(n))for(let[t,r]of Object.entries(e))o[t]=r,r.configure&&(i[t]??(i[t]=[])).push(r.configure);for(let[e,t]of Object.entries(i)){let r=1===t.length?t[0]:ae(t);o[e].configure!==r&&(o[e]={...o[e],configure:r})}return o}(e,t);(function(e){let t=nD(),r=t.getState().slots,n={},a=!1;for(let[t,o]of Object.entries(e)){let e=r[t];e?.loaded&&rk(e.config,o)?n[t]=e:(n[t]={loaded:!0,config:o},a=!0)}(a||Object.keys(r).length!==Object.keys(n).length)&&t.setState({slots:n})})(n),nG(e,r,t,n,!1),nU={configState:e,tempConfigState:t,slotConfigs:n},nN()}()}catch(e){nM(e),console.error("Failed to recompute the configuration",e)}}nH();let nK=new Map;function nG(e,t,r,n,a){let o=nS(),i=o.getState().configs,s={},l=!1,u=0;for(let o of t.mountedExtensions){let t,c=i[o.slotName]?.[o.extensionId],d=c&&nW.get(c);if(a&&c?.loaded&&d?.slotModuleName===o.slotModuleName&&d.extensionModuleName===o.extensionModuleName)t=c;else{let a=function(e,t,r,n,a,o,i){let s=function(e){let[t]=e.split("#");return t}(n),l=a.schemas[s],u=!!a.moduleStarted[t],c=JSON.stringify([r,n,e,t]),d=n3.get(c);if(d&&d.extensionSchema===l&&d.extensionModuleSchema===a.schemas[t]&&d.extensionModuleStarted===u&&d.providedConfigs===a.providedConfigs&&d.temporaryConfig===o.config)return d.config;let m=l?s:t,p=n9(a,o),f=i?.configure?.[n]??{},h=n7(e,p),g=h?.extensionSlots?.[r]?.configure?.[n]??{},y=ae([n7(m,p),f,g]),v=l??a.schemas[t];(l||u)&&at(v,y,m);let b=ao(v,y);return ar(v,b,m),delete b.extensionSlots,n3.set(c,{extensionSchema:l,extensionModuleSchema:a.schemas[t],extensionModuleStarted:u,providedConfigs:a.providedConfigs,temporaryConfig:o.config,config:b}),b}(o.slotModuleName,o.extensionModuleName,o.slotName,o.extensionId,e,r,n[o.slotName]);t=c?.loaded&&rk(c.config,a)?c:{config:a,loaded:!0}}nW.set(t,o),t!==c&&(l=!0),s[o.slotName]||(s[o.slotName]={}),s[o.slotName][o.extensionId]=t,u++}for(let[e,t]of Object.entries(s)){let r=i[e];r&&Object.keys(r).length===Object.keys(t).length&&Object.entries(t).every(([e,t])=>r[e]===t)&&(s[e]=r)}l||(l=Object.keys(i).length!==Object.keys(s).length||Object.values(i).reduce((e,t)=>e+Object.keys(t).length,0)!==u),l&&o.setState({configs:s})}function nZ(e,t){n8(e,t);let r=nF(t,ap);nv.setState(t=>({...t,schemas:{...t.schemas,[e]:r},moduleLoaded:{...t.moduleLoaded,[e]:!0}}))}function nY(e){nv.setState(t=>({...t,schemas:{...t.schemas,[e]:ap}}))}function nq(e){nv.setState(t=>({...t,moduleLoaded:{...t.moduleLoaded,[e]:!0},moduleStarted:{...t.moduleStarted,[e]:!0}}))}function nJ(e){nv.setState(t=>({...t,schemas:{...t.schemas,[e]:am}}))}function nX(e,t){n8(e,t);let r=nF(t,ap);nv.getState().schemas[e]&&console.error(`Config schema for extension ${e} already exists. If there are multiple extensions with this same name, one will probably crash.`),nv.setState(t=>({...t,schemas:{...t.schemas,[e]:r}}))}function nQ(e,t="provided"){nv.setState(r=>({...r,providedConfigs:[...r.providedConfigs,{source:t,config:e}]}))}function n0(e,t,r){return new Promise(n=>{let a,o=!1;function i(e){!o&&t(e)&&(o=!0,n(r(e)),a?.())}i(e.getState()),o||(a=e.subscribe(i))})}function n1(e){return n0(nE(e),e=>!!(e.loaded&&e.config),e=>nu(e.config,["Display conditions","Translation overrides"]))}function n4(e,t,r){let n=[e in nv.getState().schemas?n0(nE(e),e=>!!(e.translationOverridesLoaded&&e.config),e=>e.config["Translation overrides"]??{}):Promise.resolve({})];if(t&&r){let e=nC(nS().getState(),t,r),a=e.loaded&&e.config?e.config["Translation overrides"]??{}:{};n.push(Promise.resolve(a))}return Promise.all(n)}function n2(e,t,r){at(e,t,r);let n=ao(e,t);return ar(e,n,r),n}let n3=new Map,n6=new Map,n5=new Map;function n9(e,t){return[...e.providedConfigs.map(e=>e.config),t.config]}function n8(e,t,r=""){let n="Please verify that you are running the latest version and, if so, alert the maintainer.";for(let a of Object.keys(t).filter(e=>!e.startsWith("_"))){let o=r+(r&&".")+a,i=t[a];if("Display conditions"===o&&console.error(`${e} declares a configuration option called "Display conditions"; the "Display conditions" option is a reserved name. ${n}`),"Translation overrides"===o&&console.error(`${e} declares a configuration option called "Translation overrides"; the "Translation overrides" option is a reserved name. ${n}`),!as(i)){console.error(`${e} has bad config schema definition for key '${o}'. ${n}`);continue}i.hasOwnProperty("_default")||n8(e,i,o);let s=i._elements;if(ai(s)&&n8(e,s,o+"._elements"),i._validators)for(let t of i._validators)"function"!=typeof t&&console.error(`${e} has invalid validator for key '${o}' ${n}.
4
4
 
@@ -12,7 +12,7 @@ If you're the maintainer: the 'elements' key only works with '_type' equal to 'A
12
12
  ${t}`)}return n}let ao=(e,t)=>{let r=structuredClone(t);if(!e)return r;for(let t of Object.keys(e)){let n=r[t],a=e[t];if(a&&(a.hasOwnProperty("_type")||a.hasOwnProperty("_default"))){r.hasOwnProperty(t)||(r[t]=a._default);let e=a._elements;if(n&&ai(e)){if(a._type===nc.Array&&Array.isArray(n)){let a=n.map(t=>ao(e,t));r[t]=a}else if(a._type===nc.Object)for(let t of Object.keys(n))n[t]=ao(e,n[t])}}else if(as(a)){let e=n??{};as(e)&&(r[t]=ao(a,e))}}return r};function ai(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function as(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function al(e,t){let r=`${e}:::${t}`;nV.has(r)||(console.error(t),nV.add(r))}function au(e){e?nV.forEach(t=>{t.startsWith(e)&&nV.delete(t)}):nV.clear()}function ac(){nB.forEach(e=>e()),nB.length=0,nK.clear(),n3.clear(),n5.clear(),n6.clear(),nU=null,nW=new WeakMap,nH()}function ad(e){if(!e.includes("-"))return/^[a-z]{2,3}$/.test(e);try{return Intl.getCanonicalLocales(e)[0]===e}catch{return!1}}let am={"Translation overrides":{_description:"Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value",_type:nc.Object,_default:{},_validators:[nd(e=>Object.keys(e).every(ad),e=>{let t=Object.keys(e).filter(e=>!ad(e));return`The 'Translation overrides' object should have language codes for keys. Language codes must be BCP 47 language tags in canonical form, such as 'fr', 'pt-BR', 'es-419' or 'zh-Hant'. The following keys do not conform: ${t.join(", ")}.`})]}},ap={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:nc.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:nc.String,_default:void 0}},...am},af=(e,t)=>nd(r=>e<=r&&r<=t,`must be between ${e} and ${t}`),ah=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return nd(e=>{if(!e||"string"!=typeof e)return!1;let r=/\${(.*?)}/g,n=r.exec(e);for(;n;){if(!t.includes(n[1]))return!1;n=r.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},ag=ah([]),ay=e=>nd(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),av={inRange:af,isUrl:ag,isUrlWithTemplateParameters:ah,oneOf:ay};var ab=r(8067);let aw=F("breadcrumbs",[]);function aE(e){return aD([e])}function aD(e){let t=[...ax(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,ab.pathToRegexp)(e.matcher).regexp:(0,ab.pathToRegexp)(e.path).regexp,settings:e}))];aw.setState(t,!0)}function ax(){return aw.getState()}function a_(e,t){if(t)return function(e,t){let[r]=e.filter(e=>e.matcher.test(t));return r}(e,t)||function(e,t){let r=t.split("/");for(;r.length>1;){r.pop();let t=a_(e,r.join("/"));if(t)return t}}(e,t)}function aS(e,t){if(e.length>0){let r=a_(e,t);if(r){let t=[r],n=a_(e,r.settings.parent);for(;void 0!==n;)t.push(n),n=a_(e,n.settings.parent);return t.reverse()}}return[]}function aC(e){return aS(ax(),e)}var ak=r(366),aP=r(2635);let aR={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",discardUnsavedChangesPromptBodyMultiple:"{{count}} workspaces have unsaved changes. Closing them will discard the changes:",discardUnsavedChangesPromptBodySingle:"<strong>{{workspaceTitle}}</strong> has unsaved changes. Closing it will discard them.",discardUnsavedChangesPromptTitle:"Discard unsaved changes?",keepEditing:"Keep editing",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",applicationError:"Application Error",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",clearDevOverrides:"Clear dev overrides",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",copied:"Copied!",copyToClipboard:"Copy to clipboard",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",localVersion:"Local Build",male:"Male",navigateNonHttp:"Could not navigate to the requested page as it is not a safe URL",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",prereleaseVersion:"Prerelease",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",provisional:"Provisional",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",reload:"Reload",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",serverStartingUp:"The server is starting",serverStartingUpExplainer:"This can take a few minutes. OpenMRS will open automatically when the server is ready.",serverStartingUpSlowExplainer:"This is taking longer than usual. First startup after an upgrade can take 10 minutes or more. You can leave this page open.",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",somethingWentWrongTryReloading:"Something went wrong. Please try reloading.",toggleDevTools:"Toggle dev tools",unknown:"Unknown",viewSetupProgress:"View setup progress",waitingForServer:"Waiting for the server",yearAbbreviation:"yr",yearsAbbreviation:"yrs"},aT=aP.Ay.default||aP.Ay,aO="___",a$=new Map,aN=!1;function aI(){aN=!0,aT.emit("languageChanged",aT.language)}function aM(){aN=!1,a$.clear()}function aj(){return aN}function aA(e){if(!aN)return;let t=a$.get(e.value);if(!t){a$.size>=2e4&&a$.delete(a$.keys().next().value),a$.set(e.value,[{...e}]);return}let r=t.find(t=>t.key===e.key&&t.namespace===e.namespace&&t.extensionNamespace===e.extensionNamespace);r?r.hasCount||(r.hasCount=e.hasCount):t.push({...e}),a$.delete(e.value),a$.set(e.value,t)}function aL(e){return e&&aN?(a$.get(e)??a$.get(e.trim())??[]).map(e=>({...e})):[]}let aF=aP.Ay.default||aP.Ay;function aB(e,t,r,n){return aF.t(t,{ns:e,defaultValue:r,...n})}function aV(e,t,r){return aR[e]?aB("core",e,t??aR[e],r):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}function aU(e,t){let r=window.getOpenmrsSpaBase().replace(/\/$/,""),n=aW(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:r,...t});return e.startsWith("//")?n:n.replace(/^\/\//,"/")}function aW(e,t){return Object.keys(t).reduce((e,r)=>e.split("${"+r+"}").join(t[r]),e)}function aH({to:e,templateParams:t}){let r=window.getOpenmrsSpaBase().replace(/\/$/,""),n=aU(e,t).replace(window.location.origin,""),a=new URL(n,window.location.origin);if("http:"!=a.protocol&&"https:"!=a.protocol)throw console.error(`Received request to navigate to non-http URL: ${a.toString()}`),Error(aV("navigateNonHttp"));n.startsWith(r)?(0,ak.navigateToUrl)(n):window.location.assign(n)}aF.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let az="openmrs:history";function aK(e){let t=JSON.parse(sessionStorage.getItem(az)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(az,JSON.stringify(t))}function aG(){0===JSON.parse(sessionStorage.getItem(az)??"[]").length&&document.referrer&&aK(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=aZ();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(az,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?aY({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&aK(window.location.href)})}function aZ(){return JSON.parse(sessionStorage.getItem(az)??"[]")}function aY({toUrl:e}){let t=aZ(),r=t.lastIndexOf(e);if(-1!=r){let e=t.slice(0,r+1);aH({to:t[r]}),sessionStorage.setItem(az,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function aq(){sessionStorage.removeItem(az)}let aJ="${openmrsSpaBase}/login",aX={redirectAuthFailure:{enabled:{_type:nc.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:nc.String,_default:aJ,_validators:[av.isUrl],_description:"The url to which users will be redirected when they are logged out. If set to blank, the `location` header from the response will be used."},errors:{_type:nc.Array,_default:[401],_elements:{_type:nc.Number,_validators:[av.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:nc.Boolean,_default:!1,_description:"Changes how requests that fail authentication are handled. Try messing with this if redirects to the login page aren't working correctly."}},followRedirects:{_type:nc.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function aQ(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let a0="/ws/rest/v1",a1="/ws/fhir2/R4",a4=`${a0}/session`;function a2(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function a3(e,t={}){if("string"!=typeof e)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof t)throw Error("The second argument to @openmrs/api's openmrsFetch function must be a plain object.");if(!window.openmrsBase)throw Error("@openmrs/api is running in a browser that doesn't have window.openmrsBase, which is provided by openmrs-module-spa's HTML file.");let r=a2(e);t.headers||(t.headers={}),ex(t.body)&&(t.body=JSON.stringify(t.body)),void 0===t.headers.Accept&&(t.headers.Accept="application/json"),null===t.headers.Accept&&delete t.headers.Accept;let n=!1;try{let e=new URL(r,window.location.href),t=new URL(a2(a0),window.location.href),a=e.pathname.replace(/\/{2,}/g,"/"),o=t.pathname.replace(/\/{2,}/g,"/");n=e.origin===t.origin&&(a===o||a.startsWith(`${o}/`))}catch{}if(n){let e=!1;for(let[r,n]of Object.entries(t.headers))"disable-www-authenticate"===r.toLowerCase()&&(void 0===n?delete t.headers[r]:e=!0);e||(t.headers["Disable-WWW-Authenticate"]="true")}if(e.startsWith(a1)){let e=new URL(r,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),r=e.toString())}let a=Error();return window.fetch(r,t).then(async e=>{let{redirectAuthFailure:n,followRedirects:o}=await n1("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(o&&t&&(r===a2(a4)||204===e.status)&&aH({to:t}),204===e.status)?(e.data=null,e):e.clone().text().then(t=>{try{t&&(e.data=JSON.parse(t))}catch(e){}return e})}return(r===a2(a4)&&403===e.status||n.enabled&&n.errors.includes(e.status))&&(aq(),aH({to:n.url||e.headers.get("location")||aJ}),!0!==t.rejectAuthFailure)?n.resolvePromise?Promise.resolve():new Promise(()=>{}):e.clone().text().then(t=>{let n=t;try{n=JSON.parse(t)}catch(e){}throw new a6(r,e,n,a)},()=>{throw new a6(r,e,null,a)})})}class a6 extends Error{constructor(e,t,r,n){super(),aQ(this,"response",void 0),aQ(this,"responseBody",void 0),this.message=`Server responded with ${t.status} (${t.statusText}) for url ${e}. Check err.responseBody or network tab in dev tools for more info`,n.message=this.message,this.responseBody=r,this.response=t,this.stack=`Stacktrace for outgoing request:
13
13
  ${n.stack}
14
14
  Stacktrace for incoming response:
15
- ${this.stack}`}}let a5=F("session",{loaded:!1,session:null}),a9=0,a8=null;function a7(){return a8||(a5.getState().loaded&&a9>=Date.now()-6e4?null:on())}function oe(e){let t=e?.includeAuthStatus??!0,r=e=>t?e:e.user,n=a7();return n?new Promise(e=>{let t=()=>{let t=a5.getState();t.loaded&&(a(),e(r(t.session)))},a=a5.subscribe(t);n.then(t,t)}):Promise.resolve(r(a5.getState().session))}function ot(){return a7(),a5}function or(e){let t=e.locale??e.user?.userProperties?.defaultLocale;t&&t.includes("_")&&(t=t.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(t)&&t!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",t)}function on(e,t){a9=Date.now(),a??(a=a9);let r={};e&&t&&(r.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let n=op(a3(a4,{headers:r,rejectAuthFailure:!0})),o=()=>{a8===n&&(a8=null)};return n.then(o,o),a8=n,n}function oa(){a5.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function oo(e,t){var r,n;if(void 0===t)return!e;if(!e)return!0;return r=e,n=t,("string"==typeof r?!z(n.privileges.find(e=>r===e.display)):Array.isArray(r)?r.every(e=>!z(n.privileges.find(t=>e===t.display))):(z(r)||console.error(`Could not understand privileges "${r}"`),!0))||!z(t.roles.find(e=>"System Developer"===e.display))}function oi(){let e,t;return new Promise(r=>{let n=n=>{n.loaded&&n.session.user&&(e=n.session.user,r(n.session.user),t&&t())};n(a5.getState()),e||(t=a5.subscribe(n))})}async function os(){return(await oe()).sessionLocation}async function ol(e,t){return op(a3(a4,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function ou(e,t){return await a3(a4,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),on()}async function oc(e,t,r){return r||(r=new AbortController),await a3(`${a0}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:r.signal}),on()}async function od(e,t=!1){let r=await a3(t?`${a4}?rememberMe=true`:a4,{headers:{"X-Totp-Code":e}});return r.data?.authenticated?(await on()).session:r.data}async function om(){try{await a3(a4,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!of(e))throw e}oa(),await on().catch(()=>{})}function op(e){return new Promise((t,r)=>{e.then(e=>{if("object"==typeof e?.data){let r={loaded:!0,session:e.data};a5.setState(r,!0),t(r)}else!function(e){if(!e?.redirected||!e.url)return!1;try{return new URL(e.url,window.location.href).pathname.replace(/\/+$/,"").endsWith("/initialsetup")}catch{return!1}}(e)?r(oh(Error("The session endpoint did not respond with a session"))):r(oh(Error("The server is still starting up"),!0))}).catch(e=>{var n,o;if(of(e)){"object"==typeof(n=e.responseBody)&&null!==n&&!1===n.authenticated?a5.setState({loaded:!0,session:e.responseBody},!0):oa(),t(a5.getState());return}(o=e)instanceof a6&&502===o.response.status&&!a5.getState().loaded&&void 0!==a&&Date.now()-a<18e4?r(oh(e,!0)):(C(`Failed to fetch new session information: ${e}`),r(oh(e)))})})}function of(e){return e instanceof a6&&(401===e.response.status||403===e.response.status)}function oh(e,t=!1){return a5.getState().loaded||a5.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),a5.getState()}function og(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}a5.subscribe(e=>{e.loaded&&e.session&&or(e.session)});let oy={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};async function ov(e,t=a3){let r=await t(e),n=[...r.data.results],a=new Set,o=r.data,{origin:i}=new URL(a2(e),window.location.href);for(;;){let e=o.links?.find(e=>"next"===e.rel)?.uri;if(!e)break;let{pathname:r,search:s}=new URL(e),l=`${i}${r}${s}`;if(a.has(l))throw Error("Cannot fetch the complete collection: pagination returned a repeated next link.");a.add(l),o=(await t(l)).data,n.push(...o.results)}return r.data={...r.data,results:n,...r.data.links?{links:r.data.links.filter(e=>"next"!==e.rel)}:{}},r}function ob(){nZ("@openmrs/esm-api",aX),on()}let ow="import-map-override:",oE="import-map-overrides-disabled",oD="import-map-overrides:change",ox=!1,o_=null,oS=null;async function oC(){return oS??(oS=ok().then(({map:e,complete:t})=>(t||(oS=null),e))),oS}async function ok(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{if(a.src){let e=await fetch(a.src);if(!e.ok)throw Error(`Request for ${a.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else a.textContent&&t.push(JSON.parse(a.textContent))}catch(e){r=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${n}`,e)}}return{map:oP(t),complete:r}}function oP(e){let t={imports:{}};for(let r of e)r?.imports&&Object.assign(t.imports,r.imports);return t}function oR(){let e={};try{let t=oI();for(let r=0;r<localStorage.length;r++){let n=localStorage.key(r);if(n?.startsWith(ow)){let r=n.slice(ow.length);if(!t.includes(r)){let t=localStorage.getItem(n);t&&(e[r]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function oT(){let e=await oC();return ox?oP([e,o_??oR()]):e}async function oO(){return oC()}async function o$(){return ox?oP([await oC(),oR()]):oC()}function oN(e){if(!ox)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(ow)){let t=localStorage.getItem(r);t&&(e[r.slice(ow.length)]=t)}}return{imports:e}}return oR()}function oI(){if(!ox)return[];try{let e=localStorage.getItem(oE);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function oM(e){return!!ox&&oI().includes(e)}function oj(e,t){if(!ox)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(ow+e,t),window.dispatchEvent(new CustomEvent(oD))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function oA(e){if(!ox)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(ow+e);let t=oI().filter(t=>t!==e);t.length>0?localStorage.setItem(oE,JSON.stringify(t)):localStorage.removeItem(oE),window.dispatchEvent(new CustomEvent(oD))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function oL(){if(!ox)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(ow)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(oE),window.dispatchEvent(new CustomEvent(oD))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function oF(e){if(!ox)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=oI().filter(t=>t!==e);t.length>0?localStorage.setItem(oE,JSON.stringify(t)):localStorage.removeItem(oE),window.dispatchEvent(new CustomEvent(oD))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let oB=!1;function oV(){!oB&&(oB=!0,(ox="development"===window.spaEnv)&&(o_=oR()))}function oU(e){return e.replace(/[\/\-@]/g,"_")}async function oW(e,t="./start",n){var a;let o,i=!n?.maxLoadingTime||n.maxLoadingTime<=0?6e5:n.maxLoadingTime;await Promise.race([oH(e,n?.importMap),new Promise((t,r)=>{o=setTimeout(()=>{var t;r(Error(`Could not resolve requested script, ${e}, within ${(t=i)<1e3?`${t} milliseconds`:t<6e4?`${Math.floor(t/1e3)} seconds`:t<36e5?`${Math.floor(t/6e4)} minutes`:t<864e5?`${Math.floor(t/36e5)} hours`:`${Math.floor(t/864e5)} days`}.`))},i)})]),o&&clearTimeout(o);let s=oU(e),l=window[s];if(!("object"==typeof(a=l)&&null!==a&&"init"in a&&"function"==typeof a.init&&"get"in a&&"function"==typeof a.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(r.S.default);let u=(await l.get(t))();if("object"!=typeof u||null===u){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return u}async function oH(e,t){if("string"!=typeof e||0===e.trim().length){let e="Attempted to call importDynamic() without supplying a package to load";throw console.error(e),Error(e)}let r=oU(e);if(!window[r]){let r=t??await oz();if(!r.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let n=r.imports[e];n.startsWith("./")&&(n=window.spaBase+n.substring(1));let a=e in oN().imports;try{return await function(e){var t;let r=(t=window)[oK]??(t[oK]=new Map),n=r.get(e);if(n)return n;if(document.head.querySelector(`script[src="${e}"]`))return console.warn(`Script at ${e} already loaded. Not loading it again.`),Promise.resolve();let a=document.createElement("script");a.src=e,a.type="text/javascript",a.async=!0;let o=new Promise((t,n)=>{let o=setTimeout(()=>{console.error(`The script at ${e} did not load within 5 seconds. This may indicate an issue with the imports in the script's entry-point file or with the script's bundler configuration.`)},5e3);function i(){clearTimeout(o),a.removeEventListener("load",s),a.removeEventListener("error",l)}function s(){i(),t()}function l(t){i(),r.delete(e),a.remove();let o=`Failed to load script from ${e}`;console.error(o,t),n(t.message??o)}a.addEventListener("load",s),a.addEventListener("error",l),document.head.appendChild(a)});return r.set(e,o),o}(n)}catch(e){return a&&w({kind:"error",title:aV("scriptLoadingFailed","Error: Script failed to load"),description:aV("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:n}),actionButtonLabel:aV("resetOverrides","Reset overrides"),onActionButtonClick(){oL(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function oz(){return oT()}let oK=Symbol.for("__openmrs_script_loading");function oG(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals))||Object.hasOwn(e,"workspaces2")&&(!e.workspaces2||!Array.isArray(e.workspaces2))||Object.hasOwn(e,"workspaceWindows2")&&(!e.workspaceWindows2||!Array.isArray(e.workspaceWindows2))||Object.hasOwn(e,"workspaceGroups2")&&(!e.workspaceGroups2||!Array.isArray(e.workspaceGroups2)))}function oZ(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&oG(t))}let oY="openmrs-routes:",oq="openmrs-routes:change",oJ=!1,oX=null,oQ=null;async function o0(){return oQ??(oQ=o1().then(({map:e,complete:t})=>(t||(oQ=null),e))),oQ}async function o1(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{let e;if(a.src){let t=await fetch(a.src);if(!t.ok)throw Error(`Request for ${a.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else a.textContent&&(e=JSON.parse(a.textContent));e&&oZ(e)&&t.push(e)}catch(e){r=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${n}`,e)}}return{map:o4(t),complete:r}}function o4(e){let t={routes:{}};for(let r of e)r&&"object"==typeof r&&!Array.isArray(r)&&(Object.assign(t.routes,r.routes),void 0===t.version&&void 0!==r.version&&(t.version=r.version));return t}async function o2(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let r=localStorage.key(e);if(r?.startsWith(oY)){let e=localStorage.getItem(r);e&&t.push({moduleName:r.slice(oY.length),raw:e})}}for(let r of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let r=JSON.parse(t);if(oG(r))return{moduleName:e,routes:r};if("string"==typeof r&&r.startsWith("http")){let t=await fetch(r),n=await t.json();if(oG(n))return{moduleName:e,routes:n};throw Error(`${r} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===r.status?e.routes[r.value.moduleName]=r.value.routes:console.warn("[route-maps] Failed to load route override",r.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function o3(){let e=await o0();return oJ?o4([e,oX??await o2()]):e}async function o6(){return o0()}async function o5(){return oJ?o4([await o0(),await o2()]):o0()}function o9(){if(!oJ)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(oY)){let t=localStorage.getItem(r);t&&(e[r.slice(oY.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function o8(e,t){if(!oJ)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(oY+e,JSON.stringify(t));else{let r=JSON.parse(t);if(!oG(r))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(oY+e,JSON.stringify(r))}else if(t instanceof URL)localStorage.setItem(oY+e,JSON.stringify(t.toString()));else{if(!oG(t))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,t);localStorage.setItem(oY+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(oq))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function o7(e){if(!oJ)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(oY+e),window.dispatchEvent(new CustomEvent(oq))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function ie(){if(!oJ)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(oY)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(oq))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let it=null;function ir(){return it||(it=(oJ="development"===window.spaEnv)?o2().then(e=>{oX=e}):Promise.resolve())}let ia=`${a0}/attachment`;function io(e,t){return a3(`${ia}/${e}`,{signal:t.signal})}function ii(e,t,r,n){return ov(is(e,t,n),e=>a3(e,{signal:r.signal}))}function is(e,t,r){return r?`${ia}?patient=${e}&encounter=${r}`:`${ia}?patient=${e}&includeEncounterless=${t}`}async function il(e,t,r){let n=new FormData;return n.append("fileCaption",t.fileDescription),n.append("patient",e),r&&n.append("encounter",r),t.file?n.append("file",t.file,t.fileName):(n.append("file",new File([""],t.fileName),t.fileName),n.append("base64Content",t.base64Content)),a3(`${ia}`,{method:"POST",body:n})}function iu(e,t){return a3(`${ia}/${e}`,{method:"DELETE",signal:t.signal})}async function ic(e,t){return e?(await a3(`${a1}/Patient/${e}`,t)).data:null}function id(e,t){let r=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(r)}function im(e,t){let r=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,r),()=>{window.removeEventListener(`openmrs:${e}`,r)}}function ip(e){return{uuid:e.uuid,display:e.display}}function ih(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString();return a3(`${a0}/location${n?"?"+n:""}`).then(e=>e.data.results.map(ip))}function ig(e){return{uuid:e.uuid,display:e.display,name:e.name}}let iy=`${a0}/visittype`;function iv(e=iy){return ov(e,a3).then(e=>e.data.results.map(ig))}var ib=((ee={}).NEWVISIT="startVisit",ee.EDITVISIT="editVisit",ee.LOADING="loadingVisit",ee),iw=((et={}).NOTSTARTED="notStarted",et.ONGOING="ongoing",et);let iE="custom:(uuid,display,voided,indication,startDatetime,stopDatetime,encounters:(uuid,display,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,display),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display))",iD=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function ix(){return U("visit",iD)}function i_(e,t){ix().setState({patientUuid:e,manuallySetVisitUuid:t})}function iS(e,t){return a3(`${a0}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function iC(e,t,r){return a3(`${a0}/visit/${e}`,{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function ik(e,t,r){return a3(`${a0}/visit?patient=${e}&v=${r??iE}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}ix().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});class iP{static get version(){return"1.6.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+iP.version}static addUnaryOp(e){return iP.max_unop_len=Math.max(e.length,iP.max_unop_len),iP.unary_ops[e]=1,iP}static addBinaryOp(e,t,r){return iP.max_binop_len=Math.max(e.length,iP.max_binop_len),iP.binary_ops[e]=t,r?iP.right_associative.add(e):iP.right_associative.delete(e),iP}static addIdentifierChar(e){return iP.additional_identifier_chars.add(e),iP}static addLiteral(e,t){return iP.literals[e]=t,iP}static removeUnaryOp(e){return delete iP.unary_ops[e],e.length===iP.max_unop_len&&(iP.max_unop_len=iP.getMaxKeyLen(iP.unary_ops)),iP}static removeAllUnaryOps(){return iP.unary_ops={},iP.max_unop_len=0,iP}static removeIdentifierChar(e){return iP.additional_identifier_chars.delete(e),iP}static removeBinaryOp(e){return delete iP.binary_ops[e],e.length===iP.max_binop_len&&(iP.max_binop_len=iP.getMaxKeyLen(iP.binary_ops)),iP.right_associative.delete(e),iP}static removeAllBinaryOps(){return iP.binary_ops={},iP.max_binop_len=0,iP}static removeLiteral(e){return delete iP.literals[e],iP}static removeAllLiterals(){return iP.literals={},iP}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new iP(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return iP.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!iP.binary_ops[String.fromCharCode(e)]||iP.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return iP.isIdentifierStart(e)||iP.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(iP.hooks[e]){let r={context:this,node:t};return iP.hooks.run(e,r),r.node}return t}searchHook(e){if(iP.hooks[e]){let t={context:this};return iP.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===iP.SPACE_CODE||e===iP.TAB_CODE||e===iP.LF_CODE||e===iP.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:iP.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],r,n;for(;this.index<this.expr.length;)if((r=this.code)===iP.SEMCOL_CODE||r===iP.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())t.push(n);else if(this.index<this.expr.length){if(r===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,iP.max_binop_len),t=e.length;for(;t>0;){if(iP.binary_ops.hasOwnProperty(e)&&(!iP.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!iP.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,n,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:iP.binaryPrecedence(t),right_a:iP.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),n=[o,a,i];t=this.gobbleBinaryOp();){if(0===(r=iP.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:r,right_a:iP.right_associative.has(t)},l=t;let s=e=>a.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;n.length>2&&s(n[n.length-2]);)i=n.pop(),t=n.pop().value,o=n.pop(),e={type:iP.BINARY_EXP,operator:t,left:o,right:i},n.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),n.push(a,e)}for(s=n.length-1,e=n[s];s>1;)e={type:iP.BINARY_EXP,operator:n[s-1].value,left:n[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,r,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"))return this.runHook("after-token",n);if(e=this.code,iP.isDecimalDigit(e)||e===iP.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===iP.SQUOTE_CODE||e===iP.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===iP.OBRACK_CODE)n=this.gobbleArray();else{for(r=(t=this.expr.substr(this.index,iP.max_unop_len)).length;r>0;){if(iP.unary_ops.hasOwnProperty(t)&&(!iP.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!iP.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:iP.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}iP.isIdentifierStart(e)?(n=this.gobbleIdentifier(),iP.literals.hasOwnProperty(n.name)?n={type:iP.LITERAL,value:iP.literals[n.name],raw:n.name}:n.name===iP.this_str&&(n={type:iP.THIS_EXP})):e===iP.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===iP.PERIOD_CODE||t===iP.OBRACK_CODE||t===iP.OPAREN_CODE||t===iP.QUMARK_CODE;){let r;if(t===iP.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==iP.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===iP.OBRACK_CODE?((e={type:iP.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==iP.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===iP.OPAREN_CODE?e={type:iP.CALL_EXP,arguments:this.gobbleArguments(iP.CPAREN_CODE),callee:e}:(t===iP.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:iP.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,r;for(;iP.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===iP.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);iP.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));iP.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);iP.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return r=this.code,iP.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(r===iP.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===iP.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:iP.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,r=this.expr.charAt(this.index++),n=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){n=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++)){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:iP.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(iP.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,iP.isIdentifierPart(e))this.index++;else break;return{type:iP.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],r=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){r=!0,this.index++,e===iP.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===iP.COMMA_CODE){if(this.index++,++n!==t.length){if(e===iP.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===iP.CBRACK_CODE)for(let e=t.length;e<n;e++)t.push(null)}}else if(t.length!==n&&0!==n)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==iP.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(iP.CPAREN_CODE);if(this.code===iP.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:iP.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:iP.ARRAY_EXP,elements:this.gobbleArguments(iP.CBRACK_CODE)}}}Object.assign(iP,{hooks:new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(iP),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),iP.max_unop_len=iP.getMaxKeyLen(iP.unary_ops),iP.max_binop_len=iP.getMaxKeyLen(iP.binary_ops);let iR=e=>new iP(e).parse(),iT=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(iP).filter(e=>!iT.includes(e)&&void 0===iR[e]).forEach(e=>{iR[e]=iP[e]}),iR.Jsep=iP,iR.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}});let iO="ArrowFunctionExpression",i$={Array,Boolean,Symbol,Infinity,NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},iN={...i$,Promise};function iI(e,t={}){return iB(e,t,iW)}async function iM(e,t={}){return iV(e,t,iW)}function ij(e,t={}){return iB(e,t,iH)}function iA(e,t={}){return iV(e,t,iH)}function iL(e,t={}){return iB(e,t,iz)}function iF(e,t={}){return iV(e,t,iz)}function iB(e,t={},r){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let n=iq(t,i$),a=iK("string"==typeof e?iR(e):e,n);if(r(a))return a;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}}async function iV(e,t={},r){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))return Promise.reject(`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`);if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let n=iq(t,iN);return Promise.resolve(iK("string"==typeof e?iR(e):e,n)).then(t=>{if(r(t))return t;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}})}function iU(e){return iR(e)}function iW(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function iH(e){return"boolean"==typeof e}function iz(e){return"number"==typeof e}function iK(e,t){switch(e.type){case"UnaryExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h=e,g=t;let y=iK(h.argument,g);switch(h.operator){case"+":return+y;case"-":return-y;case"~":return~y;case"!":return!y;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var v=e,b=t;switch(v.operator){case"&&":return iK(v.left,b)&&iK(v.right,b);case"||":return iK(v.left,b)||iK(v.right,b);case"??":return iK(v.left,b)??iK(v.right,b)}let w=iK(v.left,b),E=iK(v.right,b);switch(v.operator){case"+":return w+E;case"-":return w-E;case"*":return w*E;case"/":return w/E;case"%":return w%E;case"**":return w**E;case"==":return w==E;case"===":return w===E;case"!=":return w!=E;case"!==":return w!==E;case">":return w>E;case">=":return w>=E;case"<":return w<E;case"<=":return w<=E;case"in":return w in E;default:throw`Expression evaluator does not support operator '${v.operator}' operator`}case"ConditionalExpression":return r=e,n=t,iK(r.test,n)?iK(r.consequent,n):iK(r.alternate,n);case"CallExpression":return iQ(iZ(e,t));case"ArrowFunctionExpression":let D;return a=e,o=t,D=a.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<D.length)throw`Required argument(s) ${D.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(D.reduce((t,r,n)=>{let a=e[n];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let r of Object.keys(t))if(!e(t[r]))return!1;return!0}if(Array.isArray(t)){for(let r of t)if(!e(r))break}return!1}(a)&&t.push([r,a]),t},[]));return iK(a.body,o.addVariables(t))}).bind(null);case"MemberExpression":return iQ(iY(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(i0(s));case"SequenceExpression":let x;return l=e,u=t,(x=l.expressions.map(i0(u)))[x.length-1];case"NewExpression":var _=e,S=t;if(_.callee&&"Identifier"===_.callee.type){let e=_.arguments?.map(i0(S));switch(_.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${_.callee.name}`}}if(_.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return e.value;case"Identifier":return c=e,d=t,(i1(c.name),d.variables&&Object.hasOwn(d.variables,c.name))?d.variables[c.name]:Object.hasOwn(d.globals,c.name)?d.globals[c.name]:void 0;case"TemplateLiteral":let C,k;return m=e,p=t,C=m.expressions?.map(i0(p))??[],(k=m.quasis?.map(i0(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+C.join("")+k.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(f=e).cooked,tail:f.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function iG(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return iG(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function iZ(e,t){let r=iX(e.callee,t);if(r===iJ||e.optional&&null==r)return iJ;let n=e.arguments?.map(i0(t));if(r){if("function"!=typeof r)throw`${i3(e.callee)} is not a function`}else throw`No function named ${i3(e.callee)} is defined in this context`;return r(...n)}function iY(e,t){let r=iX(e.object,t);if(r===iJ||e.optional&&null==r)return iJ;if(null===r)throw TypeError(`TypeError: cannot read properties of null (reading '${i2(e.property,t)}')`);if(void 0===r)switch(e.object.type){case"Identifier":{let r=iG(e.object,t);throw ReferenceError(`ReferenceError: ${r} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${i2(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof r&&"function"!=typeof r&&"string"!=typeof r&&"number"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;let n=e.computed?function(e){if(void 0===e)throw{type:"Illegal property access",message:"No property was supplied to the property access"};if("string"!=typeof e&&"number"!=typeof e)throw{type:"Illegal property access",message:`Cannot use a value of type ${null===e?"null":typeof e} as a property name`};return e}(iK(e.property,t)):function(e){if("Identifier"!==e.type)throw`VisitMemberExpression does not support a property of type '${e.type}'`;return e.name}(e.property);i1(n),function(e,t){if(i4.has(String(t)))return;let r=Object(e);for(;null!==r;){if(Object.hasOwn(r,t)){if(r===Object.prototype||r===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}r=Object.getPrototypeOf(r)}}(r,n);let a=r[n];return"function"==typeof a?a.bind(r):a}function iq(e,t){let r={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return r.addVariables.bind(r),r}iR.plugins.register({name:"arrow",init(e){e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){let r=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let r=this.gobbleBinaryExpression();r||this.throwError("Expected expression after "+e),t.node={type:iO,params:null,body:r};return}}this.index=r}}),e.hooks.add("after-expression",function(t){!function t(r){r&&(Object.values(r).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===r.operator&&(r.type=iO,r.params=r.left?[r.left]:null,r.body=r.right,r.params&&r.params[0].type===e.SEQUENCE_EXP&&(r.params=r.params[0].expressions),delete r.left,delete r.right,delete r.operator))}(t.node)})}}),iR.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let r=t.node;if(r&&"new"===r.operator){r.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(r.argument.type)||this.throwError("Expected new function()"),t.node=r.argument;let n=t.node;for(;n.type===e.MEMBER_EXP||n.type===e.CALL_EXP&&n.callee.type===e.MEMBER_EXP;)n=n.type===e.MEMBER_EXP?n.object:n.callee.object;n.type="NewExpression"}})}}),iR.plugins.register({name:"numbers",init(e){function t(e){return"x"===e||"X"===e?(this.index+=2,[[48,57],[65,70],[97,102]]):"b"===e||"B"===e?(this.index+=2,[[48,49]]):"o"===e||"O"===e||e>="0"&&e<="7"?(this.index+=e<="7"?1:2,[[48,55]]):null}function r(t){let r=this.index,n="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(n+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(n+=this.expr.charAt(this.index++)),a(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+n+this.char+")");else if(i===e.PERIOD_CODE){n.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:n},null,2)}`),this.index=r;return}t.node={type:e.LITERAL,value:parseFloat(n),raw:this.expr.substring(r,this.index)}}e.hooks.add("gobble-token",function(n){if(48===this.code){var a,o,i;let s=this.index,l=this.expr.charAt(this.index+1),u=t.call(this,l);if(!u)return;let c="";for(;a=this.code,o=u,95===a||o.some(([e,t])=>a>=e&&a<=t);)95===this.code?this.index++:c+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(l.charCodeAt(0))){this.index=s+1,r.call(this,n);return}this.throwError("unexpected char within number")}n.node={type:e.LITERAL,value:parseInt(c,"x"===(i=l)||"X"===i?16:"b"===i||"B"===i?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&r.call(this,n)})}}),iR.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let r=++this.index,n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){let n,a=this.expr.slice(r,this.index),o="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)o+=this.char;else break}try{n=new RegExp(a,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:n,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),iR.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}}),iR.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,r=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},n="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:n},tail:o});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,o=!0,s(),e.node=t,r&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",n="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(a+=i,i=this.expr.charAt(++this.index),a+=i,i){case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+=" ";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=i}else n+=i,a+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(r){if((r.node.type===e.IDENTIFIER||r.node.type===e.MEMBER_EXP)&&96===this.code)return r.node={type:"TaggedTemplateExpression",tag:r.node,quasi:t.bind(this)(r,!1)},r.node=this.gobbleTokenProperty(r.node),r.node})}}),iR.addBinaryOp("in",7),iR.addBinaryOp("??",1);let iJ=Symbol("optional chain short-circuited");function iX(e,t){switch(e.type){case"MemberExpression":return iY(e,t);case"CallExpression":return iZ(e,t);default:return iK(e,t)}}function iQ(e){return e===iJ?void 0:e}function i0(e){return function(t){return null===t?null:iK(t,e)}}function i1(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let i4=new Set(["toString","valueOf","hasOwnProperty"]);function i2(e,t){try{return iG(e,t)}catch{return"<computed>"}}function i3(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function i6(e){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;let t={globals:{...iN},boundNames:new Set,variables:new Set};return i5("string"==typeof e?iR(e):e,t),[...t.variables]}function i5(e,t){switch(e.type){case"UnaryExpression":return r=e,n=t,void i5(r.argument,n);case"BinaryExpression":return a=e,o=t,void(i5(a.left,o),i5(a.right,o));case"ConditionalExpression":return i=e,s=t,void(i5(i.consequent,s),i5(i.test,s),i5(i.alternate,s));case"CallExpression":return l=e,u=t,void(i5(l.callee,u),l.arguments?.map(i9(u)));case"ArrowFunctionExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h,g,y,v,b,w,E,D=e,x=t;let _=new Set(x.boundNames);for(let e of D.params??[])e?.type==="Identifier"&&_.add(e.name);i5(D.body,{...x,boundNames:_});return;case"MemberExpression":return c=e,d=t,void(i5(c.object,d),c.computed&&i5(c.property,d));case"ArrayExpression":return m=e,p=t,void m.elements?.map(i9(p));case"SequenceExpression":return f=e,h=t,void f.expressions?.map(i9(h));case"NewExpression":return g=e,y=t,void g.arguments?.map(i9(y));case"Literal":case"TemplateElement":return;case"Identifier":return v=e,b=t,void(v.name in b.globals||b.boundNames.has(v.name)||b.variables.add(v.name));case"TemplateLiteral":return w=e,E=t,void(w.expressions?.map(i9(E)),w.quasis?.map(i9(E)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function i9(e){return function(t){return null===t?null:i5(t,e)}}let i8=U("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let r=t.replace("openmrs:feature-flag:",""),n=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${r}`)||"{}");e[r]={enabled:"true"===localStorage.getItem(t),...n}}return e}()});function i7(e,t,r){i8.setState(n=>({flags:{...n.flags,[e]:{enabled:n.flags[e]?.enabled??!1,label:t,description:r}}}))}function se(){let e=i8.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let r=t.replace("openmrs:feature-flag:","");e[r]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${r}`))})}function st(e){return i8.getState().flags[e].enabled}function sr(e,t){i8.subscribe(r=>{t(r.flags[e].enabled)})}function sn(e,t){i8.setState(r=>({flags:{...r.flags,[e]:{...r.flags[e],enabled:t}}}))}i8.subscribe(e=>{for(let[t,r]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,r.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:r.label,description:r.description}))});var sa=tK(function(e,t,r){tL(e,t,r)});let so=F("extensionsInternal",{slots:{},extensions:{}}),si=F("extensionRenderings",{renderings:new Map}),ss=()=>U("extensionsInternal",{slots:{},extensions:{}}),sl=()=>U("extensionRenderings",{renderings:new Map});function su(e){let t=so.getState(),r=e(t);r!==t&&so.setState(r)}let sc=null,sd=null;function sm(){let e=si.getState();return sc&&e===sd||(sc=new Map(e.renderings),sd=e,function(e){for(let t of(sD.clear(),e.values()))s_(t,1);sx=!0}(sc)),sc}function sp(e){sd={renderings:e},si.setState(sd,!0)}function sf(e){let t=sm();t.has(e.renderingId)||(t.set(e.renderingId,e),s_(e,1),sp(t))}function sh(e){let t=sm(),r=t.get(e);r&&(t.delete(e),s_(r,-1),sp(t))}let sg=()=>U("extensions",{slots:{}}),sy=0,sv=new Set;function sb(e){sy++;try{return e()}finally{if(0==--sy&&sv.size>0){let e=Array.from(sv);for(let t of(sv.clear(),e))sw(t)}}}function sw(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function sE(e){sy>0?sv.add(e):sw(e)}let sD=new Map,sx=!1;function s_(e,t){let r=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),n=sD.get(r);if(!n){if(t<0)return;sD.set(r,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),sx=!0;return}n.count+=t,n.count<1&&(sD.delete(r),sx=!0)}function sS(){var e,t;if(sm(),!sx)return;sx=!1;let r=Array.from(sD.values(),({record:e})=>e);r.sort(sC),e=nw.getState().mountedExtensions,t=r,e.length===t.length&&e.every((e,r)=>0===sC(e,t[r]))||nw.setState({mountedExtensions:r})}function sC(e,t){return sk(e.slotName,t.slotName)||sk(e.extensionId,t.extensionId)||sk(e.slotModuleName,t.slotModuleName)||sk(e.extensionModuleName,t.extensionModuleName)}function sk(e,t){return e===t?0:e<t?-1:1}sS(),si.subscribe(()=>sE(sS));let sP=ss(),sR=sg(),sT=nD(),sO=nS(),s$=new Set,sN=!1;function sI(e){if(null===e)s$=null;else if(null!==s$)for(let t of e)s$.add(t);sE(sM)}function sM(){if(!sN){sN=!0;try{for(let e=1;;e++){let t=s$;if(null!==t&&0===t.size)return;s$=new Set;try{!function(e,t,r,n,a,o=null){let i=sR.getState().slots,s={},l=!1,u=Object.entries(n.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[n,c]of Object.entries(e.slots)){let d=i[n];if(d&&o&&!o.has(n)){s[n]=d;continue}let{config:m}=n_(t,c.name),p=function(e,t,r,n,a,o){let i=function(e,t){let r=e.add||[],n=e.remove||[],a=e.order||[],{extensions:o}=sP.getState(),i=new Set(n),s=[...t,...r].filter(e=>!i.has(e)),l=sz(a),u=sz(t),c=new Map(s.map(e=>[e,function(e,t,r,n){let a=t.get(e);if(void 0!==a)return a;{if(void 0!==r)return 1e3+r;let t=n.get(e);return void 0!==t?2e3+t:3e3}}(e,l,o[sL(e)]?.order,u)]));return s.sort((e,t)=>c.get(e)-c.get(t))}(r,t.slots[e].attachedIds),s=[];for(let l of i){let{config:i}=nC(n,e,l),u=nk(r,e,l),c=u?sa({},i,u):i,d=sL(l),m=t.extensions[d];if(m){let e=c?.["Display conditions"]?.privileges??m.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!o?.user||!oo(e,o.user))||m.featureFlag&&!a.includes(m.featureFlag))continue;s.push({id:l,name:d,moduleName:m.moduleName,config:c,featureFlag:m.featureFlag,meta:m.meta,displayConditionExpression:c?.["Display conditions"]?.expression||m.displayExpression})}}return s}(n,e,m,r,u,a.session);d&&d.moduleName===c.moduleName&&rk(d.candidateExtensions,p)?s[n]=d:(s[n]={moduleName:c.moduleName,candidateExtensions:p},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&sR.setState({slots:s})}(sP.getState(),sT.getState(),sO.getState(),i8.getState(),a5.getState(),t)}catch(e){throw s$=null===t||null===s$?null:new Set([...t,...s$]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{sN=!1}}}function sj(e,t){let r=new Set;for(let n of Object.keys(e))e[n]!==t[n]&&r.add(n);for(let n of Object.keys(t))n in e||r.add(n);return r}function sA(e,t){return{moduleName:t,name:e,attachedIds:[]}}function sL(e){let[t]=e.split("#");return t}function sF(e,t){let r=sL(t);return e.extensions[r]}function sB(e){return sF(sP.getState(),e)}sP.subscribe((e,t)=>{sI(e.extensions!==t.extensions?null:sj(e.slots,t.slots))}),sT.subscribe((e,t)=>{sI(sj(e.slots,t.slots))}),sO.subscribe((e,t)=>{sI(sj(e.configs,t.configs))}),i8.subscribe(()=>sI(null)),a5.subscribe(()=>sI(null)),sI(null);let sV=e=>su(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function sU(e,t){su(r=>{let n=r.slots[e];return n?{...r,slots:{...r.slots,[e]:{...n,attachedIds:[...n.attachedIds,t]}}}:{...r,slots:{...r.slots,[e]:{...sA(e),attachedIds:[t]}}}})}function sW(e,t){su(r=>{let n=r.slots[e];return n&&n.attachedIds.includes(t)?{...r,slots:{...r.slots,[e]:{...n,attachedIds:n.attachedIds.filter(e=>e!==t)}}}:r})}function sH(e){su(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[]}}}:t})}function sz(e){let t=new Map;return e.forEach((e,r)=>{t.has(e)||t.set(e,r)}),t}function sK(e,t){return function(e,t,r=null,n){let a;return e.filter(e=>{let o=e.displayConditionExpression;if("string"!=typeof o||0===o.trim().length)return!0;a??(a=t&&"object"==typeof t?{session:r,...t}:{session:r});try{return!!ij(o,a)}catch(t){return console.error(`Error while evaluating expression '${o}' for ${e.id}`+(n?` in ${n}`:""),t),!1}})}(sG(e),t,a5.getState().session,e)}function sG(e){return sR.getState().slots[e]?.candidateExtensions??[]}let sZ=(e,t)=>sP.setState(r=>{let n=r.slots[t]?.moduleName;if(n&&n!=e)return console.warn(`An extension slot with the name '${t}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${n}.`),r;if(n&&n==e)return r;if(r.slots[t])return{...r,slots:{...r.slots,[t]:{...r.slots[t],moduleName:e}}};let a=sA(t,e);return{...r,slots:{...r.slots,[t]:{...a}}}}),sY=()=>{s$=null,su(()=>({slots:{},extensions:{}})),sl().setState({renderings:new Map}),sR.setState({slots:{}})},sq=F("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function sJ({name:e,basePath:t,mode:r,componentContext:n,state:a}){sq.setState({slotName:e,basePath:t,mode:r??"normal",componentContext:n,state:a})}function sX(e){sq.getState().slotName===e&&sq.setState(sq.getInitialState(),!0)}let sQ=F("modalRegistry",{modals:{}});function s0(e){sQ.setState(t=>(t.modals[e.name]=e,t))}function s1(e){let t=sQ.getState().modals[e];if(!t){let r=sB(e);r&&(t={name:e,load:r.load,moduleName:r.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),s0(t))}return t}let s4=F("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function s2(e){let{registeredWorkspacesByName:t,registeredWindowsByName:r}=s4.getState(),n=t[e];if(n){let t=r[n.window];if(t)return t;throw Error(`No workspace window found with name: ${n.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function s3(e){let{registeredGroupsByName:t,registeredWindowsByName:r}=s4.getState(),n=r[e];if(n){let r=t[n.group];if(r)return r;throw Error(`No workspace group found with name: ${n.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function s6(e){let{openedWindows:t}=s4.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function s5(e,t){if(0==t.length)return;let{registeredGroupsByName:r}=s4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace group ${r.name} more than once`);n[r.name]={...r,moduleName:e}}s4.setState({registeredGroupsByName:n})}function s9(e,t){if(0==t.length)return;let{registeredWindowsByName:r}=s4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace window ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}s4.setState({registeredWindowsByName:n})}function s8(e,t){if(0==t.length)return;let{registeredWorkspacesByName:r}=s4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}s4.setState({registeredWorkspacesByName:n})}let s7=0,le=null,lt={bootstrap:15e3,mount:15e3,unmount:15e3};function lr(e,t){if(e.timeouts)return e;let r=e.name??"parcel",n=Object.fromEntries(Object.keys(lt).filter(t=>e[t]).map(n=>{var a,o;let i,s;return[n,(a=e[n],o=lt[n],i=Array.isArray(a)?a:[a],s=e=>i.reduce((t,a,o)=>t.then(()=>{let t=a(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${n} at array index ${o} for parcel ${r} did not return a promise`))}),Promise.resolve(void 0)),e=>{let a,i=new Promise((e,t)=>{a=setTimeout(()=>t(Error(`Lifecycle function ${n} for parcel ${r} did not settle within ${o}ms`)),o)});return Promise.race([s(e),i]).finally(()=>clearTimeout(a)).then(e=>(t(n,!1),e),e=>{throw t(n,!0),e})})]}));return{...e,...n}}async function ln(e,t){var r,n;let a,o,i,s,l,u=await (le??(le=new Promise((e,t)=>{(0,ak.mountRootParcel)({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),ak.mountRootParcel))),le),c={...t},d=(a=c,o=!1,{retarget:e=>a={...e},release:i=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(a),onSettled(e,t){switch(e){case"bootstrap":t&&i();return;case"mount":o||(o=t);return;case"unmount":(t||o)&&i();return}}});return n=u((r=d.onSettled,"function"==typeof e?()=>e().then(e=>lr(e,r)):lr(e,r)),c),s=e=>t=>e.call(n,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===n.getStatus()&&d.release(),e}),l=n.update&&s(n.update),Object.defineProperty(n,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&s(e)}})}function la(){return lo}function lo(e,t){let r,n=ln(e,t).then(e=>r=e);return{mount:()=>n.then(e=>e.mount()),unmount:()=>n.then(e=>e.unmount()),update:e=>n.then(t=>t.update?.(e)),getStatus:()=>r?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return n.then(e=>e.loadPromise)},get bootstrapPromise(){return n.then(e=>e.bootstrapPromise)},get mountPromise(){return n.then(e=>e.mountPromise)},get unmountPromise(){return n.then(e=>e.unmountPromise)}}}async function li(e,t,r,n,a=e=>e,o={}){let i=sL(n),s=sB(n),l=null;if(e){let u;if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:c,moduleName:d,load:m}=s,p=s7++,f=`${t}/${n}-${p}`;e.dataset.extensionRenderingId=f;let h=e=>{try{sh(f)}catch(t){console.error(e,t)}};try{sf({renderingId:f,extensionName:i,extensionModuleName:d,extensionId:n,slotName:t,slotModuleName:r})}catch(e){throw h(`Recomputing configuration after registering '${n}' failed also failed`),e}try{u=await m()}catch(e){throw h(`Recomputing configuration after '${n}' failed to load also failed`),e}try{l=await ln(a({...u,name:`${t}/${i}-${p}`}),{...o,_meta:c,_extensionContext:{extensionId:n,extensionSlotName:t,extensionSlotModuleName:r,extensionModuleName:d,extensionMeta:c},domElement:e})}catch(e){throw h(`Recomputing configuration after '${n}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${n}' in slot '${t}' failed to mount`,e),h(`Recomputing configuration after '${n}' failed to mount also failed`)}),l.unmountPromise.then(()=>h(`Recomputing configuration after unmounting '${n}' failed`),e=>{console.error(`Extension '${n}' in slot '${t}' failed to unmount`,e),h(`Recomputing configuration after '${n}' failed to unmount also failed`)})}else console.warn(`Tried to render ${n} into ${t} but no DOM element was available.`);return l}var ls=r(4587),ll=r.n(ls);let lu=(0,ls.createContext)({moduleName:"",featureName:""});var lc=r(9978);function ld({to:e,templateParams:t,onBeforeNavigate:r,children:n,...a}){return(0,ls.useEffect)(()=>{a.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${a.href}'`),a.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),(0,lc.jsx)("a",{onClick:n=>{0===n.button&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey&&(n.preventDefault(),r?.(n),aH({to:e,templateParams:t})),0===n.button&&(n.ctrlKey||n.metaKey)&&r?.(n),0===n.button&&n.shiftKey&&r?.(n),1===n.button&&r?.(n)},href:aU(e,t),...a,children:n})}let lm=({state:e,children:t,...r})=>{let{extension:n}=(0,ls.useContext)(lu),a=(0,ls.useRef)(null),o=(0,ls.useRef)(Promise.resolve()),i=(0,ls.useRef)(!1),s=(0,ls.useRef)(!1),l=(0,ls.useRef)(e),u=(0,ls.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":o.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),c=(0,ls.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(o.current=Promise.all([e.mountPromise,o.current]).then(()=>{if(a.current?.getStatus()==="MOUNTED"&&a.current.update)return a.current.update({...t})}).catch(e=>{let t=a.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${n?.extensionId}' failed to update`,e)}))},[]),d=(0,ls.useCallback)(t=>{t&&!a.current&&!s.current&&n?.extensionSlotName&&n.extensionSlotModuleName&&(s.current=!0,li(t,n.extensionSlotName,n.extensionSlotModuleName,n.extensionId,void 0,e).then(t=>{(s.current=!1,a.current=t,i.current)?u(t):t&&l.current!==e&&c(t,l.current)},()=>{s.current=!1}))},[]);return(0,ls.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(a.current)}),[]),(0,ls.useEffect)(()=>{l.current=e,a.current&&c(a.current,e)},[e]),n?(0,lc.jsx)("div",{ref:d,"data-extension-id":n?.extensionId,style:{position:"relative"},...r}):null};function lp(e){let t=(0,ls.useRef)(e);return R(t.current,e)||(t.current=e),t.current}function lf(e,t){"function"==typeof t&&(t=t(e));let r={};for(let[n,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};r[n]=t}return r}let lh=e=>e;function lg(e,t=lh,r){let n=(0,ls.useCallback)(t=>e.subscribe(t),[e]),a=(0,ls.useCallback)(()=>t(e.getState()),[e,t]),o=(0,ls.useSyncExternalStore)(n,a,a),i=(0,ls.useMemo)(()=>r?lf(e,r):null,[e,r]);return(0,ls.useMemo)(()=>i?{...o,...i}:o,[o,i])}function ly(e,t){return lg(e,lh,t)}function lv(e){return function(t){let r=(0,ls.useCallback)(t=>e.subscribe(t),[]),n=(0,ls.useCallback)(()=>e.getState(),[]),a=(0,ls.useSyncExternalStore)(r,n,n),o=(0,ls.useMemo)(()=>t?lf(e,t):null,[t]);return(0,ls.useMemo)(()=>o?{...a,...o}:a,[a,o])}}let lb=[];Object.freeze(lb);let lw={candidateExtensions:lb};Object.freeze(lw);let lE=e=>{let t=(0,ls.useCallback)(t=>t.slots?.[e]??lw,[e]);return lg(sg(),t)},lD=e=>e.session;function lx(e,t){let{candidateExtensions:r}=lE(e),n=lg(a5,lD),a=lp(t);return(0,ls.useMemo)(()=>sK(e,a),[e,a,n,r])}function l_(e,t){let{moduleName:r}=(0,ls.useContext)(lu);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,ls.useEffect)(()=>{sZ(r,e)},[r,e]),{extensions:lx(e,t),extensionSlotName:e,extensionSlotModuleName:r}}function lS(e){return e}function lC({name:e,extensionSlotName:t,select:r=lS,children:n,state:a,style:o,...i}){if(n&&a)throw Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");let s=e??t,l=(0,ls.useRef)(null),{extensions:u,extensionSlotModuleName:c}=l_(s,a),d=(0,ls.useMemo)(()=>r(u),[r,u]),m=(0,ls.useMemo)(()=>{if("function"==typeof n&&!ll().isValidElement(n))return d.map(e=>n(e,a))},[n,d]);return(0,lc.jsx)("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...o,position:"relative"},...i,children:s&&d?.map((e,t)=>(0,lc.jsx)(lu.Provider,{value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}},children:m?.[t]??("function"!=typeof n?n:null)??(0,lc.jsx)(lm,{state:a})},e.id))})}var lk=r(6298),lP=r.n(lk);function lR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function lT(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lR(Object(r),!0).forEach(function(t){var n,a,o;n=e,a=t,o=r[t],a in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lR(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function lO(e){return(lO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l$(e){return(l$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lN(e,t){var r;if("function"!=typeof(r=t.domElement?function(){return t.domElement}:t.domElementGetter?t.domElementGetter:e.domElementGetter?e.domElementGetter:function(e){var t=e.appName||e.name;if(!t)throw Error("single-spa's dom-element-getter-helpers was not given an application name as a prop, so it can't make a unique dom element container for the react application");var r="single-spa-application:".concat(t);return function(){var e=document.getElementById(r);return e||((e=document.createElement("div")).id=r,document.body.appendChild(e)),e}}(t)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(t.name,"'. Expected a function, received ").concat(l$(r)));return function(){var e=r(t);if(!(e instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(t.name,"'. Expected HTMLElement, received ").concat(l$(e)));return e}}var lI=null;try{lI=require("react").createContext()}catch(e){}var lM={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function lj(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function lA(e,t){return new Promise(function(r,n){e.suppressComponentDidCatchWarning||!function(e){if(!(e&&"string"==typeof e.version&&e.version.indexOf(".")>=0))return!1;var t=e.version.slice(0,e.version.indexOf("."));try{return Number(t)>=16}catch(e){return!1}}(e.React)||e.errorBoundary||e.errorBoundaryClass||(e.rootComponent.prototype?e.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var a,o=lV(e,t,function(){r(this)}),i=lN(e,t)(),s=function(e){var t=e.reactDom,r=e.renderType,n=e.elementToRender,a=e.domElement,o=t[r];if("function"!=typeof o)throw Error('renderType "'.concat(r,'" did not return a function.'));switch(r){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(n),i;case"hydrateRoot":return o(a,n);default:return o(n,a),null}}({elementToRender:o,domElement:i,reactDom:lB(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function lL(e,t){return new Promise(function(r){e.unmountResolves[t.name]=r;var n=e.renderResults[t.name];n&&n.unmount?n.unmount():lB(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function lF(e,t){return new Promise(function(r){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(r);var n=lV(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(n);else{var o=lN(e,t)();lB(e).render(n,o)}})}function lB(e){return e.ReactDOMClient||e.ReactDOM}function lV(e,t,r){var n=e.React.createElement(e.rootComponent,t),a=lI?e.React.createElement(lI.Provider,{value:t},n):n;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function r(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},r.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return r.prototype=Object.create(e.React.Component.prototype),r.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},r.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},r}(e,t),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,lT(lT({},t),{},{mountFinished:r,updateFinished:function(){e.updateResolves[t.name]&&(e.updateResolves[t.name].forEach(function(e){return e()}),delete e.updateResolves[t.name])},unmountFinished:function(){e.unmountResolves[t.name]&&(e.unmountResolves[t.name](),delete e.unmountResolves[t.name])}}),a)}var lU=r(587),lW=r(2272),lH=r(8444);let lz={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},lK=new Map;(0,lH.y)(lK);let lG={errorRetryCount:3,fetcher:a3,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof a6){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>lK};function lZ(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},lz,e),r={...lG,...t.swrConfig};return function(e){var n,a,o,i,s;return o=a=class extends(n=ll().Component){componentDidCatch(e,r){r&&r.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:r.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:r})}render(){if(this.state.caughtError)return(0,lc.jsx)("div",{children:"An error has occurred. Please try reloading the page."});{let n=(0,lc.jsx)(ls.Suspense,{fallback:null,children:(0,lc.jsx)(lW.S,{value:r,children:(0,lc.jsx)(lu.Provider,{value:this.state.config,children:t.disableTranslations?(0,lc.jsx)(e,{...this.props}):(0,lc.jsx)(lU.I18nextProvider,{i18n:window.i18next,defaultNS:this.state.config.extension?`${this.state.config.moduleName}___${this.state.config.extension.extensionSlotName}___${this.state.config.extension.extensionId}`:this.state.config.moduleName,children:(0,lc.jsx)(e,{...this.props})})})})});return t.strictMode&&ll().StrictMode?(0,lc.jsx)(ll().StrictMode,{children:n}):n}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:t.moduleName,featureName:t.featureName,extension:e._extensionContext}}}},i="displayName",s=`OpenmrsReactComponent(${t.featureName})`,i in o?Object.defineProperty(o,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[i]=s,a}}function lY(e,t){return function(e){if("object"!==lO(e))throw Error("single-spa-react requires a configuration object");var t,r=lT(lT({},lM),e);if(!r.React)throw Error("single-spa-react must be passed opts.React");if(!r.ReactDOM&&!r.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(r.renderType||(null!=(t=r.ReactDOMClient)&&t.createRoot?r.renderType="createRoot":r.renderType="render"),!r.rootComponent&&!r.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(r.errorBoundary&&"function"!=typeof r.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!lI&&r.React.createContext&&(lI=r.React.createContext()),r.SingleSpaRoot=function(e){function t(e){t.displayName="SingleSpaRoot(".concat(e.name,")")}return t.prototype=Object.create(e.React.Component.prototype),t.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},t.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},t.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},t}(r);var n={bootstrap:lj.bind(null,r),mount:lA.bind(null,r),unmount:lL.bind(null,r)};return r.parcelCanUpdate&&(n.update=lF.bind(null,r)),n}({React:ll(),ReactDOMClient:lP(),rootComponent:lZ(t)(e)})}function lq(e,t){return()=>e().then(({default:e})=>lY(e,t))}function lJ(e,t){return()=>Promise.resolve(lY(e,t))}let lX=lq,lQ=N()(()=>({}));V("openmrs-app-context",lQ);let l0={};function l1(e,t=e=>e){let r=lQ.getState();return e in r?Object.freeze(Object.assign({},t?t(r[e]):r[e])):null}function l4(e,t){lQ.setState(r=>(e in r||(r[e]={}),r[e]=t(r[e]),Object.assign({},r)))}function l2(e){return null===e?null:Object.freeze(Object.assign({},e))}let l3=new Map;function l6(e,t){let r=(0,ls.useRef)(t??{}),n=(0,ls.useRef)(t=>l4(e,t)),a=(0,ls.useRef)(Symbol());return(0,ls.useEffect)(()=>{let r=t??{},n=a.current;return null===l1(e)?!function(e,t=l0){lQ.setState(r=>{if(e in r)throw Error(`Attempted to re-register namespace ${e} in the app context. Each namespace must be unregistered before the name can be registered again.`);return Object.assign({},r,{[e]:t===l0?{}:t})})}(e,r):(console.warn(`Namespace ${e} is already registered in the app context. This is likely a race condition during navigation, but may indicate two components are trying to own the same namespace. Updating the existing context.`),l4(e,()=>r)),l3.set(e,n),()=>{l3.get(e)===n&&(lQ.setState(t=>(e in t&&delete t[e],t)),l3.delete(e))}},[e]),(0,ls.useEffect)(()=>{let n=t??{};R(r.current,n)||(l4(e,()=>n),r.current=n)},[t]),n.current}function l5({namespace:e,value:t}){return l6(e,t),null}let l9=({children:e,value:t,fallback:r})=>t?(0,lc.jsx)(lc.Fragment,{children:e}):r?(0,lc.jsx)(lc.Fragment,{children:r}):null;function l8(){let e=(0,ls.useRef)(null);return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,ls.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function l7(e,t=e=>e??{}){let[r,n]=(0,ls.useState)(()=>{if(ue(e))return;let r=l1(e);if(null!==r)return t?t(r):r});return(0,ls.useEffect)(()=>{if(ue(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,ls.useEffect)(()=>{var r;let a;return(r=e=>{if(null==e)return void n(void 0);let r=t?t(e):e;n(e=>R(e,r)?e:r)})(l2(a=l1(e))),lQ.subscribe(t=>{let n=e in t?t[e]:null;n!==a&&(a=n,r(l2(n)))})},[e,t]),r}function ue(e){return"string"!=typeof e||0===e.trim().length}function ut(e){let t=lx(e);return(0,ls.useMemo)(()=>t.map(e=>e.id),[t])}function ur(e){return lE(e).candidateExtensions}function un(e,t,r){let{data:n,error:a,mutate:o,isLoading:i,isValidating:s}=(0,lW.u)(e?is(e,t,r):null,e=>ov(e,a3));return(0,ls.useMemo)(()=>({isLoading:i,data:n?.data.results??[],error:a,mutate:o,isValidating:s}),[n,a,i,s,o])}function ua(e){(0,ls.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let uo={},ui=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
15
+ ${this.stack}`}}let a5=F("session",{loaded:!1,session:null}),a9=0,a8=null;function a7(){return a8||(a5.getState().loaded&&a9>=Date.now()-6e4?null:on())}function oe(e){let t=e?.includeAuthStatus??!0,r=e=>t?e:e.user,n=a7();return n?new Promise(e=>{let t=()=>{let t=a5.getState();t.loaded&&(a(),e(r(t.session)))},a=a5.subscribe(t);n.then(t,t)}):Promise.resolve(r(a5.getState().session))}function ot(){return a7(),a5}function or(e){let t=e.locale??e.user?.userProperties?.defaultLocale;t&&t.includes("_")&&(t=t.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(t)&&t!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",t)}function on(e,t){a9=Date.now(),a??(a=a9);let r={};e&&t&&(r.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let n=op(a3(a4,{headers:r,rejectAuthFailure:!0})),o=()=>{a8===n&&(a8=null)};return n.then(o,o),a8=n,n}function oa(){a5.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function oo(e,t){var r,n;if(void 0===t)return!e;if(!e)return!0;return r=e,n=t,("string"==typeof r?!z(n.privileges.find(e=>r===e.display)):Array.isArray(r)?r.every(e=>!z(n.privileges.find(t=>e===t.display))):(z(r)||console.error(`Could not understand privileges "${r}"`),!0))||!z(t.roles.find(e=>"System Developer"===e.display))}function oi(){let e,t;return new Promise(r=>{let n=n=>{n.loaded&&n.session.user&&(e=n.session.user,r(n.session.user),t&&t())};n(a5.getState()),e||(t=a5.subscribe(n))})}async function os(){return(await oe()).sessionLocation}async function ol(e,t){return op(a3(a4,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function ou(e,t){return await a3(a4,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),on()}async function oc(e,t,r){return r||(r=new AbortController),await a3(`${a0}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:r.signal}),on()}async function od(e,t=!1){let r=await a3(t?`${a4}?rememberMe=true`:a4,{headers:{"X-Totp-Code":e}});return r.data?.authenticated?(await on()).session:r.data}async function om(){try{await a3(a4,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!of(e))throw e}oa(),await on().catch(()=>{})}function op(e){return new Promise((t,r)=>{e.then(e=>{if("object"==typeof e?.data){let r={loaded:!0,session:e.data};a5.setState(r,!0),t(r)}else!function(e){if(!e?.redirected||!e.url)return!1;try{return new URL(e.url,window.location.href).pathname.replace(/\/+$/,"").endsWith("/initialsetup")}catch{return!1}}(e)?r(oh(Error("The session endpoint did not respond with a session"))):r(oh(Error("The server is still starting up"),!0))}).catch(e=>{var n,o;if(of(e)){"object"==typeof(n=e.responseBody)&&null!==n&&!1===n.authenticated?a5.setState({loaded:!0,session:e.responseBody},!0):oa(),t(a5.getState());return}(o=e)instanceof a6&&502===o.response.status&&!a5.getState().loaded&&void 0!==a&&Date.now()-a<18e4?r(oh(e,!0)):(C(`Failed to fetch new session information: ${e}`),r(oh(e)))})})}function of(e){return e instanceof a6&&(401===e.response.status||403===e.response.status)}function oh(e,t=!1){return a5.getState().loaded||a5.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),a5.getState()}function og(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}a5.subscribe(e=>{e.loaded&&e.session&&or(e.session)});let oy={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};async function ov(e,t=a3){let r=await t(e),n=[...r.data.results],a=new Set,o=r.data,{origin:i}=new URL(a2(e),window.location.href);for(;;){let e=o.links?.find(e=>"next"===e.rel)?.uri;if(!e)break;let{pathname:r,search:s}=new URL(e),l=`${i}${r}${s}`;if(a.has(l))throw Error("Cannot fetch the complete collection: pagination returned a repeated next link.");a.add(l),o=(await t(l)).data,n.push(...o.results)}return r.data={...r.data,results:n,...r.data.links?{links:r.data.links.filter(e=>"next"!==e.rel)}:{}},r}function ob(){nZ("@openmrs/esm-api",aX),on()}let ow="import-map-override:",oE="import-map-overrides-disabled",oD="import-map-overrides:change",ox=!1,o_=null,oS=null;async function oC(){return oS??(oS=ok().then(({map:e,complete:t})=>(t||(oS=null),e))),oS}async function ok(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{if(a.src){let e=await fetch(a.src);if(!e.ok)throw Error(`Request for ${a.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else a.textContent&&t.push(JSON.parse(a.textContent))}catch(e){r=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${n}`,e)}}return{map:oP(t),complete:r}}function oP(e){let t={imports:{}};for(let r of e)r?.imports&&Object.assign(t.imports,r.imports);return t}function oR(){let e={};try{let t=oI();for(let r=0;r<localStorage.length;r++){let n=localStorage.key(r);if(n?.startsWith(ow)){let r=n.slice(ow.length);if(!t.includes(r)){let t=localStorage.getItem(n);t&&(e[r]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function oT(){let e=await oC();return ox?oP([e,o_??oR()]):e}async function oO(){return oC()}async function o$(){return ox?oP([await oC(),oR()]):oC()}function oN(e){if(!ox)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(ow)){let t=localStorage.getItem(r);t&&(e[r.slice(ow.length)]=t)}}return{imports:e}}return oR()}function oI(){if(!ox)return[];try{let e=localStorage.getItem(oE);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function oM(e){return!!ox&&oI().includes(e)}function oj(e,t){if(!ox)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(ow+e,t),window.dispatchEvent(new CustomEvent(oD))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function oA(e){if(!ox)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(ow+e);let t=oI().filter(t=>t!==e);t.length>0?localStorage.setItem(oE,JSON.stringify(t)):localStorage.removeItem(oE),window.dispatchEvent(new CustomEvent(oD))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function oL(){if(!ox)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(ow)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(oE),window.dispatchEvent(new CustomEvent(oD))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function oF(e){if(!ox)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=oI().filter(t=>t!==e);t.length>0?localStorage.setItem(oE,JSON.stringify(t)):localStorage.removeItem(oE),window.dispatchEvent(new CustomEvent(oD))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let oB=!1;function oV(){!oB&&(oB=!0,(ox="development"===window.spaEnv)&&(o_=oR()))}function oU(e){return e.replace(/[\/\-@]/g,"_")}async function oW(e,t="./start",n){var a;let o,i=!n?.maxLoadingTime||n.maxLoadingTime<=0?6e5:n.maxLoadingTime;await Promise.race([oH(e,n?.importMap),new Promise((t,r)=>{o=setTimeout(()=>{var t;r(Error(`Could not resolve requested script, ${e}, within ${(t=i)<1e3?`${t} milliseconds`:t<6e4?`${Math.floor(t/1e3)} seconds`:t<36e5?`${Math.floor(t/6e4)} minutes`:t<864e5?`${Math.floor(t/36e5)} hours`:`${Math.floor(t/864e5)} days`}.`))},i)})]),o&&clearTimeout(o);let s=oU(e),l=window[s];if(!("object"==typeof(a=l)&&null!==a&&"init"in a&&"function"==typeof a.init&&"get"in a&&"function"==typeof a.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(r.S.default);let u=(await l.get(t))();if("object"!=typeof u||null===u){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return u}async function oH(e,t){if("string"!=typeof e||0===e.trim().length){let e="Attempted to call importDynamic() without supplying a package to load";throw console.error(e),Error(e)}let r=oU(e);if(!window[r]){let r=t??await oz();if(!r.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let n=r.imports[e];n.startsWith("./")&&(n=window.spaBase+n.substring(1));let a=e in oN().imports;try{return await function(e){var t;let r=(t=window)[oK]??(t[oK]=new Map),n=r.get(e);if(n)return n;if(document.head.querySelector(`script[src="${e}"]`))return console.warn(`Script at ${e} already loaded. Not loading it again.`),Promise.resolve();let a=document.createElement("script");a.src=e,a.type="text/javascript",a.async=!0;let o=new Promise((t,n)=>{let o=setTimeout(()=>{console.error(`The script at ${e} did not load within 5 seconds. This may indicate an issue with the imports in the script's entry-point file or with the script's bundler configuration.`)},5e3);function i(){clearTimeout(o),a.removeEventListener("load",s),a.removeEventListener("error",l)}function s(){i(),t()}function l(t){i(),r.delete(e),a.remove();let o=`Failed to load script from ${e}`;console.error(o,t),n(t.message??o)}a.addEventListener("load",s),a.addEventListener("error",l),document.head.appendChild(a)});return r.set(e,o),o}(n)}catch(e){return a&&w({kind:"error",title:aV("scriptLoadingFailed","Error: Script failed to load"),description:aV("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:n}),actionButtonLabel:aV("resetOverrides","Reset overrides"),onActionButtonClick(){oL(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function oz(){return oT()}let oK=Symbol.for("__openmrs_script_loading");function oG(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals))||Object.hasOwn(e,"workspaces2")&&(!e.workspaces2||!Array.isArray(e.workspaces2))||Object.hasOwn(e,"workspaceWindows2")&&(!e.workspaceWindows2||!Array.isArray(e.workspaceWindows2))||Object.hasOwn(e,"workspaceGroups2")&&(!e.workspaceGroups2||!Array.isArray(e.workspaceGroups2)))}function oZ(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&oG(t))}let oY="openmrs-routes:",oq="openmrs-routes:change",oJ=!1,oX=null,oQ=null;async function o0(){return oQ??(oQ=o1().then(({map:e,complete:t})=>(t||(oQ=null),e))),oQ}async function o1(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{let e;if(a.src){let t=await fetch(a.src);if(!t.ok)throw Error(`Request for ${a.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else a.textContent&&(e=JSON.parse(a.textContent));e&&oZ(e)&&t.push(e)}catch(e){r=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${n}`,e)}}return{map:o4(t),complete:r}}function o4(e){let t={routes:{}};for(let r of e)r&&"object"==typeof r&&!Array.isArray(r)&&(Object.assign(t.routes,r.routes),void 0===t.version&&void 0!==r.version&&(t.version=r.version));return t}async function o2(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let r=localStorage.key(e);if(r?.startsWith(oY)){let e=localStorage.getItem(r);e&&t.push({moduleName:r.slice(oY.length),raw:e})}}for(let r of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let r=JSON.parse(t);if(oG(r))return{moduleName:e,routes:r};if("string"==typeof r&&r.startsWith("http")){let t=await fetch(r),n=await t.json();if(oG(n))return{moduleName:e,routes:n};throw Error(`${r} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===r.status?e.routes[r.value.moduleName]=r.value.routes:console.warn("[route-maps] Failed to load route override",r.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function o3(){let e=await o0();return oJ?o4([e,oX??await o2()]):e}async function o6(){return o0()}async function o5(){return oJ?o4([await o0(),await o2()]):o0()}function o9(){if(!oJ)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(oY)){let t=localStorage.getItem(r);t&&(e[r.slice(oY.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function o8(e,t){if(!oJ)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(oY+e,JSON.stringify(t));else{let r=JSON.parse(t);if(!oG(r))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(oY+e,JSON.stringify(r))}else if(t instanceof URL)localStorage.setItem(oY+e,JSON.stringify(t.toString()));else{if(!oG(t))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,t);localStorage.setItem(oY+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(oq))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function o7(e){if(!oJ)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(oY+e),window.dispatchEvent(new CustomEvent(oq))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function ie(){if(!oJ)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(oY)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(oq))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let it=null;function ir(){return it||(it=(oJ="development"===window.spaEnv)?o2().then(e=>{oX=e}):Promise.resolve())}let ia=`${a0}/attachment`;function io(e,t){return a3(`${ia}/${e}`,{signal:t.signal})}function ii(e,t,r,n){return ov(is(e,t,n),e=>a3(e,{signal:r.signal}))}function is(e,t,r){return r?`${ia}?patient=${e}&encounter=${r}`:`${ia}?patient=${e}&includeEncounterless=${t}`}async function il(e,t,r){let n=new FormData;return n.append("fileCaption",t.fileDescription),n.append("patient",e),r&&n.append("encounter",r),t.file?n.append("file",t.file,t.fileName):(n.append("file",new File([""],t.fileName),t.fileName),n.append("base64Content",t.base64Content)),a3(`${ia}`,{method:"POST",body:n})}function iu(e,t){return a3(`${ia}/${e}`,{method:"DELETE",signal:t.signal})}async function ic(e,t){return e?(await a3(`${a1}/Patient/${e}`,t)).data:null}function id(e,t){let r=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(r)}function im(e,t){let r=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,r),()=>{window.removeEventListener(`openmrs:${e}`,r)}}function ip(e){return{uuid:e.uuid,display:e.display}}function ih(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString();return a3(`${a0}/location${n?"?"+n:""}`).then(e=>e.data.results.map(ip))}function ig(e){return{uuid:e.uuid,display:e.display,name:e.name}}let iy=`${a0}/visittype`;function iv(e=iy){return ov(e,a3).then(e=>e.data.results.map(ig))}var ib=((ee={}).NEWVISIT="startVisit",ee.EDITVISIT="editVisit",ee.LOADING="loadingVisit",ee),iw=((et={}).NOTSTARTED="notStarted",et.ONGOING="ongoing",et);let iE="custom:(uuid,display,voided,indication,startDatetime,stopDatetime,encounters:(uuid,display,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,display),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display))",iD=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function ix(){return U("visit",iD)}function i_(e,t){ix().setState({patientUuid:e,manuallySetVisitUuid:t})}function iS(e,t){return a3(`${a0}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function iC(e,t,r){return a3(`${a0}/visit/${e}`,{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function ik(e,t,r){return a3(`${a0}/visit?patient=${e}&v=${r??iE}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}ix().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});class iP{static get version(){return"1.6.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+iP.version}static addUnaryOp(e){return iP.max_unop_len=Math.max(e.length,iP.max_unop_len),iP.unary_ops[e]=1,iP}static addBinaryOp(e,t,r){return iP.max_binop_len=Math.max(e.length,iP.max_binop_len),iP.binary_ops[e]=t,r?iP.right_associative.add(e):iP.right_associative.delete(e),iP}static addIdentifierChar(e){return iP.additional_identifier_chars.add(e),iP}static addLiteral(e,t){return iP.literals[e]=t,iP}static removeUnaryOp(e){return delete iP.unary_ops[e],e.length===iP.max_unop_len&&(iP.max_unop_len=iP.getMaxKeyLen(iP.unary_ops)),iP}static removeAllUnaryOps(){return iP.unary_ops={},iP.max_unop_len=0,iP}static removeIdentifierChar(e){return iP.additional_identifier_chars.delete(e),iP}static removeBinaryOp(e){return delete iP.binary_ops[e],e.length===iP.max_binop_len&&(iP.max_binop_len=iP.getMaxKeyLen(iP.binary_ops)),iP.right_associative.delete(e),iP}static removeAllBinaryOps(){return iP.binary_ops={},iP.max_binop_len=0,iP}static removeLiteral(e){return delete iP.literals[e],iP}static removeAllLiterals(){return iP.literals={},iP}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new iP(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return iP.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!iP.binary_ops[String.fromCharCode(e)]||iP.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return iP.isIdentifierStart(e)||iP.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(iP.hooks[e]){let r={context:this,node:t};return iP.hooks.run(e,r),r.node}return t}searchHook(e){if(iP.hooks[e]){let t={context:this};return iP.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===iP.SPACE_CODE||e===iP.TAB_CODE||e===iP.LF_CODE||e===iP.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:iP.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],r,n;for(;this.index<this.expr.length;)if((r=this.code)===iP.SEMCOL_CODE||r===iP.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())t.push(n);else if(this.index<this.expr.length){if(r===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,iP.max_binop_len),t=e.length;for(;t>0;){if(iP.binary_ops.hasOwnProperty(e)&&(!iP.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!iP.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,n,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:iP.binaryPrecedence(t),right_a:iP.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),n=[o,a,i];t=this.gobbleBinaryOp();){if(0===(r=iP.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:r,right_a:iP.right_associative.has(t)},l=t;let s=e=>a.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;n.length>2&&s(n[n.length-2]);)i=n.pop(),t=n.pop().value,o=n.pop(),e={type:iP.BINARY_EXP,operator:t,left:o,right:i},n.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),n.push(a,e)}for(s=n.length-1,e=n[s];s>1;)e={type:iP.BINARY_EXP,operator:n[s-1].value,left:n[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,r,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"))return this.runHook("after-token",n);if(e=this.code,iP.isDecimalDigit(e)||e===iP.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===iP.SQUOTE_CODE||e===iP.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===iP.OBRACK_CODE)n=this.gobbleArray();else{for(r=(t=this.expr.substr(this.index,iP.max_unop_len)).length;r>0;){if(iP.unary_ops.hasOwnProperty(t)&&(!iP.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!iP.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:iP.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}iP.isIdentifierStart(e)?(n=this.gobbleIdentifier(),iP.literals.hasOwnProperty(n.name)?n={type:iP.LITERAL,value:iP.literals[n.name],raw:n.name}:n.name===iP.this_str&&(n={type:iP.THIS_EXP})):e===iP.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===iP.PERIOD_CODE||t===iP.OBRACK_CODE||t===iP.OPAREN_CODE||t===iP.QUMARK_CODE;){let r;if(t===iP.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==iP.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===iP.OBRACK_CODE?((e={type:iP.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==iP.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===iP.OPAREN_CODE?e={type:iP.CALL_EXP,arguments:this.gobbleArguments(iP.CPAREN_CODE),callee:e}:(t===iP.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:iP.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,r;for(;iP.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===iP.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);iP.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));iP.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);iP.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return r=this.code,iP.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(r===iP.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===iP.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:iP.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,r=this.expr.charAt(this.index++),n=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){n=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++)){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return n||this.throwError('Unclosed quote after "'+e+'"'),{type:iP.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(iP.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,iP.isIdentifierPart(e))this.index++;else break;return{type:iP.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],r=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){r=!0,this.index++,e===iP.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===iP.COMMA_CODE){if(this.index++,++n!==t.length){if(e===iP.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===iP.CBRACK_CODE)for(let e=t.length;e<n;e++)t.push(null)}}else if(t.length!==n&&0!==n)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==iP.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(iP.CPAREN_CODE);if(this.code===iP.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:iP.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:iP.ARRAY_EXP,elements:this.gobbleArguments(iP.CBRACK_CODE)}}}Object.assign(iP,{hooks:new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(iP),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),iP.max_unop_len=iP.getMaxKeyLen(iP.unary_ops),iP.max_binop_len=iP.getMaxKeyLen(iP.binary_ops);let iR=e=>new iP(e).parse(),iT=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(iP).filter(e=>!iT.includes(e)&&void 0===iR[e]).forEach(e=>{iR[e]=iP[e]}),iR.Jsep=iP,iR.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}});let iO="ArrowFunctionExpression",i$={Array,Boolean,Symbol,Infinity,NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},iN={...i$,Promise};function iI(e,t={}){return iB(e,t,iW)}async function iM(e,t={}){return iV(e,t,iW)}function ij(e,t={}){return iB(e,t,iH)}function iA(e,t={}){return iV(e,t,iH)}function iL(e,t={}){return iB(e,t,iz)}function iF(e,t={}){return iV(e,t,iz)}function iB(e,t={},r){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let n=iq(t,i$),a=iK("string"==typeof e?iR(e):e,n);if(r(a))return a;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}}async function iV(e,t={},r){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))return Promise.reject(`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`);if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let n=iq(t,iN);return Promise.resolve(iK("string"==typeof e?iR(e):e,n)).then(t=>{if(r(t))return t;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}})}function iU(e){return iR(e)}function iW(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function iH(e){return"boolean"==typeof e}function iz(e){return"number"==typeof e}function iK(e,t){switch(e.type){case"UnaryExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h=e,g=t;let y=iK(h.argument,g);switch(h.operator){case"+":return+y;case"-":return-y;case"~":return~y;case"!":return!y;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var v=e,b=t;switch(v.operator){case"&&":return iK(v.left,b)&&iK(v.right,b);case"||":return iK(v.left,b)||iK(v.right,b);case"??":return iK(v.left,b)??iK(v.right,b)}let w=iK(v.left,b),E=iK(v.right,b);switch(v.operator){case"+":return w+E;case"-":return w-E;case"*":return w*E;case"/":return w/E;case"%":return w%E;case"**":return w**E;case"==":return w==E;case"===":return w===E;case"!=":return w!=E;case"!==":return w!==E;case">":return w>E;case">=":return w>=E;case"<":return w<E;case"<=":return w<=E;case"in":return w in E;default:throw`Expression evaluator does not support operator '${v.operator}' operator`}case"ConditionalExpression":return r=e,n=t,iK(r.test,n)?iK(r.consequent,n):iK(r.alternate,n);case"CallExpression":return iQ(iZ(e,t));case"ArrowFunctionExpression":let D;return a=e,o=t,D=a.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<D.length)throw`Required argument(s) ${D.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(D.reduce((t,r,n)=>{let a=e[n];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let r of Object.keys(t))if(!e(t[r]))return!1;return!0}if(Array.isArray(t)){for(let r of t)if(!e(r))break}return!1}(a)&&t.push([r,a]),t},[]));return iK(a.body,o.addVariables(t))}).bind(null);case"MemberExpression":return iQ(iY(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(i0(s));case"SequenceExpression":let x;return l=e,u=t,(x=l.expressions.map(i0(u)))[x.length-1];case"NewExpression":var _=e,S=t;if(_.callee&&"Identifier"===_.callee.type){let e=_.arguments?.map(i0(S));switch(_.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${_.callee.name}`}}if(_.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return e.value;case"Identifier":return c=e,d=t,(i1(c.name),d.variables&&Object.hasOwn(d.variables,c.name))?d.variables[c.name]:Object.hasOwn(d.globals,c.name)?d.globals[c.name]:void 0;case"TemplateLiteral":let C,k;return m=e,p=t,C=m.expressions?.map(i0(p))??[],(k=m.quasis?.map(i0(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+C.join("")+k.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(f=e).cooked,tail:f.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function iG(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return iG(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function iZ(e,t){let r=iX(e.callee,t);if(r===iJ||e.optional&&null==r)return iJ;let n=e.arguments?.map(i0(t));if(r){if("function"!=typeof r)throw`${i3(e.callee)} is not a function`}else throw`No function named ${i3(e.callee)} is defined in this context`;return r(...n)}function iY(e,t){let r=iX(e.object,t);if(r===iJ||e.optional&&null==r)return iJ;if(null===r)throw TypeError(`TypeError: cannot read properties of null (reading '${i2(e.property,t)}')`);if(void 0===r)switch(e.object.type){case"Identifier":{let r=iG(e.object,t);throw ReferenceError(`ReferenceError: ${r} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${i2(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof r&&"function"!=typeof r&&"string"!=typeof r&&"number"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;let n=e.computed?function(e){if(void 0===e)throw{type:"Illegal property access",message:"No property was supplied to the property access"};if("string"!=typeof e&&"number"!=typeof e)throw{type:"Illegal property access",message:`Cannot use a value of type ${null===e?"null":typeof e} as a property name`};return e}(iK(e.property,t)):function(e){if("Identifier"!==e.type)throw`VisitMemberExpression does not support a property of type '${e.type}'`;return e.name}(e.property);i1(n),function(e,t){if(i4.has(String(t)))return;let r=Object(e);for(;null!==r;){if(Object.hasOwn(r,t)){if(r===Object.prototype||r===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}r=Object.getPrototypeOf(r)}}(r,n);let a=r[n];return"function"==typeof a?a.bind(r):a}function iq(e,t){let r={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return r.addVariables.bind(r),r}iR.plugins.register({name:"arrow",init(e){e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){let r=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let r=this.gobbleBinaryExpression();r||this.throwError("Expected expression after "+e),t.node={type:iO,params:null,body:r};return}}this.index=r}}),e.hooks.add("after-expression",function(t){!function t(r){r&&(Object.values(r).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===r.operator&&(r.type=iO,r.params=r.left?[r.left]:null,r.body=r.right,r.params&&r.params[0].type===e.SEQUENCE_EXP&&(r.params=r.params[0].expressions),delete r.left,delete r.right,delete r.operator))}(t.node)})}}),iR.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let r=t.node;if(r&&"new"===r.operator){r.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(r.argument.type)||this.throwError("Expected new function()"),t.node=r.argument;let n=t.node;for(;n.type===e.MEMBER_EXP||n.type===e.CALL_EXP&&n.callee.type===e.MEMBER_EXP;)n=n.type===e.MEMBER_EXP?n.object:n.callee.object;n.type="NewExpression"}})}}),iR.plugins.register({name:"numbers",init(e){function t(e){return"x"===e||"X"===e?(this.index+=2,[[48,57],[65,70],[97,102]]):"b"===e||"B"===e?(this.index+=2,[[48,49]]):"o"===e||"O"===e||e>="0"&&e<="7"?(this.index+=e<="7"?1:2,[[48,55]]):null}function r(t){let r=this.index,n="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(n+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(n+=this.expr.charAt(this.index++)),a(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+n+this.char+")");else if(i===e.PERIOD_CODE){n.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:n},null,2)}`),this.index=r;return}t.node={type:e.LITERAL,value:parseFloat(n),raw:this.expr.substring(r,this.index)}}e.hooks.add("gobble-token",function(n){if(48===this.code){var a,o,i;let s=this.index,l=this.expr.charAt(this.index+1),u=t.call(this,l);if(!u)return;let c="";for(;a=this.code,o=u,95===a||o.some(([e,t])=>a>=e&&a<=t);)95===this.code?this.index++:c+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(l.charCodeAt(0))){this.index=s+1,r.call(this,n);return}this.throwError("unexpected char within number")}n.node={type:e.LITERAL,value:parseInt(c,"x"===(i=l)||"X"===i?16:"b"===i||"B"===i?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&r.call(this,n)})}}),iR.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let r=++this.index,n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){let n,a=this.expr.slice(r,this.index),o="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)o+=this.char;else break}try{n=new RegExp(a,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:n,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),iR.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}}),iR.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,r=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},n="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:n},tail:o});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,o=!0,s(),e.node=t,r&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",n="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(a+=i,i=this.expr.charAt(++this.index),a+=i,i){case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+=" ";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=i}else n+=i,a+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(r){if((r.node.type===e.IDENTIFIER||r.node.type===e.MEMBER_EXP)&&96===this.code)return r.node={type:"TaggedTemplateExpression",tag:r.node,quasi:t.bind(this)(r,!1)},r.node=this.gobbleTokenProperty(r.node),r.node})}}),iR.addBinaryOp("in",7),iR.addBinaryOp("??",1);let iJ=Symbol("optional chain short-circuited");function iX(e,t){switch(e.type){case"MemberExpression":return iY(e,t);case"CallExpression":return iZ(e,t);default:return iK(e,t)}}function iQ(e){return e===iJ?void 0:e}function i0(e){return function(t){return null===t?null:iK(t,e)}}function i1(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let i4=new Set(["toString","valueOf","hasOwnProperty"]);function i2(e,t){try{return iG(e,t)}catch{return"<computed>"}}function i3(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function i6(e){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;let t={globals:{...iN},boundNames:new Set,variables:new Set};return i5("string"==typeof e?iR(e):e,t),[...t.variables]}function i5(e,t){switch(e.type){case"UnaryExpression":return r=e,n=t,void i5(r.argument,n);case"BinaryExpression":return a=e,o=t,void(i5(a.left,o),i5(a.right,o));case"ConditionalExpression":return i=e,s=t,void(i5(i.consequent,s),i5(i.test,s),i5(i.alternate,s));case"CallExpression":return l=e,u=t,void(i5(l.callee,u),l.arguments?.map(i9(u)));case"ArrowFunctionExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h,g,y,v,b,w,E,D=e,x=t;let _=new Set(x.boundNames);for(let e of D.params??[])e?.type==="Identifier"&&_.add(e.name);i5(D.body,{...x,boundNames:_});return;case"MemberExpression":return c=e,d=t,void(i5(c.object,d),c.computed&&i5(c.property,d));case"ArrayExpression":return m=e,p=t,void m.elements?.map(i9(p));case"SequenceExpression":return f=e,h=t,void f.expressions?.map(i9(h));case"NewExpression":return g=e,y=t,void g.arguments?.map(i9(y));case"Literal":case"TemplateElement":return;case"Identifier":return v=e,b=t,void(v.name in b.globals||b.boundNames.has(v.name)||b.variables.add(v.name));case"TemplateLiteral":return w=e,E=t,void(w.expressions?.map(i9(E)),w.quasis?.map(i9(E)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function i9(e){return function(t){return null===t?null:i5(t,e)}}let i8=U("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let r=t.replace("openmrs:feature-flag:",""),n=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${r}`)||"{}");e[r]={enabled:"true"===localStorage.getItem(t),...n}}return e}()});function i7(e,t,r){i8.setState(n=>({flags:{...n.flags,[e]:{enabled:n.flags[e]?.enabled??!1,label:t,description:r}}}))}function se(){let e=i8.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let r=t.replace("openmrs:feature-flag:","");e[r]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${r}`))})}function st(e){return i8.getState().flags[e].enabled}function sr(e,t){i8.subscribe(r=>{t(r.flags[e].enabled)})}function sn(e,t){i8.setState(r=>({flags:{...r.flags,[e]:{...r.flags[e],enabled:t}}}))}i8.subscribe(e=>{for(let[t,r]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,r.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:r.label,description:r.description}))});var sa=tK(function(e,t,r){tL(e,t,r)});let so=F("extensionsInternal",{slots:{},extensions:{}}),si=F("extensionRenderings",{renderings:new Map}),ss=()=>U("extensionsInternal",{slots:{},extensions:{}}),sl=()=>U("extensionRenderings",{renderings:new Map});function su(e){let t=so.getState(),r=e(t);r!==t&&so.setState(r)}let sc=null,sd=null;function sm(){let e=si.getState();return sc&&e===sd||(sc=new Map(e.renderings),sd=e,function(e){for(let t of(sD.clear(),e.values()))s_(t,1);sx=!0}(sc)),sc}function sp(e){sd={renderings:e},si.setState(sd,!0)}function sf(e){let t=sm();t.has(e.renderingId)||(t.set(e.renderingId,e),s_(e,1),sp(t))}function sh(e){let t=sm(),r=t.get(e);r&&(t.delete(e),s_(r,-1),sp(t))}let sg=()=>U("extensions",{slots:{}}),sy=0,sv=new Set;function sb(e){sy++;try{return e()}finally{if(0==--sy&&sv.size>0){let e=Array.from(sv);for(let t of(sv.clear(),e))sw(t)}}}function sw(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function sE(e){sy>0?sv.add(e):sw(e)}let sD=new Map,sx=!1;function s_(e,t){let r=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),n=sD.get(r);if(!n){if(t<0)return;sD.set(r,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),sx=!0;return}n.count+=t,n.count<1&&(sD.delete(r),sx=!0)}function sS(){var e,t;if(sm(),!sx)return;sx=!1;let r=Array.from(sD.values(),({record:e})=>e);r.sort(sC),e=nw.getState().mountedExtensions,t=r,e.length===t.length&&e.every((e,r)=>0===sC(e,t[r]))||nw.setState({mountedExtensions:r})}function sC(e,t){return sk(e.slotName,t.slotName)||sk(e.extensionId,t.extensionId)||sk(e.slotModuleName,t.slotModuleName)||sk(e.extensionModuleName,t.extensionModuleName)}function sk(e,t){return e===t?0:e<t?-1:1}sS(),si.subscribe(()=>sE(sS));let sP=ss(),sR=sg(),sT=nD(),sO=nS(),s$=new Set,sN=!1;function sI(e){if(null===e)s$=null;else if(null!==s$)for(let t of e)s$.add(t);sE(sM)}function sM(){if(!sN){sN=!0;try{for(let e=1;;e++){let t=s$;if(null!==t&&0===t.size)return;s$=new Set;try{!function(e,t,r,n,a,o=null){let i=sR.getState().slots,s={},l=!1,u=Object.entries(n.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[n,c]of Object.entries(e.slots)){let d=i[n];if(d&&o&&!o.has(n)){s[n]=d;continue}let{config:m}=n_(t,c.name),p=function(e,t,r,n,a,o){let i=function(e,t){let r=e.add||[],n=e.remove||[],a=e.order||[],{extensions:o}=sP.getState(),i=new Set(n),s=[...t,...r].filter(e=>!i.has(e)),l=sz(a),u=sz(t),c=new Map(s.map(e=>[e,function(e,t,r,n){let a=t.get(e);if(void 0!==a)return a;{if(void 0!==r)return 1e3+r;let t=n.get(e);return void 0!==t?2e3+t:3e3}}(e,l,o[sL(e)]?.order,u)]));return s.sort((e,t)=>c.get(e)-c.get(t))}(r,t.slots[e].attachedIds),s=[];for(let l of i){let{config:i}=nC(n,e,l),u=nk(r,e,l),c=u?sa({},i,u):i,d=sL(l),m=t.extensions[d];if(m){let e=c?.["Display conditions"]?.privileges??m.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!o?.user||!oo(e,o.user))||m.featureFlag&&!a.includes(m.featureFlag))continue;s.push({id:l,name:d,moduleName:m.moduleName,config:c,featureFlag:m.featureFlag,meta:m.meta,displayConditionExpression:c?.["Display conditions"]?.expression||m.displayExpression})}}return s}(n,e,m,r,u,a.session);d&&d.moduleName===c.moduleName&&rk(d.candidateExtensions,p)?s[n]=d:(s[n]={moduleName:c.moduleName,candidateExtensions:p},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&sR.setState({slots:s})}(sP.getState(),sT.getState(),sO.getState(),i8.getState(),a5.getState(),t)}catch(e){throw s$=null===t||null===s$?null:new Set([...t,...s$]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{sN=!1}}}function sj(e,t){let r=new Set;for(let n of Object.keys(e))e[n]!==t[n]&&r.add(n);for(let n of Object.keys(t))n in e||r.add(n);return r}function sA(e,t){return{moduleName:t,name:e,attachedIds:[]}}function sL(e){let[t]=e.split("#");return t}function sF(e,t){let r=sL(t);return e.extensions[r]}function sB(e){return sF(sP.getState(),e)}sP.subscribe((e,t)=>{sI(e.extensions!==t.extensions?null:sj(e.slots,t.slots))}),sT.subscribe((e,t)=>{sI(sj(e.slots,t.slots))}),sO.subscribe((e,t)=>{sI(sj(e.configs,t.configs))}),i8.subscribe(()=>sI(null)),a5.subscribe(()=>sI(null)),sI(null);let sV=e=>su(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function sU(e,t){su(r=>{let n=r.slots[e];return n?{...r,slots:{...r.slots,[e]:{...n,attachedIds:[...n.attachedIds,t]}}}:{...r,slots:{...r.slots,[e]:{...sA(e),attachedIds:[t]}}}})}function sW(e,t){su(r=>{let n=r.slots[e];return n&&n.attachedIds.includes(t)?{...r,slots:{...r.slots,[e]:{...n,attachedIds:n.attachedIds.filter(e=>e!==t)}}}:r})}function sH(e){su(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[]}}}:t})}function sz(e){let t=new Map;return e.forEach((e,r)=>{t.has(e)||t.set(e,r)}),t}function sK(e,t){return function(e,t,r=null,n){let a;return e.filter(e=>{let o=e.displayConditionExpression;if("string"!=typeof o||0===o.trim().length)return!0;a??(a=t&&"object"==typeof t?{session:r,...t}:{session:r});try{return!!ij(o,a)}catch(t){return console.error(`Error while evaluating expression '${o}' for ${e.id}`+(n?` in ${n}`:""),t),!1}})}(sG(e),t,a5.getState().session,e)}function sG(e){return sR.getState().slots[e]?.candidateExtensions??[]}let sZ=(e,t)=>sP.setState(r=>{let n=r.slots[t]?.moduleName;if(n&&n!=e)return console.warn(`An extension slot with the name '${t}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${n}.`),r;if(n&&n==e)return r;if(r.slots[t])return{...r,slots:{...r.slots,[t]:{...r.slots[t],moduleName:e}}};let a=sA(t,e);return{...r,slots:{...r.slots,[t]:{...a}}}}),sY=()=>{s$=null,su(()=>({slots:{},extensions:{}})),sl().setState({renderings:new Map}),sR.setState({slots:{}})},sq=F("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function sJ({name:e,basePath:t,mode:r,componentContext:n,state:a}){sq.setState({slotName:e,basePath:t,mode:r??"normal",componentContext:n,state:a})}function sX(e){sq.getState().slotName===e&&sq.setState(sq.getInitialState(),!0)}let sQ=F("modalRegistry",{modals:{}});function s0(e){sQ.setState(t=>(t.modals[e.name]=e,t))}function s1(e){let t=sQ.getState().modals[e];if(!t){let r=sB(e);r&&(t={name:e,load:r.load,moduleName:r.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),s0(t))}return t}let s4=F("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function s2(e){let{registeredWorkspacesByName:t,registeredWindowsByName:r}=s4.getState(),n=t[e];if(n){let t=r[n.window];if(t)return t;throw Error(`No workspace window found with name: ${n.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function s3(e){let{registeredGroupsByName:t,registeredWindowsByName:r}=s4.getState(),n=r[e];if(n){let r=t[n.group];if(r)return r;throw Error(`No workspace group found with name: ${n.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function s6(e){let{openedWindows:t}=s4.getState();return t.findIndex(t=>t.windowName===e)}function s5(e,t){if(0==t.length)return;let{registeredGroupsByName:r}=s4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace group ${r.name} more than once`);n[r.name]={...r,moduleName:e}}s4.setState({registeredGroupsByName:n})}function s9(e,t){if(0==t.length)return;let{registeredWindowsByName:r}=s4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace window ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}s4.setState({registeredWindowsByName:n})}function s8(e,t){if(0==t.length)return;let{registeredWorkspacesByName:r}=s4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}s4.setState({registeredWorkspacesByName:n})}let s7=0,le=null,lt={bootstrap:15e3,mount:15e3,unmount:15e3};function lr(e,t){if(e.timeouts)return e;let r=e.name??"parcel",n=Object.fromEntries(Object.keys(lt).filter(t=>e[t]).map(n=>{var a,o;let i,s;return[n,(a=e[n],o=lt[n],i=Array.isArray(a)?a:[a],s=e=>i.reduce((t,a,o)=>t.then(()=>{let t=a(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${n} at array index ${o} for parcel ${r} did not return a promise`))}),Promise.resolve(void 0)),e=>{let a,i=new Promise((e,t)=>{a=setTimeout(()=>t(Error(`Lifecycle function ${n} for parcel ${r} did not settle within ${o}ms`)),o)});return Promise.race([s(e),i]).finally(()=>clearTimeout(a)).then(e=>(t(n,!1),e),e=>{throw t(n,!0),e})})]}));return{...e,...n}}async function ln(e,t){var r,n;let a,o,i,s,l,u=await (le??(le=new Promise((e,t)=>{(0,ak.mountRootParcel)({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),ak.mountRootParcel))),le),c={...t},d=(a=c,o=!1,{retarget:e=>a={...e},release:i=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(a),onSettled(e,t){switch(e){case"bootstrap":t&&i();return;case"mount":o||(o=t);return;case"unmount":(t||o)&&i();return}}});return n=u((r=d.onSettled,"function"==typeof e?()=>e().then(e=>lr(e,r)):lr(e,r)),c),s=e=>t=>e.call(n,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===n.getStatus()&&d.release(),e}),l=n.update&&s(n.update),Object.defineProperty(n,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&s(e)}})}function la(){return lo}function lo(e,t){let r,n=ln(e,t).then(e=>r=e);return{mount:()=>n.then(e=>e.mount()),unmount:()=>n.then(e=>e.unmount()),update:e=>n.then(t=>t.update?.(e)),getStatus:()=>r?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return n.then(e=>e.loadPromise)},get bootstrapPromise(){return n.then(e=>e.bootstrapPromise)},get mountPromise(){return n.then(e=>e.mountPromise)},get unmountPromise(){return n.then(e=>e.unmountPromise)}}}async function li(e,t,r,n,a=e=>e,o={}){let i=sL(n),s=sB(n),l=null;if(e){let u;if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:c,moduleName:d,load:m}=s,p=s7++,f=`${t}/${n}-${p}`;e.dataset.extensionRenderingId=f;let h=e=>{try{sh(f)}catch(t){console.error(e,t)}};try{sf({renderingId:f,extensionName:i,extensionModuleName:d,extensionId:n,slotName:t,slotModuleName:r})}catch(e){throw h(`Recomputing configuration after registering '${n}' failed also failed`),e}try{u=await m()}catch(e){throw h(`Recomputing configuration after '${n}' failed to load also failed`),e}try{l=await ln(a({...u,name:`${t}/${i}-${p}`}),{...o,_meta:c,_extensionContext:{extensionId:n,extensionSlotName:t,extensionSlotModuleName:r,extensionModuleName:d,extensionMeta:c},domElement:e})}catch(e){throw h(`Recomputing configuration after '${n}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${n}' in slot '${t}' failed to mount`,e),h(`Recomputing configuration after '${n}' failed to mount also failed`)}),l.unmountPromise.then(()=>h(`Recomputing configuration after unmounting '${n}' failed`),e=>{console.error(`Extension '${n}' in slot '${t}' failed to unmount`,e),h(`Recomputing configuration after '${n}' failed to unmount also failed`)})}else console.warn(`Tried to render ${n} into ${t} but no DOM element was available.`);return l}var ls=r(4587),ll=r.n(ls);let lu=(0,ls.createContext)({moduleName:"",featureName:""});var lc=r(9978);function ld({to:e,templateParams:t,onBeforeNavigate:r,children:n,...a}){return(0,ls.useEffect)(()=>{a.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${a.href}'`),a.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),(0,lc.jsx)("a",{onClick:n=>{0===n.button&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey&&(n.preventDefault(),r?.(n),aH({to:e,templateParams:t})),0===n.button&&(n.ctrlKey||n.metaKey)&&r?.(n),0===n.button&&n.shiftKey&&r?.(n),1===n.button&&r?.(n)},href:aU(e,t),...a,children:n})}let lm=({state:e,children:t,...r})=>{let{extension:n}=(0,ls.useContext)(lu),a=(0,ls.useRef)(null),o=(0,ls.useRef)(Promise.resolve()),i=(0,ls.useRef)(!1),s=(0,ls.useRef)(!1),l=(0,ls.useRef)(e),u=(0,ls.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":o.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),c=(0,ls.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(o.current=Promise.all([e.mountPromise,o.current]).then(()=>{if(a.current?.getStatus()==="MOUNTED"&&a.current.update)return a.current.update({...t})}).catch(e=>{let t=a.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${n?.extensionId}' failed to update`,e)}))},[]),d=(0,ls.useCallback)(t=>{t&&!a.current&&!s.current&&n?.extensionSlotName&&n.extensionSlotModuleName&&(s.current=!0,li(t,n.extensionSlotName,n.extensionSlotModuleName,n.extensionId,void 0,e).then(t=>{(s.current=!1,a.current=t,i.current)?u(t):t&&l.current!==e&&c(t,l.current)},()=>{s.current=!1}))},[]);return(0,ls.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(a.current)}),[]),(0,ls.useEffect)(()=>{l.current=e,a.current&&c(a.current,e)},[e]),n?(0,lc.jsx)("div",{ref:d,"data-extension-id":n?.extensionId,style:{position:"relative"},...r}):null};function lp(e){let t=(0,ls.useRef)(e);return R(t.current,e)||(t.current=e),t.current}function lf(e,t){"function"==typeof t&&(t=t(e));let r={};for(let[n,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};r[n]=t}return r}let lh=e=>e;function lg(e,t=lh,r){let n=(0,ls.useCallback)(t=>e.subscribe(t),[e]),a=(0,ls.useCallback)(()=>t(e.getState()),[e,t]),o=(0,ls.useSyncExternalStore)(n,a,a),i=(0,ls.useMemo)(()=>r?lf(e,r):null,[e,r]);return(0,ls.useMemo)(()=>i?{...o,...i}:o,[o,i])}function ly(e,t){return lg(e,lh,t)}function lv(e){return function(t){let r=(0,ls.useCallback)(t=>e.subscribe(t),[]),n=(0,ls.useCallback)(()=>e.getState(),[]),a=(0,ls.useSyncExternalStore)(r,n,n),o=(0,ls.useMemo)(()=>t?lf(e,t):null,[t]);return(0,ls.useMemo)(()=>o?{...a,...o}:a,[a,o])}}let lb=[];Object.freeze(lb);let lw={candidateExtensions:lb};Object.freeze(lw);let lE=e=>{let t=(0,ls.useCallback)(t=>t.slots?.[e]??lw,[e]);return lg(sg(),t)},lD=e=>e.session;function lx(e,t){let{candidateExtensions:r}=lE(e),n=lg(a5,lD),a=lp(t);return(0,ls.useMemo)(()=>sK(e,a),[e,a,n,r])}function l_(e,t){let{moduleName:r}=(0,ls.useContext)(lu);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,ls.useEffect)(()=>{sZ(r,e)},[r,e]),{extensions:lx(e,t),extensionSlotName:e,extensionSlotModuleName:r}}function lS(e){return e}function lC({name:e,extensionSlotName:t,select:r=lS,children:n,state:a,style:o,...i}){if(n&&a)throw Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");let s=e??t,l=(0,ls.useRef)(null),{extensions:u,extensionSlotModuleName:c}=l_(s,a),d=(0,ls.useMemo)(()=>r(u),[r,u]),m=(0,ls.useMemo)(()=>{if("function"==typeof n&&!ll().isValidElement(n))return d.map(e=>n(e,a))},[n,d]);return(0,lc.jsx)("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...o,position:"relative"},...i,children:s&&d?.map((e,t)=>(0,lc.jsx)(lu.Provider,{value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}},children:m?.[t]??("function"!=typeof n?n:null)??(0,lc.jsx)(lm,{state:a})},e.id))})}var lk=r(6298),lP=r.n(lk);function lR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function lT(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lR(Object(r),!0).forEach(function(t){var n,a,o;n=e,a=t,o=r[t],a in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lR(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function lO(e){return(lO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l$(e){return(l$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lN(e,t){var r;if("function"!=typeof(r=t.domElement?function(){return t.domElement}:t.domElementGetter?t.domElementGetter:e.domElementGetter?e.domElementGetter:function(e){var t=e.appName||e.name;if(!t)throw Error("single-spa's dom-element-getter-helpers was not given an application name as a prop, so it can't make a unique dom element container for the react application");var r="single-spa-application:".concat(t);return function(){var e=document.getElementById(r);return e||((e=document.createElement("div")).id=r,document.body.appendChild(e)),e}}(t)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(t.name,"'. Expected a function, received ").concat(l$(r)));return function(){var e=r(t);if(!(e instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(t.name,"'. Expected HTMLElement, received ").concat(l$(e)));return e}}var lI=null;try{lI=require("react").createContext()}catch(e){}var lM={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function lj(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function lA(e,t){return new Promise(function(r,n){e.suppressComponentDidCatchWarning||!function(e){if(!(e&&"string"==typeof e.version&&e.version.indexOf(".")>=0))return!1;var t=e.version.slice(0,e.version.indexOf("."));try{return Number(t)>=16}catch(e){return!1}}(e.React)||e.errorBoundary||e.errorBoundaryClass||(e.rootComponent.prototype?e.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var a,o=lV(e,t,function(){r(this)}),i=lN(e,t)(),s=function(e){var t=e.reactDom,r=e.renderType,n=e.elementToRender,a=e.domElement,o=t[r];if("function"!=typeof o)throw Error('renderType "'.concat(r,'" did not return a function.'));switch(r){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(n),i;case"hydrateRoot":return o(a,n);default:return o(n,a),null}}({elementToRender:o,domElement:i,reactDom:lB(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function lL(e,t){return new Promise(function(r){e.unmountResolves[t.name]=r;var n=e.renderResults[t.name];n&&n.unmount?n.unmount():lB(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function lF(e,t){return new Promise(function(r){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(r);var n=lV(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(n);else{var o=lN(e,t)();lB(e).render(n,o)}})}function lB(e){return e.ReactDOMClient||e.ReactDOM}function lV(e,t,r){var n=e.React.createElement(e.rootComponent,t),a=lI?e.React.createElement(lI.Provider,{value:t},n):n;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function r(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},r.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return r.prototype=Object.create(e.React.Component.prototype),r.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},r.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},r}(e,t),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,lT(lT({},t),{},{mountFinished:r,updateFinished:function(){e.updateResolves[t.name]&&(e.updateResolves[t.name].forEach(function(e){return e()}),delete e.updateResolves[t.name])},unmountFinished:function(){e.unmountResolves[t.name]&&(e.unmountResolves[t.name](),delete e.unmountResolves[t.name])}}),a)}var lU=r(587),lW=r(2272),lH=r(8444);let lz={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},lK=new Map;(0,lH.y)(lK);let lG={errorRetryCount:3,fetcher:a3,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof a6){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>lK};function lZ(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},lz,e),r={...lG,...t.swrConfig};return function(e){var n,a,o,i,s;return o=a=class extends(n=ll().Component){componentDidCatch(e,r){r&&r.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:r.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:r})}render(){if(this.state.caughtError)return(0,lc.jsx)("div",{children:"An error has occurred. Please try reloading the page."});{let n=(0,lc.jsx)(ls.Suspense,{fallback:null,children:(0,lc.jsx)(lW.S,{value:r,children:(0,lc.jsx)(lu.Provider,{value:this.state.config,children:t.disableTranslations?(0,lc.jsx)(e,{...this.props}):(0,lc.jsx)(lU.I18nextProvider,{i18n:window.i18next,defaultNS:this.state.config.extension?`${this.state.config.moduleName}___${this.state.config.extension.extensionSlotName}___${this.state.config.extension.extensionId}`:this.state.config.moduleName,children:(0,lc.jsx)(e,{...this.props})})})})});return t.strictMode&&ll().StrictMode?(0,lc.jsx)(ll().StrictMode,{children:n}):n}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:t.moduleName,featureName:t.featureName,extension:e._extensionContext}}}},i="displayName",s=`OpenmrsReactComponent(${t.featureName})`,i in o?Object.defineProperty(o,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[i]=s,a}}function lY(e,t){return function(e){if("object"!==lO(e))throw Error("single-spa-react requires a configuration object");var t,r=lT(lT({},lM),e);if(!r.React)throw Error("single-spa-react must be passed opts.React");if(!r.ReactDOM&&!r.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(r.renderType||(null!=(t=r.ReactDOMClient)&&t.createRoot?r.renderType="createRoot":r.renderType="render"),!r.rootComponent&&!r.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(r.errorBoundary&&"function"!=typeof r.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!lI&&r.React.createContext&&(lI=r.React.createContext()),r.SingleSpaRoot=function(e){function t(e){t.displayName="SingleSpaRoot(".concat(e.name,")")}return t.prototype=Object.create(e.React.Component.prototype),t.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},t.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},t.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},t}(r);var n={bootstrap:lj.bind(null,r),mount:lA.bind(null,r),unmount:lL.bind(null,r)};return r.parcelCanUpdate&&(n.update=lF.bind(null,r)),n}({React:ll(),ReactDOMClient:lP(),rootComponent:lZ(t)(e)})}function lq(e,t){return()=>e().then(({default:e})=>lY(e,t))}function lJ(e,t){return()=>Promise.resolve(lY(e,t))}let lX=lq,lQ=N()(()=>({}));V("openmrs-app-context",lQ);let l0={};function l1(e,t=e=>e){let r=lQ.getState();return e in r?Object.freeze(Object.assign({},t?t(r[e]):r[e])):null}function l4(e,t){lQ.setState(r=>(e in r||(r[e]={}),r[e]=t(r[e]),Object.assign({},r)))}function l2(e){return null===e?null:Object.freeze(Object.assign({},e))}let l3=new Map;function l6(e,t){let r=(0,ls.useRef)(t??{}),n=(0,ls.useRef)(t=>l4(e,t)),a=(0,ls.useRef)(Symbol());return(0,ls.useEffect)(()=>{let r=t??{},n=a.current;return null===l1(e)?!function(e,t=l0){lQ.setState(r=>{if(e in r)throw Error(`Attempted to re-register namespace ${e} in the app context. Each namespace must be unregistered before the name can be registered again.`);return Object.assign({},r,{[e]:t===l0?{}:t})})}(e,r):(console.warn(`Namespace ${e} is already registered in the app context. This is likely a race condition during navigation, but may indicate two components are trying to own the same namespace. Updating the existing context.`),l4(e,()=>r)),l3.set(e,n),()=>{l3.get(e)===n&&(lQ.setState(t=>(e in t&&delete t[e],t)),l3.delete(e))}},[e]),(0,ls.useEffect)(()=>{let n=t??{};R(r.current,n)||(l4(e,()=>n),r.current=n)},[t]),n.current}function l5({namespace:e,value:t}){return l6(e,t),null}let l9=({children:e,value:t,fallback:r})=>t?(0,lc.jsx)(lc.Fragment,{children:e}):r?(0,lc.jsx)(lc.Fragment,{children:r}):null;function l8(){let e=(0,ls.useRef)(null);return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,ls.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function l7(e,t=e=>e??{}){let[r,n]=(0,ls.useState)(()=>{if(ue(e))return;let r=l1(e);if(null!==r)return t?t(r):r});return(0,ls.useEffect)(()=>{if(ue(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,ls.useEffect)(()=>{var r;let a;return(r=e=>{if(null==e)return void n(void 0);let r=t?t(e):e;n(e=>R(e,r)?e:r)})(l2(a=l1(e))),lQ.subscribe(t=>{let n=e in t?t[e]:null;n!==a&&(a=n,r(l2(n)))})},[e,t]),r}function ue(e){return"string"!=typeof e||0===e.trim().length}function ut(e){let t=lx(e);return(0,ls.useMemo)(()=>t.map(e=>e.id),[t])}function ur(e){return lE(e).candidateExtensions}function un(e,t,r){let{data:n,error:a,mutate:o,isLoading:i,isValidating:s}=(0,lW.u)(e?is(e,t,r):null,e=>ov(e,a3));return(0,ls.useMemo)(()=>({isLoading:i,data:n?.data.results??[],error:a,mutate:o,isValidating:s}),[n,a,i,s,o])}function ua(e){(0,ls.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let uo={},ui=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
16
16
  Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function us(e,t,r){let n=uo[e];if(n)return n;let a=new Promise(e=>{let n=r(t.getState());if(n)return void e(n);let a=t.subscribe(t=>{let n=r(t);n&&(a(),e(n))})});return uo[e]=a,a.then(()=>{uo[e]===a&&delete uo[e]}),a}function ul(e){let{moduleName:t,extension:r}=(0,ls.useContext)(lu),n=e?.externalModuleName??t;if(!n&&!r)throw Error(ui);let a=function(e){let t=(0,ls.useMemo)(()=>nE(e),[e]),r=function(e){let[t,r]=(0,ls.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,ls.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&r(e.config)}),[e]),t}(t);if(!r)throw us(e,t,e=>e.loaded?e.config:null);return r}(n),o=function(e){let t=(0,ls.useMemo)(nS,[]),r=function(e,t){let[r,n]=(0,ls.useState)(t?()=>{let r=nC(e.getState(),t.extensionSlotName,t.extensionId);if(r.loaded&&r.config)return r.config}:null);return(0,ls.useEffect)(()=>{if(t)return e.subscribe(e=>{let a=nC(e,t.extensionSlotName,t.extensionId);a.loaded&&a.config&&!rk(a.config,r)&&n(a.config)})},[e,t,r]),r}(t,e);if(!r&&e)throw us(`${e.extensionSlotName}-${e.extensionId}`,t,t=>{let r=nC(t,e.extensionSlotName,e.extensionId);return r.loaded?r.config:null});return r||{}}(r);return(0,ls.useMemo)(()=>e?.externalModuleName&&n===e.externalModuleName?{...a}:{...a,...o},[n,e?.externalModuleName,a,o])}let uu=lx;function uc(e,t=300){let[r,n]=(0,ls.useState)(e);return(0,ls.useEffect)(()=>{let r=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(r)}},[e,t]),r}var ud=r(4993);let um=(0,ud.Ht)(lW.u,e=>(t,r,n)=>(n.revalidateOnFocus=!1,n.revalidateIfStale=!1,n.revalidateOnReconnect=!1,n.refreshInterval=0,e(t,r,n))),up=`custom:${[["admissionDecisionConcept","ref"],["admissionEncounterType","ref"],["admissionForm","ref"],["atFacilityVisitType","ref"],["bedAssignmentEncounterType","ref"],["cancelADTRequestEncounterType","ref"],["checkInClerkEncounterRole","ref"],["checkInEncounterType","ref"],["clinicianEncounterRole","ref"],["conceptSourcesForDiagnosisSearch","ref"],["consultEncounterType","ref"],["consultFreeTextCommentsConcept","ref"],["denyAdmissionConcept","ref"],["diagnosisMetadata","ref"],["diagnosisSets","ref"],["dischargeForm","ref"],["dispositionDescriptor","ref"],["dispositions","ref"],["emrApiConceptSource","ref"],["exitFromInpatientEncounterType","ref"],["extraPatientIdentifierTypes","ref"],["fullPrivilegeLevel","ref"],["highPrivilegeLevel","ref"],["identifierTypesToSearch","ref"],["inpatientNoteEncounterType","ref"],["lastViewedPatientSizeLimit","ref"],["metadataSourceName","ref"],["motherChildRelationshipType","ref"],["narrowerThanConceptMapType","ref"],["nonDiagnosisConceptSets","ref"],["orderingProviderEncounterRole","ref"],["patientDiedConcept","ref"],["personImageDirectory","ref"],["primaryIdentifierType","ref"],["sameAsConceptMapType","ref"],["suppressedDiagnosisConcepts","ref"],["supportsAdmissionLocationTag","(uuid,display,name,links)"],["supportsLoginLocationTag","(uuid,display,name,links)"],["supportsTransferLocationTag","(uuid,display,name,links)"],["supportsVisitsLocationTag","(uuid,display,name,links)"],["telephoneAttributeType","ref"],["testPatientPersonAttributeType","ref"],["transferForm","ref"],["transferRequestEncounterType","ref"],["transferWithinHospitalEncounterType","ref"],["unknownCauseOfDeathConcept","ref"],["unknownLocation","ref"],["unknownPatientPersonAttributeType","ref"],["unknownProvider","ref"],["visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary","ref"],["visitExpireHours","ref"],["visitNoteEncounterType","ref"]].map(([e,t])=>`${e}:${t}`).join(",")}`;function uf(){let e=um(`${a0}/emrapi/configuration?v=${up}`,a3);return(0,ls.useMemo)(()=>({emrConfiguration:e.data?.data,isLoadingEmrConfiguration:e.isLoading,mutateEmrConfiguration:e.mutate,errorFetchingEmrConfiguration:e.error}),[e])}function uh(){return(0,ls.useContext)(lu).extension}let ug=lv(ss());function uy(e){let t=lx(e);return(0,ls.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}let uv=lv(sg());function ub(e){let{flags:t}=lg(i8);return t[e]?.enabled??!1}function uw(){let[,e]=(0,ls.useState)(0);return(0,ls.useCallback)(()=>{e(e=>e+1)},[])}function uE(e,t,r={}){return ux(e,t,uD,r)}let uD={getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(a2(e.toString()),window.location.toString());return n.searchParams.set("limit",""+t),n.searchParams.set("startIndex",""+r),n.searchParams.set("totalCount","true"),n.toString()}},getNextUrl:e=>{let t=e?.links?.find(e=>"next"==e.rel)?.uri;if(!t)return null;{let e=new URL(t);return e.protocol=window.location.protocol,e.host=window.location.host,e.port=window.location.port,e.toString()}},getTotalCount:e=>e?.totalCount??NaN,getCurrentPageSize:e=>e?.results?.length??NaN,getData:e=>e?.results};function ux(e,t,r,n={}){let{getPaginatedUrl:a,getTotalCount:o,getCurrentPageSize:i,getData:s}=r,{immutable:l,swrConfig:u}=n,c=n.fetcher??a3,[d,m]=(0,ls.useState)(1),p=(0,ls.useRef)(NaN),f=(0,ls.useRef)(NaN),h=(0,ls.useRef)(d),g=(0,ls.useRef)(!1),y=(0,ls.useRef)(!1),v=e?.toString()??"",[b,w]=(0,ls.useState)(v);v!==b&&(w(v),m(1),h.current=1,p.current=NaN,f.current=NaN,g.current=!1,y.current=!1);let E=(d-1)*t,D=(0,ls.useMemo)(()=>a(e,t,E),[e,t,E]),{data:x,..._}=(l?um:lW.u)(D,c,u);x?.data&&(p.current=o(x?.data),f.current=i(x?.data),g.current=!0);let S=Math.ceil(p.current/t),C=(0,ls.useCallback)(e=>{if(!Number.isInteger(e)||e<1)return void console.warn(`useServerPagination: ignoring goTo(${e}); page must be a positive integer.`);let r=Math.ceil(p.current/t);!g.current||Number.isNaN(r)||e<=r?(h.current=e,m(e)):console.warn("Invalid attempt to go to out of bounds page: "+e)},[t]);(0,ls.useEffect)(()=>{if(!g.current)return;if(Number.isNaN(p.current)){y.current||(y.current=!0,console.warn(`useServerPagination: ${v} returned no total count, so out-of-range pages cannot be detected.`));return}let e=Math.max(1,Math.ceil(p.current/t));d>e&&(console.warn(`Invalid attempt to go to out of bounds page: ${d}; returning to page ${e}.`),h.current=e,m(e))},[d,t,v,x]);let k=(0,ls.useCallback)(()=>{C(h.current+1)},[C]),P=(0,ls.useCallback)(()=>{C(h.current-1)},[C]);return{data:s(x?.data),totalPages:S,totalCount:p.current,currentPage:d,currentPageSize:f.current,paginated:S>1,showNextButton:d<S,showPreviousButton:d>1,goTo:C,goToNext:k,goToPrevious:P,..._}}function u_(e,t,r={}){return ux(e,t,uS(),r)}function uS(){return{getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(a2(e.toString()),window.location.toString());return n.searchParams.set("_count",""+t),n.searchParams.set("_getpagesoffset",""+r),n.toString()}},getNextUrl:e=>{let t=e?.link?.find(e=>"next"==e.relation)?.url;if(!t)return null;{let e=new URL(t);return e.protocol=window.location.protocol,e.host=window.location.host,e.port=window.location.port,e.toString()}},getTotalCount:e=>e?.total??NaN,getCurrentPageSize:e=>e?.entry?.length??NaN,getData:e=>e?.entry?.map(e=>e.resource)}}var uC=r(9888);let uk=Promise.resolve(),uP=(0,ud.Ht)(lW.u,e=>(t,r,n)=>{let a,o=(0,ls.useRef)(!1),{cache:i,initialSize:s=1,revalidateAll:l=!1,persistSize:u=!1,revalidateFirstPage:c=!0,revalidateOnMount:d=!1,parallel:m=!1}=n,[,,,p]=lH.a.get(lH.o);try{(a=(0,lH.s)(t?t(0,null):null)[0])&&(a="$inf$"+a)}catch(e){}let[f,h,g]=(0,lH.c)(i,a),y=(0,ls.useCallback)(()=>(0,lH.i)(f()._l)?s:f()._l,[i,a,s]);(0,uC.useSyncExternalStore)((0,ls.useCallback)(e=>a?g(a,()=>{e()}):()=>{},[i,a]),y,y);let v=(0,ls.useCallback)(()=>{let e=f()._l;return(0,lH.i)(e)?s:e},[a,s]),b=(0,ls.useRef)(v());(0,lH.u)(()=>{if(!o.current){o.current=!0;return}a&&h({_l:u?b.current:v()})},[a,i]);let w=d&&!o.current,E=e(a,async e=>{let a=f()._i,o=f()._r,s=lH.a.get(i),u=s[8],d=()=>s[8]!==u;h({_r:lH.U});let g=[],y=v(),[b]=(0,lH.c)(i,e),E=b().data,D=[],x=null;for(let e=0;e<y;++e){let[s,u]=(0,lH.s)(t(e,m?null:x));if(!s)break;let[f,h]=(0,lH.c)(i,s),y=f().data,v=l||a||(0,lH.i)(y)||c&&!e&&!(0,lH.i)(E)||w||E&&!(0,lH.i)(E[e])&&!n.compare(E[e],y);if(r&&("function"==typeof o?o(y,u):v)){let t=async()=>{if(s in p){let e=p[s];delete p[s],y=await e}else y=await r(u);d()||h({data:y,_k:u}),g[e]=y};m?D.push(t):await t()}else g[e]=y;m||(x=y)}return m&&await Promise.all(D.map(e=>e())),d()||h({_i:lH.U}),g},n),D=(0,ls.useCallback)(function(e,t){let r="boolean"==typeof t?{revalidate:t}:t||{},n=!1!==r.revalidate;return a?(n&&((0,lH.i)(e)?h({_i:!0,_r:r.revalidate}):h({_i:!1,_r:r.revalidate})),arguments.length?E.mutate(e,{...r,revalidate:n}):E.mutate()):uk},[a,i]),x=(0,ls.useCallback)(e=>{let r;if(!a)return uk;let[,n]=(0,lH.c)(i,a);if((0,lH.e)(e)?r=e(v()):"number"==typeof e&&(r=e),"number"!=typeof r)return uk;n({_l:r}),b.current=r;let o=[],[s]=(0,lH.c)(i,a),l=null;for(let e=0;e<r;++e){let[r]=(0,lH.s)(t(e,l)),[n]=(0,lH.c)(i,r),a=r?n().data:lH.U;if((0,lH.i)(a))return D(s().data);o.push(a),l=a}return D(o)},[a,i,D,v]);return{size:v(),setSize:x,mutate:D,get data(){return E.data},get error(){return E.error},get isValidating(){return E.isValidating},get isLoading(){return E.isLoading}}});function uR(e,t={}){return uT(e,uD,t)}function uT(e,t,r={}){return uO(e,t,r).response}function uO(e,t,r={}){let{swrInfiniteConfig:n,immutable:a}=r,{getNextUrl:o,getTotalCount:i,getData:s}=t,l=r.fetcher??a3,{data:u,size:c,setSize:d,...m}=uP((0,ls.useCallback)((r,n)=>0==r?e?.toString()??null:t.getNextUrl(n.data),[e,t]),l,{...n,parallel:!1,...a?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),p=o(u?.[u.length-1]?.data),f=(0,ls.useCallback)(()=>d((u?.length??0)+1),[u?.length,d]),h=(0,ls.useCallback)(()=>{f()},[f]),g=i(u?.[0]?.data);return{response:{data:u?.flatMap(e=>s(e.data)??[]),totalCount:g,hasMore:null!=p,loadMore:h,nextUri:p,...m},loadMoreAsync:f,pages:u}}let u$=new WeakMap;function uN(e,t={}){return uI(e,uD,t)}function uI(e,t,r={}){let n=e?.toString()??null,a=(0,ud.iX)(),{cache:o}=a,[i,s]=(0,ls.useState)(null),l=n?`${n}#openmrs-fetch-all`:null,u=!!l&&void 0===o.get(l),{data:c,mutate:d}=(0,lW.u)(l,async()=>(await g.mutate(),null),{revalidateOnMount:!1,revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:!1,suspense:!1,fallbackData:void 0,keepPreviousData:!1,onSuccess:()=>{},onError:()=>{},onLoadingSlow:()=>{},onDiscarded:()=>{}}),m=!!l&&!u&&void 0===c;(0,ls.useEffect)(()=>{u&&d(null,{revalidate:!1})},[u,d]);let p=r.swrInfiniteConfig?.revalidateOnMount??a.revalidateOnMount,f=(0,ls.useRef)(!0),h=f.current&&m&&!1!==p,{response:g,loadMoreAsync:y,pages:v}=uO(e,t,{...r,swrInfiniteConfig:{...r.swrInfiniteConfig,revalidateFirstPage:r.swrInfiniteConfig?.revalidateFirstPage??a.revalidateFirstPage??i!==n,revalidateAll:m||(r.swrInfiniteConfig?.revalidateAll??a.revalidateAll),revalidateOnMount:!h&&p,onSuccess:(e,t,n)=>{l&&!o.get(l)?.isValidating&&d(null,{revalidate:!1}),(r.swrInfiniteConfig?.onSuccess??a.onSuccess)?.(e,t,n)}}}),{hasMore:b,data:w,isLoading:E,isValidating:D,nextUri:x,mutate:_}=g;(0,ls.useEffect)(()=>{n&&f.current&&(f.current=!1,h&&_())},[n,h,_]);let S=!!x&&!!v?.slice(0,-1).some(e=>t.getNextUrl(e.data)===x),C=(0,ls.useMemo)(()=>S?Error("Cannot fetch the complete collection: pagination returned a repeated next link."):void 0,[S]),k=g.error??C;return((0,ls.useEffect)(()=>{if(!b||k||D||m)(!b||k)&&null!==i&&s(null);else if(i!==n)s(n);else if(n){let e=u$.get(o);e||(e=new Map,u$.set(o,e));let t=`${n}
17
17
  ${x}`;if(!e.has(t)){let r=y().catch(()=>void 0).finally(()=>e.delete(t));e.set(t,r)}}},[b,x,k,D,m,i,n,y,o]),r.partialData)?{...g,error:k}:{...g,error:k,data:b||k?void 0:w,isLoading:E||b&&!k}}function uM(e,t={}){return uI(e,uS(),t)}function uj(e,t={}){return uT(e,uS(),t)}function uA(){let e="tablet";return document.body.classList.forEach(t=>{switch(t){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}}),e}function uL(){let[e,t]=(0,ls.useState)(uA);return(0,ls.useEffect)(()=>{let e=()=>{t(uA())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let uF=e=>"small-desktop"===e||"large-desktop"===e;function uB(e){let t=(0,ls.useContext)(lu);(0,ls.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),sJ(e),()=>{sX(e.name)}),[t,e])}function uV(){return lg(sq)}let uU=[];function uW(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString(),{data:a}=uN(`${a0}/location${n?"?"+n:""}`,{immutable:!0});return a??uU}function uH(e,t=!0){let r=(0,ls.useRef)(null);return(0,ls.useEffect)(()=>{let n=n=>{t&&r.current&&n.target&&n.target instanceof Node&&(r.current.contains(n.target)||e(n))};return window.addEventListener("mousedown",n),window.addEventListener("touchstart",n),()=>{window.removeEventListener("mousedown",n),window.removeEventListener("touchstart",n)}},[e,t]),r}function uz(e){let t=(0,ls.useRef)(null);return(0,ls.useEffect)(()=>{let r=new IntersectionObserver(t=>{for(let r of t)if(r.isIntersecting)return void e()},{threshold:1});return t.current&&r.observe(t.current),()=>{t.current&&r.unobserve(t.current)}},[t.current,e]),t}function uK(e,t={}){let{abortController:r,fetchInit:n,url:a,swrConfig:o}=t,i=l8(),s=(0,ls.useMemo)(()=>n?.signal??r?.signal??i.signal,[r?.signal,n?.signal,i.signal]),l=(0,ls.useCallback)(e=>a3(function(e,t){if(t)return"function"==typeof t?t(e):t;if("string"==typeof e)return e;throw Error(`When using useOpenmrsSWR with a key that is not a string, you must provide a url() function that converts the key to a valid url. The key for this hook is ${e}.`)}(e,a),{...n,signal:s}),[s,n,a]);return(0,lW.u)(e,l,o)}function uG(e=[],t=10){let[r,n]=(0,ls.useState)(1),a=(0,ls.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]);r>a&&n(a);let o=Math.min(Math.max(1,r),a),i=(0,ls.useMemo)(()=>{let r=(o-1)*t,n=(o+0)*t;return e.slice(r,n)},[e,o,t]),s=(0,ls.useCallback)(e=>{!Number.isInteger(e)||e<1?console.warn(`usePagination: ignoring goTo(${e}); page must be a positive integer.`):n(e)},[]),l=(0,ls.useCallback)(()=>{n(e=>e+1)},[]),u=(0,ls.useCallback)(()=>{n(e=>Math.max(1,e-1))},[]);return(0,ls.useMemo)(()=>({results:i,totalPages:a,currentPage:o,paginated:e.length>t,showNextButton:o<a,showPreviousButton:o>1,goTo:s,goToNext:l,goToPrevious:u}),[i,a,e.length,t,o,s,l,u])}function uZ(e,t,r,n){return{pageSizes:(0,ls.useMemo)(()=>{let r=Math.ceil(t/e);return isNaN(r)&&(r=0),[...Array(r).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,ls.useMemo)(()=>e>t?t:e*r>t?e*(r-1)+n:e*r,[e,t,r,n])}}function uY(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function uq(e){let[t,r]=(0,ls.useState)(e??uY()),{data:n,error:a,isValidating:o}=(0,lW.u)(t?["patient",t]:null,()=>ic(t,{}));return(0,ls.useEffect)(()=>{let e=()=>{let e=uY();e!==t&&r(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,ls.useMemo)(()=>({isLoading:o&&!a&&!n,patient:n,patientUuid:t,error:a}),[o,a,n,t])}function uJ(){let e=`${a0}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:r,isLoading:n}=(0,lW.u)(e,a3);return(0,ls.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:n,error:r}),[t,r,n])}function uX(e,t,r,n){let a=e?.slotName===t&&e.slotModuleName===r?e.components:null,o=new Map;for(let e of n)o.set(e,a?.get(e)??function(e,t,r){let n=sL(r),a=e=>e.extensions[n]?.meta,o=({state:n})=>{let o=lg(ss(),a),i=(0,ls.useMemo)(()=>({moduleName:t,featureName:"",extension:{extensionId:r,extensionSlotName:e,extensionSlotModuleName:t,extensionMeta:o}}),[o]);return(0,lc.jsx)(lu.Provider,{value:i,children:(0,lc.jsx)(lm,{state:n})})};return o.displayName=`RenderableExtension(${r})`,o}(t,r,e));return{slotName:t,slotModuleName:r,components:o}}function uQ(e){let{extensions:t,extensionSlotModuleName:r}=l_(e),n=(0,ls.useMemo)(()=>new Set(e?t.map(e=>e.id):[]),[e,t]),[a,o]=(0,ls.useState)(()=>uX(null,e,r,n)),i=a;return a.slotName===e&&a.slotModuleName===r&&a.components.size===n.size&&[...n].every(e=>a.components.has(e))||o(i=uX(a,e,r,n)),(0,ls.useMemo)(()=>e?t.flatMap(e=>{let t=i.components.get(e.id);return t?[t]:[]}):[],[e,t,i])}function u0(){let e=(0,ls.useRef)(null),[t,r]=(0,ls.useState)(null),n=null;if(!t){if(o){let e=ot().getState();e.loaded&&(n=e.session)}else o=new Promise(t=>{let r=({loaded:r,session:a})=>{r&&(t(a),n=a,e.current&&(e.current(),e.current=null))};r(ot().getState()),n||(e.current=ot().subscribe(r))});if(n)r(n);else throw o}(0,ls.useEffect)(()=>(e.current||(e.current=ot().subscribe(({loaded:e,session:t})=>{e&&(n=t,r(t))})),()=>{e.current&&(e.current(),e.current=null)}),[]);let a=t||n;if(!a)if(o)throw console.warn("useSession is in an unexpected state. Attempting to recover."),o;else throw Error("useSession is in an invalid state.");return a}let u1=({privilege:e,fallback:t,children:r})=>{let[n,a]=(0,ls.useState)(null);return((0,ls.useEffect)(()=>{let e=ot(),t=e.subscribe(({loaded:e,session:t})=>{a(e?t?.user??null:null)}),{loaded:r,session:n}=e.getState();return r&&a(n?.user??null),t},[]),n&&oo(e,n))?(0,lc.jsx)(lc.Fragment,{children:r}):t?(0,lc.jsx)(lc.Fragment,{children:t}):null};var u4=r(4353),u2=r.n(u4),u3=r(7581);let u6=new Map;function u5(){for(let e of Array.from(u6.values()))e()}let u9={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function u8(e){let t=(0,ls.useId)();return(0,ls.useEffect)(()=>{if(e)return u6.set(t,e),()=>{u6.delete(t)}},[t,e]),{...ly(ix(),u9),mutateVisit:u5}}function u7(e,t=iE){let r=(0,ls.useRef)(void 0),{patientUuid:n,manuallySetVisitUuid:a,setVisitContext:o}=u8((0,ls.useCallback)(()=>r.current?.(),[])),i=e&&n==e?a:null,s=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${i}?v=${t}`,{data:u,error:c,mutate:d,isValidating:m}=(0,lW.u)(e?`${a0}/visit${s}`:null,a3),{data:p,error:f,mutate:h,isValidating:g}=(0,lW.u)(e&&i?`${a0}/visit${l}`:null,a3),y=(0,ls.useMemo)(()=>u?.data.results.find(e=>null===e.stopDatetime)??null,[u]),v=(0,ls.useMemo)(()=>i&&p?p.data:null,[p,i]),b=(0,ls.useRef)(null);(0,ls.useEffect)(()=>{!m&&y&&n===e&&null===a&&o(y),g||(b.current&&v&&b.current.uuid===v.uuid&&!b.current.stopDatetime&&v.stopDatetime&&o(null),b.current=v)},[v,a,y,m,g,n]);let w=(0,ls.useCallback)(()=>{d(),h()},[d,h]);(0,ls.useEffect)(()=>{r.current=w},[w]);let E=!!(!u||i&&!p),D=!!(i?f:c);return{error:c||f,mutate:w,isValidating:m||g,activeVisit:y,currentVisit:v,currentVisitIsRetrospective:!!i,isLoading:E&&!D}}u4.extend(u3);let ce=[];function ct(){let{data:e}=um(iy,iv);return e??ce}let cr=new Map;async function cn(e,t){let r=t.indexOf("#"),n=r>=0,a=n?t.substring(0,r):e,o=n?t.substring(r+1):t,i=await oW(a);return i&&Object.hasOwn(i,o)&&"function"==typeof i[o]?co(a,i).then(()=>i[o]()):(i?i&&Object.hasOwn(i,o)?console.warn(`The export ${t}, defined in ${e}'s routes.json, is not a function`):console.warn(`${a} does not define a component called "${o}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${a} for ${t} defined in ${e}'s routes.json`),ca)}let ca={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()};async function co(e,t){if(e in cr)await cr[e];else{let r=t??await oW(e);await (cr[e]=new Promise((t,n)=>{if(Object.hasOwn(r,"startupApp")){let a=r.startupApp;if("function"==typeof a)return Promise.resolve(a()).then(()=>{nq(e),t(null)}).catch(n)}nq(e),t(null)}))}}function ci(e,t){let r=t.name;if(!r)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
18
18
  registered. To fix this, ensure that you define the "name" field inside the
@@ -37,4 +37,4 @@ To fix this, ensure that you define the "component" field inside the page defini
37
37
  * {
38
38
  overscroll-behavior: contain;
39
39
  }
40
- }`.trim(),document.head.prepend(o),s=bj(),l=ml(m0(document,"touchstart",e=>{let r=m2(e);t=gp(r,!0)?r:gf(r,!0),a=!1;let n=r.ownerDocument.defaultView.getSelection();n&&!n.isCollapsed&&n.containsNode(r,!0)&&(a=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(a=!0),"selectionStart"in r&&"selectionEnd"in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(a=!0)},{passive:!1,capture:!0}),m0(document,"touchmove",e=>{if(2!==e.touches.length&&!a){if(!t||t===document.documentElement||t===document.body)return void e.preventDefault();t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},{passive:!1,capture:!0}),bM()),()=>{n(),l(),o.remove(),s()}):(e=r,ml((c=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?m1(document.documentElement,"scrollbar-gutter","stable"):m1(document.documentElement,"padding-right",`${c}px`)),m1(document.documentElement,"overflow","hidden"),e&&bj(),e&&b_()&&bM()))),()=>{0==--bI&&u()}}},[t,r])}({isDisabled:o||!t.isOpen}),(0,ls.useEffect)(()=>{if(t.isOpen&&n.current)if(o){var e,r,i=a?.current??n.current;let t=v1[v1.length-1];return t&&!t.visibleNodes.has(i)?(t.visibleNodes.add(i),()=>{t.visibleNodes.delete(i)}):void 0}else{let t,o,i,s,l,u,c,d,m,p,f;return e=[a?.current??n.current],o=(r={shouldUseInert:!0})instanceof(t=mX(e?.[0])).Element?{root:r}:r,i=o?.root??document.body,s=o?.shouldUseInert&&vQ,l=new Set(e),u=new Set,c=(e,r)=>{s&&e instanceof t.HTMLElement?e.inert=r:r?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof t.HTMLElement&&(e.inert=!1))},d=e=>{for(let t of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(t);let t=e=>{if(u.has(e)||l.has(e)||e.parentElement&&u.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let t of l)if(m4(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},r=yN(mJ(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),n=t(e);if(n===NodeFilter.FILTER_ACCEPT&&m(e),n!==NodeFilter.FILTER_REJECT){let e=r.nextNode();for(;null!=e;)m(e),e=r.nextNode()}},m=e=>{let r=v0.get(e)??0;(s&&e instanceof t.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===r||(0===r&&c(e,!0),u.add(e),v0.set(e,r+1))},v1.length&&v1[v1.length-1].disconnect(),d(i),(p=new MutationObserver(e=>{for(let r of e)if("childList"===r.type&&r.target.isConnected&&![...l,...u].some(e=>m4(e,r.target)))for(let e of r.addedNodes){var t;(e instanceof HTMLElement||e instanceof SVGElement)&&("true"===(t=e).dataset.liveAnnouncer||void 0!==t.dataset.reactAriaTopLayer)?l.add(e):e instanceof Element&&d(e)}})).observe(i,{childList:!0,subtree:!0}),f={visibleNodes:l,hiddenNodes:u,observe(){p.observe(i,{childList:!0,subtree:!0})},disconnect(){p.disconnect()}},v1.push(f),()=>{for(let e of(p.disconnect(),u)){let t=v0.get(e);null!=t&&(1===t?(c(e,!1),v0.delete(e)):v0.set(e,t-1))}f===v1[v1.length-1]?(v1.pop(),v1.length&&v1[v1.length-1].observe()):v1.splice(v1.indexOf(f),1)}}},[o,t.isOpen,n,a]);let{focusWithinProps:y}=fE(e);return{popoverProps:mk(d,p,y),arrowProps:f,underlayProps:m,placement:h,triggerAnchorPoint:g}}({...a,offset:a.offset??8,arrowRef:o,groupRef:l?s:i},e),y=a.popoverRef,v=bB(y,!!h&&c),b=a.isEntering||!a.shouldSkipAnimation&&v||!1,w=mO({...a,defaultClassName:"react-aria-Popover",values:{trigger:a.trigger||null,placement:h,isEntering:b,isExiting:t}}),E=!a.isNonModal||"SubmenuTrigger"===a.trigger||"PreviewTrigger"===a.trigger,[D,x]=(0,ls.useState)("PreviewTrigger"===a.trigger);mu(()=>{y.current&&x(E&&!y.current.querySelector("[role=dialog]"))},[y,E]),(0,ls.useEffect)(()=>{D&&"PreviewTrigger"!==a.trigger&&("SubmenuTrigger"!==a.trigger||"pointer"!==pE)&&y.current&&!m6(y.current)&&pK(y.current)},[D,y,a.trigger]);let _=(0,ls.useMemo)(()=>{let e=w.children;for(let t of[bW,...n??[]])e=ll().createElement(t.Provider,{value:null},e);return e},[w.children,n]),[S,C]=(0,ls.useState)(null),k=(0,ls.useCallback)(()=>{a.triggerRef.current&&C(a.triggerRef.current.getBoundingClientRect().width+"px")},[a.triggerRef]);mu(k,[k]),bd({ref:w.style?.["--trigger-width"]?void 0:a.triggerRef,onResize:k});let P={...m.style,"--trigger-anchor-point":g?`${g.x}px ${g.y}px`:void 0,...w.style,"--trigger-width":w.style?.["--trigger-width"]||S};mu(()=>b$(()=>d(!0)),[]);let R=ll().createElement(mL.div,{...mk(mY(a,{global:!0}),m),...w,id:D?a.id:void 0,role:D?"dialog":void 0,tabIndex:D?-1:void 0,"aria-label":a["aria-label"],"aria-labelledby":a["aria-labelledby"],ref:y,slot:a.slot||void 0,style:P,dir:a.dir,"data-trigger":a.trigger,"data-placement":h,"data-entering":b||void 0,"data-exiting":t||void 0},!a.isNonModal&&ll().createElement(bL,{onDismiss:e.close}),ll().createElement(vX.Provider,{value:{...f,placement:h,ref:o}},_),ll().createElement(bL,{onDismiss:e.close}));return l?ll().createElement(vF,{...a,shouldContainFocus:D&&"PreviewTrigger"!==a.trigger,isExiting:t,portalContainer:r??s?.current??void 0},R):ll().createElement(vF,{...a,shouldContainFocus:D&&"PreviewTrigger"!==a.trigger,isExiting:t,portalContainer:r},!a.isNonModal&&e.isOpen&&ll().createElement("div",{"data-testid":"underlay",...p,style:{position:"fixed",inset:0}}),ll().createElement("div",{ref:i,style:{display:"contents"}},ll().createElement(bH.Provider,{value:i},R)))}function bG(e){return e?.start!=null&&null!=e.end}let bZ=(0,ls.createContext)(null),bY=(0,ls.createContext)(null),bq=(0,ls.createContext)(null),bJ=(0,ls.createContext)(null),bX=[yR,fP,vq,f$],bQ=(0,ls.forwardRef)(function(e,t){[e,t]=mN(e,t,bZ);let{validationBehavior:r}=m$(vK)||{},n=e.validationBehavior??r??"native",a=function(e){let t=bF(e),[r,n]=yl(e.value,e.defaultValue||null,e.onChange),[a]=(0,ls.useState)(r),o=r||e.placeholderValue||null,[i,s]=vb(o,e.granularity),l=null!=r?r.toDate(s??"UTC"):null,u="hour"===i||"minute"===i||"second"===i,c=e.shouldCloseOnSelect??!0,[d,m]=(0,ls.useState)(null),[p,f]=(0,ls.useState)(null);if(r&&(d=r,"hour"in r&&(p=r)),o&&!(i in o))throw Error("Invalid granularity "+i+" for value "+o.toString());let h=r?.calendar.identifier==="gregory"&&"BC"===r.era,g=(0,ls.useMemo)(()=>({granularity:i,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:h}),[i,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,h]),{minValue:y,maxValue:v,isDateUnavailable:b}=e,w=(0,ls.useMemo)(()=>vp(r,y,v,b,g),[r,y,v,b,g]),E=vi({...e,value:r,builtinValidation:w}),D=E.displayValidation.isInvalid,x=e.validationState||(D?"invalid":null),_=(e,t)=>{n("timeZone"in t?t.set(hK(e)):hG(e,t)),m(null),f(null),E.commitValidation()};return{...E,value:r,defaultValue:e.defaultValue??a,setValue:n,dateValue:d,timeValue:p,setDateValue:r=>{let a="function"==typeof c?c():c;u?p||a?_(r,p||vy(e.defaultValue||e.placeholderValue)):m(r):(n(r),E.commitValidation()),a&&t.setOpen(!1)},setTimeValue:e=>{d&&e?_(d,e):f(e)},granularity:i,hasTime:u,...t,setOpen(n){!n&&!r&&d&&u&&_(d,p||vy(e.defaultValue||e.placeholderValue)),t.setOpen(n)},validationState:x,isInvalid:D,formatValue:(e,t)=>l?new fJ(e,vg(t,g)).format(l):"",getDateFormatter:(e,t)=>new fJ(e,vg({},{...g,...t}))}}({...e,validationBehavior:n}),o=(0,ls.useRef)(null),[i,s]=mI(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:l,labelProps:u,fieldProps:c,buttonProps:d,dialogProps:m,calendarProps:p,descriptionProps:f,errorMessageProps:h,...g}=function(e,t,r){var n;let a=mD(),o=mD(),i=mD(),s=hr((n=y0)&&n.__esModule?n.default:n,"@react-aria/datepicker"),{isInvalid:l,validationErrors:u,validationDetails:c}=t.displayValidation,{labelProps:d,fieldProps:m,descriptionProps:p,errorMessageProps:f}=y2({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||u}),h=y1(t,r),g=m["aria-labelledby"]||m.id,{locale:y}=fY(),v=t.formatValue(y,{month:"long"}),b=gw(v?s.format("selectedDateDescription",{date:v}):""),w=[b["aria-describedby"],m["aria-describedby"]].filter(Boolean).join(" ")||void 0,E=mY(e),D=(0,ls.useMemo)(()=>yY(r),[r]),x=(0,ls.useRef)(!1),{focusWithinProps:_}=fE({...e,isDisabled:t.isOpen,onBlurWithin:t=>{m4(document.getElementById(o),t.relatedTarget)||(x.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{x.current||(x.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}});return{groupProps:mk(E,h,m,b,_,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":g,"aria-describedby":w,onKeyDown(r){!t.isOpen&&e.onKeyDown&&e.onKeyDown(r)},onKeyUp(r){!t.isOpen&&e.onKeyUp&&e.onKeyUp(r)}}),labelProps:{...d,onClick:()=>{D.focusFirst()}},fieldProps:{...m,id:i,[y9]:"presentation","aria-describedby":w,value:t.value,defaultValue:t.defaultValue,onChange:t.setValue,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,granularity:e.granularity,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior,[vo]:t,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:p,errorMessageProps:f,buttonProps:{...b,id:a,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${a} ${g}`,"aria-describedby":w,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:o,"aria-labelledby":`${a} ${g}`},calendarProps:{autoFocus:!0,value:t.dateValue,onChange:t.setDateValue,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,defaultFocusedValue:t.dateValue?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:l,validationErrors:u,validationDetails:c}}({...mM(e),label:s,validationBehavior:n},a,o),{focusProps:y,isFocused:v,isFocusVisible:b}=fD({within:!0}),w=mO({...e,values:{state:a,isFocusWithin:v,isFocusVisible:b,isDisabled:e.isDisabled||!1,isInvalid:a.isInvalid,isOpen:a.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-DatePicker"}),E=mY(e,{global:!0});return delete E.id,ll().createElement(mT,{values:[[bq,a],[yR,{...l,ref:o,isInvalid:a.isInvalid}],[vR,c],[fP,{...d,isPressed:a.isOpen}],[vq,{...u,ref:i,elementType:"span"}],[yy,p],[vV,a],[bW,{trigger:"DatePicker",triggerRef:o,placement:"bottom start",clearContexts:bX}],[vB,m],[f$,{slots:{description:f,errorMessage:h}}],[vW,g]]},ll().createElement(mL.div,{...mk(E,w,y),ref:t,slot:e.slot||void 0,"data-focus-within":v||void 0,"data-invalid":a.isInvalid||void 0,"data-focus-visible":b||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":a.isOpen||void 0}),ll().createElement(vY,{autoComplete:e.autoComplete,name:e.name,isDisabled:e.isDisabled,state:a}))}),b0=(0,ls.forwardRef)(function(e,t){[e,t]=mN(e,t,bY);let{validationBehavior:r}=m$(vK)||{},n=e.validationBehavior??r??"native",a=function(e){let t=bF(e),[r,n]=yl(e.value,e.defaultValue||null,e.onChange),[a]=(0,ls.useState)(r),[o,i]=(0,ls.useState)(()=>r||{start:null,end:null});null==r&&o.start&&o.end&&i(o={start:null,end:null});let s=r||o,l=e=>{i(s=e||{start:null,end:null}),bG(s)?n(s):n(null)},[u,c]=vb(s?.start||s?.end||e.placeholderValue||null,e.granularity),d="hour"===u||"minute"===u||"second"===u,m=e.shouldCloseOnSelect??!0,[p,f]=(0,ls.useState)(null),[h,g]=(0,ls.useState)(null);s&&bG(s)&&(p=s,"hour"in s.start&&(h=s));let y=(e,t)=>{l({start:"timeZone"in t.start?t.start.set(hK(e.start)):hG(e.start,t.start),end:"timeZone"in t.end?t.end.set(hK(e.end)):hG(e.end,t.end)}),f(null),g(null),C.commitValidation()},v=r=>{let n="function"==typeof m?m():m;d?bG(r)&&(n||h?.start&&h?.end)?y(r,{start:h?.start||vy(e.placeholderValue),end:h?.end||vy(e.placeholderValue)}):f(r):bG(r)?(l(r),C.commitValidation()):f(r),n&&t.setOpen(!1)},b=e=>{bG(p)&&bG(e)?y(p,e):g(e)},w=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,E=(0,ls.useMemo)(()=>({granularity:u,timeZone:c,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:w}),[u,e.hourCycle,e.shouldForceLeadingZeros,c,e.hideTimeZone,w]),{minValue:D,maxValue:x,isDateUnavailable:_}=e,S=(0,ls.useMemo)(()=>{var e,t;let r;return e=s,t=_?e=>_(e,null):void 0,r=vc(vp(e?.start??null,D,x,t,E),vp(e?.end??null,D,x,t,E)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(r=vc(r,{isInvalid:!0,validationErrors:[(f5.getGlobalDictionaryForPackage("@react-stately/datepicker")||vd).getStringForLocale("rangeReversed",vm())],validationDetails:{...vt,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),r},[s,D,x,_,E]),C=vi({...e,value:r,name:(0,ls.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:S}),k=C.displayValidation.isInvalid,P=e.validationState||(k?"invalid":null);return{...C,value:s,defaultValue:e.defaultValue??a,setValue:l,dateRange:p,timeRange:h,granularity:u,hasTime:d,setDate(e,t){"start"===e?v({start:t,end:p?.end??null}):v({start:p?.start??null,end:t})},setTime(e,t){"start"===e?b({start:t,end:h?.end??null}):b({start:h?.start??null,end:t})},setDateTime(e,t){"start"===e?l({start:t,end:s?.end??null}):l({start:s?.start??null,end:t})},setDateRange:v,setTimeRange:b,...t,setOpen(r){!r&&!(s?.start&&s?.end)&&bG(p)&&d&&y(p,{start:h?.start||vy(e.placeholderValue),end:h?.end||vy(e.placeholderValue)}),t.setOpen(r)},validationState:P,isInvalid:k,formatValue(t,r){let n;if(!s||!s.start||!s.end)return null;let a="timeZone"in s.start?s.start.timeZone:void 0,o=e.granularity||(s.start&&"minute"in s.start?"minute":"day"),i="timeZone"in s.end?s.end.timeZone:void 0,l=e.granularity||(s.end&&"minute"in s.end?"minute":"day"),u=vg(r,{granularity:o,timeZone:a,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:"gregory"===s.start.calendar.identifier&&"BC"===s.start.era||"gregory"===s.end.calendar.identifier&&"BC"===s.end.era}),c=s.start.toDate(a||"UTC"),d=s.end.toDate(i||"UTC"),m=new fJ(t,u);if(a===i&&o===l&&0!==s.start.compare(s.end)){try{let e=m.formatRangeToParts(c,d),t=-1;for(let r=0;r<e.length;r++){let n=e[r];if("shared"===n.source&&"literal"===n.type)t=r;else if("endRange"===n.source)break}let r="",n="";for(let a=0;a<e.length;a++)a<t?r+=e[a].value:a>t&&(n+=e[a].value);return{start:r,end:n}}catch{}n=m}else n=new fJ(t,vg(r,{granularity:l,timeZone:i,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:m.format(c),end:n.format(d)}},getDateFormatter:(e,t)=>new fJ(e,vg({},{...E,...t}))}}({...e,validationBehavior:n}),o=(0,ls.useRef)(null),[i,s]=mI(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:l,labelProps:u,startFieldProps:c,endFieldProps:d,buttonProps:m,dialogProps:p,calendarProps:f,descriptionProps:h,errorMessageProps:g,...y}=function(e,t,r){var n;let a=hr((n=y0)&&n.__esModule?n.default:n,"@react-aria/datepicker"),{isInvalid:o,validationErrors:i,validationDetails:s}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:c,errorMessageProps:d}=y2({...e,labelElementType:"span",isInvalid:o,errorMessage:e.errorMessage||i}),m=u["aria-labelledby"]||u.id,{locale:p}=fY(),f=t.formatValue(p,{month:"long"}),h=gw(f?a.format("selectedRangeDescription",{startDate:f.start,endDate:f.end}):""),g={"aria-label":a.format("startDate"),"aria-labelledby":m},y={"aria-label":a.format("endDate"),"aria-labelledby":m},v=mD(),b=mD(),w=y1(t,r),E=[h["aria-describedby"],u["aria-describedby"]].filter(Boolean).join(" ")||void 0,D=(0,ls.useMemo)(()=>yY(r,{accept:e=>e.id!==v}),[r,v]),x={[y8]:D,[y9]:"presentation","aria-describedby":E,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},_=mY(e),S=(0,ls.useRef)(!1),{focusWithinProps:C}=fE({...e,isDisabled:t.isOpen,onBlurWithin:t=>{m4(document.getElementById(b),t.relatedTarget)||(S.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{S.current||(S.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,ls.useRef)(vn),P=(0,ls.useRef)(vn);return{groupProps:mk(_,w,u,h,C,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":E,onKeyDown(r){!t.isOpen&&e.onKeyDown&&e.onKeyDown(r)},onKeyUp(r){!t.isOpen&&e.onKeyUp&&e.onKeyUp(r)}}),labelProps:{...l,onClick:()=>{D.focusFirst()}},buttonProps:{...h,id:v,"aria-haspopup":"dialog","aria-label":a.format("calendar"),"aria-labelledby":`${v} ${m}`,"aria-describedby":E,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${v} ${m}`},startFieldProps:{...g,...x,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[vo]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(vc(e,P.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...y,...x,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime("end",e),name:e.endName,form:e.form,[vo]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){P.current=e,t.updateValidation(vc(k.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:c,errorMessageProps:d,calendarProps:{autoFocus:!0,value:t.dateRange?.start&&t.dateRange.end?t.dateRange:null,onChange:t.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:t.dateRange?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:o,validationErrors:i,validationDetails:s}}({...mM(e),label:s,validationBehavior:n},a,o),{focusProps:v,isFocused:b,isFocusVisible:w}=fD({within:!0}),E=mO({...e,values:{state:a,isFocusWithin:b,isFocusVisible:w,isDisabled:e.isDisabled||!1,isInvalid:a.isInvalid,isOpen:a.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-DateRangePicker"}),D=mY(e,{global:!0});return delete D.id,ll().createElement(mT,{values:[[bJ,a],[yR,{...l,ref:o,isInvalid:a.isInvalid}],[fP,{...m,isPressed:a.isOpen}],[vq,{...u,ref:i,elementType:"span"}],[yv,f],[vV,a],[bW,{trigger:"DateRangePicker",triggerRef:o,placement:"bottom start",clearContexts:bX}],[vB,p],[vR,{slots:{start:c,end:d}}],[f$,{slots:{description:h,errorMessage:g}}],[vW,y]]},ll().createElement(mL.div,{...mk(D,E,v),ref:t,slot:e.slot||void 0,"data-focus-within":b||void 0,"data-invalid":a.isInvalid||void 0,"data-focus-visible":w||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":a.isOpen||void 0}))});function b1(e){return ll().createElement(fZ,e)}function b4(e,t,r=!1){if(null==e)return r?e:void 0;if("string"==typeof e&&!e)return r?null:void 0;if(e instanceof hI||e instanceof hj||e instanceof hA)return t?hZ(e,t):e;{let r=u2()(e).toDate(),n=new hI(r.getFullYear(),r.getMonth()+1,r.getDate());return t?hZ(n,t):n}}function b2(e){if(e)return e.toDate(h9())}function b3(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function b6(e){let t=e??"",r=b3(t);if(!r)return t;try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??t}catch{return t}}function b5(){let e=window.i18next.language,t=b3(e)??e;return"ht"===t&&(t="fr-HT"),t}if("u">typeof navigator){let e=navigator;en=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;en=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var b9=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch{return"en-US"}}(en||"en-US"),b8=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},b7={};for(let e=0;e<100;e++)b7[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var we={arab:1632,arabext:1776,bali:6992,beng:2534,deva:2406,fullwide:65296,gujr:2790,khmr:6112,knda:3302,laoo:3792,limb:6470,mlym:3430,mong:6160,mymr:4160,orya:2918,tamldec:3046,telu:3174,thai:3664,tibt:3872},wt="[1234567890一二三四五六七八九〇\\d]",wr={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,〇:0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9},wn={},wa={"Eastern Daylight Time":-240,"Eastern Standard Time":-300,"Central Daylight Time":-300,"Central Standard Time":-360,"Mountain Daylight Time":-360,"Mountain Standard Time":-420,"Pacific Daylight Time":-420,"Pacific Standard Time":-480,"Coordinated Universal Time":0,ACDT:630,ACST:570,ACT:480,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,AMST:-180,AMT:-240,ART:-180,AST:180,AWDT:540,AWST:480,AZOST:-60,AZT:240,BDT:360,BIOT:360,BIT:-720,BOT:-240,BRST:-120,BRT:-180,BTT:360,CAT:120,CCT:390,CDT:-300,CEDT:120,CEST:120,CET:60,CHADT:825,CHAST:765,CHOT:480,ChST:600,CHUT:600,CIST:-480,CIT:480,CKT:-600,CLST:-180,CLT:-240,COST:-240,COT:-300,CST:-360,CT:480,CVT:-60,CXT:420,DAVT:420,DDUT:600,DFT:60,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEDT:180,EEST:180,EET:120,EGST:0,EGT:-60,EIT:540,EST:-300,FET:180,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GIT:-540,GMT:0,GST:-120,GYT:-240,HADT:-540,HAEC:120,HAST:-600,HKT:480,HMT:300,HOVT:420,HST:-600,IBST:0,ICT:420,IDT:180,IOT:180,IRDT:270,IRKT:480,IRST:210,IST:120,JST:540,KGT:360,KOST:660,KRAT:420,KST:540,LHST:630,LINT:840,MAGT:720,MART:-510,MAWT:300,MDT:-360,MET:60,MEST:120,MHT:720,MIST:660,MIT:-510,MMT:390,MSK:180,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:660,NPT:345,NST:-150,NT:-150,NUT:-660,NZDT:780,NZST:720,OMST:360,ORAT:300,PDT:-420,PET:-300,PETT:720,PGT:600,PHOT:780,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PYST:-180,PYT:-240,RET:240,ROTT:-180,SAKT:660,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SLST:330,SRET:660,SRT:-180,SST:480,SYOT:180,TAHT:-600,THA:420,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TOT:780,TVT:720,UCT:0,ULAT:480,USZ1:120,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-240,VLAT:600,VOLT:240,VOST:360,VUT:660,WAKT:720,WAST:120,WAT:60,WEDT:60,WEST:60,WET:0,WIT:420,WST:480,YAKT:540,YEKT:300},wo={zone:wa,year:b7,meridiem:{am:0,pm:12,"a.m.":0,"p.m.":12},month:{january:1,jan:1,february:2,feb:2,march:3,mar:3,april:4,apr:4,may:5,june:6,jun:6,july:7,jul:7,august:8,aug:8,september:9,sep:9,october:10,oct:10,november:11,nov:11,december:12,dec:12},dayname:{sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,wednesday:3,wed:3,thursday:4,thu:4,friday:5,fri:5,saturday:6,sat:6},digit:{}},wi={MONTHNAME:"january|february|march|april|may|june|july|august|september|october|november|december|jan\\.?|feb\\.?|mar\\.?|apr\\.?|may\\.?|jun\\.?|jul\\.?|aug\\.?|sep\\.?|oct\\.?|nov\\.?|dec\\.?",DAYNAME:"sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun\\.?|mon\\.?|tue\\.?|wed\\.?|thu\\.?|fri\\.?|sat\\.?",ZONE:`\\(?(?:${Object.keys(wa).join("|")})\\)?`,MERIDIEM:"am|pm|a.m.|p.m.",ORDINAL:"st|nd|rd|th|\\.",YEAR:"\\d{4}|\\d{2}",YEAR2:"\\d{2}",YEAR4:"\\d{4}",YEAR6:"-\\d{6}|\\+?\\d{5,6}",MONTH:"1[0-2]|0?[1-9]",MONTH2:"1[0-2]|0[1-9]",DAY:"3[01]|[12]\\d|0?[1-9]",DAY2:"3[01]|[12]\\d|0[1-9]",OFFSET:"(?:GMT)?[\xb1−+-](?:[01]\\d[0-5]\\d|[01]\\d:[0-5]\\d|[01]?\\d)",H24:"[01]\\d|2[0-3]",H12:"0?[1-9]|1[012]",MIN:"[0-5]\\d",SEC:"[0-5]\\d|60",MS:"\\d{9}|\\d{6}|\\d{1,3}",GAP:"[\\s/.,-]{1,}"},ws={...wi,YEAR:"*{4}|*{2}",YEAR4:"*{4}",YEAR6:"-*{6}|\\+?*{5,6}",MONTH:"*{1,2}",MONTH2:"*{2}",DAY:"*{1,2}",DAY2:"*{2}",OFFSET:"(?:GMT)?[\xb1−+-](?:*{4}|*{2}:*{2}|*{1,2})",H24:"*{2}",H12:"*{1,2}",MIN:"*{2}",SEC:"*{2}",MS:"*{9}|*{6}|*{3}"},wl={},wu=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(t=b9){let r=t.toLowerCase(),n=wl[r];if(n)return n;let a=new e(t);return wl[r]=a,a}constructor(e=b9){this.locale=e,this.lookups={...wo},this.vars={...wi};const t=new Intl.NumberFormat(this.locale);this.numberingSystem=t.resolvedOptions().numberingSystem,this.dateOptions=new Intl.DateTimeFormat(this.locale).resolvedOptions(),this.baseName=new Intl.Locale(this.locale).baseName,this.build()}toInt(e){return"number"==typeof e?e:"string"==typeof e?this.stringToInt(e):void 0}stringToInt(e){if("latn"===this.numberingSystem&&!this.baseName.startsWith("zh")){let t=parseInt(e,10);if(!Number.isNaN(t))return t}let t="";for(let r=0;r<e.length;r++)t+=String(this.lookups.digit[e[r]]);return parseInt(t,10)}millisecondToInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;let t=e.slice(0,3);return 1===t.length?100*this.stringToInt(t):2===t.length?10*this.stringToInt(t):this.stringToInt(t)}monthNameToInt(e){if("string"!=typeof e)return;let t=e.toLocaleLowerCase(this.locale).replace(/\.$/,"");return this.lookups.month[t]||12}h12ToInt(e,t){if("string"!=typeof e)return;let r=this.lookups.meridiem[t?.toLowerCase()]||0,n=this.stringToInt(e);return n<12&&12===r&&(n+=12),12===n&&0===r&&(n=0),n}zoneToOffset(e){if("string"==typeof e)return e=e.replace(/[^a-z\s]/gi,""),this.lookups.zone[e]}offsetToMinutes(e){if("string"!=typeof e)return;let t=e.match(/^(?:GMT)?([±−+-])(..?):?(..)?$/);if(t){let[,e,r,n]=t;return("-"===e||"−"===e?-1:1)*(60*this.stringToInt(r)+(n?this.stringToInt(n):0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=wr:this.buildNumbers(),!/^en/i.test(this.locale)&&(this.buildMonthNames(),this.buildDaynames(),/zh/i.test(this.locale)||this.buildMeridiems())}buildNumbers(){let{group:e,lookup:t}=function(e){let t=wn[e];if(t)return t;if("fullwide"===e||"hanidec"===e)return{group:wt,lookup:{...wr}};let r=we[e];if(!r)return{group:"\\d",lookup:{...wr}};let n=String.fromCharCode(r),a=String.fromCharCode(r+9),o={};for(let e=0;e<10;e++)o[String.fromCharCode(r+e)]=e;return wn[e]={group:`[${n}-${a}]`,lookup:o},wn[e]}(this.numberingSystem);for(let r in this.lookups.digit=t,ws)Object.hasOwn(ws,r)&&(this.vars[r]=ws[r].replace(/\*/g,e))}buildMonthNames(){let e={},t={};if(/^fi/i.test(this.locale))"tammi|helmi|maalis|huhti|touko|kes\xe4|hein\xe4|elo|syys|loka|marras|joulu".split("|").forEach((r,n)=>{["","k","kuu","kuuta"].forEach((a,o)=>{e[r+a+(o<2?"\\.?":"")]=!0,t[r+a]=n+1})});else{let r=[],n=e=>"month"===e.type;for(let e=0;e<12;e++)r.push(new Date(2017,e,1));for(let a of["full","long","medium"]){let o=Intl.DateTimeFormat(this.locale,{dateStyle:a});for(let i=0;i<12;i++){let s=o.formatToParts(r[i]).find(n);if(!s)continue;let l=s.value.toLocaleLowerCase(this.locale);/^\d+$/.test(l)||(/^ko/i.test(this.locale)&&(l+="월"),"medium"===a?(l=l.replace(/\.$/,""),e[`${l}\\.?`]=!0):e[l]=!0,t[l]=i+1)}}let a=Intl.DateTimeFormat(this.locale,{month:"short"});for(let o=0;o<12;o++){let i=a.formatToParts(r[o]).find(n);if(!i)continue;let s=i.value.toLocaleLowerCase(this.locale);s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0,t[s]=o+1}}this.vars.MONTHNAME=Object.keys(e).join("|"),this.lookups.month=t}buildDaynames(){let e=[],t=e=>"weekday"===e.type;for(let t=0;t<7;t++)e.push(new Date(2017,0,t+1));let r=[],n={};for(let a of["long","short"]){let o=Intl.DateTimeFormat(this.locale,{weekday:a});for(let i=0;i<7;i++){let s=o.formatToParts(e[i]).find(t);if(!s)continue;let l=s.value.toLocaleLowerCase(this.locale);"short"===a?(l=l.replace(/\.$/,""),r.push(`${l}\\.?`)):r.push(l),n[l]=i}}this.vars.DAYNAME=r.join("|"),this.lookups.dayname=n}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],t=e=>"dayPeriod"===e.type,r=[],n={},a=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let o=0;o<2;o++){let i=a.formatToParts(e[o]).find(t);if(!i)return;let s=i.value.toLocaleLowerCase(this.locale);r.push(s),n[s]=12*o}this.vars.MERIDIEM=r.join("|"),this.lookups.meridiem=n}compile(e){return RegExp(e.replace(/_([A-Z0-9]+)_/g,(e,t)=>{if(!this.vars[t])throw Error(`Template string contains invalid variable _${t}_`);return this.vars[t]}),"i")}},wc=["ee-TG","en-AS","en-CA","en-FM","en-GH","en-GU","en-KE","en-KY","en-MH","en-MP","en-US","en-VI","en-WS","jp-JP","sm-AS","sm-SM"],wd={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},wm=()=>new Date;function wp(e){return function(t){let r={};for(let n=0,a=e.length;n<a;n++){let a=e[n];a&&(r[a]=t[n])}return r}}var wf=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:t,patterns:r,formatter:n}){this.doneChecker=e,this.fallback=t,this.patterns=r,this.formatter=n}attempt(e){if("string"!=typeof e)return this.fallback(e);let t=e.trim(),r={},n=!1;for(let e of this.patterns){let a=t.match(e.regex);if(!a)continue;n=!0;let o=e.handler(a);if(o){for(let[e,t]of Object.entries(o))e in r||void 0===t||(r[e]=t);let e=a.index??0;if(t=(t=t.slice(0,e)+t.slice(e+a[0].length+1)).trim(),this.doneChecker(r,t))break}}return n?this.formatter(r):this.fallback(e)}},wh=["year","month","day","hour","minute","second","millisecond","offset"],wg={};function wy(e,t){return""===t||/^\s+$/.test(t)||"year"in e&&("month"in e||"monthname"in e)&&"day"in e&&"hour"in e&&"minute"in e&&"second"in e&&"millisecond"in e&&("zone"in e||"offset"in e)}var wv=[[/([^\d.]+)(\d{1,2})\.(\d{2})\.(\d{2})(\D|$)/,"$1$2:$3:$4$5"],[/([^\d.]+)(\d{1,2})\.(\d{2})(\D|$)/,"$1$2:$3$4"]],wb={ar:[[/ /g," "]],bn:[[/,/g,""]],zh:[[/早上\s*([\d:]+)/,"$1am"],[/凌晨\s*([\d:]+)/,"$1am"],[/上午\s*([\d:]+)/,"$1am"],[/下午\s*([\d:]+)/,"$1pm"],[/晚上\s*([\d:]+)/,"$1pm"]],he:[[/ב/gi,""]],de:[[/ um /g," "]],pt:[[/\sde /gi," "]],es:[[/\sde /gi," "]],da:[[/\sden /gi," "],...wv],ru:[[/ г\./g,""]],th:[[/\s*นาฬิกา\s*/i,":"],[/\s*นาที\s*/i,":"],[/\s*วินาที\s*/i," "]],ko:[[/\s*시\s*/,":"],[/\s*분\s*/,":"],[/\s*초\s*/,""],[/(오전|오후)\s*([\d:]+)/,"$2$1"],[/(\d{4})\. (\d{1,2})\. (\d{1,2})\./,"$1-$2-$3"]],fi:wv,id:wv,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function ww(e,t=b9){let r=function(e){var t,r;let n,a,o=wg[e];if(o)return o;let i=wu.factory(e),s=new wf({doneChecker:wy,fallback:(t=e,function(e){let r=String(e).slice(0,50);return""===r&&(r="(empty string)"),{invalid:`Unable to parse "${r}" with locale "${t}"`}}),patterns:(n=[{name:"timestampWithOffset",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:wp(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:wp(["","year","month","day","hour","minute","second","millisecond","zone"])},{name:"timestampWithOffsetAndZone",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? (_OFFSET_|Z)\\s*(_ZONE_)$"),handler:wp(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:i.compile(`^(${wt}{2,4})\\s*\u5E74\\s*(${wt}{1,2})\\s*\u6708\\s*(${wt}{1,2})\\s*\u65E5$`),handler:wp(["","year","month","day"])},{name:"korean",regex:i.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:wp(["","year","month","day"])},{name:"twitter",regex:/^(?:sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) (\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4}) (\d{4})$/i,handler:wp(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/\b(now|today|tomorrow|yesterday)\b/i,handler:e=>{let t=wm(),r=e[0].toLowerCase(),n={now:0,today:0,tomorrow:864e5,yesterday:-864e5}[r]??0;0!==n&&t.setTime(t.getTime()+n);let a={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()};return"now"===r?{...a,hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()}:a}},{name:"ago",regex:/^(\+|-|in|) ?([\d.]+) ?(years?|months?|weeks?|days?|hours?|minutes?|seconds?|milliseconds?|ms|s|m|h|w|d|M|y)( ago)?$/i,handler:([,e,t,r,n])=>{let a,o=parseFloat(t);"week"===(a=r.length<=2?wd[r]:(a=r.replace(/s$/,"")).toLowerCase())&&(a="day",o*=7),("-"===e||n)&&(o*=-1);let i=wm();return"millisecond"===a?i.setUTCMilliseconds(i.getUTCMilliseconds()+o):"second"===a?i.setUTCSeconds(i.getUTCSeconds()+o):"minute"===a?i.setUTCMinutes(i.getUTCMinutes()+o):"hour"===a?i.setUTCHours(i.getUTCHours()+o):"day"===a?i.setUTCDate(i.getUTCDate()+o):"month"===a?i.setUTCMonth(i.getUTCMonth()+o):"year"===a&&i.setUTCFullYear(i.getUTCFullYear()+o),{year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate(),hour:i.getUTCHours(),minute:i.getUTCMinutes(),second:i.getUTCSeconds(),millisecond:i.getUTCMilliseconds()}}},{name:"atSeconds",regex:/^@(\d+)$/,handler:e=>{let t=new Date(1e3*parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}},{name:"microsoftJson",regex:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:e=>{let t=new Date(parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds(),offset:e[2]}}},{name:"full24",regex:i.compile("(?:^|[\\sT])(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?(Z)?$"),handler:wp(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:i.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:wp(["","hour","minute","second","millisecond","zone"])},{name:"hms12WithOffset",regex:i.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)\\s*(_OFFSET_)"),handler:wp(["","hour","minute","second","meridiem","offset"])},{name:"hms12",regex:i.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:wp(["","hour","minute","second","meridiem"])},{name:"hms24",regex:i.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:wp(["","hour","minute","second","millisecond"])},{name:"hm12",regex:i.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:wp(["","hour","minute","meridiem"])},{name:"hm24",regex:i.compile("(_H24_):(_MIN_)"),handler:wp(["","hour","minute"])},{name:"h12",regex:i.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:wp(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:wp(["","year","month","day"])},{name:"yearMonthnameDay",regex:i.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:wp(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:i.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:wp(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:i.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:wp(["","monthname","day","","year"])},{name:"dayMonthname",regex:i.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:wp(["","day","","monthname"])},{name:"monthnameDay",regex:i.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:wp(["","monthname","day"])},{name:"hmsNoMeridiem",regex:i.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:wp(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:i.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:wp(["","hour","minute"])},{name:"ymd",regex:i.compile("(_YEAR4_)([./-])(_MONTH_)\\2+(_DAY_)"),handler:wp(["","year","","month","day"])},{name:"mdy",regex:i.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:wp(["","month","","day","year"])},{name:"dmy",regex:i.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:wp(["","day","month","year"])},{name:"yearLoose",regex:i.compile("_YEAR4_"),handler:wp(["year"])},{name:"dayMonthnameLoose",regex:i.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:wp(["","day","monthname"])},{name:"monthnameDayLoose",regex:i.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:wp(["","monthname","day"])},{name:"monthname",regex:i.compile("_MONTHNAME_"),handler:wp(["monthname"])},{name:"year4",regex:i.compile("_YEAR4_"),handler:wp(["year"])},{name:"md",regex:i.compile("(_MONTH_)[/-](_DAY_)"),handler:wp(["","month","day"])},{name:"dm",regex:i.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:wp(["","day","month"])},{name:"day",regex:i.compile("_DAY_"),handler:wp(["day"])},{name:"year2",regex:i.compile("_YEAR2_"),handler:wp(["year"])},{name:"onlyZone",regex:i.compile("_ZONE_"),handler:wp(["zone"])},{name:"onlyOffset",regex:i.compile("_OFFSET_"),handler:wp(["offset"])}],a=i.baseName.slice(0,5),wc.includes(a)?n:n.filter(e=>!["mdy","md"].includes(e.name))),formatter:(r=i,function(e){let t={};for(let[n,a]of Object.entries(e))if("monthname"===n){if(a){let e=r.monthNameToInt(a);void 0!==e&&(t.month=e)}}else if("hour"===n&&e.meridiem){let n=r.h12ToInt(a,e.meridiem);void 0!==n&&(t.hour=n)}else if("zone"===n){if(a){let e=r.zoneToOffset(a);void 0!==e&&(t.offset=e)}}else if("offset"===n){let e=r.offsetToMinutes(a);void 0!==e&&(t.offset=e)}else if("millisecond"===n){let e=r.millisecondToInt(a);"number"==typeof e&&(t.millisecond=e)}else if(wh.includes(n)){let e=r.toInt(a);"number"==typeof e&&(t[n]=e)}return void 0!==t.year&&t.year<100&&(t.year=b7[String(e.year)]),t.year&&"buddhist"===r.dateOptions.calendar&&(t.year-=543),t})});return wg[e]=s,s}(t),n=function(e,t){let r=wb[t.slice(0,2).toLowerCase()];if(!r)return e;for(let[t,n]of r)e=e.replace(t,n);return e}(e,t);return r.attempt(n)}function wE(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let t=new b8(e.year??NaN,(e.month??NaN)-1,e.day,e.hour||0,e.minute||0,e.second||0,e.millisecond||0);return"number"==typeof e.offset?new b8(t.valueOf()-60*e.offset*1e3):t}function wD(e,t=b9){let r=ww(e,t),n=r.invalid?new b8(NaN):wE(r);return n.isValid()||(n.invalid=`Unable to parse date "${e}"`),n}function wx(e,t=b9){return e instanceof Date?new b8(e.valueOf()):"number"==typeof e?new b8(e):wD(e,t)}Date.fromString=b8.fromString=wD,Date.fromAny=b8.fromAny=wx,"u">typeof window&&(window.anyDateParser={fromString:wD,fromAny:wx,fromObject:wE,attempt:ww});var w_=r(5238),wS=r(3826);let wC=function(e){return null==e};function wk(e,t){var r=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(e,t);return r.get?r.get.call(e):r.value}u4.extend(u3),u4.extend(wS),u4.extend(w_);let wP="YYYY-MM-DDTHH:mm:ss.SSSZZ",wR=/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/;function wT(e,t){let r=wR.exec(e);if(!r)return ww(e,t);let n=Number(r[1]),a=void 0===r[2]?void 0:Number(r[2]),o=void 0===r[3]?void 0:Number(r[3]),i=new Date(0);return(i.setUTCFullYear(n,(a??1)-1,o??1),i.getUTCFullYear()!==n||i.getUTCMonth()!==(a??1)-1||i.getUTCDate()!==(o??1))?{invalid:`Invalid ISO calendar date '${e}'`}:{year:n,...void 0!==a&&{month:a},...void 0!==o&&{day:o}}}function wO(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&u4(e,wP).isValid()}function w$(e){return u4(e).isToday()}function wN(e){return wO(e)?u4(e,wP).toDate():null}function wI(e,t=!1){let r=u4(e);return t&&(r=r.utc()),r.format(wP)}function wM(e){return u4(e).toDate()}var wj=new WeakMap;let wA=new class{register(e,t){wk(this,wj).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(wk(this,wj).has(t))return wk(this,wj).get(t)}if(e.language&&wk(this,wj).has(e.language))return wk(this,wj).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return wk(this,wj).set(`${e.language}${e.region?`-${e.region}`:""}`,t),t}constructor(){!function(e,t,r){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,r)}(this,wj,{writable:!0,value:new Map})}};function wL(e,t){wA.register(e,t)}function wF(e){let t=e??b5();return wA.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let wB={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function wV(e,t={}){let r=wT(e,b5());if(r.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!wC(r.day)&&wC(r.month)&&(r=Object.assign({},nu(r,"day"),{month:r.day})),r.month&&(r.month-=1),r.day&&(r=Object.assign({},nu(r,"day"),{date:r.day}));let n=u4().set(r).toDate();return wC(r.year)&&(t.year=!1),wC(r.month)&&(t.month=!1),wC(r.date)&&(t.day=!1),wU(n,t)}function wU(e,t){let r,n=t?.locale??b5(),a=new Intl.Locale(n),{calendar:o,mode:i,time:s,day:l,month:u,year:c,noToday:d,numberingSystem:m}={...wB,...{noToday:"am"===a.language},...t},p={calendar:o??wF(a),year:c?"numeric":void 0,month:u?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},f=u4(e).isToday();if(f&&!d)r=(r=new Intl.RelativeTimeFormat(n,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(n)+r.slice(1);else{"en"===a.language&&(n="en-GB");let t=new Intl.DateTimeFormat(n,p).formatToParts(e);("en"===a.language||"am"===a.language)&&"standard"==i&&c&&l&&(t=t.map(wW("-"))),"wide"==i&&(t=t.map(wW(" — "))),"ethiopic"===p.calendar&&(t=t.filter((e,t,r)=>"era"!==e.type&&("literal"!==e.type||!(t<r.length-1)||"era"!==r[t+1].type))),r=t.map(e=>e.value).join("")}return(!0===s||f&&"for today"===s)&&(r+=`, ${wH(e)}`),r}let wW=e=>(t,r,n)=>"literal"!==t.type||" "!==t.value||r<n.length-1&&"era"===n[r+1].type?t:{type:"literal",value:e};function wH(e){return e.toLocaleTimeString(b5(),{hour:"2-digit",minute:"2-digit"})}function wz(e,t){return wU(e,{...t,time:!0})}function wK(e,t){let r=wF("string"==typeof t?new Intl.Locale(t):t);return r?hZ(e,g7(r)):e}function wG(e,t){return new Intl.DurationFormat(b5(),t).format(e)}function wZ(e,t){if(null==e)return null;if("string"==typeof e){let r=wT(e,b5());return r.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(r.day&&!r.month&&(r={...nu(r,"day"),...{month:r.day}}),r.month&&(r.month-=1),r.day&&(r={...nu(r,"day"),...{date:r.day}}),u4(t).set(r))}return u4(e)}let wY=["years","months","days","hours","minutes","seconds"],wq={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},wJ={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function wX(e,t=u4(),r){let n,a=u4(t),o=wZ(e,a);if(null==o)return null;if("string"==typeof r){let e=wq[r]??r;return{[e]:a.diff(o,e)}}let{thresholds:i,largestUnit:s,smallestUnit:l}=r??{};if(void 0!==s||void 0!==l){let e,t=l?wq[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,r){let n=wY.indexOf(r);for(let a=0;a<wY.length;a++){let o=wY[a];if(t.diff(e,o)>0)return a<=n?o:r}return r}(o,a,t??"seconds"):wq[s]??s,function(e,t,r,n){let a=wY.indexOf(r),o=wY.indexOf(n),i=wY.slice(a,o+1),s={},l=e;for(let e of i){let r=t.diff(l,e);s[e]=r,l=l.add(r,e)}return s}(o,a,e,t??e)}let u=(n=function(e){let t={...wJ};if(e)for(let[r,n]of Object.entries(e))void 0!==n&&(t[wq[r]??r]=n);return t}(i),a.diff(o,"seconds")<n.seconds?"seconds":a.diff(o,"minutes")<n.minutes?"minutes":a.diff(o,"hours")<n.hours?"hours":a.diff(o,"days")<n.days?"days":a.diff(o,"months")<n.months?"months":"years");return{[u]:a.diff(o,u)}}let wQ={style:"short",localeMatcher:"lookup"};function w0(e,t=u4(),r){let n=wX(e,t,r);return null==n?null:wG(n,"object"==typeof r&&r.formatOptions?{...wQ,...r.formatOptions}:wQ)}let w1=(0,ls.createContext)(null);function w4(){let e=ul({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,ls.useMemo)(()=>{let t=b5();return e[t]&&(t=e[t]),t},[window.i18next.language]),r=(0,ls.useMemo)(()=>{let e=wF(t);return void 0!==e?g7(e):void 0},[t]),n=(0,ls.useMemo)(()=>new Intl.Locale(t,{calendar:r?.identifier}),[t,r]),a=(0,ls.useMemo)(()=>r?hZ(h2(h9()),r):h2(h9()),[r]);return{calendar:r,intlLocale:n,today_:a}}let w2=new hI(1793,1,1);var w3={};function w6(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function w5(e={}){let{locale:t}=fY();return(0,ls.useMemo)(()=>new(0,v_.K)(t,e),[t,e])}w3={"ar-AE":{decrease:e=>`\u{62E}\u{641}\u{636} ${e.fieldLabel}`,increase:e=>`\u{632}\u{64A}\u{627}\u{62F}\u{629} ${e.fieldLabel}`,numberField:"حقل رقمي"},"bg-BG":{decrease:e=>`\u{41D}\u{430}\u{43C}\u{430}\u{43B}\u{44F}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{441}\u{438}\u{43B}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,numberField:"Номер на полето"},"cs-CZ":{decrease:e=>`Sn\xed\u{17E}it ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}it ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"da-DK":{decrease:e=>`Reducer ${e.fieldLabel}`,increase:e=>`\xd8g ${e.fieldLabel}`,numberField:"Talfelt"},"de-DE":{decrease:e=>`${e.fieldLabel} verringern`,increase:e=>`${e.fieldLabel} erh\xf6hen`,numberField:"Nummernfeld"},"el-GR":{decrease:e=>`\u{39C}\u{3B5}\u{3AF}\u{3C9}\u{3C3}\u{3B7} ${e.fieldLabel}`,increase:e=>`\u{391}\u{3CD}\u{3BE}\u{3B7}\u{3C3}\u{3B7} ${e.fieldLabel}`,numberField:"Πεδίο αριθμού"},"en-US":{decrease:e=>`Decrease ${e.fieldLabel}`,increase:e=>`Increase ${e.fieldLabel}`,numberField:"Number field"},"es-ES":{decrease:e=>`Reducir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"et-EE":{decrease:e=>`V\xe4henda ${e.fieldLabel}`,increase:e=>`Suurenda ${e.fieldLabel}`,numberField:"Numbri v\xe4li"},"fi-FI":{decrease:e=>`V\xe4henn\xe4 ${e.fieldLabel}`,increase:e=>`Lis\xe4\xe4 ${e.fieldLabel}`,numberField:"Numerokentt\xe4"},"fr-FR":{decrease:e=>`Diminuer ${e.fieldLabel}`,increase:e=>`Augmenter ${e.fieldLabel}`,numberField:"Champ de nombre"},"he-IL":{decrease:e=>`\u{5D4}\u{5E7}\u{5D8}\u{5DF} ${e.fieldLabel}`,increase:e=>`\u{5D4}\u{5D2}\u{5D3}\u{5DC} ${e.fieldLabel}`,numberField:"שדה מספר"},"hr-HR":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"hu-HU":{decrease:e=>`${e.fieldLabel} cs\xf6kkent\xe9se`,increase:e=>`${e.fieldLabel} n\xf6vel\xe9se`,numberField:"Sz\xe1mmező"},"it-IT":{decrease:e=>`Riduci ${e.fieldLabel}`,increase:e=>`Aumenta ${e.fieldLabel}`,numberField:"Campo numero"},"ja-JP":{decrease:e=>`${e.fieldLabel}\u{3092}\u{7E2E}\u{5C0F}`,increase:e=>`${e.fieldLabel}\u{3092}\u{62E1}\u{5927}`,numberField:"数値フィールド"},"ko-KR":{decrease:e=>`${e.fieldLabel} \u{AC10}\u{C18C}`,increase:e=>`${e.fieldLabel} \u{C99D}\u{AC00}`,numberField:"번호 필드"},"lt-LT":{decrease:e=>`Suma\u{17E}inti ${e.fieldLabel}`,increase:e=>`Padidinti ${e.fieldLabel}`,numberField:"Numerio laukas"},"lv-LV":{decrease:e=>`Samazin\u{101}\u{161}ana ${e.fieldLabel}`,increase:e=>`Palielin\u{101}\u{161}ana ${e.fieldLabel}`,numberField:"Skaitļu lauks"},"nb-NO":{decrease:e=>`Reduser ${e.fieldLabel}`,increase:e=>`\xd8k ${e.fieldLabel}`,numberField:"Tallfelt"},"nl-NL":{decrease:e=>`${e.fieldLabel} verlagen`,increase:e=>`${e.fieldLabel} verhogen`,numberField:"Getalveld"},"pl-PL":{decrease:e=>`Zmniejsz ${e.fieldLabel}`,increase:e=>`Zwi\u{119}ksz ${e.fieldLabel}`,numberField:"Pole numeru"},"pt-BR":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"pt-PT":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo num\xe9rico"},"ro-RO":{decrease:e=>`Sc\u{103}dere ${e.fieldLabel}`,increase:e=>`Cre\u{219}tere ${e.fieldLabel}`,numberField:"C\xe2mp numeric"},"ru-RU":{decrease:e=>`\u{423}\u{43C}\u{435}\u{43D}\u{44C}\u{448}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{432}\u{435}\u{43B}\u{438}\u{447}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,numberField:"Числовое поле"},"sk-SK":{decrease:e=>`Zn\xed\u{17E}i\u{165} ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}i\u{165} ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"sl-SI":{decrease:e=>`Upadati ${e.fieldLabel}`,increase:e=>`Pove\u{10D}ajte ${e.fieldLabel}`,numberField:"Številčno polje"},"sr-SP":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"sv-SE":{decrease:e=>`Minska ${e.fieldLabel}`,increase:e=>`\xd6ka ${e.fieldLabel}`,numberField:"Nummerf\xe4lt"},"tr-TR":{decrease:e=>`${e.fieldLabel} azalt`,increase:e=>`${e.fieldLabel} artt\u{131}r`,numberField:"Sayı alanı"},"uk-UA":{decrease:e=>`\u{417}\u{43C}\u{435}\u{43D}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,increase:e=>`\u{417}\u{431}\u{456}\u{43B}\u{44C}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,numberField:"Поле номера"},"zh-CN":{decrease:e=>`\u{964D}\u{4F4E} ${e.fieldLabel}`,increase:e=>`\u{63D0}\u{9AD8} ${e.fieldLabel}`,numberField:"数字字段"},"zh-TW":{decrease:e=>`\u{7E2E}\u{5C0F} ${e.fieldLabel}`,increase:e=>`\u{653E}\u{5927} ${e.fieldLabel}`,numberField:"數字欄位"}};var w9={};w9={"ar-AE":{Empty:"فارغ"},"bg-BG":{Empty:"Изпразни"},"cs-CZ":{Empty:"Pr\xe1zdn\xe9"},"da-DK":{Empty:"Tom"},"de-DE":{Empty:"Leer"},"el-GR":{Empty:"Άδειο"},"en-US":{Empty:"Empty"},"es-ES":{Empty:"Vac\xedo"},"et-EE":{Empty:"T\xfchjenda"},"fi-FI":{Empty:"Tyhj\xe4"},"fr-FR":{Empty:"Vide"},"he-IL":{Empty:"ריק"},"hr-HR":{Empty:"Prazno"},"hu-HU":{Empty:"\xdcres"},"it-IT":{Empty:"Vuoto"},"ja-JP":{Empty:"空"},"ko-KR":{Empty:"비어 있음"},"lt-LT":{Empty:"Tuščias"},"lv-LV":{Empty:"Tukšs"},"nb-NO":{Empty:"Tom"},"nl-NL":{Empty:"Leeg"},"pl-PL":{Empty:"Pusty"},"pt-BR":{Empty:"Vazio"},"pt-PT":{Empty:"Vazio"},"ro-RO":{Empty:"Gol"},"ru-RU":{Empty:"Не заполнено"},"sk-SK":{Empty:"Pr\xe1zdne"},"sl-SI":{Empty:"Prazen"},"sr-SP":{Empty:"Prazno"},"sv-SE":{Empty:"Tomt"},"tr-TR":{Empty:"Boş"},"uk-UA":{Empty:"Пусто"},"zh-CN":{Empty:"空"},"zh-TW":{Empty:"空白"}};let w8=()=>{};function w7(e){var t;let r=(0,ls.useRef)(void 0),{value:n,textValue:a,minValue:o,maxValue:i,isDisabled:s,isReadOnly:l,isRequired:u,onIncrement:c,onIncrementPage:d,onDecrement:m,onDecrementPage:p,onDecrementToMin:f,onIncrementToMax:h}=e,g=hr((t=w9)&&t.__esModule?t.default:t,"@react-aria/spinbutton"),y=(0,ls.useRef)(!1),v=(0,ls.useCallback)(()=>{clearTimeout(r.current),y.current=!1},[]),b=fa(()=>{v()});(0,ls.useEffect)(()=>()=>b(),[]);let{keyboardProps:w}=p0({isDisabled:s||l,shortcuts:{PageUp:()=>d?void d():!!c&&void c(),ArrowUp:()=>!!c&&void c(),PageDown:()=>p?void p():!!m&&void m(),ArrowDown:()=>!!m&&void m(),Home:()=>!!f&&void f(),End:()=>!!h&&void h()},allowRepeats:!0}),E=(0,ls.useRef)(!1),D=()=>{E.current=!0},x=()=>{E.current=!1},_=""===a?g.format("Empty"):(a||`${n}`).replace("-","−");(0,ls.useEffect)(()=>{E.current&&(mB&&mB.clear("assertive"),mV(_,"assertive"))},[_]);let S=(0,ls.useCallback)(()=>{v()},[v]),C=fa(c??w8),k=fa(m??w8),P=fa(()=>{(void 0===i||isNaN(i)||void 0===n||isNaN(n)||n<i)&&(C(),R(60))}),R=fa(e=>{b(),y.current=!0,r.current=window.setTimeout(P,e)}),T=fa(()=>{(void 0===o||isNaN(o)||void 0===n||isNaN(n)||n>o)&&(k(),O(60))}),O=fa(e=>{b(),y.current=!0,r.current=window.setTimeout(T,e)}),$=e=>{e.preventDefault()},{addGlobalListener:N,removeAllGlobalListeners:I}=fo(),M=(0,ls.useRef)(!1),[j,A]=(0,ls.useState)(null);(0,ls.useEffect)(()=>{"touch"===j?R(600):j?R(400):j||b()},[j]);let[L,F]=(0,ls.useState)(null);return(0,ls.useEffect)(()=>{"touch"===L?O(600):L?O(400):L||b()},[L]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===n||isNaN(n)?void 0:n,"aria-valuetext":_,"aria-valuemin":o,"aria-valuemax":i,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":u||void 0,...w,onFocus:D,onBlur:x},incrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(c?.(),A("mouse")):(N(window,"pointercancel",S,{capture:!0}),M.current=!1,A("touch")),N(window,"contextmenu",$)},onPressUp:e=>{v(),"touch"===e.pointerType&&(M.current=!0),I(),A(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&M.current&&c?.(),M.current=!1,A(null)},onFocus:D,onBlur:x},decrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(m?.(),F("mouse")):(N(window,"pointercancel",S,{capture:!0}),M.current=!1,F("touch"))},onPressUp:e=>{v(),"touch"===e.pointerType&&(M.current=!0),I(),F(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&M.current&&m?.(),M.current=!1,F(null)},onFocus:D,onBlur:x}}}let Ee=null;var Et=r(6284);function Er(e,t,r){let n="+"===e?t+r:t-r;if(t%1!=0||r%1!=0){let a=t.toString().split("."),o=r.toString().split("."),i=Math.pow(10,Math.max(a[1]&&a[1].length||0,o[1]&&o[1].length||0));t=Math.round(t*i),r=Math.round(r*i),n=("+"===e?t+r:t-r)/i}return n}let En=(0,ls.createContext)(null),Ea=(0,ls.createContext)(null),Eo=(0,ls.forwardRef)(function(e,t){[e,t]=mN(e,t,En);let{validationBehavior:r}=m$(vK)||{},n=e.validationBehavior??r??"native",{locale:a}=fY(),o=function(e){let{minValue:t,maxValue:r,step:n,formatOptions:a,value:o,defaultValue:i=NaN,onChange:s,locale:l,isDisabled:u,isReadOnly:c,commitBehavior:d="snap"}=e;null===o&&(o=NaN);let m=(0,ls.useCallback)(e=>void 0===n||isNaN(n)?v4(e,t,r):v3(e,t,r,n),[n,t,r]);void 0===o||isNaN(o)||"snap"!==d||(o=m(o)),isNaN(i)||"snap"!==d||(i=m(i));let[p,f]=yl(o,isNaN(i)?NaN:i,s),[h]=(0,ls.useState)(p),[g,y]=(0,ls.useState)(()=>isNaN(p)?"":new(0,v_.K)(l,a).format(p)),v=(0,ls.useMemo)(()=>new(0,Et.d)(l,a),[l,a]),b=(0,ls.useMemo)(()=>v.getNumberingSystem(g),[v,g]),w=(0,ls.useMemo)(()=>new(0,v_.K)(l,{...a,numberingSystem:b}),[l,a,b]),E=(0,ls.useMemo)(()=>w.resolvedOptions(),[w]),D=(0,ls.useCallback)(e=>isNaN(e)||null===e?"":w.format(e),[w]),x=vi({...e,value:p}),_=void 0===n||isNaN(n)?1:n;"percent"===E.style&&(void 0===n||isNaN(n))&&(_=.01);let[S,C]=(0,ls.useState)(p),[k,P]=(0,ls.useState)(l),[R,T]=(0,ls.useState)(a);Object.is(p,S)&&l===k&&function(e,t){if(e===t)return!0;if(!e||!t)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(t[n]!==e[n])return!1;return!0}(a,R)||(y(D(p)),C(p),P(l),T(a));let O=(0,ls.useMemo)(()=>v.parse(g),[v,g]),$=(e,n=0)=>{if(isNaN(O))return v3(isNaN(n)?0:n,t,r,_);{let n=v3(O,t,r,_);return"+"===e&&n>O||"-"===e&&n<O?n:v3(Er(e,O,_),t,r,_)}},N=(0,ls.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===r||isNaN(r)||v3(O,t,r,_)>O||Er("+",O,_)<=r),[u,c,t,r,_,O]),I=(0,ls.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===t||isNaN(t)||v3(O,t,r,_)<O||Er("-",O,_)>=t),[u,c,t,r,_,O]);return{...x,validate:e=>v.isValidPartialNumber(e,t,r),increment:()=>{let e=$("+",t);e===p&&y(D(e)),f(e),x.commitValidation()},incrementToMax:()=>{null!=r&&(f(v3(r,t,r,_)),x.commitValidation())},decrement:()=>{let e=$("-",r);e===p&&y(D(e)),f(e),x.commitValidation()},decrementToMin:()=>{null!=t&&(f(t),x.commitValidation())},canIncrement:N,canDecrement:I,minValue:t,maxValue:r,numberValue:O,defaultNumberValue:isNaN(i)?h:i,setNumberValue:f,setInputValue:y,inputValue:g,commit:e=>{let t=void 0===e?g:e,r=O;if(void 0!==e&&(r=v.parse(t)),!t.length){f(NaN),y(void 0===o?"":D(p));return}if(isNaN(r))return void y(D(p));let n="snap"===d?m(r):r,a=(n=v.parse(D(n)))!==p;f(n),y(D(void 0===o?n:p)),a&&x.commitValidation()}}}({...e,locale:a,validationBehavior:n}),i=(0,ls.useRef)(null),[s,l]=mI(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:u,groupProps:c,inputProps:d,incrementButtonProps:m,decrementButtonProps:p,descriptionProps:f,errorMessageProps:h,...g}=function(e,t,r){var n,a,o,i,s,l,u,c,d;let m,{id:p,decrementAriaLabel:f,incrementAriaLabel:h,isDisabled:g,isReadOnly:y,isRequired:v,minValue:b,maxValue:w,autoFocus:E,label:D,formatOptions:x,onBlur:_=()=>{},onFocus:S,onFocusChange:C,onKeyDown:k,onKeyUp:P,description:R,errorMessage:T,isWheelDisabled:O,...$}=e,{increment:N,incrementToMax:I,decrement:M,decrementToMin:j,numberValue:A,inputValue:L,commit:F,commitValidation:B}=t,V=hr((n=w3)&&n.__esModule?n.default:n,"@react-aria/numberfield"),U=(0,ls.useCallback)(()=>{let e=r.current?.value??"";(0,fi.flushSync)(()=>{F()}),r.current?.value!==e&&mV(r.current?.value??"","assertive")},[F,r]),W=mD(p),{focusProps:H}=pG({onBlur(){U()}}),z=w5(x),K=(0,ls.useMemo)(()=>z.resolvedOptions(),[z]),G=w5({...x,currencySign:void 0}),Z=(0,ls.useMemo)(()=>isNaN(A)?"":G.format(A),[G,A]),{spinButtonProps:Y,incrementButtonProps:q,decrementButtonProps:J}=w7({isDisabled:g,isReadOnly:y,isRequired:v,maxValue:w,minValue:b,onIncrement:N,onIncrementToMax:I,onDecrement:M,onDecrementToMin:j,value:A,textValue:Z}),[X,Q]=(0,ls.useState)(!1),{focusWithinProps:ee}=fE({isDisabled:g,onFocusWithinChange:Q});!function(e,t){let{onScroll:r,isDisabled:n}=e,a=(0,ls.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),r&&r({deltaX:e.deltaX,deltaY:e.deltaY}))},[r]);gE(t,"wheel",n?void 0:a)}({onScroll:(0,ls.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?N():e.deltaY<0&&M())},[M,N]),isDisabled:O||g||y||!X},r);let et=(K.maximumFractionDigits??0)>0,er=void 0===t.minValue||isNaN(t.minValue)||t.minValue<0,en="numeric";pm()?er?en="text":et&&(en="decimal"):py()&&(er?en="numeric":et&&(en="decimal"));let ea=mY(e),{keyboardProps:eo}=p0({isDisabled:g||y,shortcuts:{Enter:()=>((0,fi.flushSync)(()=>{F()}),B(),{shouldPreventDefault:!1})},onKeyDown:k,onKeyUp:P}),{isInvalid:ei,validationErrors:es,validationDetails:el}=t.displayValidation,{labelProps:eu,inputProps:ec,descriptionProps:ed,errorMessageProps:em}=function(e,t,r){let n=fa(e=>{let n=r.current;if(!n)return;let a=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":a=n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteContentForward":a=n.selectionEnd===n.selectionStart?n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd+1):n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteContentBackward":a=n.selectionEnd===n.selectionStart?n.value.slice(0,n.selectionStart-1)+n.value.slice(n.selectionStart):n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":a=n.value.slice(n.selectionStart);break;default:null!=e.data&&(a=n.value.slice(0,n.selectionStart)+e.data+n.value.slice(n.selectionEnd))}null!=a&&t.validate(a)||e.preventDefault()});(0,ls.useEffect)(()=>{if(!w6()||!r.current)return;let e=r.current;return e.addEventListener("beforeinput",n,!1),()=>{e.removeEventListener("beforeinput",n,!1)}},[r]);let a=w6()?null:e=>{let r=m2(e).value.slice(0,m2(e).selectionStart)+e.data+m2(e).value.slice(m2(e).selectionEnd);t.validate(r)||e.preventDefault()},{labelProps:o,inputProps:i,descriptionProps:s,errorMessageProps:l,...u}=function(e,t){let{inputElementType:r="input",isDisabled:n=!1,isRequired:a=!1,isReadOnly:o=!1,type:i="text",validationBehavior:s="aria"}=e,[l,u]=yl(e.value,e.defaultValue||"",e.onChange),{focusableProps:c}=p3(e,t),d=vi({...e,value:l}),{isInvalid:m,validationErrors:p,validationDetails:f}=d.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:y,errorMessageProps:v}=y2({...e,isInvalid:m,errorMessage:e.errorMessage||p}),b=mY(e,{labelable:!0}),w={type:i,pattern:e.pattern},[E]=(0,ls.useState)(l);return y3(t,e.defaultValue??E,u),y6(e,d,t),{labelProps:h,inputProps:mk(b,"input"===r?w:void 0,{disabled:n,readOnly:o,required:a&&"native"===s,"aria-required":a&&"aria"===s||void 0,"aria-invalid":m||void 0,"aria-errormessage":e["aria-errormessage"],"aria-activedescendant":e["aria-activedescendant"],"aria-autocomplete":e["aria-autocomplete"],"aria-haspopup":e["aria-haspopup"],"aria-controls":e["aria-controls"],value:l,onChange:e=>u(m2(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(ll().version,10)>=17?"enterKeyHint":"enterkeyhint"]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...c,...g}),descriptionProps:y,errorMessageProps:v,isInvalid:m,validationErrors:p,validationDetails:f}}(e,r),c=(0,ls.useRef)(null);return{inputProps:mk(i,{onBeforeInput:a,onCompositionStart(){let{value:e,selectionStart:t,selectionEnd:n}=r.current;c.current={value:e,selectionStart:t,selectionEnd:n}},onCompositionEnd(){if(r.current&&!t.validate(r.current.value)){let{value:e,selectionStart:n,selectionEnd:a}=c.current;r.current.value=e,r.current.setSelectionRange(n,a),t.setInputValue(e)}}}),labelProps:o,descriptionProps:s,errorMessageProps:l,...u}}({...$,...ea,name:void 0,form:void 0,label:D,autoFocus:E,isDisabled:g,isReadOnly:y,isRequired:v,validate:void 0,[vo]:t,value:L,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:W,type:"text",inputMode:en,onChange:e=>{t.validate(e)&&t.setInputValue(e)},onBlur:_,onFocus:S,onFocusChange:C,onPaste:t=>{e.onPaste?.(t);let r=m2(t);r&&(r.selectionEnd??-1)-(r.selectionStart??0)===r.value.length&&(t.preventDefault(),F(t.clipboardData?.getData?.("text/plain")?.trim()??""))},description:R,errorMessage:T},t,r),ep=mk(eo,ec);y3(r,t.defaultNumberValue,t.setNumberValue),a=t,o=e.validationBehavior,i=e.commitBehavior,s=r,l=t.minValue,u=t.maxValue,c=e.step,d=t.numberValue,mu(()=>{let e=s.current;if("validate"!==i||a.realtimeValidation.isInvalid||!e||e.disabled||(!Ee&&"u">typeof document&&((Ee=document.createElement("input")).type="number"),!Ee))return;Ee.min=null==l||isNaN(l)?"":String(l),Ee.max=null==u||isNaN(u)?"":String(u),Ee.step=null==c||isNaN(c)?"":String(c),Ee.value=null==d||isNaN(d)?"":String(d);let t=e.validity.valid&&Ee.validity.valid,r=e.validationMessage||Ee.validationMessage,n={isInvalid:!t,validationErrors:r?[r]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:Ee.validity.rangeOverflow,rangeUnderflow:Ee.validity.rangeUnderflow,stepMismatch:Ee.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:t}};a.updateValidation(n),"native"!==o||Ee.validity.valid||e.setCustomValidity(Ee.validationMessage)});let ef=mk(Y,H,ep,{role:null,"aria-roledescription":pf()?null:V.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(ef["aria-required"]=void 0);let eh=e=>{((e=document)=>e.activeElement)()!==r.current&&("mouse"===e.pointerType?r.current?.focus():e.target.focus())},eg=e["aria-label"]||("string"==typeof e.label?e.label:"");eg||(m=null!=e.label?eu.id:e["aria-labelledby"]);let ey=mD(),ev=mD(),eb=mk(q,{"aria-label":h||V.format("increase",{fieldLabel:eg}).trim(),id:m&&!h?ey:null,"aria-labelledby":m&&!h?`${ey} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:eh}),ew=mk(J,{"aria-label":f||V.format("decrease",{fieldLabel:eg}).trim(),id:m&&!f?ev:null,"aria-labelledby":m&&!f?`${ev} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canDecrement,onPressStart:eh});return{groupProps:{...ee,role:"group","aria-disabled":g,"aria-invalid":ei?"true":void 0},labelProps:eu,inputProps:ef,incrementButtonProps:eb,decrementButtonProps:ew,errorMessageProps:em,descriptionProps:ed,isInvalid:ei,validationErrors:es,validationDetails:el}}({...mM(e),label:l,validationBehavior:n},o,i),y=mO({...e,values:{state:o,isDisabled:e.isDisabled||!1,isInvalid:g.isInvalid||!1,isRequired:e.isRequired||!1,isReadOnly:e.isReadOnly||!1},defaultClassName:"react-aria-NumberField"}),v=mY(e,{global:!0});return delete v.id,ll().createElement(mT,{values:[[Ea,o],[yR,c],[yO,{...d,ref:i}],[vq,{...u,ref:s}],[fP,{slots:{increment:m,decrement:p}}],[f$,{slots:{description:f,errorMessage:h}}],[vW,g]]},ll().createElement(mL.div,{...v,...y,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":g.isInvalid||void 0}),e.name&&ll().createElement("input",{type:"hidden",name:e.name,form:e.form,value:isNaN(o.numberValue)?"":o.numberValue,disabled:e.isDisabled||void 0}))});function Ei(e,t){return Number.parseInt(wU(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let Es=(0,ls.forwardRef)(function(e,t){let{className:r}=e,n=(0,ls.useContext)(yb),a=(0,ls.useContext)(yw),o=n??a,i=(0,ls.useContext)(w1),s=h9(),l=wU(o.visibleRange.start.toDate(s),{calendar:i.calendar,locale:i.baseName,day:!1,year:!1,noToday:!0}),u=Ei(o.visibleRange.start.toDate(s),i),c=o.maxValue?Ei(o.maxValue.toDate(s),i):void 0,d=o.minValue?Ei(o.minValue.toDate(s),i):void 0,m=(0,ls.useCallback)(e=>{o.setFocusedDate(o.focusedDate.cycle("year",e-o.focusedDate.year))},[]);return o&&(0,lc.jsxs)("span",{ref:t,className:r,children:[(0,lc.jsx)("span",{children:l}),(0,lc.jsxs)(Eo,{formatOptions:{useGrouping:!1},maxValue:c,minValue:d,onChange:m,value:u,children:[(0,lc.jsx)(y$,{}),(0,lc.jsxs)(yT,{children:[(0,lc.jsx)(fR,{slot:"increment",children:(0,lc.jsx)(cK,{size:8})}),(0,lc.jsx)(fR,{slot:"decrement",children:(0,lc.jsx)(cW,{size:8})})]})]})]})}),El="-esm-report-builder__datepicker-module__inputGroup___8HE83",Eu="-esm-report-builder__datepicker-module__inputSegment___bZPCL",Ec="-esm-report-builder__datepicker-module__dateInputWrapper___ZGn+P",Ed="-esm-report-builder__datepicker-module__invalidText___mb1DW",Em="-esm-report-builder__datepicker-module__flatButton___DL7RZ",Ep="-esm-report-builder__datepicker-module__flatButtonMd___JZlIZ",Ef="-esm-report-builder__datepicker-module__flatButtonSm___bOLZt",Eh="-esm-report-builder__datepicker-module__flatButtonLg___IQPkt";function Eg({children:e}){let t=(0,ls.useContext)(bq),r=(0,ls.useContext)(bJ),n=t??r,a=uH(()=>n?.close());return(0,lc.jsx)(vU,{className:"-esm-report-builder__datepicker-module__dialog___vu+V8",ref:a,children:e})}let Ey=(0,ls.forwardRef)(function({variant:e,today_:t,minDate:r,maxDate:n},a){let o=(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsxs)("header",{className:"-esm-report-builder__datepicker-module__header___8V465",children:[(0,lc.jsx)(fR,{className:ch()(Em,Ep),slot:"previous",children:(0,lc.jsx)(cQ,{size:16})}),(0,lc.jsx)(Es,{className:"-esm-report-builder__datepicker-module__monthYear___kwBXn"}),(0,lc.jsx)(fR,{className:ch()(Em,Ep),slot:"next",children:(0,lc.jsx)(c0,{size:16})})]}),(0,lc.jsx)(y_,{className:"-esm-report-builder__datepicker-module__calendarGrid___Po5J8",children:e=>(0,lc.jsx)(yP,{className:ch()("cds--date-picker__day",{"-esm-report-builder__datepicker-module__today___EotRU":0===t.compare(e)}),date:e},e.toString())})]});return(0,lc.jsx)(bz,{ref:a,className:"-esm-report-builder__datepicker-module__popover___rJRGV",placement:"bottom start",offset:1,isNonModal:!0,children:(0,lc.jsx)(Eg,{children:"range"===e?(0,lc.jsx)(yD,{minValue:r,maxValue:n,className:"cds--date-picker__calendar",children:o}):(0,lc.jsx)(yE,{children:o})})})}),Ev=(0,ls.forwardRef)(function(e,t){let r=(0,ls.useContext)(bq),[n,a]=mN({slot:e.slot},t,vR),{locale:o}=fY(),i=vP({...n,locale:o,createCalendar:g7}),s=(0,ls.useRef)(null),{fieldProps:l,inputProps:u}=y7({...n,inputRef:s},i,a),c=(0,ls.useCallback)(()=>{i.isDisabled||r.toggle()},[]);return(0,lc.jsxs)(mT,{values:[[vT,i],[yO,{...u,ref:s}],[yR,{...l,ref:a,isInvalid:i.isInvalid}]],children:[(0,lc.jsx)(yT,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:i.isDisabled,isInvalid:i.isInvalid,onClick:c,children:i.segments.map((t,r)=>(0,ls.cloneElement)(e.children(t),{key:r}))}),(0,lc.jsx)(y$,{})]})}),Eb=(0,ls.forwardRef)(function(e,t){let r=(0,ls.useContext)(bq),n=(0,ls.useContext)(bJ);return(r??n).isInvalid?(0,lc.jsx)(d8,{ref:t,size:16,...e}):(0,lc.jsx)(cU,{ref:t,size:16,...e})});class Ew{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let EE=new Map,ED=(0,ls.forwardRef)(function({segment:e,...t},r){let n=(0,ls.useContext)(vT),a=mP(r),{segmentProps:o}=function(e,t,r){let n,a,o,i,s=(0,ls.useRef)(""),{locale:l,direction:u}=fY(),c=function(){var e;let{locale:t}=fY(),r=ht((e=y0)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,ls.useMemo)(()=>{try{return new Intl.DisplayNames(t,{type:"dateTimeField"})}catch{return new Ew(t,r)}},[t,r])}(),{ariaLabel:d,ariaLabelledBy:m,ariaDescribedBy:p,focusManager:f}=y5.get(t),h=e.isPlaceholder?"":e.text,g=(0,ls.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),y=f4({month:"long",timeZone:g.timeZone}),v=f4({hour:"numeric",hour12:g.hour12,timeZone:g.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(h=v.format(t.dateValue));else{let e=y.format(t.dateValue);h=e!==h?`${h} \u{2013} ${e}`:e}let{spinButtonProps:b}=w7({value:e.value??void 0,textValue:h,minValue:e.minValue,maxValue:e.maxValue,isDisabled:t.isDisabled,isReadOnly:t.isReadOnly||!e.isEditable,isRequired:t.isRequired,onIncrement:()=>{s.current="",t.increment(e.type)},onDecrement:()=>{s.current="",t.decrement(e.type)},onIncrementPage:()=>{s.current="",t.incrementPage(e.type)},onDecrementPage:()=>{s.current="",t.decrementPage(e.type)},onIncrementToMax:()=>{s.current="",t.incrementToMax(e.type)},onDecrementToMin:()=>{s.current="",t.decrementToMin(e.type)}}),w=(0,ls.useMemo)(()=>new(0,Et.d)(l,{maximumFractionDigits:0}),[l]),E=()=>{if(e.text===e.placeholder&&f.focusPrevious(),!w.isValidPartialNumber(e.text)||t.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&t.clearSegment(e.type);else{let r=e.text.slice(0,-1),n=w.parse(r);0===(r=0===n?"":r).length||0===n?t.clearSegment(e.type):t.setSegment(e.type,n),s.current=r}},{keyboardProps:D}=p0({shortcuts:{Backspace:()=>{E()},Delete:()=>{E()},"Mod+a":()=>{}},allowRepeats:!0}),{startsWith:x}=(n=function(e){let{locale:t}=fY(),r=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(EE.has(r))return EE.get(r);let n=new Intl.Collator(t,e);return EE.set(r,n),n}({usage:"search",sensitivity:"base"}),a=(0,ls.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===n.compare(e.slice(0,t.length),t)),[n]),o=(0,ls.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===n.compare(e.slice(-t.length),t)),[n]),i=(0,ls.useCallback)((e,t)=>{if(0===t.length)return!0;e=e.normalize("NFC");let r=0,a=(t=t.normalize("NFC")).length;for(;r+a<=e.length;r++){let o=e.slice(r,r+a);if(0===n.compare(t,o))return!0}return!1},[n]),(0,ls.useMemo)(()=>({startsWith:a,endsWith:o,contains:i}),[a,o,i])),_=f4({hour:"numeric",hour12:!0}),S=(0,ls.useMemo)(()=>{let e=new Date;return e.setHours(0),_.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[_]),C=(0,ls.useMemo)(()=>{let e=new Date;return e.setHours(12),_.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[_]),k=f4({year:"numeric",era:"narrow",timeZone:"UTC"}),P=(0,ls.useMemo)(()=>{if("era"!==e.type)return[];let r=hZ(new hI(1,1,1),t.calendar),n=t.calendar.getEras().map(e=>{let t=r.set({year:1,month:1,day:1,era:e}).toDate("UTC"),n=k.formatToParts(t),a=n.find(e=>"era"===e.type)?.value??e;return{era:e,formatted:a}}),a=function(e){e.sort();let t=e[0],r=e[e.length-1];for(let e=0;e<t.length;e++)if(t[e]!==r[e])return e;return 0}(n.map(e=>e.formatted));if(a)for(let e of n)e.formatted=e.formatted.slice(a);return n},[k,t.calendar,e.type]),R=r=>{if(t.isDisabled||t.isReadOnly)return;let n=s.current+r;switch(e.type){case"dayPeriod":if(x(S,r))t.setSegment("dayPeriod",0);else if(x(C,r))t.setSegment("dayPeriod",1);else break;f.focusNext();break;case"era":{let e=P.find(e=>x(e.formatted,r));e&&(t.setSegment("era",e.era),f.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!w.isValidPartialNumber(n))return;let a=w.parse(n),o=a;if(void 0!==e.maxValue&&a>e.maxValue&&(o=w.parse(r)),isNaN(a))return;t.setSegment(e.type,o),void 0!==e.maxValue&&(Number(a+"0")>e.maxValue||n.length>=String(e.maxValue).length)?(s.current="",f.focusNext()):s.current=n}}};gE((0,ls.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&m4(r.current,e?.anchorNode)&&((e=document)=>e.activeElement)()===r.current&&e.collapse(r.current)});let T=(0,ls.useRef)("");gE(r,"beforeinput",n=>{if(r.current)switch(n.preventDefault(),n.inputType){case"deleteContentBackward":case"deleteContentForward":w.isValidPartialNumber(e.text)&&!t.isReadOnly&&E();break;case"insertCompositionText":T.current=r.current.textContent,r.current.textContent=r.current.textContent;break;default:null!=n.data&&R(n.data)}}),gE(r,"input",e=>{let{inputType:t,data:n}=e;"insertCompositionText"===t&&(r.current&&(r.current.textContent=T.current),null!=n&&(x(S,n)||x(C,n))&&R(n))}),mu(()=>{let e=r.current;return()=>{((e=document)=>e.activeElement)()===e&&(f.focusPrevious()||f.focusNext())}},[r,f]);let O=pf()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,ls.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])||t.isInvalid||(p=void 0);let $=mD(),N=!t.isDisabled&&!t.isReadOnly&&e.isEditable,I="literal"===e.type?"":c.of(e.type),M=gc({"aria-label":`${I}${d?`, ${d}`:""}${m?", ":""}`,"aria-labelledby":m});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let j={caretColor:"transparent"};if("rtl"===u){j.unicodeBidi="embed";let t=g[e.type];("numeric"===t||"2-digit"===t)&&(j.direction="ltr")}return{segmentProps:mk(b,M,{id:$,...O,...D,"aria-invalid":t.isInvalid?"true":void 0,"aria-describedby":p,"aria-readonly":t.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:N,suppressContentEditableWarning:N,spellCheck:N?"false":void 0,autoCorrect:N?"off":void 0,[parseInt(ll().version,10)>=17?"enterKeyHint":"enterkeyhint"]:N?"next":void 0,inputMode:t.isDisabled||"dayPeriod"===e.type||"era"===e.type||!N?void 0:"numeric",tabIndex:t.isDisabled?void 0:0,onFocus:()=>{s.current="",r.current&&gy(r.current,{containingElement:gf(r.current)});let e=window.getSelection();e?.collapse(r.current)},style:j,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,n,a),{focusProps:i,isFocused:s,isFocusVisible:l}=fD(),{hoverProps:u,isHovered:c}=fk({...t,isDisabled:n.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:r,children:n,defaultClassName:a,defaultChildren:o,defaultStyle:i,values:s}=e;return(0,ls.useMemo)(()=>{let e,l,u;return e="function"==typeof t?t({...s,defaultClassName:a}):t,l="function"==typeof r?r({...s,defaultStyle:i||{}}):r,u="function"==typeof n?n({...s,defaultChildren:o}):null==n?o:n,{className:e??a,style:l||i?{...i,...l}:void 0,children:u??o,"data-rac":""}},[t,r,n,a,o,i,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:n.isInvalid,isDisabled:n.isDisabled,isHovered:c,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),m=(0,ls.useCallback)(e=>{e.stopPropagation()},[]);return(0,lc.jsx)("span",{...mk(mY(t),o,i,u),...d,ref:a,style:o.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":n.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":n.isDisabled||void 0,"data-type":e.type,"data-hovered":c||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:m})}),Ex={short:!1,size:"md"},E_=(0,ls.forwardRef)(function(e,t){let{className:r,defaultValue:n,isDisabled:a,invalid:o,invalidText:i,isInvalid:s,label:l,labelText:u,light:c,maxDate:d,minDate:m,onChange:p,onChangeRaw:f,short:h,size:g,value:y,...v}={...Ex,...e},{calendar:b,intlLocale:w,today_:E}=w4(),D=(0,ls.useId)(),x=!!(u??l),_=(0,ls.useMemo)(()=>b4(n,b),[n,b]),S=(0,ls.useMemo)(()=>b4(y,b,!0),[y,b]),C=(0,ls.useMemo)(()=>b4(d,b),[d,b]),k=(0,ls.useMemo)(()=>b4(m??w2,b),[m,b]),P=(0,ls.useMemo)(()=>o||s,[o,s]),R=(0,ls.useMemo)(()=>(f&&p&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),f??(e=>p?.(b2(e)))),[f,p]);return(0,lc.jsx)(b1,{locale:w.toString(),children:(0,lc.jsx)("div",{className:ch()("cds--form-item",r),children:(0,lc.jsx)(mT,{values:[[w1,w]],children:(0,lc.jsxs)(bQ,{className:ch()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":h,"cds--date-picker--light":c}),defaultValue:_,isDisabled:a,isInvalid:P,maxValue:C,minValue:k,value:S,shouldForceLeadingZeros:"en"===w.language||void 0,...v,onChange:R,children:[(0,lc.jsxs)("div",{className:"cds--date-picker-container",children:[x&&(0,lc.jsx)(vJ,{className:ch()("cds--label",{"cds--label--disabled":a}),htmlFor:D,children:u??l}),(0,lc.jsxs)(yT,{className:El,children:[(0,lc.jsx)(Ev,{id:x?D:void 0,ref:t,className:ch()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__inputWrapper___y+8gr",{"-esm-report-builder__datepicker-module__inputWrapperSm___tpcoF":"sm"===g,"-esm-report-builder__datepicker-module__inputWrapperMd___1hH89":"md"===g||!g||0===g.length,"-esm-report-builder__datepicker-module__inputWrapperLg___CRsQW":"lg"===g}),children:e=>"era"!==e.type?(0,lc.jsx)(ED,{className:Eu,segment:e}):(0,lc.jsx)(ll().Fragment,{})}),(0,lc.jsx)(fR,{className:ch()(Em,{[Ef]:"sm"===g,[Ep]:"md"===g||!g||0===g.length,[Eh]:"lg"===g}),children:(0,lc.jsx)(Eb,{})})]}),(0,lc.jsx)(vH,{className:Ed,children:i})]}),(0,lc.jsx)(Ey,{variant:"single",today_:E})]})})})})}),ES=(0,ls.forwardRef)(function({className:e,defaultValue:t,invalid:r,invalidText:n,isDisabled:a,isInvalid:o,label:i,labelText:s,light:l,maxDate:u,minDate:c,onChange:d,onChangeRaw:m,size:p="md",value:f,...h},g){let{calendar:y,intlLocale:v,today_:b}=w4(),w=(0,ls.useId)(),E=!!(s??i),D=(0,ls.useMemo)(()=>{if(f){let e=b4(f[0],y,!1),t=b4(f[1],y,!1);return e&&t?{start:e,end:t}:null}},[f,y]),x=(0,ls.useMemo)(()=>{if(t)return{start:b4(t[0],y,!1),end:b4(t[1],y,!1)}},[t,y]),_=(0,ls.useMemo)(()=>b4(c??w2,y,!0),[c,y]),S=(0,ls.useMemo)(()=>b4(u,y,!0),[u,y]),C=(0,ls.useMemo)(()=>r||o,[r,o]),k=(0,ls.useMemo)(()=>(m&&d&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),m??(e=>d?.([b2(e?.start),b2(e?.end)]))),[m,d]);return(0,lc.jsx)(b1,{locale:v.toString(),children:(0,lc.jsx)("div",{className:ch()("cds--form-item",e),children:(0,lc.jsx)(mT,{values:[[w1,v]],children:(0,lc.jsx)(b0,{id:E?w:void 0,className:ch()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":a}),isInvalid:C,shouldForceLeadingZeros:"en"===v.language||void 0,maxValue:S,minValue:_,value:D,defaultValue:x,ref:g,isDisabled:a,...h,onChange:k,children:(0,lc.jsxs)("div",{className:"cds--date-picker-container",children:[E&&(0,lc.jsx)(vJ,{className:ch()("cds--label",{"cds--label--disabled":a}),htmlFor:w,children:s??i}),(0,lc.jsxs)(yT,{className:El,children:[(0,lc.jsxs)("div",{className:ch()("-esm-report-builder__datepicker-module__inputsWrapper___soXTl",{"-esm-report-builder__datepicker-module__inputsWrapperSm___ES6Mr":"sm"===p,"-esm-report-builder__datepicker-module__inputsWrapperMd___4qQj-":"md"===p||!p||0===p.length,"-esm-report-builder__datepicker-module__inputsWrapperLg___apyRG":"lg"===p}),children:[(0,lc.jsx)(v$,{className:ch()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__startInput___Rc6pT",Ec),slot:"start",children:e=>(0,lc.jsx)(ED,{className:Eu,segment:e})}),(0,lc.jsx)("div",{className:"-esm-report-builder__datepicker-module__separator___YpWmV",children:(0,lc.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,lc.jsx)(v$,{className:ch()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__endInput___euNmk",Ec),slot:"end",children:e=>(0,lc.jsx)(ED,{className:Eu,segment:e})})]}),(0,lc.jsx)(fR,{className:ch()(Em,{[Ef]:"sm"===p,[Ep]:"md"===p||!p||0===p.length,[Eh]:"lg"===p}),children:(0,lc.jsx)(Eb,{})})]}),(0,lc.jsx)(vH,{className:Ed,children:n}),(0,lc.jsx)(Ey,{variant:"range",today_:b,minDate:_,maxDate:S})]})})})})})}),EC=ll().createContext(null);function Ek(e){let{children:t}=e,r=(0,ls.useContext)(EC),[n,a]=(0,ls.useState)(0),o=(0,ls.useMemo)(()=>({parent:r,modalCount:n,addModal(){a(e=>e+1),r&&r.addModal()},removeModal(){a(e=>e-1),r&&r.removeModal()}}),[r,n]);return ll().createElement(EC.Provider,{value:o},t)}function EP(e){let t,{modalProviderProps:r}={modalProviderProps:{"aria-hidden":!!(t=(0,ls.useContext)(EC))&&t.modalCount>0||void 0}};return ll().createElement("div",{"data-overlay-container":!0,...e,...r})}function ER(e){return ll().createElement(Ek,null,ll().createElement(EP,e))}function ET(e){let t=mv(),{portalContainer:r=t?null:document.body,...n}=e,{getContainer:a}=vA();if(!e.portalContainer&&a&&(r=a()),ll().useEffect(()=>{if(r?.closest("[data-overlay-container]"))throw Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.")},[r]),!r)return null;let o=ll().createElement(ER,n);return fs().createPortal(o,r)}let EO={},E$=0,EN=!1,EI=null,EM=null;function Ej(e={}){let{delay:t=1500,closeDelay:r=500}=e,{isOpen:n,open:a,close:o}=bF(e),[i,s]=(0,ls.useState)(!1),l=(0,ls.useMemo)(()=>`${++E$}`,[]),u=(0,ls.useRef)(null),c=(0,ls.useRef)(o),d=()=>{EO[l]=f},m=()=>{for(let e in EO)e!==l&&(EO[e](!0,!0),delete EO[e])},p=e=>{u.current&&clearTimeout(u.current),u.current=null,m(),d(),s(!!e),EN=!0,a(),EI&&(clearTimeout(EI),EI=null),EM&&(clearTimeout(EM),EM=null)},f=(e,t)=>{s(!!t),e||r<=0?(u.current&&clearTimeout(u.current),u.current=null,c.current()):u.current||(u.current=setTimeout(()=>{u.current=null,c.current()},r)),EI&&(clearTimeout(EI),EI=null),EN&&(EM&&clearTimeout(EM),EM=setTimeout(()=>{delete EO[l],EM=null,EN=!1},Math.max(500,r)))};return(0,ls.useEffect)(()=>{c.current=o},[o]),(0,ls.useEffect)(()=>()=>{u.current&&clearTimeout(u.current),EO[l]&&delete EO[l]},[l]),{isOpen:n,shouldSkipAnimation:i,open:e=>{e||!(t>0)||u.current?p(EN):(m(),d(),n||EN?n||p(!0):(EI&&clearTimeout(EI),EI=setTimeout(()=>{EI=null,EN=!0,p(!1)},t)))},close:f}}let EA=(0,ls.createContext)(null),EL=(0,ls.createContext)(null);function EF(e){let t=Ej(e),r=(0,ls.useRef)(null),{triggerProps:n,tooltipProps:a}=function(e,t,r){let{isDisabled:n,trigger:a,shouldCloseOnPress:o=!0}=e,i=mD(),s=(0,ls.useRef)(!1),l=(0,ls.useRef)(!1),u=()=>{(s.current||l.current)&&t.open(l.current)},c=e=>{s.current||l.current||t.close(e)};(0,ls.useEffect)(()=>{let e=e=>{r&&r.current&&"Escape"===e.key&&(e.stopPropagation(),t.close(!0))};if(t.isOpen)return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[r,t]);let d=()=>{o&&(l.current=!1,s.current=!1,c(!0))},{hoverProps:m}=fk({isDisabled:n,onHoverStart:()=>{"focus"!==a&&("pointer"===pE?s.current=!0:s.current=!1,u())},onHoverEnd:()=>{"focus"!==a&&(l.current=!1,s.current=!1,c())}}),{focusableProps:p}=p3({isDisabled:n,onFocus:()=>{pj()&&(l.current=!0,u())},onBlur:()=>{l.current=!1,s.current=!1,c(!0)}},r);return{triggerProps:{"aria-describedby":t.isOpen?i:void 0,...mk(p,m,{onPointerDown:d,onKeyDown:d}),tabIndex:void 0},tooltipProps:{id:i}}}(e,t,r);return ll().createElement(mT,{values:[[EA,t],[EL,{...a,triggerRef:r}]]},ll().createElement(p2,{...n,ref:r},e.children))}let EB=(0,ls.forwardRef)(function({UNSTABLE_portalContainer:e,...t},r){[t,r]=mN(t,r,EL);let n=(0,ls.useContext)(EA),a=Ej(t),o=null==t.isOpen&&null==t.defaultOpen&&n?n:a,i=bV(r,o.isOpen),s=t.isExiting||!o.shouldSkipAnimation&&i||!1;return o.isOpen||s?ll().createElement(ET,{portalContainer:e},ll().createElement(EV,{...t,tooltipRef:r,isExiting:s})):null});function EV(e){let t=(0,ls.useContext)(EA),r=(0,ls.useRef)(null),{overlayProps:n,arrowProps:a,placement:o,triggerAnchorPoint:i}=bp({placement:e.placement||"top",targetRef:e.triggerRef,overlayRef:e.tooltipRef,arrowRef:r,offset:e.offset,crossOffset:e.crossOffset,isOpen:t.isOpen,arrowBoundaryOffset:e.arrowBoundaryOffset,shouldFlip:e.shouldFlip,containerPadding:e.containerPadding,onClose:()=>t.close(!0)}),s=bB(e.tooltipRef,!!o),l=e.isEntering||!t.shouldSkipAnimation&&s||!1,u=mO({...e,defaultClassName:"react-aria-Tooltip",values:{placement:o,isEntering:l,isExiting:e.isExiting,state:t}}),{tooltipProps:c}=function(e,t){let r=mY(e,{labelable:!0}),{hoverProps:n}=fk({onHoverStart:()=>t?.open(!0),onHoverEnd:()=>t?.close()});return{tooltipProps:mk(r,n,{role:"tooltip"})}}(e=mk(e,n),t),d=mY(e,{global:!0});return ll().createElement(mL.div,{...mk(d,u,c),ref:e.tooltipRef,style:{...n.style,"--trigger-anchor-point":i?`${i.x}px ${i.y}px`:void 0,...u.style},"data-placement":o??void 0,"data-entering":l||void 0,"data-exiting":e.isExiting||void 0},ll().createElement(vX.Provider,{value:{...a,placement:o,ref:r}},u.children))}let EU=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:r}=ul({externalModuleName:"@openmrs/esm-styleguide"});return(0,lc.jsx)("div",{className:"-esm-report-builder__diagnosis-tags-module__container___B0P1c",children:e.map(e=>{let n=t&&"PROVISIONAL"===e.certainty,a=1===e.rank?r?.primaryColor??"blue":r?.secondaryColor??"gray";return(0,lc.jsx)(EW,{color:a,isProvisional:n,name:e.display},e.uuid)})})};function EW({color:e,isProvisional:t,name:r}){let[n,a]=(0,ls.useState)(!1),[o,i]=(0,ls.useState)(!1),[s,l]=(0,ls.useState)(!1),u=s||o,c=(0,ls.useRef)(null);(0,ls.useLayoutEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let t=e.scrollWidth>e.clientWidth;l(t),t||a(!1)};t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[r,t,u]);let d=ch()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-report-builder__diagnosis-tags-module__diagnosisTag___65CPx"),m=(0,lc.jsxs)(lc.Fragment,{children:[t&&(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("span",{"aria-hidden":"true",className:"-esm-report-builder__diagnosis-tags-module__provisionalMark___XQ8DV",children:"?"}),(0,lc.jsxs)("span",{className:"cds--visually-hidden",children:[aV("provisional","Provisional")," "]})]}),(0,lc.jsx)("span",{ref:c,className:"cds--tag__label",children:r})]});return u?(0,lc.jsxs)(EF,{delay:0,closeDelay:150,isOpen:n,onOpenChange:a,children:[(0,lc.jsx)(fR,{className:d,"data-testid":"diagnosis-tag",onFocusChange:i,onPress:()=>a(!0),children:m}),(0,lc.jsx)(EB,{className:"-esm-report-builder__diagnosis-tags-module__tagTooltip___XQbm8",placement:"bottom",offset:4,containerPadding:8,children:r})]}):(0,lc.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let EH={action:"-esm-report-builder__empty-card-module__action___sBzfy",content:"-esm-report-builder__empty-card-module__content___oLLP3",desktopHeading:"-esm-report-builder__empty-card-module__desktopHeading___61tqo",tabletHeading:"-esm-report-builder__empty-card-module__tabletHeading___8GoOd",tile:"-esm-report-builder__empty-card-module__tile___THTb6"},Ez=({width:e="64",height:t="64"})=>(0,lc.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,lc.jsx)("use",{href:"#omrs-empty-data-illustration"})}),EK=e=>{let t="tablet"===uL(),r=e.launchForm;return(0,lc.jsx)(cw.Wdr,{className:EH.layer,children:(0,lc.jsxs)(cw.FAs,{className:EH.tile,children:[(0,lc.jsx)("div",{className:t?EH.tabletHeading:EH.desktopHeading,children:(0,lc.jsx)("h4",{children:e.headerTitle})}),(0,lc.jsx)(Ez,{}),(0,lc.jsx)("p",{className:EH.content,children:aV("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,lc.jsx)("p",{className:EH.action,children:r&&(0,lc.jsx)(cw.$nd,{onClick:()=>r(),kind:"ghost",size:t?"lg":"sm",children:aV("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},EG=({error:e,headerTitle:t})=>{let r="tablet"===uL();return(0,lc.jsx)(cw.Wdr,{children:(0,lc.jsxs)(cw.FAs,{className:"-esm-report-builder__error-state-module__tile___cCC0p",children:[(0,lc.jsx)("div",{className:r?"-esm-report-builder__error-state-module__tabletHeading___bj95p":"-esm-report-builder__error-state-module__desktopHeading___cT4Z6",children:(0,lc.jsx)("h4",{children:t})}),(0,lc.jsxs)("p",{className:"-esm-report-builder__error-state-module__errorMessage___0VxgF",children:[aV("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,lc.jsx)("p",{className:"-esm-report-builder__error-state-module__errorCopy___eiDlp",children:aV("errorCopy")})]})})},EZ=EG,EY=ll().forwardRef((e,t)=>{let{slotName:r,basePath:n,componentContext:a,state:o}=uV(),i=window.location??{pathname:""},s=lx(r??"");return e.isChildOfHeader&&r&&s.length>0?(0,lc.jsxs)(cw.f8J,{"aria-label":aV("leftNavigation","Left navigation"),className:"-esm-report-builder__left-nav-module__leftNav___+tHzD",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,lc.jsx)(lC,{name:"global-nav-menu-slot"}),r?(0,lc.jsx)(l9,{value:a,fallback:(0,lc.jsx)(lC,{name:r,state:{basePath:n,currentPath:i,...o}}),children:(0,lc.jsx)(lu.Provider,{value:a,children:(0,lc.jsx)(lC,{name:r,state:{basePath:n,currentPath:i,...o}})})}):null]}):null}),Eq=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:r,locationsPerRequest:n=50,onChange:a})=>{let[o,i]=(0,ls.useState)(""),s=(0,ls.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:r,error:n,isLoading:a}=um(t,a3,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,ls.useMemo)(()=>({location:r?.data?.entry?r.data.entry[0]:null,error:t?n:null,isLoading:!!t&&a}),[r,a,n,t])}(t),{locations:u,isLoading:c,hasMore:d,loadingNewData:m,error:p,setPage:f}=function(e,t=0,r=""){let n=uc(r),{data:a,isLoading:o,isValidating:i,setSize:s,error:l}=uP(function(r,a){if(a){let e=a.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let t=new URL(e.url);return t.origin===window.location.origin?e.url:new URL(`${t.pathname}${t.search?`?${t.search}`:""}`,window.location.origin).toString()}let o=`${a1}/Location?`,i=new URLSearchParams;return i.append("_summary","data"),t&&i.append("_count",""+t),r&&i.append("_getpagesoffset",""+r*t),e&&i.append("_tag",e),"string"==typeof n&&""!==n&&i.append("name:contains",n),o+i.toString()},a3);return(0,ls.useMemo)(()=>({locations:a?.length?a?.flatMap(e=>e?.data?.entry??[]):[],isLoading:o,totalResults:a?.[0]?.data?.total,hasMore:!!a?.length&&a?.[a.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:i,error:l||null,setPage:s}),[o,a,i,s,l])}(r,n,o),h=(0,ls.useMemo)(()=>l&&!o&&t?[l,...u.filter(({resource:e})=>e.id!==t)]:u??[],[l,u,t,o]),g=(0,ls.useCallback)(e=>{a(),i(e.trim())},[a]),y=uz((0,ls.useCallback)(()=>{!m&&d&&f(e=>e+1)},[m,d,f])),v=d?Math.max(0,Math.floor(h.length-n/2)):-1;return(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)(cw.vji,{"aria-describedby":p?`${s}-error`:void 0,labelText:aV("searchForLocation"),id:s,placeholder:aV("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),p&&(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__errorNotification___sh9BG",id:`${s}-error`,children:(0,lc.jsx)(cw.jeF,{kind:"error",subtitle:aV("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:aV("error","Error")})}),(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__searchResults___gvBsQ",children:c?(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__loadingContainer___PR-AY",children:Array.from({length:5}).map((e,t)=>(0,lc.jsx)(cw.Psq,{className:"-esm-report-builder__location-picker-module__radioButtonSkeleton___Y913N",role:"progressbar"},t))}):(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__locationResultsContainer___eH1Nw",children:h.length>0?(0,lc.jsx)(cw.zWQ,{name:"loginLocations",onChange:e=>{a(e?.toString())},orientation:"vertical",valueSelected:e,children:h.map((e,t)=>(0,lc.jsx)(cw.aaP,{className:"-esm-report-builder__location-picker-module__locationRadioButton___5tzhj",id:e.resource.id,labelText:(0,lc.jsx)("span",{ref:t===v?y:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__emptyState___+68uf",children:(0,lc.jsx)("p",{className:"-esm-report-builder__location-picker-module__locationNotFound___PBqCF",children:aV("noResultsToDisplay")})})}),m&&(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__loadingIcon___fSVp7",children:(0,lc.jsx)(cw.OuH,{description:aV("loading")})})]})})]})},EJ=F("modalState",{modalContainer:null,modalStack:[]}),EX=0;async function EQ(e,t,r={}){let n=s1(t),a=null;if(e){if(!n)throw Error(`No modal named '${t}' has been registered.`);let{load:o}=n,i=await o(),s=EX++;a=await ln({...i,name:`${t}-${s}`},{...r,domElement:e})}else C(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return a}function E0(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function E1(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function E4(e){return e.find(e=>!E0(e))}function E2(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let E3=window.getComputedStyle(document.body).overflow;function E6({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",E9),document.body.style.overflow="hidden",t.style.visibility="unset");let r=E4(e);e.forEach(e=>{switch(e.state){case"NEW":{let r=function({size:e}){let t=document.createElement("div");return t.className=`cds--modal-container cds--modal-container--${e}`,t.setAttribute("role","dialog"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-modal","true"),t}({size:e.props?.size??"md"});e.container=r,e.state="MOUNTING",EQ(r,e.modalName,e.props).then(n=>{E0(e)?E1(e.modalName,n):n?(e.parcel=n,t.prepend(r),E2(e,E4(EJ.getState().modalStack)===e),n.mountPromise.then(()=>{E0(e)||(e.state="MOUNTED")},t=>{C(t),e.parcel=null,E5(e)})):E5(e)},t=>{C(t),E5(e)});break}case"MOUNTING":case"MOUNTED":E2(e,e===r);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),E1(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=EJ.getState();EJ.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=E3,removeEventListener("keydown",E9)}function E5(e){if(E0(e))return;e.state="TO_BE_DELETED";let t=EJ.getState();EJ.setState({...t,modalStack:[...t.modalStack]})}function E9(e){"Escape"===e.key&&function(){let[e]=EJ.getState().modalStack;e&&E5(e)}()}function E8(e){EJ.subscribe(E6),EJ.setState({...EJ.getState(),modalContainer:e})}function E7(e,t={},r=()=>{}){let n=()=>{let e=EJ.getState().modalStack.find(e=>e.onClose===r);e&&E5(e)};if(s1(e)){var a;let o,i;a={state:"NEW",onClose:r,modalName:e,props:{close:n,...t}},i=[a,...(o=EJ.getState()).modalStack],EJ.setState({...o,modalStack:i})}else C(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return n}var De=Object.prototype.hasOwnProperty;let Dt=function(e){if(null==e)return!0;if(td(e)&&(tu(e)||"string"==typeof e||"function"==typeof e.splice||th(e)||tx(e)||tl(e)))return!e.length;var t=rE(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(tr(e))return!rt(e).length;for(var r in e)if(De.call(e,r))return!1;return!0},Dr=({notification:e})=>{let{description:t,action:r,kind:n,critical:a,title:o,onAction:i}=e;return(0,lc.jsx)(cw.kZS,{actionButtonLabel:r,kind:n||"info",lowContrast:a,subtitle:t,title:o||"",inline:!0,onActionButtonClick:i})},Dn=({subject:e})=>{let[t,r]=(0,ls.useState)([]);return(0,ls.useEffect)(()=>{let t=e.subscribe(e=>r(t=>[...t.filter(t=>t.description!==e.description||t.action!==e.action||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,lc.jsx)(lc.Fragment,{children:t.map(e=>(0,lc.jsx)(Dr,{notification:e},e.id))})},Da=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:r=()=>{},subtitle:n,kind:a,title:o,critical:i,progressActionLabel:s,id:l,...u}=e,[c,d]=(0,ls.useState)(t);return(0,lc.jsx)(cw.kZS,{kind:a||"info",actionButtonLabel:c,"aria-label":aV("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{r(),s&&d(s)},statusIconDescription:aV("actionableNotification","Actionable notification"),subtitle:n,title:o,lowContrast:i,inline:!0,...u})},Do=({subject:e})=>{let[t,r]=(0,ls.useState)([]);return(0,ls.useEffect)(()=>{let t=e.subscribe(e=>r(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,lc.jsx)(lc.Fragment,{children:t.map(e=>(0,lc.jsx)(Da,{notification:e},e.id))})};class Di{subscribe(e){return this.listeners.add(e),{unsubscribe:()=>{this.listeners.delete(e)}}}next(e){for(let t of[...this.listeners])t(e)}constructor(){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"listeners",new Set)}}let Ds=new Di,Dl=0,Du=new Di,Dc=0;function Dd(e){e&&(0,lk.createRoot)(e).render((0,lc.jsx)(Dn,{subject:Ds}))}function Dm(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!Dt(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{Ds.next({...e,id:Dl++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function Dp(e){e&&(0,lk.createRoot)(e).render((0,lc.jsx)(Do,{subject:Du}))}function Df(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!Dt(t))?setTimeout(()=>{Du.next({...e,id:Dc++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let Dh=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],Dg=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],Dy={container:"-esm-report-builder__numeric-observation-module__container___YMIz1",card:"-esm-report-builder__numeric-observation-module__card___ZLBwz","abnormal-value":"-esm-report-builder__numeric-observation-module__abnormal-value___bzIYd","critical-value":"-esm-report-builder__numeric-observation-module__critical-value___S2-yh",cell:"-esm-report-builder__numeric-observation-module__cell___ZiLtj","critically-high":"-esm-report-builder__numeric-observation-module__critically-high___NaPDB","critically-low":"-esm-report-builder__numeric-observation-module__critically-low___S29+P",high:"-esm-report-builder__numeric-observation-module__high___qk85l",low:"-esm-report-builder__numeric-observation-module__low___Rh+hW","label-container":"-esm-report-builder__numeric-observation-module__label-container___OHVTn","value-container":"-esm-report-builder__numeric-observation-module__value-container___-5c7b",label:"-esm-report-builder__numeric-observation-module__label___MVUkz",value:"-esm-report-builder__numeric-observation-module__value___Ne+ED",units:"-esm-report-builder__numeric-observation-module__units___7BIK5","pad-right":"-esm-report-builder__numeric-observation-module__pad-right___8vJsT","off-scale-low":"-esm-report-builder__numeric-observation-module__off-scale-low___3TolK","off-scale-high":"-esm-report-builder__numeric-observation-module__off-scale-high___xMngl",arrow:"-esm-report-builder__numeric-observation-module__arrow___6Jyji"},Dv=({value:e,unit:t,label:r,interpretation:n,referenceRange:a,conceptUuid:o,variant:i="card",patientUuid:s})=>{let l=(0,ls.useId)(),{referenceRange:u,isLoading:c}=function(e,t){let r=null;e&&(r=t?`${a0}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${a0}/conceptreferencerange/?concept=${e}&v=full`);let{data:n,error:a,isLoading:o}=um(r,a3),i=n?.data?.results?.[0];return{referenceRange:i?{hiNormal:i.hiNormal??null,hiAbsolute:i.hiAbsolute??null,hiCritical:i.hiCritical??null,lowNormal:i.lowNormal??null,lowAbsolute:i.lowAbsolute??null,lowCritical:i.lowCritical??null}:void 0,error:a,isLoading:o}}(a||n?void 0:o,s),d=a??u,m=(0,ls.useMemo)(()=>{if(n)return n?"--"===n?"normal":Dh.includes(n)?n.toLowerCase():Dg.includes(n)?n:"normal":void 0;if(d&&!c){if(!d||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==d.hiAbsolute&&void 0!==d.hiAbsolute&&t>d.hiAbsolute?"off_scale_high":null!==d.hiCritical&&void 0!==d.hiCritical&&t>=d.hiCritical?"critically_high":null!==d.hiNormal&&void 0!==d.hiNormal&&t>d.hiNormal?"high":null!==d.lowAbsolute&&void 0!==d.lowAbsolute&&t<d.lowAbsolute?"off_scale_low":null!==d.lowCritical&&void 0!==d.lowCritical&&t<=d.lowCritical?"critically_low":null!==d.lowNormal&&void 0!==d.lowNormal&&t<d.lowNormal?"low":"normal"}return"normal"},[n,d,e,c])??"normal",p="critically_low"===m||"critically_high"===m||"off_scale_low"===m||"off_scale_high"===m,f="normal"!==m,h=r?`omrs-numeric-obs-label-${r.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,y=`omrs-numeric-obs-unit-${l}`,v=null!=e&&""!==e,b=v?e:aV("notAvailable","Not available"),w=ch()({[Dy["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[Dy["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[Dy.low]:"low"===m,[Dy.high]:"high"===m,[Dy["off-scale-low"]]:"off_scale_low"===m,[Dy["off-scale-high"]]:"off_scale_high"===m}),E=ch()({[Dy.container]:!0,[Dy.card]:!0,[Dy["critical-value"]]:p,[Dy["abnormal-value"]]:f&&!p}),D=ch()({[Dy.cell]:!0,[w]:!0});return"cell"===i?(0,lc.jsxs)("div",{className:D,children:[b,v&&t?` ${t}`:""]}):(0,lc.jsxs)("section",{className:E,"data-testid":"numeric-observation-card",children:[r&&(0,lc.jsxs)("div",{className:Dy["label-container"],children:[(0,lc.jsx)("span",{id:h,className:Dy.label,children:r}),f&&(0,lc.jsx)("span",{className:Dy[m.replace("_","-")],title:aV("abnormalValue","Abnormal value")})]}),(0,lc.jsxs)("div",{className:Dy["value-container"],children:[(0,lc.jsx)("span",{id:g,"aria-labelledby":h&&y?`${h} ${y}`:h||y||void 0,className:Dy.value,children:b}),v&&t&&(0,lc.jsx)("span",{id:y,className:Dy.units,children:t})]})]})},Db="-esm-report-builder__page-header-module__pageHeader___sRmJ1",Dw=e=>{if("children"in e){let{children:t,className:r,...n}=e;return(0,lc.jsx)("div",{className:ch()(Db,r),...n,children:t})}{let{title:t,illustration:r,className:n,...a}=e;return(0,lc.jsx)("div",{className:ch()(Db,n),...a,children:(0,lc.jsx)(DE,{title:t,illustration:r})})}},DE=({title:e,illustration:t,className:r})=>{let[n,a]=(0,ls.useState)(null);return(0,ls.useEffect)(()=>{n1("@openmrs/esm-styleguide").then(e=>{a(e)})},[]),(0,lc.jsxs)("div",{className:ch()("-esm-report-builder__page-header-module__pageHeaderContent___9CRks",r),children:[t,(0,lc.jsxs)("div",{className:"-esm-report-builder__page-header-module__pageLabels___mIsS6",children:[n?.implementationName&&(0,lc.jsx)("p",{children:aV(n.implementationName)}),(0,lc.jsx)("h1",{className:"-esm-report-builder__page-header-module__pageName___kvdCd",children:e})]})]})},DD=({totalItems:e,pageSize:t,onPageNumberChange:r,pageNumber:n,dashboardLinkUrl:a,currentItems:o,dashboardLinkLabel:i})=>{let{pageSizes:s,pageItemsCount:l}=uZ(t,e,n,o),u="tablet"===uL(),c=aV("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,lc.jsx)(lc.Fragment,{children:e>0&&(0,lc.jsxs)("div",{className:ch()({"-esm-report-builder__pagination-module__tablet___-EohH":u,"-esm-report-builder__pagination-module__desktop___lJwLA":!u}),children:[(0,lc.jsxs)("div",{children:[c,a&&(0,lc.jsx)(ld,{to:a,className:"-esm-report-builder__pagination-module__configurableLink___f-IJ9",children:i??aV("seeAll","See all")})]}),(0,lc.jsx)(cw.dKS,{className:"-esm-report-builder__pagination-module__pagination___XBkRY",page:n,pageSize:t,pageSizes:s,totalItems:e,onChange:r,pageRangeText:(e,t)=>aV("paginationOfPages","of {{count}} pages",{count:t}),size:u?"lg":"sm"})]})})};function Dx(e){return DS(Dk(e,"usual","official"))}function D_(e){return Dx(e)}function DS(e){var t;let r;return e?e.text??(r=(t=e).given??[],(t.family?r.concat(t.family):r).join(" ")):""}function DC(e){return DS(e)}function Dk(e,...t){for(let r of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,n;return t=e,n=r,t.use?t.use===n:"usual"===n});if(t)return t}}function DP(e,t=u4()){let r=u4(t),n=wZ(e,r);if(null==n)return null;let a=r.diff(n,"hours"),o=r.diff(n,"days"),i=r.diff(n,"weeks"),s=r.diff(n,"months"),l=r.diff(n,"years"),u={};if(a<2)u.minutes=r.diff(n,"minutes");else if(o<2)u.hours=a;else if(i<4)u.days=o;else if(l<1){let e=r.subtract(i,"weeks").diff(n,"days");u.weeks=i,u.days=e}else if(l<2){let e=r.subtract(s,"months").diff(n,"days");u.months=s,u.days=e}else if(l<18){let e=r.subtract(l,"year").diff(n,"months");u.years=l,u.months=e}else u.years=l;return u}function DR(e,t=u4()){let r=DP(e,t);if(null==r)return null;let n={style:"short",localeMatcher:"lookup"};return"minutes"in r&&0===r.minutes&&(n.minutesDisplay="always"),wG(r,n)}let DT={container:"-esm-report-builder__patient-banner-patient-info-module__container___SbFly",activePatientContainer:"-esm-report-builder__patient-banner-patient-info-module__activePatientContainer___dPAI3",patientBanner:"-esm-report-builder__patient-banner-patient-info-module__patientBanner___RKK5o",patientName:"-esm-report-builder__patient-banner-patient-info-module__patientName___N4cBt",patientAvatar:"-esm-report-builder__patient-banner-patient-info-module__patientAvatar___S5B6e",patientAvatarButton:"-esm-report-builder__patient-banner-patient-info-module__patientAvatarButton___b4TpF",patientInfo:"-esm-report-builder__patient-banner-patient-info-module__patientInfo___k4TpF",demographics:"-esm-report-builder__patient-banner-patient-info-module__demographics___kUxEK",row:"-esm-report-builder__patient-banner-patient-info-module__row___aBH+R",flexRow:"-esm-report-builder__patient-banner-patient-info-module__flexRow___iE9YF",tagsSlot:"-esm-report-builder__patient-banner-patient-info-module__tagsSlot___qQx0X",identifiers:"-esm-report-builder__patient-banner-patient-info-module__identifiers___S+i2W",identifier:"-esm-report-builder__patient-banner-patient-info-module__identifier___V3fBY",primaryIdentifier:"-esm-report-builder__patient-banner-patient-info-module__primaryIdentifier___MGool",secondaryIdentifier:"-esm-report-builder__patient-banner-patient-info-module__secondaryIdentifier___ORbJn",value:"-esm-report-builder__patient-banner-patient-info-module__value___rZXrd",tag:"-esm-report-builder__patient-banner-patient-info-module__tag___l5yM7",gender:"-esm-report-builder__patient-banner-patient-info-module__gender___pBoq+",separator:"-esm-report-builder__patient-banner-patient-info-module__separator___kqhkj",tooltipPadding:"-esm-report-builder__patient-banner-patient-info-module__tooltipPadding___aca85",tooltipSmallText:"-esm-report-builder__patient-banner-patient-info-module__tooltipSmallText___KSHWn",actionsButtonText:"-esm-report-builder__patient-banner-patient-info-module__actionsButtonText___dfkx2"};function DO({showIdentifierLabel:e,type:t,value:r}){return(0,lc.jsx)("span",{className:DT.primaryIdentifier,children:(0,lc.jsxs)(cw.vwO,{className:DT.tag,type:"gray",children:[e&&t?.text&&(0,lc.jsxs)("span",{className:DT.label,children:[t.text,": "]}),(0,lc.jsx)("span",{className:DT.value,children:r})]})})}function D$({showIdentifierLabel:e,type:t,value:r}){return(0,lc.jsxs)(cw.lRv,{className:DT.secondaryIdentifier,id:`patient-banner-identifier-${r}`,children:[e&&(0,lc.jsxs)("span",{className:DT.label,children:[t?.text,": "]}),(0,lc.jsx)("span",{className:DT.value,children:r})]})}function DN({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:r}=ul(),{primaryIdentifierCode:n}=uJ(),a=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!r?.uuids.includes(t)})??[];return(0,lc.jsx)(lc.Fragment,{children:a?.length?a.map(({value:e,type:r},o)=>(0,lc.jsxs)(ll().Fragment,{children:[(0,lc.jsx)("span",{className:DT.identifier,children:r?.coding?.[0]?.code===n?(0,lc.jsx)(DO,{showIdentifierLabel:t,type:r,value:e}):(0,lc.jsx)(D$,{showIdentifierLabel:t,type:r,value:e})}),o<a.length-1&&(0,lc.jsx)("span",{className:DT.separator,children:"\xb7"})]},e)):""})}let DI={Female:dr,Male:dn,Other:da,Unknown:di},DM=({gender:e})=>{let t=DI[e];return t?(0,lc.jsx)(t,{fill:"#525252"}):null},Dj={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function DA({patient:e,renderedFrom:t}){var r;let n,a,o=Dx(e),i=e?.gender&&(a=Dj[n=(r=e.gender).toLowerCase()]??"Unknown",{displayText:aV(n,r),iconKey:a}),s=(0,ls.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,lc.jsxs)("div",{className:DT.patientInfo,children:[(0,lc.jsx)("div",{className:ch()(DT.row,DT.patientNameRow),children:(0,lc.jsxs)("div",{className:DT.flexRow,children:[(0,lc.jsx)("span",{className:DT.patientName,children:o}),i&&(0,lc.jsxs)("div",{className:DT.gender,children:[(0,lc.jsx)(DM,{gender:i.iconKey}),(0,lc.jsx)("span",{children:i.displayText})]}),(0,lc.jsx)(lC,{className:DT.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,lc.jsxs)("div",{className:DT.demographics,children:[e.birthDate&&(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("span",{children:DR(e.birthDate)}),(0,lc.jsx)("span",{className:DT.separator,children:"\xb7"}),(0,lc.jsx)("span",{children:wV(e.birthDate,{time:!1,noToday:!0})}),(0,lc.jsx)("span",{className:DT.separator,children:"\xb7"})]}),(0,lc.jsx)(DN,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,lc.jsx)(lC,{className:DT.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var DL=r(1673);function DF({patient:e,patientUuid:t,actionsSlotName:r,additionalActionsSlotState:n}){let[a,o]=(0,ls.useState)(!1),{extensions:i}=l_(r),s="tablet"===uL(),l=uH(()=>o(!1),a),u=(0,ls.useRef)(null),c=(0,ls.useRef)(null),d=(0,ls.useId)(),m=`patient-actions-menu-trigger-${d}`,p=`patient-actions-menu-${d}`,f=(0,ls.useCallback)(()=>o(e=>!e),[]),h=(0,ls.useCallback)(()=>{o(!1),u.current?.focus()},[]),g=(0,ls.useCallback)(e=>{if("Escape"===e.key&&a){e.stopPropagation(),h();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&a){e.preventDefault();let t=c.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!t?.length)return;let r=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,n=Array.from(t).indexOf(r);if(-1===n)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let a=n+("ArrowDown"===e.key?1:-1),o=a<0?t.length-1:a>=t.length?0:a;t[o]?.focus()}},[h,a]);(0,ls.useEffect)(()=>{if(a&&c.current){let e=c.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[a]);let y=(0,ls.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:h,...n}),[t,e,h,n]);return 0===i.length?null:(0,lc.jsx)("div",{className:"-esm-report-builder__patient-banner-actions-menu-module__overflowMenuContainer___kcHLp",children:(0,lc.jsxs)("div",{"data-overflow-menu":!0,className:ch()("cds--overflow-menu",cx),ref:l,children:[(0,lc.jsxs)("button",{className:ch()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":a},cC),"aria-controls":p,"aria-expanded":a,"aria-haspopup":"true",id:m,onClick:f,onKeyDown:g,ref:u,children:[(0,lc.jsx)("span",{className:"-esm-report-builder__patient-banner-actions-menu-module__actionsButtonText___w2rar",children:aV("actions","Actions")})," ",(0,lc.jsx)(DL.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,lc.jsxs)("div",{className:ch()("cds--overflow-menu-options","cds--overflow-menu--flip",c_,{[cS]:a}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:p,onKeyDown:g,ref:c,role:"menu",tabIndex:-1,children:[(0,lc.jsx)("ul",{className:ch()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,lc.jsx)(lC,{name:r,state:y},r)}),(0,lc.jsx)("span",{})]})]})})}var DB=r(6767),DV=r.n(DB);function DU(e){let{patientPhotoConceptUuid:t}=ul({externalModuleName:"@openmrs/esm-styleguide"}),r=t?`${a0}/obs?patient=${e}&concept=${t}&v=full`:null,{data:n,error:a,isLoading:o}=(0,lW.u)(e?r:null,a3),i=n?.data?.results[0];return{data:i?{dateTime:i?.obsDatetime,imageSrc:i?.value?.links?.uri}:null,error:a,isLoading:o}}let DW=({width:e=56,height:t=56,"aria-label":r})=>{let{t:n}=(0,lU.useTranslation)();return(0,lc.jsxs)("svg",{"aria-label":r??n("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,lc.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,lc.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m36.75 20.134-.884-.884L19.25 35.866l.884.884 1.25-1.25H34.25a1.252 1.252 0 0 0 1.25-1.25V21.384l1.25-1.25Zm-2.5 14.116H22.634l4.87-4.87 1.487 1.486a1.25 1.25 0 0 0 1.768 0l.991-.991 2.5 2.498v1.877Zm0-3.645-1.616-1.616a1.25 1.25 0 0 0-1.768 0l-.991.991-1.486-1.486 5.861-5.86v7.971Zm-12.5 1.145v-1.875l3.125-3.123.858.859.885-.885-.86-.86a1.25 1.25 0 0 0-1.767 0l-2.241 2.242V21.75h10V20.5h-10c-.69 0-1.25.56-1.25 1.25v10h1.25Z",fill:"#8D8D8D"})]})},DH="-esm-report-builder__patient-photo-module__avatar___SjWI2";function Dz({patientUuid:e,patientName:t,alt:r}){let{data:n,isLoading:a}=DU(e),[o,i]=(0,ls.useState)(null),[s,l]=(0,ls.useState)(!1),u=(0,ls.useMemo)(()=>DV().generate(e),[e]);(0,ls.useEffect)(()=>{if(n?.imageSrc){let e=new URL(n.imageSrc,window.location.origin).pathname;l(!0);let t=!1,r=new Image;return r.onload=()=>{t||(i(e),l(!1))},r.onerror=()=>{t||(i(null),l(!1))},r.src=e,()=>{t=!0}}i(null),l(!1)},[n?.imageSrc]);let c=(0,ls.useMemo)(()=>r||(o?aV("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):aV("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[r,o,t]);return a||s?(0,lc.jsx)(cw.ryE,{className:"-esm-report-builder__patient-photo-module__skeleton___YkxcQ","data-testid":"skeleton-icon"}):n?.imageSrc&&!o?(0,lc.jsx)(DW,{"aria-label":aV("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):o?(0,lc.jsx)("div",{"aria-label":c,children:(0,lc.jsx)("img",{className:DH,src:o,alt:c,title:t})}):(0,lc.jsx)("div",{"aria-label":c,children:(0,lc.jsx)("div",{className:DH,title:t,style:{backgroundImage:u.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,lc.jsx)("span",{className:"-esm-report-builder__patient-photo-module__initials___GrIHj",children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}let DK=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-cohorts","omrs-pict-concept-dictionary","omrs-pict-ct-scan","omrs-pict-data-entry","omrs-pict-dentistry","omrs-pict-digital-trust","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-metadata-export","omrs-pict-obstetrics","omrs-pict-patient-documents","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-reports","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-system-administration","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],DG=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),DZ=DG,DY=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),Dq=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),DJ=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),DX=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),DQ=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),D0=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),D1=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),D4=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),D2=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),D3=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),D6=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),D5=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),D9=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),D8=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),D7=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),xe=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),xt=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),xr=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),xn=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),xa=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),xo=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),xi=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),xs=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),xl=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),xu=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),xc=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),xd=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),xm=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),xp=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),xf=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),xh=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),xg=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),xy=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xE,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),xv=D5,xb=xi,xw=(0,ls.memo)((0,ls.forwardRef)(function({pictogram:e,fallback:t,...r},n){let a=(0,ls.useRef)(document.getElementById(e));return(0,ls.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),r=new MutationObserver(t=>{for(let r of t)"childList"===r.type&&(a.current=document.getElementById(e))});return t&&r.observe(t,{childList:!0}),()=>r.disconnect()},[e]),(0,lc.jsx)(l9,{value:a.current,fallback:t,children:(0,lc.jsx)(xE,{ref:n,pictogram:e,pictogramProps:r})})})),xE=(0,ls.memo)((0,ls.forwardRef)(function({pictogram:e,pictogramProps:t},r){let{className:n,size:a}=Object.assign({},{size:92},t);return(a<=26||a>144)&&(console.error(`Invalid size '${a}' specified for ${e}. Defaulting to 92.`),a=92),(0,lc.jsx)("svg",{ref:r,className:ch()("-esm-report-builder__pictograms-module__pictogram___ej8c6",n),height:a,width:a,children:(0,lc.jsx)("use",{href:`#${e}`})})})),xD=({children:e})=>"tablet"===uL()?(0,lc.jsx)(cw.Wdr,{children:e}):(0,lc.jsx)(lc.Fragment,{children:e}),xx=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:r="",kind:n="success",onActionButtonClick:a=()=>{},isLowContrast:o="error"!==n,progressActionLabel:i,subtitle:s="",timeoutInMs:l=5e3,autoClose:u="error"!==n,title:c,id:d,...m}=e,[p,f]=(0,ls.useState)(r),[h,g]=(0,ls.useState)(!0),[y,v]=(0,ls.useState)(!1),b=(0,ls.useCallback)(()=>{setTimeout(t,250)},[t]),w=(0,ls.useCallback)(()=>{v(!0),b()},[b]);return(0,ls.useEffect)(()=>{if(u){let e=setTimeout(w,l);return()=>clearTimeout(e)}},[l,u,w]),(0,ls.useEffect)(()=>{g(!1),window.setTimeout(()=>{g(!0)},0)},[]),(0,lc.jsx)(cw.kZS,{actionButtonLabel:p,"aria-label":aV("closeSnackbar","Close snackbar"),className:ch()("-esm-report-builder__snackbar-module__slideIn___hMvlf",{"-esm-report-builder__snackbar-module__animated___c+ZXw":h,"-esm-report-builder__snackbar-module__slideOut___ymbgm":y}),kind:n,lowContrast:o,onActionButtonClick:()=>{a(),w(),i&&f(i)},onClose:b,statusIconDescription:aV("snackbarNotification","Snackbar notification"),subtitle:s,title:c,...m})},x_=({subject:e})=>{let[t,r]=(0,ls.useState)([]),n=(0,ls.useCallback)(e=>{r(t=>t.filter(t=>t!==e))},[]);return(0,ls.useEffect)(()=>{let t=e.subscribe(e=>r(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,lc.jsx)(lc.Fragment,{children:t.map(e=>(0,lc.jsx)(xx,{snackbar:e,closeSnackbar:()=>n(e)},e.id))})},xS=new Di,xC=0;function xk(e){e&&(0,lk.createRoot)(e).render((0,lc.jsx)(x_,{subject:xS}))}function xP(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{xS.next({...e,id:xC++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let xR=({toast:e,closeToast:t})=>{let{description:r,kind:n,critical:a,title:o,actionButtonLabel:i,onActionButtonClick:s=()=>{}}=e,l=(0,ls.useCallback)(()=>{s(),t()},[t,s]);return(0,lc.jsx)("div",{children:(0,lc.jsx)(cw.kZS,{actionButtonLabel:i,kind:n||"info",lowContrast:a,subtitle:r,title:o||"",onActionButtonClick:l,onClose:t})})},xT=({subject:e})=>{let[t,r]=(0,ls.useState)([]),n=(0,ls.useCallback)(e=>{r(t=>t.filter(t=>t!==e))},[]);return(0,ls.useEffect)(()=>{let t=e.subscribe(e=>r(t=>[...t.filter(t=>t.description!==e.description||t.kind!==e.kind||t.title!==e.title||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick),e]));return()=>t.unsubscribe()},[e]),(0,lc.jsx)(lc.Fragment,{children:t.map(e=>(0,lc.jsx)(xR,{toast:e,closeToast:()=>n(e)},e.id))})},xO=new Di,x$=0;function xN(e){e&&(0,lk.createRoot)(e).render((0,lc.jsx)(xT,{subject:xO}))}function xI(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!Dt(t))?setTimeout(()=>{xO.next({...e,id:x$++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}let xM="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xj=new Uint8Array(16),xA=[];for(let e=0;e<256;++e)xA.push((e+256).toString(16).slice(1));let xL=function(e,t,r){if(xM&&!t&&!e)return xM();let n=(e=e||{}).random??e.rng?.()??function(){if(!c){if("u"<typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");c=crypto.getRandomValues.bind(crypto)}return c(xj)}();if(n.length<16)throw Error("Random bytes length must be >= 16");if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){if((r=r||0)<0||r+16>t.length)throw RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return(xA[e[t+0]]+xA[e[t+1]]+xA[e[t+2]]+xA[e[t+3]]+"-"+xA[e[t+4]]+xA[e[t+5]]+"-"+xA[e[t+6]]+xA[e[t+7]]+"-"+xA[e[t+8]]+xA[e[t+9]]+"-"+xA[e[t+10]]+xA[e[t+11]]+xA[e[t+12]]+xA[e[t+13]]+xA[e[t+14]]+xA[e[t+15]]).toLowerCase()}(n)};async function xF(e,t){let{openedGroup:r}=s4.getState();if(r){if(r.groupName===e&&xU(r.props,t))return!0;else if(!await xz({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return s4.setState(r=>({...r,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function xB(e){let{openedGroup:t,openedWindows:r}=s4.getState();if(t){if(r.length>0&&!(e||await xz({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;s4.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function xV(e,t=null,r=null,n=null){let a=s4.getState();if(!a.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let o=s2(e);if(!o)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:i}=a,{name:s}=o,l=s3(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${o.name} is not registered to a workspace group`);let u=s6(e);if(i&&(i.groupName!==l.name||!xU(i.props,n)))return!!await xz({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(s4.setState({...a,openedGroup:{groupName:l.name,props:n},openedWindows:[{windowName:s,openedWorkspaces:[x4(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(u>=0){let n=a.openedWindows[u],o=a.openedGroup?.props??{},i=a.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:c}=n;if(xU(n.props,r)){let d=c.find(t=>t.workspaceName===e);return d&&xU(d.props,t)?((i||u!==a.openedWindows.length-1)&&s4.setState(xJ.restoreWindow(a,s)),!0):!!await xz({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(s4.setState({...a,openedGroup:{groupName:l.name,props:a?.openedGroup?.props??o},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[x4(e,t)],props:n?.props??r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await xz({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(s4.setState({...a,openedGroup:{groupName:l.name,props:o??a?.openedGroup?.props},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[x4(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(s4.setState({...a,openedGroup:{groupName:l.name,props:n??a?.openedGroup?.props??null},openedWindows:[...a.openedWindows,{windowName:s,openedWorkspaces:[x4(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await xz({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:o.name})&&(s4.setState({...a,openedGroup:{groupName:l.name,props:n??a?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[x4(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function xU(e,t){return null==e||null==t||R(e,t)}function xW(e,t){let r=[];for(let n=e.openedWorkspaces.length-1;n>=0;n--){let a=e.openedWorkspaces[n];if(a.hasUnsavedChanges&&r.push(a),t&&a.workspaceName===t)break}return r}function xH(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let r=E7("workspace2-close-prompt",{size:"sm",onConfirm:()=>{r(),t(!0)},onCancel:()=>{r(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function xz(e){let{openedWindows:t}=s4.getState(),r=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":r=t.flatMap(e=>xW(e));break;case"CLOSE_WINDOW":{let n=t.find(t=>t.windowName===e.windowName);if(!n)throw Error(`Window ${e.windowName} not found in opened windows.`);r=xW(n);break}case"CLOSE_WORKSPACE":{let n=t.find(t=>t.windowName===e.windowName);if(!n)throw Error(`Window ${e.windowName} not found in opened windows.`);r=xW(n,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":r=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>xW(e))}return xH(r)}function xK(e,t){return xH(xW(e,t))}function xG(e,t){let r=e.openedWorkspaces.findIndex(e=>e.workspaceName===t);return r<0?e:0===r?null:{...e,openedWorkspaces:e.openedWorkspaces.slice(0,r)}}function xZ(e,t,r,n){let{registeredWorkspacesByName:a}=s4.getState(),o=a[r];if(!o)throw Error(`No workspace named "${r}" registered`);let i=a[t];if(!i)throw Error(`No workspace named "${t}" registered`);if(i.window!==o.window)throw Error(`Child workspace ${r} does not belong to the same workspace window as parent workspace ${t}`);if(o.window!==e.windowName)throw Error(`Cannot open child workspace ${r} as window ${o.window} is not opened`);let{openedWorkspaces:s}=e,l=s.findIndex(e=>e.workspaceName===t);if(-1===l)throw Error(`Cannot open child workspace ${r} from parent workspace ${t} as the parent is not opened within the workspace window`);let u=s.slice(0,l+1);return{...e,openedWorkspaces:[...u,x4(r,n)]}}function xY(e,t,r){let n=e.openedWorkspaces.findIndex(e=>e.uuid===t);if(n<0)return e;let a=e.openedWorkspaces[n];if(Object.keys(r).every(e=>a[e]===r[e]))return e;let o=[...e.openedWorkspaces];return o[n]={...a,...r},{...e,openedWorkspaces:o}}function xq(e,t,r){let n=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.uuid===t));if(n<0)return e;let a=e.openedWindows[n],o=xY(a,t,r);if(o===a)return e;let i=[...e.openedWindows];return i[n]=o,{...e,openedWindows:i}}let xJ={setWindowMaximized(e,t,r){let n=e.openedWindows.findIndex(e=>e.windowName===t),a=[...e.openedWindows],o={...a[n],maximized:r};return a[n]=o,{...e,openedWindows:a}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let r=e.openedWindows.findIndex(e=>e.windowName===t),n=e.openedWindows[r],a=[...e.openedWindows.filter((e,t)=>t!==r),n];return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let r=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.workspaceName===t));if(r<0)return e;let n=xG(e.openedWindows[r],t),a=[...e.openedWindows],o=e.isMostRecentlyOpenedWindowHidden;if(null===n){let t=r===e.openedWindows.length-1;a.splice(r,1),t&&a.length>0&&(o=!1)}else a[r]=n;return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:o}},openChildWorkspace(e,t,r,n){let a=e.registeredWorkspacesByName[r];if(!a)throw Error(`No workspace named "${r}" registered`);let o=e.openedWindows.findIndex(e=>e.windowName===a.window);if(-1==o)throw Error(`Cannot open child workspace ${r} as window ${a.window} is not opened`);let i=[...e.openedWindows];return i[o]=xZ(e.openedWindows[o],t,r,n),{...e,openedWindows:i}},setHasUnsavedChanges:(e,t,r)=>xq(e,t,{hasUnsavedChanges:r}),setWorkspaceTitle:(e,t,r)=>xq(e,t,{title:r})};function xX(){return ly(s4,xJ)}let xQ=()=>(0,ls.useContext)(lI),x0=()=>Object.keys(s4.getState().registeredWorkspacesByName);function x1(e,t,r){let n=e.openedWorkspaces[e.openedWorkspaces.length-1];return(n?t[n.workspaceName]?.width:void 0)??r[e.windowName]?.width??"narrow"}function x4(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:xL()}}function x2(e,t,r){let n=s4.getState().registeredWorkspacesByName[e];return n?{windowName:n.window,openedWorkspaces:[x4(e,t)],props:r??null,maximized:!1}:null}let x3=({title:e,children:t,hasUnsavedChanges:r=!1})=>{let{setHasUnsavedChanges:n,setWorkspaceTitle:a}=xQ();return(0,ls.useEffect)(()=>{n(r??!1)},[r,n]),(0,ls.useEffect)(()=>{a(e)},[e,a]),(0,lc.jsx)(lc.Fragment,{children:t})};function x6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function x5(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?x6(Object(r),!0).forEach(function(t){x8(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x6(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function x9(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function x8(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x7(e){return(x7=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _e(e,t){return(_e=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _t(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var _r=function(e){var t=ls.Component;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),t&&_e(i,t);var r,n,a,o=(r=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=x7(i);e=r?Reflect.construct(t,arguments,x7(this).constructor):t.apply(this,arguments);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return _t(this)});function i(e){var t;if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,i),x8(_t(t=o.call(this,e)),"handleRef",function(e){t.el=e}),x8(_t(t),"addThingToDo",function(e,r){t.state.hasError&&"unmount"!==e||(t.nextThingToDo=(t.nextThingToDo||Promise.resolve()).then(function(){if(!t.unmounted||"unmount"===e)return r.apply(void 0,arguments)}).catch(function(r){throw t.nextThingToDo=Promise.resolve(),t.setState({hasError:!0}),r&&r.message&&(r.message="During '".concat(e,"', parcel threw an error: ").concat(r.message)),t.props.handleError?t.props.handleError(r):setTimeout(function(){throw r}),r}))}),x8(_t(t),"getParcelProps",function(){var e=x5(x5({},t.props),{},{domElement:t.el});return delete e.mountParcel,delete e.config,delete e.wrapWith,delete e.wrapStyle,delete e.appendTo,delete e.handleError,delete e.parcelDidMount,e}),t.state={hasError:!1},!e.config)throw Error("single-spa-react's Parcel component requires the 'config' prop to either be a parcel config or a loading function that returns a promise. See https://github.com/single-spa/single-spa-react");return t}return n=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var t,r=e.props.mountParcel||e.mountParcel;if(!r)throw Error("\n <Parcel /> was not passed a mountParcel prop, nor is it rendered where mountParcel is within the React context.\n If you are using <Parcel /> within a module that is not a single-spa application, you will need to import mountRootParcel from single-spa and pass it into <Parcel /> as a mountParcel prop \n ");return e.el?t=e.el:(e.createdDomElement=t=document.createElement(e.props.wrapWith),Object.keys(e.props.wrapStyle).forEach(function(r){t.style[r]=e.props.wrapStyle[r]}),e.props.appendTo.appendChild(t)),e.parcel=r(e.props.config,x5({domElement:t},e.getParcelProps())),e.parcel.mountPromise.then(e.props.parcelDidMount),e.parcel.mountPromise})}},{key:"componentDidUpdate",value:function(){var e=this;this.addThingToDo("update",function(){if(e.parcel&&e.parcel.update)return e.parcel.update(e.getParcelProps())})}},{key:"componentWillUnmount",value:function(){var e=this;this.addThingToDo("unmount",function(){if(e.parcel&&"MOUNTED"===e.parcel.getStatus())return e.parcel.unmount()}),this.createdDomElement&&this.createdDomElement.parentNode.removeChild(this.createdDomElement),this.unmounted=!0}},{key:"render",value:function(){var e=this;if(this.props.appendTo)return lI&&lI.Consumer?ls.createElement(lI.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):null;var t=lI&&lI.Consumer?ls.createElement(lI.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):void 0;return ls.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},t)}}],x9(i.prototype,n),a&&x9(i,a),i}();x8(_r,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var _n=r(810),_a=r(771);let _o={workspaceOuterContainer:"-esm-report-builder__workspace2-module__workspaceOuterContainer___W9iJN",narrowWorkspace:"-esm-report-builder__workspace2-module__narrowWorkspace___6pFGF",widerWorkspace:"-esm-report-builder__workspace2-module__widerWorkspace___aQBxL",extraWideWorkspace:"-esm-report-builder__workspace2-module__extraWideWorkspace___Hcpmd",workspaceMiddleContainer:"-esm-report-builder__workspace2-module__workspaceMiddleContainer___DlVKb",maximized:"-esm-report-builder__workspace2-module__maximized___GqZm5",hidden:"-esm-report-builder__workspace2-module__hidden___KSjDv",workspaceInnerContainer:"-esm-report-builder__workspace2-module__workspaceInnerContainer___qQKWW",workspaceSpacer:"-esm-report-builder__workspace2-module__workspaceSpacer___tx3mR",loader:"-esm-report-builder__workspace2-module__loader___f9ttF",hiddenExtraWorkspace:"-esm-report-builder__workspace2-module__hiddenExtraWorkspace___o2RHo",header:"-esm-report-builder__workspace2-module__header___4cJjV",headerButtons:"-esm-report-builder__workspace2-module__headerButtons___5vIhN",workspaceContent:"-esm-report-builder__workspace2-module__workspaceContent___ROBU9",overlayHeaderSpacer:"-esm-report-builder__workspace2-module__overlayHeaderSpacer___CFci9",isActionMenuOpened:"-esm-report-builder__workspace2-module__isActionMenuOpened___TlyIU",showActionMenu:"-esm-report-builder__workspace2-module__showActionMenu___5qVqE",marginWorkspaceContent:"-esm-report-builder__workspace2-module__marginWorkspaceContent___jB4mY",workspaceContainerWithActionMenu:"-esm-report-builder__workspace2-module__workspaceContainerWithActionMenu___+EHP1",workspaceFixedContainer:"-esm-report-builder__workspace2-module__workspaceFixedContainer___PV5s-",workspaceContainerWithoutActionMenu:"-esm-report-builder__workspace2-module__workspaceContainerWithoutActionMenu___pJYA1"},_i=e=>e.registeredWorkspacesByName,_s=({lifeCycle:e,openedWorkspace:t,openedWindow:r,groupProps:n,actions:a,renderChrome:o,isRootWorkspace:i,isLeafWorkspace:s,showActionMenu:l})=>{let u=(0,ls.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:n=!1,discardUnsavedChanges:o=!1}=e;return n?!!(o||await a.promptForClosingWorkspaces())&&(a.closeWorkspace(r.openedWorkspaces[0].workspaceName),!0):!!(o||await a.promptForClosingWorkspaces(t.workspaceName))&&(a.closeWorkspace(t.workspaceName),!0)},launchChildWorkspace:async(e,n)=>{let o=t.workspaceName,{openedWorkspaces:i}=r,s=i.findIndex(e=>e.workspaceName===o);-1===s||s!==i.length-1&&i.slice(s+1).some(e=>e.hasUnsavedChanges)&&!await a.promptForClosingWorkspaces(i[s+1].workspaceName)||a.openChildWorkspace(o,e,n||{})},setWorkspaceTitle:e=>a.setWorkspaceTitle(t.uuid,e),setHasUnsavedChanges:e=>a.setHasUnsavedChanges(t.uuid,e),workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:r.props,groupProps:n,workspaceMeta:s4.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:i,isLeafWorkspace:s,windowName:r.windowName,showActionMenu:l},[t,r,n,a,i,s,l]),c=!o&&!s,d=(0,ls.useMemo)(()=>e?(0,lc.jsx)(_r,{config:e,mountParcel:lo,wrapWith:"div",wrapClassName:ch()(_o.workspaceContent,{[_o.hiddenExtraWorkspace]:c}),...u},t.workspaceName):null===e?(0,lc.jsx)("div",{className:ch()(_o.workspaceContent,{[_o.hiddenExtraWorkspace]:c}),children:(0,lc.jsx)(cw.jeF,{kind:"error",title:aV("error"),subtitle:aV("somethingWentWrongTryReloading"),hideCloseButton:!0})}):null,[e,t.workspaceName,u,c]);return o?(0,lc.jsx)("div",{children:(0,lc.jsx)(_l,{openedWorkspace:t,openedWindow:r,isRootWorkspace:i,showActionMenu:l,closeWindow:()=>u.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,lc.jsx)(cw.OuH,{className:ch()(_o.loader,{[_o.hiddenExtraWorkspace]:c}),description:`${aV("loading")}`})},_l=({openedWorkspace:e,openedWindow:t,isRootWorkspace:r,showActionMenu:n,closeWindow:a,children:o})=>{let i=uL(),{openedGroup:s,openedWindows:l,registeredWindowsByName:u,registeredWorkspacesByName:c,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:p,hideWindow:f}=xX(),h=t.windowName,{maximized:g}=t,y=e.title??"",v=u[h],b=x1(t,c,u),w=v?.icon,E=v?.canMaximize,D=!!s&&d[s.groupName]?.persistence==="closable",x=!!w&&!D,_=l.findIndex(e=>e.windowName===h)<l.length-1||m,S=Object.values(u).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,lc.jsxs)("div",{className:ch()(_o.workspaceOuterContainer,{[_o.narrowWorkspace]:"narrow"===b,[_o.widerWorkspace]:"wider"===b,[_o.extraWideWorkspace]:"extra-wide"===b,[_o.isActionMenuOpened]:S}),children:[(0,lc.jsx)("div",{className:ch()(_o.workspaceSpacer,{[_o.hidden]:_})}),(0,lc.jsx)("div",{className:ch()(_o.workspaceMiddleContainer,{[_o.maximized]:g,[_o.hidden]:_,[_o.isRootWorkspace]:r,[_o.showActionMenu]:n}),children:(0,lc.jsx)("div",{className:ch()(_o.workspaceInnerContainer,{[_o.maximized]:g,[_o.hidden]:_,[_o.isRootWorkspace]:r}),children:o?(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsxs)(cw.Y9Y,{"aria-label":aV("workspaceHeader"),className:_o.header,children:[(0,lc.jsx)(cw.bCw,{prefix:"",children:y}),(0,lc.jsx)("div",{className:_o.overlayHeaderSpacer}),(0,lc.jsx)(cw.wdv,{className:_o.headerButtons,children:uF(i)?(0,lc.jsxs)(lc.Fragment,{children:[(E||g)&&(0,lc.jsx)(cw.V8d,{"aria-label":g?aV("minimize"):aV("maximize"),onClick:()=>p(h,!g),children:g?(0,lc.jsx)(_n.Xj,{}):(0,lc.jsx)(_n.hz,{})}),x&&(0,lc.jsx)(cw.V8d,{"aria-label":aV("hide"),onClick:()=>f(),children:(0,lc.jsx)(cL,{})}),!D&&(0,lc.jsx)(cw.V8d,{"aria-label":aV("close"),onClick:a,children:(0,lc.jsx)(c4,{})})]}):(0,lc.jsxs)(lc.Fragment,{children:[x&&(0,lc.jsx)(cw.V8d,{"aria-label":aV("hide"),onClick:()=>f(),children:(0,lc.jsx)(_a.d3,{})}),(0,lc.jsx)(cw.V8d,{"aria-label":aV("close"),onClick:()=>{D?xB():a()},children:(0,lc.jsx)(c4,{})})]})})]}),o]}):(0,lc.jsx)(cw.OuH,{className:_o.loader,description:`${aV("loading")} ...`})})})]})},_u=({openedWindow:e,groupProps:t,actions:r,renderChrome:n,showActionMenu:a})=>{let{openedWorkspaces:o}=e,[i,s]=(0,ls.useState)({}),l=lg(s4,_i),u=(0,ls.useRef)(new Set);return(0,ls.useEffect)(()=>{let e=!1;return Promise.all(o.map(async t=>{let r=l[t.workspaceName];if(!r)return null;let{moduleName:n,component:a}=r;try{return[t.uuid,await cn(n,a)]}catch(r){return e||u.current.has(t.uuid)||(u.current.add(t.uuid),C(r)),[t.uuid,null]}})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))},C),()=>{e=!0}},[o,l]),(0,lc.jsx)(lc.Fragment,{children:o.map((s,l)=>(0,lc.jsx)(_s,{openedWorkspace:s,openedWindow:e,groupProps:t,actions:r,renderChrome:n,lifeCycle:i[s.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===o.length-1,showActionMenu:a},s.uuid))})},_c=e=>e.registeredWorkspacesByName,_d=({name:e,workspaceProps:t,windowProps:r,groupProps:n,onWindowChanged:a})=>{let o=lg(s4,_c),i=lg(s4,t=>{let r=t.registeredWorkspacesByName[e]?.window;return r?t.registeredWindowsByName[r]:void 0}),s={name:e,workspaceProps:t,windowProps:r,groupProps:n},l=(0,ls.useRef)(null),u=(0,ls.useRef)(null);if(!l.current){let a=x2(e,t,r);l.current=B({openedWindow:a,groupProps:n??null}),a&&(u.current=s)}let c=l.current;(0,ls.useEffect)(()=>{let a=u.current;if(a&&a.name===e&&R(a.workspaceProps,t)&&R(a.windowProps,r)&&R(a.groupProps,n))return;let o=x2(e,t,r);c.setState({openedWindow:o,groupProps:n??null},!0),u.current=o?s:null},[e,t,r,n,o,c]);let d=(0,ls.useMemo)(()=>(function(e){function t(t){e.setState(e=>{if(!e.openedWindow)return e;let r=t(e.openedWindow);return r===e.openedWindow?e:{...e,openedWindow:r}})}return{closeWorkspace(e){t(t=>xG(t,e))},openChildWorkspace(e,r,n){t(t=>xZ(t,e,r,n))},setWorkspaceTitle(e,r){t(t=>xY(t,e,{title:r}))},setHasUnsavedChanges(e,r){t(t=>xY(t,e,{hasUnsavedChanges:r}))},promptForClosingWorkspaces(t){let{openedWindow:r}=e.getState();return r?xK(r,t):Promise.resolve(!0)}}})(c),[c]),{openedWindow:m,groupProps:p}=lg(c),f=m?.openedWorkspaces[m.openedWorkspaces.length-1],h=f?.workspaceName??null,g=f?.title??"",y=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,v=i?.width??"narrow",b=(0,ls.useRef)(a);return(0,ls.useEffect)(()=>{b.current=a}),(0,ls.useEffect)(()=>{b.current?.({workspaceName:h,windowWidth:v,title:g,hasUnsavedChanges:y})},[h,v,g,y]),(0,lc.jsx)("div",{className:"-esm-report-builder__exported-workspace-module__exportedWorkspace___5yaCt",children:m?(0,lc.jsx)(_u,{openedWindow:m,groupProps:p,actions:d,renderChrome:!1,showActionMenu:!1}):null})},_m="-esm-report-builder__action-menu-button2-module__container___qxTbB",_p="-esm-report-builder__action-menu-button2-module__elementContainer___MzyUg",_f="-esm-report-builder__action-menu-button2-module__active___nMKHE",_h="-esm-report-builder__action-menu-button2-module__focused___ncbDv";function _g({getIcon:e,hasUnsavedChanges:t,tagContent:r}){return(0,lc.jsxs)(lc.Fragment,{children:[e({size:16}),t?(0,lc.jsx)("span",{className:"-esm-report-builder__action-menu-button2-module__interruptedTag___HSn-T",children:"!"}):(0,lc.jsx)("span",{className:"-esm-report-builder__action-menu-button2-module__countTag___bUcY2",children:r})]})}let _y=({icon:e,label:t,tagContent:r,workspaceToLaunch:n,onBeforeWorkspaceLaunch:a,hidden:o,disabled:i})=>{let s=uL(),{openedWindows:l,restoreWindow:u,hideWindow:c,isMostRecentlyOpenedWindowHidden:d}=xX(),{extension:m}=(0,ls.useContext)(lu),p=l.findIndex(e=>e.windowName===m?.extensionId),f=l[p],h=null!=f,g=h&&(p<l.length-1||d),y=h&&!g,v=f?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,b=async()=>{if(h)g?u(f.windowName):c();else if(await (a?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:r}=n;xV(e,t,r)}};return o?.(l)?null:"tablet"===s||"phone"===s?(0,lc.jsxs)(cw.$nd,{className:ch()(_m,{[_f]:h&&!y,[_h]:y}),iconDescription:t,kind:"ghost",onClick:b,role:"button",tabIndex:0,size:"md",disabled:i?.(l),children:[(0,lc.jsx)("span",{className:_p,children:(0,lc.jsx)(_g,{hasUnsavedChanges:v,getIcon:e,tagContent:r})}),(0,lc.jsx)("span",{children:t})]}):(0,lc.jsx)(cw.K0,{align:"left","aria-label":t,className:ch()(_m,{[_f]:h&&!y,[_h]:y}),enterDelayMs:300,kind:"ghost",label:t,onClick:b,size:"md",disabled:i?.(l),children:(0,lc.jsx)("div",{className:_p,children:(0,lc.jsx)(_g,{hasUnsavedChanges:v,getIcon:e,tagContent:r})})})};function _v({showContactDetails:e,toggleContactDetails:t,className:r}){return(0,lc.jsx)(cw.$nd,{className:r,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?c1:cX,children:e?aV("showLess","Show less"):aV("showMore","Show more")})}let _b={contactDetails:"-esm-report-builder__patient-banner-contact-details-module__contactDetails___+ytje",deceased:"-esm-report-builder__patient-banner-contact-details-module__deceased___mxjtl",heading:"-esm-report-builder__patient-banner-contact-details-module__heading___wxIC0",row:"-esm-report-builder__patient-banner-contact-details-module__row___dafkX",col:"-esm-report-builder__patient-banner-contact-details-module__col___vGkbd",relationship:"-esm-report-builder__patient-banner-contact-details-module__relationship___ZOV9O"},_w=({patientUuid:e})=>{let{cohorts:t=[],isLoading:r}=function(e){let t=e?`${a0}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:r,isLoading:n}=(0,lW.u)(t,a3),a=r?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,ls.useMemo)(()=>({cohorts:a,isLoading:n}),[n,a])}(e);return(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsxs)("p",{className:_b.heading,children:[aV("patientLists","Patient Lists")," (",t?.length??0,")"]}),r?(0,lc.jsx)(cw.OuH,{description:`${aV("loading","Loading")} ...`,role:"progressbar"}):(0,lc.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>wM(e?.startDate).getTime()-wM(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,lc.jsx)("li",{children:(0,lc.jsx)(ld,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,lc.jsx)("li",{children:"--"})})(),t.length>3&&(0,lc.jsx)("li",{className:_b.link,children:(0,lc.jsx)(ld,{to:`${window.spaBase}/home/patient-lists`,children:aV("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},_E=({patientId:e})=>{let{patient:t,isLoading:r}=uq(e),n=t?.address?.find(e=>"home"===e.use),a=e=>e.split("#")[1];return r?(0,lc.jsx)(cw.OuH,{description:`${aV("loading","Loading")} ...`,role:"progressbar"}):(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("p",{className:_b.heading,children:aV("address","Address")}),(0,lc.jsx)("ul",{children:n?Object.entries(n).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?n.extension?.[0]?.extension?.map((t,r)=>(0,lc.jsxs)("li",{children:[aV(a(t.url),a(t.url)),": ",t.valueString]},`address-${e}-${r}`)):(0,lc.jsxs)("li",{children:[aV(e,e),": ",t]},`address-${e}`)):(0,lc.jsx)("li",{children:"--"})})]})},_D=({patientUuid:e})=>{let{isLoading:t,contactAttributes:r}=(e=>{let{contactAttributeTypes:t=[]}=ul({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:r,error:n,isLoading:a}=(e=>{let{data:t,error:r,isLoading:n}=um(`${a0}/patient/${e}?v=custom:(uuid,display,identifiers:(identifier,uuid,preferred,location:(uuid,name),identifierType:(uuid,name,format,formatDescription,validator)),person:(uuid,display,gender,birthdate,dead,age,deathDate,birthdateEstimated,causeOfDeath,preferredName:(uuid,preferred,givenName,middleName,familyName),attributes,preferredAddress:(uuid,preferred,address1,address2,cityVillage,longitude,stateProvince,latitude,country,postalCode,countyDistrict,address3,address4,address5,address6,address7)))`,a3);return{isLoading:n,attributes:t?.data.person.attributes??[],error:r}})(e);return{contactAttributes:(0,ls.useMemo)(()=>r.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[r,t]),isLoading:a,error:n}})(e),n=(0,ls.useMemo)(()=>r?[...r?.map(e=>[e.attributeType.display?aV(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[r]);return(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("p",{className:_b.heading,children:aV("contactDetails","Contact Details")}),t?(0,lc.jsx)(cw.OuH,{description:`${aV("loading","Loading")} ...`,role:"progressbar"}):(0,lc.jsx)("ul",{children:n.length?n.map(([e,t],r)=>(0,lc.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${r}`)):(0,lc.jsx)("li",{children:"--"})})]})},_x=({patientId:e})=>{let{data:t,isLoading:r}=function(e){let t=`${a0}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:r,error:n,isLoading:a,isValidating:o}=(0,lW.u)(e?t:null,a3),i=r?.data?.results?.length?function(e,t){let r=[];for(let n of t)e===n.personA.uuid?r.push({uuid:`${n.uuid}`,display:n.personB.display,relativeAge:n.personB.age,relativeUuid:n.personB.uuid,relationshipType:n.relationshipType.bIsToA}):r.push({uuid:`${n.uuid}`,display:n.personA.display,relativeAge:n.personA.age,relativeUuid:n.personA.uuid,relationshipType:n.relationshipType.aIsToB});return r}(e,r.data.results):null;return{data:r?i:null,error:n,isLoading:a,isValidating:o}}(e);return(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("p",{className:_b.heading,children:aV("relationships","Relationships")}),r?(0,lc.jsx)(cw.OuH,{description:`${aV("loading","Loading")} ...`,role:"progressbar"}):(0,lc.jsx)("ul",{children:t&&t.length>0?(0,lc.jsx)(lc.Fragment,{children:t.map(e=>(0,lc.jsxs)("li",{className:_b.relationship,children:[(0,lc.jsx)("div",{children:(0,lc.jsx)(ld,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,lc.jsx)("div",{children:e.relationshipType}),(0,lc.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?aV("yearAbbreviation","yr"):aV("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,lc.jsx)("li",{children:"--"})})]})};function __({patientId:e,deceased:t}){return(0,lc.jsxs)("div",{className:ch()(_b.contactDetails,{[_b.deceased]:t}),children:[(0,lc.jsxs)("div",{className:_b.row,children:[(0,lc.jsx)("div",{className:_b.col,children:(0,lc.jsx)(_E,{patientId:e})}),(0,lc.jsx)("div",{className:_b.col,children:(0,lc.jsx)(_D,{patientUuid:e})})]}),(0,lc.jsxs)("div",{className:_b.row,children:[(0,lc.jsx)("div",{className:_b.col,children:(0,lc.jsx)(_x,{patientId:e})}),(0,lc.jsx)("div",{className:_b.col,children:(0,lc.jsx)(_w,{patientUuid:e})})]})]})}function _S(e){let t=document.querySelector("template#loading-spinner");if(t){let r=t.content.cloneNode(!0),n=Array.prototype.map.call(r.childNodes,e=>e);return e.appendChild(r),()=>n.forEach(e=>e.remove())}return()=>{}}let _C="-esm-report-builder__action-menu2-module__container___usAej";function _k({workspaceGroup:e,groupProps:t}){let r=uL(),{persistence:n}=e;return(0,lc.jsx)("aside",{className:"-esm-report-builder__action-menu2-module__sideRail___dTm93",children:(0,lc.jsxs)("div",{className:_C,children:["closable"==n&&uF(r)&&(0,lc.jsx)(cw.K0,{align:"left",onClick:()=>xB(),label:aV("close"),kind:"ghost",children:(0,lc.jsx)(c4,{})}),(0,lc.jsx)(lu.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,lc.jsx)(lC,{className:_C,name:e.name,state:{groupProps:t}})})]})})}function _P(e){let t=new URL(e,window.location.origin).pathname,r=new URL(window.getOpenmrsSpaBase?.()??"/",window.location.origin).pathname,n=r.endsWith("/")?r.slice(0,-1):r,a=null;return n?n===t?a="/":t.startsWith(`${n}/`)&&(a=t.slice(n.length)):a=t,{full:t,spaRelative:a}}function _R(e){e&&(0,lk.createRoot)(e).render((0,lc.jsx)(_T,{}))}function _T(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:r,registeredWindowsByName:n}=xX();if((0,ls.useEffect)(()=>im("before-page-changed",t=>{let{newPage:n,cancelNavigation:a,oldUrl:o,newUrl:i}=t;if(!e)return;if(n)return void a(xB().then(e=>!e));let s=r[e.groupName],l=s?.scopePattern;l&&function(e,t,r){try{let n=new RegExp(e),a=_P(t),o=_P(r);if(null===a.spaRelative||null===o.spaRelative)return!0;let i=n.exec(a.spaRelative),s=n.exec(o.spaRelative);if(i&&s||(i=n.exec(a.full),s=n.exec(o.full)),!i||!s)return!0;if(i.length>1)return!i.slice(1).every((e,t)=>e===s[t+1]);return!1}catch{return!0}}(l,o,i)&&a(xB().then(e=>!e))}),[e,r]),!e)return null;let a=r[e.groupName],o=t.some(e=>e.maximized),{name:i}=a,s=Object.values(n).filter(e=>e.group===i&&void 0!==e.icon).sort((e,t)=>(e.order??Number.MAX_VALUE)-(t.order??Number.MAX_VALUE)).length>0;return(0,lc.jsxs)("div",{className:ch()("-esm-report-builder__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___CSZs-",{"-esm-report-builder__workspace-windows-and-menu-module__overlay___0kl8U":a.overlay,"-esm-report-builder__workspace-windows-and-menu-module__hasMaximizedWindow___+DcH9":o}),children:[(0,lc.jsx)("div",{className:"-esm-report-builder__workspace-windows-and-menu-module__workspaceWindowsContainer___s8ddv",children:t.map(t=>(0,lc.jsx)(_O,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,lc.jsx)(_k,{workspaceGroup:a,groupProps:e.props})]})}function _O({openedWindow:e,groupProps:t,showActionMenu:r}){let{windowName:n}=e,a=(0,ls.useMemo)(()=>({closeWorkspace(e){s4.setState(t=>xJ.closeWorkspace(t,e))},openChildWorkspace(e,t,r){s4.setState(n=>xJ.openChildWorkspace(n,e,t,r))},setWorkspaceTitle(e,t){s4.setState(r=>xJ.setWorkspaceTitle(r,e,t))},setHasUnsavedChanges(e,t){s4.setState(r=>xJ.setHasUnsavedChanges(r,e,t))},promptForClosingWorkspaces(e){let t=s4.getState().openedWindows.find(e=>e.windowName===n);return t?xK(t,e):Promise.resolve(!0)}}),[n]);return(0,lc.jsx)(_u,{openedWindow:e,groupProps:t,actions:a,renderChrome:!0,showActionMenu:r})}function _$(e,t,r){if(null==e)return r;let n=b3(e);if(!n)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),r;let a=[];for(let e of t){let t=b3(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}a.push({canonical:t,original:e})}let o=n;for(;o;){let e=a.find(e=>e.canonical===o);if(e)return e.original;let t=o+"-",r=a.find(e=>e.canonical.startsWith(t));if(r)return r.original;if("ht"===o){o="fr-HT";continue}let n=o.lastIndexOf("-");if(-1===n)break;let i=(o=o.slice(0,n)).lastIndexOf("-");-1!==i&&o.length-i==2&&(o=o.slice(0,i))}return r}function _N(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function _I(e){return!!e&&e.constructor===Object}var _M=r(7638);function _j(e){let[t,r,n]=e.split(".");return`${t}.${r}.${n}`}function _A(e,t){return _M(function(e){let t=e.indexOf("-");if(t>=0){let r=_j(e.slice(0,t)),n=e.slice(t+1);return`${r}-${n}`}return _j(e)}(t),e,{includePrerelease:!0})}async function _L(e,t={}){let r,{shouldRetry:n,getDelay:a,onError:o}=t;n=n??(e=>e<=5),a=a??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let i=0;do try{return await _F(a(i)),await e()}catch(e){o?.(e,i),r=e}while(n(i++));throw r}async function _F(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function _B(e,t,r,n){}function _V(e){}function _U(e){return Promise.resolve([])}function _W(e){return Promise.resolve([])}function _H(e){return Promise.resolve({success:!1,result:void 0,error:"No service worker has been registered. Offline-related features have been removed from the framework."})}function _z(e){return()=>{}}function _K(){return!0}}}]);
40
+ }`.trim(),document.head.prepend(o),s=bj(),l=ml(m0(document,"touchstart",e=>{let r=m2(e);t=gp(r,!0)?r:gf(r,!0),a=!1;let n=r.ownerDocument.defaultView.getSelection();n&&!n.isCollapsed&&n.containsNode(r,!0)&&(a=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&"range"===e.type)&&(a=!0),"selectionStart"in r&&"selectionEnd"in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(a=!0)},{passive:!1,capture:!0}),m0(document,"touchmove",e=>{if(2!==e.touches.length&&!a){if(!t||t===document.documentElement||t===document.body)return void e.preventDefault();t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},{passive:!1,capture:!0}),bM()),()=>{n(),l(),o.remove(),s()}):(e=r,ml((c=window.innerWidth-document.documentElement.clientWidth)>0&&("scrollbarGutter"in document.documentElement.style?m1(document.documentElement,"scrollbar-gutter","stable"):m1(document.documentElement,"padding-right",`${c}px`)),m1(document.documentElement,"overflow","hidden"),e&&bj(),e&&b_()&&bM()))),()=>{0==--bI&&u()}}},[t,r])}({isDisabled:o||!t.isOpen}),(0,ls.useEffect)(()=>{if(t.isOpen&&n.current)if(o){var e,r,i=a?.current??n.current;let t=v1[v1.length-1];return t&&!t.visibleNodes.has(i)?(t.visibleNodes.add(i),()=>{t.visibleNodes.delete(i)}):void 0}else{let t,o,i,s,l,u,c,d,m,p,f;return e=[a?.current??n.current],o=(r={shouldUseInert:!0})instanceof(t=mX(e?.[0])).Element?{root:r}:r,i=o?.root??document.body,s=o?.shouldUseInert&&vQ,l=new Set(e),u=new Set,c=(e,r)=>{s&&e instanceof t.HTMLElement?e.inert=r:r?e.setAttribute("aria-hidden","true"):(e.removeAttribute("aria-hidden"),e instanceof t.HTMLElement&&(e.inert=!1))},d=e=>{for(let t of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))l.add(t);let t=e=>{if(u.has(e)||l.has(e)||e.parentElement&&u.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let t of l)if(m4(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},r=yN(mJ(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),n=t(e);if(n===NodeFilter.FILTER_ACCEPT&&m(e),n!==NodeFilter.FILTER_REJECT){let e=r.nextNode();for(;null!=e;)m(e),e=r.nextNode()}},m=e=>{let r=v0.get(e)??0;(s&&e instanceof t.HTMLElement?e.inert:"true"===e.getAttribute("aria-hidden"))&&0===r||(0===r&&c(e,!0),u.add(e),v0.set(e,r+1))},v1.length&&v1[v1.length-1].disconnect(),d(i),(p=new MutationObserver(e=>{for(let r of e)if("childList"===r.type&&r.target.isConnected&&![...l,...u].some(e=>m4(e,r.target)))for(let e of r.addedNodes){var t;(e instanceof HTMLElement||e instanceof SVGElement)&&("true"===(t=e).dataset.liveAnnouncer||void 0!==t.dataset.reactAriaTopLayer)?l.add(e):e instanceof Element&&d(e)}})).observe(i,{childList:!0,subtree:!0}),f={visibleNodes:l,hiddenNodes:u,observe(){p.observe(i,{childList:!0,subtree:!0})},disconnect(){p.disconnect()}},v1.push(f),()=>{for(let e of(p.disconnect(),u)){let t=v0.get(e);null!=t&&(1===t?(c(e,!1),v0.delete(e)):v0.set(e,t-1))}f===v1[v1.length-1]?(v1.pop(),v1.length&&v1[v1.length-1].observe()):v1.splice(v1.indexOf(f),1)}}},[o,t.isOpen,n,a]);let{focusWithinProps:y}=fE(e);return{popoverProps:mk(d,p,y),arrowProps:f,underlayProps:m,placement:h,triggerAnchorPoint:g}}({...a,offset:a.offset??8,arrowRef:o,groupRef:l?s:i},e),y=a.popoverRef,v=bB(y,!!h&&c),b=a.isEntering||!a.shouldSkipAnimation&&v||!1,w=mO({...a,defaultClassName:"react-aria-Popover",values:{trigger:a.trigger||null,placement:h,isEntering:b,isExiting:t}}),E=!a.isNonModal||"SubmenuTrigger"===a.trigger||"PreviewTrigger"===a.trigger,[D,x]=(0,ls.useState)("PreviewTrigger"===a.trigger);mu(()=>{y.current&&x(E&&!y.current.querySelector("[role=dialog]"))},[y,E]),(0,ls.useEffect)(()=>{D&&"PreviewTrigger"!==a.trigger&&("SubmenuTrigger"!==a.trigger||"pointer"!==pE)&&y.current&&!m6(y.current)&&pK(y.current)},[D,y,a.trigger]);let _=(0,ls.useMemo)(()=>{let e=w.children;for(let t of[bW,...n??[]])e=ll().createElement(t.Provider,{value:null},e);return e},[w.children,n]),[S,C]=(0,ls.useState)(null),k=(0,ls.useCallback)(()=>{a.triggerRef.current&&C(a.triggerRef.current.getBoundingClientRect().width+"px")},[a.triggerRef]);mu(k,[k]),bd({ref:w.style?.["--trigger-width"]?void 0:a.triggerRef,onResize:k});let P={...m.style,"--trigger-anchor-point":g?`${g.x}px ${g.y}px`:void 0,...w.style,"--trigger-width":w.style?.["--trigger-width"]||S};mu(()=>b$(()=>d(!0)),[]);let R=ll().createElement(mL.div,{...mk(mY(a,{global:!0}),m),...w,id:D?a.id:void 0,role:D?"dialog":void 0,tabIndex:D?-1:void 0,"aria-label":a["aria-label"],"aria-labelledby":a["aria-labelledby"],ref:y,slot:a.slot||void 0,style:P,dir:a.dir,"data-trigger":a.trigger,"data-placement":h,"data-entering":b||void 0,"data-exiting":t||void 0},!a.isNonModal&&ll().createElement(bL,{onDismiss:e.close}),ll().createElement(vX.Provider,{value:{...f,placement:h,ref:o}},_),ll().createElement(bL,{onDismiss:e.close}));return l?ll().createElement(vF,{...a,shouldContainFocus:D&&"PreviewTrigger"!==a.trigger,isExiting:t,portalContainer:r??s?.current??void 0},R):ll().createElement(vF,{...a,shouldContainFocus:D&&"PreviewTrigger"!==a.trigger,isExiting:t,portalContainer:r},!a.isNonModal&&e.isOpen&&ll().createElement("div",{"data-testid":"underlay",...p,style:{position:"fixed",inset:0}}),ll().createElement("div",{ref:i,style:{display:"contents"}},ll().createElement(bH.Provider,{value:i},R)))}function bG(e){return e?.start!=null&&null!=e.end}let bZ=(0,ls.createContext)(null),bY=(0,ls.createContext)(null),bq=(0,ls.createContext)(null),bJ=(0,ls.createContext)(null),bX=[yR,fP,vq,f$],bQ=(0,ls.forwardRef)(function(e,t){[e,t]=mN(e,t,bZ);let{validationBehavior:r}=m$(vK)||{},n=e.validationBehavior??r??"native",a=function(e){let t=bF(e),[r,n]=yl(e.value,e.defaultValue||null,e.onChange),[a]=(0,ls.useState)(r),o=r||e.placeholderValue||null,[i,s]=vb(o,e.granularity),l=null!=r?r.toDate(s??"UTC"):null,u="hour"===i||"minute"===i||"second"===i,c=e.shouldCloseOnSelect??!0,[d,m]=(0,ls.useState)(null),[p,f]=(0,ls.useState)(null);if(r&&(d=r,"hour"in r&&(p=r)),o&&!(i in o))throw Error("Invalid granularity "+i+" for value "+o.toString());let h=r?.calendar.identifier==="gregory"&&"BC"===r.era,g=(0,ls.useMemo)(()=>({granularity:i,timeZone:s,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:h}),[i,e.hourCycle,e.shouldForceLeadingZeros,s,e.hideTimeZone,h]),{minValue:y,maxValue:v,isDateUnavailable:b}=e,w=(0,ls.useMemo)(()=>vp(r,y,v,b,g),[r,y,v,b,g]),E=vi({...e,value:r,builtinValidation:w}),D=E.displayValidation.isInvalid,x=e.validationState||(D?"invalid":null),_=(e,t)=>{n("timeZone"in t?t.set(hK(e)):hG(e,t)),m(null),f(null),E.commitValidation()};return{...E,value:r,defaultValue:e.defaultValue??a,setValue:n,dateValue:d,timeValue:p,setDateValue:r=>{let a="function"==typeof c?c():c;u?p||a?_(r,p||vy(e.defaultValue||e.placeholderValue)):m(r):(n(r),E.commitValidation()),a&&t.setOpen(!1)},setTimeValue:e=>{d&&e?_(d,e):f(e)},granularity:i,hasTime:u,...t,setOpen(n){!n&&!r&&d&&u&&_(d,p||vy(e.defaultValue||e.placeholderValue)),t.setOpen(n)},validationState:x,isInvalid:D,formatValue:(e,t)=>l?new fJ(e,vg(t,g)).format(l):"",getDateFormatter:(e,t)=>new fJ(e,vg({},{...g,...t}))}}({...e,validationBehavior:n}),o=(0,ls.useRef)(null),[i,s]=mI(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:l,labelProps:u,fieldProps:c,buttonProps:d,dialogProps:m,calendarProps:p,descriptionProps:f,errorMessageProps:h,...g}=function(e,t,r){var n;let a=mD(),o=mD(),i=mD(),s=hr((n=y0)&&n.__esModule?n.default:n,"@react-aria/datepicker"),{isInvalid:l,validationErrors:u,validationDetails:c}=t.displayValidation,{labelProps:d,fieldProps:m,descriptionProps:p,errorMessageProps:f}=y2({...e,labelElementType:"span",isInvalid:l,errorMessage:e.errorMessage||u}),h=y1(t,r),g=m["aria-labelledby"]||m.id,{locale:y}=fY(),v=t.formatValue(y,{month:"long"}),b=gw(v?s.format("selectedDateDescription",{date:v}):""),w=[b["aria-describedby"],m["aria-describedby"]].filter(Boolean).join(" ")||void 0,E=mY(e),D=(0,ls.useMemo)(()=>yY(r),[r]),x=(0,ls.useRef)(!1),{focusWithinProps:_}=fE({...e,isDisabled:t.isOpen,onBlurWithin:t=>{m4(document.getElementById(o),t.relatedTarget)||(x.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{x.current||(x.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}});return{groupProps:mk(E,h,m,b,_,{role:"group","aria-disabled":e.isDisabled||null,"aria-labelledby":g,"aria-describedby":w,onKeyDown(r){!t.isOpen&&e.onKeyDown&&e.onKeyDown(r)},onKeyUp(r){!t.isOpen&&e.onKeyUp&&e.onKeyUp(r)}}),labelProps:{...d,onClick:()=>{D.focusFirst()}},fieldProps:{...m,id:i,[y9]:"presentation","aria-describedby":w,value:t.value,defaultValue:t.defaultValue,onChange:t.setValue,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,granularity:e.granularity,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior,[vo]:t,autoFocus:e.autoFocus,name:e.name,form:e.form},descriptionProps:p,errorMessageProps:f,buttonProps:{...b,id:a,"aria-haspopup":"dialog","aria-label":s.format("calendar"),"aria-labelledby":`${a} ${g}`,"aria-describedby":w,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:o,"aria-labelledby":`${a} ${g}`},calendarProps:{autoFocus:!0,value:t.dateValue,onChange:t.setDateValue,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,defaultFocusedValue:t.dateValue?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:l,validationErrors:u,validationDetails:c}}({...mM(e),label:s,validationBehavior:n},a,o),{focusProps:y,isFocused:v,isFocusVisible:b}=fD({within:!0}),w=mO({...e,values:{state:a,isFocusWithin:v,isFocusVisible:b,isDisabled:e.isDisabled||!1,isInvalid:a.isInvalid,isOpen:a.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-DatePicker"}),E=mY(e,{global:!0});return delete E.id,ll().createElement(mT,{values:[[bq,a],[yR,{...l,ref:o,isInvalid:a.isInvalid}],[vR,c],[fP,{...d,isPressed:a.isOpen}],[vq,{...u,ref:i,elementType:"span"}],[yy,p],[vV,a],[bW,{trigger:"DatePicker",triggerRef:o,placement:"bottom start",clearContexts:bX}],[vB,m],[f$,{slots:{description:f,errorMessage:h}}],[vW,g]]},ll().createElement(mL.div,{...mk(E,w,y),ref:t,slot:e.slot||void 0,"data-focus-within":v||void 0,"data-invalid":a.isInvalid||void 0,"data-focus-visible":b||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":a.isOpen||void 0}),ll().createElement(vY,{autoComplete:e.autoComplete,name:e.name,isDisabled:e.isDisabled,state:a}))}),b0=(0,ls.forwardRef)(function(e,t){[e,t]=mN(e,t,bY);let{validationBehavior:r}=m$(vK)||{},n=e.validationBehavior??r??"native",a=function(e){let t=bF(e),[r,n]=yl(e.value,e.defaultValue||null,e.onChange),[a]=(0,ls.useState)(r),[o,i]=(0,ls.useState)(()=>r||{start:null,end:null});null==r&&o.start&&o.end&&i(o={start:null,end:null});let s=r||o,l=e=>{i(s=e||{start:null,end:null}),bG(s)?n(s):n(null)},[u,c]=vb(s?.start||s?.end||e.placeholderValue||null,e.granularity),d="hour"===u||"minute"===u||"second"===u,m=e.shouldCloseOnSelect??!0,[p,f]=(0,ls.useState)(null),[h,g]=(0,ls.useState)(null);s&&bG(s)&&(p=s,"hour"in s.start&&(h=s));let y=(e,t)=>{l({start:"timeZone"in t.start?t.start.set(hK(e.start)):hG(e.start,t.start),end:"timeZone"in t.end?t.end.set(hK(e.end)):hG(e.end,t.end)}),f(null),g(null),C.commitValidation()},v=r=>{let n="function"==typeof m?m():m;d?bG(r)&&(n||h?.start&&h?.end)?y(r,{start:h?.start||vy(e.placeholderValue),end:h?.end||vy(e.placeholderValue)}):f(r):bG(r)?(l(r),C.commitValidation()):f(r),n&&t.setOpen(!1)},b=e=>{bG(p)&&bG(e)?y(p,e):g(e)},w=s?.start?.calendar.identifier==="gregory"&&"BC"===s.start.era||s?.end?.calendar.identifier==="gregory"&&"BC"===s.end.era,E=(0,ls.useMemo)(()=>({granularity:u,timeZone:c,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:w}),[u,e.hourCycle,e.shouldForceLeadingZeros,c,e.hideTimeZone,w]),{minValue:D,maxValue:x,isDateUnavailable:_}=e,S=(0,ls.useMemo)(()=>{var e,t;let r;return e=s,t=_?e=>_(e,null):void 0,r=vc(vp(e?.start??null,D,x,t,E),vp(e?.end??null,D,x,t,E)),e?.end!=null&&null!=e.start&&0>e.end.compare(e.start)&&(r=vc(r,{isInvalid:!0,validationErrors:[(f5.getGlobalDictionaryForPackage("@react-stately/datepicker")||vd).getStringForLocale("rangeReversed",vm())],validationDetails:{...vt,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})),r},[s,D,x,_,E]),C=vi({...e,value:r,name:(0,ls.useMemo)(()=>[e.startName,e.endName].filter(e=>null!=e),[e.startName,e.endName]),builtinValidation:S}),k=C.displayValidation.isInvalid,P=e.validationState||(k?"invalid":null);return{...C,value:s,defaultValue:e.defaultValue??a,setValue:l,dateRange:p,timeRange:h,granularity:u,hasTime:d,setDate(e,t){"start"===e?v({start:t,end:p?.end??null}):v({start:p?.start??null,end:t})},setTime(e,t){"start"===e?b({start:t,end:h?.end??null}):b({start:h?.start??null,end:t})},setDateTime(e,t){"start"===e?l({start:t,end:s?.end??null}):l({start:s?.start??null,end:t})},setDateRange:v,setTimeRange:b,...t,setOpen(r){!r&&!(s?.start&&s?.end)&&bG(p)&&d&&y(p,{start:h?.start||vy(e.placeholderValue),end:h?.end||vy(e.placeholderValue)}),t.setOpen(r)},validationState:P,isInvalid:k,formatValue(t,r){let n;if(!s||!s.start||!s.end)return null;let a="timeZone"in s.start?s.start.timeZone:void 0,o=e.granularity||(s.start&&"minute"in s.start?"minute":"day"),i="timeZone"in s.end?s.end.timeZone:void 0,l=e.granularity||(s.end&&"minute"in s.end?"minute":"day"),u=vg(r,{granularity:o,timeZone:a,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:"gregory"===s.start.calendar.identifier&&"BC"===s.start.era||"gregory"===s.end.calendar.identifier&&"BC"===s.end.era}),c=s.start.toDate(a||"UTC"),d=s.end.toDate(i||"UTC"),m=new fJ(t,u);if(a===i&&o===l&&0!==s.start.compare(s.end)){try{let e=m.formatRangeToParts(c,d),t=-1;for(let r=0;r<e.length;r++){let n=e[r];if("shared"===n.source&&"literal"===n.type)t=r;else if("endRange"===n.source)break}let r="",n="";for(let a=0;a<e.length;a++)a<t?r+=e[a].value:a>t&&(n+=e[a].value);return{start:r,end:n}}catch{}n=m}else n=new fJ(t,vg(r,{granularity:l,timeZone:i,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:m.format(c),end:n.format(d)}},getDateFormatter:(e,t)=>new fJ(e,vg({},{...E,...t}))}}({...e,validationBehavior:n}),o=(0,ls.useRef)(null),[i,s]=mI(!e["aria-label"]&&!e["aria-labelledby"]),{groupProps:l,labelProps:u,startFieldProps:c,endFieldProps:d,buttonProps:m,dialogProps:p,calendarProps:f,descriptionProps:h,errorMessageProps:g,...y}=function(e,t,r){var n;let a=hr((n=y0)&&n.__esModule?n.default:n,"@react-aria/datepicker"),{isInvalid:o,validationErrors:i,validationDetails:s}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:c,errorMessageProps:d}=y2({...e,labelElementType:"span",isInvalid:o,errorMessage:e.errorMessage||i}),m=u["aria-labelledby"]||u.id,{locale:p}=fY(),f=t.formatValue(p,{month:"long"}),h=gw(f?a.format("selectedRangeDescription",{startDate:f.start,endDate:f.end}):""),g={"aria-label":a.format("startDate"),"aria-labelledby":m},y={"aria-label":a.format("endDate"),"aria-labelledby":m},v=mD(),b=mD(),w=y1(t,r),E=[h["aria-describedby"],u["aria-describedby"]].filter(Boolean).join(" ")||void 0,D=(0,ls.useMemo)(()=>yY(r,{accept:e=>e.id!==v}),[r,v]),x={[y8]:D,[y9]:"presentation","aria-describedby":E,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},_=mY(e),S=(0,ls.useRef)(!1),{focusWithinProps:C}=fE({...e,isDisabled:t.isOpen,onBlurWithin:t=>{m4(document.getElementById(b),t.relatedTarget)||(S.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{S.current||(S.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,ls.useRef)(vn),P=(0,ls.useRef)(vn);return{groupProps:mk(_,w,u,h,C,{role:"group","aria-disabled":e.isDisabled||null,"aria-describedby":E,onKeyDown(r){!t.isOpen&&e.onKeyDown&&e.onKeyDown(r)},onKeyUp(r){!t.isOpen&&e.onKeyUp&&e.onKeyUp(r)}}),labelProps:{...l,onClick:()=>{D.focusFirst()}},buttonProps:{...h,id:v,"aria-haspopup":"dialog","aria-label":a.format("calendar"),"aria-labelledby":`${v} ${m}`,"aria-describedby":E,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${v} ${m}`},startFieldProps:{...g,...x,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime("start",e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[vo]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(vc(e,P.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...y,...x,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime("end",e),name:e.endName,form:e.form,[vo]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){P.current=e,t.updateValidation(vc(k.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:c,errorMessageProps:d,calendarProps:{autoFocus:!0,value:t.dateRange?.start&&t.dateRange.end?t.dateRange:null,onChange:t.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:t.dateRange?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:"function"==typeof e.errorMessage?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(" "),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:o,validationErrors:i,validationDetails:s}}({...mM(e),label:s,validationBehavior:n},a,o),{focusProps:v,isFocused:b,isFocusVisible:w}=fD({within:!0}),E=mO({...e,values:{state:a,isFocusWithin:b,isFocusVisible:w,isDisabled:e.isDisabled||!1,isInvalid:a.isInvalid,isOpen:a.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:"react-aria-DateRangePicker"}),D=mY(e,{global:!0});return delete D.id,ll().createElement(mT,{values:[[bJ,a],[yR,{...l,ref:o,isInvalid:a.isInvalid}],[fP,{...m,isPressed:a.isOpen}],[vq,{...u,ref:i,elementType:"span"}],[yv,f],[vV,a],[bW,{trigger:"DateRangePicker",triggerRef:o,placement:"bottom start",clearContexts:bX}],[vB,p],[vR,{slots:{start:c,end:d}}],[f$,{slots:{description:h,errorMessage:g}}],[vW,y]]},ll().createElement(mL.div,{...mk(D,E,v),ref:t,slot:e.slot||void 0,"data-focus-within":b||void 0,"data-invalid":a.isInvalid||void 0,"data-focus-visible":w||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":a.isOpen||void 0}))});function b1(e){return ll().createElement(fZ,e)}function b4(e,t,r=!1){if(null==e)return r?e:void 0;if("string"==typeof e&&!e)return r?null:void 0;if(e instanceof hI||e instanceof hj||e instanceof hA)return t?hZ(e,t):e;{let r=u2()(e).toDate(),n=new hI(r.getFullYear(),r.getMonth()+1,r.getDate());return t?hZ(n,t):n}}function b2(e){if(e)return e.toDate(h9())}function b3(e){if("string"==typeof e&&0!==e.trim().length)try{return new Intl.Locale(e.replace(/[_@]/g,"-")).toString()}catch{return}}function b6(e){let t=e??"",r=b3(t);if(!r)return t;try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??t}catch{return t}}function b5(){let e=window.i18next.language,t=b3(e)??e;return"ht"===t&&(t="fr-HT"),t}if("u">typeof navigator){let e=navigator;en=Array.isArray(e.languages)?e.languages[0]:e.language}else if("u">typeof process){let e=process.env;en=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE}var b9=function(e){e=(e=e.replace(/_/g,"-")).replace(/[.:][\w-]*$/,"");try{return new Intl.Locale(e).baseName}catch{return"en-US"}}(en||"en-US"),b8=class extends Date{invalid=null;isValid(){return!Number.isNaN(this.valueOf())}},b7={};for(let e=0;e<100;e++)b7[(e<=9?"0":"")+e]=e+(e>51?1900:2e3);var we={arab:1632,arabext:1776,bali:6992,beng:2534,deva:2406,fullwide:65296,gujr:2790,khmr:6112,knda:3302,laoo:3792,limb:6470,mlym:3430,mong:6160,mymr:4160,orya:2918,tamldec:3046,telu:3174,thai:3664,tibt:3872},wt="[1234567890一二三四五六七八九〇\\d]",wr={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,〇:0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9},wn={},wa={"Eastern Daylight Time":-240,"Eastern Standard Time":-300,"Central Daylight Time":-300,"Central Standard Time":-360,"Mountain Daylight Time":-360,"Mountain Standard Time":-420,"Pacific Daylight Time":-420,"Pacific Standard Time":-480,"Coordinated Universal Time":0,ACDT:630,ACST:570,ACT:480,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,AMST:-180,AMT:-240,ART:-180,AST:180,AWDT:540,AWST:480,AZOST:-60,AZT:240,BDT:360,BIOT:360,BIT:-720,BOT:-240,BRST:-120,BRT:-180,BTT:360,CAT:120,CCT:390,CDT:-300,CEDT:120,CEST:120,CET:60,CHADT:825,CHAST:765,CHOT:480,ChST:600,CHUT:600,CIST:-480,CIT:480,CKT:-600,CLST:-180,CLT:-240,COST:-240,COT:-300,CST:-360,CT:480,CVT:-60,CXT:420,DAVT:420,DDUT:600,DFT:60,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEDT:180,EEST:180,EET:120,EGST:0,EGT:-60,EIT:540,EST:-300,FET:180,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GIT:-540,GMT:0,GST:-120,GYT:-240,HADT:-540,HAEC:120,HAST:-600,HKT:480,HMT:300,HOVT:420,HST:-600,IBST:0,ICT:420,IDT:180,IOT:180,IRDT:270,IRKT:480,IRST:210,IST:120,JST:540,KGT:360,KOST:660,KRAT:420,KST:540,LHST:630,LINT:840,MAGT:720,MART:-510,MAWT:300,MDT:-360,MET:60,MEST:120,MHT:720,MIST:660,MIT:-510,MMT:390,MSK:180,MST:-420,MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:660,NPT:345,NST:-150,NT:-150,NUT:-660,NZDT:780,NZST:720,OMST:360,ORAT:300,PDT:-420,PET:-300,PETT:720,PGT:600,PHOT:780,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PYST:-180,PYT:-240,RET:240,ROTT:-180,SAKT:660,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SLST:330,SRET:660,SRT:-180,SST:480,SYOT:180,TAHT:-600,THA:420,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TOT:780,TVT:720,UCT:0,ULAT:480,USZ1:120,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-240,VLAT:600,VOLT:240,VOST:360,VUT:660,WAKT:720,WAST:120,WAT:60,WEDT:60,WEST:60,WET:0,WIT:420,WST:480,YAKT:540,YEKT:300},wo={zone:wa,year:b7,meridiem:{am:0,pm:12,"a.m.":0,"p.m.":12},month:{january:1,jan:1,february:2,feb:2,march:3,mar:3,april:4,apr:4,may:5,june:6,jun:6,july:7,jul:7,august:8,aug:8,september:9,sep:9,october:10,oct:10,november:11,nov:11,december:12,dec:12},dayname:{sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,wednesday:3,wed:3,thursday:4,thu:4,friday:5,fri:5,saturday:6,sat:6},digit:{}},wi={MONTHNAME:"january|february|march|april|may|june|july|august|september|october|november|december|jan\\.?|feb\\.?|mar\\.?|apr\\.?|may\\.?|jun\\.?|jul\\.?|aug\\.?|sep\\.?|oct\\.?|nov\\.?|dec\\.?",DAYNAME:"sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun\\.?|mon\\.?|tue\\.?|wed\\.?|thu\\.?|fri\\.?|sat\\.?",ZONE:`\\(?(?:${Object.keys(wa).join("|")})\\)?`,MERIDIEM:"am|pm|a.m.|p.m.",ORDINAL:"st|nd|rd|th|\\.",YEAR:"\\d{4}|\\d{2}",YEAR2:"\\d{2}",YEAR4:"\\d{4}",YEAR6:"-\\d{6}|\\+?\\d{5,6}",MONTH:"1[0-2]|0?[1-9]",MONTH2:"1[0-2]|0[1-9]",DAY:"3[01]|[12]\\d|0?[1-9]",DAY2:"3[01]|[12]\\d|0[1-9]",OFFSET:"(?:GMT)?[\xb1−+-](?:[01]\\d[0-5]\\d|[01]\\d:[0-5]\\d|[01]?\\d)",H24:"[01]\\d|2[0-3]",H12:"0?[1-9]|1[012]",MIN:"[0-5]\\d",SEC:"[0-5]\\d|60",MS:"\\d{9}|\\d{6}|\\d{1,3}",GAP:"[\\s/.,-]{1,}"},ws={...wi,YEAR:"*{4}|*{2}",YEAR4:"*{4}",YEAR6:"-*{6}|\\+?*{5,6}",MONTH:"*{1,2}",MONTH2:"*{2}",DAY:"*{1,2}",DAY2:"*{2}",OFFSET:"(?:GMT)?[\xb1−+-](?:*{4}|*{2}:*{2}|*{1,2})",H24:"*{2}",H12:"*{1,2}",MIN:"*{2}",SEC:"*{2}",MS:"*{9}|*{6}|*{3}"},wl={},wu=class e{locale;lookups;vars;numberingSystem;baseName;dateOptions;static factory(t=b9){let r=t.toLowerCase(),n=wl[r];if(n)return n;let a=new e(t);return wl[r]=a,a}constructor(e=b9){this.locale=e,this.lookups={...wo},this.vars={...wi};const t=new Intl.NumberFormat(this.locale);this.numberingSystem=t.resolvedOptions().numberingSystem,this.dateOptions=new Intl.DateTimeFormat(this.locale).resolvedOptions(),this.baseName=new Intl.Locale(this.locale).baseName,this.build()}toInt(e){return"number"==typeof e?e:"string"==typeof e?this.stringToInt(e):void 0}stringToInt(e){if("latn"===this.numberingSystem&&!this.baseName.startsWith("zh")){let t=parseInt(e,10);if(!Number.isNaN(t))return t}let t="";for(let r=0;r<e.length;r++)t+=String(this.lookups.digit[e[r]]);return parseInt(t,10)}millisecondToInt(e){if("number"==typeof e)return e;if("string"!=typeof e)return;let t=e.slice(0,3);return 1===t.length?100*this.stringToInt(t):2===t.length?10*this.stringToInt(t):this.stringToInt(t)}monthNameToInt(e){if("string"!=typeof e)return;let t=e.toLocaleLowerCase(this.locale).replace(/\.$/,"");return this.lookups.month[t]||12}h12ToInt(e,t){if("string"!=typeof e)return;let r=this.lookups.meridiem[t?.toLowerCase()]||0,n=this.stringToInt(e);return n<12&&12===r&&(n+=12),12===n&&0===r&&(n=0),n}zoneToOffset(e){if("string"==typeof e)return e=e.replace(/[^a-z\s]/gi,""),this.lookups.zone[e]}offsetToMinutes(e){if("string"!=typeof e)return;let t=e.match(/^(?:GMT)?([±−+-])(..?):?(..)?$/);if(t){let[,e,r,n]=t;return("-"===e||"−"===e?-1:1)*(60*this.stringToInt(r)+(n?this.stringToInt(n):0))}return 0}build(){"latn"===this.dateOptions.numberingSystem?this.lookups.digit=wr:this.buildNumbers(),!/^en/i.test(this.locale)&&(this.buildMonthNames(),this.buildDaynames(),/zh/i.test(this.locale)||this.buildMeridiems())}buildNumbers(){let{group:e,lookup:t}=function(e){let t=wn[e];if(t)return t;if("fullwide"===e||"hanidec"===e)return{group:wt,lookup:{...wr}};let r=we[e];if(!r)return{group:"\\d",lookup:{...wr}};let n=String.fromCharCode(r),a=String.fromCharCode(r+9),o={};for(let e=0;e<10;e++)o[String.fromCharCode(r+e)]=e;return wn[e]={group:`[${n}-${a}]`,lookup:o},wn[e]}(this.numberingSystem);for(let r in this.lookups.digit=t,ws)Object.hasOwn(ws,r)&&(this.vars[r]=ws[r].replace(/\*/g,e))}buildMonthNames(){let e={},t={};if(/^fi/i.test(this.locale))"tammi|helmi|maalis|huhti|touko|kes\xe4|hein\xe4|elo|syys|loka|marras|joulu".split("|").forEach((r,n)=>{["","k","kuu","kuuta"].forEach((a,o)=>{e[r+a+(o<2?"\\.?":"")]=!0,t[r+a]=n+1})});else{let r=[],n=e=>"month"===e.type;for(let e=0;e<12;e++)r.push(new Date(2017,e,1));for(let a of["full","long","medium"]){let o=Intl.DateTimeFormat(this.locale,{dateStyle:a});for(let i=0;i<12;i++){let s=o.formatToParts(r[i]).find(n);if(!s)continue;let l=s.value.toLocaleLowerCase(this.locale);/^\d+$/.test(l)||(/^ko/i.test(this.locale)&&(l+="월"),"medium"===a?(l=l.replace(/\.$/,""),e[`${l}\\.?`]=!0):e[l]=!0,t[l]=i+1)}}let a=Intl.DateTimeFormat(this.locale,{month:"short"});for(let o=0;o<12;o++){let i=a.formatToParts(r[o]).find(n);if(!i)continue;let s=i.value.toLocaleLowerCase(this.locale);s=s.replace(/\.$/,""),e[`${s}\\.?`]=!0,t[s]=o+1}}this.vars.MONTHNAME=Object.keys(e).join("|"),this.lookups.month=t}buildDaynames(){let e=[],t=e=>"weekday"===e.type;for(let t=0;t<7;t++)e.push(new Date(2017,0,t+1));let r=[],n={};for(let a of["long","short"]){let o=Intl.DateTimeFormat(this.locale,{weekday:a});for(let i=0;i<7;i++){let s=o.formatToParts(e[i]).find(t);if(!s)continue;let l=s.value.toLocaleLowerCase(this.locale);"short"===a?(l=l.replace(/\.$/,""),r.push(`${l}\\.?`)):r.push(l),n[l]=i}}this.vars.DAYNAME=r.join("|"),this.lookups.dayname=n}buildMeridiems(){let e=[new Date(2017,0,1),new Date(2017,0,1,23,0,0)],t=e=>"dayPeriod"===e.type,r=[],n={},a=Intl.DateTimeFormat(this.locale,{timeStyle:"long"});for(let o=0;o<2;o++){let i=a.formatToParts(e[o]).find(t);if(!i)return;let s=i.value.toLocaleLowerCase(this.locale);r.push(s),n[s]=12*o}this.vars.MERIDIEM=r.join("|"),this.lookups.meridiem=n}compile(e){return RegExp(e.replace(/_([A-Z0-9]+)_/g,(e,t)=>{if(!this.vars[t])throw Error(`Template string contains invalid variable _${t}_`);return this.vars[t]}),"i")}},wc=["ee-TG","en-AS","en-CA","en-FM","en-GH","en-GU","en-KE","en-KY","en-MH","en-MP","en-US","en-VI","en-WS","jp-JP","sm-AS","sm-SM"],wd={y:"year",M:"month",d:"day",w:"week",h:"hour",m:"minute",s:"second",ms:"millisecond"},wm=()=>new Date;function wp(e){return function(t){let r={};for(let n=0,a=e.length;n<a;n++){let a=e[n];a&&(r[a]=t[n])}return r}}var wf=class{doneChecker;fallback;patterns;formatter;constructor({doneChecker:e,fallback:t,patterns:r,formatter:n}){this.doneChecker=e,this.fallback=t,this.patterns=r,this.formatter=n}attempt(e){if("string"!=typeof e)return this.fallback(e);let t=e.trim(),r={},n=!1;for(let e of this.patterns){let a=t.match(e.regex);if(!a)continue;n=!0;let o=e.handler(a);if(o){for(let[e,t]of Object.entries(o))e in r||void 0===t||(r[e]=t);let e=a.index??0;if(t=(t=t.slice(0,e)+t.slice(e+a[0].length+1)).trim(),this.doneChecker(r,t))break}}return n?this.formatter(r):this.fallback(e)}},wh=["year","month","day","hour","minute","second","millisecond","offset"],wg={};function wy(e,t){return""===t||/^\s+$/.test(t)||"year"in e&&("month"in e||"monthname"in e)&&"day"in e&&"hour"in e&&"minute"in e&&"second"in e&&"millisecond"in e&&("zone"in e||"offset"in e)}var wv=[[/([^\d.]+)(\d{1,2})\.(\d{2})\.(\d{2})(\D|$)/,"$1$2:$3:$4$5"],[/([^\d.]+)(\d{1,2})\.(\d{2})(\D|$)/,"$1$2:$3$4"]],wb={ar:[[/ /g," "]],bn:[[/,/g,""]],zh:[[/早上\s*([\d:]+)/,"$1am"],[/凌晨\s*([\d:]+)/,"$1am"],[/上午\s*([\d:]+)/,"$1am"],[/下午\s*([\d:]+)/,"$1pm"],[/晚上\s*([\d:]+)/,"$1pm"]],he:[[/ב/gi,""]],de:[[/ um /g," "]],pt:[[/\sde /gi," "]],es:[[/\sde /gi," "]],da:[[/\sden /gi," "],...wv],ru:[[/ г\./g,""]],th:[[/\s*นาฬิกา\s*/i,":"],[/\s*นาที\s*/i,":"],[/\s*วินาที\s*/i," "]],ko:[[/\s*시\s*/,":"],[/\s*분\s*/,":"],[/\s*초\s*/,""],[/(오전|오후)\s*([\d:]+)/,"$2$1"],[/(\d{4})\. (\d{1,2})\. (\d{1,2})\./,"$1-$2-$3"]],fi:wv,id:wv,fr:[[/(\d{2}) h /,"$1:"],[/(\d{2}) min /,"$1:"],[/(\d{2}) s /,"$1"]]};function ww(e,t=b9){let r=function(e){var t,r;let n,a,o=wg[e];if(o)return o;let i=wu.factory(e),s=new wf({doneChecker:wy,fallback:(t=e,function(e){let r=String(e).slice(0,50);return""===r&&(r="(empty string)"),{invalid:`Unable to parse "${r}" with locale "${t}"`}}),patterns:(n=[{name:"timestampWithOffset",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? ?(_OFFSET_|Z)?$"),handler:wp(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"timestampWithZone",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))?\\s*(_ZONE_)$"),handler:wp(["","year","month","day","hour","minute","second","millisecond","zone"])},{name:"timestampWithOffsetAndZone",regex:i.compile("^(_YEAR4_)-(_MONTH_)-(_DAY_)[T ](_H24_):(_MIN_):(_SEC_)(?:.(_MS_))? (_OFFSET_|Z)\\s*(_ZONE_)$"),handler:wp(["","year","month","day","hour","minute","second","millisecond","offset"])},{name:"chinese",regex:i.compile(`^(${wt}{2,4})\\s*\u5E74\\s*(${wt}{1,2})\\s*\u6708\\s*(${wt}{1,2})\\s*\u65E5$`),handler:wp(["","year","month","day"])},{name:"korean",regex:i.compile("^(_YEAR_)년\\s*(_MONTH_)월\\s*(_DAY_)일$"),handler:wp(["","year","month","day"])},{name:"twitter",regex:/^(?:sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) (\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4}) (\d{4})$/i,handler:wp(["","monthname","day","hour","minute","second","offset","year"])},{name:"today",regex:/\b(now|today|tomorrow|yesterday)\b/i,handler:e=>{let t=wm(),r=e[0].toLowerCase(),n={now:0,today:0,tomorrow:864e5,yesterday:-864e5}[r]??0;0!==n&&t.setTime(t.getTime()+n);let a={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()};return"now"===r?{...a,hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()}:a}},{name:"ago",regex:/^(\+|-|in|) ?([\d.]+) ?(years?|months?|weeks?|days?|hours?|minutes?|seconds?|milliseconds?|ms|s|m|h|w|d|M|y)( ago)?$/i,handler:([,e,t,r,n])=>{let a,o=parseFloat(t);"week"===(a=r.length<=2?wd[r]:(a=r.replace(/s$/,"")).toLowerCase())&&(a="day",o*=7),("-"===e||n)&&(o*=-1);let i=wm();return"millisecond"===a?i.setUTCMilliseconds(i.getUTCMilliseconds()+o):"second"===a?i.setUTCSeconds(i.getUTCSeconds()+o):"minute"===a?i.setUTCMinutes(i.getUTCMinutes()+o):"hour"===a?i.setUTCHours(i.getUTCHours()+o):"day"===a?i.setUTCDate(i.getUTCDate()+o):"month"===a?i.setUTCMonth(i.getUTCMonth()+o):"year"===a&&i.setUTCFullYear(i.getUTCFullYear()+o),{year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate(),hour:i.getUTCHours(),minute:i.getUTCMinutes(),second:i.getUTCSeconds(),millisecond:i.getUTCMilliseconds()}}},{name:"atSeconds",regex:/^@(\d+)$/,handler:e=>{let t=new Date(1e3*parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}},{name:"microsoftJson",regex:/^\/Date\((\d+)([+-]\d{4})?\)\/$/,handler:e=>{let t=new Date(parseInt(e[1],10));return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds(),offset:e[2]}}},{name:"full24",regex:i.compile("(?:^|[\\sT])(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?(Z)?$"),handler:wp(["","hour","minute","second","millisecond","zone"])},{name:"zone24",regex:i.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?[\\s\\[(]*(_ZONE_)?[\\s\\])]*$"),handler:wp(["","hour","minute","second","millisecond","zone"])},{name:"hms12WithOffset",regex:i.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)\\s*(_OFFSET_)"),handler:wp(["","hour","minute","second","meridiem","offset"])},{name:"hms12",regex:i.compile("(_H12_):(_MIN_):(_SEC_)\\s*(_MERIDIEM_)"),handler:wp(["","hour","minute","second","meridiem"])},{name:"hms24",regex:i.compile("(_H24_):(_MIN_):(_SEC_)(?:\\.(_MS_))?"),handler:wp(["","hour","minute","second","millisecond"])},{name:"hm12",regex:i.compile("(_H12_):(_MIN_)\\s*(_MERIDIEM_)"),handler:wp(["","hour","minute","meridiem"])},{name:"hm24",regex:i.compile("(_H24_):(_MIN_)"),handler:wp(["","hour","minute"])},{name:"h12",regex:i.compile("(_H12_)\\s*(_MERIDIEM_)"),handler:wp(["","hour","meridiem"])},{name:"8digit",regex:/^((?:19|20)\d{2})(\d{2})(\d{2})$/,handler:wp(["","year","month","day"])},{name:"yearMonthnameDay",regex:i.compile("(_YEAR4_)[\\s.-]+(_MONTHNAME_)[\\s,.-]+(_DAY_)(_ORDINAL_)?"),handler:wp(["","year","monthname","day"])},{name:"dayMonthnameYear",regex:i.compile("(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)[\\s,.-]+(_YEAR_)"),handler:wp(["","day","","monthname","year"])},{name:"monthnameDayYear",regex:i.compile("(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?[\\s,.-]+(_YEAR_)"),handler:wp(["","monthname","day","","year"])},{name:"dayMonthname",regex:i.compile("\\b(_DAY_)(_ORDINAL_)?[\\s.-]*(_MONTHNAME_)\\b"),handler:wp(["","day","","monthname"])},{name:"monthnameDay",regex:i.compile("\\b(_MONTHNAME_)[\\s.-]*(_DAY_)(_ORDINAL_)?\\b"),handler:wp(["","monthname","day"])},{name:"hmsNoMeridiem",regex:i.compile("\\b(_H12_|_H24_):(_MIN_):(_SEC_)\\b"),handler:wp(["","hour","minute","second"])},{name:"hmNoMeridiem",regex:i.compile("\\b(_H12_|_H24_):(_MIN_)\\b"),handler:wp(["","hour","minute"])},{name:"ymd",regex:i.compile("(_YEAR4_)([./-])(_MONTH_)\\2+(_DAY_)"),handler:wp(["","year","","month","day"])},{name:"mdy",regex:i.compile("(_MONTH_)([/-])(_DAY_)\\2(_YEAR_)"),handler:wp(["","month","","day","year"])},{name:"dmy",regex:i.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)[./\\s-]+(_YEAR_)"),handler:wp(["","day","month","year"])},{name:"yearLoose",regex:i.compile("_YEAR4_"),handler:wp(["year"])},{name:"dayMonthnameLoose",regex:i.compile("(_DAY_)[\\s.]*(_MONTHNAME_)"),handler:wp(["","day","monthname"])},{name:"monthnameDayLoose",regex:i.compile("(_MONTHNAME_)[\\s.]*(_DAY_)"),handler:wp(["","monthname","day"])},{name:"monthname",regex:i.compile("_MONTHNAME_"),handler:wp(["monthname"])},{name:"year4",regex:i.compile("_YEAR4_"),handler:wp(["year"])},{name:"md",regex:i.compile("(_MONTH_)[/-](_DAY_)"),handler:wp(["","month","day"])},{name:"dm",regex:i.compile("(_DAY_)(?:_ORDINAL_)?[./\\s-]+(_MONTH_)"),handler:wp(["","day","month"])},{name:"day",regex:i.compile("_DAY_"),handler:wp(["day"])},{name:"year2",regex:i.compile("_YEAR2_"),handler:wp(["year"])},{name:"onlyZone",regex:i.compile("_ZONE_"),handler:wp(["zone"])},{name:"onlyOffset",regex:i.compile("_OFFSET_"),handler:wp(["offset"])}],a=i.baseName.slice(0,5),wc.includes(a)?n:n.filter(e=>!["mdy","md"].includes(e.name))),formatter:(r=i,function(e){let t={};for(let[n,a]of Object.entries(e))if("monthname"===n){if(a){let e=r.monthNameToInt(a);void 0!==e&&(t.month=e)}}else if("hour"===n&&e.meridiem){let n=r.h12ToInt(a,e.meridiem);void 0!==n&&(t.hour=n)}else if("zone"===n){if(a){let e=r.zoneToOffset(a);void 0!==e&&(t.offset=e)}}else if("offset"===n){let e=r.offsetToMinutes(a);void 0!==e&&(t.offset=e)}else if("millisecond"===n){let e=r.millisecondToInt(a);"number"==typeof e&&(t.millisecond=e)}else if(wh.includes(n)){let e=r.toInt(a);"number"==typeof e&&(t[n]=e)}return void 0!==t.year&&t.year<100&&(t.year=b7[String(e.year)]),t.year&&"buddhist"===r.dateOptions.calendar&&(t.year-=543),t})});return wg[e]=s,s}(t),n=function(e,t){let r=wb[t.slice(0,2).toLowerCase()];if(!r)return e;for(let[t,n]of r)e=e.replace(t,n);return e}(e,t);return r.attempt(n)}function wE(e){e.month&&e.day&&void 0===e.year&&(e.year=new Date().getFullYear()),60===e.second&&(e.second=59);let t=new b8(e.year??NaN,(e.month??NaN)-1,e.day,e.hour||0,e.minute||0,e.second||0,e.millisecond||0);return"number"==typeof e.offset?new b8(t.valueOf()-60*e.offset*1e3):t}function wD(e,t=b9){let r=ww(e,t),n=r.invalid?new b8(NaN):wE(r);return n.isValid()||(n.invalid=`Unable to parse date "${e}"`),n}function wx(e,t=b9){return e instanceof Date?new b8(e.valueOf()):"number"==typeof e?new b8(e):wD(e,t)}Date.fromString=b8.fromString=wD,Date.fromAny=b8.fromAny=wx,"u">typeof window&&(window.anyDateParser={fromString:wD,fromAny:wx,fromObject:wE,attempt:ww});var w_=r(5238),wS=r(3826);let wC=function(e){return null==e};function wk(e,t){var r=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(e,t);return r.get?r.get.call(e):r.value}u4.extend(u3),u4.extend(wS),u4.extend(w_);let wP="YYYY-MM-DDTHH:mm:ss.SSSZZ",wR=/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/;function wT(e,t){let r=wR.exec(e);if(!r)return ww(e,t);let n=Number(r[1]),a=void 0===r[2]?void 0:Number(r[2]),o=void 0===r[3]?void 0:Number(r[3]),i=new Date(0);return(i.setUTCFullYear(n,(a??1)-1,o??1),i.getUTCFullYear()!==n||i.getUTCMonth()!==(a??1)-1||i.getUTCDate()!==(o??1))?{invalid:`Invalid ISO calendar date '${e}'`}:{year:n,...void 0!==a&&{month:a},...void 0!==o&&{day:o}}}function wO(e){return null!=e&&28===e.trim().length&&"T"===(e=e.trim())[10]&&":"===e[13]&&":"===e[16]&&"."===e[19]&&("+"===e[23]||"-"===e[23])&&u4(e,wP).isValid()}function w$(e){return u4(e).isToday()}function wN(e){return wO(e)?u4(e,wP).toDate():null}function wI(e,t=!1){let r=u4(e);return t&&(r=r.utc()),r.format(wP)}function wM(e){return u4(e).toDate()}var wj=new WeakMap;let wA=new class{register(e,t){wk(this,wj).set(e,t)}getCalendar(e){if(!e)return;if(e.calendar)return e.calendar;if(e.region){let t=`${e.language}-${e.region}`;if(wk(this,wj).has(t))return wk(this,wj).get(t)}if(e.language&&wk(this,wj).has(e.language))return wk(this,wj).get(e.language);let t=new Intl.DateTimeFormat(e.toString()).resolvedOptions().calendar;return wk(this,wj).set(`${e.language}${e.region?`-${e.region}`:""}`,t),t}constructor(){!function(e,t,r){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object");t.set(e,r)}(this,wj,{writable:!0,value:new Map})}};function wL(e,t){wA.register(e,t)}function wF(e){let t=e??b5();return wA.getCalendar(t instanceof Intl.Locale?t:new Intl.Locale(t))}let wB={mode:"standard",time:"for today",day:!0,month:!0,year:!0,noToday:!1};function wV(e,t={}){let r=wT(e,b5());if(r.invalid)return console.warn(`Could not parse invalid date '${e}'`),null;!wC(r.day)&&wC(r.month)&&(r=Object.assign({},nu(r,"day"),{month:r.day})),r.month&&(r.month-=1),r.day&&(r=Object.assign({},nu(r,"day"),{date:r.day}));let n=u4().set(r).toDate();return wC(r.year)&&(t.year=!1),wC(r.month)&&(t.month=!1),wC(r.date)&&(t.day=!1),wU(n,t)}function wU(e,t){let r,n=t?.locale??b5(),a=new Intl.Locale(n),{calendar:o,mode:i,time:s,day:l,month:u,year:c,noToday:d,numberingSystem:m}={...wB,...{noToday:"am"===a.language},...t},p={calendar:o??wF(a),year:c?"numeric":void 0,month:u?"short":void 0,day:l?"2-digit":void 0,numberingSystem:m},f=u4(e).isToday();if(f&&!d)r=(r=new Intl.RelativeTimeFormat(n,{numeric:"auto"}).format(0,"day"))[0].toLocaleUpperCase(n)+r.slice(1);else{"en"===a.language&&(n="en-GB");let t=new Intl.DateTimeFormat(n,p).formatToParts(e);("en"===a.language||"am"===a.language)&&"standard"==i&&c&&l&&(t=t.map(wW("-"))),"wide"==i&&(t=t.map(wW(" — "))),"ethiopic"===p.calendar&&(t=t.filter((e,t,r)=>"era"!==e.type&&("literal"!==e.type||!(t<r.length-1)||"era"!==r[t+1].type))),r=t.map(e=>e.value).join("")}return(!0===s||f&&"for today"===s)&&(r+=`, ${wH(e)}`),r}let wW=e=>(t,r,n)=>"literal"!==t.type||" "!==t.value||r<n.length-1&&"era"===n[r+1].type?t:{type:"literal",value:e};function wH(e){return e.toLocaleTimeString(b5(),{hour:"2-digit",minute:"2-digit"})}function wz(e,t){return wU(e,{...t,time:!0})}function wK(e,t){let r=wF("string"==typeof t?new Intl.Locale(t):t);return r?hZ(e,g7(r)):e}function wG(e,t){return new Intl.DurationFormat(b5(),t).format(e)}function wZ(e,t){if(null==e)return null;if("string"==typeof e){let r=wT(e,b5());return r.invalid?(console.warn(`Could not interpret '${e}' as a date`),null):(r.day&&!r.month&&(r={...nu(r,"day"),...{month:r.day}}),r.month&&(r.month-=1),r.day&&(r={...nu(r,"day"),...{date:r.day}}),u4(t).set(r))}return u4(e)}let wY=["years","months","days","hours","minutes","seconds"],wq={second:"seconds",minute:"minutes",hour:"hours",day:"days",month:"months",year:"years"},wJ={seconds:45,minutes:45,hours:22,days:26,months:11,years:1/0};function wX(e,t=u4(),r){let n,a=u4(t),o=wZ(e,a);if(null==o)return null;if("string"==typeof r){let e=wq[r]??r;return{[e]:a.diff(o,e)}}let{thresholds:i,largestUnit:s,smallestUnit:l}=r??{};if(void 0!==s||void 0!==l){let e,t=l?wq[l]??l:void 0;return e="auto"===s||void 0===s?function(e,t,r){let n=wY.indexOf(r);for(let a=0;a<wY.length;a++){let o=wY[a];if(t.diff(e,o)>0)return a<=n?o:r}return r}(o,a,t??"seconds"):wq[s]??s,function(e,t,r,n){let a=wY.indexOf(r),o=wY.indexOf(n),i=wY.slice(a,o+1),s={},l=e;for(let e of i){let r=t.diff(l,e);s[e]=r,l=l.add(r,e)}return s}(o,a,e,t??e)}let u=(n=function(e){let t={...wJ};if(e)for(let[r,n]of Object.entries(e))void 0!==n&&(t[wq[r]??r]=n);return t}(i),a.diff(o,"seconds")<n.seconds?"seconds":a.diff(o,"minutes")<n.minutes?"minutes":a.diff(o,"hours")<n.hours?"hours":a.diff(o,"days")<n.days?"days":a.diff(o,"months")<n.months?"months":"years");return{[u]:a.diff(o,u)}}let wQ={style:"short",localeMatcher:"lookup"};function w0(e,t=u4(),r){let n=wX(e,t,r);return null==n?null:wG(n,"object"==typeof r&&r.formatOptions?{...wQ,...r.formatOptions}:wQ)}let w1=(0,ls.createContext)(null);function w4(){let e=ul({externalModuleName:"@openmrs/esm-styleguide"}).preferredDateLocale,t=(0,ls.useMemo)(()=>{let t=b5();return e[t]&&(t=e[t]),t},[window.i18next.language]),r=(0,ls.useMemo)(()=>{let e=wF(t);return void 0!==e?g7(e):void 0},[t]),n=(0,ls.useMemo)(()=>new Intl.Locale(t,{calendar:r?.identifier}),[t,r]),a=(0,ls.useMemo)(()=>r?hZ(h2(h9()),r):h2(h9()),[r]);return{calendar:r,intlLocale:n,today_:a}}let w2=new hI(1793,1,1);var w3={};function w6(){return"u">typeof window&&window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges}function w5(e={}){let{locale:t}=fY();return(0,ls.useMemo)(()=>new(0,v_.K)(t,e),[t,e])}w3={"ar-AE":{decrease:e=>`\u{62E}\u{641}\u{636} ${e.fieldLabel}`,increase:e=>`\u{632}\u{64A}\u{627}\u{62F}\u{629} ${e.fieldLabel}`,numberField:"حقل رقمي"},"bg-BG":{decrease:e=>`\u{41D}\u{430}\u{43C}\u{430}\u{43B}\u{44F}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{441}\u{438}\u{43B}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,numberField:"Номер на полето"},"cs-CZ":{decrease:e=>`Sn\xed\u{17E}it ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}it ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"da-DK":{decrease:e=>`Reducer ${e.fieldLabel}`,increase:e=>`\xd8g ${e.fieldLabel}`,numberField:"Talfelt"},"de-DE":{decrease:e=>`${e.fieldLabel} verringern`,increase:e=>`${e.fieldLabel} erh\xf6hen`,numberField:"Nummernfeld"},"el-GR":{decrease:e=>`\u{39C}\u{3B5}\u{3AF}\u{3C9}\u{3C3}\u{3B7} ${e.fieldLabel}`,increase:e=>`\u{391}\u{3CD}\u{3BE}\u{3B7}\u{3C3}\u{3B7} ${e.fieldLabel}`,numberField:"Πεδίο αριθμού"},"en-US":{decrease:e=>`Decrease ${e.fieldLabel}`,increase:e=>`Increase ${e.fieldLabel}`,numberField:"Number field"},"es-ES":{decrease:e=>`Reducir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"et-EE":{decrease:e=>`V\xe4henda ${e.fieldLabel}`,increase:e=>`Suurenda ${e.fieldLabel}`,numberField:"Numbri v\xe4li"},"fi-FI":{decrease:e=>`V\xe4henn\xe4 ${e.fieldLabel}`,increase:e=>`Lis\xe4\xe4 ${e.fieldLabel}`,numberField:"Numerokentt\xe4"},"fr-FR":{decrease:e=>`Diminuer ${e.fieldLabel}`,increase:e=>`Augmenter ${e.fieldLabel}`,numberField:"Champ de nombre"},"he-IL":{decrease:e=>`\u{5D4}\u{5E7}\u{5D8}\u{5DF} ${e.fieldLabel}`,increase:e=>`\u{5D4}\u{5D2}\u{5D3}\u{5DC} ${e.fieldLabel}`,numberField:"שדה מספר"},"hr-HR":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"hu-HU":{decrease:e=>`${e.fieldLabel} cs\xf6kkent\xe9se`,increase:e=>`${e.fieldLabel} n\xf6vel\xe9se`,numberField:"Sz\xe1mmező"},"it-IT":{decrease:e=>`Riduci ${e.fieldLabel}`,increase:e=>`Aumenta ${e.fieldLabel}`,numberField:"Campo numero"},"ja-JP":{decrease:e=>`${e.fieldLabel}\u{3092}\u{7E2E}\u{5C0F}`,increase:e=>`${e.fieldLabel}\u{3092}\u{62E1}\u{5927}`,numberField:"数値フィールド"},"ko-KR":{decrease:e=>`${e.fieldLabel} \u{AC10}\u{C18C}`,increase:e=>`${e.fieldLabel} \u{C99D}\u{AC00}`,numberField:"번호 필드"},"lt-LT":{decrease:e=>`Suma\u{17E}inti ${e.fieldLabel}`,increase:e=>`Padidinti ${e.fieldLabel}`,numberField:"Numerio laukas"},"lv-LV":{decrease:e=>`Samazin\u{101}\u{161}ana ${e.fieldLabel}`,increase:e=>`Palielin\u{101}\u{161}ana ${e.fieldLabel}`,numberField:"Skaitļu lauks"},"nb-NO":{decrease:e=>`Reduser ${e.fieldLabel}`,increase:e=>`\xd8k ${e.fieldLabel}`,numberField:"Tallfelt"},"nl-NL":{decrease:e=>`${e.fieldLabel} verlagen`,increase:e=>`${e.fieldLabel} verhogen`,numberField:"Getalveld"},"pl-PL":{decrease:e=>`Zmniejsz ${e.fieldLabel}`,increase:e=>`Zwi\u{119}ksz ${e.fieldLabel}`,numberField:"Pole numeru"},"pt-BR":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo de n\xfamero"},"pt-PT":{decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:"Campo num\xe9rico"},"ro-RO":{decrease:e=>`Sc\u{103}dere ${e.fieldLabel}`,increase:e=>`Cre\u{219}tere ${e.fieldLabel}`,numberField:"C\xe2mp numeric"},"ru-RU":{decrease:e=>`\u{423}\u{43C}\u{435}\u{43D}\u{44C}\u{448}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{432}\u{435}\u{43B}\u{438}\u{447}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,numberField:"Числовое поле"},"sk-SK":{decrease:e=>`Zn\xed\u{17E}i\u{165} ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}i\u{165} ${e.fieldLabel}`,numberField:"Č\xedseln\xe9 pole"},"sl-SI":{decrease:e=>`Upadati ${e.fieldLabel}`,increase:e=>`Pove\u{10D}ajte ${e.fieldLabel}`,numberField:"Številčno polje"},"sr-SP":{decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:"Polje broja"},"sv-SE":{decrease:e=>`Minska ${e.fieldLabel}`,increase:e=>`\xd6ka ${e.fieldLabel}`,numberField:"Nummerf\xe4lt"},"tr-TR":{decrease:e=>`${e.fieldLabel} azalt`,increase:e=>`${e.fieldLabel} artt\u{131}r`,numberField:"Sayı alanı"},"uk-UA":{decrease:e=>`\u{417}\u{43C}\u{435}\u{43D}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,increase:e=>`\u{417}\u{431}\u{456}\u{43B}\u{44C}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,numberField:"Поле номера"},"zh-CN":{decrease:e=>`\u{964D}\u{4F4E} ${e.fieldLabel}`,increase:e=>`\u{63D0}\u{9AD8} ${e.fieldLabel}`,numberField:"数字字段"},"zh-TW":{decrease:e=>`\u{7E2E}\u{5C0F} ${e.fieldLabel}`,increase:e=>`\u{653E}\u{5927} ${e.fieldLabel}`,numberField:"數字欄位"}};var w9={};w9={"ar-AE":{Empty:"فارغ"},"bg-BG":{Empty:"Изпразни"},"cs-CZ":{Empty:"Pr\xe1zdn\xe9"},"da-DK":{Empty:"Tom"},"de-DE":{Empty:"Leer"},"el-GR":{Empty:"Άδειο"},"en-US":{Empty:"Empty"},"es-ES":{Empty:"Vac\xedo"},"et-EE":{Empty:"T\xfchjenda"},"fi-FI":{Empty:"Tyhj\xe4"},"fr-FR":{Empty:"Vide"},"he-IL":{Empty:"ריק"},"hr-HR":{Empty:"Prazno"},"hu-HU":{Empty:"\xdcres"},"it-IT":{Empty:"Vuoto"},"ja-JP":{Empty:"空"},"ko-KR":{Empty:"비어 있음"},"lt-LT":{Empty:"Tuščias"},"lv-LV":{Empty:"Tukšs"},"nb-NO":{Empty:"Tom"},"nl-NL":{Empty:"Leeg"},"pl-PL":{Empty:"Pusty"},"pt-BR":{Empty:"Vazio"},"pt-PT":{Empty:"Vazio"},"ro-RO":{Empty:"Gol"},"ru-RU":{Empty:"Не заполнено"},"sk-SK":{Empty:"Pr\xe1zdne"},"sl-SI":{Empty:"Prazen"},"sr-SP":{Empty:"Prazno"},"sv-SE":{Empty:"Tomt"},"tr-TR":{Empty:"Boş"},"uk-UA":{Empty:"Пусто"},"zh-CN":{Empty:"空"},"zh-TW":{Empty:"空白"}};let w8=()=>{};function w7(e){var t;let r=(0,ls.useRef)(void 0),{value:n,textValue:a,minValue:o,maxValue:i,isDisabled:s,isReadOnly:l,isRequired:u,onIncrement:c,onIncrementPage:d,onDecrement:m,onDecrementPage:p,onDecrementToMin:f,onIncrementToMax:h}=e,g=hr((t=w9)&&t.__esModule?t.default:t,"@react-aria/spinbutton"),y=(0,ls.useRef)(!1),v=(0,ls.useCallback)(()=>{clearTimeout(r.current),y.current=!1},[]),b=fa(()=>{v()});(0,ls.useEffect)(()=>()=>b(),[]);let{keyboardProps:w}=p0({isDisabled:s||l,shortcuts:{PageUp:()=>d?void d():!!c&&void c(),ArrowUp:()=>!!c&&void c(),PageDown:()=>p?void p():!!m&&void m(),ArrowDown:()=>!!m&&void m(),Home:()=>!!f&&void f(),End:()=>!!h&&void h()},allowRepeats:!0}),E=(0,ls.useRef)(!1),D=()=>{E.current=!0},x=()=>{E.current=!1},_=""===a?g.format("Empty"):(a||`${n}`).replace("-","−");(0,ls.useEffect)(()=>{E.current&&(mB&&mB.clear("assertive"),mV(_,"assertive"))},[_]);let S=(0,ls.useCallback)(()=>{v()},[v]),C=fa(c??w8),k=fa(m??w8),P=fa(()=>{(void 0===i||isNaN(i)||void 0===n||isNaN(n)||n<i)&&(C(),R(60))}),R=fa(e=>{b(),y.current=!0,r.current=window.setTimeout(P,e)}),T=fa(()=>{(void 0===o||isNaN(o)||void 0===n||isNaN(n)||n>o)&&(k(),O(60))}),O=fa(e=>{b(),y.current=!0,r.current=window.setTimeout(T,e)}),$=e=>{e.preventDefault()},{addGlobalListener:N,removeAllGlobalListeners:I}=fo(),M=(0,ls.useRef)(!1),[j,A]=(0,ls.useState)(null);(0,ls.useEffect)(()=>{"touch"===j?R(600):j?R(400):j||b()},[j]);let[L,F]=(0,ls.useState)(null);return(0,ls.useEffect)(()=>{"touch"===L?O(600):L?O(400):L||b()},[L]),{spinButtonProps:{role:"spinbutton","aria-valuenow":void 0===n||isNaN(n)?void 0:n,"aria-valuetext":_,"aria-valuemin":o,"aria-valuemax":i,"aria-disabled":s||void 0,"aria-readonly":l||void 0,"aria-required":u||void 0,...w,onFocus:D,onBlur:x},incrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(c?.(),A("mouse")):(N(window,"pointercancel",S,{capture:!0}),M.current=!1,A("touch")),N(window,"contextmenu",$)},onPressUp:e=>{v(),"touch"===e.pointerType&&(M.current=!0),I(),A(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&M.current&&c?.(),M.current=!1,A(null)},onFocus:D,onBlur:x},decrementButtonProps:{onPressStart:e=>{v(),"touch"!==e.pointerType?(m?.(),F("mouse")):(N(window,"pointercancel",S,{capture:!0}),M.current=!1,F("touch"))},onPressUp:e=>{v(),"touch"===e.pointerType&&(M.current=!0),I(),F(null)},onPressEnd:e=>{v(),"touch"===e.pointerType&&!y.current&&M.current&&m?.(),M.current=!1,F(null)},onFocus:D,onBlur:x}}}let Ee=null;var Et=r(6284);function Er(e,t,r){let n="+"===e?t+r:t-r;if(t%1!=0||r%1!=0){let a=t.toString().split("."),o=r.toString().split("."),i=Math.pow(10,Math.max(a[1]&&a[1].length||0,o[1]&&o[1].length||0));t=Math.round(t*i),r=Math.round(r*i),n=("+"===e?t+r:t-r)/i}return n}let En=(0,ls.createContext)(null),Ea=(0,ls.createContext)(null),Eo=(0,ls.forwardRef)(function(e,t){[e,t]=mN(e,t,En);let{validationBehavior:r}=m$(vK)||{},n=e.validationBehavior??r??"native",{locale:a}=fY(),o=function(e){let{minValue:t,maxValue:r,step:n,formatOptions:a,value:o,defaultValue:i=NaN,onChange:s,locale:l,isDisabled:u,isReadOnly:c,commitBehavior:d="snap"}=e;null===o&&(o=NaN);let m=(0,ls.useCallback)(e=>void 0===n||isNaN(n)?v4(e,t,r):v3(e,t,r,n),[n,t,r]);void 0===o||isNaN(o)||"snap"!==d||(o=m(o)),isNaN(i)||"snap"!==d||(i=m(i));let[p,f]=yl(o,isNaN(i)?NaN:i,s),[h]=(0,ls.useState)(p),[g,y]=(0,ls.useState)(()=>isNaN(p)?"":new(0,v_.K)(l,a).format(p)),v=(0,ls.useMemo)(()=>new(0,Et.d)(l,a),[l,a]),b=(0,ls.useMemo)(()=>v.getNumberingSystem(g),[v,g]),w=(0,ls.useMemo)(()=>new(0,v_.K)(l,{...a,numberingSystem:b}),[l,a,b]),E=(0,ls.useMemo)(()=>w.resolvedOptions(),[w]),D=(0,ls.useCallback)(e=>isNaN(e)||null===e?"":w.format(e),[w]),x=vi({...e,value:p}),_=void 0===n||isNaN(n)?1:n;"percent"===E.style&&(void 0===n||isNaN(n))&&(_=.01);let[S,C]=(0,ls.useState)(p),[k,P]=(0,ls.useState)(l),[R,T]=(0,ls.useState)(a);Object.is(p,S)&&l===k&&function(e,t){if(e===t)return!0;if(!e||!t)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(t[n]!==e[n])return!1;return!0}(a,R)||(y(D(p)),C(p),P(l),T(a));let O=(0,ls.useMemo)(()=>v.parse(g),[v,g]),$=(e,n=0)=>{if(isNaN(O))return v3(isNaN(n)?0:n,t,r,_);{let n=v3(O,t,r,_);return"+"===e&&n>O||"-"===e&&n<O?n:v3(Er(e,O,_),t,r,_)}},N=(0,ls.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===r||isNaN(r)||v3(O,t,r,_)>O||Er("+",O,_)<=r),[u,c,t,r,_,O]),I=(0,ls.useMemo)(()=>!u&&!c&&(isNaN(O)||void 0===t||isNaN(t)||v3(O,t,r,_)<O||Er("-",O,_)>=t),[u,c,t,r,_,O]);return{...x,validate:e=>v.isValidPartialNumber(e,t,r),increment:()=>{let e=$("+",t);e===p&&y(D(e)),f(e),x.commitValidation()},incrementToMax:()=>{null!=r&&(f(v3(r,t,r,_)),x.commitValidation())},decrement:()=>{let e=$("-",r);e===p&&y(D(e)),f(e),x.commitValidation()},decrementToMin:()=>{null!=t&&(f(t),x.commitValidation())},canIncrement:N,canDecrement:I,minValue:t,maxValue:r,numberValue:O,defaultNumberValue:isNaN(i)?h:i,setNumberValue:f,setInputValue:y,inputValue:g,commit:e=>{let t=void 0===e?g:e,r=O;if(void 0!==e&&(r=v.parse(t)),!t.length){f(NaN),y(void 0===o?"":D(p));return}if(isNaN(r))return void y(D(p));let n="snap"===d?m(r):r,a=(n=v.parse(D(n)))!==p;f(n),y(D(void 0===o?n:p)),a&&x.commitValidation()}}}({...e,locale:a,validationBehavior:n}),i=(0,ls.useRef)(null),[s,l]=mI(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:u,groupProps:c,inputProps:d,incrementButtonProps:m,decrementButtonProps:p,descriptionProps:f,errorMessageProps:h,...g}=function(e,t,r){var n,a,o,i,s,l,u,c,d;let m,{id:p,decrementAriaLabel:f,incrementAriaLabel:h,isDisabled:g,isReadOnly:y,isRequired:v,minValue:b,maxValue:w,autoFocus:E,label:D,formatOptions:x,onBlur:_=()=>{},onFocus:S,onFocusChange:C,onKeyDown:k,onKeyUp:P,description:R,errorMessage:T,isWheelDisabled:O,...$}=e,{increment:N,incrementToMax:I,decrement:M,decrementToMin:j,numberValue:A,inputValue:L,commit:F,commitValidation:B}=t,V=hr((n=w3)&&n.__esModule?n.default:n,"@react-aria/numberfield"),U=(0,ls.useCallback)(()=>{let e=r.current?.value??"";(0,fi.flushSync)(()=>{F()}),r.current?.value!==e&&mV(r.current?.value??"","assertive")},[F,r]),W=mD(p),{focusProps:H}=pG({onBlur(){U()}}),z=w5(x),K=(0,ls.useMemo)(()=>z.resolvedOptions(),[z]),G=w5({...x,currencySign:void 0}),Z=(0,ls.useMemo)(()=>isNaN(A)?"":G.format(A),[G,A]),{spinButtonProps:Y,incrementButtonProps:q,decrementButtonProps:J}=w7({isDisabled:g,isReadOnly:y,isRequired:v,maxValue:w,minValue:b,onIncrement:N,onIncrementToMax:I,onDecrement:M,onDecrementToMin:j,value:A,textValue:Z}),[X,Q]=(0,ls.useState)(!1),{focusWithinProps:ee}=fE({isDisabled:g,onFocusWithinChange:Q});!function(e,t){let{onScroll:r,isDisabled:n}=e,a=(0,ls.useCallback)(e=>{!e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),r&&r({deltaX:e.deltaX,deltaY:e.deltaY}))},[r]);gE(t,"wheel",n?void 0:a)}({onScroll:(0,ls.useCallback)(e=>{!(Math.abs(e.deltaY)<=Math.abs(e.deltaX))&&(e.deltaY>0?N():e.deltaY<0&&M())},[M,N]),isDisabled:O||g||y||!X},r);let et=(K.maximumFractionDigits??0)>0,er=void 0===t.minValue||isNaN(t.minValue)||t.minValue<0,en="numeric";pm()?er?en="text":et&&(en="decimal"):py()&&(er?en="numeric":et&&(en="decimal"));let ea=mY(e),{keyboardProps:eo}=p0({isDisabled:g||y,shortcuts:{Enter:()=>((0,fi.flushSync)(()=>{F()}),B(),{shouldPreventDefault:!1})},onKeyDown:k,onKeyUp:P}),{isInvalid:ei,validationErrors:es,validationDetails:el}=t.displayValidation,{labelProps:eu,inputProps:ec,descriptionProps:ed,errorMessageProps:em}=function(e,t,r){let n=fa(e=>{let n=r.current;if(!n)return;let a=null;switch(e.inputType){case"historyUndo":case"historyRedo":case"insertLineBreak":return;case"deleteContent":case"deleteByCut":case"deleteByDrag":a=n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteContentForward":a=n.selectionEnd===n.selectionStart?n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd+1):n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteContentBackward":a=n.selectionEnd===n.selectionStart?n.value.slice(0,n.selectionStart-1)+n.value.slice(n.selectionStart):n.value.slice(0,n.selectionStart)+n.value.slice(n.selectionEnd);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":a=n.value.slice(n.selectionStart);break;default:null!=e.data&&(a=n.value.slice(0,n.selectionStart)+e.data+n.value.slice(n.selectionEnd))}null!=a&&t.validate(a)||e.preventDefault()});(0,ls.useEffect)(()=>{if(!w6()||!r.current)return;let e=r.current;return e.addEventListener("beforeinput",n,!1),()=>{e.removeEventListener("beforeinput",n,!1)}},[r]);let a=w6()?null:e=>{let r=m2(e).value.slice(0,m2(e).selectionStart)+e.data+m2(e).value.slice(m2(e).selectionEnd);t.validate(r)||e.preventDefault()},{labelProps:o,inputProps:i,descriptionProps:s,errorMessageProps:l,...u}=function(e,t){let{inputElementType:r="input",isDisabled:n=!1,isRequired:a=!1,isReadOnly:o=!1,type:i="text",validationBehavior:s="aria"}=e,[l,u]=yl(e.value,e.defaultValue||"",e.onChange),{focusableProps:c}=p3(e,t),d=vi({...e,value:l}),{isInvalid:m,validationErrors:p,validationDetails:f}=d.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:y,errorMessageProps:v}=y2({...e,isInvalid:m,errorMessage:e.errorMessage||p}),b=mY(e,{labelable:!0}),w={type:i,pattern:e.pattern},[E]=(0,ls.useState)(l);return y3(t,e.defaultValue??E,u),y6(e,d,t),{labelProps:h,inputProps:mk(b,"input"===r?w:void 0,{disabled:n,readOnly:o,required:a&&"native"===s,"aria-required":a&&"aria"===s||void 0,"aria-invalid":m||void 0,"aria-errormessage":e["aria-errormessage"],"aria-activedescendant":e["aria-activedescendant"],"aria-autocomplete":e["aria-autocomplete"],"aria-haspopup":e["aria-haspopup"],"aria-controls":e["aria-controls"],value:l,onChange:e=>u(m2(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(ll().version,10)>=17?"enterKeyHint":"enterkeyhint"]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...c,...g}),descriptionProps:y,errorMessageProps:v,isInvalid:m,validationErrors:p,validationDetails:f}}(e,r),c=(0,ls.useRef)(null);return{inputProps:mk(i,{onBeforeInput:a,onCompositionStart(){let{value:e,selectionStart:t,selectionEnd:n}=r.current;c.current={value:e,selectionStart:t,selectionEnd:n}},onCompositionEnd(){if(r.current&&!t.validate(r.current.value)){let{value:e,selectionStart:n,selectionEnd:a}=c.current;r.current.value=e,r.current.setSelectionRange(n,a),t.setInputValue(e)}}}),labelProps:o,descriptionProps:s,errorMessageProps:l,...u}}({...$,...ea,name:void 0,form:void 0,label:D,autoFocus:E,isDisabled:g,isReadOnly:y,isRequired:v,validate:void 0,[vo]:t,value:L,defaultValue:"!",autoComplete:"off","aria-label":e["aria-label"]||void 0,"aria-labelledby":e["aria-labelledby"]||void 0,id:W,type:"text",inputMode:en,onChange:e=>{t.validate(e)&&t.setInputValue(e)},onBlur:_,onFocus:S,onFocusChange:C,onPaste:t=>{e.onPaste?.(t);let r=m2(t);r&&(r.selectionEnd??-1)-(r.selectionStart??0)===r.value.length&&(t.preventDefault(),F(t.clipboardData?.getData?.("text/plain")?.trim()??""))},description:R,errorMessage:T},t,r),ep=mk(eo,ec);y3(r,t.defaultNumberValue,t.setNumberValue),a=t,o=e.validationBehavior,i=e.commitBehavior,s=r,l=t.minValue,u=t.maxValue,c=e.step,d=t.numberValue,mu(()=>{let e=s.current;if("validate"!==i||a.realtimeValidation.isInvalid||!e||e.disabled||(!Ee&&"u">typeof document&&((Ee=document.createElement("input")).type="number"),!Ee))return;Ee.min=null==l||isNaN(l)?"":String(l),Ee.max=null==u||isNaN(u)?"":String(u),Ee.step=null==c||isNaN(c)?"":String(c),Ee.value=null==d||isNaN(d)?"":String(d);let t=e.validity.valid&&Ee.validity.valid,r=e.validationMessage||Ee.validationMessage,n={isInvalid:!t,validationErrors:r?[r]:[],validationDetails:{badInput:e.validity.badInput,customError:e.validity.customError,patternMismatch:e.validity.patternMismatch,rangeOverflow:Ee.validity.rangeOverflow,rangeUnderflow:Ee.validity.rangeUnderflow,stepMismatch:Ee.validity.stepMismatch,tooLong:e.validity.tooLong,tooShort:e.validity.tooShort,typeMismatch:e.validity.typeMismatch,valueMissing:e.validity.valueMissing,valid:t}};a.updateValidation(n),"native"!==o||Ee.validity.valid||e.setCustomValidity(Ee.validationMessage)});let ef=mk(Y,H,ep,{role:null,"aria-roledescription":pf()?null:V.format("numberField"),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:"off",spellCheck:"false"});"native"===e.validationBehavior&&(ef["aria-required"]=void 0);let eh=e=>{((e=document)=>e.activeElement)()!==r.current&&("mouse"===e.pointerType?r.current?.focus():e.target.focus())},eg=e["aria-label"]||("string"==typeof e.label?e.label:"");eg||(m=null!=e.label?eu.id:e["aria-labelledby"]);let ey=mD(),ev=mD(),eb=mk(q,{"aria-label":h||V.format("increase",{fieldLabel:eg}).trim(),id:m&&!h?ey:null,"aria-labelledby":m&&!h?`${ey} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:eh}),ew=mk(J,{"aria-label":f||V.format("decrease",{fieldLabel:eg}).trim(),id:m&&!f?ev:null,"aria-labelledby":m&&!f?`${ev} ${m}`:null,"aria-controls":W,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canDecrement,onPressStart:eh});return{groupProps:{...ee,role:"group","aria-disabled":g,"aria-invalid":ei?"true":void 0},labelProps:eu,inputProps:ef,incrementButtonProps:eb,decrementButtonProps:ew,errorMessageProps:em,descriptionProps:ed,isInvalid:ei,validationErrors:es,validationDetails:el}}({...mM(e),label:l,validationBehavior:n},o,i),y=mO({...e,values:{state:o,isDisabled:e.isDisabled||!1,isInvalid:g.isInvalid||!1,isRequired:e.isRequired||!1,isReadOnly:e.isReadOnly||!1},defaultClassName:"react-aria-NumberField"}),v=mY(e,{global:!0});return delete v.id,ll().createElement(mT,{values:[[Ea,o],[yR,c],[yO,{...d,ref:i}],[vq,{...u,ref:s}],[fP,{slots:{increment:m,decrement:p}}],[f$,{slots:{description:f,errorMessage:h}}],[vW,g]]},ll().createElement(mL.div,{...v,...y,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":g.isInvalid||void 0}),e.name&&ll().createElement("input",{type:"hidden",name:e.name,form:e.form,value:isNaN(o.numberValue)?"":o.numberValue,disabled:e.isDisabled||void 0}))});function Ei(e,t){return Number.parseInt(wU(e,{calendar:t.calendar,locale:t.baseName,day:!1,month:!1,noToday:!0,numberingSystem:"latn"}))}let Es=(0,ls.forwardRef)(function(e,t){let{className:r}=e,n=(0,ls.useContext)(yb),a=(0,ls.useContext)(yw),o=n??a,i=(0,ls.useContext)(w1),s=h9(),l=wU(o.visibleRange.start.toDate(s),{calendar:i.calendar,locale:i.baseName,day:!1,year:!1,noToday:!0}),u=Ei(o.visibleRange.start.toDate(s),i),c=o.maxValue?Ei(o.maxValue.toDate(s),i):void 0,d=o.minValue?Ei(o.minValue.toDate(s),i):void 0,m=(0,ls.useCallback)(e=>{o.setFocusedDate(o.focusedDate.cycle("year",e-o.focusedDate.year))},[]);return o&&(0,lc.jsxs)("span",{ref:t,className:r,children:[(0,lc.jsx)("span",{children:l}),(0,lc.jsxs)(Eo,{formatOptions:{useGrouping:!1},maxValue:c,minValue:d,onChange:m,value:u,children:[(0,lc.jsx)(y$,{}),(0,lc.jsxs)(yT,{children:[(0,lc.jsx)(fR,{slot:"increment",children:(0,lc.jsx)(cK,{size:8})}),(0,lc.jsx)(fR,{slot:"decrement",children:(0,lc.jsx)(cW,{size:8})})]})]})]})}),El="-esm-report-builder__datepicker-module__inputGroup___8HE83",Eu="-esm-report-builder__datepicker-module__inputSegment___bZPCL",Ec="-esm-report-builder__datepicker-module__dateInputWrapper___ZGn+P",Ed="-esm-report-builder__datepicker-module__invalidText___mb1DW",Em="-esm-report-builder__datepicker-module__flatButton___DL7RZ",Ep="-esm-report-builder__datepicker-module__flatButtonMd___JZlIZ",Ef="-esm-report-builder__datepicker-module__flatButtonSm___bOLZt",Eh="-esm-report-builder__datepicker-module__flatButtonLg___IQPkt";function Eg({children:e}){let t=(0,ls.useContext)(bq),r=(0,ls.useContext)(bJ),n=t??r,a=uH(()=>n?.close());return(0,lc.jsx)(vU,{className:"-esm-report-builder__datepicker-module__dialog___vu+V8",ref:a,children:e})}let Ey=(0,ls.forwardRef)(function({variant:e,today_:t,minDate:r,maxDate:n},a){let o=(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsxs)("header",{className:"-esm-report-builder__datepicker-module__header___8V465",children:[(0,lc.jsx)(fR,{className:ch()(Em,Ep),slot:"previous",children:(0,lc.jsx)(cQ,{size:16})}),(0,lc.jsx)(Es,{className:"-esm-report-builder__datepicker-module__monthYear___kwBXn"}),(0,lc.jsx)(fR,{className:ch()(Em,Ep),slot:"next",children:(0,lc.jsx)(c0,{size:16})})]}),(0,lc.jsx)(y_,{className:"-esm-report-builder__datepicker-module__calendarGrid___Po5J8",children:e=>(0,lc.jsx)(yP,{className:ch()("cds--date-picker__day",{"-esm-report-builder__datepicker-module__today___EotRU":0===t.compare(e)}),date:e},e.toString())})]});return(0,lc.jsx)(bz,{ref:a,className:"-esm-report-builder__datepicker-module__popover___rJRGV",placement:"bottom start",offset:1,isNonModal:!0,children:(0,lc.jsx)(Eg,{children:"range"===e?(0,lc.jsx)(yD,{minValue:r,maxValue:n,className:"cds--date-picker__calendar",children:o}):(0,lc.jsx)(yE,{children:o})})})}),Ev=(0,ls.forwardRef)(function(e,t){let r=(0,ls.useContext)(bq),[n,a]=mN({slot:e.slot},t,vR),{locale:o}=fY(),i=vP({...n,locale:o,createCalendar:g7}),s=(0,ls.useRef)(null),{fieldProps:l,inputProps:u}=y7({...n,inputRef:s},i,a),c=(0,ls.useCallback)(()=>{i.isDisabled||r.toggle()},[]);return(0,lc.jsxs)(mT,{values:[[vT,i],[yO,{...u,ref:s}],[yR,{...l,ref:a,isInvalid:i.isInvalid}]],children:[(0,lc.jsx)(yT,{...e,id:e.id,ref:t,slot:e.slot||void 0,className:e.className,isDisabled:i.isDisabled,isInvalid:i.isInvalid,onClick:c,children:i.segments.map((t,r)=>(0,ls.cloneElement)(e.children(t),{key:r}))}),(0,lc.jsx)(y$,{})]})}),Eb=(0,ls.forwardRef)(function(e,t){let r=(0,ls.useContext)(bq),n=(0,ls.useContext)(bJ);return(r??n).isInvalid?(0,lc.jsx)(d8,{ref:t,size:16,...e}):(0,lc.jsx)(cU,{ref:t,size:16,...e})});class Ew{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}}let EE=new Map,ED=(0,ls.forwardRef)(function({segment:e,...t},r){let n=(0,ls.useContext)(vT),a=mP(r),{segmentProps:o}=function(e,t,r){let n,a,o,i,s=(0,ls.useRef)(""),{locale:l,direction:u}=fY(),c=function(){var e;let{locale:t}=fY(),r=ht((e=y0)&&e.__esModule?e.default:e,"@react-aria/datepicker");return(0,ls.useMemo)(()=>{try{return new Intl.DisplayNames(t,{type:"dateTimeField"})}catch{return new Ew(t,r)}},[t,r])}(),{ariaLabel:d,ariaLabelledBy:m,ariaDescribedBy:p,focusManager:f}=y5.get(t),h=e.isPlaceholder?"":e.text,g=(0,ls.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),y=f4({month:"long",timeZone:g.timeZone}),v=f4({hour:"numeric",hour12:g.hour12,timeZone:g.timeZone});if("month"!==e.type||e.isPlaceholder)"hour"!==e.type||e.isPlaceholder||(h=v.format(t.dateValue));else{let e=y.format(t.dateValue);h=e!==h?`${h} \u{2013} ${e}`:e}let{spinButtonProps:b}=w7({value:e.value??void 0,textValue:h,minValue:e.minValue,maxValue:e.maxValue,isDisabled:t.isDisabled,isReadOnly:t.isReadOnly||!e.isEditable,isRequired:t.isRequired,onIncrement:()=>{s.current="",t.increment(e.type)},onDecrement:()=>{s.current="",t.decrement(e.type)},onIncrementPage:()=>{s.current="",t.incrementPage(e.type)},onDecrementPage:()=>{s.current="",t.decrementPage(e.type)},onIncrementToMax:()=>{s.current="",t.incrementToMax(e.type)},onDecrementToMin:()=>{s.current="",t.decrementToMin(e.type)}}),w=(0,ls.useMemo)(()=>new(0,Et.d)(l,{maximumFractionDigits:0}),[l]),E=()=>{if(e.text===e.placeholder&&f.focusPrevious(),!w.isValidPartialNumber(e.text)||t.isReadOnly||e.isPlaceholder)("dayPeriod"===e.type||"era"===e.type)&&t.clearSegment(e.type);else{let r=e.text.slice(0,-1),n=w.parse(r);0===(r=0===n?"":r).length||0===n?t.clearSegment(e.type):t.setSegment(e.type,n),s.current=r}},{keyboardProps:D}=p0({shortcuts:{Backspace:()=>{E()},Delete:()=>{E()},"Mod+a":()=>{}},allowRepeats:!0}),{startsWith:x}=(n=function(e){let{locale:t}=fY(),r=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(EE.has(r))return EE.get(r);let n=new Intl.Collator(t,e);return EE.set(r,n),n}({usage:"search",sensitivity:"base"}),a=(0,ls.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===n.compare(e.slice(0,t.length),t)),[n]),o=(0,ls.useCallback)((e,t)=>0===t.length||(e=e.normalize("NFC"),t=t.normalize("NFC"),0===n.compare(e.slice(-t.length),t)),[n]),i=(0,ls.useCallback)((e,t)=>{if(0===t.length)return!0;e=e.normalize("NFC");let r=0,a=(t=t.normalize("NFC")).length;for(;r+a<=e.length;r++){let o=e.slice(r,r+a);if(0===n.compare(t,o))return!0}return!1},[n]),(0,ls.useMemo)(()=>({startsWith:a,endsWith:o,contains:i}),[a,o,i])),_=f4({hour:"numeric",hour12:!0}),S=(0,ls.useMemo)(()=>{let e=new Date;return e.setHours(0),_.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[_]),C=(0,ls.useMemo)(()=>{let e=new Date;return e.setHours(12),_.formatToParts(e).find(e=>"dayPeriod"===e.type).value},[_]),k=f4({year:"numeric",era:"narrow",timeZone:"UTC"}),P=(0,ls.useMemo)(()=>{if("era"!==e.type)return[];let r=hZ(new hI(1,1,1),t.calendar),n=t.calendar.getEras().map(e=>{let t=r.set({year:1,month:1,day:1,era:e}).toDate("UTC"),n=k.formatToParts(t),a=n.find(e=>"era"===e.type)?.value??e;return{era:e,formatted:a}}),a=function(e){e.sort();let t=e[0],r=e[e.length-1];for(let e=0;e<t.length;e++)if(t[e]!==r[e])return e;return 0}(n.map(e=>e.formatted));if(a)for(let e of n)e.formatted=e.formatted.slice(a);return n},[k,t.calendar,e.type]),R=r=>{if(t.isDisabled||t.isReadOnly)return;let n=s.current+r;switch(e.type){case"dayPeriod":if(x(S,r))t.setSegment("dayPeriod",0);else if(x(C,r))t.setSegment("dayPeriod",1);else break;f.focusNext();break;case"era":{let e=P.find(e=>x(e.formatted,r));e&&(t.setSegment("era",e.era),f.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!w.isValidPartialNumber(n))return;let a=w.parse(n),o=a;if(void 0!==e.maxValue&&a>e.maxValue&&(o=w.parse(r)),isNaN(a))return;t.setSegment(e.type,o),void 0!==e.maxValue&&(Number(a+"0")>e.maxValue||n.length>=String(e.maxValue).length)?(s.current="",f.focusNext()):s.current=n}}};gE((0,ls.useRef)("u">typeof document?document:null),"selectionchange",()=>{let e=window.getSelection();e?.anchorNode&&m4(r.current,e?.anchorNode)&&((e=document)=>e.activeElement)()===r.current&&e.collapse(r.current)});let T=(0,ls.useRef)("");gE(r,"beforeinput",n=>{if(r.current)switch(n.preventDefault(),n.inputType){case"deleteContentBackward":case"deleteContentForward":w.isValidPartialNumber(e.text)&&!t.isReadOnly&&E();break;case"insertCompositionText":T.current=r.current.textContent,r.current.textContent=r.current.textContent;break;default:null!=n.data&&R(n.data)}}),gE(r,"input",e=>{let{inputType:t,data:n}=e;"insertCompositionText"===t&&(r.current&&(r.current.textContent=T.current),null!=n&&(x(S,n)||x(C,n))&&R(n))}),mu(()=>{let e=r.current;return()=>{((e=document)=>e.activeElement)()===e&&(f.focusPrevious()||f.focusNext())}},[r,f]);let O=pf()||"timeZoneName"===e.type?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e===(0,ls.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])||t.isInvalid||(p=void 0);let $=mD(),N=!t.isDisabled&&!t.isReadOnly&&e.isEditable,I="literal"===e.type?"":c.of(e.type),M=gc({"aria-label":`${I}${d?`, ${d}`:""}${m?", ":""}`,"aria-labelledby":m});if("literal"===e.type)return{segmentProps:{"aria-hidden":!0}};let j={caretColor:"transparent"};if("rtl"===u){j.unicodeBidi="embed";let t=g[e.type];("numeric"===t||"2-digit"===t)&&(j.direction="ltr")}return{segmentProps:mk(b,M,{id:$,...O,...D,"aria-invalid":t.isInvalid?"true":void 0,"aria-describedby":p,"aria-readonly":t.isReadOnly||!e.isEditable?"true":void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:N,suppressContentEditableWarning:N,spellCheck:N?"false":void 0,autoCorrect:N?"off":void 0,[parseInt(ll().version,10)>=17?"enterKeyHint":"enterkeyhint"]:N?"next":void 0,inputMode:t.isDisabled||"dayPeriod"===e.type||"era"===e.type||!N?void 0:"numeric",tabIndex:t.isDisabled?void 0:0,onFocus:()=>{s.current="",r.current&&gy(r.current,{containingElement:gf(r.current)});let e=window.getSelection();e?.collapse(r.current)},style:j,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}(e,n,a),{focusProps:i,isFocused:s,isFocusVisible:l}=fD(),{hoverProps:u,isHovered:c}=fk({...t,isDisabled:n.isDisabled||"literal"===e.type}),d=function(e){let{className:t,style:r,children:n,defaultClassName:a,defaultChildren:o,defaultStyle:i,values:s}=e;return(0,ls.useMemo)(()=>{let e,l,u;return e="function"==typeof t?t({...s,defaultClassName:a}):t,l="function"==typeof r?r({...s,defaultStyle:i||{}}):r,u="function"==typeof n?n({...s,defaultChildren:o}):null==n?o:n,{className:e??a,style:l||i?{...i,...l}:void 0,children:u??o,"data-rac":""}},[t,r,n,a,o,i,s])}({...t,values:{...e,isReadOnly:!e.isEditable,isInvalid:n.isInvalid,isDisabled:n.isDisabled,isHovered:c,isFocused:s,isFocusVisible:l},defaultChildren:e.text}),m=(0,ls.useCallback)(e=>{e.stopPropagation()},[]);return(0,lc.jsx)("span",{...mk(mY(t),o,i,u),...d,ref:a,style:o.style,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":n.isInvalid||void 0,"data-readonly":!e.isEditable||void 0,"data-disabled":n.isDisabled||void 0,"data-type":e.type,"data-hovered":c||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0,onClick:m})}),Ex={short:!1,size:"md"},E_=(0,ls.forwardRef)(function(e,t){let{className:r,defaultValue:n,isDisabled:a,invalid:o,invalidText:i,isInvalid:s,label:l,labelText:u,light:c,maxDate:d,minDate:m,onChange:p,onChangeRaw:f,short:h,size:g,value:y,...v}={...Ex,...e},{calendar:b,intlLocale:w,today_:E}=w4(),D=(0,ls.useId)(),x=!!(u??l),_=(0,ls.useMemo)(()=>b4(n,b),[n,b]),S=(0,ls.useMemo)(()=>b4(y,b,!0),[y,b]),C=(0,ls.useMemo)(()=>b4(d,b),[d,b]),k=(0,ls.useMemo)(()=>b4(m??w2,b),[m,b]),P=(0,ls.useMemo)(()=>o||s,[o,s]),R=(0,ls.useMemo)(()=>(f&&p&&console.error("An OpenmrsDatePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used."),f??(e=>p?.(b2(e)))),[f,p]);return(0,lc.jsx)(b1,{locale:w.toString(),children:(0,lc.jsx)("div",{className:ch()("cds--form-item",r),children:(0,lc.jsx)(mT,{values:[[w1,w]],children:(0,lc.jsxs)(bQ,{className:ch()("cds--date-picker","cds--date-picker--single",{"cds--date-picker--short":h,"cds--date-picker--light":c}),defaultValue:_,isDisabled:a,isInvalid:P,maxValue:C,minValue:k,value:S,shouldForceLeadingZeros:"en"===w.language||void 0,...v,onChange:R,children:[(0,lc.jsxs)("div",{className:"cds--date-picker-container",children:[x&&(0,lc.jsx)(vJ,{className:ch()("cds--label",{"cds--label--disabled":a}),htmlFor:D,children:u??l}),(0,lc.jsxs)(yT,{className:El,children:[(0,lc.jsx)(Ev,{id:x?D:void 0,ref:t,className:ch()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__inputWrapper___y+8gr",{"-esm-report-builder__datepicker-module__inputWrapperSm___tpcoF":"sm"===g,"-esm-report-builder__datepicker-module__inputWrapperMd___1hH89":"md"===g||!g||0===g.length,"-esm-report-builder__datepicker-module__inputWrapperLg___CRsQW":"lg"===g}),children:e=>"era"!==e.type?(0,lc.jsx)(ED,{className:Eu,segment:e}):(0,lc.jsx)(ll().Fragment,{})}),(0,lc.jsx)(fR,{className:ch()(Em,{[Ef]:"sm"===g,[Ep]:"md"===g||!g||0===g.length,[Eh]:"lg"===g}),children:(0,lc.jsx)(Eb,{})})]}),(0,lc.jsx)(vH,{className:Ed,children:i})]}),(0,lc.jsx)(Ey,{variant:"single",today_:E})]})})})})}),ES=(0,ls.forwardRef)(function({className:e,defaultValue:t,invalid:r,invalidText:n,isDisabled:a,isInvalid:o,label:i,labelText:s,light:l,maxDate:u,minDate:c,onChange:d,onChangeRaw:m,size:p="md",value:f,...h},g){let{calendar:y,intlLocale:v,today_:b}=w4(),w=(0,ls.useId)(),E=!!(s??i),D=(0,ls.useMemo)(()=>{if(f){let e=b4(f[0],y,!1),t=b4(f[1],y,!1);return e&&t?{start:e,end:t}:null}},[f,y]),x=(0,ls.useMemo)(()=>{if(t)return{start:b4(t[0],y,!1),end:b4(t[1],y,!1)}},[t,y]),_=(0,ls.useMemo)(()=>b4(c??w2,y,!0),[c,y]),S=(0,ls.useMemo)(()=>b4(u,y,!0),[u,y]),C=(0,ls.useMemo)(()=>r||o,[r,o]),k=(0,ls.useRef)(null),P=(0,ls.useMemo)(()=>{m&&d&&console.error("An OpenmrsDateRangePicker component was created with both onChange and onChangeRaw handlers defined. Only onChangeRaw will be used.");let e=m??(e=>d?.([b2(e?.start),b2(e?.end)]));return t=>{k.current={value:t},e(t)}},[m,d]);return(0,lc.jsx)(b1,{locale:v.toString(),children:(0,lc.jsx)("div",{className:ch()("cds--form-item",e),children:(0,lc.jsx)(mT,{values:[[w1,v]],children:(0,lc.jsxs)(b0,{id:E?w:void 0,className:ch()("cds--date-picker",{"cds--date-picker--light":l,"cds--date-picker--disabled":a}),isInvalid:C,shouldForceLeadingZeros:"en"===v.language||void 0,maxValue:S,minValue:_,value:D,defaultValue:x,ref:g,isDisabled:a,...h,onChange:P,children:[(0,lc.jsx)(EC,{value:D,lastUserValue:k}),(0,lc.jsxs)("div",{className:"cds--date-picker-container",children:[E&&(0,lc.jsx)(vJ,{className:ch()("cds--label",{"cds--label--disabled":a}),htmlFor:w,children:s??i}),(0,lc.jsxs)(yT,{className:El,children:[(0,lc.jsxs)("div",{className:ch()("-esm-report-builder__datepicker-module__inputsWrapper___soXTl",{"-esm-report-builder__datepicker-module__inputsWrapperSm___ES6Mr":"sm"===p,"-esm-report-builder__datepicker-module__inputsWrapperMd___4qQj-":"md"===p||!p||0===p.length,"-esm-report-builder__datepicker-module__inputsWrapperLg___apyRG":"lg"===p}),children:[(0,lc.jsx)(v$,{className:ch()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__startInput___Rc6pT",Ec),slot:"start",children:e=>(0,lc.jsx)(ED,{className:Eu,segment:e})}),(0,lc.jsx)("div",{className:"-esm-report-builder__datepicker-module__separator___YpWmV",children:(0,lc.jsx)("span",{"aria-hidden":"true","data-readonly":!0,children:"–"})}),(0,lc.jsx)(v$,{className:ch()("cds--date-picker-input__wrapper","-esm-report-builder__datepicker-module__endInput___euNmk",Ec),slot:"end",children:e=>(0,lc.jsx)(ED,{className:Eu,segment:e})})]}),(0,lc.jsx)(fR,{className:ch()(Em,{[Ef]:"sm"===p,[Ep]:"md"===p||!p||0===p.length,[Eh]:"lg"===p}),children:(0,lc.jsx)(Eb,{})})]}),(0,lc.jsx)(vH,{className:Ed,children:n}),(0,lc.jsx)(Ey,{variant:"range",today_:b,minDate:_,maxDate:S})]})]})})})})});function EC({value:e,lastUserValue:t}){let r=(0,ls.useContext)(bJ),n=(0,ls.useRef)(e);return(0,ls.useEffect)(()=>{if(Ek(e,n.current))return;n.current=e;let a=t.current;t.current=null,a&&Ek(e,a.value)||r?.commitValidation()},[r,e,t]),null}function Ek(e,t){return e?.start?.toString()===t?.start?.toString()&&e?.end?.toString()===t?.end?.toString()}let EP=ll().createContext(null);function ER(e){let{children:t}=e,r=(0,ls.useContext)(EP),[n,a]=(0,ls.useState)(0),o=(0,ls.useMemo)(()=>({parent:r,modalCount:n,addModal(){a(e=>e+1),r&&r.addModal()},removeModal(){a(e=>e-1),r&&r.removeModal()}}),[r,n]);return ll().createElement(EP.Provider,{value:o},t)}function ET(e){let t,{modalProviderProps:r}={modalProviderProps:{"aria-hidden":!!(t=(0,ls.useContext)(EP))&&t.modalCount>0||void 0}};return ll().createElement("div",{"data-overlay-container":!0,...e,...r})}function EO(e){return ll().createElement(ER,null,ll().createElement(ET,e))}function E$(e){let t=mv(),{portalContainer:r=t?null:document.body,...n}=e,{getContainer:a}=vA();if(!e.portalContainer&&a&&(r=a()),ll().useEffect(()=>{if(r?.closest("[data-overlay-container]"))throw Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.")},[r]),!r)return null;let o=ll().createElement(EO,n);return fs().createPortal(o,r)}let EN={},EI=0,EM=!1,Ej=null,EA=null;function EL(e={}){let{delay:t=1500,closeDelay:r=500}=e,{isOpen:n,open:a,close:o}=bF(e),[i,s]=(0,ls.useState)(!1),l=(0,ls.useMemo)(()=>`${++EI}`,[]),u=(0,ls.useRef)(null),c=(0,ls.useRef)(o),d=()=>{EN[l]=f},m=()=>{for(let e in EN)e!==l&&(EN[e](!0,!0),delete EN[e])},p=e=>{u.current&&clearTimeout(u.current),u.current=null,m(),d(),s(!!e),EM=!0,a(),Ej&&(clearTimeout(Ej),Ej=null),EA&&(clearTimeout(EA),EA=null)},f=(e,t)=>{s(!!t),e||r<=0?(u.current&&clearTimeout(u.current),u.current=null,c.current()):u.current||(u.current=setTimeout(()=>{u.current=null,c.current()},r)),Ej&&(clearTimeout(Ej),Ej=null),EM&&(EA&&clearTimeout(EA),EA=setTimeout(()=>{delete EN[l],EA=null,EM=!1},Math.max(500,r)))};return(0,ls.useEffect)(()=>{c.current=o},[o]),(0,ls.useEffect)(()=>()=>{u.current&&clearTimeout(u.current),EN[l]&&delete EN[l]},[l]),{isOpen:n,shouldSkipAnimation:i,open:e=>{e||!(t>0)||u.current?p(EM):(m(),d(),n||EM?n||p(!0):(Ej&&clearTimeout(Ej),Ej=setTimeout(()=>{Ej=null,EM=!0,p(!1)},t)))},close:f}}let EF=(0,ls.createContext)(null),EB=(0,ls.createContext)(null);function EV(e){let t=EL(e),r=(0,ls.useRef)(null),{triggerProps:n,tooltipProps:a}=function(e,t,r){let{isDisabled:n,trigger:a,shouldCloseOnPress:o=!0}=e,i=mD(),s=(0,ls.useRef)(!1),l=(0,ls.useRef)(!1),u=()=>{(s.current||l.current)&&t.open(l.current)},c=e=>{s.current||l.current||t.close(e)};(0,ls.useEffect)(()=>{let e=e=>{r&&r.current&&"Escape"===e.key&&(e.stopPropagation(),t.close(!0))};if(t.isOpen)return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[r,t]);let d=()=>{o&&(l.current=!1,s.current=!1,c(!0))},{hoverProps:m}=fk({isDisabled:n,onHoverStart:()=>{"focus"!==a&&("pointer"===pE?s.current=!0:s.current=!1,u())},onHoverEnd:()=>{"focus"!==a&&(l.current=!1,s.current=!1,c())}}),{focusableProps:p}=p3({isDisabled:n,onFocus:()=>{pj()&&(l.current=!0,u())},onBlur:()=>{l.current=!1,s.current=!1,c(!0)}},r);return{triggerProps:{"aria-describedby":t.isOpen?i:void 0,...mk(p,m,{onPointerDown:d,onKeyDown:d}),tabIndex:void 0},tooltipProps:{id:i}}}(e,t,r);return ll().createElement(mT,{values:[[EF,t],[EB,{...a,triggerRef:r}]]},ll().createElement(p2,{...n,ref:r},e.children))}let EU=(0,ls.forwardRef)(function({UNSTABLE_portalContainer:e,...t},r){[t,r]=mN(t,r,EB);let n=(0,ls.useContext)(EF),a=EL(t),o=null==t.isOpen&&null==t.defaultOpen&&n?n:a,i=bV(r,o.isOpen),s=t.isExiting||!o.shouldSkipAnimation&&i||!1;return o.isOpen||s?ll().createElement(E$,{portalContainer:e},ll().createElement(EW,{...t,tooltipRef:r,isExiting:s})):null});function EW(e){let t=(0,ls.useContext)(EF),r=(0,ls.useRef)(null),{overlayProps:n,arrowProps:a,placement:o,triggerAnchorPoint:i}=bp({placement:e.placement||"top",targetRef:e.triggerRef,overlayRef:e.tooltipRef,arrowRef:r,offset:e.offset,crossOffset:e.crossOffset,isOpen:t.isOpen,arrowBoundaryOffset:e.arrowBoundaryOffset,shouldFlip:e.shouldFlip,containerPadding:e.containerPadding,onClose:()=>t.close(!0)}),s=bB(e.tooltipRef,!!o),l=e.isEntering||!t.shouldSkipAnimation&&s||!1,u=mO({...e,defaultClassName:"react-aria-Tooltip",values:{placement:o,isEntering:l,isExiting:e.isExiting,state:t}}),{tooltipProps:c}=function(e,t){let r=mY(e,{labelable:!0}),{hoverProps:n}=fk({onHoverStart:()=>t?.open(!0),onHoverEnd:()=>t?.close()});return{tooltipProps:mk(r,n,{role:"tooltip"})}}(e=mk(e,n),t),d=mY(e,{global:!0});return ll().createElement(mL.div,{...mk(d,u,c),ref:e.tooltipRef,style:{...n.style,"--trigger-anchor-point":i?`${i.x}px ${i.y}px`:void 0,...u.style},"data-placement":o??void 0,"data-entering":l||void 0,"data-exiting":e.isExiting||void 0},ll().createElement(vX.Provider,{value:{...a,placement:o,ref:r}},u.children))}let EH=({diagnoses:e,showCertainty:t=!1})=>{let{diagnosisTags:r}=ul({externalModuleName:"@openmrs/esm-styleguide"});return(0,lc.jsx)("div",{className:"-esm-report-builder__diagnosis-tags-module__container___B0P1c",children:e.map(e=>{let n=t&&"PROVISIONAL"===e.certainty,a=1===e.rank?r?.primaryColor??"blue":r?.secondaryColor??"gray";return(0,lc.jsx)(Ez,{color:a,isProvisional:n,name:e.display},e.uuid)})})};function Ez({color:e,isProvisional:t,name:r}){let[n,a]=(0,ls.useState)(!1),[o,i]=(0,ls.useState)(!1),[s,l]=(0,ls.useState)(!1),u=s||o,c=(0,ls.useRef)(null);(0,ls.useLayoutEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let t=e.scrollWidth>e.clientWidth;l(t),t||a(!1)};t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[r,t,u]);let d=ch()("cds--tag","cds--tag--md","cds--layout--size-md",`cds--tag--${e}`,"-esm-report-builder__diagnosis-tags-module__diagnosisTag___65CPx"),m=(0,lc.jsxs)(lc.Fragment,{children:[t&&(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("span",{"aria-hidden":"true",className:"-esm-report-builder__diagnosis-tags-module__provisionalMark___XQ8DV",children:"?"}),(0,lc.jsxs)("span",{className:"cds--visually-hidden",children:[aV("provisional","Provisional")," "]})]}),(0,lc.jsx)("span",{ref:c,className:"cds--tag__label",children:r})]});return u?(0,lc.jsxs)(EV,{delay:0,closeDelay:150,isOpen:n,onOpenChange:a,children:[(0,lc.jsx)(fR,{className:d,"data-testid":"diagnosis-tag",onFocusChange:i,onPress:()=>a(!0),children:m}),(0,lc.jsx)(EU,{className:"-esm-report-builder__diagnosis-tags-module__tagTooltip___XQbm8",placement:"bottom",offset:4,containerPadding:8,children:r})]}):(0,lc.jsx)("span",{className:d,"data-testid":"diagnosis-tag",children:m})}let EK={action:"-esm-report-builder__empty-card-module__action___sBzfy",content:"-esm-report-builder__empty-card-module__content___oLLP3",desktopHeading:"-esm-report-builder__empty-card-module__desktopHeading___61tqo",tabletHeading:"-esm-report-builder__empty-card-module__tabletHeading___8GoOd",tile:"-esm-report-builder__empty-card-module__tile___THTb6"},EG=({width:e="64",height:t="64"})=>(0,lc.jsx)("svg",{width:e,height:t,viewBox:"0 0 64 64",children:(0,lc.jsx)("use",{href:"#omrs-empty-data-illustration"})}),EZ=e=>{let t="tablet"===uL(),r=e.launchForm;return(0,lc.jsx)(cw.Wdr,{className:EK.layer,children:(0,lc.jsxs)(cw.FAs,{className:EK.tile,children:[(0,lc.jsx)("div",{className:t?EK.tabletHeading:EK.desktopHeading,children:(0,lc.jsx)("h4",{children:e.headerTitle})}),(0,lc.jsx)(EG,{}),(0,lc.jsx)("p",{className:EK.content,children:aV("emptyStateText","There are no {{displayText}} to display",{displayText:e.displayText})}),(0,lc.jsx)("p",{className:EK.action,children:r&&(0,lc.jsx)(cw.$nd,{onClick:()=>r(),kind:"ghost",size:t?"lg":"sm",children:aV("recordNewEntry","Record {{ displayText }}",{displayText:e.displayText})})})]})})},EY=({error:e,headerTitle:t})=>{let r="tablet"===uL();return(0,lc.jsx)(cw.Wdr,{children:(0,lc.jsxs)(cw.FAs,{className:"-esm-report-builder__error-state-module__tile___cCC0p",children:[(0,lc.jsx)("div",{className:r?"-esm-report-builder__error-state-module__tabletHeading___bj95p":"-esm-report-builder__error-state-module__desktopHeading___cT4Z6",children:(0,lc.jsx)("h4",{children:t})}),(0,lc.jsxs)("p",{className:"-esm-report-builder__error-state-module__errorMessage___0VxgF",children:[aV("error","Error")," ",`${e?.response?.status}: `,e?.response?.statusText]}),(0,lc.jsx)("p",{className:"-esm-report-builder__error-state-module__errorCopy___eiDlp",children:aV("errorCopy")})]})})},Eq=EY,EJ=ll().forwardRef((e,t)=>{let{slotName:r,basePath:n,componentContext:a,state:o}=uV(),i=window.location??{pathname:""},s=lx(r??"");return e.isChildOfHeader&&r&&s.length>0?(0,lc.jsxs)(cw.f8J,{"aria-label":aV("leftNavigation","Left navigation"),className:"-esm-report-builder__left-nav-module__leftNav___+tHzD",expanded:!0,isFixedNav:!0,ref:t,...e,children:[(0,lc.jsx)(lC,{name:"global-nav-menu-slot"}),r?(0,lc.jsx)(l9,{value:a,fallback:(0,lc.jsx)(lC,{name:r,state:{basePath:n,currentPath:i,...o}}),children:(0,lc.jsx)(lu.Provider,{value:a,children:(0,lc.jsx)(lC,{name:r,state:{basePath:n,currentPath:i,...o}})})}):null]}):null}),EX=({selectedLocationUuid:e,defaultLocationUuid:t,locationTag:r,locationsPerRequest:n=50,onChange:a})=>{let[o,i]=(0,ls.useState)(""),s=(0,ls.useId)(),{location:l}=function(e){let t=e?`/ws/fhir2/R4/Location?_id=${e}`:null,{data:r,error:n,isLoading:a}=um(t,a3,{shouldRetryOnError:e=>!!e?.response?.status&&e.response.status>=500});return(0,ls.useMemo)(()=>({location:r?.data?.entry?r.data.entry[0]:null,error:t?n:null,isLoading:!!t&&a}),[r,a,n,t])}(t),{locations:u,isLoading:c,hasMore:d,loadingNewData:m,error:p,setPage:f}=function(e,t=0,r=""){let n=uc(r),{data:a,isLoading:o,isValidating:i,setSize:s,error:l}=uP(function(r,a){if(a){let e=a.data?.link?.find(e=>"next"===e.relation);if(!e)return null;let t=new URL(e.url);return t.origin===window.location.origin?e.url:new URL(`${t.pathname}${t.search?`?${t.search}`:""}`,window.location.origin).toString()}let o=`${a1}/Location?`,i=new URLSearchParams;return i.append("_summary","data"),t&&i.append("_count",""+t),r&&i.append("_getpagesoffset",""+r*t),e&&i.append("_tag",e),"string"==typeof n&&""!==n&&i.append("name:contains",n),o+i.toString()},a3);return(0,ls.useMemo)(()=>({locations:a?.length?a?.flatMap(e=>e?.data?.entry??[]):[],isLoading:o,totalResults:a?.[0]?.data?.total,hasMore:!!a?.length&&a?.[a.length-1]?.data?.link?.some(e=>"next"===e.relation),loadingNewData:i,error:l||null,setPage:s}),[o,a,i,s,l])}(r,n,o),h=(0,ls.useMemo)(()=>l&&!o&&t?[l,...u.filter(({resource:e})=>e.id!==t)]:u??[],[l,u,t,o]),g=(0,ls.useCallback)(e=>{a(),i(e.trim())},[a]),y=uz((0,ls.useCallback)(()=>{!m&&d&&f(e=>e+1)},[m,d,f])),v=d?Math.max(0,Math.floor(h.length-n/2)):-1;return(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)(cw.vji,{"aria-describedby":p?`${s}-error`:void 0,labelText:aV("searchForLocation"),id:s,placeholder:aV("searchForLocation"),onChange:e=>g(e.target.value),size:"lg"}),p&&(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__errorNotification___sh9BG",id:`${s}-error`,children:(0,lc.jsx)(cw.jeF,{kind:"error",subtitle:aV("errorLoadingLoginLocations","Unable to load login locations. Please try again or contact support if the problem persists."),title:aV("error","Error")})}),(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__searchResults___gvBsQ",children:c?(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__loadingContainer___PR-AY",children:Array.from({length:5}).map((e,t)=>(0,lc.jsx)(cw.Psq,{className:"-esm-report-builder__location-picker-module__radioButtonSkeleton___Y913N",role:"progressbar"},t))}):(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__locationResultsContainer___eH1Nw",children:h.length>0?(0,lc.jsx)(cw.zWQ,{name:"loginLocations",onChange:e=>{a(e?.toString())},orientation:"vertical",valueSelected:e,children:h.map((e,t)=>(0,lc.jsx)(cw.aaP,{className:"-esm-report-builder__location-picker-module__locationRadioButton___5tzhj",id:e.resource.id,labelText:(0,lc.jsx)("span",{ref:t===v?y:null,children:e.resource.name}),name:e.resource.name,value:e.resource.id},e.resource.id))}):(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__emptyState___+68uf",children:(0,lc.jsx)("p",{className:"-esm-report-builder__location-picker-module__locationNotFound___PBqCF",children:aV("noResultsToDisplay")})})}),m&&(0,lc.jsx)("div",{className:"-esm-report-builder__location-picker-module__loadingIcon___fSVp7",children:(0,lc.jsx)(cw.OuH,{description:aV("loading")})})]})})]})},EQ=F("modalState",{modalContainer:null,modalStack:[]}),E0=0;async function E1(e,t,r={}){let n=s1(t),a=null;if(e){if(!n)throw Error(`No modal named '${t}' has been registered.`);let{load:o}=n,i=await o(),s=E0++;a=await ln({...i,name:`${t}-${s}`},{...r,domElement:e})}else C(`Failed to launch modal. Please notify your administrator. Modal name: ${t}`);return a}function E4(e){return"TO_BE_DELETED"===e.state||"DELETED"===e.state}function E2(e,t){t?.unmount&&(t.unmountPromise?.catch(()=>{}),t.unmount().catch(t=>{console.error(`The modal '${e}' failed to unmount`,t)}))}function E3(e){return e.find(e=>!E4(e))}function E6(e,t){e.container&&(e.container.style.visibility=t?"unset":"hidden")}let E5=window.getComputedStyle(document.body).overflow;function E9({modalStack:e,modalContainer:t}){if(t)if(e.length){t.style.visibility||(addEventListener("keydown",E7),document.body.style.overflow="hidden",t.style.visibility="unset");let r=E3(e);e.forEach(e=>{switch(e.state){case"NEW":{let r=function({size:e}){let t=document.createElement("div");return t.className=`cds--modal-container cds--modal-container--${e}`,t.setAttribute("role","dialog"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-modal","true"),t}({size:e.props?.size??"md"});e.container=r,e.state="MOUNTING",E1(r,e.modalName,e.props).then(n=>{E4(e)?E2(e.modalName,n):n?(e.parcel=n,t.prepend(r),E6(e,E3(EQ.getState().modalStack)===e),n.mountPromise.then(()=>{E4(e)||(e.state="MOUNTED")},t=>{C(t),e.parcel=null,E8(e)})):E8(e)},t=>{C(t),E8(e)});break}case"MOUNTING":case"MOUNTED":E6(e,e===r);break;case"TO_BE_DELETED":e.state="DELETED",e.onClose(),E2(e.modalName,e.parcel),e.container?.remove(),setTimeout(()=>{let t=EQ.getState();EQ.setState({...t,modalStack:t.modalStack.filter(t=>t!==e)})},0)}})}else t.style.removeProperty("visibility"),document.body.style.overflow=E5,removeEventListener("keydown",E7)}function E8(e){if(E4(e))return;e.state="TO_BE_DELETED";let t=EQ.getState();EQ.setState({...t,modalStack:[...t.modalStack]})}function E7(e){"Escape"===e.key&&function(){let[e]=EQ.getState().modalStack;e&&E8(e)}()}function De(e){EQ.subscribe(E9),EQ.setState({...EQ.getState(),modalContainer:e})}function Dt(e,t={},r=()=>{}){let n=()=>{let e=EQ.getState().modalStack.find(e=>e.onClose===r);e&&E8(e)};if(s1(e)){var a;let o,i;a={state:"NEW",onClose:r,modalName:e,props:{close:n,...t}},i=[a,...(o=EQ.getState()).modalStack],EQ.setState({...o,modalStack:i})}else C(`Failed to launch modal. Please notify your administrator. Modal name: "${e}"`);return n}var Dr=Object.prototype.hasOwnProperty;let Dn=function(e){if(null==e)return!0;if(td(e)&&(tu(e)||"string"==typeof e||"function"==typeof e.splice||th(e)||tx(e)||tl(e)))return!e.length;var t=rE(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(tr(e))return!rt(e).length;for(var r in e)if(Dr.call(e,r))return!1;return!0},Da=({notification:e})=>{let{description:t,action:r,kind:n,critical:a,title:o,onAction:i}=e;return(0,lc.jsx)(cw.kZS,{actionButtonLabel:r,kind:n||"info",lowContrast:a,subtitle:t,title:o||"",inline:!0,onActionButtonClick:i})},Do=({subject:e})=>{let[t,r]=(0,ls.useState)([]);return(0,ls.useEffect)(()=>{let t=e.subscribe(e=>r(t=>[...t.filter(t=>t.description!==e.description||t.action!==e.action||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,lc.jsx)(lc.Fragment,{children:t.map(e=>(0,lc.jsx)(Da,{notification:e},e.id))})},Di=({notification:e})=>{let{actionButtonLabel:t,onActionButtonClick:r=()=>{},subtitle:n,kind:a,title:o,critical:i,progressActionLabel:s,id:l,...u}=e,[c,d]=(0,ls.useState)(t);return(0,lc.jsx)(cw.kZS,{kind:a||"info",actionButtonLabel:c,"aria-label":aV("closesActionableNotification","Closes actionable notification"),onActionButtonClick:()=>{r(),s&&d(s)},statusIconDescription:aV("actionableNotification","Actionable notification"),subtitle:n,title:o,lowContrast:i,inline:!0,...u})},Ds=({subject:e})=>{let[t,r]=(0,ls.useState)([]);return(0,ls.useEffect)(()=>{let t=e.subscribe(e=>r(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,lc.jsx)(lc.Fragment,{children:t.map(e=>(0,lc.jsx)(Di,{notification:e},e.id))})};class Dl{subscribe(e){return this.listeners.add(e),{unsubscribe:()=>{this.listeners.delete(e)}}}next(e){for(let t of[...this.listeners])t(e)}constructor(){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"listeners",new Set)}}let Du=new Dl,Dc=0,Dd=new Dl,Dm=0;function Dp(e){e&&(0,lk.createRoot)(e).render((0,lc.jsx)(Do,{subject:Du}))}function Df(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&(t instanceof Error||!Dn(t)))?(e.description instanceof Error&&(e.description=e.description.toLocaleString()),setTimeout(()=>{Du.next({...e,id:Dc++})},0)):console.error("showNotification must be called with an object having a 'description' property that is a non-empty string or object")}function Dh(e){e&&(0,lk.createRoot)(e).render((0,lc.jsx)(Ds,{subject:Dd}))}function Dg(e){var t;e&&("string"==typeof(t=e.actionButtonLabel)?t.trim().length>0:"object"==typeof t&&!Dn(t))?setTimeout(()=>{Dd.next({...e,id:Dm++})},0):console.error("showActionableNotification must be called with an actionButtonLabel that is a non-empty string")}let Dy=["NORMAL","HIGH","CRITICALLY_HIGH","OFF_SCALE_HIGH","LOW","CRITICALLY_LOW","OFF_SCALE_LOW"],Dv=["critically_low","critically_high","high","low","normal","off_scale_low","off_scale_high"],Db={container:"-esm-report-builder__numeric-observation-module__container___YMIz1",card:"-esm-report-builder__numeric-observation-module__card___ZLBwz","abnormal-value":"-esm-report-builder__numeric-observation-module__abnormal-value___bzIYd","critical-value":"-esm-report-builder__numeric-observation-module__critical-value___S2-yh",cell:"-esm-report-builder__numeric-observation-module__cell___ZiLtj","critically-high":"-esm-report-builder__numeric-observation-module__critically-high___NaPDB","critically-low":"-esm-report-builder__numeric-observation-module__critically-low___S29+P",high:"-esm-report-builder__numeric-observation-module__high___qk85l",low:"-esm-report-builder__numeric-observation-module__low___Rh+hW","label-container":"-esm-report-builder__numeric-observation-module__label-container___OHVTn","value-container":"-esm-report-builder__numeric-observation-module__value-container___-5c7b",label:"-esm-report-builder__numeric-observation-module__label___MVUkz",value:"-esm-report-builder__numeric-observation-module__value___Ne+ED",units:"-esm-report-builder__numeric-observation-module__units___7BIK5","pad-right":"-esm-report-builder__numeric-observation-module__pad-right___8vJsT","off-scale-low":"-esm-report-builder__numeric-observation-module__off-scale-low___3TolK","off-scale-high":"-esm-report-builder__numeric-observation-module__off-scale-high___xMngl",arrow:"-esm-report-builder__numeric-observation-module__arrow___6Jyji"},Dw=({value:e,unit:t,label:r,interpretation:n,referenceRange:a,conceptUuid:o,variant:i="card",patientUuid:s})=>{let l=(0,ls.useId)(),{referenceRange:u,isLoading:c}=function(e,t){let r=null;e&&(r=t?`${a0}/conceptreferencerange/?patient=${t}&concept=${e}&v=full`:`${a0}/conceptreferencerange/?concept=${e}&v=full`);let{data:n,error:a,isLoading:o}=um(r,a3),i=n?.data?.results?.[0];return{referenceRange:i?{hiNormal:i.hiNormal??null,hiAbsolute:i.hiAbsolute??null,hiCritical:i.hiCritical??null,lowNormal:i.lowNormal??null,lowAbsolute:i.lowAbsolute??null,lowCritical:i.lowCritical??null}:void 0,error:a,isLoading:o}}(a||n?void 0:o,s),d=a??u,m=(0,ls.useMemo)(()=>{if(n)return n?"--"===n?"normal":Dy.includes(n)?n.toLowerCase():Dv.includes(n)?n:"normal":void 0;if(d&&!c){if(!d||null==e||""===e)return"normal";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"normal":null!==d.hiAbsolute&&void 0!==d.hiAbsolute&&t>d.hiAbsolute?"off_scale_high":null!==d.hiCritical&&void 0!==d.hiCritical&&t>=d.hiCritical?"critically_high":null!==d.hiNormal&&void 0!==d.hiNormal&&t>d.hiNormal?"high":null!==d.lowAbsolute&&void 0!==d.lowAbsolute&&t<d.lowAbsolute?"off_scale_low":null!==d.lowCritical&&void 0!==d.lowCritical&&t<=d.lowCritical?"critically_low":null!==d.lowNormal&&void 0!==d.lowNormal&&t<d.lowNormal?"low":"normal"}return"normal"},[n,d,e,c])??"normal",p="critically_low"===m||"critically_high"===m||"off_scale_low"===m||"off_scale_high"===m,f="normal"!==m,h=r?`omrs-numeric-obs-label-${r.replaceAll(/\s+/g,"-").toLowerCase()}-${l}`:void 0,g=`omrs-numeric-obs-value-${l}`,y=`omrs-numeric-obs-unit-${l}`,v=null!=e&&""!==e,b=v?e:aV("notAvailable","Not available"),w=ch()({[Db["critically-low"]]:"critically_low"===m||"off_scale_low"===m,[Db["critically-high"]]:"critically_high"===m||"off_scale_high"===m,[Db.low]:"low"===m,[Db.high]:"high"===m,[Db["off-scale-low"]]:"off_scale_low"===m,[Db["off-scale-high"]]:"off_scale_high"===m}),E=ch()({[Db.container]:!0,[Db.card]:!0,[Db["critical-value"]]:p,[Db["abnormal-value"]]:f&&!p}),D=ch()({[Db.cell]:!0,[w]:!0});return"cell"===i?(0,lc.jsxs)("div",{className:D,children:[b,v&&t?` ${t}`:""]}):(0,lc.jsxs)("section",{className:E,"data-testid":"numeric-observation-card",children:[r&&(0,lc.jsxs)("div",{className:Db["label-container"],children:[(0,lc.jsx)("span",{id:h,className:Db.label,children:r}),f&&(0,lc.jsx)("span",{className:Db[m.replace("_","-")],title:aV("abnormalValue","Abnormal value")})]}),(0,lc.jsxs)("div",{className:Db["value-container"],children:[(0,lc.jsx)("span",{id:g,"aria-labelledby":h&&y?`${h} ${y}`:h||y||void 0,className:Db.value,children:b}),v&&t&&(0,lc.jsx)("span",{id:y,className:Db.units,children:t})]})]})},DE="-esm-report-builder__page-header-module__pageHeader___sRmJ1",DD=e=>{if("children"in e){let{children:t,className:r,...n}=e;return(0,lc.jsx)("div",{className:ch()(DE,r),...n,children:t})}{let{title:t,illustration:r,className:n,...a}=e;return(0,lc.jsx)("div",{className:ch()(DE,n),...a,children:(0,lc.jsx)(Dx,{title:t,illustration:r})})}},Dx=({title:e,illustration:t,className:r})=>{let[n,a]=(0,ls.useState)(null);return(0,ls.useEffect)(()=>{n1("@openmrs/esm-styleguide").then(e=>{a(e)})},[]),(0,lc.jsxs)("div",{className:ch()("-esm-report-builder__page-header-module__pageHeaderContent___9CRks",r),children:[t,(0,lc.jsxs)("div",{className:"-esm-report-builder__page-header-module__pageLabels___mIsS6",children:[n?.implementationName&&(0,lc.jsx)("p",{children:aV(n.implementationName)}),(0,lc.jsx)("h1",{className:"-esm-report-builder__page-header-module__pageName___kvdCd",children:e})]})]})},D_=({totalItems:e,pageSize:t,onPageNumberChange:r,pageNumber:n,dashboardLinkUrl:a,currentItems:o,dashboardLinkLabel:i})=>{let{pageSizes:s,pageItemsCount:l}=uZ(t,e,n,o),u="tablet"===uL(),c=aV("paginationItemsCount","{{pageItemsCount}} / {{totalItems}} items",{totalItems:e,pageItemsCount:l});return(0,lc.jsx)(lc.Fragment,{children:e>0&&(0,lc.jsxs)("div",{className:ch()({"-esm-report-builder__pagination-module__tablet___-EohH":u,"-esm-report-builder__pagination-module__desktop___lJwLA":!u}),children:[(0,lc.jsxs)("div",{children:[c,a&&(0,lc.jsx)(ld,{to:a,className:"-esm-report-builder__pagination-module__configurableLink___f-IJ9",children:i??aV("seeAll","See all")})]}),(0,lc.jsx)(cw.dKS,{className:"-esm-report-builder__pagination-module__pagination___XBkRY",page:n,pageSize:t,pageSizes:s,totalItems:e,onChange:r,pageRangeText:(e,t)=>aV("paginationOfPages","of {{count}} pages",{count:t}),size:u?"lg":"sm"})]})})};function DS(e){return Dk(DR(e,"usual","official"))}function DC(e){return DS(e)}function Dk(e){var t;let r;return e?e.text??(r=(t=e).given??[],(t.family?r.concat(t.family):r).join(" ")):""}function DP(e){return Dk(e)}function DR(e,...t){for(let r of(0==t.length&&(t=["usual"]),t)){let t=e.name?.find(e=>{var t,n;return t=e,n=r,t.use?t.use===n:"usual"===n});if(t)return t}}function DT(e,t=u4()){let r=u4(t),n=wZ(e,r);if(null==n)return null;let a=r.diff(n,"hours"),o=r.diff(n,"days"),i=r.diff(n,"weeks"),s=r.diff(n,"months"),l=r.diff(n,"years"),u={};if(a<2)u.minutes=r.diff(n,"minutes");else if(o<2)u.hours=a;else if(i<4)u.days=o;else if(l<1){let e=r.subtract(i,"weeks").diff(n,"days");u.weeks=i,u.days=e}else if(l<2){let e=r.subtract(s,"months").diff(n,"days");u.months=s,u.days=e}else if(l<18){let e=r.subtract(l,"year").diff(n,"months");u.years=l,u.months=e}else u.years=l;return u}function DO(e,t=u4()){let r=DT(e,t);if(null==r)return null;let n={style:"short",localeMatcher:"lookup"};return"minutes"in r&&0===r.minutes&&(n.minutesDisplay="always"),wG(r,n)}let D$={container:"-esm-report-builder__patient-banner-patient-info-module__container___SbFly",activePatientContainer:"-esm-report-builder__patient-banner-patient-info-module__activePatientContainer___dPAI3",patientBanner:"-esm-report-builder__patient-banner-patient-info-module__patientBanner___RKK5o",patientName:"-esm-report-builder__patient-banner-patient-info-module__patientName___N4cBt",patientAvatar:"-esm-report-builder__patient-banner-patient-info-module__patientAvatar___S5B6e",patientAvatarButton:"-esm-report-builder__patient-banner-patient-info-module__patientAvatarButton___b4TpF",patientInfo:"-esm-report-builder__patient-banner-patient-info-module__patientInfo___k4TpF",demographics:"-esm-report-builder__patient-banner-patient-info-module__demographics___kUxEK",row:"-esm-report-builder__patient-banner-patient-info-module__row___aBH+R",flexRow:"-esm-report-builder__patient-banner-patient-info-module__flexRow___iE9YF",tagsSlot:"-esm-report-builder__patient-banner-patient-info-module__tagsSlot___qQx0X",identifiers:"-esm-report-builder__patient-banner-patient-info-module__identifiers___S+i2W",identifier:"-esm-report-builder__patient-banner-patient-info-module__identifier___V3fBY",primaryIdentifier:"-esm-report-builder__patient-banner-patient-info-module__primaryIdentifier___MGool",secondaryIdentifier:"-esm-report-builder__patient-banner-patient-info-module__secondaryIdentifier___ORbJn",value:"-esm-report-builder__patient-banner-patient-info-module__value___rZXrd",tag:"-esm-report-builder__patient-banner-patient-info-module__tag___l5yM7",gender:"-esm-report-builder__patient-banner-patient-info-module__gender___pBoq+",separator:"-esm-report-builder__patient-banner-patient-info-module__separator___kqhkj",tooltipPadding:"-esm-report-builder__patient-banner-patient-info-module__tooltipPadding___aca85",tooltipSmallText:"-esm-report-builder__patient-banner-patient-info-module__tooltipSmallText___KSHWn",actionsButtonText:"-esm-report-builder__patient-banner-patient-info-module__actionsButtonText___dfkx2"};function DN({showIdentifierLabel:e,type:t,value:r}){return(0,lc.jsx)("span",{className:D$.primaryIdentifier,children:(0,lc.jsxs)(cw.vwO,{className:D$.tag,type:"gray",children:[e&&t?.text&&(0,lc.jsxs)("span",{className:D$.label,children:[t.text,": "]}),(0,lc.jsx)("span",{className:D$.value,children:r})]})})}function DI({showIdentifierLabel:e,type:t,value:r}){return(0,lc.jsxs)(cw.lRv,{className:D$.secondaryIdentifier,id:`patient-banner-identifier-${r}`,children:[e&&(0,lc.jsxs)("span",{className:D$.label,children:[t?.text,": "]}),(0,lc.jsx)("span",{className:D$.value,children:r})]})}function DM({identifiers:e,showIdentifierLabel:t}){let{excludePatientIdentifierCodeTypes:r}=ul(),{primaryIdentifierCode:n}=uJ(),a=e?.filter(e=>{let t=e.type?.coding?.[0]?.code;return t&&!r?.uuids.includes(t)})??[];return(0,lc.jsx)(lc.Fragment,{children:a?.length?a.map(({value:e,type:r},o)=>(0,lc.jsxs)(ll().Fragment,{children:[(0,lc.jsx)("span",{className:D$.identifier,children:r?.coding?.[0]?.code===n?(0,lc.jsx)(DN,{showIdentifierLabel:t,type:r,value:e}):(0,lc.jsx)(DI,{showIdentifierLabel:t,type:r,value:e})}),o<a.length-1&&(0,lc.jsx)("span",{className:D$.separator,children:"\xb7"})]},e)):""})}let Dj={Female:dr,Male:dn,Other:da,Unknown:di},DA=({gender:e})=>{let t=Dj[e];return t?(0,lc.jsx)(t,{fill:"#525252"}):null},DL={male:"Male",female:"Female",other:"Other",unknown:"Unknown"};function DF({patient:e,renderedFrom:t}){var r;let n,a,o=DS(e),i=e?.gender&&(a=DL[n=(r=e.gender).toLowerCase()]??"Unknown",{displayText:aV(n,r),iconKey:a}),s=(0,ls.useMemo)(()=>({patientUuid:e.id,patient:e,renderedFrom:t}),[e.id,e,t]);return(0,lc.jsxs)("div",{className:D$.patientInfo,children:[(0,lc.jsx)("div",{className:ch()(D$.row,D$.patientNameRow),children:(0,lc.jsxs)("div",{className:D$.flexRow,children:[(0,lc.jsx)("span",{className:D$.patientName,children:o}),i&&(0,lc.jsxs)("div",{className:D$.gender,children:[(0,lc.jsx)(DA,{gender:i.iconKey}),(0,lc.jsx)("span",{children:i.displayText})]}),(0,lc.jsx)(lC,{className:D$.tagsSlot,name:"patient-banner-tags-slot",state:s})]})}),(0,lc.jsxs)("div",{className:D$.demographics,children:[e.birthDate&&(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("span",{children:DO(e.birthDate)}),(0,lc.jsx)("span",{className:D$.separator,children:"\xb7"}),(0,lc.jsx)("span",{children:wV(e.birthDate,{time:!1,noToday:!0})}),(0,lc.jsx)("span",{className:D$.separator,children:"\xb7"})]}),(0,lc.jsx)(DM,{identifiers:e.identifier,showIdentifierLabel:!0}),(0,lc.jsx)(lC,{className:D$.extensionSlot,name:"patient-banner-bottom-slot",state:s})]})]})}var DB=r(1673);function DV({patient:e,patientUuid:t,actionsSlotName:r,additionalActionsSlotState:n}){let[a,o]=(0,ls.useState)(!1),{extensions:i}=l_(r),s="tablet"===uL(),l=uH(()=>o(!1),a),u=(0,ls.useRef)(null),c=(0,ls.useRef)(null),d=(0,ls.useId)(),m=`patient-actions-menu-trigger-${d}`,p=`patient-actions-menu-${d}`,f=(0,ls.useCallback)(()=>o(e=>!e),[]),h=(0,ls.useCallback)(()=>{o(!1),u.current?.focus()},[]),g=(0,ls.useCallback)(e=>{if("Escape"===e.key&&a){e.stopPropagation(),h();return}if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&a){e.preventDefault();let t=c.current?.querySelectorAll('[role="menuitem"]:not([disabled])');if(!t?.length)return;let r=document.activeElement?.closest?.('[role="menuitem"]')??document.activeElement,n=Array.from(t).indexOf(r);if(-1===n)return void t["ArrowDown"===e.key?0:t.length-1]?.focus();let a=n+("ArrowDown"===e.key?1:-1),o=a<0?t.length-1:a>=t.length?0:a;t[o]?.focus()}},[h,a]);(0,ls.useEffect)(()=>{if(a&&c.current){let e=c.current.querySelector('[role="menuitem"]:not([disabled])');e?.focus()}},[a]);let y=(0,ls.useMemo)(()=>({patientUuid:t,patient:e,closeMenu:h,...n}),[t,e,h,n]);return 0===i.length?null:(0,lc.jsx)("div",{className:"-esm-report-builder__patient-banner-actions-menu-module__overflowMenuContainer___kcHLp",children:(0,lc.jsxs)("div",{"data-overflow-menu":!0,className:ch()("cds--overflow-menu",cx),ref:l,children:[(0,lc.jsxs)("button",{className:ch()("cds--btn","cds--btn--ghost","cds--overflow-menu__trigger",{"cds--overflow-menu--open":a},cC),"aria-controls":p,"aria-expanded":a,"aria-haspopup":"true",id:m,onClick:f,onKeyDown:g,ref:u,children:[(0,lc.jsx)("span",{className:"-esm-report-builder__patient-banner-actions-menu-module__actionsButtonText___w2rar",children:aV("actions","Actions")})," ",(0,lc.jsx)(DB.CH,{size:16,style:{marginLeft:"0.5rem",fill:"#78A9FF"}})]}),(0,lc.jsxs)("div",{className:ch()("cds--overflow-menu-options","cds--overflow-menu--flip",c_,{[cS]:a}),"aria-labelledby":m,"data-floating-menu-direction":"bottom",id:p,onKeyDown:g,ref:c,role:"menu",tabIndex:-1,children:[(0,lc.jsx)("ul",{className:ch()("cds--overflow-menu-options__content",{"cds--overflow-menu-options--lg":s}),children:(0,lc.jsx)(lC,{name:r,state:y},r)}),(0,lc.jsx)("span",{})]})]})})}var DU=r(6767),DW=r.n(DU);function DH(e){let{patientPhotoConceptUuid:t}=ul({externalModuleName:"@openmrs/esm-styleguide"}),r=t?`${a0}/obs?patient=${e}&concept=${t}&v=full`:null,{data:n,error:a,isLoading:o}=(0,lW.u)(e?r:null,a3),i=n?.data?.results[0];return{data:i?{dateTime:i?.obsDatetime,imageSrc:i?.value?.links?.uri}:null,error:a,isLoading:o}}let Dz=({width:e=56,height:t=56,"aria-label":r})=>{let{t:n}=(0,lU.useTranslation)();return(0,lc.jsxs)("svg",{"aria-label":r??n("patientPhotoPlaceholder","Patient photo placeholder"),width:e,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,lc.jsx)("path",{fill:"#ffffff",d:"M0 0h56v56H0z"}),(0,lc.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m36.75 20.134-.884-.884L19.25 35.866l.884.884 1.25-1.25H34.25a1.252 1.252 0 0 0 1.25-1.25V21.384l1.25-1.25Zm-2.5 14.116H22.634l4.87-4.87 1.487 1.486a1.25 1.25 0 0 0 1.768 0l.991-.991 2.5 2.498v1.877Zm0-3.645-1.616-1.616a1.25 1.25 0 0 0-1.768 0l-.991.991-1.486-1.486 5.861-5.86v7.971Zm-12.5 1.145v-1.875l3.125-3.123.858.859.885-.885-.86-.86a1.25 1.25 0 0 0-1.767 0l-2.241 2.242V21.75h10V20.5h-10c-.69 0-1.25.56-1.25 1.25v10h1.25Z",fill:"#8D8D8D"})]})},DK="-esm-report-builder__patient-photo-module__avatar___SjWI2";function DG({patientUuid:e,patientName:t,alt:r}){let{data:n,isLoading:a}=DH(e),[o,i]=(0,ls.useState)(null),[s,l]=(0,ls.useState)(!1),u=(0,ls.useMemo)(()=>DW().generate(e),[e]);(0,ls.useEffect)(()=>{if(n?.imageSrc){let e=new URL(n.imageSrc,window.location.origin).pathname;l(!0);let t=!1,r=new Image;return r.onload=()=>{t||(i(e),l(!1))},r.onerror=()=>{t||(i(null),l(!1))},r.src=e,()=>{t=!0}}i(null),l(!1)},[n?.imageSrc]);let c=(0,ls.useMemo)(()=>r||(o?aV("patientPhotoAlt","Profile photo of {{patientName}}",{patientName:t}):aV("patientAvatarAlt","Avatar for {{patientName}}",{patientName:t})),[r,o,t]);return a||s?(0,lc.jsx)(cw.ryE,{className:"-esm-report-builder__patient-photo-module__skeleton___YkxcQ","data-testid":"skeleton-icon"}):n?.imageSrc&&!o?(0,lc.jsx)(Dz,{"aria-label":aV("patientPhotoPlaceholder","Photo placeholder for {{patientName}}",{patientName:t})}):o?(0,lc.jsx)("div",{"aria-label":c,children:(0,lc.jsx)("img",{className:DK,src:o,alt:c,title:t})}):(0,lc.jsx)("div",{"aria-label":c,children:(0,lc.jsx)("div",{className:DK,title:t,style:{backgroundImage:u.toDataUrl(),backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:(0,lc.jsx)("span",{className:"-esm-report-builder__patient-photo-module__initials___GrIHj",children:function(e,t=3){return e.split(/\s+/).filter(Boolean).slice(0,t).map(e=>e[0]).join("")}(t)})})})}let DZ=["omrs-pict-appointments","omrs-pict-assessment-1","omrs-pict-assessment-2","omrs-pict-blood-bank","omrs-pict-cardiology","omrs-pict-cohorts","omrs-pict-concept-dictionary","omrs-pict-ct-scan","omrs-pict-data-entry","omrs-pict-dentistry","omrs-pict-digital-trust","omrs-pict-emergency-department","omrs-pict-facility","omrs-pict-geriatrics","omrs-pict-gynaecology","omrs-pict-in-patient","omrs-pict-laboratory","omrs-pict-labs-2","omrs-pict-metadata-export","omrs-pict-obstetrics","omrs-pict-patient-documents","omrs-pict-patient-search","omrs-pict-patients","omrs-pict-payments-desk","omrs-pict-pharmacy","omrs-pict-pharmacy-2","omrs-pict-registration","omrs-pict-reports","omrs-pict-service-queues","omrs-pict-stock-management","omrs-pict-system-administration","omrs-pict-transfer","omrs-pict-triage","omrs-pict-x-ray"],DY=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-appointments",pictogramProps:e})})),Dq=DY,DJ=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-assessment-1",pictogramProps:e})})),DX=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-assessment-2",pictogramProps:e})})),DQ=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-blood-bank",pictogramProps:e})})),D0=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-cardiology",pictogramProps:e})})),D1=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-cohorts",pictogramProps:e})})),D4=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-concept-dictionary",pictogramProps:e})})),D2=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-ct-scan",pictogramProps:e})})),D3=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-data-entry",pictogramProps:e})})),D6=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-dentistry",pictogramProps:e})})),D5=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-digital-trust",pictogramProps:e})})),D9=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-emergency-department",pictogramProps:e})})),D8=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-facility",pictogramProps:e})})),D7=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-geriatrics",pictogramProps:e})})),xe=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-gynaecology",pictogramProps:e})})),xt=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-in-patient",pictogramProps:e})})),xr=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-laboratory",pictogramProps:e})})),xn=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-labs-2",pictogramProps:e})})),xa=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-metadata-export",pictogramProps:e})})),xo=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-obstetrics",pictogramProps:e})})),xi=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-patient-documents",pictogramProps:e})})),xs=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-patient-search",pictogramProps:e})})),xl=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-patients",pictogramProps:e})})),xu=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-payments-desk",pictogramProps:e})})),xc=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-pharmacy",pictogramProps:e})})),xd=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-pharmacy-2",pictogramProps:e})})),xm=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-registration",pictogramProps:e})})),xp=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-reports",pictogramProps:e})})),xf=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-service-queues",pictogramProps:e})})),xh=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-stock-management",pictogramProps:e})})),xg=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-system-administration",pictogramProps:e})})),xy=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-transfer",pictogramProps:e})})),xv=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-triage",pictogramProps:e})})),xb=(0,ls.memo)((0,ls.forwardRef)(function(e,t){return(0,lc.jsx)(xx,{ref:t,pictogram:"omrs-pict-x-ray",pictogramProps:e})})),xw=D8,xE=xl,xD=(0,ls.memo)((0,ls.forwardRef)(function({pictogram:e,fallback:t,...r},n){let a=(0,ls.useRef)(document.getElementById(e));return(0,ls.useEffect)(()=>{let t=document.getElementById("omrs-svgs-container"),r=new MutationObserver(t=>{for(let r of t)"childList"===r.type&&(a.current=document.getElementById(e))});return t&&r.observe(t,{childList:!0}),()=>r.disconnect()},[e]),(0,lc.jsx)(l9,{value:a.current,fallback:t,children:(0,lc.jsx)(xx,{ref:n,pictogram:e,pictogramProps:r})})})),xx=(0,ls.memo)((0,ls.forwardRef)(function({pictogram:e,pictogramProps:t},r){let{className:n,size:a}=Object.assign({},{size:92},t);return(a<=26||a>144)&&(console.error(`Invalid size '${a}' specified for ${e}. Defaulting to 92.`),a=92),(0,lc.jsx)("svg",{ref:r,className:ch()("-esm-report-builder__pictograms-module__pictogram___ej8c6",n),height:a,width:a,children:(0,lc.jsx)("use",{href:`#${e}`})})})),x_=({children:e})=>"tablet"===uL()?(0,lc.jsx)(cw.Wdr,{children:e}):(0,lc.jsx)(lc.Fragment,{children:e}),xS=({snackbar:e,closeSnackbar:t})=>{let{actionButtonLabel:r="",kind:n="success",onActionButtonClick:a=()=>{},isLowContrast:o="error"!==n,progressActionLabel:i,subtitle:s="",timeoutInMs:l=5e3,autoClose:u="error"!==n,title:c,id:d,...m}=e,[p,f]=(0,ls.useState)(r),[h,g]=(0,ls.useState)(!0),[y,v]=(0,ls.useState)(!1),b=(0,ls.useCallback)(()=>{setTimeout(t,250)},[t]),w=(0,ls.useCallback)(()=>{v(!0),b()},[b]);return(0,ls.useEffect)(()=>{if(u){let e=setTimeout(w,l);return()=>clearTimeout(e)}},[l,u,w]),(0,ls.useEffect)(()=>{g(!1),window.setTimeout(()=>{g(!0)},0)},[]),(0,lc.jsx)(cw.kZS,{actionButtonLabel:p,"aria-label":aV("closeSnackbar","Close snackbar"),className:ch()("-esm-report-builder__snackbar-module__slideIn___hMvlf",{"-esm-report-builder__snackbar-module__animated___c+ZXw":h,"-esm-report-builder__snackbar-module__slideOut___ymbgm":y}),kind:n,lowContrast:o,onActionButtonClick:()=>{a(),w(),i&&f(i)},onClose:b,statusIconDescription:aV("snackbarNotification","Snackbar notification"),subtitle:s,title:c,...m})},xC=({subject:e})=>{let[t,r]=(0,ls.useState)([]),n=(0,ls.useCallback)(e=>{r(t=>t.filter(t=>t!==e))},[]);return(0,ls.useEffect)(()=>{let t=e.subscribe(e=>r(t=>[...t.filter(t=>t.subtitle!==e.subtitle||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick||t.kind!==e.kind||t.title!==e.title),e]));return()=>t.unsubscribe()},[e]),(0,lc.jsx)(lc.Fragment,{children:t.map(e=>(0,lc.jsx)(xS,{snackbar:e,closeSnackbar:()=>n(e)},e.id))})},xk=new Dl,xP=0;function xR(e){e&&(0,lk.createRoot)(e).render((0,lc.jsx)(xC,{subject:xk}))}function xT(e){var t;e&&"string"==typeof(t=e.title)&&t.trim().length>0?setTimeout(()=>{xk.next({...e,id:xP++})},0):console.error("showSnackbar must be called with an object having a 'title' property that is a non-empty string")}let xO=({toast:e,closeToast:t})=>{let{description:r,kind:n,critical:a,title:o,actionButtonLabel:i,onActionButtonClick:s=()=>{}}=e,l=(0,ls.useCallback)(()=>{s(),t()},[t,s]);return(0,lc.jsx)("div",{children:(0,lc.jsx)(cw.kZS,{actionButtonLabel:i,kind:n||"info",lowContrast:a,subtitle:r,title:o||"",onActionButtonClick:l,onClose:t})})},x$=({subject:e})=>{let[t,r]=(0,ls.useState)([]),n=(0,ls.useCallback)(e=>{r(t=>t.filter(t=>t!==e))},[]);return(0,ls.useEffect)(()=>{let t=e.subscribe(e=>r(t=>[...t.filter(t=>t.description!==e.description||t.kind!==e.kind||t.title!==e.title||t.actionButtonLabel!==e.actionButtonLabel||t.onActionButtonClick!==e.onActionButtonClick),e]));return()=>t.unsubscribe()},[e]),(0,lc.jsx)(lc.Fragment,{children:t.map(e=>(0,lc.jsx)(xO,{toast:e,closeToast:()=>n(e)},e.id))})},xN=new Dl,xI=0;function xM(e){e&&(0,lk.createRoot)(e).render((0,lc.jsx)(x$,{subject:xN}))}function xj(e){var t;e&&("string"==typeof(t=e.description)?t.trim().length>0:"object"==typeof t&&!Dn(t))?setTimeout(()=>{xN.next({...e,id:xI++})},0):console.error("showToast must be called with an object having a 'description' property that is a non-empty string or object")}let xA="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xL=new Uint8Array(16),xF=[];for(let e=0;e<256;++e)xF.push((e+256).toString(16).slice(1));let xB=function(e,t,r){if(xA&&!t&&!e)return xA();let n=(e=e||{}).random??e.rng?.()??function(){if(!c){if("u"<typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");c=crypto.getRandomValues.bind(crypto)}return c(xL)}();if(n.length<16)throw Error("Random bytes length must be >= 16");if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){if((r=r||0)<0||r+16>t.length)throw RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return(xF[e[t+0]]+xF[e[t+1]]+xF[e[t+2]]+xF[e[t+3]]+"-"+xF[e[t+4]]+xF[e[t+5]]+"-"+xF[e[t+6]]+xF[e[t+7]]+"-"+xF[e[t+8]]+xF[e[t+9]]+"-"+xF[e[t+10]]+xF[e[t+11]]+xF[e[t+12]]+xF[e[t+13]]+xF[e[t+14]]+xF[e[t+15]]).toLowerCase()}(n)};async function xV(e,t){let{openedGroup:r}=s4.getState();if(r){if(r.groupName===e&&xH(r.props,t))return!0;else if(!await xG({reason:"CLOSE_WORKSPACE_GROUP",explicit:!1}))return!1}return s4.setState(r=>({...r,openedGroup:{groupName:e,props:t},openedWindows:[]})),!0}async function xU(e){let{openedGroup:t,openedWindows:r}=s4.getState();if(t){if(r.length>0&&!(e||await xG({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})))return!1;s4.setState(e=>({...e,openedGroup:null,openedWindows:[]}))}return!0}async function xW(e,t=null,r=null,n=null){let a=s4.getState();if(!a.registeredWorkspacesByName[e])throw Error(`Unable to launch workspace ${e}. Workspace is not registered`);let o=s2(e);if(!o)throw Error(`Unable to launch workspace ${e}. Workspace is not registered to a workspace window`);let{openedGroup:i}=a,{name:s}=o,l=s3(s);if(!l)throw Error(`Unable to launch workspace ${e}. Workspace window ${o.name} is not registered to a workspace group`);let u=s6(s);if(i&&(i.groupName!==l.name||!xH(i.props,n)))return!!await xG({reason:"CLOSE_WORKSPACE_GROUP",explicit:!0})&&(s4.setState({...a,openedGroup:{groupName:l.name,props:n},openedWindows:[{windowName:s,openedWorkspaces:[x3(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0);if(u>=0){let o=a.openedWindows[u],i=a.isMostRecentlyOpenedWindowHidden,{openedWorkspaces:c}=o;if(xH(o.props,r)){let d=c.find(t=>t.workspaceName===e);return d&&xH(d.props,t)?((i||u!==a.openedWindows.length-1)&&s4.setState(xQ.restoreWindow(a,s)),!0):!!await xG({reason:"CLOSE_WORKSPACE",explicit:!1,windowName:s,workspaceName:e})&&(s4.setState({...a,openedGroup:{groupName:l.name,props:a?.openedGroup?.props??n},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[x3(e,t)],props:o?.props??r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return!!await xG({reason:"CLOSE_WINDOW",explicit:!1,windowName:s})&&(s4.setState({...a,openedGroup:{groupName:l.name,props:n??a?.openedGroup?.props??null},openedWindows:[...a.openedWindows.filter((e,t)=>t!==u),{windowName:s,openedWorkspaces:[x3(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}return"closable"!=l.persistence?(s4.setState({...a,openedGroup:{groupName:l.name,props:n??a?.openedGroup?.props??null},openedWindows:[...a.openedWindows,{windowName:s,openedWorkspaces:[x3(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0):!!await xG({reason:"CLOSE_OTHER_WINDOWS",explicit:!1,windowNameToSpare:o.name})&&(s4.setState({...a,openedGroup:{groupName:l.name,props:n??a?.openedGroup?.props??null},openedWindows:[{windowName:s,openedWorkspaces:[x3(e,t)],props:r,maximized:!1}],isMostRecentlyOpenedWindowHidden:!1}),!0)}function xH(e,t){return null==e||null==t||R(e,t)}function xz(e,t){let r=[];for(let n=e.openedWorkspaces.length-1;n>=0;n--){let a=e.openedWorkspaces[n];if(a.hasUnsavedChanges&&r.push(a),t&&a.workspaceName===t)break}return r}function xK(e){return 0===e.length?Promise.resolve(!0):new Promise(t=>{let r=Dt("workspace2-close-prompt",{size:"sm",onConfirm:()=>{r(),t(!0)},onCancel:()=>{r(),t(!1)},affectedWorkspaceTitles:e.map(e=>e.title??"")})})}function xG(e){let{openedWindows:t}=s4.getState(),r=[];switch(e.reason){case"CLOSE_WORKSPACE_GROUP":r=t.flatMap(e=>xz(e));break;case"CLOSE_WINDOW":{let n=t.find(t=>t.windowName===e.windowName);if(!n)throw Error(`Window ${e.windowName} not found in opened windows.`);r=xz(n);break}case"CLOSE_WORKSPACE":{let n=t.find(t=>t.windowName===e.windowName);if(!n)throw Error(`Window ${e.windowName} not found in opened windows.`);r=xz(n,e.workspaceName);break}case"CLOSE_OTHER_WINDOWS":r=t.filter(t=>t.windowName!==e.windowNameToSpare).flatMap(e=>xz(e))}return xK(r)}function xZ(e,t){return xK(xz(e,t))}function xY(e,t){let r=e.openedWorkspaces.findIndex(e=>e.workspaceName===t);return r<0?e:0===r?null:{...e,openedWorkspaces:e.openedWorkspaces.slice(0,r)}}function xq(e,t,r,n){let{registeredWorkspacesByName:a}=s4.getState(),o=a[r];if(!o)throw Error(`No workspace named "${r}" registered`);let i=a[t];if(!i)throw Error(`No workspace named "${t}" registered`);if(i.window!==o.window)throw Error(`Child workspace ${r} does not belong to the same workspace window as parent workspace ${t}`);if(o.window!==e.windowName)throw Error(`Cannot open child workspace ${r} as window ${o.window} is not opened`);let{openedWorkspaces:s}=e,l=s.findIndex(e=>e.workspaceName===t);if(-1===l)throw Error(`Cannot open child workspace ${r} from parent workspace ${t} as the parent is not opened within the workspace window`);let u=s.slice(0,l+1);return{...e,openedWorkspaces:[...u,x3(r,n)]}}function xJ(e,t,r){let n=e.openedWorkspaces.findIndex(e=>e.uuid===t);if(n<0)return e;let a=e.openedWorkspaces[n];if(Object.keys(r).every(e=>a[e]===r[e]))return e;let o=[...e.openedWorkspaces];return o[n]={...a,...r},{...e,openedWorkspaces:o}}function xX(e,t,r){let n=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.uuid===t));if(n<0)return e;let a=e.openedWindows[n],o=xJ(a,t,r);if(o===a)return e;let i=[...e.openedWindows];return i[n]=o,{...e,openedWindows:i}}let xQ={setWindowMaximized(e,t,r){let n=e.openedWindows.findIndex(e=>e.windowName===t),a=[...e.openedWindows],o={...a[n],maximized:r};return a[n]=o,{...e,openedWindows:a}},hideWindow:e=>({...e,isMostRecentlyOpenedWindowHidden:!0}),restoreWindow(e,t){let r=e.openedWindows.findIndex(e=>e.windowName===t),n=e.openedWindows[r],a=[...e.openedWindows.filter((e,t)=>t!==r),n];return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:!1}},closeWorkspace(e,t){let r=e.openedWindows.findIndex(e=>e.openedWorkspaces.some(e=>e.workspaceName===t));if(r<0)return e;let n=xY(e.openedWindows[r],t),a=[...e.openedWindows],o=e.isMostRecentlyOpenedWindowHidden;if(null===n){let t=r===e.openedWindows.length-1;a.splice(r,1),t&&a.length>0&&(o=!1)}else a[r]=n;return{...e,openedWindows:a,isMostRecentlyOpenedWindowHidden:o}},openChildWorkspace(e,t,r,n){let a=e.registeredWorkspacesByName[r];if(!a)throw Error(`No workspace named "${r}" registered`);let o=e.openedWindows.findIndex(e=>e.windowName===a.window);if(-1==o)throw Error(`Cannot open child workspace ${r} as window ${a.window} is not opened`);let i=[...e.openedWindows];return i[o]=xq(e.openedWindows[o],t,r,n),{...e,openedWindows:i}},setHasUnsavedChanges:(e,t,r)=>xX(e,t,{hasUnsavedChanges:r}),setWorkspaceTitle:(e,t,r)=>xX(e,t,{title:r})};function x0(){return ly(s4,xQ)}let x1=()=>(0,ls.useContext)(lI),x4=()=>Object.keys(s4.getState().registeredWorkspacesByName);function x2(e,t,r){let n=e.openedWorkspaces[e.openedWorkspaces.length-1];return(n?t[n.workspaceName]?.width:void 0)??r[e.windowName]?.width??"narrow"}function x3(e,t){return{workspaceName:e,props:t??{},hasUnsavedChanges:!1,uuid:xB()}}function x6(e,t,r){let n=s4.getState().registeredWorkspacesByName[e];return n?{windowName:n.window,openedWorkspaces:[x3(e,t)],props:r??null,maximized:!1}:null}let x5=({title:e,children:t,hasUnsavedChanges:r=!1})=>{let{setHasUnsavedChanges:n,setWorkspaceTitle:a}=x1();return(0,ls.useEffect)(()=>{n(r??!1)},[r,n]),(0,ls.useEffect)(()=>{a(e)},[e,a]),(0,lc.jsx)(lc.Fragment,{children:t})};function x9(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function x8(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?x9(Object(r),!0).forEach(function(t){_e(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x9(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function x7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _t(e){return(_t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _r(e,t){return(_r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _n(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var _a=function(e){var t=ls.Component;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),t&&_r(i,t);var r,n,a,o=(r=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=_t(i);e=r?Reflect.construct(t,arguments,_t(this).constructor):t.apply(this,arguments);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return _n(this)});function i(e){var t;if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,i),_e(_n(t=o.call(this,e)),"handleRef",function(e){t.el=e}),_e(_n(t),"addThingToDo",function(e,r){t.state.hasError&&"unmount"!==e||(t.nextThingToDo=(t.nextThingToDo||Promise.resolve()).then(function(){if(!t.unmounted||"unmount"===e)return r.apply(void 0,arguments)}).catch(function(r){throw t.nextThingToDo=Promise.resolve(),t.setState({hasError:!0}),r&&r.message&&(r.message="During '".concat(e,"', parcel threw an error: ").concat(r.message)),t.props.handleError?t.props.handleError(r):setTimeout(function(){throw r}),r}))}),_e(_n(t),"getParcelProps",function(){var e=x8(x8({},t.props),{},{domElement:t.el});return delete e.mountParcel,delete e.config,delete e.wrapWith,delete e.wrapStyle,delete e.appendTo,delete e.handleError,delete e.parcelDidMount,e}),t.state={hasError:!1},!e.config)throw Error("single-spa-react's Parcel component requires the 'config' prop to either be a parcel config or a loading function that returns a promise. See https://github.com/single-spa/single-spa-react");return t}return n=[{key:"componentDidMount",value:function(){var e=this;this.unmounted=!1,this.addThingToDo("mount",function(){var t,r=e.props.mountParcel||e.mountParcel;if(!r)throw Error("\n <Parcel /> was not passed a mountParcel prop, nor is it rendered where mountParcel is within the React context.\n If you are using <Parcel /> within a module that is not a single-spa application, you will need to import mountRootParcel from single-spa and pass it into <Parcel /> as a mountParcel prop \n ");return e.el?t=e.el:(e.createdDomElement=t=document.createElement(e.props.wrapWith),Object.keys(e.props.wrapStyle).forEach(function(r){t.style[r]=e.props.wrapStyle[r]}),e.props.appendTo.appendChild(t)),e.parcel=r(e.props.config,x8({domElement:t},e.getParcelProps())),e.parcel.mountPromise.then(e.props.parcelDidMount),e.parcel.mountPromise})}},{key:"componentDidUpdate",value:function(){var e=this;this.addThingToDo("update",function(){if(e.parcel&&e.parcel.update)return e.parcel.update(e.getParcelProps())})}},{key:"componentWillUnmount",value:function(){var e=this;this.addThingToDo("unmount",function(){if(e.parcel&&"MOUNTED"===e.parcel.getStatus())return e.parcel.unmount()}),this.createdDomElement&&this.createdDomElement.parentNode.removeChild(this.createdDomElement),this.unmounted=!0}},{key:"render",value:function(){var e=this;if(this.props.appendTo)return lI&&lI.Consumer?ls.createElement(lI.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):null;var t=lI&&lI.Consumer?ls.createElement(lI.Consumer,null,function(t){return e.mountParcel=t?t.mountParcel:null,null}):void 0;return ls.createElement(this.props.wrapWith,{ref:this.handleRef,style:this.props.wrapStyle,className:this.props.wrapClassName},t)}}],x7(i.prototype,n),a&&x7(i,a),i}();_e(_a,"defaultProps",{wrapWith:"div",wrapStyle:{},parcelDidMount:function(){}});var _o=r(810),_i=r(771);let _s={workspaceOuterContainer:"-esm-report-builder__workspace2-module__workspaceOuterContainer___W9iJN",narrowWorkspace:"-esm-report-builder__workspace2-module__narrowWorkspace___6pFGF",widerWorkspace:"-esm-report-builder__workspace2-module__widerWorkspace___aQBxL",extraWideWorkspace:"-esm-report-builder__workspace2-module__extraWideWorkspace___Hcpmd",workspaceMiddleContainer:"-esm-report-builder__workspace2-module__workspaceMiddleContainer___DlVKb",maximized:"-esm-report-builder__workspace2-module__maximized___GqZm5",hidden:"-esm-report-builder__workspace2-module__hidden___KSjDv",workspaceInnerContainer:"-esm-report-builder__workspace2-module__workspaceInnerContainer___qQKWW",workspaceSpacer:"-esm-report-builder__workspace2-module__workspaceSpacer___tx3mR",loader:"-esm-report-builder__workspace2-module__loader___f9ttF",hiddenExtraWorkspace:"-esm-report-builder__workspace2-module__hiddenExtraWorkspace___o2RHo",header:"-esm-report-builder__workspace2-module__header___4cJjV",headerButtons:"-esm-report-builder__workspace2-module__headerButtons___5vIhN",workspaceContent:"-esm-report-builder__workspace2-module__workspaceContent___ROBU9",overlayHeaderSpacer:"-esm-report-builder__workspace2-module__overlayHeaderSpacer___CFci9",isActionMenuOpened:"-esm-report-builder__workspace2-module__isActionMenuOpened___TlyIU",showActionMenu:"-esm-report-builder__workspace2-module__showActionMenu___5qVqE",marginWorkspaceContent:"-esm-report-builder__workspace2-module__marginWorkspaceContent___jB4mY",workspaceContainerWithActionMenu:"-esm-report-builder__workspace2-module__workspaceContainerWithActionMenu___+EHP1",workspaceFixedContainer:"-esm-report-builder__workspace2-module__workspaceFixedContainer___PV5s-",workspaceContainerWithoutActionMenu:"-esm-report-builder__workspace2-module__workspaceContainerWithoutActionMenu___pJYA1"},_l=e=>e.registeredWorkspacesByName,_u=({lifeCycle:e,openedWorkspace:t,openedWindow:r,groupProps:n,actions:a,renderChrome:o,isRootWorkspace:i,isLeafWorkspace:s,showActionMenu:l})=>{let u=(0,ls.useMemo)(()=>t&&{closeWorkspace:async(e={})=>{let{closeWindow:n=!1,discardUnsavedChanges:o=!1}=e;return n?!!(o||await a.promptForClosingWorkspaces())&&(a.closeWorkspace(r.openedWorkspaces[0].workspaceName),!0):!!(o||await a.promptForClosingWorkspaces(t.workspaceName))&&(a.closeWorkspace(t.workspaceName),!0)},launchChildWorkspace:async(e,n)=>{let o=t.workspaceName,{openedWorkspaces:i}=r,s=i.findIndex(e=>e.workspaceName===o);-1===s||s!==i.length-1&&i.slice(s+1).some(e=>e.hasUnsavedChanges)&&!await a.promptForClosingWorkspaces(i[s+1].workspaceName)||a.openChildWorkspace(o,e,n||{})},setWorkspaceTitle:e=>a.setWorkspaceTitle(t.uuid,e),setHasUnsavedChanges:e=>a.setHasUnsavedChanges(t.uuid,e),workspaceName:t.workspaceName,workspaceProps:t.props,windowProps:r.props,groupProps:n,workspaceMeta:s4.getState().registeredWorkspacesByName[t.workspaceName]?.meta??{},isRootWorkspace:i,isLeafWorkspace:s,windowName:r.windowName,showActionMenu:l},[t,r,n,a,i,s,l]),c=!o&&!s,d=(0,ls.useMemo)(()=>e?(0,lc.jsx)(_a,{config:e,mountParcel:lo,wrapWith:"div",wrapClassName:ch()(_s.workspaceContent,{[_s.hiddenExtraWorkspace]:c}),...u},t.workspaceName):null===e?(0,lc.jsx)("div",{className:ch()(_s.workspaceContent,{[_s.hiddenExtraWorkspace]:c}),children:(0,lc.jsx)(cw.jeF,{kind:"error",title:aV("error"),subtitle:aV("somethingWentWrongTryReloading"),hideCloseButton:!0})}):null,[e,t.workspaceName,u,c]);return o?(0,lc.jsx)("div",{children:(0,lc.jsx)(_c,{openedWorkspace:t,openedWindow:r,isRootWorkspace:i,showActionMenu:l,closeWindow:()=>u.closeWorkspace({closeWindow:!0}),children:d})}):d??(0,lc.jsx)(cw.OuH,{className:ch()(_s.loader,{[_s.hiddenExtraWorkspace]:c}),description:`${aV("loading")}`})},_c=({openedWorkspace:e,openedWindow:t,isRootWorkspace:r,showActionMenu:n,closeWindow:a,children:o})=>{let i=uL(),{openedGroup:s,openedWindows:l,registeredWindowsByName:u,registeredWorkspacesByName:c,registeredGroupsByName:d,isMostRecentlyOpenedWindowHidden:m,setWindowMaximized:p,hideWindow:f}=x0(),h=t.windowName,{maximized:g}=t,y=e.title??"",v=u[h],b=x2(t,c,u),w=v?.icon,E=v?.canMaximize,D=!!s&&d[s.groupName]?.persistence==="closable",x=!!w&&!D,_=l.findIndex(e=>e.windowName===h)<l.length-1||m,S=Object.values(u).some(e=>e.group===s?.groupName&&void 0!==e.icon);return(0,lc.jsxs)("div",{className:ch()(_s.workspaceOuterContainer,{[_s.narrowWorkspace]:"narrow"===b,[_s.widerWorkspace]:"wider"===b,[_s.extraWideWorkspace]:"extra-wide"===b,[_s.isActionMenuOpened]:S}),children:[(0,lc.jsx)("div",{className:ch()(_s.workspaceSpacer,{[_s.hidden]:_})}),(0,lc.jsx)("div",{className:ch()(_s.workspaceMiddleContainer,{[_s.maximized]:g,[_s.hidden]:_,[_s.isRootWorkspace]:r,[_s.showActionMenu]:n}),children:(0,lc.jsx)("div",{className:ch()(_s.workspaceInnerContainer,{[_s.maximized]:g,[_s.hidden]:_,[_s.isRootWorkspace]:r}),children:o?(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsxs)(cw.Y9Y,{"aria-label":aV("workspaceHeader"),className:_s.header,children:[(0,lc.jsx)(cw.bCw,{prefix:"",children:y}),(0,lc.jsx)("div",{className:_s.overlayHeaderSpacer}),(0,lc.jsx)(cw.wdv,{className:_s.headerButtons,children:uF(i)?(0,lc.jsxs)(lc.Fragment,{children:[(E||g)&&(0,lc.jsx)(cw.V8d,{"aria-label":g?aV("minimize"):aV("maximize"),onClick:()=>p(h,!g),children:g?(0,lc.jsx)(_o.Xj,{}):(0,lc.jsx)(_o.hz,{})}),x&&(0,lc.jsx)(cw.V8d,{"aria-label":aV("hide"),onClick:()=>f(),children:(0,lc.jsx)(cL,{})}),!D&&(0,lc.jsx)(cw.V8d,{"aria-label":aV("close"),onClick:a,children:(0,lc.jsx)(c4,{})})]}):(0,lc.jsxs)(lc.Fragment,{children:[x&&(0,lc.jsx)(cw.V8d,{"aria-label":aV("hide"),onClick:()=>f(),children:(0,lc.jsx)(_i.d3,{})}),(0,lc.jsx)(cw.V8d,{"aria-label":aV("close"),onClick:()=>{D?xU():a()},children:(0,lc.jsx)(c4,{})})]})})]}),o]}):(0,lc.jsx)(cw.OuH,{className:_s.loader,description:`${aV("loading")} ...`})})})]})},_d=({openedWindow:e,groupProps:t,actions:r,renderChrome:n,showActionMenu:a})=>{let{openedWorkspaces:o}=e,[i,s]=(0,ls.useState)({}),l=lg(s4,_l),u=(0,ls.useRef)(new Set);return(0,ls.useEffect)(()=>{let e=!1;return Promise.all(o.map(async t=>{let r=l[t.workspaceName];if(!r)return null;let{moduleName:n,component:a}=r;try{return[t.uuid,await cn(n,a)]}catch(r){return e||u.current.has(t.uuid)||(u.current.add(t.uuid),C(r)),[t.uuid,null]}})).then(t=>{e||s(Object.fromEntries(t.filter(e=>null!=e)))},C),()=>{e=!0}},[o,l]),(0,lc.jsx)(lc.Fragment,{children:o.map((s,l)=>(0,lc.jsx)(_u,{openedWorkspace:s,openedWindow:e,groupProps:t,actions:r,renderChrome:n,lifeCycle:i[s.uuid],isRootWorkspace:0===l,isLeafWorkspace:l===o.length-1,showActionMenu:a},s.uuid))})},_m=e=>e.registeredWorkspacesByName,_p=({name:e,workspaceProps:t,windowProps:r,groupProps:n,onWindowChanged:a})=>{let o=lg(s4,_m),i=lg(s4,t=>{let r=t.registeredWorkspacesByName[e]?.window;return r?t.registeredWindowsByName[r]:void 0}),s={name:e,workspaceProps:t,windowProps:r,groupProps:n},l=(0,ls.useRef)(null),u=(0,ls.useRef)(null);if(!l.current){let a=x6(e,t,r);l.current=B({openedWindow:a,groupProps:n??null}),a&&(u.current=s)}let c=l.current;(0,ls.useEffect)(()=>{let a=u.current;if(a&&a.name===e&&R(a.workspaceProps,t)&&R(a.windowProps,r)&&R(a.groupProps,n))return;let o=x6(e,t,r);c.setState({openedWindow:o,groupProps:n??null},!0),u.current=o?s:null},[e,t,r,n,o,c]);let d=(0,ls.useMemo)(()=>(function(e){function t(t){e.setState(e=>{if(!e.openedWindow)return e;let r=t(e.openedWindow);return r===e.openedWindow?e:{...e,openedWindow:r}})}return{closeWorkspace(e){t(t=>xY(t,e))},openChildWorkspace(e,r,n){t(t=>xq(t,e,r,n))},setWorkspaceTitle(e,r){t(t=>xJ(t,e,{title:r}))},setHasUnsavedChanges(e,r){t(t=>xJ(t,e,{hasUnsavedChanges:r}))},promptForClosingWorkspaces(t){let{openedWindow:r}=e.getState();return r?xZ(r,t):Promise.resolve(!0)}}})(c),[c]),{openedWindow:m,groupProps:p}=lg(c),f=m?.openedWorkspaces[m.openedWorkspaces.length-1],h=f?.workspaceName??null,g=f?.title??"",y=m?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,v=i?.width??"narrow",b=(0,ls.useRef)(a);return(0,ls.useEffect)(()=>{b.current=a}),(0,ls.useEffect)(()=>{b.current?.({workspaceName:h,windowWidth:v,title:g,hasUnsavedChanges:y})},[h,v,g,y]),(0,lc.jsx)("div",{className:"-esm-report-builder__exported-workspace-module__exportedWorkspace___5yaCt",children:m?(0,lc.jsx)(_d,{openedWindow:m,groupProps:p,actions:d,renderChrome:!1,showActionMenu:!1}):null})},_f="-esm-report-builder__action-menu-button2-module__container___qxTbB",_h="-esm-report-builder__action-menu-button2-module__elementContainer___MzyUg",_g="-esm-report-builder__action-menu-button2-module__active___nMKHE",_y="-esm-report-builder__action-menu-button2-module__focused___ncbDv";function _v({getIcon:e,hasUnsavedChanges:t,tagContent:r}){return(0,lc.jsxs)(lc.Fragment,{children:[e({size:16}),t?(0,lc.jsx)("span",{className:"-esm-report-builder__action-menu-button2-module__interruptedTag___HSn-T",children:"!"}):(0,lc.jsx)("span",{className:"-esm-report-builder__action-menu-button2-module__countTag___bUcY2",children:r})]})}let _b=({icon:e,label:t,tagContent:r,workspaceToLaunch:n,onBeforeWorkspaceLaunch:a,hidden:o,disabled:i})=>{let s=uL(),{openedWindows:l,restoreWindow:u,hideWindow:c,isMostRecentlyOpenedWindowHidden:d}=x0(),{extension:m}=(0,ls.useContext)(lu),p=l.findIndex(e=>e.windowName===m?.extensionId),f=l[p],h=null!=f,g=h&&(p<l.length-1||d),y=h&&!g,v=f?.openedWorkspaces.some(e=>e.hasUnsavedChanges)??!1,b=async()=>{if(h)g?u(f.windowName):c();else if(await (a?.()??!0)){let{workspaceName:e,workspaceProps:t,windowProps:r}=n;xW(e,t,r)}};return o?.(l)?null:"tablet"===s||"phone"===s?(0,lc.jsxs)(cw.$nd,{className:ch()(_f,{[_g]:h&&!y,[_y]:y}),iconDescription:t,kind:"ghost",onClick:b,role:"button",tabIndex:0,size:"md",disabled:i?.(l),children:[(0,lc.jsx)("span",{className:_h,children:(0,lc.jsx)(_v,{hasUnsavedChanges:v,getIcon:e,tagContent:r})}),(0,lc.jsx)("span",{children:t})]}):(0,lc.jsx)(cw.K0,{align:"left","aria-label":t,className:ch()(_f,{[_g]:h&&!y,[_y]:y}),enterDelayMs:300,kind:"ghost",label:t,onClick:b,size:"md",disabled:i?.(l),children:(0,lc.jsx)("div",{className:_h,children:(0,lc.jsx)(_v,{hasUnsavedChanges:v,getIcon:e,tagContent:r})})})};function _w({showContactDetails:e,toggleContactDetails:t,className:r}){return(0,lc.jsx)(cw.$nd,{className:r,iconDescription:"Toggle contact details",kind:"ghost",onClick:t,renderIcon:e?c1:cX,children:e?aV("showLess","Show less"):aV("showMore","Show more")})}let _E={contactDetails:"-esm-report-builder__patient-banner-contact-details-module__contactDetails___+ytje",deceased:"-esm-report-builder__patient-banner-contact-details-module__deceased___mxjtl",heading:"-esm-report-builder__patient-banner-contact-details-module__heading___wxIC0",row:"-esm-report-builder__patient-banner-contact-details-module__row___dafkX",col:"-esm-report-builder__patient-banner-contact-details-module__col___vGkbd",relationship:"-esm-report-builder__patient-banner-contact-details-module__relationship___ZOV9O"},_D=({patientUuid:e})=>{let{cohorts:t=[],isLoading:r}=function(e){let t=e?`${a0}/cohortm/cohortmember?patient=${e}&v=custom:(uuid,patient:ref,cohort:(uuid,name,startDate,endDate))`:null,{data:r,isLoading:n}=(0,lW.u)(t,a3),a=r?.data?.results.map(e=>({uuid:e.cohort.uuid,name:e.cohort.name,startDate:e.cohort.startDate,endDate:e.cohort.endDate}));return(0,ls.useMemo)(()=>({cohorts:a,isLoading:n}),[n,a])}(e);return(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsxs)("p",{className:_E.heading,children:[aV("patientLists","Patient Lists")," (",t?.length??0,")"]}),r?(0,lc.jsx)(cw.OuH,{description:`${aV("loading","Loading")} ...`,role:"progressbar"}):(0,lc.jsxs)("ul",{children:[(()=>{if(t?.length>0){let e=t.sort((e,t)=>wM(e?.startDate).getTime()-wM(t?.startDate).getTime()).slice(0,3);return e?.map(e=>(0,lc.jsx)("li",{children:(0,lc.jsx)(ld,{to:`${window.spaBase}/home/patient-lists/${e.uuid}`,children:e.name},e.uuid)},e.uuid))}return(0,lc.jsx)("li",{children:"--"})})(),t.length>3&&(0,lc.jsx)("li",{className:_E.link,children:(0,lc.jsx)(ld,{to:`${window.spaBase}/home/patient-lists`,children:aV("seeMoreLists","See {{count}} more lists",{count:t?.length-3})})})]})]})},_x=({patientId:e})=>{let{patient:t,isLoading:r}=uq(e),n=t?.address?.find(e=>"home"===e.use),a=e=>e.split("#")[1];return r?(0,lc.jsx)(cw.OuH,{description:`${aV("loading","Loading")} ...`,role:"progressbar"}):(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("p",{className:_E.heading,children:aV("address","Address")}),(0,lc.jsx)("ul",{children:n?Object.entries(n).filter(([e])=>"id"!==e&&"use"!==e).map(([e,t])=>"extension"===e?n.extension?.[0]?.extension?.map((t,r)=>(0,lc.jsxs)("li",{children:[aV(a(t.url),a(t.url)),": ",t.valueString]},`address-${e}-${r}`)):(0,lc.jsxs)("li",{children:[aV(e,e),": ",t]},`address-${e}`)):(0,lc.jsx)("li",{children:"--"})})]})},__=({patientUuid:e})=>{let{isLoading:t,contactAttributes:r}=(e=>{let{contactAttributeTypes:t=[]}=ul({externalModuleName:"@openmrs/esm-patient-banner-app"}),{attributes:r,error:n,isLoading:a}=(e=>{let{data:t,error:r,isLoading:n}=um(`${a0}/patient/${e}?v=custom:(uuid,display,identifiers:(identifier,uuid,preferred,location:(uuid,name),identifierType:(uuid,name,format,formatDescription,validator)),person:(uuid,display,gender,birthdate,dead,age,deathDate,birthdateEstimated,causeOfDeath,preferredName:(uuid,preferred,givenName,middleName,familyName),attributes,preferredAddress:(uuid,preferred,address1,address2,cityVillage,longitude,stateProvince,latitude,country,postalCode,countyDistrict,address3,address4,address5,address6,address7)))`,a3);return{isLoading:n,attributes:t?.data.person.attributes??[],error:r}})(e);return{contactAttributes:(0,ls.useMemo)(()=>r.filter(({attributeType:e})=>t?.some(t=>e.uuid===t)),[r,t]),isLoading:a,error:n}})(e),n=(0,ls.useMemo)(()=>r?[...r?.map(e=>[e.attributeType.display?aV(e.attributeType.display,e.attributeType.display):"",e.value])]:[],[r]);return(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("p",{className:_E.heading,children:aV("contactDetails","Contact Details")}),t?(0,lc.jsx)(cw.OuH,{description:`${aV("loading","Loading")} ...`,role:"progressbar"}):(0,lc.jsx)("ul",{children:n.length?n.map(([e,t],r)=>(0,lc.jsxs)("li",{children:[e,": ",t]},`${e}-${t}-${r}`)):(0,lc.jsx)("li",{children:"--"})})]})},_S=({patientId:e})=>{let{data:t,isLoading:r}=function(e){let t=`${a0}/relationship?v=custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))&person=${e}`,{data:r,error:n,isLoading:a,isValidating:o}=(0,lW.u)(e?t:null,a3),i=r?.data?.results?.length?function(e,t){let r=[];for(let n of t)e===n.personA.uuid?r.push({uuid:`${n.uuid}`,display:n.personB.display,relativeAge:n.personB.age,relativeUuid:n.personB.uuid,relationshipType:n.relationshipType.bIsToA}):r.push({uuid:`${n.uuid}`,display:n.personA.display,relativeAge:n.personA.age,relativeUuid:n.personA.uuid,relationshipType:n.relationshipType.aIsToB});return r}(e,r.data.results):null;return{data:r?i:null,error:n,isLoading:a,isValidating:o}}(e);return(0,lc.jsxs)(lc.Fragment,{children:[(0,lc.jsx)("p",{className:_E.heading,children:aV("relationships","Relationships")}),r?(0,lc.jsx)(cw.OuH,{description:`${aV("loading","Loading")} ...`,role:"progressbar"}):(0,lc.jsx)("ul",{children:t&&t.length>0?(0,lc.jsx)(lc.Fragment,{children:t.map(e=>(0,lc.jsxs)("li",{className:_E.relationship,children:[(0,lc.jsx)("div",{children:(0,lc.jsx)(ld,{to:`${window.spaBase}/patient/${e.relativeUuid}/chart`,children:e.display})}),(0,lc.jsx)("div",{children:e.relationshipType}),(0,lc.jsx)("div",{children:`${e.relativeAge?e.relativeAge:"--"} ${e.relativeAge?1===e.relativeAge?aV("yearAbbreviation","yr"):aV("yearsAbbreviation","yrs"):""}`})]},e.uuid))}):(0,lc.jsx)("li",{children:"--"})})]})};function _C({patientId:e,deceased:t}){return(0,lc.jsxs)("div",{className:ch()(_E.contactDetails,{[_E.deceased]:t}),children:[(0,lc.jsxs)("div",{className:_E.row,children:[(0,lc.jsx)("div",{className:_E.col,children:(0,lc.jsx)(_x,{patientId:e})}),(0,lc.jsx)("div",{className:_E.col,children:(0,lc.jsx)(__,{patientUuid:e})})]}),(0,lc.jsxs)("div",{className:_E.row,children:[(0,lc.jsx)("div",{className:_E.col,children:(0,lc.jsx)(_S,{patientId:e})}),(0,lc.jsx)("div",{className:_E.col,children:(0,lc.jsx)(_D,{patientUuid:e})})]})]})}function _k(e){let t=document.querySelector("template#loading-spinner");if(t){let r=t.content.cloneNode(!0),n=Array.prototype.map.call(r.childNodes,e=>e);return e.appendChild(r),()=>n.forEach(e=>e.remove())}return()=>{}}let _P="-esm-report-builder__action-menu2-module__container___usAej";function _R({workspaceGroup:e,groupProps:t}){let r=uL(),{persistence:n}=e;return(0,lc.jsx)("aside",{className:"-esm-report-builder__action-menu2-module__sideRail___dTm93",children:(0,lc.jsxs)("div",{className:_P,children:["closable"==n&&uF(r)&&(0,lc.jsx)(cw.K0,{align:"left",onClick:()=>xU(),label:aV("close"),kind:"ghost",children:(0,lc.jsx)(c4,{})}),(0,lc.jsx)(lu.Provider,{value:{moduleName:e.moduleName,featureName:e.name},children:(0,lc.jsx)(lC,{className:_P,name:e.name,state:{groupProps:t}})})]})})}function _T(e){let t=new URL(e,window.location.origin).pathname,r=new URL(window.getOpenmrsSpaBase?.()??"/",window.location.origin).pathname,n=r.endsWith("/")?r.slice(0,-1):r,a=null;return n?n===t?a="/":t.startsWith(`${n}/`)&&(a=t.slice(n.length)):a=t,{full:t,spaRelative:a}}function _O(e){e&&(0,lk.createRoot)(e).render((0,lc.jsx)(_$,{}))}function _$(){let{openedGroup:e,openedWindows:t,registeredGroupsByName:r,registeredWindowsByName:n}=x0();if((0,ls.useEffect)(()=>im("before-page-changed",t=>{let{newPage:n,cancelNavigation:a,oldUrl:o,newUrl:i}=t;if(!e)return;if(n)return void a(xU().then(e=>!e));let s=r[e.groupName],l=s?.scopePattern;l&&function(e,t,r){try{let n=new RegExp(e),a=_T(t),o=_T(r);if(null===a.spaRelative||null===o.spaRelative)return!0;let i=n.exec(a.spaRelative),s=n.exec(o.spaRelative);if(i&&s||(i=n.exec(a.full),s=n.exec(o.full)),!i||!s)return!0;if(i.length>1)return!i.slice(1).every((e,t)=>e===s[t+1]);return!1}catch{return!0}}(l,o,i)&&a(xU().then(e=>!e))}),[e,r]),!e)return null;let a=r[e.groupName],o=t.some(e=>e.maximized),{name:i}=a,s=Object.values(n).filter(e=>e.group===i&&void 0!==e.icon).sort((e,t)=>(e.order??Number.MAX_VALUE)-(t.order??Number.MAX_VALUE)).length>0;return(0,lc.jsxs)("div",{className:ch()("-esm-report-builder__workspace-windows-and-menu-module__workspaceWindowsAndMenuContainer___CSZs-",{"-esm-report-builder__workspace-windows-and-menu-module__overlay___0kl8U":a.overlay,"-esm-report-builder__workspace-windows-and-menu-module__hasMaximizedWindow___+DcH9":o}),children:[(0,lc.jsx)("div",{className:"-esm-report-builder__workspace-windows-and-menu-module__workspaceWindowsContainer___s8ddv",children:t.map(t=>(0,lc.jsx)(_N,{openedWindow:t,groupProps:e.props,showActionMenu:s},t.windowName))}),s&&(0,lc.jsx)(_R,{workspaceGroup:a,groupProps:e.props})]})}function _N({openedWindow:e,groupProps:t,showActionMenu:r}){let{windowName:n}=e,a=(0,ls.useMemo)(()=>({closeWorkspace(e){s4.setState(t=>xQ.closeWorkspace(t,e))},openChildWorkspace(e,t,r){s4.setState(n=>xQ.openChildWorkspace(n,e,t,r))},setWorkspaceTitle(e,t){s4.setState(r=>xQ.setWorkspaceTitle(r,e,t))},setHasUnsavedChanges(e,t){s4.setState(r=>xQ.setHasUnsavedChanges(r,e,t))},promptForClosingWorkspaces(e){let t=s4.getState().openedWindows.find(e=>e.windowName===n);return t?xZ(t,e):Promise.resolve(!0)}}),[n]);return(0,lc.jsx)(_d,{openedWindow:e,groupProps:t,actions:a,renderChrome:!0,showActionMenu:r})}function _I(e,t,r){if(null==e)return r;let n=b3(e);if(!n)return console.warn(`matchLocale: invalid requested locale tag: ${JSON.stringify(e)}`),r;let a=[];for(let e of t){let t=b3(e);if(!t){console.warn(`matchLocale: skipping invalid available locale tag: ${JSON.stringify(e)}`);continue}a.push({canonical:t,original:e})}let o=n;for(;o;){let e=a.find(e=>e.canonical===o);if(e)return e.original;let t=o+"-",r=a.find(e=>e.canonical.startsWith(t));if(r)return r.original;if("ht"===o){o="fr-HT";continue}let n=o.lastIndexOf("-");if(-1===n)break;let i=(o=o.slice(0,n)).lastIndexOf("-");-1!==i&&o.length-i==2&&(o=o.slice(0,i))}return r}function _M(e=window.localStorage){try{return e.getItem("test"),!0}catch{return!1}}function _j(e){return!!e&&e.constructor===Object}var _A=r(7638);function _L(e){let[t,r,n]=e.split(".");return`${t}.${r}.${n}`}function _F(e,t){return _A(function(e){let t=e.indexOf("-");if(t>=0){let r=_L(e.slice(0,t)),n=e.slice(t+1);return`${r}-${n}`}return _L(e)}(t),e,{includePrerelease:!0})}async function _B(e,t={}){let r,{shouldRetry:n,getDelay:a,onError:o}=t;n=n??(e=>e<=5),a=a??(e=>(function(e,t=!1){return 1e3*Math.pow(2,t?e+1:e)})(e));let i=0;do try{return await _V(a(i)),await e()}catch(e){o?.(e,i),r=e}while(n(i++));throw r}async function _V(e){if(!(e<=0))return new Promise(t=>setTimeout(t,e))}function _U(e,t,r,n){}function _W(e){}function _H(e){return Promise.resolve([])}function _z(e){return Promise.resolve([])}function _K(e){return Promise.resolve({success:!1,result:void 0,error:"No service worker has been registered. Offline-related features have been removed from the framework."})}function _G(e){return()=>{}}function _Z(){return!0}}}]);