@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 • 164 kB
JavaScript
var ko=Object.create;var Mt=Object.defineProperty;var Oo=Object.getOwnPropertyDescriptor;var xo=Object.getOwnPropertyNames;var Mo=Object.getPrototypeOf,Io=Object.prototype.hasOwnProperty;var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Fo=(t,e)=>{for(var r in e)Mt(t,r,{get:e[r],enumerable:!0})},jn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of xo(e))!Io.call(t,a)&&a!==r&&Mt(t,a,{get:()=>e[a],enumerable:!(n=Oo(e,a))||n.enumerable});return t};var te=(t,e,r)=>(r=t!=null?ko(Mo(t)):{},jn(e||!t||!t.__esModule?Mt(r,"default",{value:t,enumerable:!0}):r,t)),No=t=>jn(Mt({},"__esModule",{value:!0}),t);var yr=I((Hf,vr)=>{"use strict";var Gn=require("url"),Bn=Gn.parse,It=Gn.Url;vr.exports=Hn;vr.exports.original=$o;function Hn(t){var e=t.url;if(e!==void 0){var r=t._parsedUrl;return zn(e,r)?r:(r=Xn(e),r._raw=e,t._parsedUrl=r)}}function $o(t){var e=t.originalUrl;if(typeof e!="string")return Hn(t);var r=t._parsedOriginalUrl;return zn(e,r)?r:(r=Xn(e),r._raw=e,t._parsedOriginalUrl=r)}function Xn(t){if(typeof t!="string"||t.charCodeAt(0)!==47)return Bn(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 Bn(t)}var s=It!==void 0?new It:{};return s.path=t,s.href=t,s.pathname=e,n!==null&&(s.query=r,s.search=n),s}function zn(t,e){return typeof e=="object"&&e!==null&&(It===void 0||e instanceof It)&&e._raw===t}});var na=I((sd,Sr)=>{var iu=Object.prototype.hasOwnProperty;function ta(t){return"[Throws: "+(t?t.message:"?")+"]"}function ou(t,e){if(iu.call(t,e))try{return t[e]}catch(r){return ta(r)}return t[e]}function ra(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 ta(o)}if(Array.isArray(n)){var s=n.map(r);return e.pop(),s}var i=Object.keys(n).reduce(function(o,u){return o[u]=r(ou(n,u)),o},{});return e.pop(),i}return r(t)}Sr.exports=function(t,e,r){return JSON.stringify(ra(t),e,r)};Sr.exports.ensureProperties=ra});var sa=I((id,aa)=>{var ne=require("fs"),ut=require("path");aa.exports=Ft;Ft.ncp=Ft;function Ft(t,e,r,n){var a=n;n||(a=r,r={});var s=process.cwd(),i=ut.resolve(s,t),o=ut.resolve(s,e),u=r.filter,l=r.rename,c=r.transform,h=r.clobber!==!1,f=r.modified,d=r.dereference,m=null,p=0,w=0,g=0,S=r.limit||Ft.limit||16;S=S<1?1:S>512?512:S,O(i);function O(v){if(p++,u){if(u instanceof RegExp){if(!u.test(v))return D(!0)}else if(typeof u=="function"&&!u(v))return D(!0)}return T(v)}function T(v){var b=d?ne.stat:ne.lstat;if(g>=S)return setImmediate(function(){T(v)});g++,b(v,function(E,x){var $={};if(E)return _(E);if($.name=v,$.mode=x.mode,$.mtime=x.mtime,$.atime=x.atime,x.isDirectory())return N($);if(x.isFile())return M($);if(x.isSymbolicLink())return k(v)})}function M(v){var b=v.name.replace(i,o);l&&(b=l(b)),y(b,function(E){if(E)return P(v,b);if(h&&U(b,function(){P(v,b)}),f){var x=d?ne.stat:ne.lstat;x(b,function($,H){if(v.mtime.getTime()>H.mtime.getTime())P(v,b);else return D()})}else return D()})}function P(v,b){var E=ne.createReadStream(v.name),x=ne.createWriteStream(b,{mode:v.mode});E.on("error",_),x.on("error",_),c?c(E,x,v):x.on("open",function(){E.pipe(x)}),x.once("finish",function(){f&&ne.utimesSync(b,v.atime,v.mtime),D()})}function U(v,b){ne.unlink(v,function(E){return E?_(E):b()})}function N(v){var b=v.name.replace(i,o);y(b,function(E){if(E)return L(v,b);j(v.name)})}function L(v,b){ne.mkdir(b,v.mode,function(E){if(E)return _(E);j(v.name)})}function j(v){ne.readdir(v,function(b,E){return b?_(b):(E.forEach(function(x){O(ut.join(v,x))}),D())})}function k(v){var b=v.replace(i,o);ne.readlink(v,function(E,x){if(E)return _(E);A(x,b)})}function A(v,b){d&&(v=ut.resolve(s,v)),y(b,function(E){if(E)return R(v,b);ne.readlink(b,function(x,$){return x?_(x):(d&&($=ut.resolve(s,$)),$===v?D():U(b,function(){R(v,b)}))})})}function R(v,b){ne.symlink(v,b,function(E){return E?_(E):D()})}function y(v,b){ne.lstat(v,function(E){return E&&E.code==="ENOENT"?b(!0):b(!1)})}function _(v){return r.stopOnError?a(v):(!m&&r.errs?m=ne.createWriteStream(r.errs):m||(m=[]),typeof m.write>"u"?m.push(v):m.write(v.stack+`
`),D())}function D(v){if(v||g--,w++,p===w&&g===0&&a!==void 0)return a(m||null)}}});var oa=I((od,ia)=>{ia.exports=function(t,e){for(var r=[],n=0;n<t.length;n++){var a=e(t[n],n);uu(a)?r.push.apply(r,a):r.push(a)}return r};var uu=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"}});var da=I((ud,fa)=>{"use strict";fa.exports=la;function la(t,e,r){t instanceof RegExp&&(t=ua(t,r)),e instanceof RegExp&&(e=ua(e,r));var n=ca(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 ua(t,e){var r=e.match(t);return r?r[0]:null}la.range=ca;function ca(t,e,r){var n,a,s,i,o,u=r.indexOf(t),l=r.indexOf(e,u+1),c=u;if(u>=0&&l>0){if(t===e)return[u,l];for(n=[],s=r.length;c>=0&&!o;)c==u?(n.push(c),u=r.indexOf(t,c+1)):n.length==1?o=[n.pop(),l]:(a=n.pop(),a<s&&(s=a,i=l),l=r.indexOf(e,c+1)),c=u<l&&u>=0?u:l;n.length&&(o=[s,i])}return o}});var Sa=I((ld,Da)=>{var lu=oa(),ha=da();Da.exports=du;var ma="\0SLASH"+Math.random()+"\0",pa="\0OPEN"+Math.random()+"\0",Rr="\0CLOSE"+Math.random()+"\0",ga="\0COMMA"+Math.random()+"\0",va="\0PERIOD"+Math.random()+"\0";function br(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function cu(t){return t.split("\\\\").join(ma).split("\\{").join(pa).split("\\}").join(Rr).split("\\,").join(ga).split("\\.").join(va)}function fu(t){return t.split(ma).join("\\").split(pa).join("{").split(Rr).join("}").split(ga).join(",").split(va).join(".")}function ya(t){if(!t)return[""];var e=[],r=ha("{","}",t);if(!r)return t.split(",");var n=r.pre,a=r.body,s=r.post,i=n.split(",");i[i.length-1]+="{"+a+"}";var o=ya(s);return s.length&&(i[i.length-1]+=o.shift(),i.push.apply(i,o)),e.push.apply(e,i),e}function du(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),je(cu(t),!0).map(fu)):[]}function hu(t){return"{"+t+"}"}function mu(t){return/^-?0\d/.test(t)}function pu(t,e){return t<=e}function gu(t,e){return t>=e}function je(t,e){var r=[],n=ha("{","}",t);if(!n||/\$$/.test(n.pre))return[t];var a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),s=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),i=a||s,o=n.body.indexOf(",")>=0;if(!i&&!o)return n.post.match(/,.*\}/)?(t=n.pre+"{"+n.body+Rr+n.post,je(t)):[t];var u;if(i)u=n.body.split(/\.\./);else if(u=ya(n.body),u.length===1&&(u=je(u[0],!1).map(hu),u.length===1)){var c=n.post.length?je(n.post,!1):[""];return c.map(function(k){return n.pre+u[0]+k})}var l=n.pre,c=n.post.length?je(n.post,!1):[""],h;if(i){var f=br(u[0]),d=br(u[1]),m=Math.max(u[0].length,u[1].length),p=u.length==3?Math.abs(br(u[2])):1,w=pu,g=d<f;g&&(p*=-1,w=gu);var S=u.some(mu);h=[];for(var O=f;w(O,d);O+=p){var T;if(s)T=String.fromCharCode(O),T==="\\"&&(T="");else if(T=String(O),S){var M=m-T.length;if(M>0){var P=new Array(M+1).join("0");O<0?T="-"+P+T.slice(1):T=P+T}}h.push(T)}}else h=lu(u,function(j){return je(j,!1)});for(var U=0;U<h.length;U++)for(var N=0;N<c.length;N++){var L=l+h[U]+c[N];(!e||i||L)&&r.push(L)}return r}});var Vt=I((cd,_a)=>{_a.exports=se;se.Minimatch=Q;var lt=function(){try{return require("path")}catch{}}()||{sep:"/"};se.sep=lt.sep;var _r=se.GLOBSTAR=Q.GLOBSTAR={},vu=Sa(),ba={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},wr="[^/]",Er=wr+"*?",yu="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Du="(?:(?!(?:\\/|^)\\.).)*?",Ra=Su("().*{}+?[]^$\\!");function Su(t){return t.split("").reduce(function(e,r){return e[r]=!0,e},{})}var wa=/\/+/;se.filter=bu;function bu(t,e){return e=e||{},function(r,n,a){return se(r,t,e)}}function Te(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}se.defaults=function(t){if(!t||typeof t!="object"||!Object.keys(t).length)return se;var e=se,r=function(a,s,i){return e(a,s,Te(t,i))};return r.Minimatch=function(a,s){return new e.Minimatch(a,Te(t,s))},r.Minimatch.defaults=function(a){return e.defaults(Te(t,a)).Minimatch},r.filter=function(a,s){return e.filter(a,Te(t,s))},r.defaults=function(a){return e.defaults(Te(t,a))},r.makeRe=function(a,s){return e.makeRe(a,Te(t,s))},r.braceExpand=function(a,s){return e.braceExpand(a,Te(t,s))},r.match=function(n,a,s){return e.match(n,a,Te(t,s))},r};Q.defaults=function(t){return se.defaults(t).Minimatch};function se(t,e,r){return $t(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);$t(t),e||(e={}),t=t.trim(),!e.allowWindowsEscape&<.sep!=="/"&&(t=t.split(lt.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=Ru;function Ru(){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(wa)}),this.debug(this.pattern,r),r=r.map(function(n,a,s){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=wu;function wu(){var t=this.pattern,e=!1,r=this.options,n=0;if(!r.nonegate){for(var a=0,s=t.length;a<s&&t.charAt(a)==="!";a++)e=!e,n++;n&&(this.pattern=t.substr(n)),this.negate=e}}se.braceExpand=function(t,e){return Ea(t,e)};Q.prototype.braceExpand=Ea;function Ea(t,e){return e||(this instanceof Q?e=this.options:e={}),t=typeof t>"u"?this.pattern:t,$t(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:vu(t)}var Eu=1024*64,$t=function(t){if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>Eu)throw new TypeError("pattern is too long")};Q.prototype.parse=_u;var Nt={};function _u(t,e){$t(t);var r=this.options;if(t==="**")if(r.noglobstar)t="*";else return _r;if(t==="")return"";var n="",a=!!r.nocase,s=!1,i=[],o=[],u,l=!1,c=-1,h=-1,f=t.charAt(0)==="."?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",d=this;function m(){if(u){switch(u){case"*":n+=Er,a=!0;break;case"?":n+=wr,a=!0;break;default:n+="\\"+u;break}d.debug("clearStateChar %j %j",u,n),u=!1}}for(var p=0,w=t.length,g;p<w&&(g=t.charAt(p));p++){if(this.debug("%s %s %s %j",t,p,n,g),s&&Ra[g]){n+="\\"+g,s=!1;continue}switch(g){case"/":return!1;case"\\":m(),s=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",t,p,n,g),l){this.debug(" in class"),g==="!"&&p===h+1&&(g="^"),n+=g;continue}d.debug("call clearStateChar %j",u),m(),u=g,r.noext&&m();continue;case"(":if(l){n+="(";continue}if(!u){n+="\\(";continue}i.push({type:u,start:p-1,reStart:n.length,open:ba[u].open,close:ba[u].close}),n+=u==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",u,n),u=!1;continue;case")":if(l||!i.length){n+="\\)";continue}m(),a=!0;var S=i.pop();n+=S.close,S.type==="!"&&o.push(S),S.reEnd=n.length;continue;case"|":if(l||!i.length||s){n+="\\|",s=!1;continue}m(),n+="|";continue;case"[":if(m(),l){n+="\\"+g;continue}l=!0,h=p,c=n.length,n+=g;continue;case"]":if(p===h+1||!l){n+="\\"+g,s=!1;continue}var O=t.substring(h+1,p);try{RegExp("["+O+"]")}catch{var T=this.parse(O,Nt);n=n.substr(0,c)+"\\["+T[0]+"\\]",a=a||T[1],l=!1;continue}a=!0,l=!1,n+=g;continue;default:m(),s?s=!1:Ra[g]&&!(g==="^"&&l)&&(n+="\\"),n+=g}}for(l&&(O=t.substr(h+1),T=this.parse(O,Nt),n=n.substr(0,c)+"\\["+T[0],a=a||T[1]),S=i.pop();S;S=i.pop()){var M=n.slice(S.reStart+S.open.length);this.debug("setting tail",n,S),M=M.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(x,$,H){return H||(H="\\"),$+$+H+"|"}),this.debug(`tail=%j
%s`,M,M,S,n);var P=S.type==="*"?Er:S.type==="?"?wr:"\\"+S.type;a=!0,n=n.slice(0,S.reStart)+P+"\\("+M}m(),s&&(n+="\\\\");var U=!1;switch(n.charAt(0)){case"[":case".":case"(":U=!0}for(var N=o.length-1;N>-1;N--){var L=o[N],j=n.slice(0,L.reStart),k=n.slice(L.reStart,L.reEnd-8),A=n.slice(L.reEnd-8,L.reEnd),R=n.slice(L.reEnd);A+=R;var y=j.split("(").length-1,_=R;for(p=0;p<y;p++)_=_.replace(/\)[+*?]?/,"");R=_;var D="";R===""&&e!==Nt&&(D="$");var v=j+k+R+D+A;n=v}if(n!==""&&a&&(n="(?=.)"+n),U&&(n=f+n),e===Nt)return[n,a];if(!a)return Tu(t);var b=r.nocase?"i":"";try{var E=new RegExp("^"+n+"$",b)}catch{return new RegExp("$.")}return E._glob=t,E._src=n,E}se.makeRe=function(t,e){return new Q(t,e||{}).makeRe()};Q.prototype.makeRe=Au;function Au(){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?Er:e.dot?yu:Du,n=e.nocase?"i":"",a=t.map(function(s){return s.map(function(i){return i===_r?r:typeof i=="string"?Cu(i):i._src}).join("\\/")}).join("|");a="^(?:"+a+")$",this.negate&&(a="^(?!"+a+").*$");try{this.regexp=new RegExp(a,n)}catch{this.regexp=!1}return this.regexp}se.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;lt.sep!=="/"&&(e=e.split(lt.sep).join("/")),e=e.split(wa),this.debug(this.pattern,"split",e);var a=this.set;this.debug(this.pattern,"set",a);var s,i;for(i=e.length-1;i>=0&&(s=e[i],!s);i--);for(i=0;i<a.length;i++){var o=a[i],u=e;n.matchBase&&o.length===1&&(u=[s]);var l=this.matchOne(u,o,r);if(l)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,s=0,i=t.length,o=e.length;a<i&&s<o;a++,s++){this.debug("matchOne loop");var u=e[s],l=t[a];if(this.debug(e,u,l),u===!1)return!1;if(u===_r){this.debug("GLOBSTAR",[e,u,l]);var c=a,h=s+1;if(h===o){for(this.debug("** at the end");a<i;a++)if(t[a]==="."||t[a]===".."||!n.dot&&t[a].charAt(0)===".")return!1;return!0}for(;c<i;){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,i,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===i))}var d;if(typeof u=="string"?(d=l===u,this.debug("string match",u,l,d)):(d=l.match(u),this.debug("pattern match",u,l,d)),!d)return!1}if(a===i&&s===o)return!0;if(a===i)return r;if(s===o)return a===i-1&&t[a]==="";throw new Error("wtf?")};function Tu(t){return t.replace(/\\(.)/g,"$1")}function Cu(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var Aa=I((fd,Ar)=>{typeof Object.create=="function"?Ar.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ar.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 Ta=I((dd,Cr)=>{try{if(Tr=require("util"),typeof Tr.inherits!="function")throw"";Cr.exports=Tr.inherits}catch{Cr.exports=Aa()}var Tr});var qt=I((hd,Ut)=>{"use strict";function Ca(t){return t.charAt(0)==="/"}function La(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)}Ut.exports=process.platform==="win32"?La:Ca;Ut.exports.posix=Ca;Ut.exports.win32=La});var Or=I(he=>{he.alphasort=xa;he.alphasorti=Oa;he.setopts=Mu;he.ownProp=ka;he.makeAbs=kr;he.finish=Iu;he.mark=Fu;he.isIgnored=Ma;he.childrenIgnored=Nu;function ka(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Be=require("path"),Lu=Vt(),ku=qt(),Lr=Lu.Minimatch;function Oa(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())}function xa(t,e){return t.localeCompare(e)}function Ou(t,e){t.ignore=e.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]),t.ignore.length&&(t.ignore=t.ignore.map(xu))}function xu(t){var e=null;if(t.slice(-3)==="/**"){var r=t.replace(/(\/\*\*)+$/,"");e=new Lr(r,{dot:!0})}return{matcher:new Lr(t,{dot:!0}),gmatcher:e}}function Mu(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),Ou(t,r),t.changedCwd=!1;var n=process.cwd();ka(r,"cwd")?(t.cwd=r.cwd,t.changedCwd=Be.resolve(r.cwd)!==n):t.cwd=n,t.root=r.root||Be.resolve(t.cwd,"/"),t.root=Be.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 Lr(e,r),t.options=t.minimatch.options}function Iu(t){for(var e=t.nounique,r=e?[]:Object.create(null),n=0,a=t.matches.length;n<a;n++){var s=t.matches[n];if(!s||Object.keys(s).length===0){if(t.nonull){var i=t.minimatch.globSet[n];e?r.push(i):r[i]=!0}}else{var o=Object.keys(s);e?r.push.apply(r,o):o.forEach(function(u){r[u]=!0})}}if(e||(r=Object.keys(r)),t.nosort||(r=r.sort(t.nocase?Oa:xa)),t.mark){for(var n=0;n<r.length;n++)r[n]=t._mark(r[n]);t.nodir&&(r=r.filter(function(u){return!/\/$/.test(u)}))}t.ignore.length&&(r=r.filter(function(u){return!Ma(t,u)})),t.found=r}function Fu(t,e){var r=kr(t,e),n=t.cache[r],a=e;if(n){var s=n==="DIR"||Array.isArray(n),i=e.slice(-1)==="/";if(s&&!i?a+="/":!s&&i&&(a=a.slice(0,-1)),a!==e){var o=kr(t,a);t.statCache[o]=t.statCache[r],t.cache[o]=t.cache[r]}}return a}function kr(t,e){var r=e;return e.charAt(0)==="/"?r=Be.join(t.root,e):ku(e)||e===""?r=e:t.changedCwd?r=Be.resolve(t.cwd,e):r=Be.resolve(e),r}function Ma(t,e){return t.ignore.length?t.ignore.some(function(r){return r.matcher.match(e)||!!(r.gmatcher&&r.gmatcher.match(e))}):!1}function Nu(t,e){return t.ignore.length?t.ignore.some(function(r){return!!(r.gmatcher&&r.gmatcher.match(e))}):!1}});var Va=I((Sd,$a)=>{$a.exports=Na;Na.GlobSync=W;var ct=require("fs"),Ia=Vt(),pd=Ia.Minimatch,gd=Ir().Glob,vd=require("util"),xr=require("path"),Fa=require("assert"),Yt=qt(),Ce=Or(),yd=Ce.alphasort,Dd=Ce.alphasorti,$u=Ce.setopts,Mr=Ce.ownProp,Vu=Ce.childrenIgnored;function Na(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 W(t,e).found}function W(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 W))return new W(t,e);if($u(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()}W.prototype._finish=function(){if(Fa(this instanceof W),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 s=ct.realpathSync(a,t.realpathCache);n[s]=!0}catch(i){if(i.syscall==="stat")n[t._makeAbs(a)]=!0;else throw i}})}Ce.finish(this)};W.prototype._process=function(t,e,r){Fa(this instanceof W);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 s=t.slice(n),i;a===null?i=".":((Yt(a)||Yt(t.join("/")))&&(!a||!Yt(a))&&(a="/"+a),i=a);var o=this._makeAbs(i);if(!Vu(this,i)){var u=s[0]===Ia.GLOBSTAR;u?this._processGlobStar(a,i,o,s,e,r):this._processReaddir(a,i,o,s,e,r)}};W.prototype._processReaddir=function(t,e,r,n,a,s){var i=this._readdir(r,s);if(i){for(var o=n[0],u=!!this.minimatch.negate,l=o._glob,c=this.dot||l.charAt(0)===".",h=[],f=0;f<i.length;f++){var d=i[f];if(d.charAt(0)!=="."||c){var m;u&&!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=xr.join(this.root,d)),this.matches[a][d]=!0}return}n.shift();for(var f=0;f<p;f++){var d=h[f],w;t?w=[t,d]:w=[d],this._process(w.concat(n),a,s)}}}};W.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)}};W.prototype._readdirInGlobStar=function(t){if(this.follow)return this._readdir(t,!1);var e,r,n;try{r=ct.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};W.prototype._readdir=function(t,e){var r;if(e&&!Mr(this.symlinks,t))return this._readdirInGlobStar(t);if(Mr(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,ct.readdirSync(t))}catch(a){return this._readdirError(t,a),null}};W.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};W.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}};W.prototype._processGlobStar=function(t,e,r,n,a,s){var i=this._readdir(r,s);if(i){var o=n.slice(1),u=t?[t]:[],l=u.concat(o);this._process(l,a,!1);var c=i.length,h=this.symlinks[r];if(!(h&&s))for(var f=0;f<c;f++){var d=i[f];if(!(d.charAt(0)==="."&&!this.dot)){var m=u.concat(i[f],o);this._process(m,a,!0);var p=u.concat(i[f],n);this._process(p,a,!0)}}}};W.prototype._processSimple=function(t,e){var r=this._stat(t);if(this.matches[e]||(this.matches[e]=Object.create(null)),!!r){if(t&&Yt(t)&&!this.nomount){var n=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=xr.join(this.root,t):(t=xr.resolve(this.root,t),n&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this.matches[e][t]=!0}};W.prototype._stat=function(t){var e=this._makeAbs(t),r=t.slice(-1)==="/";if(t.length>this.maxLength)return!1;if(!this.stat&&Mr(this.cache,e)){var i=this.cache[e];if(Array.isArray(i)&&(i="DIR"),!r||i==="DIR")return i;if(r&&i==="FILE")return!1}var n,a=this.statCache[e];if(!a){var s;try{s=ct.lstatSync(e)}catch{return!1}if(s.isSymbolicLink())try{a=ct.statSync(e)}catch{a=s}else a=s}this.statCache[e]=a;var i=a.isDirectory()?"DIR":"FILE";return this.cache[e]=this.cache[e]||i,r&&i!=="DIR"?!1:i};W.prototype._mark=function(t){return Ce.mark(this,t)};W.prototype._makeAbs=function(t){return Ce.makeAbs(this,t)}});var Fr=I((bd,qa)=>{qa.exports=Ua;function Ua(t,e){if(t&&e)return Ua(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 s=t.apply(this,n),i=n[n.length-1];return typeof s=="function"&&s!==i&&Object.keys(i).forEach(function(o){s[o]=i[o]}),s}}});var $r=I((Rd,Nr)=>{var Ya=Fr();Nr.exports=Ya(Pt);Nr.exports.strict=Ya(Pa);Pt.proto=Pt(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Pt(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Pa(this)},configurable:!0})});function Pt(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function Pa(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 Ba=I((wd,ja)=>{var Uu=Fr(),ft=Object.create(null),qu=$r();ja.exports=Uu(Yu);function Yu(t,e){return ft[t]?(ft[t].push(e),null):(ft[t]=[e],Pu(t))}function Pu(t){return qu(function e(){var r=ft[t],n=r.length,a=ju(arguments);try{for(var s=0;s<n;s++)r[s].apply(null,a)}finally{r.length>n?(r.splice(0,n),process.nextTick(function(){e.apply(null,a)})):delete ft[t]}})}function ju(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n]=t[n];return r}});var Ir=I((Cd,Ha)=>{Ha.exports=Me;var dt=require("fs"),Ga=Vt(),Ed=Ga.Minimatch,Bu=Ta(),Gu=require("events").EventEmitter,Vr=require("path"),Ur=require("assert"),jt=qt(),Yr=Va(),De=Or(),_d=De.alphasort,Ad=De.alphasorti,Hu=De.setopts,qr=De.ownProp,Pr=Ba(),Td=require("util"),Xu=De.childrenIgnored,zu=De.isIgnored,Wu=$r();function Me(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 Yr(t,e)}return new q(t,e,r)}Me.sync=Yr;var Ju=Me.GlobSync=Yr.GlobSync;Me.glob=Me;function Qu(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}Me.hasMagic=function(t,e){var r=Qu({},e);r.noprocess=!0;var n=new q(t,r),a=n.minimatch.set;if(a.length>1)return!0;for(var s=0;s<a[0].length;s++)if(typeof a[0][s]!="string")return!0;return!1};Me.Glob=q;Bu(q,Gu);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 Ju(t,e)}if(!(this instanceof q))return new q(t,e,r);Hu(this,t,e),this._didRealPath=!1;var a=this.minimatch.set.length;this.matches=new Array(a),typeof r=="function"&&(r=Wu(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 i();for(var s=0;s<a;s++)this._process(this.minimatch.set[s],s,!1,i);function i(){--n._processing,n._processing<=0&&n._finish()}}q.prototype._finish=function(){if(Ur(this instanceof q),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();De.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,s=n.length;if(s===0)return e();var i=this.matches[t]=Object.create(null);n.forEach(function(o,u){o=a._makeAbs(o),dt.realpath(o,a.realpathCache,function(l,c){l?l.syscall==="stat"?i[o]=!0:a.emit("error",l):i[c]=!0,--s===0&&(a.matches[t]=i,e())})})};q.prototype._mark=function(t){return De.mark(this,t)};q.prototype._makeAbs=function(t){return De.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(Ur(this instanceof q),Ur(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 s;switch(a){case t.length:this._processSimple(t.join("/"),e,n);return;case 0:s=null;break;default:s=t.slice(0,a).join("/");break}var i=t.slice(a),o;s===null?o=".":((jt(s)||jt(t.join("/")))&&(!s||!jt(s))&&(s="/"+s),o=s);var u=this._makeAbs(o);if(Xu(this,o))return n();var l=i[0]===Ga.GLOBSTAR;l?this._processGlobStar(s,o,u,i,e,r,n):this._processReaddir(s,o,u,i,e,r,n)}};q.prototype._processReaddir=function(t,e,r,n,a,s,i){var o=this;this._readdir(r,s,function(u,l){return o._processReaddir2(t,e,r,n,a,s,l,i)})};q.prototype._processReaddir2=function(t,e,r,n,a,s,i,o){if(!i)return o();for(var u=n[0],l=!!this.minimatch.negate,c=u._glob,h=this.dot||c.charAt(0)===".",f=[],d=0;d<i.length;d++){var m=i[d];if(m.charAt(0)!=="."||h){var p;l&&!t?p=!m.match(u):p=m.match(u),p&&f.push(m)}}var w=f.length;if(w===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<w;d++){var m=f[d];t&&(t!=="/"?m=t+"/"+m:m=t+m),m.charAt(0)==="/"&&!this.nomount&&(m=Vr.join(this.root,m)),this._emitMatch(a,m)}return o()}n.shift();for(var d=0;d<w;d++){var m=f[d],g;t&&(t!=="/"?m=t+"/"+m:m=t+m),this._process([m].concat(n),a,s,o)}o()};q.prototype._emitMatch=function(t,e){if(!this.aborted&&!this.matches[t][e]&&!zu(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=Pr(r,s);a&&dt.lstat(t,a);function s(i,o){if(i)return e();var u=o.isSymbolicLink();n.symlinks[t]=u,!u&&!o.isDirectory()?(n.cache[t]="FILE",e()):n._readdir(t,!1,e)}};q.prototype._readdir=function(t,e,r){if(!this.aborted&&(r=Pr("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;dt.readdir(t,Ku(this,t,r))}};function Ku(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,s,i){var o=this;this._readdir(r,s,function(u,l){o._processGlobStar2(t,e,r,n,a,s,l,i)})};q.prototype._processGlobStar2=function(t,e,r,n,a,s,i,o){if(!i)return o();var u=n.slice(1),l=t?[t]:[],c=l.concat(u);this._process(c,a,!1,o);var h=this.symlinks[r],f=i.length;if(h&&s)return o();for(var d=0;d<f;d++){var m=i[d];if(!(m.charAt(0)==="."&&!this.dot)){var p=l.concat(i[d],u);this._process(p,a,!0,o);var w=l.concat(i[d],n);this._process(w,a,!0,o)}}o()};q.prototype._processSimple=function(t,e,r){var n=this;this._stat(t,function(a,s){n._processSimple2(t,e,a,s,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&&jt(t)&&!this.nomount){var s=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=Vr.join(this.root,t):(t=Vr.resolve(this.root,t),s&&(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 s,i=this.statCache[r];if(i!==void 0){if(i===!1)return e(null,i);var o=i.isDirectory()?"DIR":"FILE";return n&&o==="FILE"?e():e(null,o,i)}var u=this,l=Pr("stat\0"+r,c);l&&dt.lstat(r,l);function c(h,f){if(f&&f.isSymbolicLink())return dt.stat(r,function(d,m){d?u._stat2(t,r,null,f,e):u._stat2(t,r,d,m,e)});u._stat2(t,r,h,f,e)}};q.prototype._stat2=function(t,e,r,n,a){if(r)return this.statCache[e]=!1,a();var s=t.slice(-1)==="/";if(this.statCache[e]=n,e.slice(-1)==="/"&&!n.isDirectory())return a(null,!1,n);var i=n.isDirectory()?"DIR":"FILE";return this.cache[e]=this.cache[e]||i,s&&i!=="DIR"?a():a(null,i,n)}});var Ka=I((Ld,Qa)=>{Qa.exports=Hr;Hr.sync=Ja;var V=require("assert"),Xa=require("path"),Ht=require("fs"),Xt=Ir(),za={nosort:!0,nocomment:!0,nonegate:!0,silent:!0},jr=0,Gr=process.platform==="win32";function Wa(t){var e=["unlink","chmod","stat","lstat","rmdir","readdir"];e.forEach(function(r){t[r]=t[r]||Ht[r],r=r+"Sync",t[r]=t[r]||Ht[r]}),t.maxBusyTries=t.maxBusyTries||3,t.emfileWait=t.emfileWait||1e3,t.disableGlob=t.disableGlob||!1}function Hr(t,e,r){typeof e=="function"&&(r=e,e={}),V(t,"rimraf: missing path"),V.equal(typeof t,"string","rimraf: path should be a string"),V(e,"rimraf: missing options"),V.equal(typeof e,"object","rimraf: options should be object"),V.equal(typeof r,"function","rimraf: callback function required"),Wa(e);var n=0,a=null,s=0;if(e.disableGlob||!Xt.hasMagic(t))return o(null,[t]);Ht.lstat(t,function(u,l){if(!u)return o(null,[t]);Xt(t,za,o)});function i(u){a=a||u,--s===0&&r(a)}function o(u,l){if(u)return r(u);if(s=l.length,s===0)return r();l.forEach(function(c){Br(c,e,function h(f){if(f){if(Gr&&(f.code==="EBUSY"||f.code==="ENOTEMPTY"||f.code==="EPERM")&&n<e.maxBusyTries){n++;var d=n*100;return setTimeout(function(){Br(c,e,h)},d)}if(f.code==="EMFILE"&&jr<e.emfileWait)return setTimeout(function(){Br(c,e,h)},jr++);f.code==="ENOENT"&&(f=null)}jr=0,i(f)})})}}function Br(t,e,r){V(t),V(e),V(typeof r=="function"),e.lstat(t,function(n,a){if(n&&n.code==="ENOENT")return r(null);if(a&&a.isDirectory())return Bt(t,e,n,r);e.unlink(t,function(s){if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return Gr?Zu(t,e,s,r):Bt(t,e,s,r);if(s.code==="EISDIR")return Bt(t,e,s,r)}return r(s)})})}function Zu(t,e,r,n){V(t),V(e),V(typeof n=="function"),r&&V(r instanceof Error),e.chmod(t,666,function(a){a?n(a.code==="ENOENT"?null:r):e.stat(t,function(s,i){s?n(s.code==="ENOENT"?null:r):i.isDirectory()?Bt(t,e,r,n):e.unlink(t,n)})})}function el(t,e,r){V(t),V(e),r&&V(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()?Gt(t,e,r):e.unlinkSync(t)}function Bt(t,e,r,n){V(t),V(e),r&&V(r instanceof Error),V(typeof n=="function"),e.rmdir(t,function(a){a&&(a.code==="ENOTEMPTY"||a.code==="EEXIST"||a.code==="EPERM")?tl(t,e,n):a&&a.code==="ENOTDIR"?n(r):n(a)})}function tl(t,e,r){V(t),V(e),V(typeof r=="function"),e.readdir(t,function(n,a){if(n)return r(n);var s=a.length;if(s===0)return e.rmdir(t,r);var i;a.forEach(function(o){Hr(Xa.join(t,o),e,function(u){if(!i){if(u)return r(i=u);--s===0&&e.rmdir(t,r)}})})})}function Ja(t,e){e=e||{},Wa(e),V(t,"rimraf: missing path"),V.equal(typeof t,"string","rimraf: path should be a string"),V(e,"rimraf: missing options"),V.equal(typeof e,"object","rimraf: options should be object");var r;if(e.disableGlob||!Xt.hasMagic(t))r=[t];else try{Ht.lstatSync(t),r=[t]}catch{r=Xt.sync(t,za)}if(r.length)for(var n=0;n<r.length;n++){var t=r[n];try{var a=e.lstatSync(t)}catch(i){if(i.code==="ENOENT")return}try{a&&a.isDirectory()?Gt(t,e,null):e.unlinkSync(t)}catch(i){if(i.code==="ENOENT")return;if(i.code==="EPERM")return Gr?el(t,e,i):Gt(t,e,i);if(i.code!=="EISDIR")throw i;Gt(t,e,i)}}}function Gt(t,e,r){V(t),V(e),r&&V(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")&&rl(t,e)}}function rl(t,e){V(t),V(e),e.readdirSync(t).forEach(function(r){Ja(Xa.join(t,r),e)}),e.rmdirSync(t,e)}});var rs=I((kd,ts)=>{var ht=require("path"),Za=require("fs"),es=parseInt("0777",8);ts.exports=Ge.mkdirp=Ge.mkdirP=Ge;function Ge(t,e,r,n){typeof e=="function"?(r=e,e={}):(!e||typeof e!="object")&&(e={mode:e});var a=e.mode,s=e.fs||Za;a===void 0&&(a=es),n||(n=null);var i=r||function(){};t=ht.resolve(t),s.mkdir(t,a,function(o){if(!o)return n=n||t,i(null,n);switch(o.code){case"ENOENT":if(ht.dirname(t)===t)return i(o);Ge(ht.dirname(t),e,function(u,l){u?i(u,l):Ge(t,e,i,l)});break;default:s.stat(t,function(u,l){u||!l.isDirectory()?i(o,n):i(null,n)});break}})}Ge.sync=function t(e,r,n){(!r||typeof r!="object")&&(r={mode:r});var a=r.mode,s=r.fs||Za;a===void 0&&(a=es),n||(n=null),e=ht.resolve(e);try{s.mkdirSync(e,a),n=n||e}catch(o){switch(o.code){case"ENOENT":n=t(ht.dirname(e),r,n),t(e,r,n);break;default:var i;try{i=s.statSync(e)}catch{throw o}if(!i.isDirectory())throw o;break}}return n}});var os=I((Od,is)=>{var He=require("fs"),nl=sa().ncp,al=require("path"),ns=Ka(),sl=rs();is.exports=il;function il(t,e,r,n){typeof r=="function"&&(n=r,r={});var a=!!r.mkdirp,s=r.clobber!==!1,i=r.limit||16;a?o():u();function o(){sl(al.dirname(e),function(l){if(l)return n(l);u()})}function u(){s?He.rename(t,e,function(l){if(!l)return n();if(l.code!=="EXDEV")return n(l);as(t,e,s,i,n)}):He.link(t,e,function(l){if(l){if(l.code==="EXDEV"){as(t,e,s,i,n);return}if(l.code==="EISDIR"||l.code==="EPERM"){ss(t,e,s,i,n);return}n(l);return}He.unlink(t,n)})}}function as(t,e,r,n,a){var s=r?"w":"wx",i=He.createReadStream(t),o=He.createWriteStream(e,{flags:s});i.on("error",function(l){i.destroy(),o.destroy(),o.removeListener("close",u),l.code==="EISDIR"||l.code==="EPERM"?ss(t,e,r,n,a):a(l)}),o.on("error",function(l){i.destroy(),o.destroy(),o.removeListener("close",u),a(l)}),o.once("close",u),i.pipe(o);function u(){He.unlink(t,a)}}function ss(t,e,r,n,a){var s={stopOnErr:!0,clobber:!1,limit:n};r?ns(e,{disableGlob:!0},function(o){if(o)return a(o);i()}):i();function i(){nl(t,e,s,function(o){if(o)return a(o[0]);ns(t,{disableGlob:!0},a)})}}});var ls=I(Xr=>{var us="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");Xr.encode=function(t){if(0<=t&&t<us.length)return us[t];throw new TypeError("Must be between 0 and 63: "+t)};Xr.decode=function(t){var e=65,r=90,n=97,a=122,s=48,i=57,o=43,u=47,l=26,c=52;return e<=t&&t<=r?t-e:n<=t&&t<=a?t-n+l:s<=t&&t<=i?t-s+c:t==o?62:t==u?63:-1}});var Jr=I(Wr=>{var cs=ls(),zr=5,fs=1<<zr,ds=fs-1,hs=fs;function ol(t){return t<0?(-t<<1)+1:(t<<1)+0}function ul(t){var e=(t&1)===1,r=t>>1;return e?-r:r}Wr.encode=function(e){var r="",n,a=ol(e);do n=a&ds,a>>>=zr,a>0&&(n|=hs),r+=cs.encode(n);while(a>0);return r};Wr.decode=function(e,r,n){var a=e.length,s=0,i=0,o,u;do{if(r>=a)throw new Error("Expected more digits in base 64 VLQ value.");if(u=cs.decode(e.charCodeAt(r++)),u===-1)throw new Error("Invalid base64 digit: "+e.charAt(r-1));o=!!(u&hs),u&=ds,s=s+(u<<i),i+=zr}while(o);n.value=ul(s),n.rest=r}});var We=I(re=>{function ll(t,e,r){if(e in t)return t[e];if(arguments.length===3)return r;throw new Error('"'+e+'" is a required argument.')}re.getArg=ll;var ms=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,cl=/^data:.+\,.+$/;function mt(t){var e=t.match(ms);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}re.urlParse=mt;function Xe(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}re.urlGenerate=Xe;function Qr(t){var e=t,r=mt(t);if(r){if(!r.path)return t;e=r.path}for(var n=re.isAbsolute(e),a=e.split(/\/+/),s,i=0,o=a.length-1;o>=0;o--)s=a[o],s==="."?a.splice(o,1):s===".."?i++:i>0&&(s===""?(a.splice(o+1,i),i=0):(a.splice(o,2),i--));return e=a.join("/"),e===""&&(e=n?"/":"."),r?(r.path=e,Xe(r)):e}re.normalize=Qr;function ps(t,e){t===""&&(t="."),e===""&&(e=".");var r=mt(e),n=mt(t);if(n&&(t=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),Xe(r);if(r||e.match(cl))return e;if(n&&!n.host&&!n.path)return n.host=e,Xe(n);var a=e.charAt(0)==="/"?e:Qr(t.replace(/\/+$/,"")+"/"+e);return n?(n.path=a,Xe(n)):a}re.join=ps;re.isAbsolute=function(t){return t.charAt(0)==="/"||ms.test(t)};function fl(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)}re.relative=fl;var gs=function(){var t=Object.create(null);return!("__proto__"in t)}();function vs(t){return t}function dl(t){return ys(t)?"$"+t:t}re.toSetString=gs?vs:dl;function hl(t){return ys(t)?t.slice(1):t}re.fromSetString=gs?vs:hl;function ys(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 ml(t,e,r){var n=ze(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:ze(t.name,e.name)}re.compareByOriginalPositions=ml;function pl(t,e,r){var n=t.generatedLine-e.generatedLine;return n!==0||(n=t.generatedColumn-e.generatedColumn,n!==0||r)||(n=ze(t.source,e.source),n!==0)||(n=t.originalLine-e.originalLine,n!==0)||(n=t.originalColumn-e.originalColumn,n!==0)?n:ze(t.name,e.name)}re.compareByGeneratedPositionsDeflated=pl;function ze(t,e){return t===e?0:t===null?1:e===null?-1:t>e?1:-1}function gl(t,e){var r=t.generatedLine-e.generatedLine;return r!==0||(r=t.generatedColumn-e.generatedColumn,r!==0)||(r=ze(t.source,e.source),r!==0)||(r=t.originalLine-e.originalLine,r!==0)||(r=t.originalColumn-e.originalColumn,r!==0)?r:ze(t.name,e.name)}re.compareByGeneratedPositionsInflated=gl;function vl(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))}re.parseSourceMapInput=vl;function yl(t,e,r){if(e=e||"",t&&(t[t.length-1]!=="/"&&e[0]!=="/"&&(t+="/"),e=t+e),r){var n=mt(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=ps(Xe(n),e)}return Qr(e)}re.computeSourceURL=yl});var en=I(Ds=>{var Kr=We(),Zr=Object.prototype.hasOwnProperty,Ie=typeof Map<"u";function Se(){this._array=[],this._set=Ie?new Map:Object.create(null)}Se.fromArray=function(e,r){for(var n=new Se,a=0,s=e.length;a<s;a++)n.add(e[a],r);return n};Se.prototype.size=function(){return Ie?this._set.size:Object.getOwnPropertyNames(this._set).length};Se.prototype.add=function(e,r){var n=Ie?e:Kr.toSetString(e),a=Ie?this.has(e):Zr.call(this._set,n),s=this._array.length;(!a||r)&&this._array.push(e),a||(Ie?this._set.set(e,s):this._set[n]=s)};Se.prototype.has=function(e){if(Ie)return this._set.has(e);var r=Kr.toSetString(e);return Zr.call(this._set,r)};Se.prototype.indexOf=function(e){if(Ie){var r=this._set.get(e);if(r>=0)return r}else{var n=Kr.toSetString(e);if(Zr.call(this._set,n))return this._set[n]}throw new Error('"'+e+'" is not in the set.')};Se.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)};Se.prototype.toArray=function(){return this._array.slice()};Ds.ArraySet=Se});var Rs=I(bs=>{var Ss=We();function Dl(t,e){var r=t.generatedLine,n=e.generatedLine,a=t.generatedColumn,s=e.generatedColumn;return n>r||n==r&&s>=a||Ss.compareByGeneratedPositionsInflated(t,e)<=0}function zt(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}zt.prototype.unsortedForEach=function(e,r){this._array.forEach(e,r)};zt.prototype.add=function(e){Dl(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))};zt.prototype.toArray=function(){return this._sorted||(this._array.sort(Ss.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};bs.MappingList=zt});var tn=I(ws=>{var pt=Jr(),X=We(),Wt=en().ArraySet,Sl=Rs().MappingList;function ce(t){t||(t={}),this._file=X.getArg(t,"file",null),this._sourceRoot=X.getArg(t,"sourceRoot",null),this._skipValidation=X.getArg(t,"skipValidation",!1),this._sources=new Wt,this._names=new Wt,this._mappings=new Sl,this._sourcesContents=null}ce.prototype._version=3;ce.fromSourceMap=function(e){var r=e.sourceRoot,n=new ce({file:e.file,sourceRoot:r});return e.eachMapping(function(a){var s={generated:{line:a.generatedLine,column:a.generatedColumn}};a.source!=null&&(s.source=a.source,r!=null&&(s.source=X.relative(r,s.source)),s.original={line:a.originalLine,column:a.originalColumn},a.name!=null&&(s.name=a.name)),n.addMapping(s)}),e.sources.forEach(function(a){var s=a;r!==null&&(s=X.relative(r,a)),n._sources.has(s)||n._sources.add(s);var i=e.sourceContentFor(a);i!=null&&n.setSourceContent(a,i)}),n};ce.prototype.addMapping=function(e){var r=X.getArg(e,"generated"),n=X.getArg(e,"original",null),a=X.getArg(e,"source",null),s=X.getArg(e,"name",null);this._skipValidation||this._validateMapping(r,n,a,s),a!=null&&(a=String(a),this._sources.has(a)||this._sources.add(a)),s!=null&&(s=String(s),this._names.has(s)||this._names.add(s)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:a,name:s})};ce.prototype.setSourceContent=function(e,r){var n=e;this._sourceRoot!=null&&(n=X.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[X.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[X.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};ce.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 s=this._sourceRoot;s!=null&&(a=X.relative(s,a));var i=new Wt,o=new Wt;this._mappings.unsortedForEach(function(u){if(u.source===a&&u.originalLine!=null){var l=e.originalPositionFor({line:u.originalLine,column:u.originalColumn});l.source!=null&&(u.source=l.source,n!=null&&(u.source=X.join(n,u.source)),s!=null&&(u.source=X.relative(s,u.source)),u.originalLine=l.line,u.originalColumn=l.column,l.name!=null&&(u.name=l.name))}var c=u.source;c!=null&&!i.has(c)&&i.add(c);var h=u.name;h!=null&&!o.has(h)&&o.add(h)},this),this._sources=i,this._names=o,e.sources.forEach(function(u){var l=e.sourceContentFor(u);l!=null&&(n!=null&&(u=X.join(n,u)),s!=null&&(u=X.relative(s,u)),this.setSourceContent(u,l))},this)};ce.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}))}};ce.prototype._serializeMappings=function(){for(var e=0,r=1,n=0,a=0,s=0,i=0,o="",u,l,c,h,f=this._mappings.toArray(),d=0,m=f.length;d<m;d++){if(l=f[d],u="",l.generatedLine!==r)for(e=0;l.generatedLine!==r;)u+=";",r++;else if(d>0){if(!X.compareByGeneratedPositionsInflated(l,f[d-1]))continue;u+=","}u+=pt.encode(l.generatedColumn-e),e=l.generatedColumn,l.source!=null&&(h=this._sources.indexOf(l.source),u+=pt.encode(h-i),i=h,u+=pt.encode(l.originalLine-1-a),a=l.originalLine-1,u+=pt.encode(l.originalColumn-n),n=l.originalColumn,l.name!=null&&(c=this._names.indexOf(l.name),u+=pt.encode(c-s),s=c)),o+=u}return o};ce.prototype._generateSourcesContent=function(e,r){return e.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=X.relative(r,n));var a=X.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,a)?this._sourcesContents[a]:null},this)};ce.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};ce.prototype.toString=function(){return JSON.stringify(this.toJSON())};ws.SourceMapGenerator=ce});var Es=I(Fe=>{Fe.GREATEST_LOWER_BOUND=1;Fe.LEAST_UPPER_BOUND=2;function rn(t,e,r,n,a,s){var i=Math.floor((e-t)/2)+t,o=a(r,n[i],!0);return o===0?i:o>0?e-i>1?rn(i,e,r,n,a,s):s==Fe.LEAST_UPPER_BOUND?e<n.length?e:-1:i:i-t>1?rn(t,i,r,n,a,s):s==Fe.LEAST_UPPER_BOUND?i:t<0?-1:t}Fe.search=function(e,r,n,a){if(r.length===0)return-1;var s=rn(-1,r.length,e,r,n,a||Fe.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&n(r[s],r[s-1],!0)===0;)--s;return s}});var As=I(_s=>{function nn(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function bl(t,e){return Math.round(t+Math.random()*(e-t))}function an(t,e,r,n){if(r<n){var a=bl(r,n),s=r-1;nn(t,a,n);for(var i=t[n],o=r;o<n;o++)e(t[o],i)<=0&&(s+=1,nn(t,s,o));nn(t,s+1,o);var u=s+1;an(t,e,r,u-1),an(t,e,u+1,n)}}_s.quickSort=function(t,e){an(t,e,0,t.length-1)}});var Cs=I(Jt=>{var C=We(),sn=Es(),Je=en().ArraySet,Rl=Jr(),gt=As().quickSort;function B(t,e){var r=t;return typeof t=="string"&&(r=C.parseSourceMapInput(t)),r.sections!=null?new fe(r,e):new K(r,e)}B.fromSourceMap=function(t,e){return K.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,s=n||B.GENERATED_ORDER,i;switch(s){case B.GENERATED_ORDER:i=this._generatedMappings;break;case B.ORIGINAL_ORDER:i=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var o=this.sourceRoot;i.map(function(u){var l=u.source===null?null:this._sources.at(u.source);return l=C.computeSourceURL(o,l,this._sourceMapURL),{source:l,generatedLine:u.generatedLine,generatedColumn:u.generatedColumn,originalLine:u.originalLine,originalColumn:u.originalColumn,name:u.name===null?null:this._names.at(u.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=[],s=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",C.compareByOriginalPositions,sn.LEAST_UPPER_BOUND);if(s>=0){var i=this._originalMappings[s];if(e.column===void 0)for(var o=i.originalLine;i&&i.originalLine===o;)a.push({line:C.getArg(i,"generatedLine",null),column:C.getArg(i,"generatedColumn",null),lastColumn:C.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++s];else for(var u=i.originalColumn;i&&i.originalLine===r&&i.originalColumn==u;)a.push({line:C.getArg(i,"generatedLine",null),column:C.getArg(i,"generatedColumn",null),lastColumn:C.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++s]}return a};Jt.SourceMapConsumer=B;function K(t,e){var r=t;typeof t=="string"&&(r=C.parseSourceMapInput(t));var n=C.getArg(r,"version"),a=C.getArg(r,"sources"),s=C.getArg(r,"names",[]),i=C.getArg(r,"sourceRoot",null),o=C.getArg(r,"sourcesContent",null),u=C.getArg(r,"mappings"),l=C.getArg(r,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);i&&(i=C.normalize(i)),a=a.map(String).map(C.normalize).map(function(c){return i&&C.isAbsolute(i)&&C.isAbsolute(c)?C.relative(i,c):c}),this._names=Je.fromArray(s.map(String),!0),this._sources=Je.fromArray(a,!0),this._absoluteSources=this._sources.toArray().map(function(c){return C.computeSourceURL(i,c,e)}),this.sourceRoot=i,this.sourcesContent=o,this._mappings=u,this._sourceMapURL=e,this.file=l}K.prototype=Object.create(B.prototype);K.prototype.consumer=B;K.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};K.fromSourceMap=function(e,r){var n=Object.create(K.prototype),a=n._names=Je.fromArray(e._names.toArray(),!0),s=n._sources=Je.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 i=e._mappings.toArray().slice(),o=n.__generatedMappings=[],u=n.__originalMappings=[],l=0,c=i.length;l<c;l++){var h=i[l],f=new Ts;f.generatedLine=h.generatedLine,f.generatedColumn=h.generatedColumn,h.source&&(f.source=s.indexOf(h.source),f.originalLine=h.originalLine,f.originalColumn=h.originalColumn,h.name&&(f.name=a.indexOf(h.name)),u.push(f)),o.push(f)}return gt(n.__originalMappings,C.compareByOriginalPositions),n};K.prototype._version=3;Object.defineProperty(K.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function Ts(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}K.prototype._parseMappings=function(e,r){for(var n=1,a=0,s=0,i=0,o=0,u=0,l=e.length,c=0,h={},f={},d=[],m=[],p,w,g,S,O;c<l;)if(e.charAt(c)===";")n++,c++,a=0;else if(e.charAt(c)===",")c++;else{for(p=new Ts,p.generatedLine=n,S=c;S<l&&!this._charIsMappingSeparator(e,S);S++);if(w=e.slice(c,S),g=h[w],g)c+=w.length;else{for(g=[];c<S;)Rl.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[w]=g}p.generatedColumn=a+g[0],a=p.generatedColumn,g.length>1&&(p.source=o+g[1],o+=g[1],p.originalLine=s+g[2],s=p.originalLine,p.originalLine+=1,p.originalColumn=i+g[3],i=p.originalColumn,g.length>4&&(p.name=u+g[4],u+=g[4])),m.push(p),typeof p.originalLine=="number"&&d.push(p)}gt(m,C.compareByGeneratedPositionsDeflated),this.__generatedMappings=m,gt(d,C.compareByOriginalPositions),this.__originalMappings=d};K.prototype._findMapping=function(e,r,n,a,s,i){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 sn.search(e,r,s,i)};K.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}};K.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 s=C.getArg(a,"source",null);s!==null&&(s=this._sources.at(s),s=C.computeSourceURL(this.sourceRoot,s,this._sourceMapURL));var i=C.getArg(a,"name",null);return i!==null&&(i=this._names.at(i)),{source:s,line:C.getArg(a,"originalLine",null),column:C.getArg(a,"originalColumn",null),name:i}}}return{source:null,line:null,column:null,name:null}};K.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1};K.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 s;if(this.sourceRoot!=null&&(s=C.urlParse(this.sourceRoot))){var i=a.replace(/^file:\/\//,"");if(s.scheme=="file"&&this._sources.has(i))return this.sourcesContent[this._sources.indexOf(i)];if((!s.path||s.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.')};K.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 s=this._originalMappings[a];if(s.source===n.source)return{line:C.getArg(s,"generatedLine",null),column:C.getArg(s,"generatedColumn",null),lastColumn:C.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};Jt.BasicSourceMapConsumer=K;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 Je,this._names=new Je;var s={line:-1,column:0};this._sections=a.map(function(i){if(i.url)throw new Error("Support for url field in sections not implemented.");var o=C.getArg(i,"offset"),u=C.getArg(o,"line"),l=C.getArg(o,"column");if(u<s.line||u===s.line&&l<s.column)throw new Error("Section offsets must be ordered and non-overlapping.");return s=o,{generatedOffset:{generatedLine:u+1,generatedColumn:l+1},consumer:new B(C.getArg(i,"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=sn.search(r,this._sections,function(s,i){var o=s.generatedLine-i.generatedOffset.generatedLine;return o||s.generatedColumn-i.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],s=a.consumer.sourceContentFor(e,!0);if(s)return s}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 s={line:a.line+(n.generatedOffset.generatedLine-1),column:a.column+(n.generatedOffset.generatedLine===a.line?n.generatedOffset.generatedColumn-1:0)};return s}}}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],s=a.consumer._generatedMappings,i=0;i<s.length;i++){var o=s[i],u=a.consumer._sources.at(o.source);u=C.computeSourceURL(a.consumer.sourceRoot,u,this._sourceMapURL),this._sources.add(u),u=this._sources.indexOf(u);var l=null;o.name&&(l=a.consumer._names.at(o.name),this._names.add(l),l=this._names.indexOf(l));var c={source:u,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:l};this.__generatedMappings.push(c),typeof c.originalLine=="number"&&this.__originalMappings.push(c)}gt(this.__generatedMappings,C.compareByGeneratedPositionsDeflated),gt(this.__originalMappings,C.compareByOriginalPositions)};Jt.IndexedSourceMapConsumer=fe});var ks=I(Ls=>{var wl=tn().SourceMapGenerator,Qt=We(),El=/(\r?\n)/,_l=10,Qe="$$$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[Qe]=!0,n!=null&&this.add(n)}ie.fromStringWithSourceMap=function(e,r,n){var a=new ie,s=e.split(El),i=0,o=function(){var f=m(),d=m()||"";return f+d;function m(){return i<s.length?s[i++]:void 0}},u=1,l=0,c=null;return r.eachMapping(function(f){if(c!==null)if(u<f.generatedLine)h(c,o()),u++,l=0;else{var d=s[i]||"",m=d.substr(0,f.generatedColumn-l);s[i]=d.substr(f.generatedColumn-l),l=f.generatedColumn,h(c,m),c=f;return}for(;u<f.generatedLine;)a.add(o()),u++;if(l<f.generatedColumn){var d=s[i]||"";a.add(d.substr(0,f.generatedColumn)),s[i]=d.substr(f.generatedColumn),l=f.generatedColumn}c=f},this),i<s.length&&(c&&h(c,o()),a.add(s.splice(i).join(""))),r.sources.forEach(function(f){var d=r.sourceContentFor(f);d!=null&&(n!=null&&(f=Qt.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?Qt.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[Qe]||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[Qe]||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[Qe]?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[Qe]?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[Qt.toSetString(e)]=r};ie.prototype.walkSourceContents=function(e){for(var r=0,n=this.children.length;r<n;r++)this.children[r][Qe]&&this.children[r].walkSourceContents(e);for(var a=Object.keys(this.sourceContents),r=0,n=a.length;r<n;r++)e(Qt.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 wl(e),a=!1,s=null,i=null,o=null,u=null;return this.walk(function(l,c){r.code+=l,c.source!==null&&c.line!==null&&c.column!==null?((s!==c.source||i!==c.line||o!==c.column||u!==c.name)&&n.addMapping({source:c.source,original:{line:c.line,column:c.column},generated:{line:r.line,column:r.column},name:c.name}),s=c.source,i=c.line,o=c.column,u=c.name,a=!0):a&&(n.addMapping({generated:{line:r.line,column:r.column}}),s=null,a=!1);for(var h=0,f=l.length;h<f;h++)l.charCodeAt(h)===_l?(r.line++,r.column=0,h+1===f?(s=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(l,c){n.setSourceContent(l,c)}),{code:r.code,map:n}};Ls.SourceNode=ie});var Os=I(Kt=>{Kt.SourceMapGenerator=tn().SourceMapGenerator;Kt.SourceMapConsumer=Cs().SourceMapConsumer;Kt.SourceNode=ks().SourceNode});var Ms=I((jd,xs)=>{var Al=Object.prototype.toString,on=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function Tl(t){return Al.call(t).slice(8,-1)==="ArrayBuffer"}function Cl(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 on?Buffer.from(t.slice(e,e+r)):new Buffer(new Uint8Array(t.slice(e,e+r)))}function Ll(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return on?Buffer.from(t,e):new Buffer(t,e)}function kl(t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return Tl(t)?Cl(t,e,r):typeof t=="string"?Ll(t,e):on?Buffer.from(t):new Buffer(t)}xs.exports=kl});var Ys=I(($e,fn)=>{var Ol=Os().SourceMapConsumer,un=require("path"),me;try{me=require("fs"),(!me.existsSync||!me.readFileSync)&&(me=null)}catch{}var xl=Ms();function Is(t,e){return t.require(e)}var Fs=!1,Ns=!1,ln=!1,vt="auto",Ne={},yt={},Ml=/^data:application\/json[^,]+base64,/,Le=[],ke=[];function dn(){return vt==="browser"?!0:vt==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function Il(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function Fl(){return typeof process=="object"&&process!==null?process.version:""}function Nl(){if(typeof process=="object"&&process!==null)return process.stderr}function $l(t){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(t)}function Zt(t){return function(e){for(var r=0;r<t.length;r++){var n=t[r](e);if(n)return n}return null}}var hn=Zt(Le);Le.push(function(t){if(t=t.trim(),/^file:/.test(t)&&(t=t.replace(/file:\/\/\/(\w:)?/,function(n,a){return a?"":"/"})),t in Ne)return Ne[t];var e="";try{if(me)me.existsSync(t)&&(e=me.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 Ne[t]=e});function cn(t,e){if(!t)return e;var r=un.dirname(t),n=/^\w+:\/\/[^\/]*/.exec(r),a=n?n[0]:"",s=r.slice(a.length);return a&&/^\/\w\:/.test(s)?(a+="/",a+un.resolve(r.slice(a.length),e).replace(/\\/g,"/")):a+un.resolve(r.slice(a.length),e)}function Vl(t){var e;if(dn())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=hn(t);for(var a=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,s,i;i=a.exec(e);)s=i;return s?s[1]:null}var mn=Zt(ke);ke.push(function(t){var e=Vl(t);if(!e)return null;var r;if(Ml.test(e)){var n=e.slice(e.indexOf(",")+1);r=xl(n,"base64").toString(),e=t}else e=cn(t,e),r=hn(e);return r?{url:e,map:r}:null});function pn(t){var e=yt[t.source];if(!e){var r=mn(t.source);r?(e=yt[t.source]={url:r.url,map:new Ol(r.map)},e.map.sourcesContent&&e.map.sources.forEach(function(a,s){var i=e.map.sourcesContent[s];if(i){var o=cn(e.url,a);Ne[o]=i}})):e=yt[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=cn(e.url,n.source),n}return t}function Vs(t){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(t);if(e){var r=pn({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]+" ("+Vs(e[2])+")":t}function Ul(){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="",s=this.getFunctionName(),i=!0,o=this.isConstructor(),u=!(this.isToplevel()||o);if(u){var l=this.getTypeName();l==="[object Object]"&&(l="null");var c=this.getMethodName();s?(l&&s.indexOf(l)!=0&&(a+=l+"."),a+=s,c&&s.indexOf("."+c)!=s.length-c.length-1&&(a+=" [as "+c+"]")):a+=l+"."+(c||"<anonymous>")}else o?a+="new "+(s||"<anonymous>"):s?a+=s:(a+=e,i=!1);return i&&(a+=" ("+e+")"),a}function $s(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=Ul,e}function Us(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,s=/^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)/,i=s.test(Fl())?0:62;n===1&&a>i&&!dn()&&!t.isEval()&&(a-=i);var o=pn({source:r,line:n,column:a});e.curPosition=o,t=$s(t);var u=t.getFunctionName;return t.getFunctionName=function(){return e.nextPosition==null?u():e.nextPosition.name||u()},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 l=t.isEval()&&t.getEvalOrigin();return l&&(l=Vs(l),t=$s(t),t.getEvalOrigin=function(){return l}),t}function ql(t,e){ln&&(Ne={},yt={});for(var r=t.name||"Error",n=t.message||"",a=r+": "+n,s={nextPosition:null,curPosition:null},i=[],o=e.length-1;o>=0;o--)i.push(`
at `+Us(e[o],s)),s.nextPosition=s.curPosition;return s.curPosition=s.nextPosition=null,a+i.reverse().join("")}function qs(t){var e=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(t.stack);if(e){var r=e[1],n=+e[2],a=+e[3],s=Ne[r];if(!s&&me&&me.existsSync(r))try{s=me.readFileSync(r,"utf8")}catch{s=""}if(s){var i=s.split(/(?:\r\n|\r|\n)/)[n-1];if(i)return r+":"+n+`
`+i+`
`+new Array(a).join(" ")+"^"}}return null}function Yl(t){var e=qs(t),r=Nl();r&&r._handle&&r._handle.setBlocking&&r._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(t.stack),$l(1)}function Pl(){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 Yl(arguments[1])}return t.apply(this,arguments)}}var jl=Le.slice(0),Bl=ke.slice(0);$e.wrapCallSite=Us;$e.getErrorSource=qs;$e.mapSourcePosition=pn;$e.retrieveSourceMap=mn;$e.install=function(t){if(t=t||{},t.environment&&(vt=t.environment,["node","browser","auto"].indexOf(vt)===-1))throw new Error("environment "+vt+" 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&&!dn()){var e=Is(fn,"module"),r=e.prototype._compile;r.__sourceMapSupport||(e.prototype._compile=function(s,i){return Ne[i]=s,yt[i]=void 0,r.call(this,s,i)},e.prototype._compile.__sourceMapSupport=!0)}if(ln||(ln="emptyCacheBetweenOperations"in t?t.emptyCacheBetweenOperations:!1),Fs||(Fs=!0,Error.prepareStackTrace=ql),!Ns){var n="handleUncaughtExceptions"in t?t.handleUncaughtExceptions:!0;try{var a=Is(fn,"worker_threads");a.isMainThread===!1&&(n=!1)}catch{}n&&Il()&&(Ns=!0,Pl())}};$e.resetRetrieveHandlers=function(){Le.length=0,ke.length=0,Le=jl.slice(0),ke=Bl.slice(0),mn=Zt(ke),hn=Zt(Le)}});var Js=I((Gd,ee)=>{var Gl="1.8.15",js=0,Ze=function(e){var r=["XXX: "+e].concat(Array.prototype.slice.call(arguments,1));console.error.apply(this,r)},Ze=function(){},Ue;typeof process<"u"&&process.versions&&(process.versions.nw?Ue="nw":process.versions.node&&(Ue="node"));!Ue&&typeof window<"u"&&window.window===window&&(Ue="browser");if(!Ue)throw new Error("unknown runtime environment");var er,be,Ke;if(Ue==="browser")er={hostname:function(){return window.location.host}},be={},Ke=null;else{er=require("os"),be=require("fs");try{Ke=require("dtrace-provider")}catch{Ke=null}}var we=require("util"),Re=require("assert"),wt=require("events").EventEmitter,Hl=require("stream");try{St=na()}catch{St=null}var St;process.env.BUNYAN_TEST_NO_SAFE_JSON_STRINGIFY&&(St=null);try{bt=os()}catch{bt=null}var bt;try{tr=Ys()}catch{tr=null}var tr;function Ve(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 Z=we.format;Z||(gn=we.inspect,Ps=/%[sdj%]/g,Z=function(e){if(typeof e!="string"){for(var r=[],n=0;n<arguments.length;n++)r.push(gn(arguments[n]));return r.join(" ")}for(var n=1,a=arguments,s=a.length,i=String(e).replace(Ps,function(u){if(n>=s)return u;switch(u){case"%s":return String(a[n++]);case"%d":return Number(a[n++]);case"%j":return Ws(a[n++]);case"%%":return"%";default:return u}}),o=a[n];n<s;o=a[++n])o===null||typeof o!="object"?i+=" "+o:i+=" "+gn(o);return i});var gn,Ps;function Dn(){if(this!==void 0){var t={},e=Error.stackTraceLimit,r=Error.prepareStackTrace;return Error.stackTraceLimit=3,Error.prepareStackTrace=function(n,a){var s=a[2];tr&&(s=tr.wrapCallSite(s)),t.file=s.getFileName(),t.line=s.getLineNumber();var i=s.getFunctionName();i&&(t.func=i)},Error.captureStackTrace(this,Dn),this.stack,Error.stackTraceLimit=e,Error.prepareStackTrace=r,t}}function Xl(t,e){e||(e=" ");var r=t.split(/\r?\n/g);return e+r.join(`
`+e)}function Sn(t,e){if(Re.ok(t),e){if(vn[e])return;vn[e]=!0}process.stderr.write(t+`
`)}function zl(t){return vn[t]}var vn={};function Bs(){}Bs.prototype.write=function(t){t.level<Et?console.log(t):t.level<rr?console.info(t):t.level<nr?console.warn(t):console.error(t)};var bn=10,Rn=20,Et=30,rr=40,nr=50,wn=60,et={trace:bn,debug:Rn,info:Et,warn:rr,error:nr,fatal:wn},Gs={};Object.keys(et).forEach(function(t){Gs[et[t]]=t});var Dt=void 0,yn=Ke&&{};function Rt(t){var e,r=typeof t;if(r==="string"){if(e=et[t.toLowerCase()],!e)throw new Error(Z('unknown level name: "%s"',t))}else{if(r!=="number")throw new TypeError(Z("cannot resolve level: invalid arg (%s):",r,t));if(t<0||Math.floor(t)!==t)throw new TypeError(Z("level is not a positive integer: %s",t));e=t}return e}function Wl(t){return t instanceof Hl.Writable?!0:typeof t.write=="function"}function G(t,e,r){if(Ze("Logger start:",t),!(this instanceof G))return new G(t,e);var n;if(e!==void 0&&(n=t,t=e,!(n instanceof G)))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(wt.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),s=0;s<a.length;s++){var i=a[s];f[i]=n.fields[i]}for(var o=Object.keys(t),s=0;s<o.length;s++){var i=o[s];f[i]=t[i]}return}var u=this;if(n){this._level=n._level,this.streams=[];for(var s=0;s<n.streams.length;s++){var l=Ve(n.streams[s]);l.closeOnExit=!1,this.streams.push(l)}this.serializers=Ve(n.serializers),this.src=n.src,this.fields=Ve(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(!Dt&&Ke){Dt=Ke.createDTraceProvider("bunyan");for(var c in et){var h;yn[et[c]]=h=Dt.addProbe("log-"+c,"char *"),h.dtp=Dt}Dt.enable()}t.stream?u.addStream({type:"stream",stream:t.stream,closeOnExit:!1,level:t.level}):t.streams?t.streams.forEach(function(d){u.addStream(d,t.level)}):n&&t.level?this.level(t.level):n||(Ue==="browser"?u.addStream({type:"raw",stream:new Bs,closeOnExit:!1,level:t.level}):u.addStream({type:"stream",stream:process.stdout,closeOnExit:!1,level:t.level})),t.serializers&&u.addSerializers(t.serializers),t.src&&(this.src=!0),Ze("Logger: ",u);var f=Ve(t);delete f.stream,delete f.level,delete f.streams,delete f.serializers,delete f.src,this.serializers&&this._applySerializers(f),!f.hostname&&!u.fields.hostname&&(f.hostname=er.hostname()),f.pid||(f.pid=process.pid),Object.keys(f).forEach(function(d){u.fields[d]=f[d]})}we.inherits(G,wt);G.prototype.addStream=function(e,r){var n=this;switch(r==null&&(r=Et),e=Ve(e),e.type||(e.stream?e.type="stream":e.path&&(e.type="file")),e.raw=e.type==="raw",e.level!==void 0?e.level=Rt(e.level):e.level=Rt(r),e.level<n._level&&(n._level=e.level),e.type){case"stream":Re.ok(Wl(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(bt,'"rotating-file" stream type is not supported: missing "mv" module'),e.stream=new oe(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(s){n.emit("error",s,e)}),n.streams.push(e),delete n.haveNonRawStreams};G.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(Z('invalid serializer for "%s" field: must be a function',n));r.serializers[n]=a})};G.prototype.child=function(t,e){return new this.constructor(this,t||{},e)};G.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)}))})};G.prototype.level=function(e){if(e===void 0)return this._level;for(var r=Rt(e),n=this.streams.length,a=0;a<n;a++)this.streams[a].level=r;this._level=r};G.prototype.levels=function(e,r){if(e===void 0)return Re.equal(r,void 0),this.streams.map(function(u){return u.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,s=0;s<a;s++){var i=this.streams[s];if(i.name===e){n=i;break}}if(!n)throw new Error(Z('no stream with name "%s"',e))}if(r===void 0)return n.level;var o=Rt(r);n.level=o,o<this._level&&(this._level=o)};G.prototype._applySerializers=function(t,e){var r=this;Ze("_applySerializers: excludeFields",e),Object.keys(this.serializers).forEach(function(n){if(!(t[n]===void 0||e&&e[n])){Ze('_applySerializers; apply to "%s" key',n);try{t[n]=r.serializers[n](t[n])}catch(a){Sn(Z(`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]=Z('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',n)}}})};G.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=Ws(t)+er.EOL),e)return n;var a=t.level;for(r=0;r<this.streams.length;r++){var s=this.streams[r];s.level<=a&&(Ze('writing log rec "%s" to "%s" stream (%d <= %d): %j',t.msg,s.type,s.level,a,t),s.stream.write(s.raw?t:n))}return n};function Hs(t,e,r){var n,a,s;r[0]instanceof Error?(a={err:t.serializers&&t.serializers.err?t.serializers.err(r[0]):G.stdSerializers.err(r[0])},n={err:!0},r.length===1?s=[a.err.message]:s=r.slice(1)):typeof r[0]!="object"||Array.isArray(r[0])?(a=null,s=r.slice()):Buffer.isBuffer(r[0])?(a=null,s=r.slice(),s[0]=we.inspect(s[0])):(a=r[0],a&&r.length===1&&a.err&&a.err instanceof Error?s=[a.err.message]:s=r.slice(1));var i=Ve(t.fields),o=i.level=e,u=a?Ve(a):null;return u&&(t.serializers&&t._applySerializers(u,n),Object.keys(u).forEach(function(l){i[l]=u[l]})),i.msg=Z.apply(t,s),i.time||(i.time=new Date),t.src&&!i.src&&(i.src=Dn()),i.v=js,i}function Jl(t,e,r,n){return[t||e._emit(Hs(e,r,n),!0)]}function tt(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(!zl[a]){var s=Dn();Sn(Z("bunyan usage error: %s:%s: attempt to log with an unbound log method: `this` is: %s",s.file,s.line,we.inspect(this)),a)}return}for(var i=new Array(arguments.length),o=0;o<i.length;++o)i[o]=arguments[o];this._level<=t&&(n=Hs(e,t,i),r=this._emit(n)),yn&&yn[t].fire(Jl,r,e,t,i)}}G.prototype.trace=tt(bn);G.prototype.debug=tt(Rn);G.prototype.info=tt(Et);G.prototype.warn=tt(rr);G.prototype.error=tt(nr);G.prototype.fatal=tt(wn);G.stdSerializers={};G.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}};G.stdSerializers.res=function(t){return!t||!t.statusCode?t:{statusCode:t.statusCode,header:t._header}};function Xs(t){var e=t.stack||t.toString();if(t.cause&&typeof t.cause=="function"){var r=t.cause();r&&(e+=`
Caused by: `+Xs(r))}return e}var Bd=G.stdSerializers.err=function(t){if(!t||!t.stack)return t;var e={message:t.message,name:t.name,stack:Xs(t),code:t.code,signal:t.signal};return e};function Ql(){var t=new Set;return function(e,r){return!r||typeof r!="object"?r:t.has(r)?"[Circular]":(t.add(r),r)}}function Kl(){var t=[];return function(e,r){return!r||typeof r!="object"?r:t.indexOf(r)!==-1?"[Circular]":(t.push(r),r)}}var zs=typeof Set<"u"?Ql:Kl;function Ws(t){try{return JSON.stringify(t)}catch{try{return JSON.stringify(t,zs())}catch(n){if(St)return St(t);var e=n.stack.split(/\n/g,3).join(`
`);return Sn('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n'+Xl(Z(`%s
%s`,we.inspect(t),n.stack)),e),Z("(Exception in JSON.stringify(rec): %j. See stderr for details.)",n.message)}}}var oe=null;bt&&(oe=function(e){if(this.path=e.path,this.count=e.count==null?10:e.count,Re.equal(typeof this.count,"number",Z('rotating-file stream "count" is not a number: %j (%s) in %j',this.count,typeof this.count,this)),Re.ok(this.count>=0,Z('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(Z('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 s=be.statSync(this.path);a=s.mtime.getTime()}catch{}var i=!1;if(a){var o=this._calcRotTime(0);a<o&&(i=!0)}this.stream=be.createWriteStream(this.path,{flags:"a",encoding:"utf8"}),this.rotQueue=[],this.rotating=!1,i?(this._debug("rotateAfterOpen -> call rotate()"),this.rotate()):this._setupNextRot()},we.inherits(oe,wt),oe.prototype._debug=function(){if(0)var t;else return!1},oe.prototype._setupNextRot=function(){this.rotAt=this._calcRotTime(1),this._setRotationTimer()},oe.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()},oe.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(Z('invalid period scope: "%s"',this.periodScope))}if(this._debug()){this._debug(" **rotAt**: %s (utc: %s)",n,new Date(n).toUTCString());var s=Date.now();this._debug(" now: %s (%sms == %smin == %sh to go)",s,n-s,(n-s)/1e3/60,(n-s)/1e3/60/60)}return n},oe.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 i=e.path+"."+String(s-1);s===0&&(i=e.path),s-=1,e._debug(" rm %s",i),be.unlink(i,function(o){n()})}function n(){if(e.count===0||s<0)return a();var i=e.path,o=e.path+"."+String(s);s>0&&(i+="."+String(s-1)),s-=1,be.exists(i,function(u){u?(e._debug(" mv %s %s",i,o),bt(i,o,function(l){l?(e.emit("error",l),a()):n()})):n()})}function a(){e._debug(" open %s",e.path),e.stream=be.createWriteStream(e.path,{flags:"a",encoding:"utf8"});for(var i=e.rotQueue,o=i.length,u=0;u<o;u++)e.stream.write(i[u]);e.rotQueue=[],e.rotating=!1,e.emit("drain"),e._setupNextRot()}var s=this.count;r()},oe.prototype.write=function(e){return this.rotating?(this.rotQueue.push(e),!1):this.stream.write(e)},oe.prototype.end=function(e){this.stream.end()},oe.prototype.destroy=function(e){this.stream.destroy()},oe.prototype.destroySoon=function(e){this.stream.destroySoon()});function rt(t){this.limit=t&&t.limit?t.limit:100,this.writable=!0,this.records=[],wt.call(this)}we.inherits(rt,wt);rt.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};rt.prototype.end=function(){arguments.length>0&&this.write.apply(this,Array.prototype.slice.call(arguments)),this.writable=!1};rt.prototype.destroy=function(){this.writable=!1,this.emit("close")};rt.prototype.destroySoon=function(){this.destroy()};ee.exports=G;ee.exports.TRACE=bn;ee.exports.DEBUG=Rn;ee.exports.INFO=Et;ee.exports.WARN=rr;ee.exports.ERROR=nr;ee.exports.FATAL=wn;ee.exports.resolveLevel=Rt;ee.exports.levelFromName=et;ee.exports.nameFromLevel=Gs;ee.exports.VERSION=Gl;ee.exports.LOG_VERSION=js;ee.exports.createLogger=function(e){return new G(e)};ee.exports.RingBuffer=rt;ee.exports.RotatingFileStream=oe;ee.exports.safeCycles=zs});var Ks=I((Hd,Qs)=>{var Zl=Object.prototype.hasOwnProperty,ec=Object.prototype.toString,tc=function(t){var e=typeof t=="function"&&!(t instanceof RegExp)||ec.call(t)==="[object Function]";return!e&&typeof window<"u"&&(e=t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt),e};Qs.exports=function(e,r){if(!tc(r))throw new TypeError("iterator must be a function");var n,a,s=typeof e=="string",i=e.length,o=arguments.length>2?arguments[2]:null;if(i===+i)for(n=0;n<i;n++)o===null?r(s?e.charAt(n):e[n],n,e):r.call(o,s?e.charAt(n):e[n],n,e);else for(a in e)Zl.call(e,a)&&(o===null?r(e[a],a,e):r.call(o,e[a],a,e))}});var ti=I((Xd,ei)=>{var Zs=Object.prototype.toString;ei.exports=function(e){var r=Zs.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Zs.call(e.callee)==="[object Function]"),n}});var ni=I((zd,ri)=>{(function(){"use strict";var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Ks(),n=ti(),a=!{toString:null}.propertyIsEnumerable("toString"),s=function(){}.propertyIsEnumerable("prototype"),i=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],o;o=function(l){var c=l!==null&&typeof l=="object",h=e.call(l)==="[object Function]",f=n(l),d=[];if(!c&&!h&&!f)throw new TypeError("Object.keys called on a non-object");if(f)r(l,function(S){d.push(S)});else{var m,p=s&&h;for(m in l)!(p&&m==="prototype")&&t.call(l,m)&&d.push(m)}if(a){var w=l.constructor,g=w&&w.prototype===l;r(i,function(S){!(g&&S==="constructor")&&t.call(l,S)&&d.push(S)})}return d},ri.exports=o})()});var si=I((Wd,ai)=>{ai.exports=Object.keys||ni()});var oi=I((Jd,ii)=>{ii.exports=rc;function rc(t){return t!==null&&(typeof t=="object"||typeof t=="function")}});var En=I((Qd,ui)=>{var nc=si(),ac=oi();ui.exports=sc;function sc(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];if(ac(r))for(var n=nc(r),a=0;a<n.length;a++){var s=n[a];t[s]=r[s]}}return t}});var di=I((Kd,fi)=>{"use strict";var li={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},ci={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},_n={};Object.keys(li).forEach(function(t){_n[t]=function(e){return"\x1B["+li[t]+"m"+e+"\x1B[39m"}});Object.keys(ci).forEach(function(t){_n[t]=function(e){return"\x1B["+ci[t]+"m"+e+"\x1B[49m"}});fi.exports=_n});var pi=I((Zd,mi)=>{"use strict";var An={reset:[0,22],bright:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],blink:[5,25],inverse:[7,27]},hi={};Object.keys(An).forEach(function(t){hi[t]=function(e){var r=An[t][0],n=An[t][1];return"\x1B["+r+"m"+e+"\x1B["+n+"m"}});mi.exports=hi});var Fi=I((eh,Ii)=>{"use strict";var Di=require("util"),Oe=Di.format,ic=require("http"),oc=En(),uc=di(),lc=pi(),cc=oc(lc,uc),Si=1,bi=2,Ri=3,wi=4,Ei=5,_i=6,fc={long:Si,json:bi,inspect:Ri,simple:wi,short:Ei,bunyan:_i},Ai=10,Ti=20,Ci=30,Li=40,ki=50,Oi=60,gi={trace:Ai,debug:Ti,info:Ci,warn:Li,error:ki,fatal:Oi},dc={},xi={},Mi={};Object.keys(gi).forEach(function(t){var e=gi[t];dc[e]=t,xi[e]=t.toUpperCase(),Mi[e]=(t.length===4?" ":"")+t.toUpperCase()});function vi(t){return!(t.v===null||t.level===null||t.name===null||t.hostname===null||t.pid===null||t.time===null||t.msg===null)}function nt(t){return" "+t.split(/\r?\n/).join(`
`)}function hc(t,e){if(!t)return"";var r=cc[e];return r?r(t):t}function mc(t,e){return t}function yi(t){switch(t){case Ai:return"TRACE";case Ti:return"DEBUG";case Ci:return"INFO";case Li:return"WARN";case ki:return"ERROR";case Oi:return"FATAL"}}Ii.exports=function(e,r){function n(k){var A="";if(k.header)A+=k.header.trimRight();else if(k.headers){k.statusCode&&(A+=Oe(`HTTP/1.1 %s %s
`,k.statusCode,ic.STATUS_CODES[k.statusCode]));var R=k.headers;A+=Object.keys(R).map(function(y){return y+": "+R[y]}).join(`
`)}delete k.header,delete k.headers,delete k.statusCode,k.body&&(A+=`
`+(typeof k.body=="object"?JSON.stringify(k.body,null,2):k.body),delete k.body),k.trailer&&(A+=`
`+k.trailer),delete k.trailer,A&&S.push(nt(A)),Object.keys(k).forEach(function(y){e["res."+y]=k[y]})}var a=!1,s,i=e.line,o=r.color?hc:mc,u=isNaN(r.outputMode)?fc[r.outputMode]:r.outputMode;switch(u){case Ei:a=!0;case Si:if(!vi(e))return i+`
`;delete e.v,a&&e.time[10]=="T"?(s=e.time.substr(11),s=o(s,"brightBlack")):s=o("["+e.time+"]","brightBlack"),delete e.time;var l=e.name;delete e.name,e.component&&(l+="/"+e.component),delete e.component,a||(l+="/"+e.pid),delete e.pid;var c=Mi[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 w=e.hostname;delete e.hostname;var g=[],S=[];e.req_id&&g.push("req_id="+e.req_id),delete e.req_id;var O;if(e.msg.indexOf(`
`)!==-1?(O="",S.push(nt(o(e.msg,"cyan")))):O=" "+o(e.msg,"cyan"),delete e.msg,e.req&&typeof e.req=="object"){var T=e.req;delete e.req,m=T.headers,d=Oe("%s %s HTTP/%s%s",T.method,T.url,T.httpVersion||"1.1",m?`
`+Object.keys(m).map(function(k){return k+": "+m[k]}).join(`
`):""),delete T.url,delete T.method,delete T.httpVersion,delete T.headers,T.body&&(d+=`
`+(typeof T.body=="object"?JSON.stringify(T.body,null,2):T.body),delete T.body),T.trailers&&Object.keys(T.trailers)>0&&(d+=`
`+Object.keys(T.trailers).map(function(k){return k+": "+T.trailers[k]}).join(`
`)),delete T.trailers,S.push(nt(d)),Object.keys(T).forEach(function(k){e["req."+k]=T[k]})}if(e.client_req&&typeof e.client_req=="object"){var M=e.client_req;delete e.client_req,m=M.headers,d="",M.address&&(p="Host: "+M.address,M.port&&(p+=":"+M.port),p+=`
`),delete M.headers,delete M.address,delete M.port,d+=Oe(`%s %s HTTP/%s
%s%s`,M.method,M.url,M.httpVersion||"1.1",p,m?Object.keys(m).map(function(k){return k+": "+m[k]}).join(`
`):""),delete M.method,delete M.url,delete M.httpVersion,M.body&&(d+=`
`+(typeof M.body=="object"?JSON.stringify(M.body,null,2):M.body),delete M.body),Object.keys(M).forEach(function(k){e["client_req."+k]=M[k]}),S.push(nt(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&&(S.push(nt(e.err.stack)),delete e.err);for(var P=Object.keys(e),U=0;U<P.length;U++){var N=P[U],L=e[N],j=!1;typeof L!="string"&&(L=JSON.stringify(L,null,2),j=!0),L.indexOf(`
`)!==-1||L.length>50?S.push(nt(N+": "+L)):!j&&(L.indexOf(" ")!=-1||L.length===0)?g.push(N+"="+JSON.stringify(L)):g.push(N+"="+L)}return g=o(g.length?" ("+g.join(", ")+")":"","brightBlack"),S=o(S.length?S.join(`
--
`)+`
`:"","brightBlack"),a?Oe(`%s %s %s:%s%s
%s`,s,c,l,O,g,S):Oe(`%s %s: %s on %s%s:%s%s
%s`,s,c,l,w||"<no-hostname>",f,O,g,S);case Ri:return Di.inspect(e,!1,1/0,!0)+`
`;case _i:return r.levelInString&&(e.level=yi(e.level)),JSON.stringify(e,null,0)+`
`;case bi:return r.levelInString&&(e.level=yi(e.level)),JSON.stringify(e,null,r.jsonIndent)+`
`;case wi:return vi(e)?Oe(`%s - %s
`,xi[e.level]||"LVL"+e.level,e.msg):i+`
`;default:throw new Error("unknown output mode: "+r.outputMode)}}});var Vi=I((th,$i)=>{"use strict";var pc=require("stream"),gc=require("util"),vc=Fi(),yc=En(),Ni=pc.Writable;$i.exports=_t;gc.inherits(_t,Ni);function _t(t,e){if(!(this instanceof _t))return new _t(t,e);t=t||{},t.objectMode=!0,Ni.call(this,t),this.opts=yc({outputMode:"short",color:!0,colorFromLevel:{10:"brightBlack",20:"brightBlack",30:"green",40:"magenta",50:"red",60:"brightRed"}},t),this.out=e||process.stdout}_t.prototype._write=function(t,e,r){var n;try{n=JSON.parse(t),this.out.write(vc(n,this.opts))}catch{this.out.write(t)}r()}});var qe=I((Tn,Cn)=>{(function(t,e){typeof Tn=="object"&&typeof Cn<"u"?Cn.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(Tn,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",a="second",s="minute",i="hour",o="day",u="week",l="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,w={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(A){var R=["th","st","nd","rd"],y=A%100;return"["+A+(R[(y-20)%10]||R[y]||R[0])+"]"}},g=function(A,R,y){var _=String(A);return!_||_.length>=R?A:""+Array(R+1-_.length).join(y)+A},S={s:g,z:function(A){var R=-A.utcOffset(),y=Math.abs(R),_=Math.floor(y/60),D=y%60;return(R<=0?"+":"-")+g(_,2,"0")+":"+g(D,2,"0")},m:function A(R,y){if(R.date()<y.date())return-A(y,R);var _=12*(y.year()-R.year())+(y.month()-R.month()),D=R.clone().add(_,l),v=y-D<0,b=R.clone().add(_+(v?-1:1),l);return+(-(_+(y-D)/(v?D-b:b-D))||0)},a:function(A){return A<0?Math.ceil(A)||0:Math.floor(A)},p:function(A){return{M:l,y:h,w:u,d:o,D:f,h:i,m:s,s:a,ms:n,Q:c}[A]||String(A||"").toLowerCase().replace(/s$/,"")},u:function(A){return A===void 0}},O="en",T={};T[O]=w;var M="$isDayjsObject",P=function(A){return A instanceof j||!(!A||!A[M])},U=function A(R,y,_){var D;if(!R)return O;if(typeof R=="string"){var v=R.toLowerCase();T[v]&&(D=v),y&&(T[v]=y,D=v);var b=R.split("-");if(!D&&b.length>1)return A(b[0])}else{var E=R.name;T[E]=R,D=E}return!_&&D&&(O=D),D||!_&&O},N=function(A,R){if(P(A))return A.clone();var y=typeof R=="object"?R:{};return y.date=A,y.args=arguments,new j(y)},L=S;L.l=U,L.i=P,L.w=function(A,R){return N(A,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var j=function(){function A(y){this.$L=U(y.locale,null,!0),this.parse(y),this.$x=this.$x||y.x||{},this[M]=!0}var R=A.prototype;return R.parse=function(y){this.$d=function(_){var D=_.date,v=_.utc;if(D===null)return new Date(NaN);if(L.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var b=D.match(m);if(b){var E=b[2]-1||0,x=(b[7]||"0").substring(0,3);return v?new Date(Date.UTC(b[1],E,b[3]||1,b[4]||0,b[5]||0,b[6]||0,x)):new Date(b[1],E,b[3]||1,b[4]||0,b[5]||0,b[6]||0,x)}}return new Date(D)}(y),this.init()},R.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()},R.$utils=function(){return L},R.isValid=function(){return this.$d.toString()!==d},R.isSame=function(y,_){var D=N(y);return this.startOf(_)<=D&&D<=this.endOf(_)},R.isAfter=function(y,_){return N(y)<this.startOf(_)},R.isBefore=function(y,_){return this.endOf(_)<N(y)},R.$g=function(y,_,D){return L.u(y)?this[_]:this.set(D,y)},R.unix=function(){return Math.floor(this.valueOf()/1e3)},R.valueOf=function(){return this.$d.getTime()},R.startOf=function(y,_){var D=this,v=!!L.u(_)||_,b=L.p(y),E=function(de,J){var le=L.w(D.$u?Date.UTC(D.$y,J,de):new Date(D.$y,J,de),D);return v?le:le.endOf(o)},x=function(de,J){return L.w(D.toDate()[de].apply(D.toDate("s"),(v?[0,0,0,0]:[23,59,59,999]).slice(J)),D)},$=this.$W,H=this.$M,ae=this.$D,_e="set"+(this.$u?"UTC":"");switch(b){case h:return v?E(1,0):E(31,11);case l:return v?E(1,H):E(0,H+1);case u:var ve=this.$locale().weekStart||0,xe=($<ve?$+7:$)-ve;return E(v?ae-xe:ae+(6-xe),H);case o:case f:return x(_e+"Hours",0);case i:return x(_e+"Minutes",1);case s:return x(_e+"Seconds",2);case a:return x(_e+"Milliseconds",3);default:return this.clone()}},R.endOf=function(y){return this.startOf(y,!1)},R.$set=function(y,_){var D,v=L.p(y),b="set"+(this.$u?"UTC":""),E=(D={},D[o]=b+"Date",D[f]=b+"Date",D[l]=b+"Month",D[h]=b+"FullYear",D[i]=b+"Hours",D[s]=b+"Minutes",D[a]=b+"Seconds",D[n]=b+"Milliseconds",D)[v],x=v===o?this.$D+(_-this.$W):_;if(v===l||v===h){var $=this.clone().set(f,1);$.$d[E](x),$.init(),this.$d=$.set(f,Math.min(this.$D,$.daysInMonth())).$d}else E&&this.$d[E](x);return this.init(),this},R.set=function(y,_){return this.clone().$set(y,_)},R.get=function(y){return this[L.p(y)]()},R.add=function(y,_){var D,v=this;y=Number(y);var b=L.p(_),E=function(H){var ae=N(v);return L.w(ae.date(ae.date()+Math.round(H*y)),v)};if(b===l)return this.set(l,this.$M+y);if(b===h)return this.set(h,this.$y+y);if(b===o)return E(1);if(b===u)return E(7);var x=(D={},D[s]=e,D[i]=r,D[a]=t,D)[b]||1,$=this.$d.getTime()+y*x;return L.w($,this)},R.subtract=function(y,_){return this.add(-1*y,_)},R.format=function(y){var _=this,D=this.$locale();if(!this.isValid())return D.invalidDate||d;var v=y||"YYYY-MM-DDTHH:mm:ssZ",b=L.z(this),E=this.$H,x=this.$m,$=this.$M,H=D.weekdays,ae=D.months,_e=D.meridiem,ve=function(J,le,ye,Ae){return J&&(J[le]||J(_,v))||ye[le].slice(0,Ae)},xe=function(J){return L.s(E%12||12,J,"0")},de=_e||function(J,le,ye){var Ae=J<12?"AM":"PM";return ye?Ae.toLowerCase():Ae};return v.replace(p,function(J,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(D.monthsShort,$,ae,3);case"MMMM":return ve(ae,$);case"D":return _.$D;case"DD":return L.s(_.$D,2,"0");case"d":return String(_.$W);case"dd":return ve(D.weekdaysMin,_.$W,H,2);case"ddd":return ve(D.weekdaysShort,_.$W,H,3);case"dddd":return H[_.$W];case"H":return String(E);case"HH":return L.s(E,2,"0");case"h":return xe(1);case"hh":return xe(2);case"a":return de(E,x,!0);case"A":return de(E,x,!1);case"m":return String(x);case"mm":return L.s(x,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 b}return null}(J)||b.replace(":","")})},R.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},R.diff=function(y,_,D){var v,b=this,E=L.p(_),x=N(y),$=(x.utcOffset()-this.utcOffset())*e,H=this-x,ae=function(){return L.m(b,x)};switch(E){case h:v=ae()/12;break;case l:v=ae();break;case c:v=ae()/3;break;case u:v=(H-$)/6048e5;break;case o:v=(H-$)/864e5;break;case i:v=H/r;break;case s:v=H/e;break;case a:v=H/t;break;default:v=H}return D?v:L.a(v)},R.daysInMonth=function(){return this.endOf(l).$D},R.$locale=function(){return T[this.$L]},R.locale=function(y,_){if(!y)return this.$L;var D=this.clone(),v=U(y,_,!0);return v&&(D.$L=v),D},R.clone=function(){return L.w(this.$d,this)},R.toDate=function(){return new Date(this.valueOf())},R.toJSON=function(){return this.isValid()?this.toISOString():null},R.toISOString=function(){return this.$d.toISOString()},R.toString=function(){return this.$d.toUTCString()},A}(),k=j.prototype;return N.prototype=k,[["$ms",n],["$s",a],["$m",s],["$H",i],["$W",o],["$M",l],["$y",h],["$D",f]].forEach(function(A){k[A[1]]=function(R){return this.$g(R,A[0],A[1])}}),N.extend=function(A,R){return A.$i||(A(R,j,N),A.$i=!0),N},N.locale=U,N.isDayjs=P,N.unix=function(A){return N(1e3*A)},N.en=T[O],N.Ls=T,N.p={},N})});var at=I((Ln,kn)=>{(function(t,e){typeof Ln=="object"&&typeof kn<"u"?kn.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(Ln,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?/,s=/\d*[^-_:/,()\s\d]+/,i={},o=function(m){return(m=+m)+(m>68?1900:2e3)},u=function(m){return function(p){this[m]=+p}},l=[/[+-]\d\d:?(\d\d)?|Z/,function(m){(this.zone||(this.zone={})).offset=function(p){if(!p||p==="Z")return 0;var w=p.match(/([+-]|\d\d)/g),g=60*w[1]+(+w[2]||0);return g===0?0:w[0]==="+"?-g:g}(m)}],c=function(m){var p=i[m];return p&&(p.indexOf?p:p.s.concat(p.f))},h=function(m,p){var w,g=i.meridiem;if(g){for(var S=1;S<=24;S+=1)if(m.indexOf(g(S,0,p))>-1){w=S>12;break}}else w=m===(p?"pm":"PM");return w},f={A:[s,function(m){this.afternoon=h(m,!1)}],a:[s,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,u("seconds")],ss:[a,u("seconds")],m:[a,u("minutes")],mm:[a,u("minutes")],H:[a,u("hours")],h:[a,u("hours")],HH:[a,u("hours")],hh:[a,u("hours")],D:[a,u("day")],DD:[n,u("day")],Do:[s,function(m){var p=i.ordinal,w=m.match(/\d+/);if(this.day=w[0],p)for(var g=1;g<=31;g+=1)p(g).replace(/\[|\]/g,"")===m&&(this.day=g)}],w:[a,u("week")],ww:[n,u("week")],M:[a,u("month")],MM:[n,u("month")],MMM:[s,function(m){var p=c("months"),w=(c("monthsShort")||p.map(function(g){return g.slice(0,3)})).indexOf(m)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[s,function(m){var p=c("months").indexOf(m)+1;if(p<1)throw new Error;this.month=p%12||p}],Y:[/[+-]?\d+/,u("year")],YY:[n,function(m){this.year=o(m)}],YYYY:[/\d{4}/,u("year")],Z:l,ZZ:l};function d(m){var p,w;p=m,w=i&&i.formats;for(var g=(m=p.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(N,L,j){var k=j&&j.toUpperCase();return L||w[j]||t[j]||w[k].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(A,R,y){return R||y.slice(1)})})).match(e),S=g.length,O=0;O<S;O+=1){var T=g[O],M=f[T],P=M&&M[0],U=M&&M[1];g[O]=U?{regex:P,parser:U}:T.replace(/^\[|\]$/g,"")}return function(N){for(var L={},j=0,k=0;j<S;j+=1){var A=g[j];if(typeof A=="string")k+=A.length;else{var R=A.regex,y=A.parser,_=N.slice(k),D=R.exec(_)[0];y.call(L,D),N=N.replace(D,"")}}return function(v){var b=v.afternoon;if(b!==void 0){var E=v.hours;b?E<12&&(v.hours+=12):E===12&&(v.hours=0),delete v.afternoon}}(L),L}}return function(m,p,w){w.p.customParseFormat=!0,m&&m.parseTwoDigitYear&&(o=m.parseTwoDigitYear);var g=p.prototype,S=g.parse;g.parse=function(O){var T=O.date,M=O.utc,P=O.args;this.$u=M;var U=P[1];if(typeof U=="string"){var N=P[2]===!0,L=P[3]===!0,j=N||L,k=P[2];L&&(k=P[2]),i=this.$locale(),!N&&k&&(i=w.Ls[k]),this.$d=function(_,D,v,b){try{if(["x","X"].indexOf(D)>-1)return new Date((D==="X"?1e3:1)*_);var E=d(D)(_),x=E.year,$=E.month,H=E.day,ae=E.hours,_e=E.minutes,ve=E.seconds,xe=E.milliseconds,de=E.zone,J=E.week,le=new Date,ye=H||(x||$?1:le.getDate()),Ae=x||le.getFullYear(),Ot=0;x&&!$||(Ot=$>0?$-1:le.getMonth());var xt,hr=ae||0,mr=_e||0,pr=ve||0,gr=xe||0;return de?new Date(Date.UTC(Ae,Ot,ye,hr,mr,pr,gr+60*de.offset*1e3)):v?new Date(Date.UTC(Ae,Ot,ye,hr,mr,pr,gr)):(xt=new Date(Ae,Ot,ye,hr,mr,pr,gr),J&&(xt=b(xt).week(J).toDate()),xt)}catch{return new Date("")}}(T,U,M,w),this.init(),k&&k!==!0&&(this.$L=this.locale(k).$L),j&&T!=this.format(U)&&(this.$d=new Date("")),i={}}else if(U instanceof Array)for(var A=U.length,R=1;R<=A;R+=1){P[1]=U[R-1];var y=w.apply(this,P);if(y.isValid()){this.$d=y.$d,this.$L=y.$L,this.init();break}R===A&&(this.$d=new Date(""))}else S.call(this,O)}}})});var Gi=I((On,xn)=>{(function(t,e){typeof On=="object"&&typeof xn<"u"?xn.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_isBetween=e()})(On,function(){"use strict";return function(t,e,r){e.prototype.isBetween=function(n,a,s,i){var o=r(n),u=r(a),l=(i=i||"()")[0]==="(",c=i[1]===")";return(l?this.isAfter(o,s):!this.isBefore(o,s))&&(c?this.isBefore(u,s):!this.isAfter(u,s))||(l?this.isBefore(o,s):!this.isAfter(o,s))&&(c?this.isAfter(u,s):!this.isBefore(u,s))}}})});var jf={};Fo(jf,{default:()=>Pf});module.exports=No(jf);var Lo=te(yr());var Vo=(t,e)=>{let{keys:r,measures:n,filters:a,expectNulls:s}=t.columns,i=n.map(h=>h.id),o=r?.map(h=>h.id)||[],u=a?.map(h=>h.id)||[],l=r?.some(h=>h.optional);e.length&&e[0].ts&&o.unshift("ts");let c=e.filter(h=>{let f=[];return Object.keys(h).forEach(d=>{let m=h[d].raw,p=!0;u.includes(d)?p=a.filter(g=>g.id===d).map(g=>g.equals).includes(m):o.includes(d)&&l?p=!0:o.includes(d)&&!l||i.includes(d)?p=m!==""&&m!==void 0&&m!==null:s&&(p=m===""||m===void 0||m===null),f.push(p)}),f.every(d=>d)});return l?Qn(c,r):c},Wn=(t,e)=>{let r=[],n=e.map(i=>i.id),a=e.every(i=>i.optional),s=[...n];return n.reverse().forEach(i=>{let o=e.find(u=>u.id===i);r.push([...s]),o&&o.optional&&s.pop()}),a&&r.push([]),r},Jn=(t,e)=>{let r=[];return e.every(n=>{let a=[];return t.forEach(s=>{let i=[];Object.keys(s).forEach(o=>{let u=s[o].raw,l=!0;n.includes(o)&&(l=u!==""&&u!==void 0&&u!==null),i.push(l)}),i.every(o=>o)&&a.push(s)}),a.length>0?(r=n,!1):(r=n,!0)}),r},Qn=(t,e)=>{let r=Wn(t,e),n=Jn(t,r);return t.filter(a=>{let s=[];return Object.keys(a).forEach(i=>{let o=a[i].raw,u=!0;n.includes(i)&&(u=o!==""&&o!==void 0&&o!==null),s.push(u)}),s.every(i=>i)})},Uo=t=>{let e=t[t.length-1]?.ts?.raw;return e?t.filter(r=>r.ts.raw===e):t},qo=t=>{let e=t[0]?.ts?.raw;return e?t.filter(r=>r.ts.raw===e):t},Yo=t=>[...new Set(t.map(r=>r.ts.raw))].map(r=>t.filter(n=>n.ts.raw===r)),Po=(t,e)=>[...new Set(t.map(n=>n[e].raw))].map(n=>t.filter(a=>a[e].raw===n)),jo=(t,e)=>{if(!t||!t.length)return;let r=e[0],n=t.length-1,a=!1;for(;!a;){let s=`${t[n]?.id}`;s&&n!==-1&&(!r[s]||!r[s].raw||r[s].raw===""||r[s].raw===null)?n-=1:a=!0}return n!==-1?t[n]:void 0},Bo=(t,e,r=!1)=>{let{keys:n,measures:a}=t.columns,s=n||[],i=[...a];r&&(i=[...s,...a]);let o=i.map(u=>u.id);return e.map(u=>Object.keys(u).filter(l=>o.includes(l)).reduce((l,c)=>(l[c]=u[c],l),{}))},Y={getDatasetRows:Vo,getLastestDataset:Uo,getEarliestDataset:qo,filterRowsByDisplayColumns:Bo,groupRowsByTimestamp:Yo,groupRowsByKey:Po,getGroupKey:jo,getKeyVariations:Wn,getKeyIds:Jn,filterKeys:Qn};var Go=(t,e)=>{let{columns:r,showLatest:n=!0,columnsAsList:a}=t,{measures:s,keys:i}=r,o=!s&&!i||!s.length&&!i,u=[...e];n&&(u=Y.getLastestDataset(u));let l,c,h;return o?{head:l,rows:c,ts:h}=zo(u):a?{head:l,rows:c,ts:h}=Ho(t,u):{head:l,rows:c,ts:h}=Xo(t,u),c.length&&s&&(c=Wo(c,s)),{table:{head:l,rows:c},ts:h}},Ho=(t,e)=>{let{columns:r}=t,{keys:n,measures:a}=r,s=Y.getGroupKey(n,e),i=e[0]?.ts?.raw,o=i?`${i}`:"",u=[];u.push({text:""}),e.forEach(c=>{u.push({text:s?c[s.id].raw:""})});let l=[];return a.forEach(c=>{l.push([{text:c.display}])}),a.forEach((c,h)=>{e.forEach(f=>{l[h].push({text:`${f[c.id].raw}`})})}),{rows:l,head:u,ts:o}},Dr=(t,e)=>t.map(r=>{let n=e?.length?Array(e.length):Array(Object.keys(t[0]).length);return Object.keys(r).forEach((a,s)=>{let i=e?.length?e.findIndex(u=>u.id===a):s,o=r[a].raw;n.splice(i,1,{text:o})}),n}),Xo=(t,e)=>{let{measures:r}=t.columns,n=r.map(l=>({text:l.display})),a=Y.getDatasetRows(t,e),s=Y.filterRowsByDisplayColumns(t,a),i=Dr(s,r),o=a[0]?.ts?.raw,u=o?`${o}`:"";return{head:n,rows:i,ts:u}},zo=t=>{let e=Object.keys(t[0]).map(i=>({text:i})),r=Dr(t),a=Y.getLastestDataset(t)[0]?.ts?.raw,s=a?`${a}`:"";return{head:e,rows:r,ts:s}},Wo=(t,e)=>{let r=e.map((n,a)=>n.aggregate?a:void 0).filter(n=>n);if(r.length){let n=[{html:"<strong>Total<strong>"}];for(let a=1;a<e.length;a+=1)n[a]={text:""};t.push(n),r.forEach(a=>{let s=t.reduce((i,o)=>(i+=+o[a].text,i),0);t[t.length-1][a]={html:`<strong>${s}<strong>`}})}return t},ot={createList:Go,createTableRows:Dr};var Jo=(t,e)=>{let r=["bar-timeseries","line-timeseries"],{type:n}=t,a,s,i;if(r.includes(n)){let{latestData:o,dataSetRows:u,timeseriesData:l}=Ko(t,e);u.length&&(s=au(t,l),a=su(t,l),i=Kn(t,o,!0))}else{let{dataSetRows:o,snapshotData:u}=Qo(t,e);o.length&&(s=eu(t,u),a=nu(t,o),i=Kn(t,o))}return{details:i,table:a,chart:s}},ea={createChart:Jo},Qo=(t,e)=>{let r=Y.getLastestDataset(e),n=Y.getDatasetRows(t,r),a=Y.filterRowsByDisplayColumns(t,n,!0);return{dataSetRows:n,snapshotData:a}},Ko=(t,e)=>{let r=Y.getLastestDataset(e),n=Y.getDatasetRows(t,e),a=Y.filterRowsByDisplayColumns(t,n,!0);return{latestData:r,dataSetRows:n,timeseriesData:a}},Kn=(t,e,r=!1)=>{let n=[],a=Zo(t,e,r);return e[0]?.ts&&n.push({label:"Values for:",value:e[0]?.ts.raw}),{meta:n,headlines:a}},Zo=(t,e,r=!1)=>{let n=[],{columns:a}=t,{measures:s}=a,i=!!s.find(h=>h.axis),o,u,l,c;return r?(u=s.find(h=>h.id!=="ts"),u&&(c=`${e[0].ts.raw}`,l=+e[0][u.id].raw,o={label:c,value:l})):(u=i?s.find(h=>h.axis&&h.axis==="y"):s[0],u&&(c=`Total ${u.display.toLowerCase()}`,l=e.reduce((h,f)=>h+ +f[u.id].raw,0),o={label:c,value:l})),n.push(o),n},eu=(t,e)=>{let{type:r,columns:n}=t,{measures:a}=n,s=!!a.find(l=>l.axis),i,o,u;return s?{labels:i,unit:o,datasets:u}=ru(n,e):{labels:i,unit:o,datasets:u}=tu(n,e),{type:r,unit:o,data:{labels:i,datasets:u}}},tu=(t,e)=>{let{keys:r,measures:n}=t,a=n.map(u=>u.display),s=r[r.length-1]?.id,i=n[0].unit?n[0].unit:void 0,o=e.map(u=>{let l=u[s]?`${u[s].raw}`:"All",c=n.map(f=>{let d=f.id;return u[d]?+u[d].raw:0}),h=c.reduce((f,d)=>f+d,0);return{label:l,data:c,total:h}});return{labels:a,unit:i,datasets:o}},ru=(t,e)=>{let{measures:r,keys:n}=t,a=r.find(h=>h.axis==="x"),s=r.find(h=>h.axis==="y"),i=s?.unit||void 0,o=Y.getGroupKey(n,e),u=o?Y.groupRowsByKey(e,o.id):[e],l=u[0]?.map(h=>`${h[a.id].raw}`),c=u.map(h=>{let f=h.map(d=>+d[s.id].raw);return{label:o?`${h[0][o.id].raw}`:s.display,data:f,total:f.reduce((d,m)=>d+m,0)}});return{labels:l,unit:i,datasets:c}},nu=(t,e)=>{let{columns:r}=t,{keys:n,measures:a}=r,i=[...n,...a].map(l=>({text:l.display})),o=Y.filterRowsByDisplayColumns(t,e,!0),u=ot.createTableRows(o);return{head:i,rows:u}},au=(t,e)=>{let{columns:r}=t,{keys:n,measures:a}=r,s=a[0].unit?a[0].unit:void 0,i=t.type==="bar-timeseries"?"bar":"line",u=Y.getGroupKey(n,e).id,l=Y.groupRowsByTimestamp(e),c=l.map(d=>d[0].ts.raw),h=l[0].length,f=[];for(let d=0;d<h;d+=1){let m=l.map(g=>+g[d][a[1].id].raw),p=m.reduce((g,S)=>g+S,0),w=l[0][d][u].raw;f.push({data:m,label:w,total:p})}return{type:i,unit:s,timeseries:!0,data:{labels:c,datasets:f}}},su=(t,e)=>{let{columns:r}=t,{keys:n,measures:a}=r,s=e.flat(),i=e.length>1,o=[...a];if(i){let c=o.findIndex(f=>f.id==="ts"),h=o[c];o.splice(c,1),o=[...n,...o],o.unshift(h)}else s=Y.filterRowsByDisplayColumns(t,s);let u=o.map(c=>({text:c.display})),l=ot.createTableRows(s);return{head:u,rows:l}};var Ui=te(Js()),qi=te(Vi()),Dc=(0,qi.default)({outputMode:"short",color:!1}),Sc=Ui.default.createLogger({name:"Digital Prison Reporting:",stream:Dc,level:"debug"}),pe=Sc;var ar={getCurrentVariantDefinition:(t,e,r)=>{if(!t){pe.info("No definitions");return}let n,a=t.find(s=>s.id===e);return a&&(n=a.variants.find(s=>r===s.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(s=>s.id===t)};var go=te(qe());var sr=te(qe()),Yi=te(at());var bc=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||"",s=t.locals.pathSuffix||"",i=t.locals.routePrefix||"",o=t.locals.definitions||[],u=t.locals.requestedReports||[],l=t.locals.recentlyViewedReports||[],c=t.locals.bookmarks||[],{bookmarkingEnabled:h,downloadingEnabled:f,definitionsPath:d,dpdPathFromQuery:m,dpdPathFromConfig:p,nestedBaseUrl:w}=t.locals;return{csrfToken:e,userId:r,token:n,definitions:o,requestedReports:u,recentlyViewedReports:l,bookmarks:c,bookmarkingEnabled:h,downloadingEnabled:f,dpdPathFromQuery:m,dpdPathFromConfig:p,definitionsPath:d,pathSuffix:s,routePrefix:i,activeCaseLoadId:a,nestedBaseUrl:w}},Rc=(t,e)=>(e&&(t.query={...t.query,dataProductDefinitionsPath:e}),t.query),z={getValues:bc,setDdpPathToReqQuery:Rc};sr.default.extend(Yi.default);var wc=["ABORTED","FAILED","EXPIRED"],Ec=["SUBMITTED","STARTED","PICKED"];function _c(t){return Promise.all(t).then(e=>{let r=e.find(a=>typeof a.status=="number"||wc.includes(a.status));if(r)return r;let n=e.find(a=>Ec.includes(a.status));return n||e[0]})}var Pi=async(t,e,r,n,a)=>{let{definitionsPath:s}=z.getValues(r),{type:i,reportId:o,executionId:u,id:l,tableId:c}=e.body,f=(await t.requestedReportService.getReportByExecutionId(u,a)).childExecutionData??[];i==="report"&&f.push({executionId:u,tableId:c,variantId:l});let d=f.map(p=>t.reportingService.getAsyncReportStatus(n,o,p.variantId,p.executionId,s,p.tableId));i==="dashboard"&&d.push(t.dashboardService.getAsyncStatus(n,o,l,u,s,c));let m=await _c(d);return{status:m.status,statusResponse:m}},ji=async({req:t,res:e,services:r})=>{let{token:n,userId:a}=z.getValues(e),{status:s,requestedAt:i}=t.body,o=["READY","EXPIRED","FAILED"],u,l,c;try{if({status:u,statusResponse:c}=await Pi(r,t,e,n,a),Ac({requestedAt:i,compareTime:new Date,durationMins:15})&&!o.includes(u))throw new Error("Request taking too long. Request Halted");if(u==="FAILED"){pe.error(`Error: ${JSON.stringify(c.error)}`);let{userMessage:h,developerMessage:f}=c.error;h||f?l=c.error:l={developerMessage:c.error}}}catch(h){pe.error(`Error: ${JSON.stringify(h)}`);let{data:f}=h;l=f||{userMessage:h.message},u=s==="FINISHED"?"EXPIRED":"FAILED"}return typeof u=="number"&&(u="FAILED"),{status:u,...l&&{errorMessage:l}}},Bi=async({req:t,res:e,services:r})=>{let{token:n,userId:a}=z.getValues(e),{executionId:s,status:i}=t.body,o,u;try{({status:u}=await Pi(r,t,e,n,a))}catch(c){let{data:h}=c;o=(h??{}).userMessage,u=i==="READY"||i==="FINISHED"?"EXPIRED":"FAILED"}return{isExpired:{status:u,...o&&{errorMessage:o}}.status==="EXPIRED",executionId:s}},Ac=({requestedAt:t,compareTime:e,durationMins:r})=>{let n=(0,sr.default)(e),a=(0,sr.default)(t);return n.diff(a,"minutes")>=r};var ue=te(qe()),zi=te(at()),Wi=te(Gi());var Mn=(t,e,r)=>{let{min:n,max:a}=t,s;n?s=Hi(n,e):s=e;let i;return a?i=Xi(a,r):i=r,{start:s,end:i}},Hi=(t,e)=>{let r=new Date(t);return new Date(e)<r?t:e},Xi=(t,e)=>{let r=new Date(t);return new Date(e)>r?t:e},Tc=t=>{let{min:e,max:r,defaultValue:n}=t,a,s;e&&(a=e),r&&(s=r);let i=/^\d{1,4}-\d{1,2}-\d{2,2} - \d{1,4}-\d{1,2}-\d{1,2}$/,o;return n&&n.match(i)?([a,s]=n.split(" - "),o=Mn(t,a,s)):n?o=n:o=Mn(t,a,s),o};function Cc(t){return t.start!==void 0||t.end!==void 0}var Ye={compareMax:Xi,compareMin:Hi,isDateRange:Cc,setDateRangeValuesWithinMinMax:Mn,getStartAndEndValueFromDefinition:Tc};ue.default.extend(zi.default);var Lc=(t,e,r,n)=>{ue.default.extend(Wi.default);let a=(0,ue.default)(r),s=(0,ue.default)(n),i=t?t.isBetween(a,s,"day","[]"):!0,o=e?e.isBetween(a,s,"day","[]"):!0;return i&&o},Ji=t=>{let e,r;switch(t){case"none":e="",r="";break;case"yesterday":e=(0,ue.default)(),r=e.subtract(1,"day");break;case"tomorrow":r=(0,ue.default)(),e=r.add(1,"day");break;case"last-week":e=(0,ue.default)(),r=e.subtract(1,"week");break;case"next-week":r=(0,ue.default)(),e=r.add(1,"week");break;case"last-month":e=(0,ue.default)(),r=e.subtract(1,"month");break;case"next-month":r=(0,ue.default)(),e=r.add(1,"month");break;default:break}return{endDate:e,startDate:r}},kc=(t,e,r)=>{let n=e.query[`${r}${t.name}.start`],a=e.query[`${r}${t.name}.end`],s=e.query[`${r}${t.name}.relative-duration`];return{start:n||t.min,end:a||t.max,...s&&{relative:s}}},Oc=(t,e)=>{let r=e.split(".")[0],n=Object.keys(t.body).filter(s=>s.includes(r)).map(s=>({name:s,value:t.body[s]})),a={start:"",end:""};return n.forEach(s=>{s.name.includes("start")&&(a.start=s.value),s.name.includes("end")&&(a.end=s.value)}),{value:a,name:r}},xc=(t,e)=>{let r={start:"",end:""},{start:n,end:a}=t.value;return n&&(r.start=(0,ue.default)(n,"D/M/YYYY").format("YYYY-MM-DD").toString()),a&&(r.end=(0,ue.default)(a,"D/M/YYYY").format("YYYY-MM-DD").toString()),{...e,value:r}},Qi=(t,e)=>{t||(t="1977-05-25"),e||(e="9999-01-01");let r=Ki();return r.forEach(n=>{if(n.value){let{endDate:a,startDate:s}=Ji(n.value);Lc(s,a,t,e)||(n.disabled=!0)}}),r.filter(n=>n.value!=="none").every(n=>n.value===null||n.disabled)&&(r=[]),r},Mc=t=>{let r=Ki().find(n=>n.value===t);return r?r.text:""},Ki=()=>[{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"}],Ic=(t,e)=>{let r=Ye.getStartAndEndValueFromDefinition(t),n=Qi(t.min,t.max);return{...e,min:t.min,max:t.max,relativeOptions:n,value:r}},Fc=(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:Ji,getRelativeDateOptions:Qi,getFilterFromDefinition:Ic,setValueFromRequest:kc,getQueryFromDefinition:Fc,mapRelativeValue:Mc,setDefaultValue:Oc,setFilterValueFromDefault:xc};var Nc=(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}`,s=[`"${a}"`],i=[`${e}${n.name}`],o="",u=!1,l;n.type.toLowerCase()==="DateRange".toLowerCase()&&({key:i,value:s,disabled:u,cantRemoveClass:o,displayValue:a,constraints:l}=eo(n,e)),n.type.toLowerCase()==="GranularDateRange".toLowerCase()&&({key:i,value:s,disabled:u,cantRemoveClass:o,displayValue:a,constraints:l}=no(n,e)),n.type.toLowerCase()==="Date".toLowerCase()&&({key:i,value:s,disabled:u,cantRemoveClass:o,displayValue:a,constraints:l}=$c(n,e)),(n.type.toLowerCase()==="Autocomplete".toLowerCase()||n.type.toLowerCase()==="Radio".toLowerCase()||n.type.toLowerCase()==="Select".toLowerCase())&&({key:i,value:s,displayValue:a}=to(n,e)),n.type.toLowerCase()==="Multiselect".toLowerCase()&&({key:i,value:s,displayValue:a}=ro(n,e));let c;return u?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(i),value:s,disabled:u,constraints:l,classes:`interactive-remove-filter-button${o}`,attributes:{"aria-label":c}}})},eo=(t,e)=>{let r=t.value.start||"Open start",n=t.value.end||"Open end",a=`${e}${t.name}`,s=[`${a}.start`,`${a}.end`],i=[`"${r}"`,`"${n}"`],o=`${r} - ${n}`;t.value.relative&&(s.push(`${a}.relative-duration`),i.push(`"${t.value.relative}"`),o=Ee.mapRelativeValue(t.value.relative));let u=In(t,s),{disabled:l,cantRemoveClass:c,displayValue:h}=ao(t,i,o);return{key:s,value:i,displayValue:h||o,disabled:l,cantRemoveClass:c,constraints:u}},In=(t,e,r=!1)=>{let n=[],{min:a,max:s}=t;return a&&n.push({key:e[0],value:a}),s&&!r&&n.push({key:e[1],value:s}),n.length?n:void 0},to=(t,e)=>{let n=t.options.find(i=>i.value===t.value).text,a=[`${e}${t.name}`],s=[`"${t.value}"`];return{key:a,value:s,displayValue:n}},ro=(t,e)=>{let n=t.value.split(","),a=n.map(o=>t.options.find(l=>l.value===o).text).filter((o,u)=>u<3).join(", ");a=n.length>3?`${a} + ${n.length-3} more`:a;let s=n.map(o=>`"${o}"`);return{key:[`${e}${t.name}`],value:s,displayValue:a}},no=(t,e)=>{let r=t.value.start||"Open start",n=t.value.end||"Open end",a=t.value.quickFilter?.value,s=`${e}${t.name}`,i=[`${s}.start`,`${s}.end`,`${s}.granularity`],o=[`"${r}"`,`"${n}"`,`"${t.value.granularity.value}"`],u=In(t,i),l,c=t.value.granularity.display;a&&a!=="none"?(i.push(`${s}.quick-filter`),o.push(`"${t.value.quickFilter.value}"`),l=`${t.value.quickFilter.display}: ${c}`):l=`${r} - ${n}: ${c}`;let{disabled:h,cantRemoveClass:f,displayValue:d}=ao(t,o,l);return{key:i,value:o,displayValue:d||l,disabled:h,constraints:u,cantRemoveClass:f}},$c=(t,e)=>{let r=[`${e}${t.name}`],n=`${t.value}`,a=[`"${n}"`],s=In(t,r,!0),{disabled:i,cantRemoveClass:o,displayValue:u}=Vc(t,a,n);return{key:r,value:a,displayValue:u||n,disabled:i,constraints:s,cantRemoveClass:o}},ao=(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}},Vc=(t,e,r)=>{let{min:n,max:a}=t;if(n&&e[0].includes(n)||a&&e[0].includes(a)){let s;return e[0].includes(n)&&(s="min"),e[0].includes(a)&&(s="max"),{disabled:!0,cantRemoveClass:" interactive-remove-filter-button--disabled",displayValue:`${r} (${s} date)`}}return{disabled:!1,cantRemoveClass:"",displayValue:r}},Uc=(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:s}=a;return a.type.toLowerCase()==="Multiselect".toLowerCase()&&(s=ro(a,"filters").displayValue),(a.type.toLowerCase()==="Autocomplete".toLowerCase()||a.type.toLowerCase()==="Radio".toLowerCase()||a.type.toLowerCase()==="Select".toLowerCase())&&(s=to(a,n).displayValue),a.type.toLowerCase()==="DateRange".toLowerCase()&&(s=eo(a,n).displayValue),a.type.toLowerCase()==="GranularDateRange".toLowerCase()&&(s=no(a,n).displayValue),{id:a.name,name:a.text,value:s}})},or={getSelectedFilters:Nc,getQuerySummary:Uc};var ur=(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>`},Yc=t=>{let e="";switch(t){case"dashboard":e="govuk-tag--purple";break;case"unavailable":e="govuk-tag--grey";break;default:e="";break}return e},lr=(t,e,r,n)=>{let a=n?"":"dpr-display-none",s=Yc(r),i=Pc(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 ${s} dpr-request-status-tag--small govuk-!-margin-bottom-4'">${i}</strong>
<p class="govuk-body-xs govuk-!-margin-bottom-0 govuk-!-margin-top-3 ${a}">${n}</p>
</div>`};var so=(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 s,i;return e==="unavailable"?(i="Request missing report",s=`<a class='dpr-user-list-action govuk-link--no-visited-state govuk-!-margin-bottom-1 dpr-missing-report' href="${t}">${i}</a>`):(i=`Request ${e}`,r&&r==="sync"&&(i=`Load ${e}`),s=`<a class='dpr-user-list-action govuk-link--no-visited-state govuk-!-margin-bottom-1 dpr-live-report dpr-type__${e}' href="${t}">${i}</a>`,n&&(s=`${s}${n}`)),s},Pc=t=>t.charAt(0).toUpperCase()+t.substring(1).toLowerCase(),io=(t,e,r,n,a)=>{let s="";if(e==="unavailable")s=`dpr/request-missing-report/${r}/${n}/form`;else{let{pathSuffix:i,dpdPathFromQuery:o}=z.getValues(a),u=o?i:"";s=`dpr/request-report/${e}/${r}/${n}/filters${u}`,t&&t==="sync"&&(s=`dpr/view-report/sync/${e}/${r}/${n}/load-report${u}`)}return s};var oo={getRequestStatus:async({req:t,res:e,services:r})=>{let{executionId:n,status:a}=t.body,s=e.locals.user?.uuid?e.locals.user.uuid:"userId",i=await ji({req:t,res:e,services:r});return a!==i.status&&(await r.requestedReportService.updateStatus(n,s,i.status,i.errorMessage),i.reportData=await r.requestedReportService.getReportByExecutionId(n,s)),i},filterReports:t=>!t.timestamp.lastViewed};var uo={filterReports:t=>t.status==="READY"||t.executionId?.length&&t.status==="EXPIRED"};var lo={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 jc=async t=>t.map(e=>Bc(e)).sort((e,r)=>e.text.localeCompare(r.text)),Bc=t=>{let e=JSON.parse(JSON.stringify(t)),{id:r,name:n,description:a,href:s,reportName:i,type:o}=e;return{id:r,reportName:i,text:n,description:a,href:s,type:o}},Gc=async(t,e,r,n,a)=>{let s=await Promise.all(t.sort((i,o)=>i.name.localeCompare(o.name)).map(async i=>Hc(i,e,r,n)));return{rows:a?s.slice(0,a):s,head:[{text:"Product",classes:"dpr-req-product-head"},{text:"Description",classes:"dpr-bm-description-head"},{text:"Actions",classes:"dpr-bm-actions-head"}]}},Hc=async(t,e,r,n)=>{let{description:a,reportName:s,reportId:i,id:o,href:u,name:l,type:c,loadType:h}=t,f=await e.createBookMarkToggleHtml({userId:n,reportId:i,id:o,csrfToken:r,ctxId:"bookmark-list",reportType:c});return[{html:lr(s,l,c)},{html:lo.createShowMoreHtml(a),classes:"dpr-req-cell"},{html:so(u,c,h,f),classes:"dpr-req-cell dpr-req-cell__status"}]},Xc=async(t,e,r,n,a)=>{let s=[],{definitionsPath:i}=z.getValues(r);return await Promise.all(t.map(async o=>{let u,{reportId:l,variantId:c,id:h,automatic:f,type:d}=o,m=c||h,p=d||"report";try{let w,g,S,O="async",T=`/async/${p}/${l}/${m}/request`;if(p==="report"&&(u=await a.reportingService.getDefinition(n,l,m,i),S=u.name,w=u.variant.name,g=u.variant.description||u.description,O=u.variant.loadType||O,T=io(O,p,l,m,r)),p==="dashboard"){let M=await ar.getReportSummary(l,a.reportingService,n,i);u=await a.dashboardService.getDefinition(n,l,m,i),w=u.name,S=M.name,g=u.description}u&&s.push({reportId:l,id:m,reportName:S,name:w,description:g,type:p,href:T,loadType:O,automatic:f})}catch{pe.warn(`Failed to map bookmark for: Report ${l}, variant ${m}`);let g=r.locals.user?.uuid?r.locals.user.uuid:"userId";await a.bookmarkService.removeBookmark(g,m,l)}})),s},co={renderBookmarkList:async({services:t,maxRows:e,res:r,req:n})=>{let{token:a,csrfToken:s,userId:i,bookmarks:o}=z.getValues(r),u=await Xc(o,n,r,a,t),l=await jc(u),c=l.length;e&&(l=l.slice(0,e));let h=await Gc(u,t.bookmarkService,s,i,e),f={...l.length&&{href:"/dpr/my-reports/bookmarks/list"},...!l.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:s,type:"bookmark"}}};var Pe=te(qe()),fo=te(at());var Tt=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(Pe.default.extend(fo.default),this.getDateType(e)){case"iso":return(0,Pe.default)(e);case"local-date":return(0,Pe.default)(e,this.localDateFormatInput);case"local-date-short-year":return(0,Pe.default)(e,this.localDateShortYearFormatInput);case"local-datetime":return(0,Pe.default)(e,this.localDateTimeFormatInput);case"local-datetime-short-year":return(0,Pe.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 pe.warn(`Invalid date type: ${r}`),null}return e&&pe.warn(`Could not map non-date value : ${e}`),null}};var po=te(yr());var Fn="~clear~",zc=(t,e,r)=>{let n;e?(n={...t,selectedPage:"1"},Object.keys(e).forEach(s=>{e[s]?n[s]=e[s]:Object.keys(n).filter(i=>i===s||i.startsWith(`${s}.`)).forEach(i=>{n[i]=Fn})})):n={selectedPage:"1",pageSize:t.pageSize,sortColumn:t.sortColumn,sortedAsc:t.sortedAsc,dataProductDefinitionsPath:t.dataProductDefinitionsPath};let a={};return Object.keys(n).filter(s=>n[s]).forEach(s=>{a[s]=n[s]}),Wc(a,r)},Wc=(t,e)=>`?${Object.keys(t).flatMap(n=>{let a=e?.find(i=>`filters.${i.name}`===n),s=t[n];return Array.isArray(s)?s.map(i=>`${encodeURI(n)}=${encodeURI(i)}`):a&&a.filter.type.toLowerCase()==="Multiselect".toLowerCase()?s.split(",").map(o=>`${encodeURI(n)}=${encodeURI(o)}`):[`${encodeURI(n)}=${encodeURI(s)}`]}).join("&")}`,ho=t=>t&&t!==""?`?dataProductDefinitionsPath=${t}`:"";var mo=zc;var Ct=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:s,name:i})=>(this.userStoreItem={type:e,reportId:r,reportName:n,description:a,id:s,name:i,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:s,defaultInteractiveQueryString:i}=this.requestFormData,{executionId:o,dataProductDefinitionsPath:u,dpdPathFromQuery:l}=this.userStoreItem,c=l?`${ho(u)}`:"",h=e.baseUrl.replace("/filters",`/${o}/status`),f=`${r}${h}`;return this.userStoreItem={...this.userStoreItem,url:{origin:r,request:{fullUrl:s,pathname:n,search:a},polling:{fullUrl:f,pathname:h},report:{...i?.length&&{search:c.length?`${c}&${i}`:`?${i}`,default:`?${i}`}}}},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,po.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 Jc=t=>{let e=JSON.parse(JSON.stringify(t)),{executionId:r,tableId:n,variantName:a,name:s,reportId:i,variantId:o,id:u,description:l,query:c,interactiveQuery:h,status:f,timestamp:d,reportName:m,dataProductDefinitionsPath:p,type:w,url:g}=e,S=[];c&&(S=c.summary);let O=[];h&&(O=h.summary);let T=w||"report";return{id:r,text:s||a,reportName:m,description:l,tag:"MIS",summary:S,interactiveSummary:O,timestamp:d,status:f,type:T,...rf(f,e),meta:{reportId:i,id:o||u,executionId:r,tableId:n,status:f,type:T,dataProductDefinitionsPath:p,pollingUrl:g.polling?.pathname,reportUrl:g.report?.pathname}}},Qc=(t,e)=>({rows:t.map(n=>Kc(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"}]}),Kc=(t,e)=>{let r,n="",{href:a,id:s,reportName:i,text:o,timestamp:u,type:l,status:c}=t;switch(c){case"FAILED":r="govuk-tag--red",n=ur(a,s,e,c);break;case"EXPIRED":r="govuk-tag--grey",n=ur(a,s,e,c);break;case"ABORTED":r="govuk-tag--orange",n=ur(a,s,e,c);break;case"READY":case"FINISHED":n=`<a class=govuk-link govuk-link--no-visited-state dpr-type__${l}' href="${a}">Go to ${l}</a>`,r="govuk-tag--green";break;case"PICKED":case"SUBMITTED":case"STARTED":n=`<a class='govuk-link govuk-link--no-visited-state dpr-type__${l}' href="${a}">Go to status</a>`;break;default:break}let h="";return(t.summary||t.interactiveSummary)&&(h=ef(t)),[{html:lr(i,o,l,u)},{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"}]},Zc=(t,e)=>({amount:t,shown:t>e?e:t,max:e}),ef=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>`},tf=(t,e)=>{let{nestedBaseUrl:r}=z.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}))},rf=(t,e)=>{let r,n,a,{url:s,timestamp:i}=e,o=new Tt;switch(t){case"FAILED":{a=i.failed?o.toDateString(i.failed,"local-date"):(0,go.default)().format("DD/MM/YYYY"),n=`${s.polling.fullUrl}`,r=`Failed at: ${a}`;break}case"ABORTED":{n=`${s.request.fullUrl}`,a=o.toDateString(i.aborted,"local-date"),r=`Aborted at: ${a}`;break}case"FINISHED":n=s.report.fullUrl,a=o.toDateString(i.completed,"local-date"),r=`Ready at: ${a}`;break;case"EXPIRED":{n=`${s.request.fullUrl}`,a=o.toDateString(i.expired,"local-date"),r=`Expired at: ${a}`;break}case"READY":{n=`${s.report.fullUrl}`,a=o.toDateString(i.lastViewed,"local-date"),r=`Last viewed: ${a}`;break}case"SUBMITTED":case"STARTED":case"PICKED":n=s.polling.fullUrl,a=o.toDateString(i.requested,"local-date"),r=`Requested at: ${a}`;break;default:a=o.toDateString(i.lastViewed,"local-date"),r=`Last viewed: ${a}`;break}return{timestamp:r,href:n}},Nn=async({res:t,reportsData:e,maxRows:r,filterFunction:n,type:a})=>{let{csrfToken:s}=z.getValues(t),i=e.filter(n).map(Jc),o=i.length;r&&(i=i.slice(0,r));let u=Qc(i,a),l=a==="requested"?"requested-reports":"recently-viewed";return{head:{...i.length&&{href:`dpr/my-reports/${l}/list`},...!i.length&&{emptyMessage:`You have 0 ${a} reports`}},tableData:u,total:Zc(o,r),meta:tf(i,t),csrfToken:s,maxRows:r}},vo={renderList:Nn,updateExpiredStatus:async({req:t,res:e,services:r})=>{let{userId:n}=z.getValues(e),a=await Bi({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:s,bookmarkingEnabled:i}=z.getValues(e),o=await Nn({res:e,reportsData:a,filterFunction:oo.filterReports,maxRows:n,type:"requested"}),u=await Nn({res:e,reportsData:s,filterFunction:uo.filterReports,maxRows:n,type:"viewed"}),l;return i&&(l=await co.renderBookmarkList({res:e,req:r,services:t,maxRows:n})),{requestedReports:o,viewedReports:u,bookmarks:l}},updateLastViewed:async({req:t,services:e,reportStateData:r,userId:n,filters:a})=>{let{type:s,reportId:i,reportName:o,description:u,id:l,name:c,executionId:h,tableId:f,query:d,url:m}=r,p={type:s,reportId:i,reportName:o,description:u,id:l,name:c},w={executionId:h,tableId:f},g=d?{query:d.data,querySummary:d.summary}:{query:{},querySummary:[]},S={query:t.query,querySummary:or.getQuerySummary(t,a)},O=new Ct().addReportData(p).addExecutionData(w).addQuery(g).addInteractiveQuery(S).addStatus("READY").addTimestamp().addAsyncUrls(m).addReportUrls(t).build();await e.requestedReportService.updateLastViewed(r.executionId,n),await e.recentlyViewedService.setRecentlyViewed(O,n)}};var yo=(t,e)=>t.includes(e)?t:t.concat(e);var nf=t=>t.filter(e=>e.mandatory).map(e=>e.name),af=t=>t.filter(e=>e.visible).map(e=>e.name),Do=(t,e)=>[...nf(t),...e].reduce(yo,[]),So={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:Do(r,e??af(r))}},ensureMandatoryColumns:Do};var ge="filters.",Lt=class{constructor({fields:e,template:r,queryParams:n,definitionsPath:a,filtersPrefix:s=ge}){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=s,n.columns){let l=typeof n.columns=="string"?n.columns.split(","):n.columns;this.columns=So.ensureMandatoryColumns(e,l)}else this.columns=e.filter(l=>l.visible).map(l=>l.name);let i,o,u=e.find(l=>l.type==="date"&&l.filter&&l.filter.type==="daterange"||l.type==="date"&&l.filter&&l.filter.type==="date");u&&({min:i,max:o}=u.filter),this.filters={},Object.keys(n).filter(l=>l.startsWith(this.filtersPrefix)).filter(l=>n[l]).forEach(l=>{let c=l.replace(this.filtersPrefix,""),h=n[l].toString();c.includes(".start")&&i&&new Date(h)<new Date(i)&&(h=i),c.includes(".end")&&o&&new Date(h)>new Date(o)&&(h=o),h!=="no-filter"&&(this.filters[c]=h)}),u&&u.filter.type==="daterange"&&(i&&Object.keys(n).some(l=>l.includes(this.filtersPrefix))&&Object.keys(n).every(l=>!l.includes(".start"))&&(this.filters[`${u.name}.start`]=i),o&&Object.keys(n).some(l=>l.includes(this.filtersPrefix))&&Object.keys(n).every(l=>!l.includes(".end"))&&(this.filters[`${u.name}.end`]=o)),u&&u.filter.type==="date"&&i&&Object.keys(n).some(l=>l.includes(this.filtersPrefix))&&Object.keys(n).every(l=>!l.includes(u.name))&&(this.filters[`${u.name}.start`]=i)}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!==Fn)&&(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 $n=te(qe()),bo=te(at());$n.default.extend(bo.default);var Ro=t=>{let{defaultValue:e,min:r,max:n}=t,a;return e&&(a=e,r&&(a=Ye.compareMin(r,a)),n&&(a=Ye.compareMax(n,a))),a},sf=(t,e,r)=>{let{min:n,max:a,mandatory:s}=t,i=e.query[`${r}${t.name}`],o=i;return s&&!i&&(o=n||a||"1977-05-25"),o},of=(t,e)=>{let r=t.value?(0,$n.default)(t.value,"D/M/YYYY").format("YYYY-MM-DD").toString():"";return{...e,value:r}},uf=(t,e)=>({...e,value:Ro(t),min:t.min,max:t.max}),cr={setDateValueWithinMinMax:Ro,getFilterFromDefinition:uf,setValueFromRequest:sf,setFilterValueFromDefault:of};var F=te(qe()),wo=te(at());F.default.extend(wo.default);var Vn=(t,e,r)=>{let n,a;switch(t){case"daily":n=!1,a=!1;break;case"monthly":{let s=(0,F.default)(e).startOf("month"),i=(0,F.default)(r).endOf("month");n=!s.isSame(e,"day"),a=!i.isSame(r,"day")}break;case"annually":{let s=(0,F.default)(e).startOf("year"),i=(0,F.default)(r).endOf("year");n=!s.isSame(e,"day"),a=!i.isSame(r,"day")}break;default:n=!1,a=!1;break}return{start:n,end:a}},Un=()=>[{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"}],qn=()=>[{value:"hourly",text:"Hourly"},{value:"daily",text:"Daily"},{value:"monthly",text:"Monthly"},{value:"annually",text:"Annually"}],lf=(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},Yn=t=>{let e,r,n;switch(t){case"today":r=(0,F.default)(),e=(0,F.default)(),n="daily";break;case"yesterday":r=(0,F.default)().subtract(1,"day"),e=(0,F.default)().subtract(1,"day"),n="daily";break;case"last-seven-days":r=(0,F.default)(),e=r.subtract(7,"day").add(1,"day"),n="daily";break;case"last-thirty-days":r=(0,F.default)(),e=r.subtract(30,"day").add(1,"day"),n="daily";break;case"last-month":r=(0,F.default)(),e=r.subtract(1,"month").add(1,"day"),n="monthly";break;case"last-full-month":r=(0,F.default)().subtract(1,"month").endOf("month"),e=r.startOf("month"),n="monthly";break;case"last-ninety-days":r=(0,F.default)(),e=r.subtract(90,"day").add(1,"day"),n="daily";break;case"last-three-months":r=(0,F.default)(),e=r.subtract(3,"month").add(1,"day"),n="monthly";break;case"last-full-three-months":r=(0,F.default)().subtract(1,"month").endOf("month"),e=r.subtract(2,"month").startOf("month"),n="monthly";break;case"last-six-months":r=(0,F.default)(),e=r.subtract(6,"month").add(1,"day"),n="monthly";break;case"last-full-six-months":r=(0,F.default)().subtract(1,"month").endOf("month"),e=r.subtract(6,"month").startOf("month"),n="monthly";break;case"last-year":r=(0,F.default)(),e=r.subtract(1,"year").add(1,"day"),n="annually";break;case"last-full-year":r=(0,F.default)().subtract(1,"year").endOf("year"),e=r.startOf("year"),n="annually";break;case"tomorrow":r=(0,F.default)().add(1,"day"),e=(0,F.default)().add(1,"day"),n="daily";break;case"next-seven-days":e=(0,F.default)(),r=(0,F.default)().add(7,"day").subtract(1,"day"),n="daily";break;case"next-thirty-days":e=(0,F.default)(),r=(0,F.default)().add(30,"day").subtract(1,"day"),n="daily";break;case"next-month":e=(0,F.default)(),r=(0,F.default)().add(1,"month").subtract(1,"day"),n="monthly";break;case"next-full-month":e=(0,F.default)().add(1,"month").startOf("month"),r=e.endOf("month"),n="monthly";break;case"next-ninety-days":e=(0,F.default)(),r=(0,F.default)().add(90,"day").subtract(1,"day"),n="daily";break;case"next-three-months":e=(0,F.default)(),r=(0,F.default)().add(3,"month").subtract(1,"day"),n="monthly";break;case"next-full-three-months":e=(0,F.default)().add(1,"month").startOf("month"),r=e.add(2,"month").endOf("month"),n="monthly";break;case"next-year":e=(0,F.default)(),r=(0,F.default)().add(1,"year").subtract(1,"day"),n="annually";break;case"next-full-year":e=(0,F.default)().add(1,"year").startOf("year"),r=e.endOf("year"),n="annually";break;default:r=(0,F.default)(),e=(0,F.default)(),n="daily";break}return{start:e.format("YYYY-MM-DD").toString(),end:r.format("YYYY-MM-DD").toString(),granularity:n}},kt=(t,e)=>e.find(n=>n.value===t).text||t,cf=(t,e,r)=>{let{preventDefault:n}=e.query,a=e.query[`${r}${t.name}.quick-filter`],s=e.query[`${r}${t.name}.granularity`],i,o;a&&a!=="none"?({start:i,end:o}=Yn(a),s=lf(a,s)):(s=e.query[`${r}${t.name}.granularity`],i=e.query[`${r}${t.name}.start`],o=e.query[`${r}${t.name}.end`]);let u=n?null:t.value?.start,l=n?null:t.value?.end,c=n?"daily":t.value?.granularity.value,h=n?"none":t.value?.quickFilter.value,f=qn(),d=Un(),m=i||u||t.min,p=o||l||t.max,w=s||c,g=a||h;return{start:m,end:p,granularity:{value:w,display:kt(w,f)},quickFilter:{value:g,display:kt(g,d)},partialDate:{...Vn(w,m,p)}}},ff=(t,e)=>{let r=e.split(".")[0],n=Object.keys(t.body).filter(s=>s.includes(r)).map(s=>({name:s,value:t.body[s]})),a={start:"",end:"",granularity:null,quickFilter:null};return n.forEach(s=>{s.name.includes("start")&&(a.start=s.value),s.name.includes("end")&&(a.end=s.value),s.name.includes("granularity")&&(a.granularity=s.value),s.name.includes("granularity")&&(a.quickFilter=s.value)}),a=a.start!==""&&a.end!==""&&a.granularity&&a.quickFilter?a:"",{value:a,name:r}},df=(t,e)=>{let{granularity:r,quickFilter:n,start:a,end:s}=t.value,i={start:a?(0,F.default)(a,"D/M/YYYY").format("YYYY-MM-DD").toString():"",end:s?(0,F.default)(s,"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:i}},hf=(t,e)=>{let r,n=t.defaultQuickFilterValue,a=qn(),s=Un();if(n){let{start:i,end:o,granularity:u}=Yn(n);r={start:i,end:o,granularity:{value:u,display:kt(u,a)},quickFilter:{value:n,display:kt(n,s)},partialDate:{...Vn(u,i,o)}}}else{r=Ye.getStartAndEndValueFromDefinition(t);let i=r.granularity?r.granularity.value:t.defaultGranularity||"daily";r={...r,granularity:{value:i,display:kt(i,a)},quickFilter:{value:"none",display:"None"},partialDate:{...Vn(i,r.start,r.end)}}}return{...e,min:t.min,max:t.max,value:r,quickFilterOptions:Un(),granularityOptions:qn()}},mf=(t,e,r,n)=>{let a=[];if(t.defaultQuickFilterValue){let{start:s,end:i,granularity:o}=Yn(t.defaultQuickFilterValue);a.push(`${r}${e}.quick-filter=${t.defaultQuickFilterValue}`),a.push(`${r}${e}.granularity=${o}`),a.push(`${r}${e}.start=${s}`),a.push(`${r}${e}.end=${i}`)}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("&")},st={getFilterFromDefinition:hf,setValueFromRequest:cf,getQueryFromDefinition:mf,setDefaultValue:ff,setFilterValueFromDefault:df};var pf=(t,e,r)=>{let n=e.query[`${r}${t.name}`],a,s;return n?.length&&(a=Array.isArray(n)?n:[n],s=a.join(",")),{requestfilterValue:s||null,requestfilterValues:a||[]}},gf=(t,e,r)=>(t.defaultValue?t.defaultValue.split(","):[]).map(a=>`${r}${e}=${a}`).join("&"),vf=(t,e)=>{let n=t.value.split(","),a=n.map(o=>t.options.find(l=>l.value===o).text).filter((o,u)=>u<3).join(", ");a=n.length>3?`${a} + ${n.length-3} more`:a;let s=n.map(o=>`"${o}"`);return{key:[`${e}${t.name}`],value:s,displayValue:a}},Pn={getQueryFromDefinition:gf,setValueFromRequest:pf,getMultiselectValues:vf};var Eo=(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 s,i;a.type.toLowerCase()==="DateRange".toLowerCase()?s=Ee.setValueFromRequest(a,e,r):a.type.toLowerCase()==="GranularDateRange".toLowerCase()?s=st.setValueFromRequest(a,e,r):a.type.toLowerCase()==="Date".toLowerCase()?s=cr.setValueFromRequest(a,e,r):a.type.toLowerCase()==="Multiselect".toLowerCase()?{requestfilterValue:s,requestfilterValues:i}=Pn.setValueFromRequest(a,e,r):s=e.query[`${r}${a.name}`];let o=null;return s?o=s:n&&(o=null),{...a,value:o,...i&&{values:i}}})},yf=(t,e)=>{let r=t.some(n=>e.findIndex(s=>s.name===n.name)!==-1);return t.map(n=>{let a=e.find(o=>o.name===n.name),s={...n},i=n.type.toLocaleLowerCase();if(i==="Multiselect".toLocaleLowerCase()){let o=r?"":s.value;o=a?a.value:o;let u=r?[]:s.values;u=a?a.value.split(","):u,s={...s,value:o,values:u}}else if(i==="Date".toLocaleLowerCase()){let o=r?"":s.value;a=a||{...a,value:o},s=cr.setFilterValueFromDefault(a,s)}else if(i==="DateRange".toLocaleLowerCase()){let o=r?{start:"",end:""}:s.value;a=a||{...a,value:o},s=Ee.setFilterValueFromDefault(a,s)}else if(i==="GranularDateRange".toLocaleLowerCase()){let o=r?{start:"",end:"",granularity:"",quickFilter:""}:s.value;a=a||{...a,value:o},s=st.setFilterValueFromDefault(a,s)}else{let o=r?"":s.value;o=a?a.value:o,s={...n,value:o}}return s})},Df=(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,ge);if(a.type.toLowerCase()==="Multiselect".toLowerCase())return Pn.getQueryFromDefinition(a,n.name,ge);if(a.type.toLowerCase()==="GranularDateRange".toLowerCase()){let s=Ee.getQueryFromDefinition(a,n.name,ge);return st.getQueryFromDefinition(a,n.name,ge,s)}return`${ge}${n.name}=${a.defaultValue}`}).join("&")},Sf=async(t,e,r)=>{let{token:n,definitionsPath:a}=z.getValues(e),{reportId:s,id:i,type:o}=t.body,l=await(o==="report"?r.reportingService:r.dashboardService).getDefinition(n,s,i,a),c=o==="report"?l.variant.specification.fields:l.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(S=>S.name===m),{value:w,name:g}=d;if(p){let S=p.filter?.type.toLocaleLowerCase();S==="Multiselect".toLocaleLowerCase()&&(w=d.value.join(",")),S==="DateRange".toLocaleLowerCase()&&({value:w,name:g}=Ee.setDefaultValue(t,g)),S==="GranularDateRange".toLocaleLowerCase()&&({name:g,value:w}=st.setDefaultValue(t,g))}return{name:g,value:w}}),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},bf=(t,e)=>{let{activeCaseLoadId:r}=z.getValues(t);return e.forEach(n=>{n.type.toLocaleLowerCase()==="Autocomplete".toLocaleLowerCase()&&n.text.toLocaleLowerCase().includes("establishment")&&r.length&&(n.value=r)}),e},_o=(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:s}=r,{type:i,staticOptions:o,dynamicOptions:u,defaultValue:l,mandatory:c,pattern:h}=s,f=o?o.map(p=>({value:p.name,text:p.display})):[],d={text:n,name:a,type:i,value:l||null,minimumLength:u?u.minimumLength:null,dynamicResourceEndpoint:null,mandatory:c||!1,pattern:h},m={value:"no-filter",text:"None",disabled:!1};switch(i){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:l?l.split(","):[]};break;case"DateRange".toLowerCase():d=Ee.getFilterFromDefinition(s,d);break;case"Date".toLowerCase():d=cr.getFilterFromDefinition(s,d);break;case"GranularDateRange".toLocaleLowerCase():{let p=s;d=st.getFilterFromDefinition(p,d);break}default:break}return d}),Rf=(t,e,r,n)=>{let a={},{fields:s}=e.specification,{preventDefault:i}=n.query;if(Object.keys(t.filters).length===0&&!i&&s.filter(u=>u.filter&&u.filter.defaultValue).forEach(u=>{if(u.filter.type.toLowerCase()==="DateRange".toLowerCase()){let l=u.filter.defaultValue.split(" - ");l.length>=1&&(a[`${ge}${u.name}.start`]=l[0],l.length>=2&&(a[`${ge}${u.name}.end`]=l[1]))}else a[`${ge}${u.name}`]=u.filter.defaultValue}),Object.keys(a).length>0){let u=mo(t.toRecordWithFilterPrefix(),a,s);return r.redirect(`${n.baseUrl}${n.path}${u}`),!0}return!1},wf=async({fields:t,req:e,interactive:r=!1,prefix:n="filters."})=>{let a=await _o(t,r),s=Eo(a,e),i=or.getSelectedFilters(s,n);return{filters:s,selectedFilters:i}},Ao={getFiltersFromDefinition:_o,setFilterValuesFromRequest:Eo,getFilters:wf,setFilterQueryFromFilterDefinition:Df,redirectWithDefaultFilters:Rf,setFilterValuesFromSavedDefaults:yf,setUserDefinedDefaultValuesForReport:Sf,setUserContextDefaults:bf};var Ef=(t,e)=>{let{columns:r}=t,{measures:n,keys:a}=r,s=To(t,e),{earliest:i,latest:o,earliestTs:u,latestTs:l}=s,c=n.find(d=>d.displayValue),h=Y.getGroupKey(a,o),f;return c?h?f=Cf(r,i,u,o,l,h):f=Af(r,i,u,o,l):f=Tf(r,i,u,o,l,h),f},To=(t,e)=>{let r=Y.getLastestDataset(e),n=Y.getDatasetRows(t,r),a=n[0]?.ts?.raw,s=Y.filterRowsByDisplayColumns(t,n,!0),i=Y.getEarliestDataset(e),o=Y.getDatasetRows(t,i),u=o[0]?.ts?.raw;return{earliest:Y.filterRowsByDisplayColumns(t,o,!0),earliestTs:u,latest:s,latestTs:a}},fr=({title:t,value:e,rag:r,valueFor:n,valueFrom:a,prevVal:s,groupTitle:i})=>({title:t,value:e,...r&&{rag:Lf(r)},valueFor:n,trend:kf(n,a,e,s),...i&&{group:i}}),_f=(t,e)=>{let{columns:r}=t,{measures:n}=r,a=n[0],{id:s,display:i}=a,o=To(t,e),{earliest:u,latest:l,earliestTs:c,latestTs:h}=o;return l.map((d,m)=>{let p=i,{rag:w,raw:g}=d[s],S=u[m][s].raw,O=`${h}`,T=`${c}`;return fr({title:p,value:g,rag:w,prevVal:S,valueFor:O,valueFrom:T})})[0]},Af=(t,e,r,n,a)=>{let{measures:s}=t,i=s.find(u=>u.displayValue),o=s.find(u=>u.display||u.display==="");return[{title:"",scorecards:n.map((u,l)=>{let c=o?`${o.display} ${u[o.id].raw}`:o.display,{rag:h,raw:f}=u[i.id],d=e[l][i.id].raw,m=`${a}`,p=`${r}`;return fr({title:c,value:f,rag:h,prevVal:d,valueFor:m,valueFrom:p})})}]},Tf=(t,e,r,n,a,s)=>{let{measures:i}=t;return n.map((o,u)=>{let l=`${o[s?.id]?.raw}`||"";return{title:s.display?`${s.display}: ${l}`:l,scorecards:Object.keys(o).filter(c=>c!==s?.id).map(c=>{let h=e[u],d=i.find(O=>O.id===c)?.display||c,m=+o[c].raw,p=+o[c].rag,w=h[c]?.raw,g=`${a}`,S=`${r}`;return fr({title:d,value:m,rag:p,prevVal:w,valueFor:g,valueFrom:S})})}})},Cf=(t,e,r,n,a,s)=>{let{measures:i}=t,o=Y.groupRowsByKey(n,s.id),u=Y.groupRowsByKey(e,s.id),l=i.find(f=>f.displayValue),c=i.find(f=>f.display||f.display==="");return o.map((f,d)=>{let m=`${f[0][s?.id]?.raw}`||"";return{title:s.display?`${s.display}: ${m}`:m,scorecards:f.map((p,w)=>{let g=c?`${c.display} ${p[c.id].raw}`:c.display,S=+p[l.id].raw,O=+p[l.id].rag,T=`${a}`,M=`${r}`,U=u[d][w][l.id]?.raw;return fr({title:g,value:S,rag:O,prevVal:U,valueFor:T,valueFrom:M})})}})},Lf=t=>({score:t,color:["green","yellow","red"][t]}),kf=(t,e,r,n)=>{let a;if(e!==t){let s=+r-+n;a={direction:Math.sign(s),value:Math.abs(s),from:e}}return a},Of=t=>(t.reduce((r,n,a)=>(n.type==="scorecard"&&r.push(a),r),[]).reduce((r,n)=>{let a=r[r.length-1];return(!a||a[a.length-1]!==n-1)&&r.push([]),r[r.length-1].push(n),r},[]).reverse().forEach(r=>{let n=r[0],a=r.map(s=>t[s].data).filter(s=>!!s);for(;r.length;)t.splice(r.pop(),1);a.length&&t.splice(n,0,{id:`${n}`,type:"scorecard-group",data:[{scorecards:a}]})}),t),dr={createScorecard:_f,createScorecards:Ef,mergeScorecardsIntoGroup:Of};var it={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 xf=({refresh:t,print:e,share:r,copy:n,download:a})=>{let s=[];return t&&t.url&&t.executionId&&s.push(Mf(it.refresh,t)),e&&s.push($f(it.printable,e)),r&&s.push(If(it.sharable,r)),n&&s.push(Ff(it.copy,n)),a&&s.push(Nf(it.downloadable,a)),s},Mf=(t,e)=>{let{url:r}=e;return{...t,href:r}},If=(t,e)=>{let{reportName:r,name:n,url:a}=e,s=`mailto:?subject=${r}-${n}&body=${encodeURIComponent(a)}`;return{...t,href:s}},Ff=(t,e)=>{let{url:r}=e;return{...t,href:r}},Nf=(t,e)=>{let{canDownload:r,enabled:n}=e,{tooltipText:a,ariaLabelText:s}=t;return{...t,tooltipText:r?a:"Enable download",disabled:!n,attributes:{...e},ariaLabelText:n?s:`${s}, disabled`}},$f=(t,e)=>{let{enabled:r}=e,{ariaLabelText:n}=t;return{...t,disabled:!r,href:"#",ariaLabelText:r?n:`${n}, disabled`}},Co={getActions:xf};var Vf=(t,e,r)=>{let n=e.name,{name:a}=t,s=r.url.request.fullUrl,{executionId:i}=r;return Co.getActions({share:{reportName:n,name:a,url:s},refresh:{url:s,executionId:i},copy:{url:s}})},Uf=async({req:t,res:e,services:r,next:n})=>{let{token:a}=z.getValues(e),{reportId:s,id:i}=t.params,{dataProductDefinitionsPath:o}=t.query,u=await r.dashboardService.getDefinition(a,s,i,o),l=await ar.getReportSummary(s,r.reportingService,a,o),c=await Ao.getFilters({fields:u.filterFields||[],req:t,interactive:!0});return{query:new Lt({fields:u.filterFields||[],queryParams:t.query,definitionsPath:o}).toRecordWithFilterPrefix(!0),filters:c,dashboardDefinition:u,reportDefinition:l}},qf=(t,e)=>t.sections.map(r=>{let{id:n,display:a,description:s}=r,i=!1,o=r.visualisations.map(u=>{let{type:l,display:c,description:h,id:f}=u,d;switch(l){case"list":d=ot.createList(u,e);break;case"scorecard":i=!0,d=dr.createScorecard(u,e);break;case"scorecard-group":d=dr.createScorecards(u,e);break;case"bar":case"line":case"bar-timeseries":case"line-timeseries":case"doughnut":{d=ea.createChart(u,e);break}default:break}return{id:f,title:c,description:h,type:l,data:d}});return i&&dr.mergeScorecardsIntoGroup(o),{id:n,title:a,description:s,visualisations:o}}),Yf=async(t,e,r,n,a,s,i)=>{let o=await t.requestedReportService.getReportByTableId(e,r);return n&&n.length&&o&&vo.updateLastViewed({services:t,reportStateData:o,userId:r,search:a.search,href:a.href,req:s,filters:i}),o},Pf={renderAsyncDashboard:async({req:t,res:e,services:r,next:n})=>{let{token:a,csrfToken:s,userId:i}=z.getValues(e),{reportId:o,id:u,tableId:l}=t.params,c=(0,Lo.default)(t),{query:h,filters:f,reportDefinition:d,dashboardDefinition:m}=await Uf({req:t,res:e,services:r}),w=(await r.dashboardService.getAsyncDashboard(a,u,o,l,h)).flat(),g=qf(m,w),S=await Yf(r,l,i,g,c,t,f.filters);return{dashboardData:{token:a,id:u,reportId:o,name:m.name,description:m.description,reportName:d.name,bookmarked:await r.bookmarkService.isBookmarked(u,o,i),csrfToken:s,sections:g,filters:f,type:"dashboard",actions:Vf(m,d,S)}}}};
/*! Bundled license information:
parseurl/index.js:
(*!
* parseurl
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*)
*/
//# sourceMappingURL=utils.js.map