UNPKG

@ministryofjustice/hmpps-digital-prison-reporting-frontend

Version:

The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.

69 lines 174 kB
var Fo=Object.create;var Vt=Object.defineProperty;var Io=Object.getOwnPropertyDescriptor;var No=Object.getOwnPropertyNames;var $o=Object.getPrototypeOf,Po=Object.prototype.hasOwnProperty;var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Vo=(t,e)=>{for(var r in e)Vt(t,r,{get:e[r],enumerable:!0})},Xn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of No(e))!Po.call(t,a)&&a!==r&&Vt(t,a,{get:()=>e[a],enumerable:!(n=Io(e,a))||n.enumerable});return t};var ee=(t,e,r)=>(r=t!=null?Fo($o(t)):{},Xn(e||!t||!t.__esModule?Vt(r,"default",{value:t,enumerable:!0}):r,t)),Uo=t=>Xn(Vt({},"__esModule",{value:!0}),t);var Er=I((qf,wr)=>{"use strict";var Kn=require("url"),Jn=Kn.parse,Ut=Kn.Url;wr.exports=Zn;wr.exports.original=Bo;function Zn(t){var e=t.url;if(e!==void 0){var r=t._parsedUrl;return ta(e,r)?r:(r=ea(e),r._raw=e,t._parsedUrl=r)}}function Bo(t){var e=t.originalUrl;if(typeof e!="string")return Zn(t);var r=t._parsedOriginalUrl;return ta(e,r)?r:(r=ea(e),r._raw=e,t._parsedOriginalUrl=r)}function ea(t){if(typeof t!="string"||t.charCodeAt(0)!==47)return Jn(t);for(var e=t,r=null,n=null,a=1;a<t.length;a++)switch(t.charCodeAt(a)){case 63:n===null&&(e=t.substring(0,a),r=t.substring(a+1),n=t.substring(a));break;case 9:case 10:case 12:case 13:case 32:case 35:case 160:case 65279:return Jn(t)}var i=Ut!==void 0?new Ut:{};return i.path=t,i.href=t,i.pathname=e,n!==null&&(i.query=r,i.search=n),i}function ta(t,e){return typeof e=="object"&&e!==null&&(Ut===void 0||e instanceof Ut)&&e._raw===t}});var Fe=I((Tr,Ar)=>{(function(t,e){typeof Tr=="object"&&typeof Ar<"u"?Ar.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(Tr,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",a="second",i="minute",s="hour",o="day",l="week",u="month",c="quarter",h="year",f="date",d="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,R={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(T){var b=["th","st","nd","rd"],y=T%100;return"["+T+(b[(y-20)%10]||b[y]||b[0])+"]"}},g=function(T,b,y){var _=String(T);return!_||_.length>=b?T:""+Array(b+1-_.length).join(y)+T},w={s:g,z:function(T){var b=-T.utcOffset(),y=Math.abs(b),_=Math.floor(y/60),S=y%60;return(b<=0?"+":"-")+g(_,2,"0")+":"+g(S,2,"0")},m:function T(b,y){if(b.date()<y.date())return-T(y,b);var _=12*(y.year()-b.year())+(y.month()-b.month()),S=b.clone().add(_,u),v=y-S<0,D=b.clone().add(_+(v?-1:1),u);return+(-(_+(y-S)/(v?S-D:D-S))||0)},a:function(T){return T<0?Math.ceil(T)||0:Math.floor(T)},p:function(T){return{M:u,y:h,w:l,d:o,D:f,h:s,m:i,s:a,ms:n,Q:c}[T]||String(T||"").toLowerCase().replace(/s$/,"")},u:function(T){return T===void 0}},O="en",A={};A[O]=R;var x="$isDayjsObject",V=function(T){return T instanceof j||!(!T||!T[x])},P=function T(b,y,_){var S;if(!b)return O;if(typeof b=="string"){var v=b.toLowerCase();A[v]&&(S=v),y&&(A[v]=y,S=v);var D=b.split("-");if(!S&&D.length>1)return T(D[0])}else{var E=b.name;A[E]=b,S=E}return!_&&S&&(O=S),S||!_&&O},F=function(T,b){if(V(T))return T.clone();var y=typeof b=="object"?b:{};return y.date=T,y.args=arguments,new j(y)},L=w;L.l=P,L.i=V,L.w=function(T,b){return F(T,{locale:b.$L,utc:b.$u,x:b.$x,$offset:b.$offset})};var j=function(){function T(y){this.$L=P(y.locale,null,!0),this.parse(y),this.$x=this.$x||y.x||{},this[x]=!0}var b=T.prototype;return b.parse=function(y){this.$d=function(_){var S=_.date,v=_.utc;if(S===null)return new Date(NaN);if(L.u(S))return new Date;if(S instanceof Date)return new Date(S);if(typeof S=="string"&&!/Z$/i.test(S)){var D=S.match(m);if(D){var E=D[2]-1||0,M=(D[7]||"0").substring(0,3);return v?new Date(Date.UTC(D[1],E,D[3]||1,D[4]||0,D[5]||0,D[6]||0,M)):new Date(D[1],E,D[3]||1,D[4]||0,D[5]||0,D[6]||0,M)}}return new Date(S)}(y),this.init()},b.init=function(){var y=this.$d;this.$y=y.getFullYear(),this.$M=y.getMonth(),this.$D=y.getDate(),this.$W=y.getDay(),this.$H=y.getHours(),this.$m=y.getMinutes(),this.$s=y.getSeconds(),this.$ms=y.getMilliseconds()},b.$utils=function(){return L},b.isValid=function(){return this.$d.toString()!==d},b.isSame=function(y,_){var S=F(y);return this.startOf(_)<=S&&S<=this.endOf(_)},b.isAfter=function(y,_){return F(y)<this.startOf(_)},b.isBefore=function(y,_){return this.endOf(_)<F(y)},b.$g=function(y,_,S){return L.u(y)?this[_]:this.set(S,y)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(y,_){var S=this,v=!!L.u(_)||_,D=L.p(y),E=function(me,W){var le=L.w(S.$u?Date.UTC(S.$y,W,me):new Date(S.$y,W,me),S);return v?le:le.endOf(o)},M=function(me,W){return L.w(S.toDate()[me].apply(S.toDate("s"),(v?[0,0,0,0]:[23,59,59,999]).slice(W)),S)},$=this.$W,G=this.$M,ne=this.$D,_e="set"+(this.$u?"UTC":"");switch(D){case h:return v?E(1,0):E(31,11);case u:return v?E(1,G):E(0,G+1);case l:var ve=this.$locale().weekStart||0,Me=($<ve?$+7:$)-ve;return E(v?ne-Me:ne+(6-Me),G);case o:case f:return M(_e+"Hours",0);case s:return M(_e+"Minutes",1);case i:return M(_e+"Seconds",2);case a:return M(_e+"Milliseconds",3);default:return this.clone()}},b.endOf=function(y){return this.startOf(y,!1)},b.$set=function(y,_){var S,v=L.p(y),D="set"+(this.$u?"UTC":""),E=(S={},S[o]=D+"Date",S[f]=D+"Date",S[u]=D+"Month",S[h]=D+"FullYear",S[s]=D+"Hours",S[i]=D+"Minutes",S[a]=D+"Seconds",S[n]=D+"Milliseconds",S)[v],M=v===o?this.$D+(_-this.$W):_;if(v===u||v===h){var $=this.clone().set(f,1);$.$d[E](M),$.init(),this.$d=$.set(f,Math.min(this.$D,$.daysInMonth())).$d}else E&&this.$d[E](M);return this.init(),this},b.set=function(y,_){return this.clone().$set(y,_)},b.get=function(y){return this[L.p(y)]()},b.add=function(y,_){var S,v=this;y=Number(y);var D=L.p(_),E=function(G){var ne=F(v);return L.w(ne.date(ne.date()+Math.round(G*y)),v)};if(D===u)return this.set(u,this.$M+y);if(D===h)return this.set(h,this.$y+y);if(D===o)return E(1);if(D===l)return E(7);var M=(S={},S[i]=e,S[s]=r,S[a]=t,S)[D]||1,$=this.$d.getTime()+y*M;return L.w($,this)},b.subtract=function(y,_){return this.add(-1*y,_)},b.format=function(y){var _=this,S=this.$locale();if(!this.isValid())return S.invalidDate||d;var v=y||"YYYY-MM-DDTHH:mm:ssZ",D=L.z(this),E=this.$H,M=this.$m,$=this.$M,G=S.weekdays,ne=S.months,_e=S.meridiem,ve=function(W,le,ye,Te){return W&&(W[le]||W(_,v))||ye[le].slice(0,Te)},Me=function(W){return L.s(E%12||12,W,"0")},me=_e||function(W,le,ye){var Te=W<12?"AM":"PM";return ye?Te.toLowerCase():Te};return v.replace(p,function(W,le){return le||function(ye){switch(ye){case"YY":return String(_.$y).slice(-2);case"YYYY":return L.s(_.$y,4,"0");case"M":return $+1;case"MM":return L.s($+1,2,"0");case"MMM":return ve(S.monthsShort,$,ne,3);case"MMMM":return ve(ne,$);case"D":return _.$D;case"DD":return L.s(_.$D,2,"0");case"d":return String(_.$W);case"dd":return ve(S.weekdaysMin,_.$W,G,2);case"ddd":return ve(S.weekdaysShort,_.$W,G,3);case"dddd":return G[_.$W];case"H":return String(E);case"HH":return L.s(E,2,"0");case"h":return Me(1);case"hh":return Me(2);case"a":return me(E,M,!0);case"A":return me(E,M,!1);case"m":return String(M);case"mm":return L.s(M,2,"0");case"s":return String(_.$s);case"ss":return L.s(_.$s,2,"0");case"SSS":return L.s(_.$ms,3,"0");case"Z":return D}return null}(W)||D.replace(":","")})},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(y,_,S){var v,D=this,E=L.p(_),M=F(y),$=(M.utcOffset()-this.utcOffset())*e,G=this-M,ne=function(){return L.m(D,M)};switch(E){case h:v=ne()/12;break;case u:v=ne();break;case c:v=ne()/3;break;case l:v=(G-$)/6048e5;break;case o:v=(G-$)/864e5;break;case s:v=G/r;break;case i:v=G/e;break;case a:v=G/t;break;default:v=G}return S?v:L.a(v)},b.daysInMonth=function(){return this.endOf(u).$D},b.$locale=function(){return A[this.$L]},b.locale=function(y,_){if(!y)return this.$L;var S=this.clone(),v=P(y,_,!0);return v&&(S.$L=v),S},b.clone=function(){return L.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},T}(),k=j.prototype;return F.prototype=k,[["$ms",n],["$s",a],["$m",i],["$H",s],["$W",o],["$M",u],["$y",h],["$D",f]].forEach(function(T){k[T[1]]=function(b){return this.$g(b,T[0],T[1])}}),F.extend=function(T,b){return T.$i||(T(b,j,F),T.$i=!0),F},F.locale=P,F.isDayjs=V,F.unix=function(T){return F(1e3*T)},F.en=A[O],F.Ls=A,F.p={},F})});var Qe=I((Cr,Lr)=>{(function(t,e){typeof Cr=="object"&&typeof Lr<"u"?Lr.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(Cr,function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,a=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,s={},o=function(m){return(m=+m)+(m>68?1900:2e3)},l=function(m){return function(p){this[m]=+p}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(m){(this.zone||(this.zone={})).offset=function(p){if(!p||p==="Z")return 0;var R=p.match(/([+-]|\d\d)/g),g=60*R[1]+(+R[2]||0);return g===0?0:R[0]==="+"?-g:g}(m)}],c=function(m){var p=s[m];return p&&(p.indexOf?p:p.s.concat(p.f))},h=function(m,p){var R,g=s.meridiem;if(g){for(var w=1;w<=24;w+=1)if(m.indexOf(g(w,0,p))>-1){R=w>12;break}}else R=m===(p?"pm":"PM");return R},f={A:[i,function(m){this.afternoon=h(m,!1)}],a:[i,function(m){this.afternoon=h(m,!0)}],Q:[r,function(m){this.month=3*(m-1)+1}],S:[r,function(m){this.milliseconds=100*+m}],SS:[n,function(m){this.milliseconds=10*+m}],SSS:[/\d{3}/,function(m){this.milliseconds=+m}],s:[a,l("seconds")],ss:[a,l("seconds")],m:[a,l("minutes")],mm:[a,l("minutes")],H:[a,l("hours")],h:[a,l("hours")],HH:[a,l("hours")],hh:[a,l("hours")],D:[a,l("day")],DD:[n,l("day")],Do:[i,function(m){var p=s.ordinal,R=m.match(/\d+/);if(this.day=R[0],p)for(var g=1;g<=31;g+=1)p(g).replace(/\[|\]/g,"")===m&&(this.day=g)}],w:[a,l("week")],ww:[n,l("week")],M:[a,l("month")],MM:[n,l("month")],MMM:[i,function(m){var p=c("months"),R=(c("monthsShort")||p.map(function(g){return g.slice(0,3)})).indexOf(m)+1;if(R<1)throw new Error;this.month=R%12||R}],MMMM:[i,function(m){var p=c("months").indexOf(m)+1;if(p<1)throw new Error;this.month=p%12||p}],Y:[/[+-]?\d+/,l("year")],YY:[n,function(m){this.year=o(m)}],YYYY:[/\d{4}/,l("year")],Z:u,ZZ:u};function d(m){var p,R;p=m,R=s&&s.formats;for(var g=(m=p.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(F,L,j){var k=j&&j.toUpperCase();return L||R[j]||t[j]||R[k].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(T,b,y){return b||y.slice(1)})})).match(e),w=g.length,O=0;O<w;O+=1){var A=g[O],x=f[A],V=x&&x[0],P=x&&x[1];g[O]=P?{regex:V,parser:P}:A.replace(/^\[|\]$/g,"")}return function(F){for(var L={},j=0,k=0;j<w;j+=1){var T=g[j];if(typeof T=="string")k+=T.length;else{var b=T.regex,y=T.parser,_=F.slice(k),S=b.exec(_)[0];y.call(L,S),F=F.replace(S,"")}}return function(v){var D=v.afternoon;if(D!==void 0){var E=v.hours;D?E<12&&(v.hours+=12):E===12&&(v.hours=0),delete v.afternoon}}(L),L}}return function(m,p,R){R.p.customParseFormat=!0,m&&m.parseTwoDigitYear&&(o=m.parseTwoDigitYear);var g=p.prototype,w=g.parse;g.parse=function(O){var A=O.date,x=O.utc,V=O.args;this.$u=x;var P=V[1];if(typeof P=="string"){var F=V[2]===!0,L=V[3]===!0,j=F||L,k=V[2];L&&(k=V[2]),s=this.$locale(),!F&&k&&(s=R.Ls[k]),this.$d=function(_,S,v,D){try{if(["x","X"].indexOf(S)>-1)return new Date((S==="X"?1e3:1)*_);var E=d(S)(_),M=E.year,$=E.month,G=E.day,ne=E.hours,_e=E.minutes,ve=E.seconds,Me=E.milliseconds,me=E.zone,W=E.week,le=new Date,ye=G||(M||$?1:le.getDate()),Te=M||le.getFullYear(),$t=0;M&&!$||($t=$>0?$-1:le.getMonth());var Pt,Sr=ne||0,Dr=_e||0,br=ve||0,Rr=Me||0;return me?new Date(Date.UTC(Te,$t,ye,Sr,Dr,br,Rr+60*me.offset*1e3)):v?new Date(Date.UTC(Te,$t,ye,Sr,Dr,br,Rr)):(Pt=new Date(Te,$t,ye,Sr,Dr,br,Rr),W&&(Pt=D(Pt).week(W).toDate()),Pt)}catch{return new Date("")}}(A,P,x,R),this.init(),k&&k!==!0&&(this.$L=this.locale(k).$L),j&&A!=this.format(P)&&(this.$d=new Date("")),s={}}else if(P instanceof Array)for(var T=P.length,b=1;b<=T;b+=1){V[1]=P[b-1];var y=R.apply(this,V);if(y.isValid()){this.$d=y.$d,this.$L=y.$L,this.init();break}b===T&&(this.$d=new Date(""))}else w.call(this,O)}}})});var oa=I((Zf,kr)=>{var Wo=Object.prototype.hasOwnProperty;function ia(t){return"[Throws: "+(t?t.message:"?")+"]"}function Qo(t,e){if(Wo.call(t,e))try{return t[e]}catch(r){return ia(r)}return t[e]}function sa(t){var e=[];function r(n){if(n===null||typeof n!="object")return n;if(e.indexOf(n)!==-1)return"[Circular]";if(e.push(n),typeof n.toJSON=="function")try{var a=r(n.toJSON());return e.pop(),a}catch(o){return ia(o)}if(Array.isArray(n)){var i=n.map(r);return e.pop(),i}var s=Object.keys(n).reduce(function(o,l){return o[l]=r(Qo(n,l)),o},{});return e.pop(),s}return r(t)}kr.exports=function(t,e,r){return JSON.stringify(sa(t),e,r)};kr.exports.ensureProperties=sa});var ua=I((ed,la)=>{var re=require("fs"),pt=require("path");la.exports=qt;qt.ncp=qt;function qt(t,e,r,n){var a=n;n||(a=r,r={});var i=process.cwd(),s=pt.resolve(i,t),o=pt.resolve(i,e),l=r.filter,u=r.rename,c=r.transform,h=r.clobber!==!1,f=r.modified,d=r.dereference,m=null,p=0,R=0,g=0,w=r.limit||qt.limit||16;w=w<1?1:w>512?512:w,O(s);function O(v){if(p++,l){if(l instanceof RegExp){if(!l.test(v))return S(!0)}else if(typeof l=="function"&&!l(v))return S(!0)}return A(v)}function A(v){var D=d?re.stat:re.lstat;if(g>=w)return setImmediate(function(){A(v)});g++,D(v,function(E,M){var $={};if(E)return _(E);if($.name=v,$.mode=M.mode,$.mtime=M.mtime,$.atime=M.atime,M.isDirectory())return F($);if(M.isFile())return x($);if(M.isSymbolicLink())return k(v)})}function x(v){var D=v.name.replace(s,o);u&&(D=u(D)),y(D,function(E){if(E)return V(v,D);if(h&&P(D,function(){V(v,D)}),f){var M=d?re.stat:re.lstat;M(D,function($,G){if(v.mtime.getTime()>G.mtime.getTime())V(v,D);else return S()})}else return S()})}function V(v,D){var E=re.createReadStream(v.name),M=re.createWriteStream(D,{mode:v.mode});E.on("error",_),M.on("error",_),c?c(E,M,v):M.on("open",function(){E.pipe(M)}),M.once("finish",function(){f&&re.utimesSync(D,v.atime,v.mtime),S()})}function P(v,D){re.unlink(v,function(E){return E?_(E):D()})}function F(v){var D=v.name.replace(s,o);y(D,function(E){if(E)return L(v,D);j(v.name)})}function L(v,D){re.mkdir(D,v.mode,function(E){if(E)return _(E);j(v.name)})}function j(v){re.readdir(v,function(D,E){return D?_(D):(E.forEach(function(M){O(pt.join(v,M))}),S())})}function k(v){var D=v.replace(s,o);re.readlink(v,function(E,M){if(E)return _(E);T(M,D)})}function T(v,D){d&&(v=pt.resolve(i,v)),y(D,function(E){if(E)return b(v,D);re.readlink(D,function(M,$){return M?_(M):(d&&($=pt.resolve(i,$)),$===v?S():P(D,function(){b(v,D)}))})})}function b(v,D){re.symlink(v,D,function(E){return E?_(E):S()})}function y(v,D){re.lstat(v,function(E){return E&&E.code==="ENOENT"?D(!0):D(!1)})}function _(v){return r.stopOnError?a(v):(!m&&r.errs?m=re.createWriteStream(r.errs):m||(m=[]),typeof m.write>"u"?m.push(v):m.write(v.stack+`

`),S())}function S(v){if(v||g--,R++,p===R&&g===0&&a!==void 0)return a(m||null)}}});var fa=I((td,ca)=>{ca.exports=function(t,e){for(var r=[],n=0;n<t.length;n++){var a=e(t[n],n);Jo(a)?r.push.apply(r,a):r.push(a)}return r};var Jo=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"}});var ga=I((rd,pa)=>{"use strict";pa.exports=ma;function ma(t,e,r){t instanceof RegExp&&(t=da(t,r)),e instanceof RegExp&&(e=da(e,r));var n=ha(t,e,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+t.length,n[1]),post:r.slice(n[1]+e.length)}}function da(t,e){var r=e.match(t);return r?r[0]:null}ma.range=ha;function ha(t,e,r){var n,a,i,s,o,l=r.indexOf(t),u=r.indexOf(e,l+1),c=l;if(l>=0&&u>0){if(t===e)return[l,u];for(n=[],i=r.length;c>=0&&!o;)c==l?(n.push(c),l=r.indexOf(t,c+1)):n.length==1?o=[n.pop(),u]:(a=n.pop(),a<i&&(i=a,s=u),u=r.indexOf(e,c+1)),c=l<u&&l>=0?l:u;n.length&&(o=[i,s])}return o}});var Ea=I((nd,wa)=>{var Ko=fa(),va=ga();wa.exports=tl;var ya="\0SLASH"+Math.random()+"\0",Sa="\0OPEN"+Math.random()+"\0",xr="\0CLOSE"+Math.random()+"\0",Da="\0COMMA"+Math.random()+"\0",ba="\0PERIOD"+Math.random()+"\0";function Or(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function Zo(t){return t.split("\\\\").join(ya).split("\\{").join(Sa).split("\\}").join(xr).split("\\,").join(Da).split("\\.").join(ba)}function el(t){return t.split(ya).join("\\").split(Sa).join("{").split(xr).join("}").split(Da).join(",").split(ba).join(".")}function Ra(t){if(!t)return[""];var e=[],r=va("{","}",t);if(!r)return t.split(",");var n=r.pre,a=r.body,i=r.post,s=n.split(",");s[s.length-1]+="{"+a+"}";var o=Ra(i);return i.length&&(s[s.length-1]+=o.shift(),s.push.apply(s,o)),e.push.apply(e,s),e}function tl(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),Je(Zo(t),!0).map(el)):[]}function rl(t){return"{"+t+"}"}function nl(t){return/^-?0\d/.test(t)}function al(t,e){return t<=e}function il(t,e){return t>=e}function Je(t,e){var r=[],n=va("{","}",t);if(!n||/\$$/.test(n.pre))return[t];var a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),i=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),s=a||i,o=n.body.indexOf(",")>=0;if(!s&&!o)return n.post.match(/,.*\}/)?(t=n.pre+"{"+n.body+xr+n.post,Je(t)):[t];var l;if(s)l=n.body.split(/\.\./);else if(l=Ra(n.body),l.length===1&&(l=Je(l[0],!1).map(rl),l.length===1)){var c=n.post.length?Je(n.post,!1):[""];return c.map(function(k){return n.pre+l[0]+k})}var u=n.pre,c=n.post.length?Je(n.post,!1):[""],h;if(s){var f=Or(l[0]),d=Or(l[1]),m=Math.max(l[0].length,l[1].length),p=l.length==3?Math.abs(Or(l[2])):1,R=al,g=d<f;g&&(p*=-1,R=il);var w=l.some(nl);h=[];for(var O=f;R(O,d);O+=p){var A;if(i)A=String.fromCharCode(O),A==="\\"&&(A="");else if(A=String(O),w){var x=m-A.length;if(x>0){var V=new Array(x+1).join("0");O<0?A="-"+V+A.slice(1):A=V+A}}h.push(A)}}else h=Ko(l,function(j){return Je(j,!1)});for(var P=0;P<h.length;P++)for(var F=0;F<c.length;F++){var L=u+h[P]+c[F];(!e||s||L)&&r.push(L)}return r}});var Ht=I((ad,La)=>{La.exports=ae;ae.Minimatch=Q;var gt=function(){try{return require("path")}catch{}}()||{sep:"/"};ae.sep=gt.sep;var Ir=ae.GLOBSTAR=Q.GLOBSTAR={},sl=Ea(),_a={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},Mr="[^/]",Fr=Mr+"*?",ol="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ll="(?:(?!(?:\\/|^)\\.).)*?",Ta=ul("().*{}+?[]^$\\!");function ul(t){return t.split("").reduce(function(e,r){return e[r]=!0,e},{})}var Aa=/\/+/;ae.filter=cl;function cl(t,e){return e=e||{},function(r,n,a){return ae(r,t,e)}}function Ae(t,e){e=e||{};var r={};return Object.keys(t).forEach(function(n){r[n]=t[n]}),Object.keys(e).forEach(function(n){r[n]=e[n]}),r}ae.defaults=function(t){if(!t||typeof t!="object"||!Object.keys(t).length)return ae;var e=ae,r=function(a,i,s){return e(a,i,Ae(t,s))};return r.Minimatch=function(a,i){return new e.Minimatch(a,Ae(t,i))},r.Minimatch.defaults=function(a){return e.defaults(Ae(t,a)).Minimatch},r.filter=function(a,i){return e.filter(a,Ae(t,i))},r.defaults=function(a){return e.defaults(Ae(t,a))},r.makeRe=function(a,i){return e.makeRe(a,Ae(t,i))},r.braceExpand=function(a,i){return e.braceExpand(a,Ae(t,i))},r.match=function(n,a,i){return e.match(n,a,Ae(t,i))},r};Q.defaults=function(t){return ae.defaults(t).Minimatch};function ae(t,e,r){return Bt(e),r||(r={}),!r.nocomment&&e.charAt(0)==="#"?!1:new Q(e,r).match(t)}function Q(t,e){if(!(this instanceof Q))return new Q(t,e);Bt(t),e||(e={}),t=t.trim(),!e.allowWindowsEscape&&gt.sep!=="/"&&(t=t.split(gt.sep).join("/")),this.options=e,this.set=[],this.pattern=t,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.make()}Q.prototype.debug=function(){};Q.prototype.make=fl;function fl(){var t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate();var r=this.globSet=this.braceExpand();e.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,r),r=this.globParts=r.map(function(n){return n.split(Aa)}),this.debug(this.pattern,r),r=r.map(function(n,a,i){return n.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(n){return n.indexOf(!1)===-1}),this.debug(this.pattern,r),this.set=r}Q.prototype.parseNegate=dl;function dl(){var t=this.pattern,e=!1,r=this.options,n=0;if(!r.nonegate){for(var a=0,i=t.length;a<i&&t.charAt(a)==="!";a++)e=!e,n++;n&&(this.pattern=t.substr(n)),this.negate=e}}ae.braceExpand=function(t,e){return Ca(t,e)};Q.prototype.braceExpand=Ca;function Ca(t,e){return e||(this instanceof Q?e=this.options:e={}),t=typeof t>"u"?this.pattern:t,Bt(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:sl(t)}var ml=1024*64,Bt=function(t){if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>ml)throw new TypeError("pattern is too long")};Q.prototype.parse=hl;var jt={};function hl(t,e){Bt(t);var r=this.options;if(t==="**")if(r.noglobstar)t="*";else return Ir;if(t==="")return"";var n="",a=!!r.nocase,i=!1,s=[],o=[],l,u=!1,c=-1,h=-1,f=t.charAt(0)==="."?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",d=this;function m(){if(l){switch(l){case"*":n+=Fr,a=!0;break;case"?":n+=Mr,a=!0;break;default:n+="\\"+l;break}d.debug("clearStateChar %j %j",l,n),l=!1}}for(var p=0,R=t.length,g;p<R&&(g=t.charAt(p));p++){if(this.debug("%s	%s %s %j",t,p,n,g),i&&Ta[g]){n+="\\"+g,i=!1;continue}switch(g){case"/":return!1;case"\\":m(),i=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s	%s %s %j <-- stateChar",t,p,n,g),u){this.debug("  in class"),g==="!"&&p===h+1&&(g="^"),n+=g;continue}d.debug("call clearStateChar %j",l),m(),l=g,r.noext&&m();continue;case"(":if(u){n+="(";continue}if(!l){n+="\\(";continue}s.push({type:l,start:p-1,reStart:n.length,open:_a[l].open,close:_a[l].close}),n+=l==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",l,n),l=!1;continue;case")":if(u||!s.length){n+="\\)";continue}m(),a=!0;var w=s.pop();n+=w.close,w.type==="!"&&o.push(w),w.reEnd=n.length;continue;case"|":if(u||!s.length||i){n+="\\|",i=!1;continue}m(),n+="|";continue;case"[":if(m(),u){n+="\\"+g;continue}u=!0,h=p,c=n.length,n+=g;continue;case"]":if(p===h+1||!u){n+="\\"+g,i=!1;continue}var O=t.substring(h+1,p);try{RegExp("["+O+"]")}catch{var A=this.parse(O,jt);n=n.substr(0,c)+"\\["+A[0]+"\\]",a=a||A[1],u=!1;continue}a=!0,u=!1,n+=g;continue;default:m(),i?i=!1:Ta[g]&&!(g==="^"&&u)&&(n+="\\"),n+=g}}for(u&&(O=t.substr(h+1),A=this.parse(O,jt),n=n.substr(0,c)+"\\["+A[0],a=a||A[1]),w=s.pop();w;w=s.pop()){var x=n.slice(w.reStart+w.open.length);this.debug("setting tail",n,w),x=x.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(M,$,G){return G||(G="\\"),$+$+G+"|"}),this.debug(`tail=%j
   %s`,x,x,w,n);var V=w.type==="*"?Fr:w.type==="?"?Mr:"\\"+w.type;a=!0,n=n.slice(0,w.reStart)+V+"\\("+x}m(),i&&(n+="\\\\");var P=!1;switch(n.charAt(0)){case"[":case".":case"(":P=!0}for(var F=o.length-1;F>-1;F--){var L=o[F],j=n.slice(0,L.reStart),k=n.slice(L.reStart,L.reEnd-8),T=n.slice(L.reEnd-8,L.reEnd),b=n.slice(L.reEnd);T+=b;var y=j.split("(").length-1,_=b;for(p=0;p<y;p++)_=_.replace(/\)[+*?]?/,"");b=_;var S="";b===""&&e!==jt&&(S="$");var v=j+k+b+S+T;n=v}if(n!==""&&a&&(n="(?=.)"+n),P&&(n=f+n),e===jt)return[n,a];if(!a)return gl(t);var D=r.nocase?"i":"";try{var E=new RegExp("^"+n+"$",D)}catch{return new RegExp("$.")}return E._glob=t,E._src=n,E}ae.makeRe=function(t,e){return new Q(t,e||{}).makeRe()};Q.prototype.makeRe=pl;function pl(){if(this.regexp||this.regexp===!1)return this.regexp;var t=this.set;if(!t.length)return this.regexp=!1,this.regexp;var e=this.options,r=e.noglobstar?Fr:e.dot?ol:ll,n=e.nocase?"i":"",a=t.map(function(i){return i.map(function(s){return s===Ir?r:typeof s=="string"?vl(s):s._src}).join("\\/")}).join("|");a="^(?:"+a+")$",this.negate&&(a="^(?!"+a+").*$");try{this.regexp=new RegExp(a,n)}catch{this.regexp=!1}return this.regexp}ae.match=function(t,e,r){r=r||{};var n=new Q(e,r);return t=t.filter(function(a){return n.match(a)}),n.options.nonull&&!t.length&&t.push(e),t};Q.prototype.match=function(e,r){if(typeof r>"u"&&(r=this.partial),this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;var n=this.options;gt.sep!=="/"&&(e=e.split(gt.sep).join("/")),e=e.split(Aa),this.debug(this.pattern,"split",e);var a=this.set;this.debug(this.pattern,"set",a);var i,s;for(s=e.length-1;s>=0&&(i=e[s],!i);s--);for(s=0;s<a.length;s++){var o=a[s],l=e;n.matchBase&&o.length===1&&(l=[i]);var u=this.matchOne(l,o,r);if(u)return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate};Q.prototype.matchOne=function(t,e,r){var n=this.options;this.debug("matchOne",{this:this,file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var a=0,i=0,s=t.length,o=e.length;a<s&&i<o;a++,i++){this.debug("matchOne loop");var l=e[i],u=t[a];if(this.debug(e,l,u),l===!1)return!1;if(l===Ir){this.debug("GLOBSTAR",[e,l,u]);var c=a,h=i+1;if(h===o){for(this.debug("** at the end");a<s;a++)if(t[a]==="."||t[a]===".."||!n.dot&&t[a].charAt(0)===".")return!1;return!0}for(;c<s;){var f=t[c];if(this.debug(`
globstar while`,t,c,e,h,f),this.matchOne(t.slice(c),e.slice(h),r))return this.debug("globstar found match!",c,s,f),!0;if(f==="."||f===".."||!n.dot&&f.charAt(0)==="."){this.debug("dot detected!",t,c,e,h);break}this.debug("globstar swallow a segment, and continue"),c++}return!!(r&&(this.debug(`
>>> no match, partial?`,t,c,e,h),c===s))}var d;if(typeof l=="string"?(d=u===l,this.debug("string match",l,u,d)):(d=u.match(l),this.debug("pattern match",l,u,d)),!d)return!1}if(a===s&&i===o)return!0;if(a===s)return r;if(i===o)return a===s-1&&t[a]==="";throw new Error("wtf?")};function gl(t){return t.replace(/\\(.)/g,"$1")}function vl(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var ka=I((id,Nr)=>{typeof Object.create=="function"?Nr.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Nr.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var Oa=I((sd,Pr)=>{try{if($r=require("util"),typeof $r.inherits!="function")throw"";Pr.exports=$r.inherits}catch{Pr.exports=ka()}var $r});var zt=I((od,Gt)=>{"use strict";function xa(t){return t.charAt(0)==="/"}function Ma(t){var e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,r=e.exec(t),n=r[1]||"",a=!!(n&&n.charAt(1)!==":");return!!(r[2]||a)}Gt.exports=process.platform==="win32"?Ma:xa;Gt.exports.posix=xa;Gt.exports.win32=Ma});var Yr=I(pe=>{pe.alphasort=Na;pe.alphasorti=Ia;pe.setopts=Rl;pe.ownProp=Fa;pe.makeAbs=Ur;pe.finish=wl;pe.mark=El;pe.isIgnored=$a;pe.childrenIgnored=_l;function Fa(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Ke=require("path"),yl=Ht(),Sl=zt(),Vr=yl.Minimatch;function Ia(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())}function Na(t,e){return t.localeCompare(e)}function Dl(t,e){t.ignore=e.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]),t.ignore.length&&(t.ignore=t.ignore.map(bl))}function bl(t){var e=null;if(t.slice(-3)==="/**"){var r=t.replace(/(\/\*\*)+$/,"");e=new Vr(r,{dot:!0})}return{matcher:new Vr(t,{dot:!0}),gmatcher:e}}function Rl(t,e,r){if(r||(r={}),r.matchBase&&e.indexOf("/")===-1){if(r.noglobstar)throw new Error("base matching requires globstar");e="**/"+e}t.silent=!!r.silent,t.pattern=e,t.strict=r.strict!==!1,t.realpath=!!r.realpath,t.realpathCache=r.realpathCache||Object.create(null),t.follow=!!r.follow,t.dot=!!r.dot,t.mark=!!r.mark,t.nodir=!!r.nodir,t.nodir&&(t.mark=!0),t.sync=!!r.sync,t.nounique=!!r.nounique,t.nonull=!!r.nonull,t.nosort=!!r.nosort,t.nocase=!!r.nocase,t.stat=!!r.stat,t.noprocess=!!r.noprocess,t.maxLength=r.maxLength||1/0,t.cache=r.cache||Object.create(null),t.statCache=r.statCache||Object.create(null),t.symlinks=r.symlinks||Object.create(null),Dl(t,r),t.changedCwd=!1;var n=process.cwd();Fa(r,"cwd")?(t.cwd=r.cwd,t.changedCwd=Ke.resolve(r.cwd)!==n):t.cwd=n,t.root=r.root||Ke.resolve(t.cwd,"/"),t.root=Ke.resolve(t.root),process.platform==="win32"&&(t.root=t.root.replace(/\\/g,"/")),t.nomount=!!r.nomount,r.nonegate=!0,r.nocomment=!0,t.minimatch=new Vr(e,r),t.options=t.minimatch.options}function wl(t){for(var e=t.nounique,r=e?[]:Object.create(null),n=0,a=t.matches.length;n<a;n++){var i=t.matches[n];if(!i||Object.keys(i).length===0){if(t.nonull){var s=t.minimatch.globSet[n];e?r.push(s):r[s]=!0}}else{var o=Object.keys(i);e?r.push.apply(r,o):o.forEach(function(l){r[l]=!0})}}if(e||(r=Object.keys(r)),t.nosort||(r=r.sort(t.nocase?Ia:Na)),t.mark){for(var n=0;n<r.length;n++)r[n]=t._mark(r[n]);t.nodir&&(r=r.filter(function(l){return!/\/$/.test(l)}))}t.ignore.length&&(r=r.filter(function(l){return!$a(t,l)})),t.found=r}function El(t,e){var r=Ur(t,e),n=t.cache[r],a=e;if(n){var i=n==="DIR"||Array.isArray(n),s=e.slice(-1)==="/";if(i&&!s?a+="/":!i&&s&&(a=a.slice(0,-1)),a!==e){var o=Ur(t,a);t.statCache[o]=t.statCache[r],t.cache[o]=t.cache[r]}}return a}function Ur(t,e){var r=e;return e.charAt(0)==="/"?r=Ke.join(t.root,e):Sl(e)||e===""?r=e:t.changedCwd?r=Ke.resolve(t.cwd,e):r=Ke.resolve(e),r}function $a(t,e){return t.ignore.length?t.ignore.some(function(r){return r.matcher.match(e)||!!(r.gmatcher&&r.gmatcher.match(e))}):!1}function _l(t,e){return t.ignore.length?t.ignore.some(function(r){return!!(r.gmatcher&&r.gmatcher.match(e))}):!1}});var qa=I((hd,Ya)=>{Ya.exports=Ua;Ua.GlobSync=X;var vt=require("fs"),Pa=Ht(),ud=Pa.Minimatch,cd=Br().Glob,fd=require("util"),qr=require("path"),Va=require("assert"),Xt=zt(),Ce=Yr(),dd=Ce.alphasort,md=Ce.alphasorti,Tl=Ce.setopts,jr=Ce.ownProp,Al=Ce.childrenIgnored;function Ua(t,e){if(typeof e=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);return new X(t,e).found}function X(t,e){if(!t)throw new Error("must provide pattern");if(typeof e=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof X))return new X(t,e);if(Tl(this,t,e),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var n=0;n<r;n++)this._process(this.minimatch.set[n],n,!1);this._finish()}X.prototype._finish=function(){if(Va(this instanceof X),this.realpath){var t=this;this.matches.forEach(function(e,r){var n=t.matches[r]=Object.create(null);for(var a in e)try{a=t._makeAbs(a);var i=vt.realpathSync(a,t.realpathCache);n[i]=!0}catch(s){if(s.syscall==="stat")n[t._makeAbs(a)]=!0;else throw s}})}Ce.finish(this)};X.prototype._process=function(t,e,r){Va(this instanceof X);for(var n=0;typeof t[n]=="string";)n++;var a;switch(n){case t.length:this._processSimple(t.join("/"),e);return;case 0:a=null;break;default:a=t.slice(0,n).join("/");break}var i=t.slice(n),s;a===null?s=".":((Xt(a)||Xt(t.join("/")))&&(!a||!Xt(a))&&(a="/"+a),s=a);var o=this._makeAbs(s);if(!Al(this,s)){var l=i[0]===Pa.GLOBSTAR;l?this._processGlobStar(a,s,o,i,e,r):this._processReaddir(a,s,o,i,e,r)}};X.prototype._processReaddir=function(t,e,r,n,a,i){var s=this._readdir(r,i);if(s){for(var o=n[0],l=!!this.minimatch.negate,u=o._glob,c=this.dot||u.charAt(0)===".",h=[],f=0;f<s.length;f++){var d=s[f];if(d.charAt(0)!=="."||c){var m;l&&!t?m=!d.match(o):m=d.match(o),m&&h.push(d)}}var p=h.length;if(p!==0){if(n.length===1&&!this.mark&&!this.stat){this.matches[a]||(this.matches[a]=Object.create(null));for(var f=0;f<p;f++){var d=h[f];t&&(t.slice(-1)!=="/"?d=t+"/"+d:d=t+d),d.charAt(0)==="/"&&!this.nomount&&(d=qr.join(this.root,d)),this.matches[a][d]=!0}return}n.shift();for(var f=0;f<p;f++){var d=h[f],R;t?R=[t,d]:R=[d],this._process(R.concat(n),a,i)}}}};X.prototype._emitMatch=function(t,e){var r=this._makeAbs(e);if(this.mark&&(e=this._mark(e)),!this.matches[t][e]){if(this.nodir){var n=this.cache[this._makeAbs(e)];if(n==="DIR"||Array.isArray(n))return}this.matches[t][e]=!0,this.stat&&this._stat(e)}};X.prototype._readdirInGlobStar=function(t){if(this.follow)return this._readdir(t,!1);var e,r,n;try{r=vt.lstatSync(t)}catch{return null}var a=r.isSymbolicLink();return this.symlinks[t]=a,!a&&!r.isDirectory()?this.cache[t]="FILE":e=this._readdir(t,!1),e};X.prototype._readdir=function(t,e){var r;if(e&&!jr(this.symlinks,t))return this._readdirInGlobStar(t);if(jr(this.cache,t)){var n=this.cache[t];if(!n||n==="FILE")return null;if(Array.isArray(n))return n}try{return this._readdirEntries(t,vt.readdirSync(t))}catch(a){return this._readdirError(t,a),null}};X.prototype._readdirEntries=function(t,e){if(!this.mark&&!this.stat)for(var r=0;r<e.length;r++){var n=e[r];t==="/"?n=t+n:n=t+"/"+n,this.cache[n]=!0}return this.cache[t]=e,e};X.prototype._readdirError=function(t,e){switch(e.code){case"ENOTSUP":case"ENOTDIR":this.cache[this._makeAbs(t)]="FILE";break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:if(this.cache[this._makeAbs(t)]=!1,this.strict)throw e;this.silent||console.error("glob error",e);break}};X.prototype._processGlobStar=function(t,e,r,n,a,i){var s=this._readdir(r,i);if(s){var o=n.slice(1),l=t?[t]:[],u=l.concat(o);this._process(u,a,!1);var c=s.length,h=this.symlinks[r];if(!(h&&i))for(var f=0;f<c;f++){var d=s[f];if(!(d.charAt(0)==="."&&!this.dot)){var m=l.concat(s[f],o);this._process(m,a,!0);var p=l.concat(s[f],n);this._process(p,a,!0)}}}};X.prototype._processSimple=function(t,e){var r=this._stat(t);if(this.matches[e]||(this.matches[e]=Object.create(null)),!!r){if(t&&Xt(t)&&!this.nomount){var n=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=qr.join(this.root,t):(t=qr.resolve(this.root,t),n&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this.matches[e][t]=!0}};X.prototype._stat=function(t){var e=this._makeAbs(t),r=t.slice(-1)==="/";if(t.length>this.maxLength)return!1;if(!this.stat&&jr(this.cache,e)){var s=this.cache[e];if(Array.isArray(s)&&(s="DIR"),!r||s==="DIR")return s;if(r&&s==="FILE")return!1}var n,a=this.statCache[e];if(!a){var i;try{i=vt.lstatSync(e)}catch{return!1}if(i.isSymbolicLink())try{a=vt.statSync(e)}catch{a=i}else a=i}this.statCache[e]=a;var s=a.isDirectory()?"DIR":"FILE";return this.cache[e]=this.cache[e]||s,r&&s!=="DIR"?!1:s};X.prototype._mark=function(t){return Ce.mark(this,t)};X.prototype._makeAbs=function(t){return Ce.makeAbs(this,t)}});var Hr=I((pd,Ba)=>{Ba.exports=ja;function ja(t,e){if(t&&e)return ja(t)(e);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(n){r[n]=t[n]}),r;function r(){for(var n=new Array(arguments.length),a=0;a<n.length;a++)n[a]=arguments[a];var i=t.apply(this,n),s=n[n.length-1];return typeof i=="function"&&i!==s&&Object.keys(s).forEach(function(o){i[o]=s[o]}),i}}});var zr=I((gd,Gr)=>{var Ha=Hr();Gr.exports=Ha(Wt);Gr.exports.strict=Ha(Ga);Wt.proto=Wt(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Wt(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Ga(this)},configurable:!0})});function Wt(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function Ga(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}});var Xa=I((vd,za)=>{var Cl=Hr(),yt=Object.create(null),Ll=zr();za.exports=Cl(kl);function kl(t,e){return yt[t]?(yt[t].push(e),null):(yt[t]=[e],Ol(t))}function Ol(t){return Ll(function e(){var r=yt[t],n=r.length,a=xl(arguments);try{for(var i=0;i<n;i++)r[i].apply(null,a)}finally{r.length>n?(r.splice(0,n),process.nextTick(function(){e.apply(null,a)})):delete yt[t]}})}function xl(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n]=t[n];return r}});var Br=I((Rd,Qa)=>{Qa.exports=Ie;var St=require("fs"),Wa=Ht(),yd=Wa.Minimatch,Ml=Oa(),Fl=require("events").EventEmitter,Xr=require("path"),Wr=require("assert"),Qt=zt(),Jr=qa(),Se=Yr(),Sd=Se.alphasort,Dd=Se.alphasorti,Il=Se.setopts,Qr=Se.ownProp,Kr=Xa(),bd=require("util"),Nl=Se.childrenIgnored,$l=Se.isIgnored,Pl=zr();function Ie(t,e,r){if(typeof e=="function"&&(r=e,e={}),e||(e={}),e.sync){if(r)throw new TypeError("callback provided to sync glob");return Jr(t,e)}return new q(t,e,r)}Ie.sync=Jr;var Vl=Ie.GlobSync=Jr.GlobSync;Ie.glob=Ie;function Ul(t,e){if(e===null||typeof e!="object")return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}Ie.hasMagic=function(t,e){var r=Ul({},e);r.noprocess=!0;var n=new q(t,r),a=n.minimatch.set;if(a.length>1)return!0;for(var i=0;i<a[0].length;i++)if(typeof a[0][i]!="string")return!0;return!1};Ie.Glob=q;Ml(q,Fl);function q(t,e,r){if(typeof e=="function"&&(r=e,e=null),e&&e.sync){if(r)throw new TypeError("callback provided to sync glob");return new Vl(t,e)}if(!(this instanceof q))return new q(t,e,r);Il(this,t,e),this._didRealPath=!1;var a=this.minimatch.set.length;this.matches=new Array(a),typeof r=="function"&&(r=Pl(r),this.on("error",r),this.on("end",function(o){r(null,o)}));var n=this,a=this.minimatch.set.length;if(this._processing=0,this.matches=new Array(a),this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(a===0)return s();for(var i=0;i<a;i++)this._process(this.minimatch.set[i],i,!1,s);function s(){--n._processing,n._processing<=0&&n._finish()}}q.prototype._finish=function(){if(Wr(this instanceof q),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();Se.finish(this),this.emit("end",this.found)}};q.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var t=this.matches.length;if(t===0)return this._finish();for(var e=this,r=0;r<this.matches.length;r++)this._realpathSet(r,n);function n(){--t===0&&e._finish()}};q.prototype._realpathSet=function(t,e){var r=this.matches[t];if(!r)return e();var n=Object.keys(r),a=this,i=n.length;if(i===0)return e();var s=this.matches[t]=Object.create(null);n.forEach(function(o,l){o=a._makeAbs(o),St.realpath(o,a.realpathCache,function(u,c){u?u.syscall==="stat"?s[o]=!0:a.emit("error",u):s[c]=!0,--i===0&&(a.matches[t]=s,e())})})};q.prototype._mark=function(t){return Se.mark(this,t)};q.prototype._makeAbs=function(t){return Se.makeAbs(this,t)};q.prototype.abort=function(){this.aborted=!0,this.emit("abort")};q.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};q.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var t=this._emitQueue.slice(0);this._emitQueue.length=0;for(var e=0;e<t.length;e++){var r=t[e];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var n=this._processQueue.slice(0);this._processQueue.length=0;for(var e=0;e<n.length;e++){var a=n[e];this._processing--,this._process(a[0],a[1],a[2],a[3])}}}};q.prototype._process=function(t,e,r,n){if(Wr(this instanceof q),Wr(typeof n=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([t,e,r,n]);return}for(var a=0;typeof t[a]=="string";)a++;var i;switch(a){case t.length:this._processSimple(t.join("/"),e,n);return;case 0:i=null;break;default:i=t.slice(0,a).join("/");break}var s=t.slice(a),o;i===null?o=".":((Qt(i)||Qt(t.join("/")))&&(!i||!Qt(i))&&(i="/"+i),o=i);var l=this._makeAbs(o);if(Nl(this,o))return n();var u=s[0]===Wa.GLOBSTAR;u?this._processGlobStar(i,o,l,s,e,r,n):this._processReaddir(i,o,l,s,e,r,n)}};q.prototype._processReaddir=function(t,e,r,n,a,i,s){var o=this;this._readdir(r,i,function(l,u){return o._processReaddir2(t,e,r,n,a,i,u,s)})};q.prototype._processReaddir2=function(t,e,r,n,a,i,s,o){if(!s)return o();for(var l=n[0],u=!!this.minimatch.negate,c=l._glob,h=this.dot||c.charAt(0)===".",f=[],d=0;d<s.length;d++){var m=s[d];if(m.charAt(0)!=="."||h){var p;u&&!t?p=!m.match(l):p=m.match(l),p&&f.push(m)}}var R=f.length;if(R===0)return o();if(n.length===1&&!this.mark&&!this.stat){this.matches[a]||(this.matches[a]=Object.create(null));for(var d=0;d<R;d++){var m=f[d];t&&(t!=="/"?m=t+"/"+m:m=t+m),m.charAt(0)==="/"&&!this.nomount&&(m=Xr.join(this.root,m)),this._emitMatch(a,m)}return o()}n.shift();for(var d=0;d<R;d++){var m=f[d],g;t&&(t!=="/"?m=t+"/"+m:m=t+m),this._process([m].concat(n),a,i,o)}o()};q.prototype._emitMatch=function(t,e){if(!this.aborted&&!this.matches[t][e]&&!$l(this,e)){if(this.paused){this._emitQueue.push([t,e]);return}var r=this._makeAbs(e);if(this.nodir){var n=this.cache[r];if(n==="DIR"||Array.isArray(n))return}this.mark&&(e=this._mark(e)),this.matches[t][e]=!0;var a=this.statCache[r];a&&this.emit("stat",e,a),this.emit("match",e)}};q.prototype._readdirInGlobStar=function(t,e){if(this.aborted)return;if(this.follow)return this._readdir(t,!1,e);var r="lstat\0"+t,n=this,a=Kr(r,i);a&&St.lstat(t,a);function i(s,o){if(s)return e();var l=o.isSymbolicLink();n.symlinks[t]=l,!l&&!o.isDirectory()?(n.cache[t]="FILE",e()):n._readdir(t,!1,e)}};q.prototype._readdir=function(t,e,r){if(!this.aborted&&(r=Kr("readdir\0"+t+"\0"+e,r),!!r)){if(e&&!Qr(this.symlinks,t))return this._readdirInGlobStar(t,r);if(Qr(this.cache,t)){var n=this.cache[t];if(!n||n==="FILE")return r();if(Array.isArray(n))return r(null,n)}var a=this;St.readdir(t,Yl(this,t,r))}};function Yl(t,e,r){return function(n,a){n?t._readdirError(e,n,r):t._readdirEntries(e,a,r)}}q.prototype._readdirEntries=function(t,e,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var n=0;n<e.length;n++){var a=e[n];t==="/"?a=t+a:a=t+"/"+a,this.cache[a]=!0}return this.cache[t]=e,r(null,e)}};q.prototype._readdirError=function(t,e,r){if(!this.aborted){switch(e.code){case"ENOTSUP":case"ENOTDIR":this.cache[this._makeAbs(t)]="FILE";break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:this.cache[this._makeAbs(t)]=!1,this.strict&&(this.emit("error",e),this.abort()),this.silent||console.error("glob error",e);break}return r()}};q.prototype._processGlobStar=function(t,e,r,n,a,i,s){var o=this;this._readdir(r,i,function(l,u){o._processGlobStar2(t,e,r,n,a,i,u,s)})};q.prototype._processGlobStar2=function(t,e,r,n,a,i,s,o){if(!s)return o();var l=n.slice(1),u=t?[t]:[],c=u.concat(l);this._process(c,a,!1,o);var h=this.symlinks[r],f=s.length;if(h&&i)return o();for(var d=0;d<f;d++){var m=s[d];if(!(m.charAt(0)==="."&&!this.dot)){var p=u.concat(s[d],l);this._process(p,a,!0,o);var R=u.concat(s[d],n);this._process(R,a,!0,o)}}o()};q.prototype._processSimple=function(t,e,r){var n=this;this._stat(t,function(a,i){n._processSimple2(t,e,a,i,r)})};q.prototype._processSimple2=function(t,e,r,n,a){if(this.matches[e]||(this.matches[e]=Object.create(null)),!n)return a();if(t&&Qt(t)&&!this.nomount){var i=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=Xr.join(this.root,t):(t=Xr.resolve(this.root,t),i&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this._emitMatch(e,t),a()};q.prototype._stat=function(t,e){var r=this._makeAbs(t),n=t.slice(-1)==="/";if(t.length>this.maxLength)return e();if(!this.stat&&Qr(this.cache,r)){var a=this.cache[r];if(Array.isArray(a)&&(a="DIR"),!n||a==="DIR")return e(null,a);if(n&&a==="FILE")return e()}var i,s=this.statCache[r];if(s!==void 0){if(s===!1)return e(null,s);var o=s.isDirectory()?"DIR":"FILE";return n&&o==="FILE"?e():e(null,o,s)}var l=this,u=Kr("stat\0"+r,c);u&&St.lstat(r,u);function c(h,f){if(f&&f.isSymbolicLink())return St.stat(r,function(d,m){d?l._stat2(t,r,null,f,e):l._stat2(t,r,d,m,e)});l._stat2(t,r,h,f,e)}};q.prototype._stat2=function(t,e,r,n,a){if(r)return this.statCache[e]=!1,a();var i=t.slice(-1)==="/";if(this.statCache[e]=n,e.slice(-1)==="/"&&!n.isDirectory())return a(null,!1,n);var s=n.isDirectory()?"DIR":"FILE";return this.cache[e]=this.cache[e]||s,i&&s!=="DIR"?a():a(null,s,n)}});var ri=I((wd,ti)=>{ti.exports=rn;rn.sync=ei;var U=require("assert"),Ja=require("path"),Zt=require("fs"),er=Br(),Ka={nosort:!0,nocomment:!0,nonegate:!0,silent:!0},Zr=0,tn=process.platform==="win32";function Za(t){var e=["unlink","chmod","stat","lstat","rmdir","readdir"];e.forEach(function(r){t[r]=t[r]||Zt[r],r=r+"Sync",t[r]=t[r]||Zt[r]}),t.maxBusyTries=t.maxBusyTries||3,t.emfileWait=t.emfileWait||1e3,t.disableGlob=t.disableGlob||!1}function rn(t,e,r){typeof e=="function"&&(r=e,e={}),U(t,"rimraf: missing path"),U.equal(typeof t,"string","rimraf: path should be a string"),U(e,"rimraf: missing options"),U.equal(typeof e,"object","rimraf: options should be object"),U.equal(typeof r,"function","rimraf: callback function required"),Za(e);var n=0,a=null,i=0;if(e.disableGlob||!er.hasMagic(t))return o(null,[t]);Zt.lstat(t,function(l,u){if(!l)return o(null,[t]);er(t,Ka,o)});function s(l){a=a||l,--i===0&&r(a)}function o(l,u){if(l)return r(l);if(i=u.length,i===0)return r();u.forEach(function(c){en(c,e,function h(f){if(f){if(tn&&(f.code==="EBUSY"||f.code==="ENOTEMPTY"||f.code==="EPERM")&&n<e.maxBusyTries){n++;var d=n*100;return setTimeout(function(){en(c,e,h)},d)}if(f.code==="EMFILE"&&Zr<e.emfileWait)return setTimeout(function(){en(c,e,h)},Zr++);f.code==="ENOENT"&&(f=null)}Zr=0,s(f)})})}}function en(t,e,r){U(t),U(e),U(typeof r=="function"),e.lstat(t,function(n,a){if(n&&n.code==="ENOENT")return r(null);if(a&&a.isDirectory())return Jt(t,e,n,r);e.unlink(t,function(i){if(i){if(i.code==="ENOENT")return r(null);if(i.code==="EPERM")return tn?ql(t,e,i,r):Jt(t,e,i,r);if(i.code==="EISDIR")return Jt(t,e,i,r)}return r(i)})})}function ql(t,e,r,n){U(t),U(e),U(typeof n=="function"),r&&U(r instanceof Error),e.chmod(t,666,function(a){a?n(a.code==="ENOENT"?null:r):e.stat(t,function(i,s){i?n(i.code==="ENOENT"?null:r):s.isDirectory()?Jt(t,e,r,n):e.unlink(t,n)})})}function jl(t,e,r){U(t),U(e),r&&U(r instanceof Error);try{e.chmodSync(t,666)}catch(a){if(a.code==="ENOENT")return;throw r}try{var n=e.statSync(t)}catch(a){if(a.code==="ENOENT")return;throw r}n.isDirectory()?Kt(t,e,r):e.unlinkSync(t)}function Jt(t,e,r,n){U(t),U(e),r&&U(r instanceof Error),U(typeof n=="function"),e.rmdir(t,function(a){a&&(a.code==="ENOTEMPTY"||a.code==="EEXIST"||a.code==="EPERM")?Bl(t,e,n):a&&a.code==="ENOTDIR"?n(r):n(a)})}function Bl(t,e,r){U(t),U(e),U(typeof r=="function"),e.readdir(t,function(n,a){if(n)return r(n);var i=a.length;if(i===0)return e.rmdir(t,r);var s;a.forEach(function(o){rn(Ja.join(t,o),e,function(l){if(!s){if(l)return r(s=l);--i===0&&e.rmdir(t,r)}})})})}function ei(t,e){e=e||{},Za(e),U(t,"rimraf: missing path"),U.equal(typeof t,"string","rimraf: path should be a string"),U(e,"rimraf: missing options"),U.equal(typeof e,"object","rimraf: options should be object");var r;if(e.disableGlob||!er.hasMagic(t))r=[t];else try{Zt.lstatSync(t),r=[t]}catch{r=er.sync(t,Ka)}if(r.length)for(var n=0;n<r.length;n++){var t=r[n];try{var a=e.lstatSync(t)}catch(s){if(s.code==="ENOENT")return}try{a&&a.isDirectory()?Kt(t,e,null):e.unlinkSync(t)}catch(s){if(s.code==="ENOENT")return;if(s.code==="EPERM")return tn?jl(t,e,s):Kt(t,e,s);if(s.code!=="EISDIR")throw s;Kt(t,e,s)}}}function Kt(t,e,r){U(t),U(e),r&&U(r instanceof Error);try{e.rmdirSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="ENOTDIR")throw r;(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")&&Hl(t,e)}}function Hl(t,e){U(t),U(e),e.readdirSync(t).forEach(function(r){ei(Ja.join(t,r),e)}),e.rmdirSync(t,e)}});var si=I((Ed,ii)=>{var Dt=require("path"),ni=require("fs"),ai=parseInt("0777",8);ii.exports=Ze.mkdirp=Ze.mkdirP=Ze;function Ze(t,e,r,n){typeof e=="function"?(r=e,e={}):(!e||typeof e!="object")&&(e={mode:e});var a=e.mode,i=e.fs||ni;a===void 0&&(a=ai),n||(n=null);var s=r||function(){};t=Dt.resolve(t),i.mkdir(t,a,function(o){if(!o)return n=n||t,s(null,n);switch(o.code){case"ENOENT":if(Dt.dirname(t)===t)return s(o);Ze(Dt.dirname(t),e,function(l,u){l?s(l,u):Ze(t,e,s,u)});break;default:i.stat(t,function(l,u){l||!u.isDirectory()?s(o,n):s(null,n)});break}})}Ze.sync=function t(e,r,n){(!r||typeof r!="object")&&(r={mode:r});var a=r.mode,i=r.fs||ni;a===void 0&&(a=ai),n||(n=null),e=Dt.resolve(e);try{i.mkdirSync(e,a),n=n||e}catch(o){switch(o.code){case"ENOENT":n=t(Dt.dirname(e),r,n),t(e,r,n);break;default:var s;try{s=i.statSync(e)}catch{throw o}if(!s.isDirectory())throw o;break}}return n}});var fi=I((_d,ci)=>{var et=require("fs"),Gl=ua().ncp,zl=require("path"),oi=ri(),Xl=si();ci.exports=Wl;function Wl(t,e,r,n){typeof r=="function"&&(n=r,r={});var a=!!r.mkdirp,i=r.clobber!==!1,s=r.limit||16;a?o():l();function o(){Xl(zl.dirname(e),function(u){if(u)return n(u);l()})}function l(){i?et.rename(t,e,function(u){if(!u)return n();if(u.code!=="EXDEV")return n(u);li(t,e,i,s,n)}):et.link(t,e,function(u){if(u){if(u.code==="EXDEV"){li(t,e,i,s,n);return}if(u.code==="EISDIR"||u.code==="EPERM"){ui(t,e,i,s,n);return}n(u);return}et.unlink(t,n)})}}function li(t,e,r,n,a){var i=r?"w":"wx",s=et.createReadStream(t),o=et.createWriteStream(e,{flags:i});s.on("error",function(u){s.destroy(),o.destroy(),o.removeListener("close",l),u.code==="EISDIR"||u.code==="EPERM"?ui(t,e,r,n,a):a(u)}),o.on("error",function(u){s.destroy(),o.destroy(),o.removeListener("close",l),a(u)}),o.once("close",l),s.pipe(o);function l(){et.unlink(t,a)}}function ui(t,e,r,n,a){var i={stopOnErr:!0,clobber:!1,limit:n};r?oi(e,{disableGlob:!0},function(o){if(o)return a(o);s()}):s();function s(){Gl(t,e,i,function(o){if(o)return a(o[0]);oi(t,{disableGlob:!0},a)})}}});var mi=I(nn=>{var di="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");nn.encode=function(t){if(0<=t&&t<di.length)return di[t];throw new TypeError("Must be between 0 and 63: "+t)};nn.decode=function(t){var e=65,r=90,n=97,a=122,i=48,s=57,o=43,l=47,u=26,c=52;return e<=t&&t<=r?t-e:n<=t&&t<=a?t-n+u:i<=t&&t<=s?t-i+c:t==o?62:t==l?63:-1}});var on=I(sn=>{var hi=mi(),an=5,pi=1<<an,gi=pi-1,vi=pi;function Ql(t){return t<0?(-t<<1)+1:(t<<1)+0}function Jl(t){var e=(t&1)===1,r=t>>1;return e?-r:r}sn.encode=function(e){var r="",n,a=Ql(e);do n=a&gi,a>>>=an,a>0&&(n|=vi),r+=hi.encode(n);while(a>0);return r};sn.decode=function(e,r,n){var a=e.length,i=0,s=0,o,l;do{if(r>=a)throw new Error("Expected more digits in base 64 VLQ value.");if(l=hi.decode(e.charCodeAt(r++)),l===-1)throw new Error("Invalid base64 digit: "+e.charAt(r-1));o=!!(l&vi),l&=gi,i=i+(l<<s),s+=an}while(o);n.value=Jl(i),n.rest=r}});var nt=I(te=>{function Kl(t,e,r){if(e in t)return t[e];if(arguments.length===3)return r;throw new Error('"'+e+'" is a required argument.')}te.getArg=Kl;var yi=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,Zl=/^data:.+\,.+$/;function bt(t){var e=t.match(yi);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}te.urlParse=bt;function tt(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}te.urlGenerate=tt;function ln(t){var e=t,r=bt(t);if(r){if(!r.path)return t;e=r.path}for(var n=te.isAbsolute(e),a=e.split(/\/+/),i,s=0,o=a.length-1;o>=0;o--)i=a[o],i==="."?a.splice(o,1):i===".."?s++:s>0&&(i===""?(a.splice(o+1,s),s=0):(a.splice(o,2),s--));return e=a.join("/"),e===""&&(e=n?"/":"."),r?(r.path=e,tt(r)):e}te.normalize=ln;function Si(t,e){t===""&&(t="."),e===""&&(e=".");var r=bt(e),n=bt(t);if(n&&(t=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),tt(r);if(r||e.match(Zl))return e;if(n&&!n.host&&!n.path)return n.host=e,tt(n);var a=e.charAt(0)==="/"?e:ln(t.replace(/\/+$/,"")+"/"+e);return n?(n.path=a,tt(n)):a}te.join=Si;te.isAbsolute=function(t){return t.charAt(0)==="/"||yi.test(t)};function eu(t,e){t===""&&(t="."),t=t.replace(/\/$/,"");for(var r=0;e.indexOf(t+"/")!==0;){var n=t.lastIndexOf("/");if(n<0||(t=t.slice(0,n),t.match(/^([^\/]+:\/)?\/*$/)))return e;++r}return Array(r+1).join("../")+e.substr(t.length+1)}te.relative=eu;var Di=function(){var t=Object.create(null);return!("__proto__"in t)}();function bi(t){return t}function tu(t){return Ri(t)?"$"+t:t}te.toSetString=Di?bi:tu;function ru(t){return Ri(t)?t.slice(1):t}te.fromSetString=Di?bi:ru;function Ri(t){if(!t)return!1;var e=t.length;if(e<9||t.charCodeAt(e-1)!==95||t.charCodeAt(e-2)!==95||t.charCodeAt(e-3)!==111||t.charCodeAt(e-4)!==116||t.charCodeAt(e-5)!==111||t.charCodeAt(e-6)!==114||t.charCodeAt(e-7)!==112||t.charCodeAt(e-8)!==95||t.charCodeAt(e-9)!==95)return!1;for(var r=e-10;r>=0;r--)if(t.charCodeAt(r)!==36)return!1;return!0}function nu(t,e,r){var n=rt(t.source,e.source);return n!==0||(n=t.originalLine-e.originalLine,n!==0)||(n=t.originalColumn-e.originalColumn,n!==0||r)||(n=t.generatedColumn-e.generatedColumn,n!==0)||(n=t.generatedLine-e.generatedLine,n!==0)?n:rt(t.name,e.name)}te.compareByOriginalPositions=nu;function au(t,e,r){var n=t.generatedLine-e.generatedLine;return n!==0||(n=t.generatedColumn-e.generatedColumn,n!==0||r)||(n=rt(t.source,e.source),n!==0)||(n=t.originalLine-e.originalLine,n!==0)||(n=t.originalColumn-e.originalColumn,n!==0)?n:rt(t.name,e.name)}te.compareByGeneratedPositionsDeflated=au;function rt(t,e){return t===e?0:t===null?1:e===null?-1:t>e?1:-1}function iu(t,e){var r=t.generatedLine-e.generatedLine;return r!==0||(r=t.generatedColumn-e.generatedColumn,r!==0)||(r=rt(t.source,e.source),r!==0)||(r=t.originalLine-e.originalLine,r!==0)||(r=t.originalColumn-e.originalColumn,r!==0)?r:rt(t.name,e.name)}te.compareByGeneratedPositionsInflated=iu;function su(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))}te.parseSourceMapInput=su;function ou(t,e,r){if(e=e||"",t&&(t[t.length-1]!=="/"&&e[0]!=="/"&&(t+="/"),e=t+e),r){var n=bt(r);if(!n)throw new Error("sourceMapURL could not be parsed");if(n.path){var a=n.path.lastIndexOf("/");a>=0&&(n.path=n.path.substring(0,a+1))}e=Si(tt(n),e)}return ln(e)}te.computeSourceURL=ou});var fn=I(wi=>{var un=nt(),cn=Object.prototype.hasOwnProperty,Ne=typeof Map<"u";function De(){this._array=[],this._set=Ne?new Map:Object.create(null)}De.fromArray=function(e,r){for(var n=new De,a=0,i=e.length;a<i;a++)n.add(e[a],r);return n};De.prototype.size=function(){return Ne?this._set.size:Object.getOwnPropertyNames(this._set).length};De.prototype.add=function(e,r){var n=Ne?e:un.toSetString(e),a=Ne?this.has(e):cn.call(this._set,n),i=this._array.length;(!a||r)&&this._array.push(e),a||(Ne?this._set.set(e,i):this._set[n]=i)};De.prototype.has=function(e){if(Ne)return this._set.has(e);var r=un.toSetString(e);return cn.call(this._set,r)};De.prototype.indexOf=function(e){if(Ne){var r=this._set.get(e);if(r>=0)return r}else{var n=un.toSetString(e);if(cn.call(this._set,n))return this._set[n]}throw new Error('"'+e+'" is not in the set.')};De.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)};De.prototype.toArray=function(){return this._array.slice()};wi.ArraySet=De});var Ti=I(_i=>{var Ei=nt();function lu(t,e){var r=t.generatedLine,n=e.generatedLine,a=t.generatedColumn,i=e.generatedColumn;return n>r||n==r&&i>=a||Ei.compareByGeneratedPositionsInflated(t,e)<=0}function tr(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}tr.prototype.unsortedForEach=function(e,r){this._array.forEach(e,r)};tr.prototype.add=function(e){lu(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))};tr.prototype.toArray=function(){return this._sorted||(this._array.sort(Ei.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};_i.MappingList=tr});var dn=I(Ai=>{var Rt=on(),z=nt(),rr=fn().ArraySet,uu=Ti().MappingList;function ue(t){t||(t={}),this._file=z.getArg(t,"file",null),this._sourceRoot=z.getArg(t,"sourceRoot",null),this._skipValidation=z.getArg(t,"skipValidation",!1),this._sources=new rr,this._names=new rr,this._mappings=new uu,this._sourcesContents=null}ue.prototype._version=3;ue.fromSourceMap=function(e){var r=e.sourceRoot,n=new ue({file:e.file,sourceRoot:r});return e.eachMapping(function(a){var i={generated:{line:a.generatedLine,column:a.generatedColumn}};a.source!=null&&(i.source=a.source,r!=null&&(i.source=z.relative(r,i.source)),i.original={line:a.originalLine,column:a.originalColumn},a.name!=null&&(i.name=a.name)),n.addMapping(i)}),e.sources.forEach(function(a){var i=a;r!==null&&(i=z.relative(r,a)),n._sources.has(i)||n._sources.add(i);var s=e.sourceContentFor(a);s!=null&&n.setSourceContent(a,s)}),n};ue.prototype.addMapping=function(e){var r=z.getArg(e,"generated"),n=z.getArg(e,"original",null),a=z.getArg(e,"source",null),i=z.getArg(e,"name",null);this._skipValidation||this._validateMapping(r,n,a,i),a!=null&&(a=String(a),this._sources.has(a)||this._sources.add(a)),i!=null&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:a,name:i})};ue.prototype.setSourceContent=function(e,r){var n=e;this._sourceRoot!=null&&(n=z.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[z.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[z.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};ue.prototype.applySourceMap=function(e,r,n){var a=r;if(r==null){if(e.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);a=e.file}var i=this._sourceRoot;i!=null&&(a=z.relative(i,a));var s=new rr,o=new rr;this._mappings.unsortedForEach(function(l){if(l.source===a&&l.originalLine!=null){var u=e.originalPositionFor({line:l.originalLine,column:l.originalColumn});u.source!=null&&(l.source=u.source,n!=null&&(l.source=z.join(n,l.source)),i!=null&&(l.source=z.relative(i,l.source)),l.originalLine=u.line,l.originalColumn=u.column,u.name!=null&&(l.name=u.name))}var c=l.source;c!=null&&!s.has(c)&&s.add(c);var h=l.name;h!=null&&!o.has(h)&&o.add(h)},this),this._sources=s,this._names=o,e.sources.forEach(function(l){var u=e.sourceContentFor(l);u!=null&&(n!=null&&(l=z.join(n,l)),i!=null&&(l=z.relative(i,l)),this.setSourceContent(l,u))},this)};ue.prototype._validateMapping=function(e,r,n,a){if(r&&typeof r.line!="number"&&typeof r.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!r&&!n&&!a)){if(e&&"line"in e&&"column"in e&&r&&"line"in r&&"column"in r&&e.line>0&&e.column>=0&&r.line>0&&r.column>=0&&n)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:r,name:a}))}};ue.prototype._serializeMappings=function(){for(var e=0,r=1,n=0,a=0,i=0,s=0,o="",l,u,c,h,f=this._mappings.toArray(),d=0,m=f.length;d<m;d++){if(u=f[d],l="",u.generatedLine!==r)for(e=0;u.generatedLine!==r;)l+=";",r++;else if(d>0){if(!z.compareByGeneratedPositionsInflated(u,f[d-1]))continue;l+=","}l+=Rt.encode(u.generatedColumn-e),e=u.generatedColumn,u.source!=null&&(h=this._sources.indexOf(u.source),l+=Rt.encode(h-s),s=h,l+=Rt.encode(u.originalLine-1-a),a=u.originalLine-1,l+=Rt.encode(u.originalColumn-n),n=u.originalColumn,u.name!=null&&(c=this._names.indexOf(u.name),l+=Rt.encode(c-i),i=c)),o+=l}return o};ue.prototype._generateSourcesContent=function(e,r){return e.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=z.relative(r,n));var a=z.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,a)?this._sourcesContents[a]:null},this)};ue.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e};ue.prototype.toString=function(){return JSON.stringify(this.toJSON())};Ai.SourceMapGenerator=ue});var Ci=I($e=>{$e.GREATEST_LOWER_BOUND=1;$e.LEAST_UPPER_BOUND=2;function mn(t,e,r,n,a,i){var s=Math.floor((e-t)/2)+t,o=a(r,n[s],!0);return o===0?s:o>0?e-s>1?mn(s,e,r,n,a,i):i==$e.LEAST_UPPER_BOUND?e<n.length?e:-1:s:s-t>1?mn(t,s,r,n,a,i):i==$e.LEAST_UPPER_BOUND?s:t<0?-1:t}$e.search=function(e,r,n,a){if(r.length===0)return-1;var i=mn(-1,r.length,e,r,n,a||$e.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&n(r[i],r[i-1],!0)===0;)--i;return i}});var ki=I(Li=>{function hn(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function cu(t,e){return Math.round(t+Math.random()*(e-t))}function pn(t,e,r,n){if(r<n){var a=cu(r,n),i=r-1;hn(t,a,n);for(var s=t[n],o=r;o<n;o++)e(t[o],s)<=0&&(i+=1,hn(t,i,o));hn(t,i+1,o);var l=i+1;pn(t,e,r,l-1),pn(t,e,l+1,n)}}Li.quickSort=function(t,e){pn(t,e,0,t.length-1)}});var xi=I(nr=>{var C=nt(),gn=Ci(),at=fn().ArraySet,fu=on(),wt=ki().quickSort;function B(t,e){var r=t;return typeof t=="string"&&(r=C.parseSourceMapInput(t)),r.sections!=null?new fe(r,e):new J(r,e)}B.fromSourceMap=function(t,e){return J.fromSourceMap(t,e)};B.prototype._version=3;B.prototype.__generatedMappings=null;Object.defineProperty(B.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}});B.prototype.__originalMappings=null;Object.defineProperty(B.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}});B.prototype._charIsMappingSeparator=function(e,r){var n=e.charAt(r);return n===";"||n===","};B.prototype._parseMappings=function(e,r){throw new Error("Subclasses must implement _parseMappings")};B.GENERATED_ORDER=1;B.ORIGINAL_ORDER=2;B.GREATEST_LOWER_BOUND=1;B.LEAST_UPPER_BOUND=2;B.prototype.eachMapping=function(e,r,n){var a=r||null,i=n||B.GENERATED_ORDER,s;switch(i){case B.GENERATED_ORDER:s=this._generatedMappings;break;case B.ORIGINAL_ORDER:s=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var o=this.sourceRoot;s.map(function(l){var u=l.source===null?null:this._sources.at(l.source);return u=C.computeSourceURL(o,u,this._sourceMapURL),{source:u,generatedLine:l.generatedLine,generatedColumn:l.generatedColumn,originalLine:l.originalLine,originalColumn:l.originalColumn,name:l.name===null?null:this._names.at(l.name)}},this).forEach(e,a)};B.prototype.allGeneratedPositionsFor=function(e){var r=C.getArg(e,"line"),n={source:C.getArg(e,"source"),originalLine:r,originalColumn:C.getArg(e,"column",0)};if(n.source=this._findSourceIndex(n.source),n.source<0)return[];var a=[],i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",C.compareByOriginalPositions,gn.LEAST_UPPER_BOUND);if(i>=0){var s=this._originalMappings[i];if(e.column===void 0)for(var o=s.originalLine;s&&s.originalLine===o;)a.push({line:C.getArg(s,"generatedLine",null),column:C.getArg(s,"generatedColumn",null),lastColumn:C.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var l=s.originalColumn;s&&s.originalLine===r&&s.originalColumn==l;)a.push({line:C.getArg(s,"generatedLine",null),column:C.getArg(s,"generatedColumn",null),lastColumn:C.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return a};nr.SourceMapConsumer=B;function J(t,e){var r=t;typeof t=="string"&&(r=C.parseSourceMapInput(t));var n=C.getArg(r,"version"),a=C.getArg(r,"sources"),i=C.getArg(r,"names",[]),s=C.getArg(r,"sourceRoot",null),o=C.getArg(r,"sourcesContent",null),l=C.getArg(r,"mappings"),u=C.getArg(r,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);s&&(s=C.normalize(s)),a=a.map(String).map(C.normalize).map(function(c){return s&&C.isAbsolute(s)&&C.isAbsolute(c)?C.relative(s,c):c}),this._names=at.fromArray(i.map(String),!0),this._sources=at.fromArray(a,!0),this._absoluteSources=this._sources.toArray().map(function(c){return C.computeSourceURL(s,c,e)}),this.sourceRoot=s,this.sourcesContent=o,this._mappings=l,this._sourceMapURL=e,this.file=u}J.prototype=Object.create(B.prototype);J.prototype.consumer=B;J.prototype._findSourceIndex=function(t){var e=t;if(this.sourceRoot!=null&&(e=C.relative(this.sourceRoot,e)),this._sources.has(e))return this._sources.indexOf(e);var r;for(r=0;r<this._absoluteSources.length;++r)if(this._absoluteSources[r]==t)return r;return-1};J.fromSourceMap=function(e,r){var n=Object.create(J.prototype),a=n._names=at.fromArray(e._names.toArray(),!0),i=n._sources=at.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file,n._sourceMapURL=r,n._absoluteSources=n._sources.toArray().map(function(d){return C.computeSourceURL(n.sourceRoot,d,r)});for(var s=e._mappings.toArray().slice(),o=n.__generatedMappings=[],l=n.__originalMappings=[],u=0,c=s.length;u<c;u++){var h=s[u],f=new Oi;f.generatedLine=h.generatedLine,f.generatedColumn=h.generatedColumn,h.source&&(f.source=i.indexOf(h.source),f.originalLine=h.originalLine,f.originalColumn=h.originalColumn,h.name&&(f.name=a.indexOf(h.name)),l.push(f)),o.push(f)}return wt(n.__originalMappings,C.compareByOriginalPositions),n};J.prototype._version=3;Object.defineProperty(J.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function Oi(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}J.prototype._parseMappings=function(e,r){for(var n=1,a=0,i=0,s=0,o=0,l=0,u=e.length,c=0,h={},f={},d=[],m=[],p,R,g,w,O;c<u;)if(e.charAt(c)===";")n++,c++,a=0;else if(e.charAt(c)===",")c++;else{for(p=new Oi,p.generatedLine=n,w=c;w<u&&!this._charIsMappingSeparator(e,w);w++);if(R=e.slice(c,w),g=h[R],g)c+=R.length;else{for(g=[];c<w;)fu.decode(e,c,f),O=f.value,c=f.rest,g.push(O);if(g.length===2)throw new Error("Found a source, but no line and column");if(g.length===3)throw new Error("Found a source and line, but no column");h[R]=g}p.generatedColumn=a+g[0],a=p.generatedColumn,g.length>1&&(p.source=o+g[1],o+=g[1],p.originalLine=i+g[2],i=p.originalLine,p.originalLine+=1,p.originalColumn=s+g[3],s=p.originalColumn,g.length>4&&(p.name=l+g[4],l+=g[4])),m.push(p),typeof p.originalLine=="number"&&d.push(p)}wt(m,C.compareByGeneratedPositionsDeflated),this.__generatedMappings=m,wt(d,C.compareByOriginalPositions),this.__originalMappings=d};J.prototype._findMapping=function(e,r,n,a,i,s){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[a]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[a]);return gn.search(e,r,i,s)};J.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var r=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var n=this._generatedMappings[e+1];if(r.generatedLine===n.generatedLine){r.lastGeneratedColumn=n.generatedColumn-1;continue}}r.lastGeneratedColumn=1/0}};J.prototype.originalPositionFor=function(e){var r={generatedLine:C.getArg(e,"line"),generatedColumn:C.getArg(e,"column")},n=this._findMapping(r,this._generatedMappings,"generatedLine","generatedColumn",C.compareByGeneratedPositionsDeflated,C.getArg(e,"bias",B.GREATEST_LOWER_BOUND));if(n>=0){var a=this._generatedMappings[n];if(a.generatedLine===r.generatedLine){var i=C.getArg(a,"source",null);i!==null&&(i=this._sources.at(i),i=C.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));var s=C.getArg(a,"name",null);return s!==null&&(s=this._names.at(s)),{source:i,line:C.getArg(a,"originalLine",null),column:C.getArg(a,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}};J.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1};J.prototype.sourceContentFor=function(e,r){if(!this.sourcesContent)return null;var n=this._findSourceIndex(e);if(n>=0)return this.sourcesContent[n];var a=e;this.sourceRoot!=null&&(a=C.relative(this.sourceRoot,a));var i;if(this.sourceRoot!=null&&(i=C.urlParse(this.sourceRoot))){var s=a.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(s))return this.sourcesContent[this._sources.indexOf(s)];if((!i.path||i.path=="/")&&this._sources.has("/"+a))return this.sourcesContent[this._sources.indexOf("/"+a)]}if(r)return null;throw new Error('"'+a+'" is not in the SourceMap.')};J.prototype.generatedPositionFor=function(e){var r=C.getArg(e,"source");if(r=this._findSourceIndex(r),r<0)return{line:null,column:null,lastColumn:null};var n={source:r,originalLine:C.getArg(e,"line"),originalColumn:C.getArg(e,"column")},a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",C.compareByOriginalPositions,C.getArg(e,"bias",B.GREATEST_LOWER_BOUND));if(a>=0){var i=this._originalMappings[a];if(i.source===n.source)return{line:C.getArg(i,"generatedLine",null),column:C.getArg(i,"generatedColumn",null),lastColumn:C.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};nr.BasicSourceMapConsumer=J;function fe(t,e){var r=t;typeof t=="string"&&(r=C.parseSourceMapInput(t));var n=C.getArg(r,"version"),a=C.getArg(r,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new at,this._names=new at;var i={line:-1,column:0};this._sections=a.map(function(s){if(s.url)throw new Error("Support for url field in sections not implemented.");var o=C.getArg(s,"offset"),l=C.getArg(o,"line"),u=C.getArg(o,"column");if(l<i.line||l===i.line&&u<i.column)throw new Error("Section offsets must be ordered and non-overlapping.");return i=o,{generatedOffset:{generatedLine:l+1,generatedColumn:u+1},consumer:new B(C.getArg(s,"map"),e)}})}fe.prototype=Object.create(B.prototype);fe.prototype.constructor=B;fe.prototype._version=3;Object.defineProperty(fe.prototype,"sources",{get:function(){for(var t=[],e=0;e<this._sections.length;e++)for(var r=0;r<this._sections[e].consumer.sources.length;r++)t.push(this._sections[e].consumer.sources[r]);return t}});fe.prototype.originalPositionFor=function(e){var r={generatedLine:C.getArg(e,"line"),generatedColumn:C.getArg(e,"column")},n=gn.search(r,this._sections,function(i,s){var o=i.generatedLine-s.generatedOffset.generatedLine;return o||i.generatedColumn-s.generatedOffset.generatedColumn}),a=this._sections[n];return a?a.consumer.originalPositionFor({line:r.generatedLine-(a.generatedOffset.generatedLine-1),column:r.generatedColumn-(a.generatedOffset.generatedLine===r.generatedLine?a.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}};fe.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})};fe.prototype.sourceContentFor=function(e,r){for(var n=0;n<this._sections.length;n++){var a=this._sections[n],i=a.consumer.sourceContentFor(e,!0);if(i)return i}if(r)return null;throw new Error('"'+e+'" is not in the SourceMap.')};fe.prototype.generatedPositionFor=function(e){for(var r=0;r<this._sections.length;r++){var n=this._sections[r];if(n.consumer._findSourceIndex(C.getArg(e,"source"))!==-1){var a=n.consumer.generatedPositionFor(e);if(a){var i={line:a.line+(n.generatedOffset.generatedLine-1),column:a.column+(n.generatedOffset.generatedLine===a.line?n.generatedOffset.generatedColumn-1:0)};return i}}}return{line:null,column:null}};fe.prototype._parseMappings=function(e,r){this.__generatedMappings=[],this.__originalMappings=[];for(var n=0;n<this._sections.length;n++)for(var a=this._sections[n],i=a.consumer._generatedMappings,s=0;s<i.length;s++){var o=i[s],l=a.consumer._sources.at(o.source);l=C.computeSourceURL(a.consumer.sourceRoot,l,this._sourceMapURL),this._sources.add(l),l=this._sources.indexOf(l);var u=null;o.name&&(u=a.consumer._names.at(o.name),this._names.add(u),u=this._names.indexOf(u));var c={source:l,generatedLine:o.generatedLine+(a.generatedOffset.generatedLine-1),generatedColumn:o.generatedColumn+(a.generatedOffset.generatedLine===o.generatedLine?a.generatedOffset.generatedColumn-1:0),originalLine:o.originalLine,originalColumn:o.originalColumn,name:u};this.__generatedMappings.push(c),typeof c.originalLine=="number"&&this.__originalMappings.push(c)}wt(this.__generatedMappings,C.compareByGeneratedPositionsDeflated),wt(this.__originalMappings,C.compareByOriginalPositions)};nr.IndexedSourceMapConsumer=fe});var Fi=I(Mi=>{var du=dn().SourceMapGenerator,ar=nt(),mu=/(\r?\n)/,hu=10,it="$$$isSourceNode$$$";function ie(t,e,r,n,a){this.children=[],this.sourceContents={},this.line=t??null,this.column=e??null,this.source=r??null,this.name=a??null,this[it]=!0,n!=null&&this.add(n)}ie.fromStringWithSourceMap=function(e,r,n){var a=new ie,i=e.split(mu),s=0,o=function(){var f=m(),d=m()||"";return f+d;function m(){return s<i.length?i[s++]:void 0}},l=1,u=0,c=null;return r.eachMapping(function(f){if(c!==null)if(l<f.generatedLine)h(c,o()),l++,u=0;else{var d=i[s]||"",m=d.substr(0,f.generatedColumn-u);i[s]=d.substr(f.generatedColumn-u),u=f.generatedColumn,h(c,m),c=f;return}for(;l<f.generatedLine;)a.add(o()),l++;if(u<f.generatedColumn){var d=i[s]||"";a.add(d.substr(0,f.generatedColumn)),i[s]=d.substr(f.generatedColumn),u=f.generatedColumn}c=f},this),s<i.length&&(c&&h(c,o()),a.add(i.splice(s).join(""))),r.sources.forEach(function(f){var d=r.sourceContentFor(f);d!=null&&(n!=null&&(f=ar.join(n,f)),a.setSourceContent(f,d))}),a;function h(f,d){if(f===null||f.source===void 0)a.add(d);else{var m=n?ar.join(n,f.source):f.source;a.add(new ie(f.originalLine,f.originalColumn,m,d,f.name))}}};ie.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(r){this.add(r)},this);else if(e[it]||typeof e=="string")e&&this.children.push(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};ie.prototype.prepend=function(e){if(Array.isArray(e))for(var r=e.length-1;r>=0;r--)this.prepend(e[r]);else if(e[it]||typeof e=="string")this.children.unshift(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};ie.prototype.walk=function(e){for(var r,n=0,a=this.children.length;n<a;n++)r=this.children[n],r[it]?r.walk(e):r!==""&&e(r,{source:this.source,line:this.line,column:this.column,name:this.name})};ie.prototype.join=function(e){var r,n,a=this.children.length;if(a>0){for(r=[],n=0;n<a-1;n++)r.push(this.children[n]),r.push(e);r.push(this.children[n]),this.children=r}return this};ie.prototype.replaceRight=function(e,r){var n=this.children[this.children.length-1];return n[it]?n.replaceRight(e,r):typeof n=="string"?this.children[this.children.length-1]=n.replace(e,r):this.children.push("".replace(e,r)),this};ie.prototype.setSourceContent=function(e,r){this.sourceContents[ar.toSetString(e)]=r};ie.prototype.walkSourceContents=function(e){for(var r=0,n=this.children.length;r<n;r++)this.children[r][it]&&this.children[r].walkSourceContents(e);for(var a=Object.keys(this.sourceContents),r=0,n=a.length;r<n;r++)e(ar.fromSetString(a[r]),this.sourceContents[a[r]])};ie.prototype.toString=function(){var e="";return this.walk(function(r){e+=r}),e};ie.prototype.toStringWithSourceMap=function(e){var r={code:"",line:1,column:0},n=new du(e),a=!1,i=null,s=null,o=null,l=null;return this.walk(function(u,c){r.code+=u,c.source!==null&&c.line!==null&&c.column!==null?((i!==c.source||s!==c.line||o!==c.column||l!==c.name)&&n.addMapping({source:c.source,original:{line:c.line,column:c.column},generated:{line:r.line,column:r.column},name:c.name}),i=c.source,s=c.line,o=c.column,l=c.name,a=!0):a&&(n.addMapping({generated:{line:r.line,column:r.column}}),i=null,a=!1);for(var h=0,f=u.length;h<f;h++)u.charCodeAt(h)===hu?(r.line++,r.column=0,h+1===f?(i=null,a=!1):a&&n.addMapping({source:c.source,original:{line:c.line,column:c.column},generated:{line:r.line,column:r.column},name:c.name})):r.column++}),this.walkSourceContents(function(u,c){n.setSourceContent(u,c)}),{code:r.code,map:n}};Mi.SourceNode=ie});var Ii=I(ir=>{ir.SourceMapGenerator=dn().SourceMapGenerator;ir.SourceMapConsumer=xi().SourceMapConsumer;ir.SourceNode=Fi().SourceNode});var $i=I(($d,Ni)=>{var pu=Object.prototype.toString,vn=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function gu(t){return pu.call(t).slice(8,-1)==="ArrayBuffer"}function vu(t,e,r){e>>>=0;var n=t.byteLength-e;if(n<0)throw new RangeError("'offset' is out of bounds");if(r===void 0)r=n;else if(r>>>=0,r>n)throw new RangeError("'length' is out of bounds");return vn?Buffer.from(t.slice(e,e+r)):new Buffer(new Uint8Array(t.slice(e,e+r)))}function yu(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return vn?Buffer.from(t,e):new Buffer(t,e)}function Su(t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return gu(t)?vu(t,e,r):typeof t=="string"?yu(t,e):vn?Buffer.from(t):new Buffer(t)}Ni.exports=Su});var Hi=I((Ve,bn)=>{var Du=Ii().SourceMapConsumer,yn=require("path"),ge;try{ge=require("fs"),(!ge.existsSync||!ge.readFileSync)&&(ge=null)}catch{}var bu=$i();function Pi(t,e){return t.require(e)}var Vi=!1,Ui=!1,Sn=!1,Et="auto",Pe={},_t={},Ru=/^data:application\/json[^,]+base64,/,Le=[],ke=[];function Rn(){return Et==="browser"?!0:Et==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function wu(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function Eu(){return typeof process=="object"&&process!==null?process.version:""}function _u(){if(typeof process=="object"&&process!==null)return process.stderr}function Tu(t){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(t)}function sr(t){return function(e){for(var r=0;r<t.length;r++){var n=t[r](e);if(n)return n}return null}}var wn=sr(Le);Le.push(function(t){if(t=t.trim(),/^file:/.test(t)&&(t=t.replace(/file:\/\/\/(\w:)?/,function(n,a){return a?"":"/"})),t in Pe)return Pe[t];var e="";try{if(ge)ge.existsSync(t)&&(e=ge.readFileSync(t,"utf8"));else{var r=new XMLHttpRequest;r.open("GET",t,!1),r.send(null),r.readyState===4&&r.status===200&&(e=r.responseText)}}catch{}return Pe[t]=e});function Dn(t,e){if(!t)return e;var r=yn.dirname(t),n=/^\w+:\/\/[^\/]*/.exec(r),a=n?n[0]:"",i=r.slice(a.length);return a&&/^\/\w\:/.test(i)?(a+="/",a+yn.resolve(r.slice(a.length),e).replace(/\\/g,"/")):a+yn.resolve(r.slice(a.length),e)}function Au(t){var e;if(Rn())try{var r=new XMLHttpRequest;r.open("GET",t,!1),r.send(null),e=r.readyState===4?r.responseText:null;var n=r.getResponseHeader("SourceMap")||r.getResponseHeader("X-SourceMap");if(n)return n}catch{}e=wn(t);for(var a=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,i,s;s=a.exec(e);)i=s;return i?i[1]:null}var En=sr(ke);ke.push(function(t){var e=Au(t);if(!e)return null;var r;if(Ru.test(e)){var n=e.slice(e.indexOf(",")+1);r=bu(n,"base64").toString(),e=t}else e=Dn(t,e),r=wn(e);return r?{url:e,map:r}:null});function _n(t){var e=_t[t.source];if(!e){var r=En(t.source);r?(e=_t[t.source]={url:r.url,map:new Du(r.map)},e.map.sourcesContent&&e.map.sources.forEach(function(a,i){var s=e.map.sourcesContent[i];if(s){var o=Dn(e.url,a);Pe[o]=s}})):e=_t[t.source]={url:null,map:null}}if(e&&e.map&&typeof e.map.originalPositionFor=="function"){var n=e.map.originalPositionFor(t);if(n.source!==null)return n.source=Dn(e.url,n.source),n}return t}function qi(t){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(t);if(e){var r=_n({source:e[2],line:+e[3],column:e[4]-1});return"eval at "+e[1]+" ("+r.source+":"+r.line+":"+(r.column+1)+")"}return e=/^eval at ([^(]+) \((.+)\)$/.exec(t),e?"eval at "+e[1]+" ("+qi(e[2])+")":t}function Cu(){var t,e="";if(this.isNative())e="native";else{t=this.getScriptNameOrSourceURL(),!t&&this.isEval()&&(e=this.getEvalOrigin(),e+=", "),t?e+=t:e+="<anonymous>";var r=this.getLineNumber();if(r!=null){e+=":"+r;var n=this.getColumnNumber();n&&(e+=":"+n)}}var a="",i=this.getFunctionName(),s=!0,o=this.isConstructor(),l=!(this.isToplevel()||o);if(l){var u=this.getTypeName();u==="[object Object]"&&(u="null");var c=this.getMethodName();i?(u&&i.indexOf(u)!=0&&(a+=u+"."),a+=i,c&&i.indexOf("."+c)!=i.length-c.length-1&&(a+=" [as "+c+"]")):a+=u+"."+(c||"<anonymous>")}else o?a+="new "+(i||"<anonymous>"):i?a+=i:(a+=e,s=!1);return s&&(a+=" ("+e+")"),a}function Yi(t){var e={};return Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(function(r){e[r]=/^(?:is|get)/.test(r)?function(){return t[r].call(t)}:t[r]}),e.toString=Cu,e}function ji(t,e){if(e===void 0&&(e={nextPosition:null,curPosition:null}),t.isNative())return e.curPosition=null,t;var r=t.getFileName()||t.getScriptNameOrSourceURL();if(r){var n=t.getLineNumber(),a=t.getColumnNumber()-1,i=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,s=i.test(Eu())?0:62;n===1&&a>s&&!Rn()&&!t.isEval()&&(a-=s);var o=_n({source:r,line:n,column:a});e.curPosition=o,t=Yi(t);var l=t.getFunctionName;return t.getFunctionName=function(){return e.nextPosition==null?l():e.nextPosition.name||l()},t.getFileName=function(){return o.source},t.getLineNumber=function(){return o.line},t.getColumnNumber=function(){return o.column+1},t.getScriptNameOrSourceURL=function(){return o.source},t}var u=t.isEval()&&t.getEvalOrigin();return u&&(u=qi(u),t=Yi(t),t.getEvalOrigin=function(){return u}),t}function Lu(t,e){Sn&&(Pe={},_t={});for(var r=t.name||"Error",n=t.message||"",a=r+": "+n,i={nextPosition:null,curPosition:null},s=[],o=e.length-1;o>=0;o--)s.push(`
    at `+ji(e[o],i)),i.nextPosition=i.curPosition;return i.curPosition=i.nextPosition=null,a+s.reverse().join("")}function Bi(t){var e=/\n    at [^(]+ \((.*):(\d+):(\d+)\)/.exec(t.stack);if(e){var r=e[1],n=+e[2],a=+e[3],i=Pe[r];if(!i&&ge&&ge.existsSync(r))try{i=ge.readFileSync(r,"utf8")}catch{i=""}if(i){var s=i.split(/(?:\r\n|\r|\n)/)[n-1];if(s)return r+":"+n+`
`+s+`
`+new Array(a).join(" ")+"^"}}return null}function ku(t){var e=Bi(t),r=_u();r&&r._handle&&r._handle.setBlocking&&r._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(t.stack),Tu(1)}function Ou(){var t=process.emit;process.emit=function(e){if(e==="uncaughtException"){var r=arguments[1]&&arguments[1].stack,n=this.listeners(e).length>0;if(r&&!n)return ku(arguments[1])}return t.apply(this,arguments)}}var xu=Le.slice(0),Mu=ke.slice(0);Ve.wrapCallSite=ji;Ve.getErrorSource=Bi;Ve.mapSourcePosition=_n;Ve.retrieveSourceMap=En;Ve.install=function(t){if(t=t||{},t.environment&&(Et=t.environment,["node","browser","auto"].indexOf(Et)===-1))throw new Error("environment "+Et+" was unknown. Available options are {auto, browser, node}");if(t.retrieveFile&&(t.overrideRetrieveFile&&(Le.length=0),Le.unshift(t.retrieveFile)),t.retrieveSourceMap&&(t.overrideRetrieveSourceMap&&(ke.length=0),ke.unshift(t.retrieveSourceMap)),t.hookRequire&&!Rn()){var e=Pi(bn,"module"),r=e.prototype._compile;r.__sourceMapSupport||(e.prototype._compile=function(i,s){return Pe[s]=i,_t[s]=void 0,r.call(this,i,s)},e.prototype._compile.__sourceMapSupport=!0)}if(Sn||(Sn="emptyCacheBetweenOperations"in t?t.emptyCacheBetweenOperations:!1),Vi||(Vi=!0,Error.prepareStackTrace=Lu),!Ui){var n="handleUncaughtExceptions"in t?t.handleUncaughtExceptions:!0;try{var a=Pi(bn,"worker_threads");a.isMainThread===!1&&(n=!1)}catch{}n&&wu()&&(Ui=!0,Ou())}};Ve.resetRetrieveHandlers=function(){Le.length=0,ke.length=0,Le=xu.slice(0),ke=Mu.slice(0),En=sr(ke),wn=sr(Le)}});var es=I((Vd,Z)=>{var Fu="1.8.15",zi=0,ot=function(e){var r=["XXX: "+e].concat(Array.prototype.slice.call(arguments,1));console.error.apply(this,r)},ot=function(){},Ye;typeof process<"u"&&process.versions&&(process.versions.nw?Ye="nw":process.versions.node&&(Ye="node"));!Ye&&typeof window<"u"&&window.window===window&&(Ye="browser");if(!Ye)throw new Error("unknown runtime environment");var or,be,st;if(Ye==="browser")or={hostname:function(){return window.location.host}},be={},st=null;else{or=require("os"),be=require("fs");try{st=require("dtrace-provider")}catch{st=null}}var we=require("util"),Re=require("assert"),kt=require("events").EventEmitter,Iu=require("stream");try{At=oa()}catch{At=null}var At;process.env.BUNYAN_TEST_NO_SAFE_JSON_STRINGIFY&&(At=null);try{Ct=fi()}catch{Ct=null}var Ct;try{lr=Hi()}catch{lr=null}var lr;function Ue(t){if(t==null)return t;if(Array.isArray(t))return t.slice();if(typeof t=="object"){var e={};return Object.keys(t).forEach(function(r){e[r]=t[r]}),e}else return t}var K=we.format;K||(Tn=we.inspect,Gi=/%[sdj%]/g,K=function(e){if(typeof e!="string"){for(var r=[],n=0;n<arguments.length;n++)r.push(Tn(arguments[n]));return r.join(" ")}for(var n=1,a=arguments,i=a.length,s=String(e).replace(Gi,function(l){if(n>=i)return l;switch(l){case"%s":return String(a[n++]);case"%d":return Number(a[n++]);case"%j":return Zi(a[n++]);case"%%":return"%";default:return l}}),o=a[n];n<i;o=a[++n])o===null||typeof o!="object"?s+=" "+o:s+=" "+Tn(o);return s});var Tn,Gi;function Ln(){if(this!==void 0){var t={},e=Error.stackTraceLimit,r=Error.prepareStackTrace;return Error.stackTraceLimit=3,Error.prepareStackTrace=function(n,a){var i=a[2];lr&&(i=lr.wrapCallSite(i)),t.file=i.getFileName(),t.line=i.getLineNumber();var s=i.getFunctionName();s&&(t.func=s)},Error.captureStackTrace(this,Ln),this.stack,Error.stackTraceLimit=e,Error.prepareStackTrace=r,t}}function Nu(t,e){e||(e="    ");var r=t.split(/\r?\n/g);return e+r.join(`
`+e)}function kn(t,e){if(Re.ok(t),e){if(An[e])return;An[e]=!0}process.stderr.write(t+`
`)}function $u(t){return An[t]}var An={};function Xi(){}Xi.prototype.write=function(t){t.level<Ot?console.log(t):t.level<ur?console.info(t):t.level<cr?console.warn(t):console.error(t)};var On=10,xn=20,Ot=30,ur=40,cr=50,Mn=60,lt={trace:On,debug:xn,info:Ot,warn:ur,error:cr,fatal:Mn},Wi={};Object.keys(lt).forEach(function(t){Wi[lt[t]]=t});var Tt=void 0,Cn=st&&{};function Lt(t){var e,r=typeof t;if(r==="string"){if(e=lt[t.toLowerCase()],!e)throw new Error(K('unknown level name: "%s"',t))}else{if(r!=="number")throw new TypeError(K("cannot resolve level: invalid arg (%s):",r,t));if(t<0||Math.floor(t)!==t)throw new TypeError(K("level is not a positive integer: %s",t));e=t}return e}function Pu(t){return t instanceof Iu.Writable?!0:typeof t.write=="function"}function H(t,e,r){if(ot("Logger start:",t),!(this instanceof H))return new H(t,e);var n;if(e!==void 0&&(n=t,t=e,!(n instanceof H)))throw new TypeError("invalid Logger creation: do not pass a second arg");if(!t)throw new TypeError("options (object) is required");if(n){if(t.name)throw new TypeError("invalid options.name: child cannot set logger name")}else if(!t.name)throw new TypeError("options.name (string) is required");if(t.stream&&t.streams)throw new TypeError('cannot mix "streams" and "stream" options');if(t.streams&&!Array.isArray(t.streams))throw new TypeError("invalid options.streams: must be an array");if(t.serializers&&(typeof t.serializers!="object"||Array.isArray(t.serializers)))throw new TypeError("invalid options.serializers: must be an object");if(kt.call(this),n&&r){this._isSimpleChild=!0,this._level=n._level,this.streams=n.streams,this.serializers=n.serializers,this.src=n.src;for(var f=this.fields={},a=Object.keys(n.fields),i=0;i<a.length;i++){var s=a[i];f[s]=n.fields[s]}for(var o=Object.keys(t),i=0;i<o.length;i++){var s=o[i];f[s]=t[s]}return}var l=this;if(n){this._level=n._level,this.streams=[];for(var i=0;i<n.streams.length;i++){var u=Ue(n.streams[i]);u.closeOnExit=!1,this.streams.push(u)}this.serializers=Ue(n.serializers),this.src=n.src,this.fields=Ue(n.fields),t.level&&this.level(t.level)}else this._level=Number.POSITIVE_INFINITY,this.streams=[],this.serializers=null,this.src=!1,this.fields={};if(!Tt&&st){Tt=st.createDTraceProvider("bunyan");for(var c in lt){var h;Cn[lt[c]]=h=Tt.addProbe("log-"+c,"char *"),h.dtp=Tt}Tt.enable()}t.stream?l.addStream({type:"stream",stream:t.stream,closeOnExit:!1,level:t.level}):t.streams?t.streams.forEach(function(d){l.addStream(d,t.level)}):n&&t.level?this.level(t.level):n||(Ye==="browser"?l.addStream({type:"raw",stream:new Xi,closeOnExit:!1,level:t.level}):l.addStream({type:"stream",stream:process.stdout,closeOnExit:!1,level:t.level})),t.serializers&&l.addSerializers(t.serializers),t.src&&(this.src=!0),ot("Logger: ",l);var f=Ue(t);delete f.stream,delete f.level,delete f.streams,delete f.serializers,delete f.src,this.serializers&&this._applySerializers(f),!f.hostname&&!l.fields.hostname&&(f.hostname=or.hostname()),f.pid||(f.pid=process.pid),Object.keys(f).forEach(function(d){l.fields[d]=f[d]})}we.inherits(H,kt);H.prototype.addStream=function(e,r){var n=this;switch(r==null&&(r=Ot),e=Ue(e),e.type||(e.stream?e.type="stream":e.path&&(e.type="file")),e.raw=e.type==="raw",e.level!==void 0?e.level=Lt(e.level):e.level=Lt(r),e.level<n._level&&(n._level=e.level),e.type){case"stream":Re.ok(Pu(e.stream),'"stream" stream is not writable: '+we.inspect(e.stream)),e.closeOnExit||(e.closeOnExit=!1);break;case"file":e.reemitErrorEvents===void 0&&(e.reemitErrorEvents=!0),e.stream?e.closeOnExit||(e.closeOnExit=!1):(e.stream=be.createWriteStream(e.path,{flags:"a",encoding:"utf8"}),e.closeOnExit||(e.closeOnExit=!0));break;case"rotating-file":Re.ok(!e.stream,'"rotating-file" stream should not give a "stream"'),Re.ok(e.path),Re.ok(Ct,'"rotating-file" stream type is not supported: missing "mv" module'),e.stream=new se(e),e.closeOnExit||(e.closeOnExit=!0);break;case"raw":e.closeOnExit||(e.closeOnExit=!1);break;default:throw new TypeError('unknown stream type "'+e.type+'"')}e.reemitErrorEvents&&typeof e.stream.on=="function"&&e.stream.on("error",function(i){n.emit("error",i,e)}),n.streams.push(e),delete n.haveNonRawStreams};H.prototype.addSerializers=function(e){var r=this;r.serializers||(r.serializers={}),Object.keys(e).forEach(function(n){var a=e[n];if(typeof a!="function")throw new TypeError(K('invalid serializer for "%s" field: must be a function',n));r.serializers[n]=a})};H.prototype.child=function(t,e){return new this.constructor(this,t||{},e)};H.prototype.reopenFileStreams=function(){var t=this;t.streams.forEach(function(e){e.type==="file"&&(e.stream&&(e.stream.end(),e.stream.destroySoon(),delete e.stream),e.stream=be.createWriteStream(e.path,{flags:"a",encoding:"utf8"}),e.stream.on("error",function(r){t.emit("error",r,e)}))})};H.prototype.level=function(e){if(e===void 0)return this._level;for(var r=Lt(e),n=this.streams.length,a=0;a<n;a++)this.streams[a].level=r;this._level=r};H.prototype.levels=function(e,r){if(e===void 0)return Re.equal(r,void 0),this.streams.map(function(l){return l.level});var n;if(typeof e=="number"){if(n=this.streams[e],n===void 0)throw new Error("invalid stream index: "+e)}else{for(var a=this.streams.length,i=0;i<a;i++){var s=this.streams[i];if(s.name===e){n=s;break}}if(!n)throw new Error(K('no stream with name "%s"',e))}if(r===void 0)return n.level;var o=Lt(r);n.level=o,o<this._level&&(this._level=o)};H.prototype._applySerializers=function(t,e){var r=this;ot("_applySerializers: excludeFields",e),Object.keys(this.serializers).forEach(function(n){if(!(t[n]===void 0||e&&e[n])){ot('_applySerializers; apply to "%s" key',n);try{t[n]=r.serializers[n](t[n])}catch(a){kn(K(`bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bug in that serializer function.
%s`,n,a.stack||a)),t[n]=K('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',n)}}})};H.prototype._emit=function(t,e){var r;if(this.haveNonRawStreams===void 0){for(this.haveNonRawStreams=!1,r=0;r<this.streams.length;r++)if(!this.streams[r].raw){this.haveNonRawStreams=!0;break}}var n;if((e||this.haveNonRawStreams)&&(n=Zi(t)+or.EOL),e)return n;var a=t.level;for(r=0;r<this.streams.length;r++){var i=this.streams[r];i.level<=a&&(ot('writing log rec "%s" to "%s" stream (%d <= %d): %j',t.msg,i.type,i.level,a,t),i.stream.write(i.raw?t:n))}return n};function Qi(t,e,r){var n,a,i;r[0]instanceof Error?(a={err:t.serializers&&t.serializers.err?t.serializers.err(r[0]):H.stdSerializers.err(r[0])},n={err:!0},r.length===1?i=[a.err.message]:i=r.slice(1)):typeof r[0]!="object"||Array.isArray(r[0])?(a=null,i=r.slice()):Buffer.isBuffer(r[0])?(a=null,i=r.slice(),i[0]=we.inspect(i[0])):(a=r[0],a&&r.length===1&&a.err&&a.err instanceof Error?i=[a.err.message]:i=r.slice(1));var s=Ue(t.fields),o=s.level=e,l=a?Ue(a):null;return l&&(t.serializers&&t._applySerializers(l,n),Object.keys(l).forEach(function(u){s[u]=l[u]})),s.msg=K.apply(t,i),s.time||(s.time=new Date),t.src&&!s.src&&(s.src=Ln()),s.v=zi,s}function Vu(t,e,r,n){return[t||e._emit(Qi(e,r,n),!0)]}function ut(t){return function(){var e=this,r=null,n=null;if(this._emit){if(arguments.length===0)return this._level<=t}else{var a="unbound";if(!$u[a]){var i=Ln();kn(K("bunyan usage error: %s:%s: attempt to log with an unbound log method: `this` is: %s",i.file,i.line,we.inspect(this)),a)}return}for(var s=new Array(arguments.length),o=0;o<s.length;++o)s[o]=arguments[o];this._level<=t&&(n=Qi(e,t,s),r=this._emit(n)),Cn&&Cn[t].fire(Vu,r,e,t,s)}}H.prototype.trace=ut(On);H.prototype.debug=ut(xn);H.prototype.info=ut(Ot);H.prototype.warn=ut(ur);H.prototype.error=ut(cr);H.prototype.fatal=ut(Mn);H.stdSerializers={};H.stdSerializers.req=function(t){return!t||!t.connection?t:{method:t.method,url:t.originalUrl||t.url,headers:t.headers,remoteAddress:t.connection.remoteAddress,remotePort:t.connection.remotePort}};H.stdSerializers.res=function(t){return!t||!t.statusCode?t:{statusCode:t.statusCode,header:t._header}};function Ji(t){var e=t.stack||t.toString();if(t.cause&&typeof t.cause=="function"){var r=t.cause();r&&(e+=`
Caused by: `+Ji(r))}return e}var Pd=H.stdSerializers.err=function(t){if(!t||!t.stack)return t;var e={message:t.message,name:t.name,stack:Ji(t),code:t.code,signal:t.signal};return e};function Uu(){var t=new Set;return function(e,r){return!r||typeof r!="object"?r:t.has(r)?"[Circular]":(t.add(r),r)}}function Yu(){var t=[];return function(e,r){return!r||typeof r!="object"?r:t.indexOf(r)!==-1?"[Circular]":(t.push(r),r)}}var Ki=typeof Set<"u"?Uu:Yu;function Zi(t){try{return JSON.stringify(t)}catch{try{return JSON.stringify(t,Ki())}catch(n){if(At)return At(t);var e=n.stack.split(/\n/g,3).join(`
`);return kn('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n'+Nu(K(`%s
%s`,we.inspect(t),n.stack)),e),K("(Exception in JSON.stringify(rec): %j. See stderr for details.)",n.message)}}}var se=null;Ct&&(se=function(e){if(this.path=e.path,this.count=e.count==null?10:e.count,Re.equal(typeof this.count,"number",K('rotating-file stream "count" is not a number: %j (%s) in %j',this.count,typeof this.count,this)),Re.ok(this.count>=0,K('rotating-file stream "count" is not >= 0: %j in %j',this.count,this)),e.period){var r={hourly:"1h",daily:"1d",weekly:"1w",monthly:"1m",yearly:"1y"}[e.period]||e.period,n=/^([1-9][0-9]*)([hdwmy]|ms)$/.exec(r);if(!n)throw new Error(K('invalid period: "%s"',e.period));this.periodNum=Number(n[1]),this.periodScope=n[2]}else this.periodNum=1,this.periodScope="d";var a=null;try{var i=be.statSync(this.path);a=i.mtime.getTime()}catch{}var s=!1;if(a){var o=this._calcRotTime(0);a<o&&(s=!0)}this.stream=be.createWriteStream(this.path,{flags:"a",encoding:"utf8"}),this.rotQueue=[],this.rotating=!1,s?(this._debug("rotateAfterOpen -> call rotate()"),this.rotate()):this._setupNextRot()},we.inherits(se,kt),se.prototype._debug=function(){if(0)var t;else return!1},se.prototype._setupNextRot=function(){this.rotAt=this._calcRotTime(1),this._setRotationTimer()},se.prototype._setRotationTimer=function(){var t=this,e=this.rotAt-Date.now(),r=2147483647;e>r&&(e=r),this.timeout=setTimeout(function(){t._debug("_setRotationTimer timeout -> call rotate()"),t.rotate()},e),typeof this.timeout.unref=="function"&&this.timeout.unref()},se.prototype._calcRotTime=function(e){this._debug("_calcRotTime: %s%s",this.periodNum,this.periodScope);var r=new Date;this._debug("  now local: %s",r),this._debug("    now utc: %s",r.toISOString());var n;switch(this.periodScope){case"ms":this.rotAt?n=this.rotAt+this.periodNum*e:n=Date.now()+this.periodNum*e;break;case"h":this.rotAt?n=this.rotAt+this.periodNum*60*60*1e3*e:n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),r.getUTCHours()+e);break;case"d":this.rotAt?n=this.rotAt+this.periodNum*24*60*60*1e3*e:n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()+e);break;case"w":if(this.rotAt)n=this.rotAt+this.periodNum*7*24*60*60*1e3*e;else{var a=7-r.getUTCDay();e<1&&(a=-r.getUTCDay()),(e>1||e<-1)&&(a+=7*e),n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()+a)}break;case"m":this.rotAt?n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+this.periodNum*e,1):n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+e,1);break;case"y":this.rotAt?n=Date.UTC(r.getUTCFullYear()+this.periodNum*e,0,1):n=Date.UTC(r.getUTCFullYear()+e,0,1);break;default:Re.fail(K('invalid period scope: "%s"',this.periodScope))}if(this._debug()){this._debug("  **rotAt**: %s (utc: %s)",n,new Date(n).toUTCString());var i=Date.now();this._debug("        now: %s (%sms == %smin == %sh to go)",i,n-i,(n-i)/1e3/60,(n-i)/1e3/60/60)}return n},se.prototype.rotate=function(){var e=this;if(e.rotAt&&e.rotAt>Date.now())return e._setRotationTimer();if(this._debug("rotate"),e.rotating)throw new TypeError("cannot start a rotation when already rotating");e.rotating=!0,e.stream.end();function r(){var s=e.path+"."+String(i-1);i===0&&(s=e.path),i-=1,e._debug("  rm %s",s),be.unlink(s,function(o){n()})}function n(){if(e.count===0||i<0)return a();var s=e.path,o=e.path+"."+String(i);i>0&&(s+="."+String(i-1)),i-=1,be.exists(s,function(l){l?(e._debug("  mv %s %s",s,o),Ct(s,o,function(u){u?(e.emit("error",u),a()):n()})):n()})}function a(){e._debug("  open %s",e.path),e.stream=be.createWriteStream(e.path,{flags:"a",encoding:"utf8"});for(var s=e.rotQueue,o=s.length,l=0;l<o;l++)e.stream.write(s[l]);e.rotQueue=[],e.rotating=!1,e.emit("drain"),e._setupNextRot()}var i=this.count;r()},se.prototype.write=function(e){return this.rotating?(this.rotQueue.push(e),!1):this.stream.write(e)},se.prototype.end=function(e){this.stream.end()},se.prototype.destroy=function(e){this.stream.destroy()},se.prototype.destroySoon=function(e){this.stream.destroySoon()});function ct(t){this.limit=t&&t.limit?t.limit:100,this.writable=!0,this.records=[],kt.call(this)}we.inherits(ct,kt);ct.prototype.write=function(t){if(!this.writable)throw new Error("RingBuffer has been ended already");return this.records.push(t),this.records.length>this.limit&&this.records.shift(),!0};ct.prototype.end=function(){arguments.length>0&&this.write.apply(this,Array.prototype.slice.call(arguments)),this.writable=!1};ct.prototype.destroy=function(){this.writable=!1,this.emit("close")};ct.prototype.destroySoon=function(){this.destroy()};Z.exports=H;Z.exports.TRACE=On;Z.exports.DEBUG=xn;Z.exports.INFO=Ot;Z.exports.WARN=ur;Z.exports.ERROR=cr;Z.exports.FATAL=Mn;Z.exports.resolveLevel=Lt;Z.exports.levelFromName=lt;Z.exports.nameFromLevel=Wi;Z.exports.VERSION=Fu;Z.exports.LOG_VERSION=zi;Z.exports.createLogger=function(e){return new H(e)};Z.exports.RingBuffer=ct;Z.exports.RotatingFileStream=se;Z.exports.safeCycles=Ki});var rs=I((Ud,ts)=>{var qu=Object.prototype.hasOwnProperty,ju=Object.prototype.toString,Bu=function(t){var e=typeof t=="function"&&!(t instanceof RegExp)||ju.call(t)==="[object Function]";return!e&&typeof window<"u"&&(e=t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt),e};ts.exports=function(e,r){if(!Bu(r))throw new TypeError("iterator must be a function");var n,a,i=typeof e=="string",s=e.length,o=arguments.length>2?arguments[2]:null;if(s===+s)for(n=0;n<s;n++)o===null?r(i?e.charAt(n):e[n],n,e):r.call(o,i?e.charAt(n):e[n],n,e);else for(a in e)qu.call(e,a)&&(o===null?r(e[a],a,e):r.call(o,e[a],a,e))}});var is=I((Yd,as)=>{var ns=Object.prototype.toString;as.exports=function(e){var r=ns.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&ns.call(e.callee)==="[object Function]"),n}});var os=I((qd,ss)=>{(function(){"use strict";var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=rs(),n=is(),a=!{toString:null}.propertyIsEnumerable("toString"),i=function(){}.propertyIsEnumerable("prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],o;o=function(u){var c=u!==null&&typeof u=="object",h=e.call(u)==="[object Function]",f=n(u),d=[];if(!c&&!h&&!f)throw new TypeError("Object.keys called on a non-object");if(f)r(u,function(w){d.push(w)});else{var m,p=i&&h;for(m in u)!(p&&m==="prototype")&&t.call(u,m)&&d.push(m)}if(a){var R=u.constructor,g=R&&R.prototype===u;r(s,function(w){!(g&&w==="constructor")&&t.call(u,w)&&d.push(w)})}return d},ss.exports=o})()});var us=I((jd,ls)=>{ls.exports=Object.keys||os()});var fs=I((Bd,cs)=>{cs.exports=Hu;function Hu(t){return t!==null&&(typeof t=="object"||typeof t=="function")}});var Fn=I((Hd,ds)=>{var Gu=us(),zu=fs();ds.exports=Xu;function Xu(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];if(zu(r))for(var n=Gu(r),a=0;a<n.length;a++){var i=n[a];t[i]=r[i]}}return t}});var gs=I((Gd,ps)=>{"use strict";var ms={white:37,black:30,blue:34,cyan:36,green:32,magenta:35,red:31,yellow:33,brightBlack:90,brightRed:91,brightGreen:92,brightYellow:93,brightBlue:94,brightMagenta:95,brightCyan:96,brightWhite:97},hs={bgBlack:40,bgRed:41,bgGreen:42,bgYellow:43,bgBlue:44,bgMagenta:45,bgCyan:46,bgWhite:47,bgBrightBlack:100,bgBrightRed:101,bgBrightGreen:102,bgBrightYellow:103,bgBrightBlue:104,bgBrightMagenta:105,bgBrightCyan:106,bgBrightWhite:107},In={};Object.keys(ms).forEach(function(t){In[t]=function(e){return"\x1B["+ms[t]+"m"+e+"\x1B[39m"}});Object.keys(hs).forEach(function(t){In[t]=function(e){return"\x1B["+hs[t]+"m"+e+"\x1B[49m"}});ps.exports=In});var Ss=I((zd,ys)=>{"use strict";var Nn={reset:[0,22],bright:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],blink:[5,25],inverse:[7,27]},vs={};Object.keys(Nn).forEach(function(t){vs[t]=function(e){var r=Nn[t][0],n=Nn[t][1];return"\x1B["+r+"m"+e+"\x1B["+n+"m"}});ys.exports=vs});var Vs=I((Xd,Ps)=>{"use strict";var ws=require("util"),Oe=ws.format,Wu=require("http"),Qu=Fn(),Ju=gs(),Ku=Ss(),Zu=Qu(Ku,Ju),Es=1,_s=2,Ts=3,As=4,Cs=5,Ls=6,ec={long:Es,json:_s,inspect:Ts,simple:As,short:Cs,bunyan:Ls},ks=10,Os=20,xs=30,Ms=40,Fs=50,Is=60,Ds={trace:ks,debug:Os,info:xs,warn:Ms,error:Fs,fatal:Is},tc={},Ns={},$s={};Object.keys(Ds).forEach(function(t){var e=Ds[t];tc[e]=t,Ns[e]=t.toUpperCase(),$s[e]=(t.length===4?" ":"")+t.toUpperCase()});function bs(t){return!(t.v===null||t.level===null||t.name===null||t.hostname===null||t.pid===null||t.time===null||t.msg===null)}function ft(t){return"  "+t.split(/\r?\n/).join(`
  `)}function rc(t,e){if(!t)return"";var r=Zu[e];return r?r(t):t}function nc(t,e){return t}function Rs(t){switch(t){case ks:return"TRACE";case Os:return"DEBUG";case xs:return"INFO";case Ms:return"WARN";case Fs:return"ERROR";case Is:return"FATAL"}}Ps.exports=function(e,r){function n(k){var T="";if(k.header)T+=k.header.trimRight();else if(k.headers){k.statusCode&&(T+=Oe(`HTTP/1.1 %s %s
`,k.statusCode,Wu.STATUS_CODES[k.statusCode]));var b=k.headers;T+=Object.keys(b).map(function(y){return y+": "+b[y]}).join(`
`)}delete k.header,delete k.headers,delete k.statusCode,k.body&&(T+=`

`+(typeof k.body=="object"?JSON.stringify(k.body,null,2):k.body),delete k.body),k.trailer&&(T+=`
`+k.trailer),delete k.trailer,T&&w.push(ft(T)),Object.keys(k).forEach(function(y){e["res."+y]=k[y]})}var a=!1,i,s=e.line,o=r.color?rc:nc,l=isNaN(r.outputMode)?ec[r.outputMode]:r.outputMode;switch(l){case Cs:a=!0;case Es:if(!bs(e))return s+`
`;delete e.v,a&&e.time[10]=="T"?(i=e.time.substr(11),i=o(i,"brightBlack")):i=o("["+e.time+"]","brightBlack"),delete e.time;var u=e.name;delete e.name,e.component&&(u+="/"+e.component),delete e.component,a||(u+="/"+e.pid),delete e.pid;var c=$s[e.level]||"LVL"+e.level;if(r.color){var h=r.colorFromLevel||{10:"brightBlack",20:"brightBlack",30:"cyan",40:"magenta",50:"red",60:"inverse"};c=o(c,h[e.level])}delete e.level;var f="",d,m,p="";e.src&&e.src.file&&(d=e.src,d.func?f=Oe(" (%s:%d in %s)",d.file,d.line,d.func):f=Oe(" (%s:%d)",d.file,d.line),f=o(f,"green")),delete e.src;var R=e.hostname;delete e.hostname;var g=[],w=[];e.req_id&&g.push("req_id="+e.req_id),delete e.req_id;var O;if(e.msg.indexOf(`
`)!==-1?(O="",w.push(ft(o(e.msg,"cyan")))):O=" "+o(e.msg,"cyan"),delete e.msg,e.req&&typeof e.req=="object"){var A=e.req;delete e.req,m=A.headers,d=Oe("%s %s HTTP/%s%s",A.method,A.url,A.httpVersion||"1.1",m?`
`+Object.keys(m).map(function(k){return k+": "+m[k]}).join(`
`):""),delete A.url,delete A.method,delete A.httpVersion,delete A.headers,A.body&&(d+=`

`+(typeof A.body=="object"?JSON.stringify(A.body,null,2):A.body),delete A.body),A.trailers&&Object.keys(A.trailers)>0&&(d+=`
`+Object.keys(A.trailers).map(function(k){return k+": "+A.trailers[k]}).join(`
`)),delete A.trailers,w.push(ft(d)),Object.keys(A).forEach(function(k){e["req."+k]=A[k]})}if(e.client_req&&typeof e.client_req=="object"){var x=e.client_req;delete e.client_req,m=x.headers,d="",x.address&&(p="Host: "+x.address,x.port&&(p+=":"+x.port),p+=`
`),delete x.headers,delete x.address,delete x.port,d+=Oe(`%s %s HTTP/%s
%s%s`,x.method,x.url,x.httpVersion||"1.1",p,m?Object.keys(m).map(function(k){return k+": "+m[k]}).join(`
`):""),delete x.method,delete x.url,delete x.httpVersion,x.body&&(d+=`

`+(typeof x.body=="object"?JSON.stringify(x.body,null,2):x.body),delete x.body),Object.keys(x).forEach(function(k){e["client_req."+k]=x[k]}),w.push(ft(d))}e.res&&typeof e.res=="object"&&(n(e.res),delete e.res),e.client_res&&typeof e.client_res=="object"&&(n(e.client_res),delete e.res),e.err&&e.err.stack&&(w.push(ft(e.err.stack)),delete e.err);for(var V=Object.keys(e),P=0;P<V.length;P++){var F=V[P],L=e[F],j=!1;typeof L!="string"&&(L=JSON.stringify(L,null,2),j=!0),L.indexOf(`
`)!==-1||L.length>50?w.push(ft(F+": "+L)):!j&&(L.indexOf(" ")!=-1||L.length===0)?g.push(F+"="+JSON.stringify(L)):g.push(F+"="+L)}return g=o(g.length?" ("+g.join(", ")+")":"","brightBlack"),w=o(w.length?w.join(`
  --
`)+`
`:"","brightBlack"),a?Oe(`%s %s %s:%s%s
%s`,i,c,u,O,g,w):Oe(`%s %s: %s on %s%s:%s%s
%s`,i,c,u,R||"<no-hostname>",f,O,g,w);case Ts:return ws.inspect(e,!1,1/0,!0)+`
`;case Ls:return r.levelInString&&(e.level=Rs(e.level)),JSON.stringify(e,null,0)+`
`;case _s:return r.levelInString&&(e.level=Rs(e.level)),JSON.stringify(e,null,r.jsonIndent)+`
`;case As:return bs(e)?Oe(`%s - %s
`,Ns[e.level]||"LVL"+e.level,e.msg):s+`
`;default:throw new Error("unknown output mode: "+r.outputMode)}}});var qs=I((Wd,Ys)=>{"use strict";var ac=require("stream"),ic=require("util"),sc=Vs(),oc=Fn(),Us=ac.Writable;Ys.exports=xt;ic.inherits(xt,Us);function xt(t,e){if(!(this instanceof xt))return new xt(t,e);t=t||{},t.objectMode=!0,Us.call(this,t),this.opts=oc({outputMode:"short",color:!0,colorFromLevel:{10:"brightBlack",20:"brightBlack",30:"green",40:"magenta",50:"red",60:"brightRed"}},t),this.out=e||process.stdout}xt.prototype._write=function(t,e,r){var n;try{n=JSON.parse(t),this.out.write(sc(n,this.opts))}catch{this.out.write(t)}r()}});var Xs=I(($n,Pn)=>{(function(t,e){typeof $n=="object"&&typeof Pn<"u"?Pn.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_isBetween=e()})($n,function(){"use strict";return function(t,e,r){e.prototype.isBetween=function(n,a,i,s){var o=r(n),l=r(a),u=(s=s||"()")[0]==="(",c=s[1]===")";return(u?this.isAfter(o,i):!this.isBefore(o,i))&&(c?this.isBefore(l,i):!this.isAfter(l,i))||(u?this.isBefore(o,i):!this.isAfter(o,i))&&(c?this.isAfter(l,i):!this.isBefore(l,i))}}})});var $f={};Vo($f,{default:()=>yr});module.exports=Uo($f);var Wn={handleError:(t,e)=>{let r=Qn(t);return Yo(r,e)}},Yo=(t,e)=>{let r=Qn(t),n="FAILED",a;return r.userMessage.includes("TypeError:")&&(a="There is an issue in the client. This has been reported to admin staff"),r.userMessage.includes("The stored report or dashboard was not found.")&&(n="EXPIRED",a=`This ${e} has expired`),{status:n,developerMessage:r.developerMessage,userMessage:a||r.userMessage}},Qn=t=>{if(t&&t.data)return t.data;if(t&&t.message){let e=t;return{status:500,userMessage:`${e.name}: ${e.message}`,developerMessage:e.stack}}return t};var qo=t=>{let e=t.locals.csrfToken||"csrfToken",r=t.locals.user?.uuid?t.locals.user.uuid:"userId",n=t.locals.user?.token?t.locals.user.token:"token",a=t.locals.user?.activeCaseLoadId||"",i=t.locals.pathSuffix||"",s=t.locals.routePrefix||"",o=t.locals.definitions||[],l=t.locals.requestedReports||[],u=t.locals.recentlyViewedReports||[],c=t.locals.bookmarks||[],{bookmarkingEnabled:h,downloadingEnabled:f,definitionsPath:d,dpdPathFromQuery:m,dpdPathFromConfig:p,nestedBaseUrl:R}=t.locals;return{csrfToken:e,userId:r,token:n,definitions:o,requestedReports:l,recentlyViewedReports:u,bookmarks:c,bookmarkingEnabled:h,downloadingEnabled:f,dpdPathFromQuery:m,dpdPathFromConfig:p,definitionsPath:d,pathSuffix:i,routePrefix:s,activeCaseLoadId:a,nestedBaseUrl:R}},jo=(t,e)=>(e&&(t.query={...t.query,dataProductDefinitionsPath:e}),t.query),Y={getValues:qo,setDdpPathToReqQuery:jo};var xo=ee(Er());var _r="~clear~",Ho=(t,e,r)=>{let n;e?(n={...t,selectedPage:"1"},Object.keys(e).forEach(i=>{e[i]?n[i]=e[i]:Object.keys(n).filter(s=>s===i||s.startsWith(`${i}.`)).forEach(s=>{n[s]=_r})})):n={selectedPage:"1",pageSize:t.pageSize,sortColumn:t.sortColumn,sortedAsc:t.sortedAsc,dataProductDefinitionsPath:t.dataProductDefinitionsPath};let a={};return Object.keys(n).filter(i=>n[i]).forEach(i=>{a[i]=n[i]}),Go(a,r)},Go=(t,e)=>`?${Object.keys(t).flatMap(n=>{let a=e?.find(s=>`filters.${s.name}`===n),i=t[n];return Array.isArray(i)?i.map(s=>`${encodeURI(n)}=${encodeURI(s)}`):a&&a.filter.type.toLowerCase()==="Multiselect".toLowerCase()?i.split(",").map(o=>`${encodeURI(n)}=${encodeURI(o)}`):[`${encodeURI(n)}=${encodeURI(i)}`]}).join("&")}`,na=t=>t&&t!==""?`?dataProductDefinitionsPath=${t}`:"";var ht=Ho;var Xe=(t,e)=>t.includes(e)?t:t.concat(e);var zo=t=>t.filter(e=>e.mandatory).map(e=>e.name),Xo=t=>t.filter(e=>e.visible).map(e=>e.name),aa=(t,e)=>[...zo(t),...e].reduce(Xe,[]),Yt={getColumns:(t,e=null)=>{let{fields:r}=t;return{name:"columns",options:r.filter(a=>!t.sections||!t.sections.includes(a.name)).map(a=>({text:a.display,value:a.name,disabled:a.mandatory})),text:"Select report columns",value:aa(r,e??Xo(r))}},ensureMandatoryColumns:aa};var he="filters.",We=class{constructor({fields:e,template:r,queryParams:n,definitionsPath:a,filtersPrefix:i=he}){if(this.selectedPage=n.selectedPage?Number(n.selectedPage):1,this.pageSize=n.pageSize&&r?Number(n.pageSize):this.getDefaultPageSize(r),this.sortColumn=n.sortColumn?n.sortColumn.toString():this.getDefaultSortColumn(e),this.sortedAsc=n.sortedAsc!=="false",this.dataProductDefinitionsPath=a??(n.dataProductDefinitionsPath?n.dataProductDefinitionsPath.toString():null),this.filtersPrefix=i,n.columns){let u=typeof n.columns=="string"?n.columns.split(","):n.columns;this.columns=Yt.ensureMandatoryColumns(e,u)}else this.columns=e.filter(u=>u.visible).map(u=>u.name);let s,o,l=e.find(u=>u.type==="date"&&u.filter&&u.filter.type==="daterange"||u.type==="date"&&u.filter&&u.filter.type==="date");l&&({min:s,max:o}=l.filter),this.filters={},Object.keys(n).filter(u=>u.startsWith(this.filtersPrefix)).filter(u=>n[u]).forEach(u=>{let c=u.replace(this.filtersPrefix,""),h=n[u].toString();c.includes(".start")&&s&&new Date(h)<new Date(s)&&(h=s),c.includes(".end")&&o&&new Date(h)>new Date(o)&&(h=o),h!=="no-filter"&&(this.filters[c]=h)}),l&&l.filter.type==="daterange"&&(s&&Object.keys(n).some(u=>u.includes(this.filtersPrefix))&&Object.keys(n).every(u=>!u.includes(".start"))&&(this.filters[`${l.name}.start`]=s),o&&Object.keys(n).some(u=>u.includes(this.filtersPrefix))&&Object.keys(n).every(u=>!u.includes(".end"))&&(this.filters[`${l.name}.end`]=o)),l&&l.filter.type==="date"&&s&&Object.keys(n).some(u=>u.includes(this.filtersPrefix))&&Object.keys(n).every(u=>!u.includes(l.name))&&(this.filters[`${l.name}.start`]=s)}getDefaultSortColumn(e){let r=e.find(n=>n.defaultsort);return r?r.name:e.find(n=>n.sortable)?.name}toRecordWithFilterPrefix(e=!1){let r={selectedPage:this.selectedPage.toString(),pageSize:this.pageSize.toString(),sortColumn:this.sortColumn,sortedAsc:this.sortedAsc.toString(),columns:this.columns};return this.dataProductDefinitionsPath&&(r.dataProductDefinitionsPath=this.dataProductDefinitionsPath),Object.keys(this.filters).forEach(n=>{let a=this.filters[n];(!e||a!==_r)&&(r[`${this.filtersPrefix}${n}`]=a)}),r}getDefaultPageSize(e){switch(e){case"list-section":case"summary-section":case"row-section-child":case"parent-child":return 5e4;default:return 20}}};var qe=ee(Fe()),Hs=ee(Qe());var js=ee(es()),Bs=ee(qs()),lc=(0,Bs.default)({outputMode:"short",color:!1}),uc=js.default.createLogger({name:"Digital Prison Reporting:",stream:lc,level:"debug"}),ce=uc;var je=class{constructor(){this.isoDateRegEx=/^(\d{4}[/-](0?[1-9]|1[012])[/-](0?[1-9]|[12][0-9]|3[01]))/;this.localDateRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{4}$/;this.localDateShortYearRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{2}$/;this.localDateTimeRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{4} [0-2]\d:[0-5]\d$/;this.localDateTimeShortYearRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{2} [0-2]\d:[0-5]\d$/;this.isoFormat="YYYY-MM-DD";this.localDateFormatInput="D/M/YYYY";this.localDateFormatOutput="DD/MM/YYYY";this.localDateShortYearFormatInput="D/M/YY";this.localDateShortYearFormatOutput="DD/MM/YY";this.localDateTimeFormatInput="D/M/YYYY HH:mm";this.localDateTimeFormatOutput="DD/MM/YYYY HH:mm";this.localDateTimeShortYearFormatInput="D/M/YY HH:mm";this.localDateTimeShortYearFormatOutput="DD/MM/YY HH:mm"}getDateType(e){if(e&&e.match){if(e.match(this.isoDateRegEx))return"iso";if(e.match(this.localDateRegEx))return"local-date";if(e.match(this.localDateShortYearRegEx))return"local-date-short-year";if(e.match(this.localDateTimeRegEx))return"local-datetime";if(e.match(this.localDateTimeShortYearRegEx))return"local-datetime-short-year"}return"none"}getDateWrapper(e){switch(qe.default.extend(Hs.default),this.getDateType(e)){case"iso":return(0,qe.default)(e);case"local-date":return(0,qe.default)(e,this.localDateFormatInput);case"local-date-short-year":return(0,qe.default)(e,this.localDateShortYearFormatInput);case"local-datetime":return(0,qe.default)(e,this.localDateTimeFormatInput);case"local-datetime-short-year":return(0,qe.default)(e,this.localDateTimeShortYearFormatInput);default:return null}}isDate(e){return this.getDateType(e)!=="none"}toDateString(e,r){let n=this.getDateWrapper(e);if(n)switch(r){case"iso":return n.format(this.isoFormat);case"local-date":return n.format(this.localDateFormatOutput);case"local-date-short-year":return n.format(this.localDateShortYearFormatOutput);case"local-datetime":return n.format(this.localDateTimeFormatOutput);case"local-datetime-short-year":return n.format(this.localDateTimeShortYearFormatOutput);default:return ce.warn(`Invalid date type: ${r}`),null}return e&&ce.warn(`Could not map non-date value : ${e}`),null}};var de=class{constructor(e,r=!1){this.columns=[];this.reportSummaries={};this.reportQuery=null;this.currentQueryParams=null;this.dateMapper=new je;this.fields=e,this.sortData=r}mapDate(e){return e?this.dateMapper.toDateString(e,"local-datetime-short-year"):""}mapBoolean(e){return e?e.substring(0,1).toUpperCase()+e.substring(1).toLowerCase():""}mapRow(e,r="",n=[]){return this.fields.filter(a=>this.columns.includes(a.name)).map(a=>{let s=n.find(o=>o.name===a.name)??a;return this.mapCell(s,e,r)})}mapCell(e,r,n=""){let a=this.mapCellValue(e,r[e.name]),i="string",s=n;e.wordWrap&&(s+=` data-table-cell-wrap-${e.wordWrap.toLowerCase()}`),e.header&&(s+=" govuk-table__header"),(e.type==="double"||e.type==="long")&&(i="numeric");let o=e.type==="HTML";return{fieldName:e.name,...o?{html:a}:{text:a},format:i,classes:s.trim()}}mapCellValue(e,r){if(e.calculated)return r;switch(e.type){case"boolean":return this.mapBoolean(r);case"date":case"time":return this.mapDate(r);default:return r}}mapHeader(e=!1,r=null){return this.fields.filter(n=>this.columns.includes(n.name)).map(n=>{if(this.reportQuery&&!e&&n.sortable){let a="none",i=ht(this.currentQueryParams,{sortColumn:n.name,sortedAsc:"true"});return n.name===this.reportQuery.sortColumn&&(a=this.reportQuery.sortedAsc?"ascending":"descending",this.reportQuery.sortedAsc&&(i=ht(this.currentQueryParams,{sortColumn:n.name,sortedAsc:"false"}))),{html:`<a data-column="${n.name}" class="data-table-header-button data-table-header-button-sort-${a}" href="${i}">${n.display}</a>`,classes:r}}return{text:n.display,classes:r}})}mapData(e){let r=this.mapSummary("table-header"),n=this.mergeCells(e.map(i=>this.mapRow(i))),a=this.mapSummary("table-footer");return r.concat(n).concat(a)}mergeCells(e){let r=this.fields.filter(a=>a.mergeRows).map(a=>a.name);if(r.length===0)return e;let n={};return r.forEach(a=>{n[a]=e.reduce((i,s)=>{let o=this.getCellByFieldName(s,a),l=o.text??o.html;return{...i,[l]:(i[l]??0)+1}},{})}),e.map(a=>{let i=[...a];return r.forEach(s=>{let o=this.getCellByFieldName(a,s),l=o.text??o.html,u=n[s][l];switch(u){case-1:i=i.filter(c=>c.fieldName!==s);break;case 1:break;default:o.rowspan=u,n[s][l]=-1}}),i})}getCellByFieldName(e,r){return e.find(n=>n.fieldName===r)}mapSummary(e){return this.reportSummaries[e]?this.reportSummaries[e].flatMap(r=>r.data.map(n=>this.mapRow(n,`dpr-report-summary-cell dpr-report-summary-cell-${e}`,r.fields))):[]}sort(e){return this.appendSortKeyToData(e).sort(this.sortKeyComparison()).map(r=>({...r}))}sortKeyComparison(){return(e,r)=>{let n=e.sortKey,a=r.sortKey;return n===a?0:n<a?-1:1}}appendSortKeyToData(e,r=null){let n=r||this.fields;return e.map(a=>{let i=this.getSortKey(a,n);return{...a,sortKey:i}})}mapNamesToFields(e){return e.map(r=>this.fields.find(n=>n.name===r))}getSortKey(e,r){return r.map(n=>{let a=e[n.name];return a===null?"zzzzzzzz":this.dateMapper.isDate(a)?this.dateMapper.toDateString(a,"iso"):this.mapCellValue(n,a)}).join("-").toLowerCase()}convertDataTableToHtml(e){let r=e.head.map(a=>`<th scope='col' class='govuk-table__header'>${a.html??a.text}</th>`),n=e.rows.map(a=>`<tr class='govuk-table__row'>${a.map(i=>`<td class='govuk-table__cell govuk-table__cell--${i.format} ${i.classes}'>${i.html??i.text}</td>`).join("")}</tr>`);return`<table class='govuk-table'><thead class='govuk-table__head'>${r.join("")}</thead><tbody class='govuk-table__body'>${n.join("")}</tbody></table>`}withHeaderOptions({reportQuery:e,columns:r,interactive:n}){return n?this.withHeaderSortOptions(e):this.withNoHeaderOptions(r)}withHeaderSortOptions(e){return this.reportQuery=e,this.columns=e.columns,this.currentQueryParams=this.reportQuery.toRecordWithFilterPrefix(),this}withNoHeaderOptions(e){return this.columns=e,this}buildTable(e){let r=this.mapData(this.sortData?this.sort(e):e);return{head:this.mapHeader(),rows:r,rowCount:e.length,colCount:this.columns.length}}withSummaries(e){return this.reportSummaries=e,this}withSortedData(e=!0){return this.sortData=e,this}};var Be=class extends de{constructor(e,r){let n=e.fields.filter(i=>!r||!r.includes(i.name)).map(i=>i.name),a=e.fields.map(i=>({...i,calculated:!1,sortable:!1,defaultsort:!1,mandatory:!0,visible:!0}));super(a,!0),this.summary=e,this.columns=n}buildSummaryTable(){return super.buildTable(this.summary.data)}};var xe=class{constructor(e,r){this.pageSummaryTemplates=["page-header","page-footer"];this.dataTableSummaryTemplates=["section-footer","section-header","table-footer","table-header"];this.specification=e,this.summaries=r}collatePageSummaries(){return this.collateAndMapToDataTable(this.pageSummaryTemplates)}collateDataTableSummaries(){return this.collate(this.dataTableSummaryTemplates)}collateAndMapToDataTable(e=[]){let r=this.collate(e);return this.mapToDataTables(r)}collate(e=this.pageSummaryTemplates){let r={};return this.summaries&&this.summaries.forEach(n=>{e.includes(n.template)&&(r[n.template]||(r[n.template]=[]),r[n.template].push(n))}),r}mapToDataTables(e){let r={};return Object.keys(e).forEach(n=>{r[n]=e[n].map(a=>new Be(a,this.specification.sections).buildSummaryTable())}),r}};var fr="selectedPage",cc="pageSize",fc=1,dc=20,mc=(t,e,r,n,a)=>{let i=Math.ceil(r/n),s=[];return Array(i).fill(0).forEach((o,l)=>{let u=l+1;e.set(fr,`${u}`),u===1||u===i||u>=a-1&&u<=a+1?s.push({number:u,href:`${t}?${e.toString()}`,current:u===a}):(u===2||u===i-1)&&s.push({ellipsis:!0})}),{pages:s,pagesLength:i}},hc=(t,e,r,n,a)=>{let i=new URLSearchParams(e);if(n>0){if(a===r)return;let s=a+1;return i.set(fr,`${s}`),`${t}?${i.toString()}`}},pc=(t,e,r)=>{let n=new URLSearchParams(e);if(r===1)return;let a=r-1;return n.set(fr,`${a}`),`${t}?${n.toString()}`},gc=t=>{let e=[10,20,100,200,t];return e.map((r,n)=>n===e.length-1?{value:t,text:"All"}:{value:r,text:r.toString()})},Gs={getPaginationData:(t,e,r)=>{let{search:n}=t,a=n?r.originalUrl.split(n)[0]:r.originalUrl,i=new URLSearchParams(n),s=+i.get(cc)||dc,o=+i.get(fr)||fc,{pages:l,pagesLength:u}=mc(a,i,e,s,o);return{next:hc(a,n,u,e,o),prev:pc(a,n,o),pages:l,pageSize:s,currentPage:o,totalRows:e,sizes:gc(e)}}};var zs={getTotals:(t,e,r,n)=>{let a="",i=(e-1)*t,s=i+n;return i===0&&r===s?a=r===1?`${r} total result`:`${r} total results`:a=r>0?`Showing <strong>${i+1}</strong> to <strong>${s}</strong> of <strong>${r}</strong> results`:"0-0 of 0",a}};var oe=ee(Fe()),Js=ee(Qe()),Ks=ee(Xs());var Vn=(t,e,r)=>{let{min:n,max:a}=t,i;n?i=Ws(n,e):i=e;let s;return a?s=Qs(a,r):s=r,{start:i,end:s}},Ws=(t,e)=>{let r=new Date(t);return new Date(e)<r?t:e},Qs=(t,e)=>{let r=new Date(t);return new Date(e)>r?t:e},vc=t=>{let{min:e,max:r,defaultValue:n}=t,a,i;e&&(a=e),r&&(i=r);let s=/^\d{1,4}-\d{1,2}-\d{2,2} - \d{1,4}-\d{1,2}-\d{1,2}$/,o;return n&&n.match(s)?([a,i]=n.split(" - "),o=Vn(t,a,i)):n?o=n:o=Vn(t,a,i),o};function yc(t){return t.start!==void 0||t.end!==void 0}var He={compareMax:Qs,compareMin:Ws,isDateRange:yc,setDateRangeValuesWithinMinMax:Vn,getStartAndEndValueFromDefinition:vc};oe.default.extend(Js.default);var Sc=(t,e,r,n)=>{oe.default.extend(Ks.default);let a=(0,oe.default)(r),i=(0,oe.default)(n),s=t?t.isBetween(a,i,"day","[]"):!0,o=e?e.isBetween(a,i,"day","[]"):!0;return s&&o},Zs=t=>{let e,r;switch(t){case"none":e="",r="";break;case"yesterday":e=(0,oe.default)(),r=e.subtract(1,"day");break;case"tomorrow":r=(0,oe.default)(),e=r.add(1,"day");break;case"last-week":e=(0,oe.default)(),r=e.subtract(1,"week");break;case"next-week":r=(0,oe.default)(),e=r.add(1,"week");break;case"last-month":e=(0,oe.default)(),r=e.subtract(1,"month");break;case"next-month":r=(0,oe.default)(),e=r.add(1,"month");break;default:break}return{endDate:e,startDate:r}},Dc=(t,e,r)=>{let n=e.query[`${r}${t.name}.start`],a=e.query[`${r}${t.name}.end`],i=e.query[`${r}${t.name}.relative-duration`];return{start:n||t.min,end:a||t.max,...i&&{relative:i}}},bc=(t,e)=>{let r=e.split(".")[0],n=Object.keys(t.body).filter(i=>i.includes(r)).map(i=>({name:i,value:t.body[i]})),a={start:"",end:""};return n.forEach(i=>{i.name.includes("start")&&(a.start=i.value),i.name.includes("end")&&(a.end=i.value)}),{value:a,name:r}},Rc=(t,e)=>{let r={start:"",end:""},{start:n,end:a}=t.value;return n&&(r.start=(0,oe.default)(n,"D/M/YYYY").format("YYYY-MM-DD").toString()),a&&(r.end=(0,oe.default)(a,"D/M/YYYY").format("YYYY-MM-DD").toString()),{...e,value:r}},eo=(t,e)=>{t||(t="1977-05-25"),e||(e="9999-01-01");let r=to();return r.forEach(n=>{if(n.value){let{endDate:a,startDate:i}=Zs(n.value);Sc(i,a,t,e)||(n.disabled=!0)}}),r.filter(n=>n.value!=="none").every(n=>n.value===null||n.disabled)&&(r=[]),r},wc=t=>{let r=to().find(n=>n.value===t);return r?r.text:""},to=()=>[{value:"none",text:"None"},{value:"yesterday",text:"Yesterday"},{value:"tomorrow",text:"Tomorrow"},{value:"last-week",text:"Last week"},{value:"next-week",text:"Next week"},{value:"last-month",text:"Last month"},{value:"next-month",text:"Next month"}],Ec=(t,e)=>{let r=He.getStartAndEndValueFromDefinition(t),n=eo(t.min,t.max);return{...e,min:t.min,max:t.max,relativeOptions:n,value:r}},_c=(t,e,r)=>{let n=t.defaultValue.split(" - "),a;return n.length>=1&&(a=`${r}${e}.start=${n[0]}`,n.length>=2&&(a=`${a}&${r}${e}.end=${n[1]}`)),a},Ee={calcDates:Zs,getRelativeDateOptions:eo,getFilterFromDefinition:Ec,setValueFromRequest:Dc,getQueryFromDefinition:_c,mapRelativeValue:wc,setDefaultValue:bc,setFilterValueFromDefault:Rc};var Tc=(t,e)=>{let r=[void 0,null,""];return t.filter(n=>n.value&&Object.prototype.hasOwnProperty.call(n.value,"start")&&!r.includes(n.value.start)||n.value&&Object.prototype.hasOwnProperty.call(n.value,"end")&&!r.includes(n.value.end)||n.value&&!Object.prototype.hasOwnProperty.call(n.value,"start")&&!Object.prototype.hasOwnProperty.call(n.value,"end")).filter(n=>n.value&&n.value!=="no-filter").map(n=>{let a=`${n.value}`,i=[`"${a}"`],s=[`${e}${n.name}`],o="",l=!1,u;n.type.toLowerCase()==="DateRange".toLowerCase()&&({key:s,value:i,disabled:l,cantRemoveClass:o,displayValue:a,constraints:u}=ro(n,e)),n.type.toLowerCase()==="GranularDateRange".toLowerCase()&&({key:s,value:i,disabled:l,cantRemoveClass:o,displayValue:a,constraints:u}=io(n,e)),n.type.toLowerCase()==="Date".toLowerCase()&&({key:s,value:i,disabled:l,cantRemoveClass:o,displayValue:a,constraints:u}=Ac(n,e)),(n.type.toLowerCase()==="Autocomplete".toLowerCase()||n.type.toLowerCase()==="Radio".toLowerCase()||n.type.toLowerCase()==="Select".toLowerCase())&&({key:s,value:i,displayValue:a}=no(n,e)),n.type.toLowerCase()==="Multiselect".toLowerCase()&&({key:s,value:i,displayValue:a}=ao(n,e));let c;return l?c=`Selected Filter: ${n.text}: ${a}. This filter cant be removed. Update the filter input to change the value`:c=`Selected Filter: ${n.text}: ${a}. Click to clear this filter`,{text:n.text,displayValue:a,key:JSON.stringify(s),value:i,disabled:l,constraints:u,classes:`interactive-remove-filter-button${o}`,attributes:{"aria-label":c}}})},ro=(t,e)=>{let r=t.value.start||"Open start",n=t.value.end||"Open end",a=`${e}${t.name}`,i=[`${a}.start`,`${a}.end`],s=[`"${r}"`,`"${n}"`],o=`${r} - ${n}`;t.value.relative&&(i.push(`${a}.relative-duration`),s.push(`"${t.value.relative}"`),o=Ee.mapRelativeValue(t.value.relative));let l=Un(t,i),{disabled:u,cantRemoveClass:c,displayValue:h}=so(t,s,o);return{key:i,value:s,displayValue:h||o,disabled:u,cantRemoveClass:c,constraints:l}},Un=(t,e,r=!1)=>{let n=[],{min:a,max:i}=t;return a&&n.push({key:e[0],value:a}),i&&!r&&n.push({key:e[1],value:i}),n.length?n:void 0},no=(t,e)=>{let n=t.options.find(s=>s.value===t.value).text,a=[`${e}${t.name}`],i=[`"${t.value}"`];return{key:a,value:i,displayValue:n}},ao=(t,e)=>{let n=t.value.split(","),a=n.map(o=>t.options.find(u=>u.value===o).text).filter((o,l)=>l<3).join(", ");a=n.length>3?`${a} + ${n.length-3} more`:a;let i=n.map(o=>`"${o}"`);return{key:[`${e}${t.name}`],value:i,displayValue:a}},io=(t,e)=>{let r=t.value.start||"Open start",n=t.value.end||"Open end",a=t.value.quickFilter?.value,i=`${e}${t.name}`,s=[`${i}.start`,`${i}.end`,`${i}.granularity`],o=[`"${r}"`,`"${n}"`,`"${t.value.granularity.value}"`],l=Un(t,s),u,c=t.value.granularity.display;a&&a!=="none"?(s.push(`${i}.quick-filter`),o.push(`"${t.value.quickFilter.value}"`),u=`${t.value.quickFilter.display}: ${c}`):u=`${r} - ${n}: ${c}`;let{disabled:h,cantRemoveClass:f,displayValue:d}=so(t,o,u);return{key:s,value:o,displayValue:d||u,disabled:h,constraints:l,cantRemoveClass:f}},Ac=(t,e)=>{let r=[`${e}${t.name}`],n=`${t.value}`,a=[`"${n}"`],i=Un(t,r,!0),{disabled:s,cantRemoveClass:o,displayValue:l}=Cc(t,a,n);return{key:r,value:a,displayValue:l||n,disabled:s,constraints:i,cantRemoveClass:o}},so=(t,e,r)=>{let{min:n,max:a}=t;return n&&e[0].includes(n)&&a&&e[1].includes(a)?{disabled:!0,cantRemoveClass:" interactive-remove-filter-button--disabled",displayValue:`${r} (maximum range)`}:{disabled:!1,cantRemoveClass:"",displayValue:r}},Cc=(t,e,r)=>{let{min:n,max:a}=t;if(n&&e[0].includes(n)||a&&e[0].includes(a)){let i;return e[0].includes(n)&&(i="min"),e[0].includes(a)&&(i="max"),{disabled:!0,cantRemoveClass:" interactive-remove-filter-button--disabled",displayValue:`${r} (${i} date)`}}return{disabled:!1,cantRemoveClass:"",displayValue:r}},Lc=(t,e)=>{let{query:r}=t,n="filters.";return e.filter(a=>r[`filters.${a.name}`]||r[`filters.${a.name}.start`]||r[`filters.${a.name}.end`]).map(a=>{let{value:i}=a;return a.type.toLowerCase()==="Multiselect".toLowerCase()&&(i=ao(a,"filters").displayValue),(a.type.toLowerCase()==="Autocomplete".toLowerCase()||a.type.toLowerCase()==="Radio".toLowerCase()||a.type.toLowerCase()==="Select".toLowerCase())&&(i=no(a,n).displayValue),a.type.toLowerCase()==="DateRange".toLowerCase()&&(i=ro(a,n).displayValue),a.type.toLowerCase()==="GranularDateRange".toLowerCase()&&(i=io(a,n).displayValue),{id:a.name,name:a.text,value:i}})},dr={getSelectedFilters:Tc,getQuerySummary:Lc};var Yn=ee(Fe()),oo=ee(Qe());Yn.default.extend(oo.default);var lo=t=>{let{defaultValue:e,min:r,max:n}=t,a;return e&&(a=e,r&&(a=He.compareMin(r,a)),n&&(a=He.compareMax(n,a))),a},kc=(t,e,r)=>{let{min:n,max:a,mandatory:i}=t,s=e.query[`${r}${t.name}`],o=s;return i&&!s&&(o=n||a||"1977-05-25"),o},Oc=(t,e)=>{let r=t.value?(0,Yn.default)(t.value,"D/M/YYYY").format("YYYY-MM-DD").toString():"";return{...e,value:r}},xc=(t,e)=>({...e,value:lo(t),min:t.min,max:t.max}),mr={setDateValueWithinMinMax:lo,getFilterFromDefinition:xc,setValueFromRequest:kc,setFilterValueFromDefault:Oc};var N=ee(Fe()),uo=ee(Qe());N.default.extend(uo.default);var qn=(t,e,r)=>{let n,a;switch(t){case"daily":n=!1,a=!1;break;case"monthly":{let i=(0,N.default)(e).startOf("month"),s=(0,N.default)(r).endOf("month");n=!i.isSame(e,"day"),a=!s.isSame(r,"day")}break;case"annually":{let i=(0,N.default)(e).startOf("year"),s=(0,N.default)(r).endOf("year");n=!i.isSame(e,"day"),a=!s.isSame(r,"day")}break;default:n=!1,a=!1;break}return{start:n,end:a}},jn=()=>[{value:"none",text:"None"},{value:"today",text:"Today"},{value:"past",text:"Past:",disabled:!0},{value:"yesterday",text:"Yesterday"},{value:"last-seven-days",text:"Last 7 days"},{value:"last-thirty-days",text:"Last 30 days"},{value:"last-month",text:"Last month"},{value:"last-full-month",text:"Last full month"},{value:"last-ninety-days",text:"Last 90 days"},{value:"last-three-months",text:"Last 3 months"},{value:"last-full-three-months",text:"Last full 3 months"},{value:"last-six-months",text:"Last 6 months"},{value:"last-full-six-months",text:"Last full 6 months"},{value:"last-year",text:"Last year"},{value:"last-full-year",text:"Last full year"},{value:"future",text:"Future:",disabled:!0},{value:"tomorrow",text:"Tomorrow"},{value:"next-seven-days",text:"Next 7 days"},{value:"next-thirty-days",text:"Next 30 days"},{value:"next-month",text:"Next month"},{value:"next-full-month",text:"Next full month"},{value:"next-ninety-days",text:"Next 90 days"},{value:"next-three-months",text:"Next 3 months"},{value:"next-full-three-months",text:"Next full 3 months"},{value:"next-six-months",text:"Next 6 months"},{value:"next-full-six-months",text:"Next full 6 months"},{value:"next-year",text:"Next year"},{value:"next-full-year",text:"Next full year"}],Bn=()=>[{value:"hourly",text:"Hourly"},{value:"daily",text:"Daily"},{value:"monthly",text:"Monthly"},{value:"annually",text:"Annually"}],Mc=(t,e)=>{let r=e,n=["annually","monthly"],a=["annually"];return t.includes("month")&&a.includes(t)&&(r="monthly"),t.includes("day")&&n.includes(t)&&(r="daily"),r},Hn=t=>{let e,r,n;switch(t){case"today":r=(0,N.default)(),e=(0,N.default)(),n="daily";break;case"yesterday":r=(0,N.default)().subtract(1,"day"),e=(0,N.default)().subtract(1,"day"),n="daily";break;case"last-seven-days":r=(0,N.default)(),e=r.subtract(7,"day").add(1,"day"),n="daily";break;case"last-thirty-days":r=(0,N.default)(),e=r.subtract(30,"day").add(1,"day"),n="daily";break;case"last-month":r=(0,N.default)(),e=r.subtract(1,"month").add(1,"day"),n="monthly";break;case"last-full-month":r=(0,N.default)().subtract(1,"month").endOf("month"),e=r.startOf("month"),n="monthly";break;case"last-ninety-days":r=(0,N.default)(),e=r.subtract(90,"day").add(1,"day"),n="daily";break;case"last-three-months":r=(0,N.default)(),e=r.subtract(3,"month").add(1,"day"),n="monthly";break;case"last-full-three-months":r=(0,N.default)().subtract(1,"month").endOf("month"),e=r.subtract(2,"month").startOf("month"),n="monthly";break;case"last-six-months":r=(0,N.default)(),e=r.subtract(6,"month").add(1,"day"),n="monthly";break;case"last-full-six-months":r=(0,N.default)().subtract(1,"month").endOf("month"),e=r.subtract(6,"month").startOf("month"),n="monthly";break;case"last-year":r=(0,N.default)(),e=r.subtract(1,"year").add(1,"day"),n="annually";break;case"last-full-year":r=(0,N.default)().subtract(1,"year").endOf("year"),e=r.startOf("year"),n="annually";break;case"tomorrow":r=(0,N.default)().add(1,"day"),e=(0,N.default)().add(1,"day"),n="daily";break;case"next-seven-days":e=(0,N.default)(),r=(0,N.default)().add(7,"day").subtract(1,"day"),n="daily";break;case"next-thirty-days":e=(0,N.default)(),r=(0,N.default)().add(30,"day").subtract(1,"day"),n="daily";break;case"next-month":e=(0,N.default)(),r=(0,N.default)().add(1,"month").subtract(1,"day"),n="monthly";break;case"next-full-month":e=(0,N.default)().add(1,"month").startOf("month"),r=e.endOf("month"),n="monthly";break;case"next-ninety-days":e=(0,N.default)(),r=(0,N.default)().add(90,"day").subtract(1,"day"),n="daily";break;case"next-three-months":e=(0,N.default)(),r=(0,N.default)().add(3,"month").subtract(1,"day"),n="monthly";break;case"next-full-three-months":e=(0,N.default)().add(1,"month").startOf("month"),r=e.add(2,"month").endOf("month"),n="monthly";break;case"next-year":e=(0,N.default)(),r=(0,N.default)().add(1,"year").subtract(1,"day"),n="annually";break;case"next-full-year":e=(0,N.default)().add(1,"year").startOf("year"),r=e.endOf("year"),n="annually";break;default:r=(0,N.default)(),e=(0,N.default)(),n="daily";break}return{start:e.format("YYYY-MM-DD").toString(),end:r.format("YYYY-MM-DD").toString(),granularity:n}},Mt=(t,e)=>e.find(n=>n.value===t).text||t,Fc=(t,e,r)=>{let{preventDefault:n}=e.query,a=e.query[`${r}${t.name}.quick-filter`],i=e.query[`${r}${t.name}.granularity`],s,o;a&&a!=="none"?({start:s,end:o}=Hn(a),i=Mc(a,i)):(i=e.query[`${r}${t.name}.granularity`],s=e.query[`${r}${t.name}.start`],o=e.query[`${r}${t.name}.end`]);let l=n?null:t.value?.start,u=n?null:t.value?.end,c=n?"daily":t.value?.granularity.value,h=n?"none":t.value?.quickFilter.value,f=Bn(),d=jn(),m=s||l||t.min,p=o||u||t.max,R=i||c,g=a||h;return{start:m,end:p,granularity:{value:R,display:Mt(R,f)},quickFilter:{value:g,display:Mt(g,d)},partialDate:{...qn(R,m,p)}}},Ic=(t,e)=>{let r=e.split(".")[0],n=Object.keys(t.body).filter(i=>i.includes(r)).map(i=>({name:i,value:t.body[i]})),a={start:"",end:"",granularity:null,quickFilter:null};return n.forEach(i=>{i.name.includes("start")&&(a.start=i.value),i.name.includes("end")&&(a.end=i.value),i.name.includes("granularity")&&(a.granularity=i.value),i.name.includes("granularity")&&(a.quickFilter=i.value)}),a=a.start!==""&&a.end!==""&&a.granularity&&a.quickFilter?a:"",{value:a,name:r}},Nc=(t,e)=>{let{granularity:r,quickFilter:n,start:a,end:i}=t.value,s={start:a?(0,N.default)(a,"D/M/YYYY").format("YYYY-MM-DD").toString():"",end:i?(0,N.default)(i,"D/M/YYYY").format("YYYY-MM-DD").toString():"",granularity:{value:r,display:e.granularityOptions.find(o=>o.value===r)?.text},quickFilter:{value:n,display:e.quickFilterOptions.find(o=>o.value===n)?.text}};return{...e,value:s}},$c=(t,e)=>{let r,n=t.defaultQuickFilterValue,a=Bn(),i=jn();if(n){let{start:s,end:o,granularity:l}=Hn(n);r={start:s,end:o,granularity:{value:l,display:Mt(l,a)},quickFilter:{value:n,display:Mt(n,i)},partialDate:{...qn(l,s,o)}}}else{r=He.getStartAndEndValueFromDefinition(t);let s=r.granularity?r.granularity.value:t.defaultGranularity||"daily";r={...r,granularity:{value:s,display:Mt(s,a)},quickFilter:{value:"none",display:"None"},partialDate:{...qn(s,r.start,r.end)}}}return{...e,min:t.min,max:t.max,value:r,quickFilterOptions:jn(),granularityOptions:Bn()}},Pc=(t,e,r,n)=>{let a=[];if(t.defaultQuickFilterValue){let{start:i,end:s,granularity:o}=Hn(t.defaultQuickFilterValue);a.push(`${r}${e}.quick-filter=${t.defaultQuickFilterValue}`),a.push(`${r}${e}.granularity=${o}`),a.push(`${r}${e}.start=${i}`),a.push(`${r}${e}.end=${s}`)}else t.defaultGranularity&&n?(a.push(`${r}${e}.granularity=${t.defaultGranularity}`),a.push(`${n}`)):t.defaultGranularity&&a.push(`${r}${e}.granularity=${t.defaultGranularity}`);return a.join("&")},dt={getFilterFromDefinition:$c,setValueFromRequest:Fc,getQueryFromDefinition:Pc,setDefaultValue:Ic,setFilterValueFromDefault:Nc};var Vc=(t,e,r)=>{let n=e.query[`${r}${t.name}`],a,i;return n?.length&&(a=Array.isArray(n)?n:[n],i=a.join(",")),{requestfilterValue:i||null,requestfilterValues:a||[]}},Uc=(t,e,r)=>(t.defaultValue?t.defaultValue.split(","):[]).map(a=>`${r}${e}=${a}`).join("&"),Yc=(t,e)=>{let n=t.value.split(","),a=n.map(o=>t.options.find(u=>u.value===o).text).filter((o,l)=>l<3).join(", ");a=n.length>3?`${a} + ${n.length-3} more`:a;let i=n.map(o=>`"${o}"`);return{key:[`${e}${t.name}`],value:i,displayValue:a}},Gn={getQueryFromDefinition:Uc,setValueFromRequest:Vc,getMultiselectValues:Yc};var co=(t,e,r="filters.")=>{let{preventDefault:n}=e.query;return Object.keys(e.query).every(a=>!a.includes(r))&&!n?t:t.map(a=>{let i,s;a.type.toLowerCase()==="DateRange".toLowerCase()?i=Ee.setValueFromRequest(a,e,r):a.type.toLowerCase()==="GranularDateRange".toLowerCase()?i=dt.setValueFromRequest(a,e,r):a.type.toLowerCase()==="Date".toLowerCase()?i=mr.setValueFromRequest(a,e,r):a.type.toLowerCase()==="Multiselect".toLowerCase()?{requestfilterValue:i,requestfilterValues:s}=Gn.setValueFromRequest(a,e,r):i=e.query[`${r}${a.name}`];let o=null;return i?o=i:n&&(o=null),{...a,value:o,...s&&{values:s}}})},qc=(t,e)=>{let r=t.some(n=>e.findIndex(i=>i.name===n.name)!==-1);return t.map(n=>{let a=e.find(o=>o.name===n.name),i={...n},s=n.type.toLocaleLowerCase();if(s==="Multiselect".toLocaleLowerCase()){let o=r?"":i.value;o=a?a.value:o;let l=r?[]:i.values;l=a?a.value.split(","):l,i={...i,value:o,values:l}}else if(s==="Date".toLocaleLowerCase()){let o=r?"":i.value;a=a||{...a,value:o},i=mr.setFilterValueFromDefault(a,i)}else if(s==="DateRange".toLocaleLowerCase()){let o=r?{start:"",end:""}:i.value;a=a||{...a,value:o},i=Ee.setFilterValueFromDefault(a,i)}else if(s==="GranularDateRange".toLocaleLowerCase()){let o=r?{start:"",end:"",granularity:"",quickFilter:""}:i.value;a=a||{...a,value:o},i=dt.setFilterValueFromDefault(a,i)}else{let o=r?"":i.value;o=a?a.value:o,i={...n,value:o}}return i})},jc=(t,e)=>{let r=t.filter(n=>n.filter);return e&&(r=r.filter(n=>n.filter.interactive)),r.filter(n=>n.filter&&n.filter.defaultValue).map(n=>{let{filter:a}=n;if(a.type.toLowerCase()==="DateRange".toLowerCase())return Ee.getQueryFromDefinition(a,n.name,he);if(a.type.toLowerCase()==="Multiselect".toLowerCase())return Gn.getQueryFromDefinition(a,n.name,he);if(a.type.toLowerCase()==="GranularDateRange".toLowerCase()){let i=Ee.getQueryFromDefinition(a,n.name,he);return dt.getQueryFromDefinition(a,n.name,he,i)}return`${he}${n.name}=${a.defaultValue}`}).join("&")},Bc=async(t,e,r)=>{let{token:n,definitionsPath:a}=Y.getValues(e),{reportId:i,id:s,type:o}=t.body,u=await(o==="report"?r.reportingService:r.dashboardService).getDefinition(n,i,s,a),c=o==="report"?u.variant.specification.fields:u.filterFields,h=Object.keys(t.body).filter(d=>d.includes("filters.")).map(d=>({name:d.replace("filters.",""),value:t.body[d]})).map(d=>{let m=d.name.split(".")[0],p=c.find(w=>w.name===m),{value:R,name:g}=d;if(p){let w=p.filter?.type.toLocaleLowerCase();w==="Multiselect".toLocaleLowerCase()&&(R=d.value.join(",")),w==="DateRange".toLocaleLowerCase()&&({value:R,name:g}=Ee.setDefaultValue(t,g)),w==="GranularDateRange".toLocaleLowerCase()&&({name:g,value:R}=dt.setDefaultValue(t,g))}return{name:g,value:R}}),f=Array.from(new Set(h.map(d=>d.name))).map(d=>h.find(m=>m.name===d));return f=f.filter(d=>d.value!==""),f},Hc=(t,e)=>{let{activeCaseLoadId:r}=Y.getValues(t);return e.forEach(n=>{n.type.toLocaleLowerCase()==="Autocomplete".toLocaleLowerCase()&&n.text.toLocaleLowerCase().includes("establishment")&&r.length&&(n.value=r)}),e},fo=(t,e)=>t.filter(r=>r.filter).filter(r=>{if(e!==void 0){let n=r.filter.interactive;return n===void 0?!e:e===n}return!0}).map(r=>{let{display:n,name:a,filter:i}=r,{type:s,staticOptions:o,dynamicOptions:l,defaultValue:u,mandatory:c,pattern:h}=i,f=o?o.map(p=>({value:p.name,text:p.display})):[],d={text:n,name:a,type:s,value:u||null,minimumLength:l?l.minimumLength:null,dynamicResourceEndpoint:null,mandatory:c||!1,pattern:h},m={value:"no-filter",text:"None",disabled:!1};switch(s){case"Autocomplete".toLowerCase():d={...d,options:f};break;case"Radio":c||f.unshift(m),d={...d,options:f};break;case"Select":{c||f.unshift(m),f.unshift({value:"",text:"Select your option",disabled:!0,selected:!0}),d={...d,options:f};break}case"Multiselect".toLowerCase():d={...d,options:f,values:u?u.split(","):[]};break;case"DateRange".toLowerCase():d=Ee.getFilterFromDefinition(i,d);break;case"Date".toLowerCase():d=mr.getFilterFromDefinition(i,d);break;case"GranularDateRange".toLocaleLowerCase():{let p=i;d=dt.getFilterFromDefinition(p,d);break}default:break}return d}),Gc=(t,e,r,n)=>{let a={},{fields:i}=e.specification,{preventDefault:s}=n.query;if(Object.keys(t.filters).length===0&&!s&&i.filter(l=>l.filter&&l.filter.defaultValue).forEach(l=>{if(l.filter.type.toLowerCase()==="DateRange".toLowerCase()){let u=l.filter.defaultValue.split(" - ");u.length>=1&&(a[`${he}${l.name}.start`]=u[0],u.length>=2&&(a[`${he}${l.name}.end`]=u[1]))}else a[`${he}${l.name}`]=l.filter.defaultValue}),Object.keys(a).length>0){let l=ht(t.toRecordWithFilterPrefix(),a,i);return r.redirect(`${n.baseUrl}${n.path}${l}`),!0}return!1},zc=async({fields:t,req:e,interactive:r=!1,prefix:n="filters."})=>{let a=await fo(t,r),i=co(a,e),s=dr.getSelectedFilters(i,n);return{filters:i,selectedFilters:s}},mo={getFiltersFromDefinition:fo,setFilterValuesFromRequest:co,getFilters:zc,setFilterQueryFromFilterDefinition:jc,redirectWithDefaultFilters:Gc,setFilterValuesFromSavedDefaults:qc,setUserDefinedDefaultValuesForReport:Bc,setUserContextDefaults:Hc};var mt={refresh:{id:"dpr-button-refresh",disabled:!1,tooltipText:"Refresh",ariaLabelText:"refresh report"},printable:{id:"dpr-button-printable",disabled:!1,tooltipText:"Print screen",ariaLabelText:"print report"},sharable:{id:"dpr-button-sharable",disabled:!1,tooltipText:"Email\xA0report link",ariaLabelText:"share report request via email"},copy:{id:"dpr-button-copy",disabled:!1,tooltipText:"Copy report link",ariaLabelText:"report request"},downloadable:{id:"dpr-button-downloadable",disabled:!1,tooltipText:"Download",ariaLabelText:"download report"}};var Xc=({refresh:t,print:e,share:r,copy:n,download:a})=>{let i=[];return t&&t.url&&t.executionId&&i.push(Wc(mt.refresh,t)),e&&i.push(Zc(mt.printable,e)),r&&i.push(Qc(mt.sharable,r)),n&&i.push(Jc(mt.copy,n)),a&&i.push(Kc(mt.downloadable,a)),i},Wc=(t,e)=>{let{url:r}=e;return{...t,href:r}},Qc=(t,e)=>{let{reportName:r,name:n,url:a}=e,i=`mailto:?subject=${r}-${n}&body=${encodeURIComponent(a)}`;return{...t,href:i}},Jc=(t,e)=>{let{url:r}=e;return{...t,href:r}},Kc=(t,e)=>{let{canDownload:r,enabled:n}=e,{tooltipText:a,ariaLabelText:i}=t;return{...t,tooltipText:r?a:"Enable download",disabled:!n,attributes:{...e},ariaLabelText:n?i:`${i}, disabled`}},Zc=(t,e)=>{let{enabled:r}=e,{ariaLabelText:n}=t;return{...t,disabled:!r,href:"#",ariaLabelText:r?n:`${n}, disabled`}},ho={getActions:Xc};var Co=ee(Fe());var hr=ee(Fe()),po=ee(Qe());hr.default.extend(po.default);var ef=["ABORTED","FAILED","EXPIRED"],tf=["SUBMITTED","STARTED","PICKED"];function rf(t){return Promise.all(t).then(e=>{let r=e.find(a=>typeof a.status=="number"||ef.includes(a.status));if(r)return r;let n=e.find(a=>tf.includes(a.status));return n||e[0]})}var go=async(t,e,r,n,a)=>{let{definitionsPath:i}=Y.getValues(r),{type:s,reportId:o,executionId:l,id:u,tableId:c}=e.body,f=(await t.requestedReportService.getReportByExecutionId(l,a)).childExecutionData??[];s==="report"&&f.push({executionId:l,tableId:c,variantId:u});let d=f.map(p=>t.reportingService.getAsyncReportStatus(n,o,p.variantId,p.executionId,i,p.tableId));s==="dashboard"&&d.push(t.dashboardService.getAsyncStatus(n,o,u,l,i,c));let m=await rf(d);return{status:m.status,statusResponse:m}},vo=async({req:t,res:e,services:r})=>{let{token:n,userId:a}=Y.getValues(e),{status:i,requestedAt:s}=t.body,o=["READY","EXPIRED","FAILED"],l,u,c;try{if({status:l,statusResponse:c}=await go(r,t,e,n,a),nf({requestedAt:s,compareTime:new Date,durationMins:15})&&!o.includes(l))throw new Error("Request taking too long. Request Halted");if(l==="FAILED"){ce.error(`Error: ${JSON.stringify(c.error)}`);let{userMessage:h,developerMessage:f}=c.error;h||f?u=c.error:u={developerMessage:c.error}}}catch(h){ce.error(`Error: ${JSON.stringify(h)}`);let{data:f}=h;u=f||{userMessage:h.message},l=i==="FINISHED"?"EXPIRED":"FAILED"}return typeof l=="number"&&(l="FAILED"),{status:l,...u&&{errorMessage:u}}},yo=async({req:t,res:e,services:r})=>{let{token:n,userId:a}=Y.getValues(e),{executionId:i,status:s}=t.body,o,l;try{({status:l}=await go(r,t,e,n,a))}catch(c){let{data:h}=c;o=(h??{}).userMessage,l=s==="READY"||s==="FINISHED"?"EXPIRED":"FAILED"}return{isExpired:{status:l,...o&&{errorMessage:o}}.status==="EXPIRED",executionId:i}},nf=({requestedAt:t,compareTime:e,durationMins:r})=>{let n=(0,hr.default)(e),a=(0,hr.default)(t);return n.diff(a,"minutes")>=r};var gr=(t,e,r,n)=>{let a=n==="EXPIRED"?"Refresh":"Retry";return`<div class="dpr-icon-wrapper__item-actions">
      <a class='dpr-user-list-action govuk-link--no-visited-state govuk-!-margin-bottom-1' href="${t}">${a}</a>
      <a class="dpr-user-list-action govuk-link--no-visited-state dpr-remove-${r}-report-button"" href="#" data-execution-id='${e}'>Remove</a>
    </div>`},af=t=>{let e="";switch(t){case"dashboard":e="govuk-tag--purple";break;case"unavailable":e="govuk-tag--grey";break;default:e="";break}return e},vr=(t,e,r,n)=>{let a=n?"":"dpr-display-none",i=af(r),s=sf(r);return`<div>
  <p class="govuk-body govuk-!-margin-bottom-1"><strong>${e}</strong></p>
  <p class="govuk-body-s govuk-!-margin-bottom-3">${t}</p>
  <strong class="govuk-tag ${i} dpr-request-status-tag--small govuk-!-margin-bottom-4'">${s}</strong>
  <p class="govuk-body-xs govuk-!-margin-bottom-0 govuk-!-margin-top-3 ${a}">${n}</p>
</div>`};var Do=(t,e,r,n,a=!0)=>{if(!a)return'<strong class="govuk-tag govuk-tag--red dpr-request-status-tag dpr-request-status-tag--small dpr-unauthorised-report" aria-label="You are unauthorised to view this report">Unauthorised</strong>';let i,s;return e==="unavailable"?(s="Request missing report",i=`<a class='dpr-user-list-action govuk-link--no-visited-state govuk-!-margin-bottom-1 dpr-missing-report' href="${t}">${s}</a>`):(s=`Request ${e}`,r&&r==="sync"&&(s=`Load ${e}`),i=`<a class='dpr-user-list-action govuk-link--no-visited-state govuk-!-margin-bottom-1 dpr-live-report dpr-type__${e}' href="${t}">${s}</a>`,n&&(i=`${i}${n}`)),i},sf=t=>t.charAt(0).toUpperCase()+t.substring(1).toLowerCase(),bo=(t,e,r,n,a)=>{let i="";if(e==="unavailable")i=`dpr/request-missing-report/${r}/${n}/form`;else{let{pathSuffix:s,dpdPathFromQuery:o}=Y.getValues(a),l=o?s:"";i=`dpr/request-report/${e}/${r}/${n}/filters${l}`,t&&t==="sync"&&(i=`dpr/view-report/sync/${e}/${r}/${n}/load-report${l}`)}return i};var Ro={getRequestStatus:async({req:t,res:e,services:r})=>{let{executionId:n,status:a}=t.body,i=e.locals.user?.uuid?e.locals.user.uuid:"userId",s=await vo({req:t,res:e,services:r});return a!==s.status&&(await r.requestedReportService.updateStatus(n,i,s.status,s.errorMessage),s.reportData=await r.requestedReportService.getReportByExecutionId(n,i)),s},filterReports:t=>!t.timestamp.lastViewed};var wo={filterReports:t=>t.status==="READY"||t.executionId?.length&&t.status==="EXPIRED"};var Eo={createShowMoreHtml:(t,e)=>{let r=t?t.replace(/"/g,"'"):"";return`<div class="dpr-show-more" data-content="${r}" data-dpr-module="show-more" data-length="${e||100}">
      <div class='dpr-show-more-content'>${r}</div><a class="dpr-show-hide-button govuk-link--no-visited-state" href="#">show more</a>
  </div>`}};var _o={getCurrentVariantDefinition:(t,e,r)=>{if(!t){ce.info("No definitions");return}let n,a=t.find(i=>i.id===e);return a&&(n=a.variants.find(i=>r===i.id)),n||void 0},getFieldDisplayName:(t,e)=>{let r=e.split("."),n=t.find(a=>a.name===r[0]);return n?r[1]?`${n.display} ${r[1]}`:n.display:e},getField:(t,e)=>t.find(r=>r.name===e),getReportSummary:async(t,e,r,n)=>(await e.getDefinitions(r,n)).find(i=>i.id===t)};var of=async t=>t.map(e=>lf(e)).sort((e,r)=>e.text.localeCompare(r.text)),lf=t=>{let e=JSON.parse(JSON.stringify(t)),{id:r,name:n,description:a,href:i,reportName:s,type:o}=e;return{id:r,reportName:s,text:n,description:a,href:i,type:o}},uf=async(t,e,r,n,a)=>{let i=await Promise.all(t.sort((s,o)=>s.name.localeCompare(o.name)).map(async s=>cf(s,e,r,n)));return{rows:a?i.slice(0,a):i,head:[{text:"Product",classes:"dpr-req-product-head"},{text:"Description",classes:"dpr-bm-description-head"},{text:"Actions",classes:"dpr-bm-actions-head"}]}},cf=async(t,e,r,n)=>{let{description:a,reportName:i,reportId:s,id:o,href:l,name:u,type:c,loadType:h}=t,f=await e.createBookMarkToggleHtml({userId:n,reportId:s,id:o,csrfToken:r,ctxId:"bookmark-list",reportType:c});return[{html:vr(i,u,c)},{html:Eo.createShowMoreHtml(a),classes:"dpr-req-cell"},{html:Do(l,c,h,f),classes:"dpr-req-cell dpr-req-cell__status"}]},ff=async(t,e,r,n,a)=>{let i=[],{definitionsPath:s}=Y.getValues(r);return await Promise.all(t.map(async o=>{let l,{reportId:u,variantId:c,id:h,automatic:f,type:d}=o,m=c||h,p=d||"report";try{let R,g,w,O="async",A=`/async/${p}/${u}/${m}/request`;if(p==="report"&&(l=await a.reportingService.getDefinition(n,u,m,s),w=l.name,R=l.variant.name,g=l.variant.description||l.description,O=l.variant.loadType||O,A=bo(O,p,u,m,r)),p==="dashboard"){let x=await _o.getReportSummary(u,a.reportingService,n,s);l=await a.dashboardService.getDefinition(n,u,m,s),R=l.name,w=x.name,g=l.description}l&&i.push({reportId:u,id:m,reportName:w,name:R,description:g,type:p,href:A,loadType:O,automatic:f})}catch{ce.warn(`Failed to map bookmark for: Report ${u}, variant ${m}`);let g=r.locals.user?.uuid?r.locals.user.uuid:"userId";await a.bookmarkService.removeBookmark(g,m,u)}})),i},To={renderBookmarkList:async({services:t,maxRows:e,res:r,req:n})=>{let{token:a,csrfToken:i,userId:s,bookmarks:o}=Y.getValues(r),l=await ff(o,n,r,a,t),u=await of(l),c=u.length;e&&(u=u.slice(0,e));let h=await uf(l,t.bookmarkService,i,s,e),f={...u.length&&{href:"/dpr/my-reports/bookmarks/list"},...!u.length&&{emptyMessage:"You have 0 bookmarked reports"}},d={amount:c,shown:c>e?e:c,max:e};return{head:f,tableData:h,total:d,csrfToken:i,type:"bookmark"}}};var Ao=ee(Er());var It=class{constructor(e){this.build=()=>this.userStoreItem;this.initialiseItem=()=>this.addReportData({type:this.requestFormData.type,reportId:this.requestFormData.reportId,reportName:this.requestFormData.reportName,description:this.requestFormData.description,id:this.requestFormData.id,name:this.requestFormData.name});this.addReportData=({type:e,reportId:r,reportName:n,description:a,id:i,name:s})=>(this.userStoreItem={type:e,reportId:r,reportName:n,description:a,id:i,name:s,timestamp:{}},this);this.addExecutionData=e=>(this.userStoreItem={...this.userStoreItem,...e},this);this.addChildExecutionData=e=>(this.userStoreItem={...this.userStoreItem,childExecutionData:e},this);this.addFilters=e=>{let r=new URLSearchParams(e).toString();return this.userStoreItem={...this.userStoreItem,filters:{data:e,queryString:r}},this};this.addSortData=e=>{let r=new URLSearchParams(e).toString();return this.userStoreItem={...this.userStoreItem,sortBy:{data:e,queryString:r}},this};this.addRequestUrls=e=>{let{origin:r,pathname:n,search:a,href:i,defaultInteractiveQueryString:s}=this.requestFormData,{executionId:o,dataProductDefinitionsPath:l,dpdPathFromQuery:u}=this.userStoreItem,c=u?`${na(l)}`:"",h=e.baseUrl.replace("/filters",`/${o}/status`),f=`${r}${h}`;return this.userStoreItem={...this.userStoreItem,url:{origin:r,request:{fullUrl:i,pathname:n,search:a},polling:{fullUrl:f,pathname:h},report:{...s?.length&&{search:c.length?`${c}&${s}`:`?${s}`,default:`?${s}`}}}},this};this.addAsyncUrls=e=>(this.userStoreItem={...this.userStoreItem,url:e},this);this.addReportUrls=e=>{let r=e.get("host"),n=`${e.protocol}://${e.get("host")}${e.originalUrl}`,a=(0,Ao.default)(e);return this.userStoreItem={...this.userStoreItem,url:{origin:r||this.userStoreItem.url.origin,...this.userStoreItem.url?.request&&{request:this.userStoreItem.url.request},...this.userStoreItem.url?.polling&&{polling:this.userStoreItem.url.polling},report:{...this.userStoreItem.url?.report&&this.userStoreItem.url.report,fullUrl:n,...a.search&&{search:a.search}}}},this};this.addLoadType=e=>(this.userStoreItem={...this.userStoreItem,loadType:e},this);this.addQuery=e=>(this.userStoreItem={...this.userStoreItem,query:{data:e.query,summary:e.querySummary}},this);this.addInteractiveQuery=e=>(e&&(this.userStoreItem={...this.userStoreItem,interactiveQuery:{data:e.query,summary:e.querySummary}}),this);this.addStatus=e=>(this.userStoreItem={...this.userStoreItem,status:e},this);this.addMetrics=e=>(this.userStoreItem={...this.userStoreItem,metrics:e.map(r=>({name:r.display}))},this);this.addTimestamp=()=>{let{status:e}=this.userStoreItem,r=new Date;switch(e){case"FAILED":this.userStoreItem.timestamp.failed=r;break;case"EXPIRED":this.userStoreItem.timestamp.expired=r;break;case"ABORTED":this.userStoreItem.timestamp.aborted=r;break;case"FINISHED":this.userStoreItem.timestamp.completed=r;break;case"SUBMITTED":this.userStoreItem.timestamp.requested=r;break;case"STARTED":case"PICKED":break;default:this.userStoreItem.timestamp.lastViewed=r;break}return this};this.addDefinitionsPath=(e,r)=>(e&&(this.userStoreItem={...this.userStoreItem,dataProductDefinitionsPath:e,dpdPathFromQuery:r}),this);this.requestFormData=e,this.requestFormData&&this.initialiseItem()}};var df=t=>{let e=JSON.parse(JSON.stringify(t)),{executionId:r,tableId:n,variantName:a,name:i,reportId:s,variantId:o,id:l,description:u,query:c,interactiveQuery:h,status:f,timestamp:d,reportName:m,dataProductDefinitionsPath:p,type:R,url:g}=e,w=[];c&&(w=c.summary);let O=[];h&&(O=h.summary);let A=R||"report";return{id:r,text:i||a,reportName:m,description:u,tag:"MIS",summary:w,interactiveSummary:O,timestamp:d,status:f,type:A,...yf(f,e),meta:{reportId:s,id:o||l,executionId:r,tableId:n,status:f,type:A,dataProductDefinitionsPath:p,pollingUrl:g.polling?.pathname,reportUrl:g.report?.pathname}}},mf=(t,e)=>({rows:t.map(n=>hf(n,e)),head:[{text:"Product",classes:"dpr-req-product-head"},{text:"Filters",classes:"dpr-req-filters-head"},{text:"Status",classes:"dpr-req-status-head"},{text:"Actions",classes:"dpr-req-actions-head"}]}),hf=(t,e)=>{let r,n="",{href:a,id:i,reportName:s,text:o,timestamp:l,type:u,status:c}=t;switch(c){case"FAILED":r="govuk-tag--red",n=gr(a,i,e,c);break;case"EXPIRED":r="govuk-tag--grey",n=gr(a,i,e,c);break;case"ABORTED":r="govuk-tag--orange",n=gr(a,i,e,c);break;case"READY":case"FINISHED":n=`<a class=govuk-link govuk-link--no-visited-state dpr-type__${u}' href="${a}">Go to ${u}</a>`,r="govuk-tag--green";break;case"PICKED":case"SUBMITTED":case"STARTED":n=`<a class='govuk-link govuk-link--no-visited-state dpr-type__${u}' href="${a}">Go to status</a>`;break;default:break}let h="";return(t.summary||t.interactiveSummary)&&(h=gf(t)),[{html:vr(s,o,u,l)},{html:h},{html:`<strong class="govuk-tag dpr-request-status-tag ${r}">${c}</strong>`,classes:"dpr-req-cell dpr-req-cell__status"},{html:`${n}`,classes:"dpr-req-cell dpr-req-cell__status"}]},pf=(t,e)=>({amount:t,shown:t>e?e:t,max:e}),gf=t=>{let e=t.summary.map(n=>`<li class="govuk-body-s dpr-query-summary"><strong>${n.name}</strong>: ${n.value}</li>`).join(""),r=t.interactiveSummary.map(n=>`<li class="govuk-body-s dpr-interactive-query-summary"><strong>${n.name}</strong>: ${n.value}</li>`).join("");return`<ul class="dpr-card-group__item__filters-list govuk-!-margin-top-0 govuk-!-margin-bottom-0">${e}${r}</ul>`},vf=(t,e)=>{let{nestedBaseUrl:r}=Y.getValues(e);return t.map(n=>({reportId:n.meta.reportId,id:n.meta.id,executionId:n.meta.executionId,tableId:n.meta.tableId,status:n.meta.status,requestedAt:n.meta.requestedAt,type:n.meta.type,dataProductDefinitionsPath:n.meta.dataProductDefinitionsPath,pollingUrl:n.meta.pollingUrl,reportUrl:n.meta.reportUrl,nestedBaseUrl:r}))},yf=(t,e)=>{let r,n,a,{url:i,timestamp:s}=e,o=new je;switch(t){case"FAILED":{a=s.failed?o.toDateString(s.failed,"local-date"):(0,Co.default)().format("DD/MM/YYYY"),n=`${i.polling.fullUrl}`,r=`Failed at: ${a}`;break}case"ABORTED":{n=`${i.request.fullUrl}`,a=o.toDateString(s.aborted,"local-date"),r=`Aborted at: ${a}`;break}case"FINISHED":n=i.report.fullUrl,a=o.toDateString(s.completed,"local-date"),r=`Ready at: ${a}`;break;case"EXPIRED":{n=`${i.request.fullUrl}`,a=o.toDateString(s.expired,"local-date"),r=`Expired at: ${a}`;break}case"READY":{n=`${i.report.fullUrl}`,a=o.toDateString(s.lastViewed,"local-date"),r=`Last viewed: ${a}`;break}case"SUBMITTED":case"STARTED":case"PICKED":n=i.polling.fullUrl,a=o.toDateString(s.requested,"local-date"),r=`Requested at: ${a}`;break;default:a=o.toDateString(s.lastViewed,"local-date"),r=`Last viewed: ${a}`;break}return{timestamp:r,href:n}},zn=async({res:t,reportsData:e,maxRows:r,filterFunction:n,type:a})=>{let{csrfToken:i}=Y.getValues(t),s=e.filter(n).map(df),o=s.length;r&&(s=s.slice(0,r));let l=mf(s,a),u=a==="requested"?"requested-reports":"recently-viewed";return{head:{...s.length&&{href:`dpr/my-reports/${u}/list`},...!s.length&&{emptyMessage:`You have 0 ${a} reports`}},tableData:l,total:pf(o,r),meta:vf(s,t),csrfToken:i,maxRows:r}},Lo={renderList:zn,updateExpiredStatus:async({req:t,res:e,services:r})=>{let{userId:n}=Y.getValues(e),a=await yo({req:t,res:e,services:r});return a&&a.isExpired&&(await r.recentlyViewedService.setToExpired(a.executionId,n),await r.requestedReportService.setToExpired(a.executionId,n)),a?a.isExpired:!1},init:async({services:t,res:e,req:r,maxRows:n=6})=>{let{requestedReports:a,recentlyViewedReports:i,bookmarkingEnabled:s}=Y.getValues(e),o=await zn({res:e,reportsData:a,filterFunction:Ro.filterReports,maxRows:n,type:"requested"}),l=await zn({res:e,reportsData:i,filterFunction:wo.filterReports,maxRows:n,type:"viewed"}),u;return s&&(u=await To.renderBookmarkList({res:e,req:r,services:t,maxRows:n})),{requestedReports:o,viewedReports:l,bookmarks:u}},updateLastViewed:async({req:t,services:e,reportStateData:r,userId:n,filters:a})=>{let{type:i,reportId:s,reportName:o,description:l,id:u,name:c,executionId:h,tableId:f,query:d,url:m}=r,p={type:i,reportId:s,reportName:o,description:l,id:u,name:c},R={executionId:h,tableId:f},g=d?{query:d.data,querySummary:d.summary}:{query:{},querySummary:[]},w={query:t.query,querySummary:dr.getQuerySummary(t,a)},O=new It().addReportData(p).addExecutionData(R).addQuery(g).addInteractiveQuery(w).addStatus("READY").addTimestamp().addAsyncUrls(m).addReportUrls(t).build();await e.requestedReportService.updateLastViewed(r.executionId,n),await e.recentlyViewedService.setRecentlyViewed(O,n)}};var Ge=class extends de{constructor(e){let{fields:r,sections:n,template:a}=e;super(r),this.sections=n,this.template=a}createSectionHeadings(e,r){return e.map(n=>({description:this.mapSectionDescription(n),sortKey:this.getSortKey(n,r)})).sort(this.sortKeyComparison()).map(n=>n.description).reduce(Xe,[])}initSectionData(e){let r={};return e.forEach(n=>{r[n]=[]}),r}mapRowsToSection(e,r){return e.reduce((n,a)=>{let i=this.mapSectionDescription(a),s=this.mapRow(a);return{...n,[i]:n[i].concat([s])}},r)}mapDataToSection(e,r){return e.reduce((n,a)=>{let i=this.mapSectionDescription(a);return{...n,[i]:n[i].concat([a])}},r)}getSectionCount(e,r){let n=e[r].length,a=`${n} result${n===1?"":"s"}`;return{count:n,countDescription:a}}mapSummariesAndCreateTable(e,r,n){let a=[],i=[],s=[],o=[],l=[];return i=this.mapSectionSummaryTables(e,"section-header",this.columns.length),s=this.mapSectionSummaryRows("table-header",e),o=this.mapSectionSummaryRows("table-footer",e),l=this.mapSectionSummaryTables(e,"section-footer",this.columns.length),a=i.concat(r.length>0?[n]:[]).concat(s).concat(r).concat(o).concat(l),a}createTableContent(e,r,n){return e.flatMap((a,i)=>{let{count:s,countDescription:o}=this.getSectionCount(r,a),l=r[a],u=[];return Object.keys(this.reportSummaries).length?u=this.mapSummariesAndCreateTable(a,l,n):u=u.concat(l.length>0?[n]:[]).concat(l),[...this.createSectionHeader(a,i,s,o),...u]})}createSectionHeader(e,r,n,a){let i=[];return r!==0&&i.push([{classes:"dpr-section-header-spacer",colspan:this.columns.length,text:""}]),i.push([{classes:"dpr-section-header",colspan:this.columns.length,html:`<h2 class="govuk-heading-m">${e}${n>0?` <span class='govuk-caption-m'>${a}</span>`:""}</h2>`}]),i.push([{classes:"dpr-section-header-spacer-bottom",colspan:this.columns.length,text:""}]),i}mapSectionSummaryRows(e,r){return this.reportSummaries[e]?this.reportSummaries[e].flatMap(n=>n.data.filter(a=>this.mapSectionDescription(a)===r).map(a=>this.mapRow(a,`dpr-report-summary-cell dpr-report-summary-cell-${e}`,n.fields))):[]}mapSectionSummaryTables(e,r,n){let a=this.reportSummaries[r];if(a){let s=a.map(o=>{let l=o.data.filter(u=>this.mapSectionDescription(u)===e);if(l.length>0){let u=new Be(o,this.sections).buildTable(l);return`<div class='dpr-summary-container'>${this.convertDataTableToHtml(u)}</div>`}return""}).join("");if(s.length>0)return[[{classes:"dpr-summary-cell",colspan:n,html:`<div class='dpr-summary-container-group dpr-summary-container-group-${r}'>${s}</div>`}]]}return[]}mapSectionDescription(e){let{sections:r}=this;return this.mapNamesToFields(r).map(n=>`${n.display}: ${this.mapCellValue(n,e[n.name])}`).join(", ")}mapSections(e){let r=this.initSectionedHeadings(e),{sectionedData:n}=r;return this.template!=="summary-section"&&(this.template==="parent-child-section"?n=this.mapDataToSection(e,n):n=this.mapRowsToSection(e,n)),{sectionDescriptions:r.sectionDescriptions,sectionedData:n}}initSectionedHeadings(e){let r=this.mapNamesToFields(this.sections),n=this.createSectionHeadings(e,r),a=this.initSectionData(n);return{sectionDescriptions:n,sectionedData:a}}mapSectionedData(e,r){let{sectionDescriptions:n,sectionedData:a}=this.mapSections(e);return this.createTableContent(n,a,r)}buildTable(e){return{head:null,rows:this.mapSectionedData(e,this.mapHeader(!0,"govuk-table__header")),rowCount:e.length,colCount:this.columns.length}}};var ze=class extends Ge{constructor(r){let{specification:n}=r,{sections:a,template:i}=n;super(n);this.childData=[];this.sections=a,this.template=i,this.variant=r}createParentChildTable(r,n){let a={},i=this.mapNamesToFields(this.variant.childVariants.flatMap(u=>u.joinFields).reduce(Xe,[])),s=this.calculateParentChildKeys(r,i);s.forEach(u=>{a[u.sortKey]={parent:[]}}),a=this.splitParentDataIntoSections(a,r,i),a=this.splitChildDataIntoSections(s,a);let o=this.createChildDataTableBuilders();return s.flatMap(u=>{let c=a[u.sortKey],h=c.parent;return[n].concat(h.map(f=>this.mapRow(f,"dpr-parent-cell"))).concat(this.variant.childVariants.filter(f=>c[f.id]).map(f=>{let d=o[f.id].buildTable(c[f.id]);return[{classes:"dpr-child-report-cell",format:"string",html:`<div class='dpr-child-report'><h2 class="govuk-heading-s">${f.name}</h2><div class="dpr-child-report_table">${this.convertDataTableToHtml(d)}</div></div>`,colspan:this.columns.length}]}))})}createParentChildSectionRows(r,n){let i=this.mapSections(r).sectionedData,s=[];return Object.keys(i).forEach(l=>{let u=i[l];s.push({sectionDescription:l,...this.getSectionCount(i,l),rows:this.createParentChildTable(u,n)})}),s.flatMap((l,u)=>[...this.createSectionHeader(l.sectionDescription,u,l.count,l.countDescription),...l.rows])}mapParentChildData(r,n){return this.sections?.length?this.createParentChildSectionRows(r,n):this.createParentChildTable(r,n)}createChildDataTableBuilders(){return this.variant.childVariants.reduce((n,a)=>{let i=a.specification.fields.filter(o=>o.visible||o.mandatory).map(o=>o.name),s=new de(a.specification.fields).withNoHeaderOptions(i).withSortedData();return{...n,[a.id]:s}},{})}calculateParentChildKeys(r,n){return r.map(a=>({sortKey:this.getSortKey(a,n),childSortKeys:this.variant.childVariants.reduce((i,s)=>({...i,[s.id]:this.getSortKey(a,this.mapNamesToFields(s.joinFields))}),{})})).reduce((a,i)=>a.find(s=>s.sortKey===i.sortKey)?a:a.concat(i),[])}splitParentDataIntoSections(r,n,a){return n.reduce((i,s)=>{let o=this.getSortKey(s,a),u={parent:i[o].parent.concat(s)};return{...i,[o]:u}},r)}splitChildDataIntoSections(r,n){let a={...n};return this.variant.childVariants.forEach(i=>{let s=this.mapNamesToFields(i.joinFields);ce.info("DPR-Parent-child-template-debugging splitChildDataIntoSections",JSON.stringify({childFields:s,parentKeys:r}));let o=this.childData.find(u=>u.id===i.id);(o?o.data:[]).filter(u=>{let c=this.getSortKey(u,s);return r.find(h=>h.childSortKeys[i.id]===c)}).forEach(u=>{let c=this.getSortKey(u,s),h=r.find(d=>d.childSortKeys[i.id]===c).sortKey,f=a[h][i.id]??[];a[h][i.id]=f.concat(u)})}),a}withChildData(r){return this.childData=r,this}buildTable(r){return{head:null,rows:this.mapParentChildData(r,this.mapHeader(!0,"govuk-table__header")),rowCount:r.length,colCount:this.columns.length}}};var Nt=class extends ze{constructor(e){let{sectionedFields:r,template:n}=e.specification;super(e),this.sectionedFields=r,this.sections=this.sectionedFields.map(a=>a.name),this.template=n}getChildFields(e){let r=this.variant.childVariants.find(n=>n.id===e);return r?r.specification.fields:[]}getJoinKey(){return this.variant.childVariants[0].joinFields[0]}initSectionedData(e){return e.flatMap(r=>this.sectionedFields.map(a=>{let i=this.mapNamesToFields([a.name])[0],s=[],{child:o}=a;return a.fields?s=this.mapNamesToFields(a.fields):a.child&&(s=this.getChildFields(a.child)),{header:i,fields:s,child:o}}).map(a=>{if(a.child){let i=this.getChildData(a.child),s=a.fields.filter(l=>l.visible),o=this.getJoinKey();return{header:a.header.display,fields:i.data.filter(l=>l[o]===r[o]).map(l=>({heading:l[s[0]?.name]||"Not found",data:l[s[1]?.name]||"Not found"}))}}return{header:a.header.display,fields:a.fields.filter(i=>i.visible).map(i=>({heading:i.display,data:r[i.name]}))}}))}getChildData(e){return this.childData.find(r=>r.id===e)}createRows(e){return this.initSectionedData(e).flatMap((a,i)=>{let s=this.createSectionHeader(a.header,i),o=a.fields.map(l=>[{text:l.heading,classes:"dpr-row-heading"},{text:l.data,classes:"dpr-row-heading-data"}]);return[...s,...o]})}buildTable(e){return{head:[],rows:this.createRows(e),rowCount:e.length,colCount:this.columns.length}}};var ko=(t,e,r,n,a)=>{let{variant:i}=t,{interactive:s,specification:o}=i,l=new xe(o,n);return new de(o.fields).withSummaries(l.collateDataTableSummaries()).withHeaderOptions({columns:e.value,reportQuery:a,interactive:s}).buildTable(r)},Sf=(t,e,r,n)=>new ze(t.variant).withNoHeaderOptions(e.value).withChildData(n).buildTable(r),Df=(t,e,r,n,a)=>{let{variant:i}=t,{interactive:s,specification:o}=i,l=new xe(o,n);return new Ge(o).withSummaries(l.collateDataTableSummaries()).withHeaderOptions({columns:e.value,reportQuery:a,interactive:s}).buildTable(r)},bf=(t,e,r)=>{let{variant:n}=t,{interactive:a}=n;return e.map(i=>new Nt(n).withHeaderOptions({columns:new Array(2),interactive:a}).withChildData(r).buildTable([i]))},Rf=(t,e,r,n,a,i)=>{let s=[],{template:o}=t.variant.specification;switch(o){case"summary-section":case"list-section":{let l=Df(t,e,r,a,i);s.push(l);break}case"parent-child":case"parent-child-section":{let l=Sf(t,e,r,n);s.push(l);break}case"list":{let l=ko(t,e,r,a,i);s.push(l);break}case"row-section-child":case"row-section":{s=bf(t,r,n);break}default:{let l=ko(t,e,r,a,i);s.push(l);break}}return s},Oo={createDataTable:Rf};var wf=async({res:t,req:e,services:r,token:n,userId:a})=>{let{definitionsPath:i}=Y.getValues(t),{reportId:s,variantId:o,id:l,tableId:u}=e.params,c=o||l,h=await r.reportingService.getDefinition(n,s,c,i),f=await r.requestedReportService.getReportByTableId(u,a),{reportData:d,reportQuery:m}=await Ef(h,r,n,e,t),p=h.variant.summaries?await _f(h,r,n,e,t):[],R=h.variant.childVariants?await Tf(h,r,n,e,t,f):[];return{definition:h,requestData:f,reportData:d,summariesData:p,childData:R,reportQuery:m}},Ef=async(t,e,r,n,a)=>{let{definitionsPath:i}=Y.getValues(a),{reportId:s,variantId:o,id:l,tableId:u}=n.params,c=o||l,{variant:h}=t,{specification:f}=h,d=new We({fields:f.fields,template:f.template,queryParams:n.query,definitionsPath:i});return{reportData:await e.reportingService.getAsyncReport(r,s,c,u,d.toRecordWithFilterPrefix(!0)),reportQuery:d}},_f=async(t,e,r,n,a)=>{let{reportId:i,variantId:s,id:o,tableId:l}=n.params,{definitionsPath:u}=Y.getValues(a),c=s||o;return Promise.all(t.variant.summaries.map(async h=>{let f=await e.reportingService.getAsyncSummaryReport(r,i,c,l,h.id,{dataProductDefinitionsPath:u});return{...h,data:f}}))},Tf=async(t,e,r,n,a,i)=>{let{definitionsPath:s}=Y.getValues(a),{reportId:o}=n.params;return Promise.all(t.variant.childVariants.map(async l=>{let{specification:u}=l,c=new We({fields:u.fields,template:t.variant.specification.template,queryParams:n.query,definitionsPath:s}).toRecordWithFilterPrefix(!0),{tableId:h}=i.childExecutionData.find(d=>d.variantId===l.id),f=await e.reportingService.getAsyncReport(r,o,l.id,h,c);return{id:l.id,data:f}}))},Af=async({req:t,res:e,services:r})=>{let{token:n,userId:a}=Y.getValues(e),{definition:i,requestData:s,reportData:o,childData:l,summariesData:u,reportQuery:c}=await wf({req:t,res:e,services:r,token:n,userId:a}),h=Yt.getColumns(i.variant.specification,t.query.columns),f=Oo.createDataTable(i,h,o,l,u,c),d=await Cf(t,e,r,i,s,u,f,h,c),m={...d,dataTable:f};return Object.keys(s).length&&Lo.updateLastViewed({req:t,services:r,reportStateData:s,userId:a,search:m.search,href:m.pathname,filters:d.filterData.filters}),{renderData:m}},Cf=async(t,e,r,n,a,i,s,o,l)=>{let{nestedBaseUrl:u}=Y.getValues(e),c=(0,xo.default)(t),h=Of(c,t),f=Ff(n),{fields:d,specification:m}=f,p=If(a),R=await Mf(n,a,r,e,l),w=await mo.getFilters({fields:d,req:t,interactive:!0}),O=await xf(r,e,a,n,o,R,h),A=kf(n,e),x;i.length&&(x=new xe(m,i).collatePageSummaries());let V,P;if(A.template==="list"){V=Gs.getPaginationData(c,R,t);let{pageSize:F,currentPage:L,totalRows:j}=V;P=zs.getTotals(F,L,j,s[0].rowCount)}return{...Lf(m)&&{columns:o},filterData:w,count:R,nestedBaseUrl:u,...A,...O,...p,...h,...V&&{pagination:V},...P&&{totals:P},...x&&{reportSummaries:x}}},Lf=t=>{let{template:e}=t;return!["row-section","row-section-child","summary","summary-section"].includes(e)},kf=(t,e)=>{let{classification:r}=t.variant,{template:n}=t.variant.specification,{csrfToken:a}=Y.getValues(e);return{csrfToken:a,classification:r,template:n,loadType:"async",type:"report"}},Of=(t,e)=>{let{search:r}=t,n=t.search?e.originalUrl.split(t.search)[0]:e.originalUrl,a=n.replace("/download-disabled","").replace("/download-disabled?",""),i=r,s=r?encodeURIComponent(r):void 0;return{reportUrl:a,reportSearch:i,encodedSearch:s,search:r,pathname:n}},xf=async(t,e,r,n,a,i,s)=>{let{csrfToken:o,userId:l,bookmarkingEnabled:u,downloadingEnabled:c}=Y.getValues(e),{reportId:h}=r,f=r.variantId||r.id,{variant:d}=n,m;c&&(m=await t.downloadPermissionService.downloadEnabled(l,h,f));let p;u&&(p=await t.bookmarkService.isBookmarked(f,h,l));let R=Nf(o,d,r,a,m,i,s.pathname,s.search,e),{printable:g}=d;return{actions:R,canDownload:m,bookmarked:p,printable:g}},Mf=async(t,e,r,n,a)=>{let{token:i}=Y.getValues(n),{tableId:s,reportId:o}=e,l=e.variantId||e.id;return t.variant.interactive?r.reportingService.getAsyncInteractiveCount(i,s,o,l,a):r.reportingService.getAsyncCount(i,s)},Ff=t=>{let{variant:e}=t,{classification:r,printable:n,specification:a}=e,{template:i,fields:s}=a,{interactive:o}=e;return{classification:r,printable:n,specification:a,template:i,interactive:o,fields:s,variant:e}},If=t=>({reportName:t.reportName,name:t.name,description:t.description,requestedTimestamp:new Date(t.timestamp.requested).toLocaleString(),reportId:t.reportId,tableId:t.tableId,id:t.variantId||t.id,executionId:t.executionId,querySummary:t.query.summary,requestUrl:t.url.request,defaultQuery:t.url.report.default,dataProductDefinitionsPath:t.dataProductDefinitionsPath}),Nf=(t,e,r,n,a,i,s,o,l)=>{let{reportName:u,name:c,id:h,variantId:f,reportId:d,tableId:m,executionId:p,dataProductDefinitionsPath:R,url:g}=r,{nestedBaseUrl:w}=Y.getValues(l),O=g.request.fullUrl,{printable:A}=e,x=f||h,V={enabled:i>0&&a!==void 0,name:c,reportName:u,csrfToken:t,reportId:d,id:x,tableId:m,columns:n.value,definitionPath:R,loadType:"async",canDownload:a,currentUrl:s,currentQueryParams:o,nestedBaseUrl:w},P={reportName:u,name:c,url:O},F={url:O,executionId:p};return ho.getActions({download:V,print:{enabled:A},share:P,refresh:F,copy:{url:O}})},Mo={renderReport:Af};var yr=class{constructor(e,r){this.GET=async(e,r,n)=>{let{type:a}=e.params;try{let i={req:e,res:r,services:this.services,next:n},s=await Mo.renderReport(i);r.render("dpr/routes/journeys/view-report/report",{layoutPath:this.layoutPath,...s})}catch(i){let s=Wn.handleError(i,e.params.type),o;if(s.status==="EXPIRED"){let{userId:l}=Y.getValues(r);o=await this.services.recentlyViewedService.asyncSetToExpiredByTableId(e.params.tableId,l)}e.body.title=`Failed to retrieve ${a}`,e.body.error=s,e.body.refreshLink=o,n()}};this.layoutPath=e,this.services=r}};
/*! Bundled license information:

parseurl/index.js:
  (*!
   * parseurl
   * Copyright(c) 2014 Jonathan Ong
   * Copyright(c) 2014-2017 Douglas Christopher Wilson
   * MIT Licensed
   *)
*/
//# sourceMappingURL=controller.js.map