UNPKG

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

Version:

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

68 lines 169 kB
var eu=Object.create;var Wt=Object.defineProperty;var tu=Object.getOwnPropertyDescriptor;var ru=Object.getOwnPropertyNames;var nu=Object.getPrototypeOf,iu=Object.prototype.hasOwnProperty;var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),au=(e,t)=>{for(var r in t)Wt(e,r,{get:t[r],enumerable:!0})},ii=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ru(t))!iu.call(e,i)&&i!==r&&Wt(e,i,{get:()=>t[i],enumerable:!(n=tu(t,i))||n.enumerable});return e};var ie=(e,t,r)=>(r=e!=null?eu(nu(e)):{},ii(t||!e||!e.__esModule?Wt(r,"default",{value:e,enumerable:!0}):r,e)),su=e=>ii(Wt({},"__esModule",{value:!0}),e);var pt=I(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.excelBOM=pe.defaultCsv2JsonOptions=pe.defaultJson2CsvOptions=pe.errors=void 0;pe.errors={optionsRequired:"Options were not passed and are required.",json2csv:{cannotCallOn:"Cannot call json2csv on",dataCheckFailure:"Data provided was not an array of documents.",notSameSchema:"Not all documents have the same schema."},csv2json:{cannotCallOn:"Cannot call csv2json on",dataCheckFailure:"CSV is not a string."}};pe.defaultJson2CsvOptions={arrayIndexesAsKeys:!1,checkSchemaDifferences:!1,delimiter:{field:",",wrap:'"',eol:`
`},emptyFieldValue:void 0,escapeHeaderNestedDots:!0,excelBOM:!1,excludeKeys:[],expandNestedObjects:!0,expandArrayObjects:!1,prependHeader:!0,preventCsvInjection:!1,sortHeader:!1,trimFieldValues:!1,trimHeaderFields:!1,unwindArrays:!1,useDateIso8601Format:!1,useLocaleFormat:!1,wrapBooleans:!1};pe.defaultCsv2JsonOptions={delimiter:{field:",",wrap:'"',eol:`
`},excelBOM:!1,preventCsvInjection:!1,trimFieldValues:!1,trimHeaderFields:!1};pe.excelBOM="\uFEFF"});var Jt=I(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.setPath=Je.evaluatePath=void 0;function gt(e,t){if(!e)return null;let{dotIndex:r,key:n,remaining:i}=zt(t),a=typeof e=="object"&&t in e?e[t]:void 0,s=typeof e=="object"&&n in e?e[n]:void 0;if(r>=0&&typeof e=="object"&&!(t in e)){let{key:o}=zt(i),u=parseInt(o);return Array.isArray(s)&&isNaN(u)?s.map(l=>gt(l,i)):gt(s,i)}else if(Array.isArray(e)){let o=parseInt(n);return t===n&&r===-1&&!isNaN(o)?s:e.map(u=>gt(u,t))}else{if(r>=0&&t!==n&&typeof e=="object"&&n in e)return gt(s,i);if(r===-1&&typeof e=="object"&&n in e&&!(t in e))return s}return a}Je.evaluatePath=gt;function lu(e,t,r){if(e){if(!t)throw new Error("No keyPath was provided.")}else throw new Error("No object was provided.");return vt(e,t,r)}Je.setPath=lu;function vt(e,t,r){let{dotIndex:n,key:i,remaining:a}=zt(t);if(t.startsWith("__proto__")||t.startsWith("constructor")||t.startsWith("prototype"))return e;if(n>=0){let s=parseInt(i);if(typeof e=="object"&&e!==null&&!(i in e)&&Array.isArray(e)&&!isNaN(s))return e[i]=e[i]??{},vt(e[i],a,r),e;if(typeof e=="object"&&e!==null&&!(i in e)&&Array.isArray(e))return e.forEach(o=>vt(o,t,r)),e;if(typeof e=="object"&&e!==null&&!(i in e)&&!Array.isArray(e)){let{key:o}=zt(a),u=parseInt(o);if(!isNaN(u))e[i]=[];else{if(a==="")return e[t]=r,e;e[i]={}}}vt(e[i],a,r)}else if(Array.isArray(e)){let s=parseInt(i);return t===i&&n===-1&&!isNaN(s)?(e[i]=r,e):(e.forEach(o=>vt(o,a,r)),e)}else e[i]=r;return e}function zt(e){let t=cu(e);return{dotIndex:t,key:e.slice(0,t>=0?t:void 0).replace(/\\./g,"."),remaining:e.slice(t+1)}}function cu(e){for(let t=0;t<e.length;t++){let r=t>0?e[t-1]:"";if(e[t]==="."&&r!=="\\")return t}return-1}});var ai=I(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.isDocumentToRecurOn=Ce.flatten=Ce.unique=void 0;function fu(e){return[...new Set(e)]}Ce.unique=fu;function du(e){return[].concat(...e)}Ce.flatten=du;function hu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length}Ce.isDocumentToRecurOn=hu});var oi=I(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0})});var pi=I(re=>{"use strict";var ui=re&&re.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),mu=re&&re.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),pu=re&&re.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ui(t,e,r);return mu(t,e),t},gu=re&&re.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ui(t,e,r)};Object.defineProperty(re,"__esModule",{value:!0});re.deepKeysFromList=re.deepKeys=void 0;var yt=pu(ai());gu(oi(),re);function li(e,t){let r=mi(t);return typeof e=="object"&&e!==null?fi("",e,r):[]}re.deepKeys=li;function ci(e,t){let r=mi(t);return e.map(n=>typeof n=="object"&&n!==null?li(n,r):[])}re.deepKeysFromList=ci;function fi(e,t,r){let n=Object.keys(t).map(i=>{let a=hi(e,di(i,r));return r.expandNestedObjects&&yt.isDocumentToRecurOn(t[i])||r.arrayIndexesAsKeys&&Array.isArray(t[i])&&t[i].length?fi(a,t[i],r):r.expandArrayObjects&&Array.isArray(t[i])?vu(t[i],a,r):r.ignoreEmptyArrays&&Array.isArray(t[i])&&!t[i].length?[]:a});return yt.flatten(n)}function vu(e,t,r){let n=ci(e,r);return e.length?e.length&&yt.flatten(n).length===0?[t]:(n=n.map(i=>Array.isArray(i)&&i.length===0?[t]:i.map(a=>hi(t,di(a,r)))),yt.unique(yt.flatten(n))):r.ignoreEmptyArraysWhenExpanding?[]:[t]}function di(e,t){return t.escapeNestedDots?e.replace(/\./g,"\\."):e}function hi(e,t){return e?e+"."+t:t}function mi(e){return{arrayIndexesAsKeys:!1,expandNestedObjects:!0,expandArrayObjects:!1,ignoreEmptyArraysWhenExpanding:!1,escapeNestedDots:!1,ignoreEmptyArrays:!1,...e??{}}}});var Xt=I(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.isInvalid=Y.flatten=Y.unique=Y.arrayDifference=Y.isError=Y.isUndefined=Y.isNull=Y.isObject=Y.isString=Y.isNumber=Y.unwind=Y.getNCharacters=Y.removeEmptyFields=Y.isEmptyField=Y.computeSchemaDifferences=Y.isDateRepresentation=Y.isStringRepresentation=Y.deepCopy=Y.validate=Y.buildC2JOptions=Y.buildJ2COptions=void 0;var Tr=Jt(),Me=pt(),yu=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,Cr=1e5;function Su(e){return{...Me.defaultJson2CsvOptions,...e,delimiter:{field:e?.delimiter?.field??Me.defaultJson2CsvOptions.delimiter.field,wrap:e?.delimiter?.wrap||Me.defaultJson2CsvOptions.delimiter.wrap,eol:e?.delimiter?.eol||Me.defaultJson2CsvOptions.delimiter.eol},fieldTitleMap:Object.create({})}}Y.buildJ2COptions=Su;function _u(e){return{...Me.defaultCsv2JsonOptions,...e,delimiter:{field:e?.delimiter?.field??Me.defaultCsv2JsonOptions.delimiter.field,wrap:e?.delimiter?.wrap||Me.defaultCsv2JsonOptions.delimiter.wrap,eol:e?.delimiter?.eol||Me.defaultCsv2JsonOptions.delimiter.eol}}}Y.buildC2JOptions=_u;function bu(e,t,r){if(!e)throw new Error(`${r.cannotCallOn} ${e}.`);if(!t(e))throw new Error(r.dataCheckFailure);return!0}Y.validate=bu;function Mr(e){return JSON.parse(JSON.stringify(e))}Y.deepCopy=Mr;function Du(e,t){let r=e[0],n=e.length-1,i=e[n];return r===t.delimiter.wrap&&i===t.delimiter.wrap}Y.isStringRepresentation=Du;function wu(e){return yu.test(e)}Y.isDateRepresentation=wu;function Eu(e,t){return Fr(e,t).concat(Fr(t,e))}Y.computeSchemaDifferences=Eu;function gi(e){return yi(e)||vi(e)||e===""}Y.isEmptyField=gi;function Au(e){return e.filter(t=>!gi(t))}Y.removeEmptyFields=Au;function Ou(e,t,r){return e.substring(t,t+r)}Y.getNCharacters=Ou;function Ru(e,t,r){let n=(0,Tr.evaluatePath)(t,r),i=Mr(t);Array.isArray(n)&&n.length?n.forEach(a=>{i=Mr(t),e.push((0,Tr.setPath)(i,r,a))}):(Array.isArray(n)&&n.length===0&&(0,Tr.setPath)(i,r,""),e.push(i))}function Lu(e,t){let r=[];return e.forEach(n=>{Ru(r,n,t)}),r}Y.unwind=Lu;function Tu(e){return!isNaN(Number(e))}Y.isNumber=Tu;function Cu(e){return typeof e=="string"}Y.isString=Cu;function Mu(e){return typeof e=="object"}Y.isObject=Mu;function vi(e){return e===null}Y.isNull=vi;function yi(e){return typeof e>"u"}Y.isUndefined=yi;function Fu(e){return Object.prototype.toString.call(e)==="[object Error]"}Y.isError=Fu;function Fr(e,t){return e.filter(r=>!t.includes(r))}Y.arrayDifference=Fr;function xu(e){return[...new Set(e)]}Y.unique=xu;function Nu(e){if(e.flat)return e.flat();if(e.length>Cr){let t=[];for(let r=0;r<e.length;r+=Cr)t=t.concat(...e.slice(r,r+Cr));return t}return e.reduce((t,r)=>t.concat(r),[])}Y.flatten=Nu;function Iu(e){return e===1/0||e===-1/0}Y.isInvalid=Iu});var bi=I(ge=>{"use strict";var ku=ge&&ge.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),$u=ge&&ge.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Pu=ge&&ge.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ku(t,e,r);return $u(t,e),t};Object.defineProperty(ge,"__esModule",{value:!0});ge.Json2Csv=void 0;var Si=Jt(),Yu=pi(),_i=pt(),Fe=Pu(Xt()),ju=function(e){let t=new RegExp(e.delimiter.wrap,"g"),r=/\r?\n|\r/,n=e.parseValue&&typeof e.parseValue=="function"?e.parseValue:null,i=e.expandArrayObjects&&!e.unwindArrays,a={arrayIndexesAsKeys:e.arrayIndexesAsKeys,expandNestedObjects:e.expandNestedObjects,expandArrayObjects:i,ignoreEmptyArraysWhenExpanding:i,escapeNestedDots:!0};function s(c){return(0,Yu.deepKeysFromList)(c,a)}function o(c){return c.length===0?[]:e.checkSchemaDifferences?u(c):Fe.unique(Fe.flatten(c))}function u(c){let _=c[0],y=c.slice(1);if(l(_,y))throw new Error(_i.errors.json2csv.notSameSchema);return _}function l(c,_){return _.reduce((y,v)=>Fe.computeSchemaDifferences(c,v).length>0?y+1:y,0)}function f(c){return e.excludeKeys?c.filter(_=>{for(let y of e.excludeKeys){let v=y instanceof RegExp?y:new RegExp(`^${y}`);if(y===_||_.match(v))return!1}return!0}):c}function g(c){return e.sortHeader&&typeof e.sortHeader=="function"?c.sort(e.sortHeader):e.sortHeader?c.sort():c}function d(c){return e.trimHeaderFields&&(c.headerFields=c.headerFields.map(_=>_.split(".").map(y=>y.trim()).join("."))),c}function h(c){return e.prependHeader&&(c.headerFields=c.headerFields.map(function(_){return V(_)})),c}function m(c){let _=Object.keys(e.fieldTitleMap);return c.header=c.headerFields.map(function(y){let v=y;return _.includes(y)?v=e.fieldTitleMap[y]:e.escapeHeaderNestedDots||(v=v.replace(/\\\./g,".")),v}).join(e.delimiter.field),c}function S(){return e.keys?e.keys.map(c=>typeof c=="object"&&"field"in c?(e.fieldTitleMap[c.field]=c.title??c.field,c.field):c):[]}function R(){return e.keys?e.keys.flatMap(c=>typeof c=="string"?[]:c?.wildcardMatch?c.field:[]):[]}function w(c){let _=R(),y=S(),v=s(c),b=o(v);if(e.keys){e.keys=y;let k=y.flatMap(P=>{if(!_.includes(P))return P;let H=[],ee=new RegExp(`^${P}`);for(let le of b)(P===le||le.match(ee))&&H.push(le);return H});if(!e.unwindArrays){let P=f(k);return g(P)}}let O=f(b);return g(O)}function p(c){for(let _ of c.records)for(let y of c.headerFields){let v=(0,Si.evaluatePath)(_,y);if(Array.isArray(v))return!0}return!1}function L(c,_=!1){if(e.unwindArrays){if(c.headerFields.forEach(y=>{c.records=Fe.unwind(c.records,y)}),c.headerFields=w(c.records),p(c))return L(c,_);if(!_)return L(c,!0);if(e.keys){let y=S();c.headerFields=f(y)}return c}return c}function T(c){return c.recordString=c.records.map(_=>{let y=E(_,c.headerFields),v=y.map(b=>{b=N(b),b=C(b);let O=n?n(b,$):$(b);return O=V(O),O});return F(v)}).join(e.delimiter.eol),c}function M(c){let _=Fe.removeEmptyFields(c);return!c.length||!_.length?e.emptyFieldValue||"":_.length===1?_[0]:c}function E(c,_){let y=[];return _.forEach(v=>{let b=(0,Si.evaluatePath)(c,v);!Fe.isUndefined(e.emptyFieldValue)&&Fe.isEmptyField(b)?b=e.emptyFieldValue:e.expandArrayObjects&&Array.isArray(b)&&(b=M(b)),y.push(b)}),y}function $(c){let _=c instanceof Date;return c===null||Array.isArray(c)||typeof c=="object"&&!_?JSON.stringify(c):typeof c>"u"?"undefined":_&&e.useDateIso8601Format?c.toISOString():e.useLocaleFormat?c.toLocaleString():c.toString()}function N(c){return e.trimFieldValues?Array.isArray(c)?c.map(N):typeof c=="string"?c.trim():c:c}function C(c){return e.preventCsvInjection?Array.isArray(c)?c.map(C):typeof c=="string"&&!Fe.isNumber(c)?c.replace(/^[=+\-@\t\r]+/g,""):c:c}function V(c){let _=e.delimiter.wrap;return c.includes(e.delimiter.wrap)&&(c=c.replace(t,_+_)),(c.includes(e.delimiter.field)||c.includes(e.delimiter.wrap)||c.match(r)||e.wrapBooleans&&(c==="true"||c==="false"))&&(c=_+c+_),c}function F(c){return c.join(e.delimiter.field)}function D(c){let _=c.header,y=c.recordString;return(e.excelBOM?_i.excelBOM:"")+(e.prependHeader?_+e.delimiter.eol:"")+y}function A(c){Array.isArray(c)||(c=[c]);let _={headerFields:w(c),records:c,header:"",recordString:""},y=L(_),v=T(y),b=h(v),O=d(b),k=m(O);return D(k)}return{convert:A}};ge.Json2Csv=ju});var Di=I(ve=>{"use strict";var Vu=ve&&ve.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Uu=ve&&ve.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),qu=ve&&ve.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Vu(t,e,r);return Uu(t,e),t};Object.defineProperty(ve,"__esModule",{value:!0});ve.Csv2Json=void 0;var Hu=Jt(),Bu=pt(),xe=qu(Xt()),Gu=function(e){let t=new RegExp(e.delimiter.wrap+e.delimiter.wrap,"g"),r=new RegExp("^"+Bu.excelBOM),n=e.parseValue&&typeof e.parseValue=="function"?e.parseValue:JSON.parse;function i(p){return p=h(p),e.trimHeaderFields?p.split(".").map(L=>L.trim()).join("."):p}function a(p){let L=[];if(e.headerFields)L=e.headerFields.map((T,M)=>({value:i(T),index:M}));else if(L=p[0].map((M,E)=>({value:i(M),index:E})),e.keys){let M=e.keys;L=L.filter(E=>M.includes(E.value))}return{lines:p,headerFields:L,recordLines:[]}}function s(p){return e.excelBOM?p.replace(r,""):p}function o(p){let L=[],T=p.length-1,M=e.delimiter.eol.length,E={insideWrapDelimiter:!1,parsingValue:!0,justParsedDoubleQuote:!1,startIndex:0},$=[],N,C,V,F,D=0;for(;D<p.length;){if(N=p[D],C=D?p[D-1]:"",V=D<T?p[D+1]:"",F=xe.getNCharacters(p,D,M),(F===e.delimiter.eol&&!E.insideWrapDelimiter||D===T)&&C===e.delimiter.field)F===e.delimiter.eol&&E.startIndex===D||N===e.delimiter.field?$.push(""):$.push(p.substring(E.startIndex)),$.push(""),L.push($),$=[],E.startIndex=D+M,E.parsingValue=!0,E.insideWrapDelimiter=V===e.delimiter.wrap;else if(D===T&&N===e.delimiter.field){let A=p.substring(E.startIndex,D);$.push(A),$.push(""),L.push($)}else if(D===T||F===e.delimiter.eol&&(!E.insideWrapDelimiter||E.insideWrapDelimiter&&C===e.delimiter.wrap&&!E.justParsedDoubleQuote)){let A=D!==T||C===e.delimiter.wrap?D:void 0;$.push(p.substring(E.startIndex,A)),L.push($),$=[],E.startIndex=D+M,E.parsingValue=!0,E.insideWrapDelimiter=V===e.delimiter.wrap}else if(N===e.delimiter.wrap&&C===e.delimiter.field&&!E.insideWrapDelimiter&&!E.parsingValue)E.startIndex=D,E.insideWrapDelimiter=!0,E.parsingValue=!0,xe.getNCharacters(p,D+1,M)===e.delimiter.eol&&(D+=e.delimiter.eol.length+1);else if(C===e.delimiter.field&&N===e.delimiter.wrap&&V===e.delimiter.eol)$.push(p.substring(E.startIndex,D-1)),E.startIndex=D,E.parsingValue=!0,E.insideWrapDelimiter=!0,E.justParsedDoubleQuote=!0,D+=1;else if((C!==e.delimiter.wrap||E.justParsedDoubleQuote&&C===e.delimiter.wrap)&&N===e.delimiter.wrap&&xe.getNCharacters(p,D+1,M)===e.delimiter.eol)E.insideWrapDelimiter=!1,E.parsingValue=!1;else if(N===e.delimiter.wrap&&(D===0||xe.getNCharacters(p,D-M,M)===e.delimiter.eol&&!E.insideWrapDelimiter))E.insideWrapDelimiter=!0,E.parsingValue=!0,E.startIndex=D;else if(N===e.delimiter.wrap&&V===e.delimiter.field&&E.insideWrapDelimiter)$.push(p.substring(E.startIndex,D+1)),E.startIndex=D+2,E.insideWrapDelimiter=!1,E.parsingValue=!1;else if(N===e.delimiter.wrap&&C===e.delimiter.field&&!E.insideWrapDelimiter&&E.parsingValue)$.push(p.substring(E.startIndex,D-1)),E.insideWrapDelimiter=!0,E.parsingValue=!0,E.startIndex=D;else if(N===e.delimiter.wrap&&V===e.delimiter.wrap&&D!==E.startIndex){D+=2,E.justParsedDoubleQuote=!0;continue}else N===e.delimiter.field&&C!==e.delimiter.wrap&&V!==e.delimiter.wrap&&!E.insideWrapDelimiter&&E.parsingValue?($.push(p.substring(E.startIndex,D)),E.startIndex=D+1):N===e.delimiter.field&&C===e.delimiter.wrap&&V!==e.delimiter.wrap&&!E.parsingValue&&(E.insideWrapDelimiter=!1,E.parsingValue=!0,E.startIndex=D+1);D++,E.justParsedDoubleQuote=!1}return L}function u(p){return e.headerFields?p.recordLines=p.lines:p.recordLines=p.lines.splice(1),p}function l(p,L){let T=L[p.index];return f(T)}function f(p){let L=R(p);return!xe.isError(L)&&!xe.isInvalid(L)?L:p==="undefined"?void 0:p}function g(p){return e.trimFieldValues&&p!==null?p.trim():p}function d(p,L){return p.reduce((T,M)=>{let E=l(M,L);try{return(0,Hu.setPath)(T,M.value,E)}catch{return T}},{})}function h(p){let L=p[0],T=p.length-1,M=p[T];return L===e.delimiter.wrap&&M===e.delimiter.wrap?p.length<=2?"":p.substring(1,T):p}function m(p){return p.replace(t,e.delimiter.wrap)}function S(p){return p.recordLines.reduce((L,T)=>{T=T.map(E=>(E=h(E),E=m(E),E=g(E),E));let M=d(p.headerFields,T);return L.concat(M)},[])}function R(p){try{if(xe.isStringRepresentation(p,e)&&!xe.isDateRepresentation(p))return p;let L=n(p);return Array.isArray(L)?L.map(g):L}catch(L){return L}}function w(p){let L=s(p),T=o(L),M=a(T),E=u(M);return S(E)}return{convert:w}};ve.Csv2Json=Gu});var Ei=I(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.csv2json=Qe.json2csv=void 0;var wi=pt(),Wu=bi(),zu=Di(),Xe=Xt();function Ju(e,t){let r=(0,Xe.buildJ2COptions)(t??{});return(0,Xe.validate)(e,Xe.isObject,wi.errors.json2csv),(0,Wu.Json2Csv)(r).convert(e)}Qe.json2csv=Ju;function Xu(e,t){let r=(0,Xe.buildC2JOptions)(t??{});return(0,Xe.validate)(e,Xe.isString,wi.errors.csv2json),(0,zu.Csv2Json)(r).convert(e)}Qe.csv2json=Xu});var Nr=I((Md,xr)=>{"use strict";var Oi=require("url"),Ai=Oi.parse,Qt=Oi.Url;xr.exports=Ri;xr.exports.original=Qu;function Ri(e){var t=e.url;if(t!==void 0){var r=e._parsedUrl;return Ti(t,r)?r:(r=Li(t),r._raw=t,e._parsedUrl=r)}}function Qu(e){var t=e.originalUrl;if(typeof t!="string")return Ri(e);var r=e._parsedOriginalUrl;return Ti(t,r)?r:(r=Li(t),r._raw=t,e._parsedOriginalUrl=r)}function Li(e){if(typeof e!="string"||e.charCodeAt(0)!==47)return Ai(e);for(var t=e,r=null,n=null,i=1;i<e.length;i++)switch(e.charCodeAt(i)){case 63:n===null&&(t=e.substring(0,i),r=e.substring(i+1),n=e.substring(i));break;case 9:case 10:case 12:case 13:case 32:case 35:case 160:case 65279:return Ai(e)}var a=Qt!==void 0?new Qt:{};return a.path=e,a.href=e,a.pathname=t,n!==null&&(a.query=r,a.search=n),a}function Ti(e,t){return typeof t=="object"&&t!==null&&(Qt===void 0||t instanceof Qt)&&t._raw===e}});var bt=I((kr,$r)=>{(function(e,t){typeof kr=="object"&&typeof $r<"u"?$r.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(kr,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",a="minute",s="hour",o="day",u="week",l="month",f="quarter",g="year",d="date",h="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,R={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(D){var A=["th","st","nd","rd"],c=D%100;return"["+D+(A[(c-20)%10]||A[c]||A[0])+"]"}},w=function(D,A,c){var _=String(D);return!_||_.length>=A?D:""+Array(A+1-_.length).join(c)+D},p={s:w,z:function(D){var A=-D.utcOffset(),c=Math.abs(A),_=Math.floor(c/60),y=c%60;return(A<=0?"+":"-")+w(_,2,"0")+":"+w(y,2,"0")},m:function D(A,c){if(A.date()<c.date())return-D(c,A);var _=12*(c.year()-A.year())+(c.month()-A.month()),y=A.clone().add(_,l),v=c-y<0,b=A.clone().add(_+(v?-1:1),l);return+(-(_+(c-y)/(v?y-b:b-y))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:l,y:g,w:u,d:o,D:d,h:s,m:a,s:i,ms:n,Q:f}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},L="en",T={};T[L]=R;var M="$isDayjsObject",E=function(D){return D instanceof V||!(!D||!D[M])},$=function D(A,c,_){var y;if(!A)return L;if(typeof A=="string"){var v=A.toLowerCase();T[v]&&(y=v),c&&(T[v]=c,y=v);var b=A.split("-");if(!y&&b.length>1)return D(b[0])}else{var O=A.name;T[O]=A,y=O}return!_&&y&&(L=y),y||!_&&L},N=function(D,A){if(E(D))return D.clone();var c=typeof A=="object"?A:{};return c.date=D,c.args=arguments,new V(c)},C=p;C.l=$,C.i=E,C.w=function(D,A){return N(D,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var V=function(){function D(c){this.$L=$(c.locale,null,!0),this.parse(c),this.$x=this.$x||c.x||{},this[M]=!0}var A=D.prototype;return A.parse=function(c){this.$d=function(_){var y=_.date,v=_.utc;if(y===null)return new Date(NaN);if(C.u(y))return new Date;if(y instanceof Date)return new Date(y);if(typeof y=="string"&&!/Z$/i.test(y)){var b=y.match(m);if(b){var O=b[2]-1||0,k=(b[7]||"0").substring(0,3);return v?new Date(Date.UTC(b[1],O,b[3]||1,b[4]||0,b[5]||0,b[6]||0,k)):new Date(b[1],O,b[3]||1,b[4]||0,b[5]||0,b[6]||0,k)}}return new Date(y)}(c),this.init()},A.init=function(){var c=this.$d;this.$y=c.getFullYear(),this.$M=c.getMonth(),this.$D=c.getDate(),this.$W=c.getDay(),this.$H=c.getHours(),this.$m=c.getMinutes(),this.$s=c.getSeconds(),this.$ms=c.getMilliseconds()},A.$utils=function(){return C},A.isValid=function(){return this.$d.toString()!==h},A.isSame=function(c,_){var y=N(c);return this.startOf(_)<=y&&y<=this.endOf(_)},A.isAfter=function(c,_){return N(c)<this.startOf(_)},A.isBefore=function(c,_){return this.endOf(_)<N(c)},A.$g=function(c,_,y){return C.u(c)?this[_]:this.set(y,c)},A.unix=function(){return Math.floor(this.valueOf()/1e3)},A.valueOf=function(){return this.$d.getTime()},A.startOf=function(c,_){var y=this,v=!!C.u(_)||_,b=C.p(c),O=function(he,J){var ce=C.w(y.$u?Date.UTC(y.$y,J,he):new Date(y.$y,J,he),y);return v?ce:ce.endOf(o)},k=function(he,J){return C.w(y.toDate()[he].apply(y.toDate("s"),(v?[0,0,0,0]:[23,59,59,999]).slice(J)),y)},P=this.$W,H=this.$M,ee=this.$D,le="set"+(this.$u?"UTC":"");switch(b){case g:return v?O(1,0):O(31,11);case l:return v?O(1,H):O(0,H+1);case u:var be=this.$locale().weekStart||0,Ye=(P<be?P+7:P)-be;return O(v?ee-Ye:ee+(6-Ye),H);case o:case d:return k(le+"Hours",0);case s:return k(le+"Minutes",1);case a:return k(le+"Seconds",2);case i:return k(le+"Milliseconds",3);default:return this.clone()}},A.endOf=function(c){return this.startOf(c,!1)},A.$set=function(c,_){var y,v=C.p(c),b="set"+(this.$u?"UTC":""),O=(y={},y[o]=b+"Date",y[d]=b+"Date",y[l]=b+"Month",y[g]=b+"FullYear",y[s]=b+"Hours",y[a]=b+"Minutes",y[i]=b+"Seconds",y[n]=b+"Milliseconds",y)[v],k=v===o?this.$D+(_-this.$W):_;if(v===l||v===g){var P=this.clone().set(d,1);P.$d[O](k),P.init(),this.$d=P.set(d,Math.min(this.$D,P.daysInMonth())).$d}else O&&this.$d[O](k);return this.init(),this},A.set=function(c,_){return this.clone().$set(c,_)},A.get=function(c){return this[C.p(c)]()},A.add=function(c,_){var y,v=this;c=Number(c);var b=C.p(_),O=function(H){var ee=N(v);return C.w(ee.date(ee.date()+Math.round(H*c)),v)};if(b===l)return this.set(l,this.$M+c);if(b===g)return this.set(g,this.$y+c);if(b===o)return O(1);if(b===u)return O(7);var k=(y={},y[a]=t,y[s]=r,y[i]=e,y)[b]||1,P=this.$d.getTime()+c*k;return C.w(P,this)},A.subtract=function(c,_){return this.add(-1*c,_)},A.format=function(c){var _=this,y=this.$locale();if(!this.isValid())return y.invalidDate||h;var v=c||"YYYY-MM-DDTHH:mm:ssZ",b=C.z(this),O=this.$H,k=this.$m,P=this.$M,H=y.weekdays,ee=y.months,le=y.meridiem,be=function(J,ce,De,Te){return J&&(J[ce]||J(_,v))||De[ce].slice(0,Te)},Ye=function(J){return C.s(O%12||12,J,"0")},he=le||function(J,ce,De){var Te=J<12?"AM":"PM";return De?Te.toLowerCase():Te};return v.replace(S,function(J,ce){return ce||function(De){switch(De){case"YY":return String(_.$y).slice(-2);case"YYYY":return C.s(_.$y,4,"0");case"M":return P+1;case"MM":return C.s(P+1,2,"0");case"MMM":return be(y.monthsShort,P,ee,3);case"MMMM":return be(ee,P);case"D":return _.$D;case"DD":return C.s(_.$D,2,"0");case"d":return String(_.$W);case"dd":return be(y.weekdaysMin,_.$W,H,2);case"ddd":return be(y.weekdaysShort,_.$W,H,3);case"dddd":return H[_.$W];case"H":return String(O);case"HH":return C.s(O,2,"0");case"h":return Ye(1);case"hh":return Ye(2);case"a":return he(O,k,!0);case"A":return he(O,k,!1);case"m":return String(k);case"mm":return C.s(k,2,"0");case"s":return String(_.$s);case"ss":return C.s(_.$s,2,"0");case"SSS":return C.s(_.$ms,3,"0");case"Z":return b}return null}(J)||b.replace(":","")})},A.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},A.diff=function(c,_,y){var v,b=this,O=C.p(_),k=N(c),P=(k.utcOffset()-this.utcOffset())*t,H=this-k,ee=function(){return C.m(b,k)};switch(O){case g:v=ee()/12;break;case l:v=ee();break;case f:v=ee()/3;break;case u:v=(H-P)/6048e5;break;case o:v=(H-P)/864e5;break;case s:v=H/r;break;case a:v=H/t;break;case i:v=H/e;break;default:v=H}return y?v:C.a(v)},A.daysInMonth=function(){return this.endOf(l).$D},A.$locale=function(){return T[this.$L]},A.locale=function(c,_){if(!c)return this.$L;var y=this.clone(),v=$(c,_,!0);return v&&(y.$L=v),y},A.clone=function(){return C.w(this.$d,this)},A.toDate=function(){return new Date(this.valueOf())},A.toJSON=function(){return this.isValid()?this.toISOString():null},A.toISOString=function(){return this.$d.toISOString()},A.toString=function(){return this.$d.toUTCString()},D}(),F=V.prototype;return N.prototype=F,[["$ms",n],["$s",i],["$m",a],["$H",s],["$W",o],["$M",l],["$y",g],["$D",d]].forEach(function(D){F[D[1]]=function(A){return this.$g(A,D[0],D[1])}}),N.extend=function(D,A){return D.$i||(D(A,V,N),D.$i=!0),N},N.locale=$,N.isDayjs=E,N.unix=function(D){return N(1e3*D)},N.en=T[L],N.Ls=T,N.p={},N})});var Dt=I((Pr,Yr)=>{(function(e,t){typeof Pr=="object"&&typeof Yr<"u"?Yr.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_customParseFormat=t()})(Pr,function(){"use strict";var e={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"},t=/(\[[^[]*\])|([-_:/.,()\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/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,s={},o=function(m){return(m=+m)+(m>68?1900:2e3)},u=function(m){return function(S){this[m]=+S}},l=[/[+-]\d\d:?(\d\d)?|Z/,function(m){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var R=S.match(/([+-]|\d\d)/g),w=60*R[1]+(+R[2]||0);return w===0?0:R[0]==="+"?-w:w}(m)}],f=function(m){var S=s[m];return S&&(S.indexOf?S:S.s.concat(S.f))},g=function(m,S){var R,w=s.meridiem;if(w){for(var p=1;p<=24;p+=1)if(m.indexOf(w(p,0,S))>-1){R=p>12;break}}else R=m===(S?"pm":"PM");return R},d={A:[a,function(m){this.afternoon=g(m,!1)}],a:[a,function(m){this.afternoon=g(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:[i,u("seconds")],ss:[i,u("seconds")],m:[i,u("minutes")],mm:[i,u("minutes")],H:[i,u("hours")],h:[i,u("hours")],HH:[i,u("hours")],hh:[i,u("hours")],D:[i,u("day")],DD:[n,u("day")],Do:[a,function(m){var S=s.ordinal,R=m.match(/\d+/);if(this.day=R[0],S)for(var w=1;w<=31;w+=1)S(w).replace(/\[|\]/g,"")===m&&(this.day=w)}],w:[i,u("week")],ww:[n,u("week")],M:[i,u("month")],MM:[n,u("month")],MMM:[a,function(m){var S=f("months"),R=(f("monthsShort")||S.map(function(w){return w.slice(0,3)})).indexOf(m)+1;if(R<1)throw new Error;this.month=R%12||R}],MMMM:[a,function(m){var S=f("months").indexOf(m)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,u("year")],YY:[n,function(m){this.year=o(m)}],YYYY:[/\d{4}/,u("year")],Z:l,ZZ:l};function h(m){var S,R;S=m,R=s&&s.formats;for(var w=(m=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(N,C,V){var F=V&&V.toUpperCase();return C||R[V]||e[V]||R[F].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(D,A,c){return A||c.slice(1)})})).match(t),p=w.length,L=0;L<p;L+=1){var T=w[L],M=d[T],E=M&&M[0],$=M&&M[1];w[L]=$?{regex:E,parser:$}:T.replace(/^\[|\]$/g,"")}return function(N){for(var C={},V=0,F=0;V<p;V+=1){var D=w[V];if(typeof D=="string")F+=D.length;else{var A=D.regex,c=D.parser,_=N.slice(F),y=A.exec(_)[0];c.call(C,y),N=N.replace(y,"")}}return function(v){var b=v.afternoon;if(b!==void 0){var O=v.hours;b?O<12&&(v.hours+=12):O===12&&(v.hours=0),delete v.afternoon}}(C),C}}return function(m,S,R){R.p.customParseFormat=!0,m&&m.parseTwoDigitYear&&(o=m.parseTwoDigitYear);var w=S.prototype,p=w.parse;w.parse=function(L){var T=L.date,M=L.utc,E=L.args;this.$u=M;var $=E[1];if(typeof $=="string"){var N=E[2]===!0,C=E[3]===!0,V=N||C,F=E[2];C&&(F=E[2]),s=this.$locale(),!N&&F&&(s=R.Ls[F]),this.$d=function(_,y,v,b){try{if(["x","X"].indexOf(y)>-1)return new Date((y==="X"?1e3:1)*_);var O=h(y)(_),k=O.year,P=O.month,H=O.day,ee=O.hours,le=O.minutes,be=O.seconds,Ye=O.milliseconds,he=O.zone,J=O.week,ce=new Date,De=H||(k||P?1:ce.getDate()),Te=k||ce.getFullYear(),Bt=0;k&&!P||(Bt=P>0?P-1:ce.getMonth());var Gt,Ar=ee||0,Or=le||0,Rr=be||0,Lr=Ye||0;return he?new Date(Date.UTC(Te,Bt,De,Ar,Or,Rr,Lr+60*he.offset*1e3)):v?new Date(Date.UTC(Te,Bt,De,Ar,Or,Rr,Lr)):(Gt=new Date(Te,Bt,De,Ar,Or,Rr,Lr),J&&(Gt=b(Gt).week(J).toDate()),Gt)}catch{return new Date("")}}(T,$,M,R),this.init(),F&&F!==!0&&(this.$L=this.locale(F).$L),V&&T!=this.format($)&&(this.$d=new Date("")),s={}}else if($ instanceof Array)for(var D=$.length,A=1;A<=D;A+=1){E[1]=$[A-1];var c=R.apply(this,E);if(c.isValid()){this.$d=c.$d,this.$L=c.$L,this.init();break}A===D&&(this.$d=new Date(""))}else p.call(this,L)}}})});var $i=I((jr,Vr)=>{(function(e,t){typeof jr=="object"&&typeof Vr<"u"?Vr.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_isBetween=t()})(jr,function(){"use strict";return function(e,t,r){t.prototype.isBetween=function(n,i,a,s){var o=r(n),u=r(i),l=(s=s||"()")[0]==="(",f=s[1]===")";return(l?this.isAfter(o,a):!this.isBefore(o,a))&&(f?this.isBefore(u,a):!this.isAfter(u,a))||(l?this.isBefore(o,a):!this.isAfter(o,a))&&(f?this.isAfter(u,a):!this.isBefore(u,a))}}})});var sa=I((Lh,Xr)=>{var zl=Object.prototype.hasOwnProperty;function ia(e){return"[Throws: "+(e?e.message:"?")+"]"}function Jl(e,t){if(zl.call(e,t))try{return e[t]}catch(r){return ia(r)}return e[t]}function aa(e){var t=[];function r(n){if(n===null||typeof n!="object")return n;if(t.indexOf(n)!==-1)return"[Circular]";if(t.push(n),typeof n.toJSON=="function")try{var i=r(n.toJSON());return t.pop(),i}catch(o){return ia(o)}if(Array.isArray(n)){var a=n.map(r);return t.pop(),a}var s=Object.keys(n).reduce(function(o,u){return o[u]=r(Jl(n,u)),o},{});return t.pop(),s}return r(e)}Xr.exports=function(e,t,r){return JSON.stringify(aa(e),t,r)};Xr.exports.ensureProperties=aa});var ua=I((Th,oa)=>{var ne=require("fs"),At=require("path");oa.exports=tr;tr.ncp=tr;function tr(e,t,r,n){var i=n;n||(i=r,r={});var a=process.cwd(),s=At.resolve(a,e),o=At.resolve(a,t),u=r.filter,l=r.rename,f=r.transform,g=r.clobber!==!1,d=r.modified,h=r.dereference,m=null,S=0,R=0,w=0,p=r.limit||tr.limit||16;p=p<1?1:p>512?512:p,L(s);function L(v){if(S++,u){if(u instanceof RegExp){if(!u.test(v))return y(!0)}else if(typeof u=="function"&&!u(v))return y(!0)}return T(v)}function T(v){var b=h?ne.stat:ne.lstat;if(w>=p)return setImmediate(function(){T(v)});w++,b(v,function(O,k){var P={};if(O)return _(O);if(P.name=v,P.mode=k.mode,P.mtime=k.mtime,P.atime=k.atime,k.isDirectory())return N(P);if(k.isFile())return M(P);if(k.isSymbolicLink())return F(v)})}function M(v){var b=v.name.replace(s,o);l&&(b=l(b)),c(b,function(O){if(O)return E(v,b);if(g&&$(b,function(){E(v,b)}),d){var k=h?ne.stat:ne.lstat;k(b,function(P,H){if(v.mtime.getTime()>H.mtime.getTime())E(v,b);else return y()})}else return y()})}function E(v,b){var O=ne.createReadStream(v.name),k=ne.createWriteStream(b,{mode:v.mode});O.on("error",_),k.on("error",_),f?f(O,k,v):k.on("open",function(){O.pipe(k)}),k.once("finish",function(){d&&ne.utimesSync(b,v.atime,v.mtime),y()})}function $(v,b){ne.unlink(v,function(O){return O?_(O):b()})}function N(v){var b=v.name.replace(s,o);c(b,function(O){if(O)return C(v,b);V(v.name)})}function C(v,b){ne.mkdir(b,v.mode,function(O){if(O)return _(O);V(v.name)})}function V(v){ne.readdir(v,function(b,O){return b?_(b):(O.forEach(function(k){L(At.join(v,k))}),y())})}function F(v){var b=v.replace(s,o);ne.readlink(v,function(O,k){if(O)return _(O);D(k,b)})}function D(v,b){h&&(v=At.resolve(a,v)),c(b,function(O){if(O)return A(v,b);ne.readlink(b,function(k,P){return k?_(k):(h&&(P=At.resolve(a,P)),P===v?y():$(b,function(){A(v,b)}))})})}function A(v,b){ne.symlink(v,b,function(O){return O?_(O):y()})}function c(v,b){ne.lstat(v,function(O){return O&&O.code==="ENOENT"?b(!0):b(!1)})}function _(v){return r.stopOnError?i(v):(!m&&r.errs?m=ne.createWriteStream(r.errs):m||(m=[]),typeof m.write>"u"?m.push(v):m.write(v.stack+`

`),y())}function y(v){if(v||w--,R++,S===R&&w===0&&i!==void 0)return i(m||null)}}});var ca=I((Ch,la)=>{la.exports=function(e,t){for(var r=[],n=0;n<e.length;n++){var i=t(e[n],n);Xl(i)?r.push.apply(r,i):r.push(i)}return r};var Xl=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}});var pa=I((Mh,ma)=>{"use strict";ma.exports=da;function da(e,t,r){e instanceof RegExp&&(e=fa(e,r)),t instanceof RegExp&&(t=fa(t,r));var n=ha(e,t,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+e.length,n[1]),post:r.slice(n[1]+t.length)}}function fa(e,t){var r=t.match(e);return r?r[0]:null}da.range=ha;function ha(e,t,r){var n,i,a,s,o,u=r.indexOf(e),l=r.indexOf(t,u+1),f=u;if(u>=0&&l>0){if(e===t)return[u,l];for(n=[],a=r.length;f>=0&&!o;)f==u?(n.push(f),u=r.indexOf(e,f+1)):n.length==1?o=[n.pop(),l]:(i=n.pop(),i<a&&(a=i,s=l),l=r.indexOf(t,f+1)),f=u<l&&u>=0?u:l;n.length&&(o=[a,s])}return o}});var wa=I((Fh,Da)=>{var Ql=ca(),ga=pa();Da.exports=ec;var va="\0SLASH"+Math.random()+"\0",ya="\0OPEN"+Math.random()+"\0",Kr="\0CLOSE"+Math.random()+"\0",Sa="\0COMMA"+Math.random()+"\0",_a="\0PERIOD"+Math.random()+"\0";function Qr(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function Kl(e){return e.split("\\\\").join(va).split("\\{").join(ya).split("\\}").join(Kr).split("\\,").join(Sa).split("\\.").join(_a)}function Zl(e){return e.split(va).join("\\").split(ya).join("{").split(Kr).join("}").split(Sa).join(",").split(_a).join(".")}function ba(e){if(!e)return[""];var t=[],r=ga("{","}",e);if(!r)return e.split(",");var n=r.pre,i=r.body,a=r.post,s=n.split(",");s[s.length-1]+="{"+i+"}";var o=ba(a);return a.length&&(s[s.length-1]+=o.shift(),s.push.apply(s,o)),t.push.apply(t,s),t}function ec(e){return e?(e.substr(0,2)==="{}"&&(e="\\{\\}"+e.substr(2)),et(Kl(e),!0).map(Zl)):[]}function tc(e){return"{"+e+"}"}function rc(e){return/^-?0\d/.test(e)}function nc(e,t){return e<=t}function ic(e,t){return e>=t}function et(e,t){var r=[],n=ga("{","}",e);if(!n||/\$$/.test(n.pre))return[e];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),s=i||a,o=n.body.indexOf(",")>=0;if(!s&&!o)return n.post.match(/,.*\}/)?(e=n.pre+"{"+n.body+Kr+n.post,et(e)):[e];var u;if(s)u=n.body.split(/\.\./);else if(u=ba(n.body),u.length===1&&(u=et(u[0],!1).map(tc),u.length===1)){var f=n.post.length?et(n.post,!1):[""];return f.map(function(F){return n.pre+u[0]+F})}var l=n.pre,f=n.post.length?et(n.post,!1):[""],g;if(s){var d=Qr(u[0]),h=Qr(u[1]),m=Math.max(u[0].length,u[1].length),S=u.length==3?Math.abs(Qr(u[2])):1,R=nc,w=h<d;w&&(S*=-1,R=ic);var p=u.some(rc);g=[];for(var L=d;R(L,h);L+=S){var T;if(a)T=String.fromCharCode(L),T==="\\"&&(T="");else if(T=String(L),p){var M=m-T.length;if(M>0){var E=new Array(M+1).join("0");L<0?T="-"+E+T.slice(1):T=E+T}}g.push(T)}}else g=Ql(u,function(V){return et(V,!1)});for(var $=0;$<g.length;$++)for(var N=0;N<f.length;N++){var C=l+g[$]+f[N];(!t||s||C)&&r.push(C)}return r}});var ir=I((xh,La)=>{La.exports=se;se.Minimatch=X;var Ot=function(){try{return require("path")}catch{}}()||{sep:"/"};se.sep=Ot.sep;var tn=se.GLOBSTAR=X.GLOBSTAR={},ac=wa(),Ea={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},Zr="[^/]",en=Zr+"*?",sc="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",oc="(?:(?!(?:\\/|^)\\.).)*?",Aa=uc("().*{}+?[]^$\\!");function uc(e){return e.split("").reduce(function(t,r){return t[r]=!0,t},{})}var Oa=/\/+/;se.filter=lc;function lc(e,t){return t=t||{},function(r,n,i){return se(r,e,t)}}function Ne(e,t){t=t||{};var r={};return Object.keys(e).forEach(function(n){r[n]=e[n]}),Object.keys(t).forEach(function(n){r[n]=t[n]}),r}se.defaults=function(e){if(!e||typeof e!="object"||!Object.keys(e).length)return se;var t=se,r=function(i,a,s){return t(i,a,Ne(e,s))};return r.Minimatch=function(i,a){return new t.Minimatch(i,Ne(e,a))},r.Minimatch.defaults=function(i){return t.defaults(Ne(e,i)).Minimatch},r.filter=function(i,a){return t.filter(i,Ne(e,a))},r.defaults=function(i){return t.defaults(Ne(e,i))},r.makeRe=function(i,a){return t.makeRe(i,Ne(e,a))},r.braceExpand=function(i,a){return t.braceExpand(i,Ne(e,a))},r.match=function(n,i,a){return t.match(n,i,Ne(e,a))},r};X.defaults=function(e){return se.defaults(e).Minimatch};function se(e,t,r){return nr(t),r||(r={}),!r.nocomment&&t.charAt(0)==="#"?!1:new X(t,r).match(e)}function X(e,t){if(!(this instanceof X))return new X(e,t);nr(e),t||(t={}),e=e.trim(),!t.allowWindowsEscape&&Ot.sep!=="/"&&(e=e.split(Ot.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}X.prototype.debug=function(){};X.prototype.make=cc;function cc(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,r),r=this.globParts=r.map(function(n){return n.split(Oa)}),this.debug(this.pattern,r),r=r.map(function(n,i,a){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}X.prototype.parseNegate=fc;function fc(){var e=this.pattern,t=!1,r=this.options,n=0;if(!r.nonegate){for(var i=0,a=e.length;i<a&&e.charAt(i)==="!";i++)t=!t,n++;n&&(this.pattern=e.substr(n)),this.negate=t}}se.braceExpand=function(e,t){return Ra(e,t)};X.prototype.braceExpand=Ra;function Ra(e,t){return t||(this instanceof X?t=this.options:t={}),e=typeof e>"u"?this.pattern:e,nr(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ac(e)}var dc=1024*64,nr=function(e){if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>dc)throw new TypeError("pattern is too long")};X.prototype.parse=hc;var rr={};function hc(e,t){nr(e);var r=this.options;if(e==="**")if(r.noglobstar)e="*";else return tn;if(e==="")return"";var n="",i=!!r.nocase,a=!1,s=[],o=[],u,l=!1,f=-1,g=-1,d=e.charAt(0)==="."?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",h=this;function m(){if(u){switch(u){case"*":n+=en,i=!0;break;case"?":n+=Zr,i=!0;break;default:n+="\\"+u;break}h.debug("clearStateChar %j %j",u,n),u=!1}}for(var S=0,R=e.length,w;S<R&&(w=e.charAt(S));S++){if(this.debug("%s	%s %s %j",e,S,n,w),a&&Aa[w]){n+="\\"+w,a=!1;continue}switch(w){case"/":return!1;case"\\":m(),a=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s	%s %s %j <-- stateChar",e,S,n,w),l){this.debug("  in class"),w==="!"&&S===g+1&&(w="^"),n+=w;continue}h.debug("call clearStateChar %j",u),m(),u=w,r.noext&&m();continue;case"(":if(l){n+="(";continue}if(!u){n+="\\(";continue}s.push({type:u,start:S-1,reStart:n.length,open:Ea[u].open,close:Ea[u].close}),n+=u==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",u,n),u=!1;continue;case")":if(l||!s.length){n+="\\)";continue}m(),i=!0;var p=s.pop();n+=p.close,p.type==="!"&&o.push(p),p.reEnd=n.length;continue;case"|":if(l||!s.length||a){n+="\\|",a=!1;continue}m(),n+="|";continue;case"[":if(m(),l){n+="\\"+w;continue}l=!0,g=S,f=n.length,n+=w;continue;case"]":if(S===g+1||!l){n+="\\"+w,a=!1;continue}var L=e.substring(g+1,S);try{RegExp("["+L+"]")}catch{var T=this.parse(L,rr);n=n.substr(0,f)+"\\["+T[0]+"\\]",i=i||T[1],l=!1;continue}i=!0,l=!1,n+=w;continue;default:m(),a?a=!1:Aa[w]&&!(w==="^"&&l)&&(n+="\\"),n+=w}}for(l&&(L=e.substr(g+1),T=this.parse(L,rr),n=n.substr(0,f)+"\\["+T[0],i=i||T[1]),p=s.pop();p;p=s.pop()){var M=n.slice(p.reStart+p.open.length);this.debug("setting tail",n,p),M=M.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(k,P,H){return H||(H="\\"),P+P+H+"|"}),this.debug(`tail=%j
   %s`,M,M,p,n);var E=p.type==="*"?en:p.type==="?"?Zr:"\\"+p.type;i=!0,n=n.slice(0,p.reStart)+E+"\\("+M}m(),a&&(n+="\\\\");var $=!1;switch(n.charAt(0)){case"[":case".":case"(":$=!0}for(var N=o.length-1;N>-1;N--){var C=o[N],V=n.slice(0,C.reStart),F=n.slice(C.reStart,C.reEnd-8),D=n.slice(C.reEnd-8,C.reEnd),A=n.slice(C.reEnd);D+=A;var c=V.split("(").length-1,_=A;for(S=0;S<c;S++)_=_.replace(/\)[+*?]?/,"");A=_;var y="";A===""&&t!==rr&&(y="$");var v=V+F+A+y+D;n=v}if(n!==""&&i&&(n="(?=.)"+n),$&&(n=d+n),t===rr)return[n,i];if(!i)return pc(e);var b=r.nocase?"i":"";try{var O=new RegExp("^"+n+"$",b)}catch{return new RegExp("$.")}return O._glob=e,O._src=n,O}se.makeRe=function(e,t){return new X(e,t||{}).makeRe()};X.prototype.makeRe=mc;function mc(){if(this.regexp||this.regexp===!1)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,r=t.noglobstar?en:t.dot?sc:oc,n=t.nocase?"i":"",i=e.map(function(a){return a.map(function(s){return s===tn?r:typeof s=="string"?gc(s):s._src}).join("\\/")}).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,n)}catch{this.regexp=!1}return this.regexp}se.match=function(e,t,r){r=r||{};var n=new X(t,r);return e=e.filter(function(i){return n.match(i)}),n.options.nonull&&!e.length&&e.push(t),e};X.prototype.match=function(t,r){if(typeof r>"u"&&(r=this.partial),this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;var n=this.options;Ot.sep!=="/"&&(t=t.split(Ot.sep).join("/")),t=t.split(Oa),this.debug(this.pattern,"split",t);var i=this.set;this.debug(this.pattern,"set",i);var a,s;for(s=t.length-1;s>=0&&(a=t[s],!a);s--);for(s=0;s<i.length;s++){var o=i[s],u=t;n.matchBase&&o.length===1&&(u=[a]);var l=this.matchOne(u,o,r);if(l)return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate};X.prototype.matchOne=function(e,t,r){var n=this.options;this.debug("matchOne",{this:this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var i=0,a=0,s=e.length,o=t.length;i<s&&a<o;i++,a++){this.debug("matchOne loop");var u=t[a],l=e[i];if(this.debug(t,u,l),u===!1)return!1;if(u===tn){this.debug("GLOBSTAR",[t,u,l]);var f=i,g=a+1;if(g===o){for(this.debug("** at the end");i<s;i++)if(e[i]==="."||e[i]===".."||!n.dot&&e[i].charAt(0)===".")return!1;return!0}for(;f<s;){var d=e[f];if(this.debug(`
globstar while`,e,f,t,g,d),this.matchOne(e.slice(f),t.slice(g),r))return this.debug("globstar found match!",f,s,d),!0;if(d==="."||d===".."||!n.dot&&d.charAt(0)==="."){this.debug("dot detected!",e,f,t,g);break}this.debug("globstar swallow a segment, and continue"),f++}return!!(r&&(this.debug(`
>>> no match, partial?`,e,f,t,g),f===s))}var h;if(typeof u=="string"?(h=l===u,this.debug("string match",u,l,h)):(h=l.match(u),this.debug("pattern match",u,l,h)),!h)return!1}if(i===s&&a===o)return!0;if(i===s)return r;if(a===o)return i===s-1&&e[i]==="";throw new Error("wtf?")};function pc(e){return e.replace(/\\(.)/g,"$1")}function gc(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var Ta=I((Nh,rn)=>{typeof Object.create=="function"?rn.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:rn.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}});var Ca=I((Ih,an)=>{try{if(nn=require("util"),typeof nn.inherits!="function")throw"";an.exports=nn.inherits}catch{an.exports=Ta()}var nn});var sr=I((kh,ar)=>{"use strict";function Ma(e){return e.charAt(0)==="/"}function Fa(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,r=t.exec(e),n=r[1]||"",i=!!(n&&n.charAt(1)!==":");return!!(r[2]||i)}ar.exports=process.platform==="win32"?Fa:Ma;ar.exports.posix=Ma;ar.exports.win32=Fa});var un=I(Se=>{Se.alphasort=Ia;Se.alphasorti=Na;Se.setopts=bc;Se.ownProp=xa;Se.makeAbs=on;Se.finish=Dc;Se.mark=wc;Se.isIgnored=ka;Se.childrenIgnored=Ec;function xa(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var tt=require("path"),vc=ir(),yc=sr(),sn=vc.Minimatch;function Na(e,t){return e.toLowerCase().localeCompare(t.toLowerCase())}function Ia(e,t){return e.localeCompare(t)}function Sc(e,t){e.ignore=t.ignore||[],Array.isArray(e.ignore)||(e.ignore=[e.ignore]),e.ignore.length&&(e.ignore=e.ignore.map(_c))}function _c(e){var t=null;if(e.slice(-3)==="/**"){var r=e.replace(/(\/\*\*)+$/,"");t=new sn(r,{dot:!0})}return{matcher:new sn(e,{dot:!0}),gmatcher:t}}function bc(e,t,r){if(r||(r={}),r.matchBase&&t.indexOf("/")===-1){if(r.noglobstar)throw new Error("base matching requires globstar");t="**/"+t}e.silent=!!r.silent,e.pattern=t,e.strict=r.strict!==!1,e.realpath=!!r.realpath,e.realpathCache=r.realpathCache||Object.create(null),e.follow=!!r.follow,e.dot=!!r.dot,e.mark=!!r.mark,e.nodir=!!r.nodir,e.nodir&&(e.mark=!0),e.sync=!!r.sync,e.nounique=!!r.nounique,e.nonull=!!r.nonull,e.nosort=!!r.nosort,e.nocase=!!r.nocase,e.stat=!!r.stat,e.noprocess=!!r.noprocess,e.maxLength=r.maxLength||1/0,e.cache=r.cache||Object.create(null),e.statCache=r.statCache||Object.create(null),e.symlinks=r.symlinks||Object.create(null),Sc(e,r),e.changedCwd=!1;var n=process.cwd();xa(r,"cwd")?(e.cwd=r.cwd,e.changedCwd=tt.resolve(r.cwd)!==n):e.cwd=n,e.root=r.root||tt.resolve(e.cwd,"/"),e.root=tt.resolve(e.root),process.platform==="win32"&&(e.root=e.root.replace(/\\/g,"/")),e.nomount=!!r.nomount,r.nonegate=!0,r.nocomment=!0,e.minimatch=new sn(t,r),e.options=e.minimatch.options}function Dc(e){for(var t=e.nounique,r=t?[]:Object.create(null),n=0,i=e.matches.length;n<i;n++){var a=e.matches[n];if(!a||Object.keys(a).length===0){if(e.nonull){var s=e.minimatch.globSet[n];t?r.push(s):r[s]=!0}}else{var o=Object.keys(a);t?r.push.apply(r,o):o.forEach(function(u){r[u]=!0})}}if(t||(r=Object.keys(r)),e.nosort||(r=r.sort(e.nocase?Na:Ia)),e.mark){for(var n=0;n<r.length;n++)r[n]=e._mark(r[n]);e.nodir&&(r=r.filter(function(u){return!/\/$/.test(u)}))}e.ignore.length&&(r=r.filter(function(u){return!ka(e,u)})),e.found=r}function wc(e,t){var r=on(e,t),n=e.cache[r],i=t;if(n){var a=n==="DIR"||Array.isArray(n),s=t.slice(-1)==="/";if(a&&!s?i+="/":!a&&s&&(i=i.slice(0,-1)),i!==t){var o=on(e,i);e.statCache[o]=e.statCache[r],e.cache[o]=e.cache[r]}}return i}function on(e,t){var r=t;return t.charAt(0)==="/"?r=tt.join(e.root,t):yc(t)||t===""?r=t:e.changedCwd?r=tt.resolve(e.cwd,t):r=tt.resolve(t),r}function ka(e,t){return e.ignore.length?e.ignore.some(function(r){return r.matcher.match(t)||!!(r.gmatcher&&r.gmatcher.match(t))}):!1}function Ec(e,t){return e.ignore.length?e.ignore.some(function(r){return!!(r.gmatcher&&r.gmatcher.match(t))}):!1}});var Va=I((qh,ja)=>{ja.exports=Ya;Ya.GlobSync=z;var Rt=require("fs"),$a=ir(),Ph=$a.Minimatch,Yh=fn().Glob,jh=require("util"),ln=require("path"),Pa=require("assert"),or=sr(),Ie=un(),Vh=Ie.alphasort,Uh=Ie.alphasorti,Ac=Ie.setopts,cn=Ie.ownProp,Oc=Ie.childrenIgnored;function Ya(e,t){if(typeof t=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);return new z(e,t).found}function z(e,t){if(!e)throw new Error("must provide pattern");if(typeof t=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof z))return new z(e,t);if(Ac(this,e,t),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()}z.prototype._finish=function(){if(Pa(this instanceof z),this.realpath){var e=this;this.matches.forEach(function(t,r){var n=e.matches[r]=Object.create(null);for(var i in t)try{i=e._makeAbs(i);var a=Rt.realpathSync(i,e.realpathCache);n[a]=!0}catch(s){if(s.syscall==="stat")n[e._makeAbs(i)]=!0;else throw s}})}Ie.finish(this)};z.prototype._process=function(e,t,r){Pa(this instanceof z);for(var n=0;typeof e[n]=="string";)n++;var i;switch(n){case e.length:this._processSimple(e.join("/"),t);return;case 0:i=null;break;default:i=e.slice(0,n).join("/");break}var a=e.slice(n),s;i===null?s=".":((or(i)||or(e.join("/")))&&(!i||!or(i))&&(i="/"+i),s=i);var o=this._makeAbs(s);if(!Oc(this,s)){var u=a[0]===$a.GLOBSTAR;u?this._processGlobStar(i,s,o,a,t,r):this._processReaddir(i,s,o,a,t,r)}};z.prototype._processReaddir=function(e,t,r,n,i,a){var s=this._readdir(r,a);if(s){for(var o=n[0],u=!!this.minimatch.negate,l=o._glob,f=this.dot||l.charAt(0)===".",g=[],d=0;d<s.length;d++){var h=s[d];if(h.charAt(0)!=="."||f){var m;u&&!e?m=!h.match(o):m=h.match(o),m&&g.push(h)}}var S=g.length;if(S!==0){if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var d=0;d<S;d++){var h=g[d];e&&(e.slice(-1)!=="/"?h=e+"/"+h:h=e+h),h.charAt(0)==="/"&&!this.nomount&&(h=ln.join(this.root,h)),this.matches[i][h]=!0}return}n.shift();for(var d=0;d<S;d++){var h=g[d],R;e?R=[e,h]:R=[h],this._process(R.concat(n),i,a)}}}};z.prototype._emitMatch=function(e,t){var r=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),!this.matches[e][t]){if(this.nodir){var n=this.cache[this._makeAbs(t)];if(n==="DIR"||Array.isArray(n))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}};z.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,r,n;try{r=Rt.lstatSync(e)}catch{return null}var i=r.isSymbolicLink();return this.symlinks[e]=i,!i&&!r.isDirectory()?this.cache[e]="FILE":t=this._readdir(e,!1),t};z.prototype._readdir=function(e,t){var r;if(t&&!cn(this.symlinks,e))return this._readdirInGlobStar(e);if(cn(this.cache,e)){var n=this.cache[e];if(!n||n==="FILE")return null;if(Array.isArray(n))return n}try{return this._readdirEntries(e,Rt.readdirSync(e))}catch(i){return this._readdirError(e,i),null}};z.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var n=t[r];e==="/"?n=e+n:n=e+"/"+n,this.cache[n]=!0}return this.cache[e]=t,t};z.prototype._readdirError=function(e,t){switch(t.code){case"ENOTSUP":case"ENOTDIR":this.cache[this._makeAbs(e)]="FILE";break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error("glob error",t);break}};z.prototype._processGlobStar=function(e,t,r,n,i,a){var s=this._readdir(r,a);if(s){var o=n.slice(1),u=e?[e]:[],l=u.concat(o);this._process(l,i,!1);var f=s.length,g=this.symlinks[r];if(!(g&&a))for(var d=0;d<f;d++){var h=s[d];if(!(h.charAt(0)==="."&&!this.dot)){var m=u.concat(s[d],o);this._process(m,i,!0);var S=u.concat(s[d],n);this._process(S,i,!0)}}}};z.prototype._processSimple=function(e,t){var r=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),!!r){if(e&&or(e)&&!this.nomount){var n=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=ln.join(this.root,e):(e=ln.resolve(this.root,e),n&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this.matches[t][e]=!0}};z.prototype._stat=function(e){var t=this._makeAbs(e),r=e.slice(-1)==="/";if(e.length>this.maxLength)return!1;if(!this.stat&&cn(this.cache,t)){var s=this.cache[t];if(Array.isArray(s)&&(s="DIR"),!r||s==="DIR")return s;if(r&&s==="FILE")return!1}var n,i=this.statCache[t];if(!i){var a;try{a=Rt.lstatSync(t)}catch{return!1}if(a.isSymbolicLink())try{i=Rt.statSync(t)}catch{i=a}else i=a}this.statCache[t]=i;var s=i.isDirectory()?"DIR":"FILE";return this.cache[t]=this.cache[t]||s,r&&s!=="DIR"?!1:s};z.prototype._mark=function(e){return Ie.mark(this,e)};z.prototype._makeAbs=function(e){return Ie.makeAbs(this,e)}});var dn=I((Hh,qa)=>{qa.exports=Ua;function Ua(e,t){if(e&&t)return Ua(e)(t);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(n){r[n]=e[n]}),r;function r(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];var a=e.apply(this,n),s=n[n.length-1];return typeof a=="function"&&a!==s&&Object.keys(s).forEach(function(o){a[o]=s[o]}),a}}});var mn=I((Bh,hn)=>{var Ha=dn();hn.exports=Ha(ur);hn.exports.strict=Ha(Ba);ur.proto=ur(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return ur(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Ba(this)},configurable:!0})});function ur(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function Ba(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}});var Wa=I((Gh,Ga)=>{var Rc=dn(),Lt=Object.create(null),Lc=mn();Ga.exports=Rc(Tc);function Tc(e,t){return Lt[e]?(Lt[e].push(t),null):(Lt[e]=[t],Cc(e))}function Cc(e){return Lc(function t(){var r=Lt[e],n=r.length,i=Mc(arguments);try{for(var a=0;a<n;a++)r[a].apply(null,i)}finally{r.length>n?(r.splice(0,n),process.nextTick(function(){t.apply(null,i)})):delete Lt[e]}})}function Mc(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n]=e[n];return r}});var fn=I((Qh,Ja)=>{Ja.exports=Ve;var Tt=require("fs"),za=ir(),Wh=za.Minimatch,Fc=Ca(),xc=require("events").EventEmitter,pn=require("path"),gn=require("assert"),lr=sr(),yn=Va(),Ee=un(),zh=Ee.alphasort,Jh=Ee.alphasorti,Nc=Ee.setopts,vn=Ee.ownProp,Sn=Wa(),Xh=require("util"),Ic=Ee.childrenIgnored,kc=Ee.isIgnored,$c=mn();function Ve(e,t,r){if(typeof t=="function"&&(r=t,t={}),t||(t={}),t.sync){if(r)throw new TypeError("callback provided to sync glob");return yn(e,t)}return new q(e,t,r)}Ve.sync=yn;var Pc=Ve.GlobSync=yn.GlobSync;Ve.glob=Ve;function Yc(e,t){if(t===null||typeof t!="object")return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}Ve.hasMagic=function(e,t){var r=Yc({},t);r.noprocess=!0;var n=new q(e,r),i=n.minimatch.set;if(i.length>1)return!0;for(var a=0;a<i[0].length;a++)if(typeof i[0][a]!="string")return!0;return!1};Ve.Glob=q;Fc(q,xc);function q(e,t,r){if(typeof t=="function"&&(r=t,t=null),t&&t.sync){if(r)throw new TypeError("callback provided to sync glob");return new Pc(e,t)}if(!(this instanceof q))return new q(e,t,r);Nc(this,e,t),this._didRealPath=!1;var i=this.minimatch.set.length;this.matches=new Array(i),typeof r=="function"&&(r=$c(r),this.on("error",r),this.on("end",function(o){r(null,o)}));var n=this,i=this.minimatch.set.length;if(this._processing=0,this.matches=new Array(i),this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(i===0)return s();for(var a=0;a<i;a++)this._process(this.minimatch.set[a],a,!1,s);function s(){--n._processing,n._processing<=0&&n._finish()}}q.prototype._finish=function(){if(gn(this instanceof q),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();Ee.finish(this),this.emit("end",this.found)}};q.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,r=0;r<this.matches.length;r++)this._realpathSet(r,n);function n(){--e===0&&t._finish()}};q.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var n=Object.keys(r),i=this,a=n.length;if(a===0)return t();var s=this.matches[e]=Object.create(null);n.forEach(function(o,u){o=i._makeAbs(o),Tt.realpath(o,i.realpathCache,function(l,f){l?l.syscall==="stat"?s[o]=!0:i.emit("error",l):s[f]=!0,--a===0&&(i.matches[e]=s,t())})})};q.prototype._mark=function(e){return Ee.mark(this,e)};q.prototype._makeAbs=function(e){return Ee.makeAbs(this,e)};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 e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var r=e[t];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var n=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<n.length;t++){var i=n[t];this._processing--,this._process(i[0],i[1],i[2],i[3])}}}};q.prototype._process=function(e,t,r,n){if(gn(this instanceof q),gn(typeof n=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,r,n]);return}for(var i=0;typeof e[i]=="string";)i++;var a;switch(i){case e.length:this._processSimple(e.join("/"),t,n);return;case 0:a=null;break;default:a=e.slice(0,i).join("/");break}var s=e.slice(i),o;a===null?o=".":((lr(a)||lr(e.join("/")))&&(!a||!lr(a))&&(a="/"+a),o=a);var u=this._makeAbs(o);if(Ic(this,o))return n();var l=s[0]===za.GLOBSTAR;l?this._processGlobStar(a,o,u,s,t,r,n):this._processReaddir(a,o,u,s,t,r,n)}};q.prototype._processReaddir=function(e,t,r,n,i,a,s){var o=this;this._readdir(r,a,function(u,l){return o._processReaddir2(e,t,r,n,i,a,l,s)})};q.prototype._processReaddir2=function(e,t,r,n,i,a,s,o){if(!s)return o();for(var u=n[0],l=!!this.minimatch.negate,f=u._glob,g=this.dot||f.charAt(0)===".",d=[],h=0;h<s.length;h++){var m=s[h];if(m.charAt(0)!=="."||g){var S;l&&!e?S=!m.match(u):S=m.match(u),S&&d.push(m)}}var R=d.length;if(R===0)return o();if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var h=0;h<R;h++){var m=d[h];e&&(e!=="/"?m=e+"/"+m:m=e+m),m.charAt(0)==="/"&&!this.nomount&&(m=pn.join(this.root,m)),this._emitMatch(i,m)}return o()}n.shift();for(var h=0;h<R;h++){var m=d[h],w;e&&(e!=="/"?m=e+"/"+m:m=e+m),this._process([m].concat(n),i,a,o)}o()};q.prototype._emitMatch=function(e,t){if(!this.aborted&&!this.matches[e][t]&&!kc(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var r=this._makeAbs(t);if(this.nodir){var n=this.cache[r];if(n==="DIR"||Array.isArray(n))return}this.mark&&(t=this._mark(t)),this.matches[e][t]=!0;var i=this.statCache[r];i&&this.emit("stat",t,i),this.emit("match",t)}};q.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var r="lstat\0"+e,n=this,i=Sn(r,a);i&&Tt.lstat(e,i);function a(s,o){if(s)return t();var u=o.isSymbolicLink();n.symlinks[e]=u,!u&&!o.isDirectory()?(n.cache[e]="FILE",t()):n._readdir(e,!1,t)}};q.prototype._readdir=function(e,t,r){if(!this.aborted&&(r=Sn("readdir\0"+e+"\0"+t,r),!!r)){if(t&&!vn(this.symlinks,e))return this._readdirInGlobStar(e,r);if(vn(this.cache,e)){var n=this.cache[e];if(!n||n==="FILE")return r();if(Array.isArray(n))return r(null,n)}var i=this;Tt.readdir(e,jc(this,e,r))}};function jc(e,t,r){return function(n,i){n?e._readdirError(t,n,r):e._readdirEntries(t,i,r)}}q.prototype._readdirEntries=function(e,t,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var n=0;n<t.length;n++){var i=t[n];e==="/"?i=e+i:i=e+"/"+i,this.cache[i]=!0}return this.cache[e]=t,r(null,t)}};q.prototype._readdirError=function(e,t,r){if(!this.aborted){switch(t.code){case"ENOTSUP":case"ENOTDIR":this.cache[this._makeAbs(e)]="FILE";break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit("error",t),this.abort()),this.silent||console.error("glob error",t);break}return r()}};q.prototype._processGlobStar=function(e,t,r,n,i,a,s){var o=this;this._readdir(r,a,function(u,l){o._processGlobStar2(e,t,r,n,i,a,l,s)})};q.prototype._processGlobStar2=function(e,t,r,n,i,a,s,o){if(!s)return o();var u=n.slice(1),l=e?[e]:[],f=l.concat(u);this._process(f,i,!1,o);var g=this.symlinks[r],d=s.length;if(g&&a)return o();for(var h=0;h<d;h++){var m=s[h];if(!(m.charAt(0)==="."&&!this.dot)){var S=l.concat(s[h],u);this._process(S,i,!0,o);var R=l.concat(s[h],n);this._process(R,i,!0,o)}}o()};q.prototype._processSimple=function(e,t,r){var n=this;this._stat(e,function(i,a){n._processSimple2(e,t,i,a,r)})};q.prototype._processSimple2=function(e,t,r,n,i){if(this.matches[t]||(this.matches[t]=Object.create(null)),!n)return i();if(e&&lr(e)&&!this.nomount){var a=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=pn.join(this.root,e):(e=pn.resolve(this.root,e),a&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e),i()};q.prototype._stat=function(e,t){var r=this._makeAbs(e),n=e.slice(-1)==="/";if(e.length>this.maxLength)return t();if(!this.stat&&vn(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||i==="DIR")return t(null,i);if(n&&i==="FILE")return t()}var a,s=this.statCache[r];if(s!==void 0){if(s===!1)return t(null,s);var o=s.isDirectory()?"DIR":"FILE";return n&&o==="FILE"?t():t(null,o,s)}var u=this,l=Sn("stat\0"+r,f);l&&Tt.lstat(r,l);function f(g,d){if(d&&d.isSymbolicLink())return Tt.stat(r,function(h,m){h?u._stat2(e,r,null,d,t):u._stat2(e,r,h,m,t)});u._stat2(e,r,g,d,t)}};q.prototype._stat2=function(e,t,r,n,i){if(r)return this.statCache[t]=!1,i();var a=e.slice(-1)==="/";if(this.statCache[t]=n,t.slice(-1)==="/"&&!n.isDirectory())return i(null,!1,n);var s=n.isDirectory()?"DIR":"FILE";return this.cache[t]=this.cache[t]||s,a&&s!=="DIR"?i():i(null,s,n)}});var ts=I((Kh,es)=>{es.exports=wn;wn.sync=Za;var U=require("assert"),Xa=require("path"),dr=require("fs"),hr=fn(),Qa={nosort:!0,nocomment:!0,nonegate:!0,silent:!0},_n=0,Dn=process.platform==="win32";function Ka(e){var t=["unlink","chmod","stat","lstat","rmdir","readdir"];t.forEach(function(r){e[r]=e[r]||dr[r],r=r+"Sync",e[r]=e[r]||dr[r]}),e.maxBusyTries=e.maxBusyTries||3,e.emfileWait=e.emfileWait||1e3,e.disableGlob=e.disableGlob||!1}function wn(e,t,r){typeof t=="function"&&(r=t,t={}),U(e,"rimraf: missing path"),U.equal(typeof e,"string","rimraf: path should be a string"),U(t,"rimraf: missing options"),U.equal(typeof t,"object","rimraf: options should be object"),U.equal(typeof r,"function","rimraf: callback function required"),Ka(t);var n=0,i=null,a=0;if(t.disableGlob||!hr.hasMagic(e))return o(null,[e]);dr.lstat(e,function(u,l){if(!u)return o(null,[e]);hr(e,Qa,o)});function s(u){i=i||u,--a===0&&r(i)}function o(u,l){if(u)return r(u);if(a=l.length,a===0)return r();l.forEach(function(f){bn(f,t,function g(d){if(d){if(Dn&&(d.code==="EBUSY"||d.code==="ENOTEMPTY"||d.code==="EPERM")&&n<t.maxBusyTries){n++;var h=n*100;return setTimeout(function(){bn(f,t,g)},h)}if(d.code==="EMFILE"&&_n<t.emfileWait)return setTimeout(function(){bn(f,t,g)},_n++);d.code==="ENOENT"&&(d=null)}_n=0,s(d)})})}}function bn(e,t,r){U(e),U(t),U(typeof r=="function"),t.lstat(e,function(n,i){if(n&&n.code==="ENOENT")return r(null);if(i&&i.isDirectory())return cr(e,t,n,r);t.unlink(e,function(a){if(a){if(a.code==="ENOENT")return r(null);if(a.code==="EPERM")return Dn?Vc(e,t,a,r):cr(e,t,a,r);if(a.code==="EISDIR")return cr(e,t,a,r)}return r(a)})})}function Vc(e,t,r,n){U(e),U(t),U(typeof n=="function"),r&&U(r instanceof Error),t.chmod(e,666,function(i){i?n(i.code==="ENOENT"?null:r):t.stat(e,function(a,s){a?n(a.code==="ENOENT"?null:r):s.isDirectory()?cr(e,t,r,n):t.unlink(e,n)})})}function Uc(e,t,r){U(e),U(t),r&&U(r instanceof Error);try{t.chmodSync(e,666)}catch(i){if(i.code==="ENOENT")return;throw r}try{var n=t.statSync(e)}catch(i){if(i.code==="ENOENT")return;throw r}n.isDirectory()?fr(e,t,r):t.unlinkSync(e)}function cr(e,t,r,n){U(e),U(t),r&&U(r instanceof Error),U(typeof n=="function"),t.rmdir(e,function(i){i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?qc(e,t,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function qc(e,t,r){U(e),U(t),U(typeof r=="function"),t.readdir(e,function(n,i){if(n)return r(n);var a=i.length;if(a===0)return t.rmdir(e,r);var s;i.forEach(function(o){wn(Xa.join(e,o),t,function(u){if(!s){if(u)return r(s=u);--a===0&&t.rmdir(e,r)}})})})}function Za(e,t){t=t||{},Ka(t),U(e,"rimraf: missing path"),U.equal(typeof e,"string","rimraf: path should be a string"),U(t,"rimraf: missing options"),U.equal(typeof t,"object","rimraf: options should be object");var r;if(t.disableGlob||!hr.hasMagic(e))r=[e];else try{dr.lstatSync(e),r=[e]}catch{r=hr.sync(e,Qa)}if(r.length)for(var n=0;n<r.length;n++){var e=r[n];try{var i=t.lstatSync(e)}catch(s){if(s.code==="ENOENT")return}try{i&&i.isDirectory()?fr(e,t,null):t.unlinkSync(e)}catch(s){if(s.code==="ENOENT")return;if(s.code==="EPERM")return Dn?Uc(e,t,s):fr(e,t,s);if(s.code!=="EISDIR")throw s;fr(e,t,s)}}}function fr(e,t,r){U(e),U(t),r&&U(r instanceof Error);try{t.rmdirSync(e)}catch(n){if(n.code==="ENOENT")return;if(n.code==="ENOTDIR")throw r;(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")&&Hc(e,t)}}function Hc(e,t){U(e),U(t),t.readdirSync(e).forEach(function(r){Za(Xa.join(e,r),t)}),t.rmdirSync(e,t)}});var as=I((Zh,is)=>{var Ct=require("path"),rs=require("fs"),ns=parseInt("0777",8);is.exports=rt.mkdirp=rt.mkdirP=rt;function rt(e,t,r,n){typeof t=="function"?(r=t,t={}):(!t||typeof t!="object")&&(t={mode:t});var i=t.mode,a=t.fs||rs;i===void 0&&(i=ns),n||(n=null);var s=r||function(){};e=Ct.resolve(e),a.mkdir(e,i,function(o){if(!o)return n=n||e,s(null,n);switch(o.code){case"ENOENT":if(Ct.dirname(e)===e)return s(o);rt(Ct.dirname(e),t,function(u,l){u?s(u,l):rt(e,t,s,l)});break;default:a.stat(e,function(u,l){u||!l.isDirectory()?s(o,n):s(null,n)});break}})}rt.sync=function e(t,r,n){(!r||typeof r!="object")&&(r={mode:r});var i=r.mode,a=r.fs||rs;i===void 0&&(i=ns),n||(n=null),t=Ct.resolve(t);try{a.mkdirSync(t,i),n=n||t}catch(o){switch(o.code){case"ENOENT":n=e(Ct.dirname(t),r,n),e(t,r,n);break;default:var s;try{s=a.statSync(t)}catch{throw o}if(!s.isDirectory())throw o;break}}return n}});var cs=I((em,ls)=>{var nt=require("fs"),Bc=ua().ncp,Gc=require("path"),ss=ts(),Wc=as();ls.exports=zc;function zc(e,t,r,n){typeof r=="function"&&(n=r,r={});var i=!!r.mkdirp,a=r.clobber!==!1,s=r.limit||16;i?o():u();function o(){Wc(Gc.dirname(t),function(l){if(l)return n(l);u()})}function u(){a?nt.rename(e,t,function(l){if(!l)return n();if(l.code!=="EXDEV")return n(l);os(e,t,a,s,n)}):nt.link(e,t,function(l){if(l){if(l.code==="EXDEV"){os(e,t,a,s,n);return}if(l.code==="EISDIR"||l.code==="EPERM"){us(e,t,a,s,n);return}n(l);return}nt.unlink(e,n)})}}function os(e,t,r,n,i){var a=r?"w":"wx",s=nt.createReadStream(e),o=nt.createWriteStream(t,{flags:a});s.on("error",function(l){s.destroy(),o.destroy(),o.removeListener("close",u),l.code==="EISDIR"||l.code==="EPERM"?us(e,t,r,n,i):i(l)}),o.on("error",function(l){s.destroy(),o.destroy(),o.removeListener("close",u),i(l)}),o.once("close",u),s.pipe(o);function u(){nt.unlink(e,i)}}function us(e,t,r,n,i){var a={stopOnErr:!0,clobber:!1,limit:n};r?ss(t,{disableGlob:!0},function(o){if(o)return i(o);s()}):s();function s(){Bc(e,t,a,function(o){if(o)return i(o[0]);ss(e,{disableGlob:!0},i)})}}});var ds=I(En=>{var fs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");En.encode=function(e){if(0<=e&&e<fs.length)return fs[e];throw new TypeError("Must be between 0 and 63: "+e)};En.decode=function(e){var t=65,r=90,n=97,i=122,a=48,s=57,o=43,u=47,l=26,f=52;return t<=e&&e<=r?e-t:n<=e&&e<=i?e-n+l:a<=e&&e<=s?e-a+f:e==o?62:e==u?63:-1}});var Rn=I(On=>{var hs=ds(),An=5,ms=1<<An,ps=ms-1,gs=ms;function Jc(e){return e<0?(-e<<1)+1:(e<<1)+0}function Xc(e){var t=(e&1)===1,r=e>>1;return t?-r:r}On.encode=function(t){var r="",n,i=Jc(t);do n=i&ps,i>>>=An,i>0&&(n|=gs),r+=hs.encode(n);while(i>0);return r};On.decode=function(t,r,n){var i=t.length,a=0,s=0,o,u;do{if(r>=i)throw new Error("Expected more digits in base 64 VLQ value.");if(u=hs.decode(t.charCodeAt(r++)),u===-1)throw new Error("Invalid base64 digit: "+t.charAt(r-1));o=!!(u&gs),u&=ps,a=a+(u<<s),s+=An}while(o);n.value=Xc(a),n.rest=r}});var st=I(te=>{function Qc(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}te.getArg=Qc;var vs=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,Kc=/^data:.+\,.+$/;function Mt(e){var t=e.match(vs);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}te.urlParse=Mt;function it(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}te.urlGenerate=it;function Ln(e){var t=e,r=Mt(e);if(r){if(!r.path)return e;t=r.path}for(var n=te.isAbsolute(t),i=t.split(/\/+/),a,s=0,o=i.length-1;o>=0;o--)a=i[o],a==="."?i.splice(o,1):a===".."?s++:s>0&&(a===""?(i.splice(o+1,s),s=0):(i.splice(o,2),s--));return t=i.join("/"),t===""&&(t=n?"/":"."),r?(r.path=t,it(r)):t}te.normalize=Ln;function ys(e,t){e===""&&(e="."),t===""&&(t=".");var r=Mt(t),n=Mt(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),it(r);if(r||t.match(Kc))return t;if(n&&!n.host&&!n.path)return n.host=t,it(n);var i=t.charAt(0)==="/"?t:Ln(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=i,it(n)):i}te.join=ys;te.isAbsolute=function(e){return e.charAt(0)==="/"||vs.test(e)};function Zc(e,t){e===""&&(e="."),e=e.replace(/\/$/,"");for(var r=0;t.indexOf(e+"/")!==0;){var n=e.lastIndexOf("/");if(n<0||(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/)))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}te.relative=Zc;var Ss=function(){var e=Object.create(null);return!("__proto__"in e)}();function _s(e){return e}function ef(e){return bs(e)?"$"+e:e}te.toSetString=Ss?_s:ef;function tf(e){return bs(e)?e.slice(1):e}te.fromSetString=Ss?_s:tf;function bs(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}function rf(e,t,r){var n=at(e.source,t.source);return n!==0||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0||r)||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=e.generatedLine-t.generatedLine,n!==0)?n:at(e.name,t.name)}te.compareByOriginalPositions=rf;function nf(e,t,r){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0||r)||(n=at(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:at(e.name,t.name)}te.compareByGeneratedPositionsDeflated=nf;function at(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function af(e,t){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=at(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:at(e.name,t.name)}te.compareByGeneratedPositionsInflated=af;function sf(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}te.parseSourceMapInput=sf;function of(e,t,r){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),r){var n=Mt(r);if(!n)throw new Error("sourceMapURL could not be parsed");if(n.path){var i=n.path.lastIndexOf("/");i>=0&&(n.path=n.path.substring(0,i+1))}t=ys(it(n),t)}return Ln(t)}te.computeSourceURL=of});var Mn=I(Ds=>{var Tn=st(),Cn=Object.prototype.hasOwnProperty,Ue=typeof Map<"u";function Ae(){this._array=[],this._set=Ue?new Map:Object.create(null)}Ae.fromArray=function(t,r){for(var n=new Ae,i=0,a=t.length;i<a;i++)n.add(t[i],r);return n};Ae.prototype.size=function(){return Ue?this._set.size:Object.getOwnPropertyNames(this._set).length};Ae.prototype.add=function(t,r){var n=Ue?t:Tn.toSetString(t),i=Ue?this.has(t):Cn.call(this._set,n),a=this._array.length;(!i||r)&&this._array.push(t),i||(Ue?this._set.set(t,a):this._set[n]=a)};Ae.prototype.has=function(t){if(Ue)return this._set.has(t);var r=Tn.toSetString(t);return Cn.call(this._set,r)};Ae.prototype.indexOf=function(t){if(Ue){var r=this._set.get(t);if(r>=0)return r}else{var n=Tn.toSetString(t);if(Cn.call(this._set,n))return this._set[n]}throw new Error('"'+t+'" is not in the set.')};Ae.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)};Ae.prototype.toArray=function(){return this._array.slice()};Ds.ArraySet=Ae});var As=I(Es=>{var ws=st();function uf(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,a=t.generatedColumn;return n>r||n==r&&a>=i||ws.compareByGeneratedPositionsInflated(e,t)<=0}function mr(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}mr.prototype.unsortedForEach=function(t,r){this._array.forEach(t,r)};mr.prototype.add=function(t){uf(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};mr.prototype.toArray=function(){return this._sorted||(this._array.sort(ws.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};Es.MappingList=mr});var Fn=I(Os=>{var Ft=Rn(),W=st(),pr=Mn().ArraySet,lf=As().MappingList;function fe(e){e||(e={}),this._file=W.getArg(e,"file",null),this._sourceRoot=W.getArg(e,"sourceRoot",null),this._skipValidation=W.getArg(e,"skipValidation",!1),this._sources=new pr,this._names=new pr,this._mappings=new lf,this._sourcesContents=null}fe.prototype._version=3;fe.fromSourceMap=function(t){var r=t.sourceRoot,n=new fe({file:t.file,sourceRoot:r});return t.eachMapping(function(i){var a={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(a.source=i.source,r!=null&&(a.source=W.relative(r,a.source)),a.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(a.name=i.name)),n.addMapping(a)}),t.sources.forEach(function(i){var a=i;r!==null&&(a=W.relative(r,i)),n._sources.has(a)||n._sources.add(a);var s=t.sourceContentFor(i);s!=null&&n.setSourceContent(i,s)}),n};fe.prototype.addMapping=function(t){var r=W.getArg(t,"generated"),n=W.getArg(t,"original",null),i=W.getArg(t,"source",null),a=W.getArg(t,"name",null);this._skipValidation||this._validateMapping(r,n,i,a),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),a!=null&&(a=String(a),this._names.has(a)||this._names.add(a)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:i,name:a})};fe.prototype.setSourceContent=function(t,r){var n=t;this._sourceRoot!=null&&(n=W.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[W.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[W.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};fe.prototype.applySourceMap=function(t,r,n){var i=r;if(r==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=t.file}var a=this._sourceRoot;a!=null&&(i=W.relative(a,i));var s=new pr,o=new pr;this._mappings.unsortedForEach(function(u){if(u.source===i&&u.originalLine!=null){var l=t.originalPositionFor({line:u.originalLine,column:u.originalColumn});l.source!=null&&(u.source=l.source,n!=null&&(u.source=W.join(n,u.source)),a!=null&&(u.source=W.relative(a,u.source)),u.originalLine=l.line,u.originalColumn=l.column,l.name!=null&&(u.name=l.name))}var f=u.source;f!=null&&!s.has(f)&&s.add(f);var g=u.name;g!=null&&!o.has(g)&&o.add(g)},this),this._sources=s,this._names=o,t.sources.forEach(function(u){var l=t.sourceContentFor(u);l!=null&&(n!=null&&(u=W.join(n,u)),a!=null&&(u=W.relative(a,u)),this.setSourceContent(u,l))},this)};fe.prototype._validateMapping=function(t,r,n,i){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(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!r&&!n&&!i)){if(t&&"line"in t&&"column"in t&&r&&"line"in r&&"column"in r&&t.line>0&&t.column>=0&&r.line>0&&r.column>=0&&n)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:i}))}};fe.prototype._serializeMappings=function(){for(var t=0,r=1,n=0,i=0,a=0,s=0,o="",u,l,f,g,d=this._mappings.toArray(),h=0,m=d.length;h<m;h++){if(l=d[h],u="",l.generatedLine!==r)for(t=0;l.generatedLine!==r;)u+=";",r++;else if(h>0){if(!W.compareByGeneratedPositionsInflated(l,d[h-1]))continue;u+=","}u+=Ft.encode(l.generatedColumn-t),t=l.generatedColumn,l.source!=null&&(g=this._sources.indexOf(l.source),u+=Ft.encode(g-s),s=g,u+=Ft.encode(l.originalLine-1-i),i=l.originalLine-1,u+=Ft.encode(l.originalColumn-n),n=l.originalColumn,l.name!=null&&(f=this._names.indexOf(l.name),u+=Ft.encode(f-a),a=f)),o+=u}return o};fe.prototype._generateSourcesContent=function(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=W.relative(r,n));var i=W.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)};fe.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t};fe.prototype.toString=function(){return JSON.stringify(this.toJSON())};Os.SourceMapGenerator=fe});var Rs=I(qe=>{qe.GREATEST_LOWER_BOUND=1;qe.LEAST_UPPER_BOUND=2;function xn(e,t,r,n,i,a){var s=Math.floor((t-e)/2)+e,o=i(r,n[s],!0);return o===0?s:o>0?t-s>1?xn(s,t,r,n,i,a):a==qe.LEAST_UPPER_BOUND?t<n.length?t:-1:s:s-e>1?xn(e,s,r,n,i,a):a==qe.LEAST_UPPER_BOUND?s:e<0?-1:e}qe.search=function(t,r,n,i){if(r.length===0)return-1;var a=xn(-1,r.length,t,r,n,i||qe.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&n(r[a],r[a-1],!0)===0;)--a;return a}});var Ts=I(Ls=>{function Nn(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function cf(e,t){return Math.round(e+Math.random()*(t-e))}function In(e,t,r,n){if(r<n){var i=cf(r,n),a=r-1;Nn(e,i,n);for(var s=e[n],o=r;o<n;o++)t(e[o],s)<=0&&(a+=1,Nn(e,a,o));Nn(e,a+1,o);var u=a+1;In(e,t,r,u-1),In(e,t,u+1,n)}}Ls.quickSort=function(e,t){In(e,t,0,e.length-1)}});var Ms=I(gr=>{var x=st(),kn=Rs(),ot=Mn().ArraySet,ff=Rn(),xt=Ts().quickSort;function B(e,t){var r=e;return typeof e=="string"&&(r=x.parseSourceMapInput(e)),r.sections!=null?new de(r,t):new Q(r,t)}B.fromSourceMap=function(e,t){return Q.fromSourceMap(e,t)};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(t,r){var n=t.charAt(r);return n===";"||n===","};B.prototype._parseMappings=function(t,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(t,r,n){var i=r||null,a=n||B.GENERATED_ORDER,s;switch(a){case B.GENERATED_ORDER:s=this._generatedMappings;break;case B.ORIGINAL_ORDER:s=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var o=this.sourceRoot;s.map(function(u){var l=u.source===null?null:this._sources.at(u.source);return l=x.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(t,i)};B.prototype.allGeneratedPositionsFor=function(t){var r=x.getArg(t,"line"),n={source:x.getArg(t,"source"),originalLine:r,originalColumn:x.getArg(t,"column",0)};if(n.source=this._findSourceIndex(n.source),n.source<0)return[];var i=[],a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",x.compareByOriginalPositions,kn.LEAST_UPPER_BOUND);if(a>=0){var s=this._originalMappings[a];if(t.column===void 0)for(var o=s.originalLine;s&&s.originalLine===o;)i.push({line:x.getArg(s,"generatedLine",null),column:x.getArg(s,"generatedColumn",null),lastColumn:x.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a];else for(var u=s.originalColumn;s&&s.originalLine===r&&s.originalColumn==u;)i.push({line:x.getArg(s,"generatedLine",null),column:x.getArg(s,"generatedColumn",null),lastColumn:x.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a]}return i};gr.SourceMapConsumer=B;function Q(e,t){var r=e;typeof e=="string"&&(r=x.parseSourceMapInput(e));var n=x.getArg(r,"version"),i=x.getArg(r,"sources"),a=x.getArg(r,"names",[]),s=x.getArg(r,"sourceRoot",null),o=x.getArg(r,"sourcesContent",null),u=x.getArg(r,"mappings"),l=x.getArg(r,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);s&&(s=x.normalize(s)),i=i.map(String).map(x.normalize).map(function(f){return s&&x.isAbsolute(s)&&x.isAbsolute(f)?x.relative(s,f):f}),this._names=ot.fromArray(a.map(String),!0),this._sources=ot.fromArray(i,!0),this._absoluteSources=this._sources.toArray().map(function(f){return x.computeSourceURL(s,f,t)}),this.sourceRoot=s,this.sourcesContent=o,this._mappings=u,this._sourceMapURL=t,this.file=l}Q.prototype=Object.create(B.prototype);Q.prototype.consumer=B;Q.prototype._findSourceIndex=function(e){var t=e;if(this.sourceRoot!=null&&(t=x.relative(this.sourceRoot,t)),this._sources.has(t))return this._sources.indexOf(t);var r;for(r=0;r<this._absoluteSources.length;++r)if(this._absoluteSources[r]==e)return r;return-1};Q.fromSourceMap=function(t,r){var n=Object.create(Q.prototype),i=n._names=ot.fromArray(t._names.toArray(),!0),a=n._sources=ot.fromArray(t._sources.toArray(),!0);n.sourceRoot=t._sourceRoot,n.sourcesContent=t._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=t._file,n._sourceMapURL=r,n._absoluteSources=n._sources.toArray().map(function(h){return x.computeSourceURL(n.sourceRoot,h,r)});for(var s=t._mappings.toArray().slice(),o=n.__generatedMappings=[],u=n.__originalMappings=[],l=0,f=s.length;l<f;l++){var g=s[l],d=new Cs;d.generatedLine=g.generatedLine,d.generatedColumn=g.generatedColumn,g.source&&(d.source=a.indexOf(g.source),d.originalLine=g.originalLine,d.originalColumn=g.originalColumn,g.name&&(d.name=i.indexOf(g.name)),u.push(d)),o.push(d)}return xt(n.__originalMappings,x.compareByOriginalPositions),n};Q.prototype._version=3;Object.defineProperty(Q.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function Cs(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}Q.prototype._parseMappings=function(t,r){for(var n=1,i=0,a=0,s=0,o=0,u=0,l=t.length,f=0,g={},d={},h=[],m=[],S,R,w,p,L;f<l;)if(t.charAt(f)===";")n++,f++,i=0;else if(t.charAt(f)===",")f++;else{for(S=new Cs,S.generatedLine=n,p=f;p<l&&!this._charIsMappingSeparator(t,p);p++);if(R=t.slice(f,p),w=g[R],w)f+=R.length;else{for(w=[];f<p;)ff.decode(t,f,d),L=d.value,f=d.rest,w.push(L);if(w.length===2)throw new Error("Found a source, but no line and column");if(w.length===3)throw new Error("Found a source and line, but no column");g[R]=w}S.generatedColumn=i+w[0],i=S.generatedColumn,w.length>1&&(S.source=o+w[1],o+=w[1],S.originalLine=a+w[2],a=S.originalLine,S.originalLine+=1,S.originalColumn=s+w[3],s=S.originalColumn,w.length>4&&(S.name=u+w[4],u+=w[4])),m.push(S),typeof S.originalLine=="number"&&h.push(S)}xt(m,x.compareByGeneratedPositionsDeflated),this.__generatedMappings=m,xt(h,x.compareByOriginalPositions),this.__originalMappings=h};Q.prototype._findMapping=function(t,r,n,i,a,s){if(t[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[n]);if(t[i]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[i]);return kn.search(t,r,a,s)};Q.prototype.computeColumnSpans=function(){for(var t=0;t<this._generatedMappings.length;++t){var r=this._generatedMappings[t];if(t+1<this._generatedMappings.length){var n=this._generatedMappings[t+1];if(r.generatedLine===n.generatedLine){r.lastGeneratedColumn=n.generatedColumn-1;continue}}r.lastGeneratedColumn=1/0}};Q.prototype.originalPositionFor=function(t){var r={generatedLine:x.getArg(t,"line"),generatedColumn:x.getArg(t,"column")},n=this._findMapping(r,this._generatedMappings,"generatedLine","generatedColumn",x.compareByGeneratedPositionsDeflated,x.getArg(t,"bias",B.GREATEST_LOWER_BOUND));if(n>=0){var i=this._generatedMappings[n];if(i.generatedLine===r.generatedLine){var a=x.getArg(i,"source",null);a!==null&&(a=this._sources.at(a),a=x.computeSourceURL(this.sourceRoot,a,this._sourceMapURL));var s=x.getArg(i,"name",null);return s!==null&&(s=this._names.at(s)),{source:a,line:x.getArg(i,"originalLine",null),column:x.getArg(i,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}};Q.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(t){return t==null}):!1};Q.prototype.sourceContentFor=function(t,r){if(!this.sourcesContent)return null;var n=this._findSourceIndex(t);if(n>=0)return this.sourcesContent[n];var i=t;this.sourceRoot!=null&&(i=x.relative(this.sourceRoot,i));var a;if(this.sourceRoot!=null&&(a=x.urlParse(this.sourceRoot))){var s=i.replace(/^file:\/\//,"");if(a.scheme=="file"&&this._sources.has(s))return this.sourcesContent[this._sources.indexOf(s)];if((!a.path||a.path=="/")&&this._sources.has("/"+i))return this.sourcesContent[this._sources.indexOf("/"+i)]}if(r)return null;throw new Error('"'+i+'" is not in the SourceMap.')};Q.prototype.generatedPositionFor=function(t){var r=x.getArg(t,"source");if(r=this._findSourceIndex(r),r<0)return{line:null,column:null,lastColumn:null};var n={source:r,originalLine:x.getArg(t,"line"),originalColumn:x.getArg(t,"column")},i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",x.compareByOriginalPositions,x.getArg(t,"bias",B.GREATEST_LOWER_BOUND));if(i>=0){var a=this._originalMappings[i];if(a.source===n.source)return{line:x.getArg(a,"generatedLine",null),column:x.getArg(a,"generatedColumn",null),lastColumn:x.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};gr.BasicSourceMapConsumer=Q;function de(e,t){var r=e;typeof e=="string"&&(r=x.parseSourceMapInput(e));var n=x.getArg(r,"version"),i=x.getArg(r,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new ot,this._names=new ot;var a={line:-1,column:0};this._sections=i.map(function(s){if(s.url)throw new Error("Support for url field in sections not implemented.");var o=x.getArg(s,"offset"),u=x.getArg(o,"line"),l=x.getArg(o,"column");if(u<a.line||u===a.line&&l<a.column)throw new Error("Section offsets must be ordered and non-overlapping.");return a=o,{generatedOffset:{generatedLine:u+1,generatedColumn:l+1},consumer:new B(x.getArg(s,"map"),t)}})}de.prototype=Object.create(B.prototype);de.prototype.constructor=B;de.prototype._version=3;Object.defineProperty(de.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}});de.prototype.originalPositionFor=function(t){var r={generatedLine:x.getArg(t,"line"),generatedColumn:x.getArg(t,"column")},n=kn.search(r,this._sections,function(a,s){var o=a.generatedLine-s.generatedOffset.generatedLine;return o||a.generatedColumn-s.generatedOffset.generatedColumn}),i=this._sections[n];return i?i.consumer.originalPositionFor({line:r.generatedLine-(i.generatedOffset.generatedLine-1),column:r.generatedColumn-(i.generatedOffset.generatedLine===r.generatedLine?i.generatedOffset.generatedColumn-1:0),bias:t.bias}):{source:null,line:null,column:null,name:null}};de.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(t){return t.consumer.hasContentsOfAllSources()})};de.prototype.sourceContentFor=function(t,r){for(var n=0;n<this._sections.length;n++){var i=this._sections[n],a=i.consumer.sourceContentFor(t,!0);if(a)return a}if(r)return null;throw new Error('"'+t+'" is not in the SourceMap.')};de.prototype.generatedPositionFor=function(t){for(var r=0;r<this._sections.length;r++){var n=this._sections[r];if(n.consumer._findSourceIndex(x.getArg(t,"source"))!==-1){var i=n.consumer.generatedPositionFor(t);if(i){var a={line:i.line+(n.generatedOffset.generatedLine-1),column:i.column+(n.generatedOffset.generatedLine===i.line?n.generatedOffset.generatedColumn-1:0)};return a}}}return{line:null,column:null}};de.prototype._parseMappings=function(t,r){this.__generatedMappings=[],this.__originalMappings=[];for(var n=0;n<this._sections.length;n++)for(var i=this._sections[n],a=i.consumer._generatedMappings,s=0;s<a.length;s++){var o=a[s],u=i.consumer._sources.at(o.source);u=x.computeSourceURL(i.consumer.sourceRoot,u,this._sourceMapURL),this._sources.add(u),u=this._sources.indexOf(u);var l=null;o.name&&(l=i.consumer._names.at(o.name),this._names.add(l),l=this._names.indexOf(l));var f={source:u,generatedLine:o.generatedLine+(i.generatedOffset.generatedLine-1),generatedColumn:o.generatedColumn+(i.generatedOffset.generatedLine===o.generatedLine?i.generatedOffset.generatedColumn-1:0),originalLine:o.originalLine,originalColumn:o.originalColumn,name:l};this.__generatedMappings.push(f),typeof f.originalLine=="number"&&this.__originalMappings.push(f)}xt(this.__generatedMappings,x.compareByGeneratedPositionsDeflated),xt(this.__originalMappings,x.compareByOriginalPositions)};gr.IndexedSourceMapConsumer=de});var xs=I(Fs=>{var df=Fn().SourceMapGenerator,vr=st(),hf=/(\r?\n)/,mf=10,ut="$$$isSourceNode$$$";function oe(e,t,r,n,i){this.children=[],this.sourceContents={},this.line=e??null,this.column=t??null,this.source=r??null,this.name=i??null,this[ut]=!0,n!=null&&this.add(n)}oe.fromStringWithSourceMap=function(t,r,n){var i=new oe,a=t.split(hf),s=0,o=function(){var d=m(),h=m()||"";return d+h;function m(){return s<a.length?a[s++]:void 0}},u=1,l=0,f=null;return r.eachMapping(function(d){if(f!==null)if(u<d.generatedLine)g(f,o()),u++,l=0;else{var h=a[s]||"",m=h.substr(0,d.generatedColumn-l);a[s]=h.substr(d.generatedColumn-l),l=d.generatedColumn,g(f,m),f=d;return}for(;u<d.generatedLine;)i.add(o()),u++;if(l<d.generatedColumn){var h=a[s]||"";i.add(h.substr(0,d.generatedColumn)),a[s]=h.substr(d.generatedColumn),l=d.generatedColumn}f=d},this),s<a.length&&(f&&g(f,o()),i.add(a.splice(s).join(""))),r.sources.forEach(function(d){var h=r.sourceContentFor(d);h!=null&&(n!=null&&(d=vr.join(n,d)),i.setSourceContent(d,h))}),i;function g(d,h){if(d===null||d.source===void 0)i.add(h);else{var m=n?vr.join(n,d.source):d.source;i.add(new oe(d.originalLine,d.originalColumn,m,h,d.name))}}};oe.prototype.add=function(t){if(Array.isArray(t))t.forEach(function(r){this.add(r)},this);else if(t[ut]||typeof t=="string")t&&this.children.push(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this};oe.prototype.prepend=function(t){if(Array.isArray(t))for(var r=t.length-1;r>=0;r--)this.prepend(t[r]);else if(t[ut]||typeof t=="string")this.children.unshift(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this};oe.prototype.walk=function(t){for(var r,n=0,i=this.children.length;n<i;n++)r=this.children[n],r[ut]?r.walk(t):r!==""&&t(r,{source:this.source,line:this.line,column:this.column,name:this.name})};oe.prototype.join=function(t){var r,n,i=this.children.length;if(i>0){for(r=[],n=0;n<i-1;n++)r.push(this.children[n]),r.push(t);r.push(this.children[n]),this.children=r}return this};oe.prototype.replaceRight=function(t,r){var n=this.children[this.children.length-1];return n[ut]?n.replaceRight(t,r):typeof n=="string"?this.children[this.children.length-1]=n.replace(t,r):this.children.push("".replace(t,r)),this};oe.prototype.setSourceContent=function(t,r){this.sourceContents[vr.toSetString(t)]=r};oe.prototype.walkSourceContents=function(t){for(var r=0,n=this.children.length;r<n;r++)this.children[r][ut]&&this.children[r].walkSourceContents(t);for(var i=Object.keys(this.sourceContents),r=0,n=i.length;r<n;r++)t(vr.fromSetString(i[r]),this.sourceContents[i[r]])};oe.prototype.toString=function(){var t="";return this.walk(function(r){t+=r}),t};oe.prototype.toStringWithSourceMap=function(t){var r={code:"",line:1,column:0},n=new df(t),i=!1,a=null,s=null,o=null,u=null;return this.walk(function(l,f){r.code+=l,f.source!==null&&f.line!==null&&f.column!==null?((a!==f.source||s!==f.line||o!==f.column||u!==f.name)&&n.addMapping({source:f.source,original:{line:f.line,column:f.column},generated:{line:r.line,column:r.column},name:f.name}),a=f.source,s=f.line,o=f.column,u=f.name,i=!0):i&&(n.addMapping({generated:{line:r.line,column:r.column}}),a=null,i=!1);for(var g=0,d=l.length;g<d;g++)l.charCodeAt(g)===mf?(r.line++,r.column=0,g+1===d?(a=null,i=!1):i&&n.addMapping({source:f.source,original:{line:f.line,column:f.column},generated:{line:r.line,column:r.column},name:f.name})):r.column++}),this.walkSourceContents(function(l,f){n.setSourceContent(l,f)}),{code:r.code,map:n}};Fs.SourceNode=oe});var Ns=I(yr=>{yr.SourceMapGenerator=Fn().SourceMapGenerator;yr.SourceMapConsumer=Ms().SourceMapConsumer;yr.SourceNode=xs().SourceNode});var ks=I((dm,Is)=>{var pf=Object.prototype.toString,$n=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function gf(e){return pf.call(e).slice(8,-1)==="ArrayBuffer"}function vf(e,t,r){t>>>=0;var n=e.byteLength-t;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 $n?Buffer.from(e.slice(t,t+r)):new Buffer(new Uint8Array(e.slice(t,t+r)))}function yf(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!Buffer.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');return $n?Buffer.from(e,t):new Buffer(e,t)}function Sf(e,t,r){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return gf(e)?vf(e,t,r):typeof e=="string"?yf(e,t):$n?Buffer.from(e):new Buffer(e)}Is.exports=Sf});var Hs=I((Be,Vn)=>{var _f=Ns().SourceMapConsumer,Pn=require("path"),_e;try{_e=require("fs"),(!_e.existsSync||!_e.readFileSync)&&(_e=null)}catch{}var bf=ks();function $s(e,t){return e.require(t)}var Ps=!1,Ys=!1,Yn=!1,Nt="auto",He={},It={},Df=/^data:application\/json[^,]+base64,/,ke=[],$e=[];function Un(){return Nt==="browser"?!0:Nt==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function wf(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function Ef(){return typeof process=="object"&&process!==null?process.version:""}function Af(){if(typeof process=="object"&&process!==null)return process.stderr}function Of(e){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(e)}function Sr(e){return function(t){for(var r=0;r<e.length;r++){var n=e[r](t);if(n)return n}return null}}var qn=Sr(ke);ke.push(function(e){if(e=e.trim(),/^file:/.test(e)&&(e=e.replace(/file:\/\/\/(\w:)?/,function(n,i){return i?"":"/"})),e in He)return He[e];var t="";try{if(_e)_e.existsSync(e)&&(t=_e.readFileSync(e,"utf8"));else{var r=new XMLHttpRequest;r.open("GET",e,!1),r.send(null),r.readyState===4&&r.status===200&&(t=r.responseText)}}catch{}return He[e]=t});function jn(e,t){if(!e)return t;var r=Pn.dirname(e),n=/^\w+:\/\/[^\/]*/.exec(r),i=n?n[0]:"",a=r.slice(i.length);return i&&/^\/\w\:/.test(a)?(i+="/",i+Pn.resolve(r.slice(i.length),t).replace(/\\/g,"/")):i+Pn.resolve(r.slice(i.length),t)}function Rf(e){var t;if(Un())try{var r=new XMLHttpRequest;r.open("GET",e,!1),r.send(null),t=r.readyState===4?r.responseText:null;var n=r.getResponseHeader("SourceMap")||r.getResponseHeader("X-SourceMap");if(n)return n}catch{}t=qn(e);for(var i=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,a,s;s=i.exec(t);)a=s;return a?a[1]:null}var Hn=Sr($e);$e.push(function(e){var t=Rf(e);if(!t)return null;var r;if(Df.test(t)){var n=t.slice(t.indexOf(",")+1);r=bf(n,"base64").toString(),t=e}else t=jn(e,t),r=qn(t);return r?{url:t,map:r}:null});function Bn(e){var t=It[e.source];if(!t){var r=Hn(e.source);r?(t=It[e.source]={url:r.url,map:new _f(r.map)},t.map.sourcesContent&&t.map.sources.forEach(function(i,a){var s=t.map.sourcesContent[a];if(s){var o=jn(t.url,i);He[o]=s}})):t=It[e.source]={url:null,map:null}}if(t&&t.map&&typeof t.map.originalPositionFor=="function"){var n=t.map.originalPositionFor(e);if(n.source!==null)return n.source=jn(t.url,n.source),n}return e}function Vs(e){var t=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(e);if(t){var r=Bn({source:t[2],line:+t[3],column:t[4]-1});return"eval at "+t[1]+" ("+r.source+":"+r.line+":"+(r.column+1)+")"}return t=/^eval at ([^(]+) \((.+)\)$/.exec(e),t?"eval at "+t[1]+" ("+Vs(t[2])+")":e}function Lf(){var e,t="";if(this.isNative())t="native";else{e=this.getScriptNameOrSourceURL(),!e&&this.isEval()&&(t=this.getEvalOrigin(),t+=", "),e?t+=e:t+="<anonymous>";var r=this.getLineNumber();if(r!=null){t+=":"+r;var n=this.getColumnNumber();n&&(t+=":"+n)}}var i="",a=this.getFunctionName(),s=!0,o=this.isConstructor(),u=!(this.isToplevel()||o);if(u){var l=this.getTypeName();l==="[object Object]"&&(l="null");var f=this.getMethodName();a?(l&&a.indexOf(l)!=0&&(i+=l+"."),i+=a,f&&a.indexOf("."+f)!=a.length-f.length-1&&(i+=" [as "+f+"]")):i+=l+"."+(f||"<anonymous>")}else o?i+="new "+(a||"<anonymous>"):a?i+=a:(i+=t,s=!1);return s&&(i+=" ("+t+")"),i}function js(e){var t={};return Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(function(r){t[r]=/^(?:is|get)/.test(r)?function(){return e[r].call(e)}:e[r]}),t.toString=Lf,t}function Us(e,t){if(t===void 0&&(t={nextPosition:null,curPosition:null}),e.isNative())return t.curPosition=null,e;var r=e.getFileName()||e.getScriptNameOrSourceURL();if(r){var n=e.getLineNumber(),i=e.getColumnNumber()-1,a=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,s=a.test(Ef())?0:62;n===1&&i>s&&!Un()&&!e.isEval()&&(i-=s);var o=Bn({source:r,line:n,column:i});t.curPosition=o,e=js(e);var u=e.getFunctionName;return e.getFunctionName=function(){return t.nextPosition==null?u():t.nextPosition.name||u()},e.getFileName=function(){return o.source},e.getLineNumber=function(){return o.line},e.getColumnNumber=function(){return o.column+1},e.getScriptNameOrSourceURL=function(){return o.source},e}var l=e.isEval()&&e.getEvalOrigin();return l&&(l=Vs(l),e=js(e),e.getEvalOrigin=function(){return l}),e}function Tf(e,t){Yn&&(He={},It={});for(var r=e.name||"Error",n=e.message||"",i=r+": "+n,a={nextPosition:null,curPosition:null},s=[],o=t.length-1;o>=0;o--)s.push(`
    at `+Us(t[o],a)),a.nextPosition=a.curPosition;return a.curPosition=a.nextPosition=null,i+s.reverse().join("")}function qs(e){var t=/\n    at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack);if(t){var r=t[1],n=+t[2],i=+t[3],a=He[r];if(!a&&_e&&_e.existsSync(r))try{a=_e.readFileSync(r,"utf8")}catch{a=""}if(a){var s=a.split(/(?:\r\n|\r|\n)/)[n-1];if(s)return r+":"+n+`
`+s+`
`+new Array(i).join(" ")+"^"}}return null}function Cf(e){var t=qs(e),r=Af();r&&r._handle&&r._handle.setBlocking&&r._handle.setBlocking(!0),t&&(console.error(),console.error(t)),console.error(e.stack),Of(1)}function Mf(){var e=process.emit;process.emit=function(t){if(t==="uncaughtException"){var r=arguments[1]&&arguments[1].stack,n=this.listeners(t).length>0;if(r&&!n)return Cf(arguments[1])}return e.apply(this,arguments)}}var Ff=ke.slice(0),xf=$e.slice(0);Be.wrapCallSite=Us;Be.getErrorSource=qs;Be.mapSourcePosition=Bn;Be.retrieveSourceMap=Hn;Be.install=function(e){if(e=e||{},e.environment&&(Nt=e.environment,["node","browser","auto"].indexOf(Nt)===-1))throw new Error("environment "+Nt+" was unknown. Available options are {auto, browser, node}");if(e.retrieveFile&&(e.overrideRetrieveFile&&(ke.length=0),ke.unshift(e.retrieveFile)),e.retrieveSourceMap&&(e.overrideRetrieveSourceMap&&($e.length=0),$e.unshift(e.retrieveSourceMap)),e.hookRequire&&!Un()){var t=$s(Vn,"module"),r=t.prototype._compile;r.__sourceMapSupport||(t.prototype._compile=function(a,s){return He[s]=a,It[s]=void 0,r.call(this,a,s)},t.prototype._compile.__sourceMapSupport=!0)}if(Yn||(Yn="emptyCacheBetweenOperations"in e?e.emptyCacheBetweenOperations:!1),Ps||(Ps=!0,Error.prepareStackTrace=Tf),!Ys){var n="handleUncaughtExceptions"in e?e.handleUncaughtExceptions:!0;try{var i=$s(Vn,"worker_threads");i.isMainThread===!1&&(n=!1)}catch{}n&&wf()&&(Ys=!0,Mf())}};Be.resetRetrieveHandlers=function(){ke.length=0,$e.length=0,ke=Ff.slice(0),$e=xf.slice(0),Hn=Sr($e),qn=Sr(ke)}});var Zs=I((mm,Z)=>{var Nf="1.8.15",Gs=0,ct=function(t){var r=["XXX: "+t].concat(Array.prototype.slice.call(arguments,1));console.error.apply(this,r)},ct=function(){},We;typeof process<"u"&&process.versions&&(process.versions.nw?We="nw":process.versions.node&&(We="node"));!We&&typeof window<"u"&&window.window===window&&(We="browser");if(!We)throw new Error("unknown runtime environment");var _r,Oe,lt;if(We==="browser")_r={hostname:function(){return window.location.host}},Oe={},lt=null;else{_r=require("os"),Oe=require("fs");try{lt=require("dtrace-provider")}catch{lt=null}}var Le=require("util"),Re=require("assert"),jt=require("events").EventEmitter,If=require("stream");try{$t=sa()}catch{$t=null}var $t;process.env.BUNYAN_TEST_NO_SAFE_JSON_STRINGIFY&&($t=null);try{Pt=cs()}catch{Pt=null}var Pt;try{br=Hs()}catch{br=null}var br;function Ge(e){if(e==null)return e;if(Array.isArray(e))return e.slice();if(typeof e=="object"){var t={};return Object.keys(e).forEach(function(r){t[r]=e[r]}),t}else return e}var K=Le.format;K||(Gn=Le.inspect,Bs=/%[sdj%]/g,K=function(t){if(typeof t!="string"){for(var r=[],n=0;n<arguments.length;n++)r.push(Gn(arguments[n]));return r.join(" ")}for(var n=1,i=arguments,a=i.length,s=String(t).replace(Bs,function(u){if(n>=a)return u;switch(u){case"%s":return String(i[n++]);case"%d":return Number(i[n++]);case"%j":return Ks(i[n++]);case"%%":return"%";default:return u}}),o=i[n];n<a;o=i[++n])o===null||typeof o!="object"?s+=" "+o:s+=" "+Gn(o);return s});var Gn,Bs;function Jn(){if(this!==void 0){var e={},t=Error.stackTraceLimit,r=Error.prepareStackTrace;return Error.stackTraceLimit=3,Error.prepareStackTrace=function(n,i){var a=i[2];br&&(a=br.wrapCallSite(a)),e.file=a.getFileName(),e.line=a.getLineNumber();var s=a.getFunctionName();s&&(e.func=s)},Error.captureStackTrace(this,Jn),this.stack,Error.stackTraceLimit=t,Error.prepareStackTrace=r,e}}function kf(e,t){t||(t="    ");var r=e.split(/\r?\n/g);return t+r.join(`
`+t)}function Xn(e,t){if(Re.ok(e),t){if(Wn[t])return;Wn[t]=!0}process.stderr.write(e+`
`)}function $f(e){return Wn[e]}var Wn={};function Ws(){}Ws.prototype.write=function(e){e.level<Vt?console.log(e):e.level<Dr?console.info(e):e.level<wr?console.warn(e):console.error(e)};var Qn=10,Kn=20,Vt=30,Dr=40,wr=50,Zn=60,ft={trace:Qn,debug:Kn,info:Vt,warn:Dr,error:wr,fatal:Zn},zs={};Object.keys(ft).forEach(function(e){zs[ft[e]]=e});var kt=void 0,zn=lt&&{};function Yt(e){var t,r=typeof e;if(r==="string"){if(t=ft[e.toLowerCase()],!t)throw new Error(K('unknown level name: "%s"',e))}else{if(r!=="number")throw new TypeError(K("cannot resolve level: invalid arg (%s):",r,e));if(e<0||Math.floor(e)!==e)throw new TypeError(K("level is not a positive integer: %s",e));t=e}return t}function Pf(e){return e instanceof If.Writable?!0:typeof e.write=="function"}function G(e,t,r){if(ct("Logger start:",e),!(this instanceof G))return new G(e,t);var n;if(t!==void 0&&(n=e,e=t,!(n instanceof G)))throw new TypeError("invalid Logger creation: do not pass a second arg");if(!e)throw new TypeError("options (object) is required");if(n){if(e.name)throw new TypeError("invalid options.name: child cannot set logger name")}else if(!e.name)throw new TypeError("options.name (string) is required");if(e.stream&&e.streams)throw new TypeError('cannot mix "streams" and "stream" options');if(e.streams&&!Array.isArray(e.streams))throw new TypeError("invalid options.streams: must be an array");if(e.serializers&&(typeof e.serializers!="object"||Array.isArray(e.serializers)))throw new TypeError("invalid options.serializers: must be an object");if(jt.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 d=this.fields={},i=Object.keys(n.fields),a=0;a<i.length;a++){var s=i[a];d[s]=n.fields[s]}for(var o=Object.keys(e),a=0;a<o.length;a++){var s=o[a];d[s]=e[s]}return}var u=this;if(n){this._level=n._level,this.streams=[];for(var a=0;a<n.streams.length;a++){var l=Ge(n.streams[a]);l.closeOnExit=!1,this.streams.push(l)}this.serializers=Ge(n.serializers),this.src=n.src,this.fields=Ge(n.fields),e.level&&this.level(e.level)}else this._level=Number.POSITIVE_INFINITY,this.streams=[],this.serializers=null,this.src=!1,this.fields={};if(!kt&&lt){kt=lt.createDTraceProvider("bunyan");for(var f in ft){var g;zn[ft[f]]=g=kt.addProbe("log-"+f,"char *"),g.dtp=kt}kt.enable()}e.stream?u.addStream({type:"stream",stream:e.stream,closeOnExit:!1,level:e.level}):e.streams?e.streams.forEach(function(h){u.addStream(h,e.level)}):n&&e.level?this.level(e.level):n||(We==="browser"?u.addStream({type:"raw",stream:new Ws,closeOnExit:!1,level:e.level}):u.addStream({type:"stream",stream:process.stdout,closeOnExit:!1,level:e.level})),e.serializers&&u.addSerializers(e.serializers),e.src&&(this.src=!0),ct("Logger: ",u);var d=Ge(e);delete d.stream,delete d.level,delete d.streams,delete d.serializers,delete d.src,this.serializers&&this._applySerializers(d),!d.hostname&&!u.fields.hostname&&(d.hostname=_r.hostname()),d.pid||(d.pid=process.pid),Object.keys(d).forEach(function(h){u.fields[h]=d[h]})}Le.inherits(G,jt);G.prototype.addStream=function(t,r){var n=this;switch(r==null&&(r=Vt),t=Ge(t),t.type||(t.stream?t.type="stream":t.path&&(t.type="file")),t.raw=t.type==="raw",t.level!==void 0?t.level=Yt(t.level):t.level=Yt(r),t.level<n._level&&(n._level=t.level),t.type){case"stream":Re.ok(Pf(t.stream),'"stream" stream is not writable: '+Le.inspect(t.stream)),t.closeOnExit||(t.closeOnExit=!1);break;case"file":t.reemitErrorEvents===void 0&&(t.reemitErrorEvents=!0),t.stream?t.closeOnExit||(t.closeOnExit=!1):(t.stream=Oe.createWriteStream(t.path,{flags:"a",encoding:"utf8"}),t.closeOnExit||(t.closeOnExit=!0));break;case"rotating-file":Re.ok(!t.stream,'"rotating-file" stream should not give a "stream"'),Re.ok(t.path),Re.ok(Pt,'"rotating-file" stream type is not supported: missing "mv" module'),t.stream=new ue(t),t.closeOnExit||(t.closeOnExit=!0);break;case"raw":t.closeOnExit||(t.closeOnExit=!1);break;default:throw new TypeError('unknown stream type "'+t.type+'"')}t.reemitErrorEvents&&typeof t.stream.on=="function"&&t.stream.on("error",function(a){n.emit("error",a,t)}),n.streams.push(t),delete n.haveNonRawStreams};G.prototype.addSerializers=function(t){var r=this;r.serializers||(r.serializers={}),Object.keys(t).forEach(function(n){var i=t[n];if(typeof i!="function")throw new TypeError(K('invalid serializer for "%s" field: must be a function',n));r.serializers[n]=i})};G.prototype.child=function(e,t){return new this.constructor(this,e||{},t)};G.prototype.reopenFileStreams=function(){var e=this;e.streams.forEach(function(t){t.type==="file"&&(t.stream&&(t.stream.end(),t.stream.destroySoon(),delete t.stream),t.stream=Oe.createWriteStream(t.path,{flags:"a",encoding:"utf8"}),t.stream.on("error",function(r){e.emit("error",r,t)}))})};G.prototype.level=function(t){if(t===void 0)return this._level;for(var r=Yt(t),n=this.streams.length,i=0;i<n;i++)this.streams[i].level=r;this._level=r};G.prototype.levels=function(t,r){if(t===void 0)return Re.equal(r,void 0),this.streams.map(function(u){return u.level});var n;if(typeof t=="number"){if(n=this.streams[t],n===void 0)throw new Error("invalid stream index: "+t)}else{for(var i=this.streams.length,a=0;a<i;a++){var s=this.streams[a];if(s.name===t){n=s;break}}if(!n)throw new Error(K('no stream with name "%s"',t))}if(r===void 0)return n.level;var o=Yt(r);n.level=o,o<this._level&&(this._level=o)};G.prototype._applySerializers=function(e,t){var r=this;ct("_applySerializers: excludeFields",t),Object.keys(this.serializers).forEach(function(n){if(!(e[n]===void 0||t&&t[n])){ct('_applySerializers; apply to "%s" key',n);try{e[n]=r.serializers[n](e[n])}catch(i){Xn(K(`bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bug in that serializer function.
%s`,n,i.stack||i)),e[n]=K('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',n)}}})};G.prototype._emit=function(e,t){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((t||this.haveNonRawStreams)&&(n=Ks(e)+_r.EOL),t)return n;var i=e.level;for(r=0;r<this.streams.length;r++){var a=this.streams[r];a.level<=i&&(ct('writing log rec "%s" to "%s" stream (%d <= %d): %j',e.msg,a.type,a.level,i,e),a.stream.write(a.raw?e:n))}return n};function Js(e,t,r){var n,i,a;r[0]instanceof Error?(i={err:e.serializers&&e.serializers.err?e.serializers.err(r[0]):G.stdSerializers.err(r[0])},n={err:!0},r.length===1?a=[i.err.message]:a=r.slice(1)):typeof r[0]!="object"||Array.isArray(r[0])?(i=null,a=r.slice()):Buffer.isBuffer(r[0])?(i=null,a=r.slice(),a[0]=Le.inspect(a[0])):(i=r[0],i&&r.length===1&&i.err&&i.err instanceof Error?a=[i.err.message]:a=r.slice(1));var s=Ge(e.fields),o=s.level=t,u=i?Ge(i):null;return u&&(e.serializers&&e._applySerializers(u,n),Object.keys(u).forEach(function(l){s[l]=u[l]})),s.msg=K.apply(e,a),s.time||(s.time=new Date),e.src&&!s.src&&(s.src=Jn()),s.v=Gs,s}function Yf(e,t,r,n){return[e||t._emit(Js(t,r,n),!0)]}function dt(e){return function(){var t=this,r=null,n=null;if(this._emit){if(arguments.length===0)return this._level<=e}else{var i="unbound";if(!$f[i]){var a=Jn();Xn(K("bunyan usage error: %s:%s: attempt to log with an unbound log method: `this` is: %s",a.file,a.line,Le.inspect(this)),i)}return}for(var s=new Array(arguments.length),o=0;o<s.length;++o)s[o]=arguments[o];this._level<=e&&(n=Js(t,e,s),r=this._emit(n)),zn&&zn[e].fire(Yf,r,t,e,s)}}G.prototype.trace=dt(Qn);G.prototype.debug=dt(Kn);G.prototype.info=dt(Vt);G.prototype.warn=dt(Dr);G.prototype.error=dt(wr);G.prototype.fatal=dt(Zn);G.stdSerializers={};G.stdSerializers.req=function(e){return!e||!e.connection?e:{method:e.method,url:e.originalUrl||e.url,headers:e.headers,remoteAddress:e.connection.remoteAddress,remotePort:e.connection.remotePort}};G.stdSerializers.res=function(e){return!e||!e.statusCode?e:{statusCode:e.statusCode,header:e._header}};function Xs(e){var t=e.stack||e.toString();if(e.cause&&typeof e.cause=="function"){var r=e.cause();r&&(t+=`
Caused by: `+Xs(r))}return t}var hm=G.stdSerializers.err=function(e){if(!e||!e.stack)return e;var t={message:e.message,name:e.name,stack:Xs(e),code:e.code,signal:e.signal};return t};function jf(){var e=new Set;return function(t,r){return!r||typeof r!="object"?r:e.has(r)?"[Circular]":(e.add(r),r)}}function Vf(){var e=[];return function(t,r){return!r||typeof r!="object"?r:e.indexOf(r)!==-1?"[Circular]":(e.push(r),r)}}var Qs=typeof Set<"u"?jf:Vf;function Ks(e){try{return JSON.stringify(e)}catch{try{return JSON.stringify(e,Qs())}catch(n){if($t)return $t(e);var t=n.stack.split(/\n/g,3).join(`
`);return Xn('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n'+kf(K(`%s
%s`,Le.inspect(e),n.stack)),t),K("(Exception in JSON.stringify(rec): %j. See stderr for details.)",n.message)}}}var ue=null;Pt&&(ue=function(t){if(this.path=t.path,this.count=t.count==null?10:t.count,Re.equal(typeof this.count,"number",K('rotating-file stream "count" is not a number: %j (%s) in %j',this.count,typeof this.count,this)),Re.ok(this.count>=0,K('rotating-file stream "count" is not >= 0: %j in %j',this.count,this)),t.period){var r={hourly:"1h",daily:"1d",weekly:"1w",monthly:"1m",yearly:"1y"}[t.period]||t.period,n=/^([1-9][0-9]*)([hdwmy]|ms)$/.exec(r);if(!n)throw new Error(K('invalid period: "%s"',t.period));this.periodNum=Number(n[1]),this.periodScope=n[2]}else this.periodNum=1,this.periodScope="d";var i=null;try{var a=Oe.statSync(this.path);i=a.mtime.getTime()}catch{}var s=!1;if(i){var o=this._calcRotTime(0);i<o&&(s=!0)}this.stream=Oe.createWriteStream(this.path,{flags:"a",encoding:"utf8"}),this.rotQueue=[],this.rotating=!1,s?(this._debug("rotateAfterOpen -> call rotate()"),this.rotate()):this._setupNextRot()},Le.inherits(ue,jt),ue.prototype._debug=function(){if(0)var e;else return!1},ue.prototype._setupNextRot=function(){this.rotAt=this._calcRotTime(1),this._setRotationTimer()},ue.prototype._setRotationTimer=function(){var e=this,t=this.rotAt-Date.now(),r=2147483647;t>r&&(t=r),this.timeout=setTimeout(function(){e._debug("_setRotationTimer timeout -> call rotate()"),e.rotate()},t),typeof this.timeout.unref=="function"&&this.timeout.unref()},ue.prototype._calcRotTime=function(t){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*t:n=Date.now()+this.periodNum*t;break;case"h":this.rotAt?n=this.rotAt+this.periodNum*60*60*1e3*t:n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),r.getUTCHours()+t);break;case"d":this.rotAt?n=this.rotAt+this.periodNum*24*60*60*1e3*t:n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()+t);break;case"w":if(this.rotAt)n=this.rotAt+this.periodNum*7*24*60*60*1e3*t;else{var i=7-r.getUTCDay();t<1&&(i=-r.getUTCDay()),(t>1||t<-1)&&(i+=7*t),n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()+i)}break;case"m":this.rotAt?n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+this.periodNum*t,1):n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+t,1);break;case"y":this.rotAt?n=Date.UTC(r.getUTCFullYear()+this.periodNum*t,0,1):n=Date.UTC(r.getUTCFullYear()+t,0,1);break;default:Re.fail(K('invalid period scope: "%s"',this.periodScope))}if(this._debug()){this._debug("  **rotAt**: %s (utc: %s)",n,new Date(n).toUTCString());var a=Date.now();this._debug("        now: %s (%sms == %smin == %sh to go)",a,n-a,(n-a)/1e3/60,(n-a)/1e3/60/60)}return n},ue.prototype.rotate=function(){var t=this;if(t.rotAt&&t.rotAt>Date.now())return t._setRotationTimer();if(this._debug("rotate"),t.rotating)throw new TypeError("cannot start a rotation when already rotating");t.rotating=!0,t.stream.end();function r(){var s=t.path+"."+String(a-1);a===0&&(s=t.path),a-=1,t._debug("  rm %s",s),Oe.unlink(s,function(o){n()})}function n(){if(t.count===0||a<0)return i();var s=t.path,o=t.path+"."+String(a);a>0&&(s+="."+String(a-1)),a-=1,Oe.exists(s,function(u){u?(t._debug("  mv %s %s",s,o),Pt(s,o,function(l){l?(t.emit("error",l),i()):n()})):n()})}function i(){t._debug("  open %s",t.path),t.stream=Oe.createWriteStream(t.path,{flags:"a",encoding:"utf8"});for(var s=t.rotQueue,o=s.length,u=0;u<o;u++)t.stream.write(s[u]);t.rotQueue=[],t.rotating=!1,t.emit("drain"),t._setupNextRot()}var a=this.count;r()},ue.prototype.write=function(t){return this.rotating?(this.rotQueue.push(t),!1):this.stream.write(t)},ue.prototype.end=function(t){this.stream.end()},ue.prototype.destroy=function(t){this.stream.destroy()},ue.prototype.destroySoon=function(t){this.stream.destroySoon()});function ht(e){this.limit=e&&e.limit?e.limit:100,this.writable=!0,this.records=[],jt.call(this)}Le.inherits(ht,jt);ht.prototype.write=function(e){if(!this.writable)throw new Error("RingBuffer has been ended already");return this.records.push(e),this.records.length>this.limit&&this.records.shift(),!0};ht.prototype.end=function(){arguments.length>0&&this.write.apply(this,Array.prototype.slice.call(arguments)),this.writable=!1};ht.prototype.destroy=function(){this.writable=!1,this.emit("close")};ht.prototype.destroySoon=function(){this.destroy()};Z.exports=G;Z.exports.TRACE=Qn;Z.exports.DEBUG=Kn;Z.exports.INFO=Vt;Z.exports.WARN=Dr;Z.exports.ERROR=wr;Z.exports.FATAL=Zn;Z.exports.resolveLevel=Yt;Z.exports.levelFromName=ft;Z.exports.nameFromLevel=zs;Z.exports.VERSION=Nf;Z.exports.LOG_VERSION=Gs;Z.exports.createLogger=function(t){return new G(t)};Z.exports.RingBuffer=ht;Z.exports.RotatingFileStream=ue;Z.exports.safeCycles=Qs});var to=I((pm,eo)=>{var Uf=Object.prototype.hasOwnProperty,qf=Object.prototype.toString,Hf=function(e){var t=typeof e=="function"&&!(e instanceof RegExp)||qf.call(e)==="[object Function]";return!t&&typeof window<"u"&&(t=e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt),t};eo.exports=function(t,r){if(!Hf(r))throw new TypeError("iterator must be a function");var n,i,a=typeof t=="string",s=t.length,o=arguments.length>2?arguments[2]:null;if(s===+s)for(n=0;n<s;n++)o===null?r(a?t.charAt(n):t[n],n,t):r.call(o,a?t.charAt(n):t[n],n,t);else for(i in t)Uf.call(t,i)&&(o===null?r(t[i],i,t):r.call(o,t[i],i,t))}});var io=I((gm,no)=>{var ro=Object.prototype.toString;no.exports=function(t){var r=ro.call(t),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&ro.call(t.callee)==="[object Function]"),n}});var so=I((vm,ao)=>{(function(){"use strict";var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=to(),n=io(),i=!{toString:null}.propertyIsEnumerable("toString"),a=function(){}.propertyIsEnumerable("prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],o;o=function(l){var f=l!==null&&typeof l=="object",g=t.call(l)==="[object Function]",d=n(l),h=[];if(!f&&!g&&!d)throw new TypeError("Object.keys called on a non-object");if(d)r(l,function(p){h.push(p)});else{var m,S=a&&g;for(m in l)!(S&&m==="prototype")&&e.call(l,m)&&h.push(m)}if(i){var R=l.constructor,w=R&&R.prototype===l;r(s,function(p){!(w&&p==="constructor")&&e.call(l,p)&&h.push(p)})}return h},ao.exports=o})()});var uo=I((ym,oo)=>{oo.exports=Object.keys||so()});var co=I((Sm,lo)=>{lo.exports=Bf;function Bf(e){return e!==null&&(typeof e=="object"||typeof e=="function")}});var ei=I((_m,fo)=>{var Gf=uo(),Wf=co();fo.exports=zf;function zf(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];if(Wf(r))for(var n=Gf(r),i=0;i<n.length;i++){var a=n[i];e[a]=r[a]}}return e}});var go=I((bm,po)=>{"use strict";var ho={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},mo={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},ti={};Object.keys(ho).forEach(function(e){ti[e]=function(t){return"\x1B["+ho[e]+"m"+t+"\x1B[39m"}});Object.keys(mo).forEach(function(e){ti[e]=function(t){return"\x1B["+mo[e]+"m"+t+"\x1B[49m"}});po.exports=ti});var So=I((Dm,yo)=>{"use strict";var ri={reset:[0,22],bright:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],blink:[5,25],inverse:[7,27]},vo={};Object.keys(ri).forEach(function(e){vo[e]=function(t){var r=ri[e][0],n=ri[e][1];return"\x1B["+r+"m"+t+"\x1B["+n+"m"}});yo.exports=vo});var Yo=I((wm,Po)=>{"use strict";var wo=require("util"),Pe=wo.format,Jf=require("http"),Xf=ei(),Qf=go(),Kf=So(),Zf=Xf(Kf,Qf),Eo=1,Ao=2,Oo=3,Ro=4,Lo=5,To=6,ed={long:Eo,json:Ao,inspect:Oo,simple:Ro,short:Lo,bunyan:To},Co=10,Mo=20,Fo=30,xo=40,No=50,Io=60,_o={trace:Co,debug:Mo,info:Fo,warn:xo,error:No,fatal:Io},td={},ko={},$o={};Object.keys(_o).forEach(function(e){var t=_o[e];td[t]=e,ko[t]=e.toUpperCase(),$o[t]=(e.length===4?" ":"")+e.toUpperCase()});function bo(e){return!(e.v===null||e.level===null||e.name===null||e.hostname===null||e.pid===null||e.time===null||e.msg===null)}function mt(e){return"  "+e.split(/\r?\n/).join(`
  `)}function rd(e,t){if(!e)return"";var r=Zf[t];return r?r(e):e}function nd(e,t){return e}function Do(e){switch(e){case Co:return"TRACE";case Mo:return"DEBUG";case Fo:return"INFO";case xo:return"WARN";case No:return"ERROR";case Io:return"FATAL"}}Po.exports=function(t,r){function n(F){var D="";if(F.header)D+=F.header.trimRight();else if(F.headers){F.statusCode&&(D+=Pe(`HTTP/1.1 %s %s
`,F.statusCode,Jf.STATUS_CODES[F.statusCode]));var A=F.headers;D+=Object.keys(A).map(function(c){return c+": "+A[c]}).join(`
`)}delete F.header,delete F.headers,delete F.statusCode,F.body&&(D+=`

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

`+(typeof T.body=="object"?JSON.stringify(T.body,null,2):T.body),delete T.body),T.trailers&&Object.keys(T.trailers)>0&&(h+=`
`+Object.keys(T.trailers).map(function(F){return F+": "+T.trailers[F]}).join(`
`)),delete T.trailers,p.push(mt(h)),Object.keys(T).forEach(function(F){t["req."+F]=T[F]})}if(t.client_req&&typeof t.client_req=="object"){var M=t.client_req;delete t.client_req,m=M.headers,h="",M.address&&(S="Host: "+M.address,M.port&&(S+=":"+M.port),S+=`
`),delete M.headers,delete M.address,delete M.port,h+=Pe(`%s %s HTTP/%s
%s%s`,M.method,M.url,M.httpVersion||"1.1",S,m?Object.keys(m).map(function(F){return F+": "+m[F]}).join(`
`):""),delete M.method,delete M.url,delete M.httpVersion,M.body&&(h+=`

`+(typeof M.body=="object"?JSON.stringify(M.body,null,2):M.body),delete M.body),Object.keys(M).forEach(function(F){t["client_req."+F]=M[F]}),p.push(mt(h))}t.res&&typeof t.res=="object"&&(n(t.res),delete t.res),t.client_res&&typeof t.client_res=="object"&&(n(t.client_res),delete t.res),t.err&&t.err.stack&&(p.push(mt(t.err.stack)),delete t.err);for(var E=Object.keys(t),$=0;$<E.length;$++){var N=E[$],C=t[N],V=!1;typeof C!="string"&&(C=JSON.stringify(C,null,2),V=!0),C.indexOf(`
`)!==-1||C.length>50?p.push(mt(N+": "+C)):!V&&(C.indexOf(" ")!=-1||C.length===0)?w.push(N+"="+JSON.stringify(C)):w.push(N+"="+C)}return w=o(w.length?" ("+w.join(", ")+")":"","brightBlack"),p=o(p.length?p.join(`
  --
`)+`
`:"","brightBlack"),i?Pe(`%s %s %s:%s%s
%s`,a,f,l,L,w,p):Pe(`%s %s: %s on %s%s:%s%s
%s`,a,f,l,R||"<no-hostname>",d,L,w,p);case Oo:return wo.inspect(t,!1,1/0,!0)+`
`;case To:return r.levelInString&&(t.level=Do(t.level)),JSON.stringify(t,null,0)+`
`;case Ao:return r.levelInString&&(t.level=Do(t.level)),JSON.stringify(t,null,r.jsonIndent)+`
`;case Ro:return bo(t)?Pe(`%s - %s
`,ko[t.level]||"LVL"+t.level,t.msg):s+`
`;default:throw new Error("unknown output mode: "+r.outputMode)}}});var Uo=I((Em,Vo)=>{"use strict";var id=require("stream"),ad=require("util"),sd=Yo(),od=ei(),jo=id.Writable;Vo.exports=Ut;ad.inherits(Ut,jo);function Ut(e,t){if(!(this instanceof Ut))return new Ut(e,t);e=e||{},e.objectMode=!0,jo.call(this,e),this.opts=od({outputMode:"short",color:!0,colorFromLevel:{10:"brightBlack",20:"brightBlack",30:"green",40:"magenta",50:"red",60:"brightRed"}},e),this.out=t||process.stdout}Ut.prototype._write=function(e,t,r){var n;try{n=JSON.parse(e),this.out.write(sd(n,this.opts))}catch{this.out.write(e)}r()}});var vd={};au(vd,{default:()=>Er});module.exports=su(vd);var ou=e=>{let t=e.locals.csrfToken||"csrfToken",r=e.locals.user?.uuid?e.locals.user.uuid:"userId",n=e.locals.user?.token?e.locals.user.token:"token",i=e.locals.user?.activeCaseLoadId||"",a=e.locals.pathSuffix||"",s=e.locals.routePrefix||"",o=e.locals.definitions||[],u=e.locals.requestedReports||[],l=e.locals.recentlyViewedReports||[],f=e.locals.bookmarks||[],{bookmarkingEnabled:g,downloadingEnabled:d,definitionsPath:h,dpdPathFromQuery:m,dpdPathFromConfig:S,nestedBaseUrl:R}=e.locals;return{csrfToken:t,userId:r,token:n,definitions:o,requestedReports:u,recentlyViewedReports:l,bookmarks:f,bookmarkingEnabled:g,downloadingEnabled:d,dpdPathFromQuery:m,dpdPathFromConfig:S,definitionsPath:h,pathSuffix:a,routePrefix:s,activeCaseLoadId:i,nestedBaseUrl:R}},uu=(e,t)=>(t&&(e.query={...e.query,dataProductDefinitionsPath:t}),e.query),me={getValues:ou,setDdpPathToReqQuery:uu};var Ko=ie(Ei());var Go=ie(Nr());var Ir="~clear~",Ku=(e,t,r)=>{let n;t?(n={...e,selectedPage:"1"},Object.keys(t).forEach(a=>{t[a]?n[a]=t[a]:Object.keys(n).filter(s=>s===a||s.startsWith(`${a}.`)).forEach(s=>{n[s]=Ir})})):n={selectedPage:"1",pageSize:e.pageSize,sortColumn:e.sortColumn,sortedAsc:e.sortedAsc,dataProductDefinitionsPath:e.dataProductDefinitionsPath};let i={};return Object.keys(n).filter(a=>n[a]).forEach(a=>{i[a]=n[a]}),Zu(i,r)},Zu=(e,t)=>`?${Object.keys(e).flatMap(n=>{let i=t?.find(s=>`filters.${s.name}`===n),a=e[n];return Array.isArray(a)?a.map(s=>`${encodeURI(n)}=${encodeURI(s)}`):i&&i.filter.type.toLowerCase()==="Multiselect".toLowerCase()?a.split(",").map(o=>`${encodeURI(n)}=${encodeURI(o)}`):[`${encodeURI(n)}=${encodeURI(a)}`]}).join("&")}`,Mi=e=>e&&e!==""?`?dataProductDefinitionsPath=${e}`:"";var St=Ku;var Fi=(e,t)=>e.includes(t)?e:e.concat(t);var el=e=>e.filter(t=>t.mandatory).map(t=>t.name),tl=e=>e.filter(t=>t.visible).map(t=>t.name),xi=(e,t)=>[...el(e),...t].reduce(Fi,[]),Kt={getColumns:(e,t=null)=>{let{fields:r}=e;return{name:"columns",options:r.filter(i=>!e.sections||!e.sections.includes(i.name)).map(i=>({text:i.display,value:i.name,disabled:i.mandatory})),text:"Select report columns",value:xi(r,t??tl(r))}},ensureMandatoryColumns:xi};var ye="filters.",_t=class{constructor({fields:t,template:r,queryParams:n,definitionsPath:i,filtersPrefix:a=ye}){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(t),this.sortedAsc=n.sortedAsc!=="false",this.dataProductDefinitionsPath=i??(n.dataProductDefinitionsPath?n.dataProductDefinitionsPath.toString():null),this.filtersPrefix=a,n.columns){let l=typeof n.columns=="string"?n.columns.split(","):n.columns;this.columns=Kt.ensureMandatoryColumns(t,l)}else this.columns=t.filter(l=>l.visible).map(l=>l.name);let s,o,u=t.find(l=>l.type==="date"&&l.filter&&l.filter.type==="daterange"||l.type==="date"&&l.filter&&l.filter.type==="date");u&&({min:s,max:o}=u.filter),this.filters={},Object.keys(n).filter(l=>l.startsWith(this.filtersPrefix)).filter(l=>n[l]).forEach(l=>{let f=l.replace(this.filtersPrefix,""),g=n[l].toString();f.includes(".start")&&s&&new Date(g)<new Date(s)&&(g=s),f.includes(".end")&&o&&new Date(g)>new Date(o)&&(g=o),g!=="no-filter"&&(this.filters[f]=g)}),u&&u.filter.type==="daterange"&&(s&&Object.keys(n).some(l=>l.includes(this.filtersPrefix))&&Object.keys(n).every(l=>!l.includes(".start"))&&(this.filters[`${u.name}.start`]=s),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"&&s&&Object.keys(n).some(l=>l.includes(this.filtersPrefix))&&Object.keys(n).every(l=>!l.includes(u.name))&&(this.filters[`${u.name}.start`]=s)}getDefaultSortColumn(t){let r=t.find(n=>n.defaultsort);return r?r.name:t.find(n=>n.sortable)?.name}toRecordWithFilterPrefix(t=!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 i=this.filters[n];(!t||i!==Ir)&&(r[`${this.filtersPrefix}${n}`]=i)}),r}getDefaultPageSize(t){switch(t){case"list-section":case"summary-section":case"row-section-child":case"parent-child":return 5e4;default:return 20}}};var Zt="selectedPage",rl="pageSize",nl=1,il=20,al=(e,t,r,n,i)=>{let a=Math.ceil(r/n),s=[];return Array(a).fill(0).forEach((o,u)=>{let l=u+1;t.set(Zt,`${l}`),l===1||l===a||l>=i-1&&l<=i+1?s.push({number:l,href:`${e}?${t.toString()}`,current:l===i}):(l===2||l===a-1)&&s.push({ellipsis:!0})}),{pages:s,pagesLength:a}},sl=(e,t,r,n,i)=>{let a=new URLSearchParams(t);if(n>0){if(i===r)return;let s=i+1;return a.set(Zt,`${s}`),`${e}?${a.toString()}`}},ol=(e,t,r)=>{let n=new URLSearchParams(t);if(r===1)return;let i=r-1;return n.set(Zt,`${i}`),`${e}?${n.toString()}`},ul=e=>{let t=[10,20,100,200,e];return t.map((r,n)=>n===t.length-1?{value:e,text:"All"}:{value:r,text:r.toString()})},Ni={getPaginationData:(e,t,r)=>{let{search:n}=e,i=n?r.originalUrl.split(n)[0]:r.originalUrl,a=new URLSearchParams(n),s=+a.get(rl)||il,o=+a.get(Zt)||nl,{pages:u,pagesLength:l}=al(i,a,t,s,o);return{next:sl(i,n,l,t,o),prev:ol(i,n,o),pages:u,pageSize:s,currentPage:o,totalRows:t,sizes:ul(t)}}};var Ii={getTotals:(e,t,r,n)=>{let i="",a=(t-1)*e,s=a+n;return a===0&&r===s?i=r===1?`${r} total result`:`${r} total results`:i=r>0?`Showing <strong>${a+1}</strong> to <strong>${s}</strong> of <strong>${r}</strong> results`:"0-0 of 0",i}};var Ke={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 ll=({refresh:e,print:t,share:r,copy:n,download:i})=>{let a=[];return e&&e.url&&e.executionId&&a.push(cl(Ke.refresh,e)),t&&a.push(ml(Ke.printable,t)),r&&a.push(fl(Ke.sharable,r)),n&&a.push(dl(Ke.copy,n)),i&&a.push(hl(Ke.downloadable,i)),a},cl=(e,t)=>{let{url:r}=t;return{...e,href:r}},fl=(e,t)=>{let{reportName:r,name:n,url:i}=t,a=`mailto:?subject=${r}-${n}&body=${encodeURIComponent(i)}`;return{...e,href:a}},dl=(e,t)=>{let{url:r}=t;return{...e,href:r}},hl=(e,t)=>{let{canDownload:r,enabled:n}=t,{tooltipText:i,ariaLabelText:a}=e;return{...e,tooltipText:r?i:"Enable download",disabled:!n,attributes:{...t},ariaLabelText:n?a:`${a}, disabled`}},ml=(e,t)=>{let{enabled:r}=t,{ariaLabelText:n}=e;return{...e,disabled:!r,href:"#",ariaLabelText:r?n:`${n}, disabled`}},ki={getActions:ll};var ae=ie(bt()),ji=ie(Dt()),Vi=ie($i());var Ur=(e,t,r)=>{let{min:n,max:i}=e,a;n?a=Pi(n,t):a=t;let s;return i?s=Yi(i,r):s=r,{start:a,end:s}},Pi=(e,t)=>{let r=new Date(e);return new Date(t)<r?e:t},Yi=(e,t)=>{let r=new Date(e);return new Date(t)>r?e:t},pl=e=>{let{min:t,max:r,defaultValue:n}=e,i,a;t&&(i=t),r&&(a=r);let s=/^\d{1,4}-\d{1,2}-\d{2,2} - \d{1,4}-\d{1,2}-\d{1,2}$/,o;return n&&n.match(s)?([i,a]=n.split(" - "),o=Ur(e,i,a)):n?o=n:o=Ur(e,i,a),o};function gl(e){return e.start!==void 0||e.end!==void 0}var je={compareMax:Yi,compareMin:Pi,isDateRange:gl,setDateRangeValuesWithinMinMax:Ur,getStartAndEndValueFromDefinition:pl};ae.default.extend(ji.default);var vl=(e,t,r,n)=>{ae.default.extend(Vi.default);let i=(0,ae.default)(r),a=(0,ae.default)(n),s=e?e.isBetween(i,a,"day","[]"):!0,o=t?t.isBetween(i,a,"day","[]"):!0;return s&&o},Ui=e=>{let t,r;switch(e){case"none":t="",r="";break;case"yesterday":t=(0,ae.default)(),r=t.subtract(1,"day");break;case"tomorrow":r=(0,ae.default)(),t=r.add(1,"day");break;case"last-week":t=(0,ae.default)(),r=t.subtract(1,"week");break;case"next-week":r=(0,ae.default)(),t=r.add(1,"week");break;case"last-month":t=(0,ae.default)(),r=t.subtract(1,"month");break;case"next-month":r=(0,ae.default)(),t=r.add(1,"month");break;default:break}return{endDate:t,startDate:r}},yl=(e,t,r)=>{let n=t.query[`${r}${e.name}.start`],i=t.query[`${r}${e.name}.end`],a=t.query[`${r}${e.name}.relative-duration`];return{start:n||e.min,end:i||e.max,...a&&{relative:a}}},Sl=(e,t)=>{let r=t.split(".")[0],n=Object.keys(e.body).filter(a=>a.includes(r)).map(a=>({name:a,value:e.body[a]})),i={start:"",end:""};return n.forEach(a=>{a.name.includes("start")&&(i.start=a.value),a.name.includes("end")&&(i.end=a.value)}),{value:i,name:r}},_l=(e,t)=>{let r={start:"",end:""},{start:n,end:i}=e.value;return n&&(r.start=(0,ae.default)(n,"D/M/YYYY").format("YYYY-MM-DD").toString()),i&&(r.end=(0,ae.default)(i,"D/M/YYYY").format("YYYY-MM-DD").toString()),{...t,value:r}},qi=(e,t)=>{e||(e="1977-05-25"),t||(t="9999-01-01");let r=Hi();return r.forEach(n=>{if(n.value){let{endDate:i,startDate:a}=Ui(n.value);vl(a,i,e,t)||(n.disabled=!0)}}),r.filter(n=>n.value!=="none").every(n=>n.value===null||n.disabled)&&(r=[]),r},bl=e=>{let r=Hi().find(n=>n.value===e);return r?r.text:""},Hi=()=>[{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"}],Dl=(e,t)=>{let r=je.getStartAndEndValueFromDefinition(e),n=qi(e.min,e.max);return{...t,min:e.min,max:e.max,relativeOptions:n,value:r}},wl=(e,t,r)=>{let n=e.defaultValue.split(" - "),i;return n.length>=1&&(i=`${r}${t}.start=${n[0]}`,n.length>=2&&(i=`${i}&${r}${t}.end=${n[1]}`)),i},we={calcDates:Ui,getRelativeDateOptions:qi,getFilterFromDefinition:Dl,setValueFromRequest:yl,getQueryFromDefinition:wl,mapRelativeValue:bl,setDefaultValue:Sl,setFilterValueFromDefault:_l};var El=(e,t)=>{let r=[void 0,null,""];return e.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 i=`${n.value}`,a=[`"${i}"`],s=[`${t}${n.name}`],o="",u=!1,l;n.type.toLowerCase()==="DateRange".toLowerCase()&&({key:s,value:a,disabled:u,cantRemoveClass:o,displayValue:i,constraints:l}=Bi(n,t)),n.type.toLowerCase()==="GranularDateRange".toLowerCase()&&({key:s,value:a,disabled:u,cantRemoveClass:o,displayValue:i,constraints:l}=zi(n,t)),n.type.toLowerCase()==="Date".toLowerCase()&&({key:s,value:a,disabled:u,cantRemoveClass:o,displayValue:i,constraints:l}=Al(n,t)),(n.type.toLowerCase()==="Autocomplete".toLowerCase()||n.type.toLowerCase()==="Radio".toLowerCase()||n.type.toLowerCase()==="Select".toLowerCase())&&({key:s,value:a,displayValue:i}=Gi(n,t)),n.type.toLowerCase()==="Multiselect".toLowerCase()&&({key:s,value:a,displayValue:i}=Wi(n,t));let f;return u?f=`Selected Filter: ${n.text}: ${i}. This filter cant be removed. Update the filter input to change the value`:f=`Selected Filter: ${n.text}: ${i}. Click to clear this filter`,{text:n.text,displayValue:i,key:JSON.stringify(s),value:a,disabled:u,constraints:l,classes:`interactive-remove-filter-button${o}`,attributes:{"aria-label":f}}})},Bi=(e,t)=>{let r=e.value.start||"Open start",n=e.value.end||"Open end",i=`${t}${e.name}`,a=[`${i}.start`,`${i}.end`],s=[`"${r}"`,`"${n}"`],o=`${r} - ${n}`;e.value.relative&&(a.push(`${i}.relative-duration`),s.push(`"${e.value.relative}"`),o=we.mapRelativeValue(e.value.relative));let u=qr(e,a),{disabled:l,cantRemoveClass:f,displayValue:g}=Ji(e,s,o);return{key:a,value:s,displayValue:g||o,disabled:l,cantRemoveClass:f,constraints:u}},qr=(e,t,r=!1)=>{let n=[],{min:i,max:a}=e;return i&&n.push({key:t[0],value:i}),a&&!r&&n.push({key:t[1],value:a}),n.length?n:void 0},Gi=(e,t)=>{let n=e.options.find(s=>s.value===e.value).text,i=[`${t}${e.name}`],a=[`"${e.value}"`];return{key:i,value:a,displayValue:n}},Wi=(e,t)=>{let n=e.value.split(","),i=n.map(o=>e.options.find(l=>l.value===o).text).filter((o,u)=>u<3).join(", ");i=n.length>3?`${i} + ${n.length-3} more`:i;let a=n.map(o=>`"${o}"`);return{key:[`${t}${e.name}`],value:a,displayValue:i}},zi=(e,t)=>{let r=e.value.start||"Open start",n=e.value.end||"Open end",i=e.value.quickFilter?.value,a=`${t}${e.name}`,s=[`${a}.start`,`${a}.end`,`${a}.granularity`],o=[`"${r}"`,`"${n}"`,`"${e.value.granularity.value}"`],u=qr(e,s),l,f=e.value.granularity.display;i&&i!=="none"?(s.push(`${a}.quick-filter`),o.push(`"${e.value.quickFilter.value}"`),l=`${e.value.quickFilter.display}: ${f}`):l=`${r} - ${n}: ${f}`;let{disabled:g,cantRemoveClass:d,displayValue:h}=Ji(e,o,l);return{key:s,value:o,displayValue:h||l,disabled:g,constraints:u,cantRemoveClass:d}},Al=(e,t)=>{let r=[`${t}${e.name}`],n=`${e.value}`,i=[`"${n}"`],a=qr(e,r,!0),{disabled:s,cantRemoveClass:o,displayValue:u}=Ol(e,i,n);return{key:r,value:i,displayValue:u||n,disabled:s,constraints:a,cantRemoveClass:o}},Ji=(e,t,r)=>{let{min:n,max:i}=e;return n&&t[0].includes(n)&&i&&t[1].includes(i)?{disabled:!0,cantRemoveClass:" interactive-remove-filter-button--disabled",displayValue:`${r} (maximum range)`}:{disabled:!1,cantRemoveClass:"",displayValue:r}},Ol=(e,t,r)=>{let{min:n,max:i}=e;if(n&&t[0].includes(n)||i&&t[0].includes(i)){let a;return t[0].includes(n)&&(a="min"),t[0].includes(i)&&(a="max"),{disabled:!0,cantRemoveClass:" interactive-remove-filter-button--disabled",displayValue:`${r} (${a} date)`}}return{disabled:!1,cantRemoveClass:"",displayValue:r}},Rl=(e,t)=>{let{query:r}=e,n="filters.";return t.filter(i=>r[`filters.${i.name}`]||r[`filters.${i.name}.start`]||r[`filters.${i.name}.end`]).map(i=>{let{value:a}=i;return i.type.toLowerCase()==="Multiselect".toLowerCase()&&(a=Wi(i,"filters").displayValue),(i.type.toLowerCase()==="Autocomplete".toLowerCase()||i.type.toLowerCase()==="Radio".toLowerCase()||i.type.toLowerCase()==="Select".toLowerCase())&&(a=Gi(i,n).displayValue),i.type.toLowerCase()==="DateRange".toLowerCase()&&(a=Bi(i,n).displayValue),i.type.toLowerCase()==="GranularDateRange".toLowerCase()&&(a=zi(i,n).displayValue),{id:i.name,name:i.text,value:a}})},Xi={getSelectedFilters:El,getQuerySummary:Rl};var Hr=ie(bt()),Qi=ie(Dt());Hr.default.extend(Qi.default);var Ki=e=>{let{defaultValue:t,min:r,max:n}=e,i;return t&&(i=t,r&&(i=je.compareMin(r,i)),n&&(i=je.compareMax(n,i))),i},Ll=(e,t,r)=>{let{min:n,max:i,mandatory:a}=e,s=t.query[`${r}${e.name}`],o=s;return a&&!s&&(o=n||i||"1977-05-25"),o},Tl=(e,t)=>{let r=e.value?(0,Hr.default)(e.value,"D/M/YYYY").format("YYYY-MM-DD").toString():"";return{...t,value:r}},Cl=(e,t)=>({...t,value:Ki(e),min:e.min,max:e.max}),er={setDateValueWithinMinMax:Ki,getFilterFromDefinition:Cl,setValueFromRequest:Ll,setFilterValueFromDefault:Tl};var j=ie(bt()),Zi=ie(Dt());j.default.extend(Zi.default);var Br=(e,t,r)=>{let n,i;switch(e){case"daily":n=!1,i=!1;break;case"monthly":{let a=(0,j.default)(t).startOf("month"),s=(0,j.default)(r).endOf("month");n=!a.isSame(t,"day"),i=!s.isSame(r,"day")}break;case"annually":{let a=(0,j.default)(t).startOf("year"),s=(0,j.default)(r).endOf("year");n=!a.isSame(t,"day"),i=!s.isSame(r,"day")}break;default:n=!1,i=!1;break}return{start:n,end:i}},Gr=()=>[{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"}],Wr=()=>[{value:"hourly",text:"Hourly"},{value:"daily",text:"Daily"},{value:"monthly",text:"Monthly"},{value:"annually",text:"Annually"}],Ml=(e,t)=>{let r=t,n=["annually","monthly"],i=["annually"];return e.includes("month")&&i.includes(e)&&(r="monthly"),e.includes("day")&&n.includes(e)&&(r="daily"),r},zr=e=>{let t,r,n;switch(e){case"today":r=(0,j.default)(),t=(0,j.default)(),n="daily";break;case"yesterday":r=(0,j.default)().subtract(1,"day"),t=(0,j.default)().subtract(1,"day"),n="daily";break;case"last-seven-days":r=(0,j.default)(),t=r.subtract(7,"day").add(1,"day"),n="daily";break;case"last-thirty-days":r=(0,j.default)(),t=r.subtract(30,"day").add(1,"day"),n="daily";break;case"last-month":r=(0,j.default)(),t=r.subtract(1,"month").add(1,"day"),n="monthly";break;case"last-full-month":r=(0,j.default)().subtract(1,"month").endOf("month"),t=r.startOf("month"),n="monthly";break;case"last-ninety-days":r=(0,j.default)(),t=r.subtract(90,"day").add(1,"day"),n="daily";break;case"last-three-months":r=(0,j.default)(),t=r.subtract(3,"month").add(1,"day"),n="monthly";break;case"last-full-three-months":r=(0,j.default)().subtract(1,"month").endOf("month"),t=r.subtract(2,"month").startOf("month"),n="monthly";break;case"last-six-months":r=(0,j.default)(),t=r.subtract(6,"month").add(1,"day"),n="monthly";break;case"last-full-six-months":r=(0,j.default)().subtract(1,"month").endOf("month"),t=r.subtract(6,"month").startOf("month"),n="monthly";break;case"last-year":r=(0,j.default)(),t=r.subtract(1,"year").add(1,"day"),n="annually";break;case"last-full-year":r=(0,j.default)().subtract(1,"year").endOf("year"),t=r.startOf("year"),n="annually";break;case"tomorrow":r=(0,j.default)().add(1,"day"),t=(0,j.default)().add(1,"day"),n="daily";break;case"next-seven-days":t=(0,j.default)(),r=(0,j.default)().add(7,"day").subtract(1,"day"),n="daily";break;case"next-thirty-days":t=(0,j.default)(),r=(0,j.default)().add(30,"day").subtract(1,"day"),n="daily";break;case"next-month":t=(0,j.default)(),r=(0,j.default)().add(1,"month").subtract(1,"day"),n="monthly";break;case"next-full-month":t=(0,j.default)().add(1,"month").startOf("month"),r=t.endOf("month"),n="monthly";break;case"next-ninety-days":t=(0,j.default)(),r=(0,j.default)().add(90,"day").subtract(1,"day"),n="daily";break;case"next-three-months":t=(0,j.default)(),r=(0,j.default)().add(3,"month").subtract(1,"day"),n="monthly";break;case"next-full-three-months":t=(0,j.default)().add(1,"month").startOf("month"),r=t.add(2,"month").endOf("month"),n="monthly";break;case"next-year":t=(0,j.default)(),r=(0,j.default)().add(1,"year").subtract(1,"day"),n="annually";break;case"next-full-year":t=(0,j.default)().add(1,"year").startOf("year"),r=t.endOf("year"),n="annually";break;default:r=(0,j.default)(),t=(0,j.default)(),n="daily";break}return{start:t.format("YYYY-MM-DD").toString(),end:r.format("YYYY-MM-DD").toString(),granularity:n}},wt=(e,t)=>t.find(n=>n.value===e).text||e,Fl=(e,t,r)=>{let{preventDefault:n}=t.query,i=t.query[`${r}${e.name}.quick-filter`],a=t.query[`${r}${e.name}.granularity`],s,o;i&&i!=="none"?({start:s,end:o}=zr(i),a=Ml(i,a)):(a=t.query[`${r}${e.name}.granularity`],s=t.query[`${r}${e.name}.start`],o=t.query[`${r}${e.name}.end`]);let u=n?null:e.value?.start,l=n?null:e.value?.end,f=n?"daily":e.value?.granularity.value,g=n?"none":e.value?.quickFilter.value,d=Wr(),h=Gr(),m=s||u||e.min,S=o||l||e.max,R=a||f,w=i||g;return{start:m,end:S,granularity:{value:R,display:wt(R,d)},quickFilter:{value:w,display:wt(w,h)},partialDate:{...Br(R,m,S)}}},xl=(e,t)=>{let r=t.split(".")[0],n=Object.keys(e.body).filter(a=>a.includes(r)).map(a=>({name:a,value:e.body[a]})),i={start:"",end:"",granularity:null,quickFilter:null};return n.forEach(a=>{a.name.includes("start")&&(i.start=a.value),a.name.includes("end")&&(i.end=a.value),a.name.includes("granularity")&&(i.granularity=a.value),a.name.includes("granularity")&&(i.quickFilter=a.value)}),i=i.start!==""&&i.end!==""&&i.granularity&&i.quickFilter?i:"",{value:i,name:r}},Nl=(e,t)=>{let{granularity:r,quickFilter:n,start:i,end:a}=e.value,s={start:i?(0,j.default)(i,"D/M/YYYY").format("YYYY-MM-DD").toString():"",end:a?(0,j.default)(a,"D/M/YYYY").format("YYYY-MM-DD").toString():"",granularity:{value:r,display:t.granularityOptions.find(o=>o.value===r)?.text},quickFilter:{value:n,display:t.quickFilterOptions.find(o=>o.value===n)?.text}};return{...t,value:s}},Il=(e,t)=>{let r,n=e.defaultQuickFilterValue,i=Wr(),a=Gr();if(n){let{start:s,end:o,granularity:u}=zr(n);r={start:s,end:o,granularity:{value:u,display:wt(u,i)},quickFilter:{value:n,display:wt(n,a)},partialDate:{...Br(u,s,o)}}}else{r=je.getStartAndEndValueFromDefinition(e);let s=r.granularity?r.granularity.value:e.defaultGranularity||"daily";r={...r,granularity:{value:s,display:wt(s,i)},quickFilter:{value:"none",display:"None"},partialDate:{...Br(s,r.start,r.end)}}}return{...t,min:e.min,max:e.max,value:r,quickFilterOptions:Gr(),granularityOptions:Wr()}},kl=(e,t,r,n)=>{let i=[];if(e.defaultQuickFilterValue){let{start:a,end:s,granularity:o}=zr(e.defaultQuickFilterValue);i.push(`${r}${t}.quick-filter=${e.defaultQuickFilterValue}`),i.push(`${r}${t}.granularity=${o}`),i.push(`${r}${t}.start=${a}`),i.push(`${r}${t}.end=${s}`)}else e.defaultGranularity&&n?(i.push(`${r}${t}.granularity=${e.defaultGranularity}`),i.push(`${n}`)):e.defaultGranularity&&i.push(`${r}${t}.granularity=${e.defaultGranularity}`);return i.join("&")},Ze={getFilterFromDefinition:Il,setValueFromRequest:Fl,getQueryFromDefinition:kl,setDefaultValue:xl,setFilterValueFromDefault:Nl};var $l=(e,t,r)=>{let n=t.query[`${r}${e.name}`],i,a;return n?.length&&(i=Array.isArray(n)?n:[n],a=i.join(",")),{requestfilterValue:a||null,requestfilterValues:i||[]}},Pl=(e,t,r)=>(e.defaultValue?e.defaultValue.split(","):[]).map(i=>`${r}${t}=${i}`).join("&"),Yl=(e,t)=>{let n=e.value.split(","),i=n.map(o=>e.options.find(l=>l.value===o).text).filter((o,u)=>u<3).join(", ");i=n.length>3?`${i} + ${n.length-3} more`:i;let a=n.map(o=>`"${o}"`);return{key:[`${t}${e.name}`],value:a,displayValue:i}},Jr={getQueryFromDefinition:Pl,setValueFromRequest:$l,getMultiselectValues:Yl};var ea=(e,t,r="filters.")=>{let{preventDefault:n}=t.query;return Object.keys(t.query).every(i=>!i.includes(r))&&!n?e:e.map(i=>{let a,s;i.type.toLowerCase()==="DateRange".toLowerCase()?a=we.setValueFromRequest(i,t,r):i.type.toLowerCase()==="GranularDateRange".toLowerCase()?a=Ze.setValueFromRequest(i,t,r):i.type.toLowerCase()==="Date".toLowerCase()?a=er.setValueFromRequest(i,t,r):i.type.toLowerCase()==="Multiselect".toLowerCase()?{requestfilterValue:a,requestfilterValues:s}=Jr.setValueFromRequest(i,t,r):a=t.query[`${r}${i.name}`];let o=null;return a?o=a:n&&(o=null),{...i,value:o,...s&&{values:s}}})},Vl=(e,t)=>{let r=e.some(n=>t.findIndex(a=>a.name===n.name)!==-1);return e.map(n=>{let i=t.find(o=>o.name===n.name),a={...n},s=n.type.toLocaleLowerCase();if(s==="Multiselect".toLocaleLowerCase()){let o=r?"":a.value;o=i?i.value:o;let u=r?[]:a.values;u=i?i.value.split(","):u,a={...a,value:o,values:u}}else if(s==="Date".toLocaleLowerCase()){let o=r?"":a.value;i=i||{...i,value:o},a=er.setFilterValueFromDefault(i,a)}else if(s==="DateRange".toLocaleLowerCase()){let o=r?{start:"",end:""}:a.value;i=i||{...i,value:o},a=we.setFilterValueFromDefault(i,a)}else if(s==="GranularDateRange".toLocaleLowerCase()){let o=r?{start:"",end:"",granularity:"",quickFilter:""}:a.value;i=i||{...i,value:o},a=Ze.setFilterValueFromDefault(i,a)}else{let o=r?"":a.value;o=i?i.value:o,a={...n,value:o}}return a})},Ul=(e,t)=>{let r=e.filter(n=>n.filter);return t&&(r=r.filter(n=>n.filter.interactive)),r.filter(n=>n.filter&&n.filter.defaultValue).map(n=>{let{filter:i}=n;if(i.type.toLowerCase()==="DateRange".toLowerCase())return we.getQueryFromDefinition(i,n.name,ye);if(i.type.toLowerCase()==="Multiselect".toLowerCase())return Jr.getQueryFromDefinition(i,n.name,ye);if(i.type.toLowerCase()==="GranularDateRange".toLowerCase()){let a=we.getQueryFromDefinition(i,n.name,ye);return Ze.getQueryFromDefinition(i,n.name,ye,a)}return`${ye}${n.name}=${i.defaultValue}`}).join("&")},ql=async(e,t,r)=>{let{token:n,definitionsPath:i}=me.getValues(t),{reportId:a,id:s,type:o}=e.body,l=await(o==="report"?r.reportingService:r.dashboardService).getDefinition(n,a,s,i),f=o==="report"?l.variant.specification.fields:l.filterFields,g=Object.keys(e.body).filter(h=>h.includes("filters.")).map(h=>({name:h.replace("filters.",""),value:e.body[h]})).map(h=>{let m=h.name.split(".")[0],S=f.find(p=>p.name===m),{value:R,name:w}=h;if(S){let p=S.filter?.type.toLocaleLowerCase();p==="Multiselect".toLocaleLowerCase()&&(R=h.value.join(",")),p==="DateRange".toLocaleLowerCase()&&({value:R,name:w}=we.setDefaultValue(e,w)),p==="GranularDateRange".toLocaleLowerCase()&&({name:w,value:R}=Ze.setDefaultValue(e,w))}return{name:w,value:R}}),d=Array.from(new Set(g.map(h=>h.name))).map(h=>g.find(m=>m.name===h));return d=d.filter(h=>h.value!==""),d},Hl=(e,t)=>{let{activeCaseLoadId:r}=me.getValues(e);return t.forEach(n=>{n.type.toLocaleLowerCase()==="Autocomplete".toLocaleLowerCase()&&n.text.toLocaleLowerCase().includes("establishment")&&r.length&&(n.value=r)}),t},ta=(e,t)=>e.filter(r=>r.filter).filter(r=>{if(t!==void 0){let n=r.filter.interactive;return n===void 0?!t:t===n}return!0}).map(r=>{let{display:n,name:i,filter:a}=r,{type:s,staticOptions:o,dynamicOptions:u,defaultValue:l,mandatory:f,pattern:g}=a,d=o?o.map(S=>({value:S.name,text:S.display})):[],h={text:n,name:i,type:s,value:l||null,minimumLength:u?u.minimumLength:null,dynamicResourceEndpoint:null,mandatory:f||!1,pattern:g},m={value:"no-filter",text:"None",disabled:!1};switch(s){case"Autocomplete".toLowerCase():h={...h,options:d};break;case"Radio":f||d.unshift(m),h={...h,options:d};break;case"Select":{f||d.unshift(m),d.unshift({value:"",text:"Select your option",disabled:!0,selected:!0}),h={...h,options:d};break}case"Multiselect".toLowerCase():h={...h,options:d,values:l?l.split(","):[]};break;case"DateRange".toLowerCase():h=we.getFilterFromDefinition(a,h);break;case"Date".toLowerCase():h=er.getFilterFromDefinition(a,h);break;case"GranularDateRange".toLocaleLowerCase():{let S=a;h=Ze.getFilterFromDefinition(S,h);break}default:break}return h}),Bl=(e,t,r,n)=>{let i={},{fields:a}=t.specification,{preventDefault:s}=n.query;if(Object.keys(e.filters).length===0&&!s&&a.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&&(i[`${ye}${u.name}.start`]=l[0],l.length>=2&&(i[`${ye}${u.name}.end`]=l[1]))}else i[`${ye}${u.name}`]=u.filter.defaultValue}),Object.keys(i).length>0){let u=St(e.toRecordWithFilterPrefix(),i,a);return r.redirect(`${n.baseUrl}${n.path}${u}`),!0}return!1},Gl=async({fields:e,req:t,interactive:r=!1,prefix:n="filters."})=>{let i=await ta(e,r),a=ea(i,t),s=Xi.getSelectedFilters(a,n);return{filters:a,selectedFilters:s}},ra={getFiltersFromDefinition:ta,setFilterValuesFromRequest:ea,getFilters:Gl,setFilterQueryFromFilterDefinition:Ul,redirectWithDefaultFilters:Bl,setFilterValuesFromSavedDefaults:Vl,setUserDefinedDefaultValuesForReport:ql,setUserContextDefaults:Hl};var na=ie(Nr());var Et=class{constructor(t){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:t,reportId:r,reportName:n,description:i,id:a,name:s})=>(this.userStoreItem={type:t,reportId:r,reportName:n,description:i,id:a,name:s,timestamp:{}},this);this.addExecutionData=t=>(this.userStoreItem={...this.userStoreItem,...t},this);this.addChildExecutionData=t=>(this.userStoreItem={...this.userStoreItem,childExecutionData:t},this);this.addFilters=t=>{let r=new URLSearchParams(t).toString();return this.userStoreItem={...this.userStoreItem,filters:{data:t,queryString:r}},this};this.addSortData=t=>{let r=new URLSearchParams(t).toString();return this.userStoreItem={...this.userStoreItem,sortBy:{data:t,queryString:r}},this};this.addRequestUrls=t=>{let{origin:r,pathname:n,search:i,href:a,defaultInteractiveQueryString:s}=this.requestFormData,{executionId:o,dataProductDefinitionsPath:u,dpdPathFromQuery:l}=this.userStoreItem,f=l?`${Mi(u)}`:"",g=t.baseUrl.replace("/filters",`/${o}/status`),d=`${r}${g}`;return this.userStoreItem={...this.userStoreItem,url:{origin:r,request:{fullUrl:a,pathname:n,search:i},polling:{fullUrl:d,pathname:g},report:{...s?.length&&{search:f.length?`${f}&${s}`:`?${s}`,default:`?${s}`}}}},this};this.addAsyncUrls=t=>(this.userStoreItem={...this.userStoreItem,url:t},this);this.addReportUrls=t=>{let r=t.get("host"),n=`${t.protocol}://${t.get("host")}${t.originalUrl}`,i=(0,na.default)(t);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,...i.search&&{search:i.search}}}},this};this.addLoadType=t=>(this.userStoreItem={...this.userStoreItem,loadType:t},this);this.addQuery=t=>(this.userStoreItem={...this.userStoreItem,query:{data:t.query,summary:t.querySummary}},this);this.addInteractiveQuery=t=>(t&&(this.userStoreItem={...this.userStoreItem,interactiveQuery:{data:t.query,summary:t.querySummary}}),this);this.addStatus=t=>(this.userStoreItem={...this.userStoreItem,status:t},this);this.addMetrics=t=>(this.userStoreItem={...this.userStoreItem,metrics:t.map(r=>({name:r.display}))},this);this.addTimestamp=()=>{let{status:t}=this.userStoreItem,r=new Date;switch(t){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=(t,r)=>(t&&(this.userStoreItem={...this.userStoreItem,dataProductDefinitionsPath:t,dpdPathFromQuery:r}),this);this.requestFormData=t,this.requestFormData&&this.initialiseItem()}};var ze=ie(bt()),Bo=ie(Dt());var qo=ie(Zs()),Ho=ie(Uo()),ud=(0,Ho.default)({outputMode:"short",color:!1}),ld=qo.default.createLogger({name:"Digital Prison Reporting:",stream:ud,level:"debug"}),ni=ld;var qt=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(t){if(t&&t.match){if(t.match(this.isoDateRegEx))return"iso";if(t.match(this.localDateRegEx))return"local-date";if(t.match(this.localDateShortYearRegEx))return"local-date-short-year";if(t.match(this.localDateTimeRegEx))return"local-datetime";if(t.match(this.localDateTimeShortYearRegEx))return"local-datetime-short-year"}return"none"}getDateWrapper(t){switch(ze.default.extend(Bo.default),this.getDateType(t)){case"iso":return(0,ze.default)(t);case"local-date":return(0,ze.default)(t,this.localDateFormatInput);case"local-date-short-year":return(0,ze.default)(t,this.localDateShortYearFormatInput);case"local-datetime":return(0,ze.default)(t,this.localDateTimeFormatInput);case"local-datetime-short-year":return(0,ze.default)(t,this.localDateTimeShortYearFormatInput);default:return null}}isDate(t){return this.getDateType(t)!=="none"}toDateString(t,r){let n=this.getDateWrapper(t);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 ni.warn(`Invalid date type: ${r}`),null}return t&&ni.warn(`Could not map non-date value : ${t}`),null}};var Ht=class{constructor(t,r=!1){this.columns=[];this.reportSummaries={};this.reportQuery=null;this.currentQueryParams=null;this.dateMapper=new qt;this.fields=t,this.sortData=r}mapDate(t){return t?this.dateMapper.toDateString(t,"local-datetime-short-year"):""}mapBoolean(t){return t?t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase():""}mapRow(t,r="",n=[]){return this.fields.filter(i=>this.columns.includes(i.name)).map(i=>{let s=n.find(o=>o.name===i.name)??i;return this.mapCell(s,t,r)})}mapCell(t,r,n=""){let i=this.mapCellValue(t,r[t.name]),a="string",s=n;t.wordWrap&&(s+=` data-table-cell-wrap-${t.wordWrap.toLowerCase()}`),t.header&&(s+=" govuk-table__header"),(t.type==="double"||t.type==="long")&&(a="numeric");let o=t.type==="HTML";return{fieldName:t.name,...o?{html:i}:{text:i},format:a,classes:s.trim()}}mapCellValue(t,r){if(t.calculated)return r;switch(t.type){case"boolean":return this.mapBoolean(r);case"date":case"time":return this.mapDate(r);default:return r}}mapHeader(t=!1,r=null){return this.fields.filter(n=>this.columns.includes(n.name)).map(n=>{if(this.reportQuery&&!t&&n.sortable){let i="none",a=St(this.currentQueryParams,{sortColumn:n.name,sortedAsc:"true"});return n.name===this.reportQuery.sortColumn&&(i=this.reportQuery.sortedAsc?"ascending":"descending",this.reportQuery.sortedAsc&&(a=St(this.currentQueryParams,{sortColumn:n.name,sortedAsc:"false"}))),{html:`<a data-column="${n.name}" class="data-table-header-button data-table-header-button-sort-${i}" href="${a}">${n.display}</a>`,classes:r}}return{text:n.display,classes:r}})}mapData(t){let r=this.mapSummary("table-header"),n=this.mergeCells(t.map(a=>this.mapRow(a))),i=this.mapSummary("table-footer");return r.concat(n).concat(i)}mergeCells(t){let r=this.fields.filter(i=>i.mergeRows).map(i=>i.name);if(r.length===0)return t;let n={};return r.forEach(i=>{n[i]=t.reduce((a,s)=>{let o=this.getCellByFieldName(s,i),u=o.text??o.html;return{...a,[u]:(a[u]??0)+1}},{})}),t.map(i=>{let a=[...i];return r.forEach(s=>{let o=this.getCellByFieldName(i,s),u=o.text??o.html,l=n[s][u];switch(l){case-1:a=a.filter(f=>f.fieldName!==s);break;case 1:break;default:o.rowspan=l,n[s][u]=-1}}),a})}getCellByFieldName(t,r){return t.find(n=>n.fieldName===r)}mapSummary(t){return this.reportSummaries[t]?this.reportSummaries[t].flatMap(r=>r.data.map(n=>this.mapRow(n,`dpr-report-summary-cell dpr-report-summary-cell-${t}`,r.fields))):[]}sort(t){return this.appendSortKeyToData(t).sort(this.sortKeyComparison()).map(r=>({...r}))}sortKeyComparison(){return(t,r)=>{let n=t.sortKey,i=r.sortKey;return n===i?0:n<i?-1:1}}appendSortKeyToData(t,r=null){let n=r||this.fields;return t.map(i=>{let a=this.getSortKey(i,n);return{...i,sortKey:a}})}mapNamesToFields(t){return t.map(r=>this.fields.find(n=>n.name===r))}getSortKey(t,r){return r.map(n=>{let i=t[n.name];return i===null?"zzzzzzzz":this.dateMapper.isDate(i)?this.dateMapper.toDateString(i,"iso"):this.mapCellValue(n,i)}).join("-").toLowerCase()}convertDataTableToHtml(t){let r=t.head.map(i=>`<th scope='col' class='govuk-table__header'>${i.html??i.text}</th>`),n=t.rows.map(i=>`<tr class='govuk-table__row'>${i.map(a=>`<td class='govuk-table__cell govuk-table__cell--${a.format} ${a.classes}'>${a.html??a.text}</td>`).join("")}</tr>`);return`<table class='govuk-table'><thead class='govuk-table__head'>${r.join("")}</thead><tbody class='govuk-table__body'>${n.join("")}</tbody></table>`}withHeaderOptions({reportQuery:t,columns:r,interactive:n}){return n?this.withHeaderSortOptions(t):this.withNoHeaderOptions(r)}withHeaderSortOptions(t){return this.reportQuery=t,this.columns=t.columns,this.currentQueryParams=this.reportQuery.toRecordWithFilterPrefix(),this}withNoHeaderOptions(t){return this.columns=t,this}buildTable(t){let r=this.mapData(this.sortData?this.sort(t):t);return{head:this.mapHeader(),rows:r,rowCount:t.length,colCount:this.columns.length}}withSummaries(t){return this.reportSummaries=t,this}withSortedData(t=!0){return this.sortData=t,this}};var Wo=(e,t,r,n,i,a,s,o,u,l)=>{let{name:f,variant:g,id:d}=t,{name:h,id:m,printable:S}=g,R={enabled:a>0,name:h,reportName:f,csrfToken:e,reportId:d,id:m,columns:r.value,loadType:"sync",definitionPath:s,canDownload:i,currentUrl:o,currentQueryParams:u,nestedBaseUrl:l};return ki.getActions({download:R,print:{enabled:S},share:{reportName:f,name:h,url:n},copy:{url:n}})},fd=async(e,t,r,n,i,a,s,o)=>{let u={type:"report",reportId:a,id:s,reportName:r,description:i,name:n},l=new Et().addReportData(u).addStatus("READY").addTimestamp().addReportUrls(e).build();await t.recentlyViewedService.setRecentlyViewed(l,o)},zo=async({services:e,req:t,token:r,reportId:n,id:i,dataProductDefinitionsPath:a})=>{let s=await e.reportingService.getDefinition(r,n,i,a),{variant:o}=s,{resourceName:u,specification:l}=o,f=new _t({fields:l.fields,template:l.template,queryParams:t.query,definitionsPath:a});return{reportData:await e.reportingService.getListWithWarnings(u,r,f),reportDefinition:s,reportQuery:f}},dd=async({req:e,res:t,services:r})=>{let{token:n,csrfToken:i,userId:a}=me.getValues(t),{reportId:s,id:o}=e.params,u=e.query.dataProductDefinitionsPath,{reportData:l,reportDefinition:f,reportQuery:g}=await zo({services:r,req:e,token:n,reportId:s,id:o,dataProductDefinitionsPath:u}),d=await r.reportingService.getCount(f.variant.resourceName,n,g),h=await r.downloadPermissionService.downloadEnabled(a,s,o),m=await r.bookmarkService.isBookmarked(o,s,a),S=await Xo({req:e,res:t,reportDefinition:f,reportQuery:g,reportData:l,count:d,csrfToken:i,canDownload:h});return Object.keys(S).length&&fd(e,r,s,o,S.reportName,S.name,S.description,a),{renderData:{...S,csrfToken:i,loadType:"sync",reportId:s,id:o,bookmarked:m,dataProductDefinitionsPath:u}}},Jo=async(e,t,r,n,i)=>{let a=(0,Go.default)(e),s=`${e.protocol}://${e.get("host")}${e.originalUrl}`,o=a.search?e.originalUrl.split(a.search)[0]:e.originalUrl,u=Ni.getPaginationData(a,t,e),l=new Ht(r.fields).withHeaderSortOptions(n).buildTable(i),f=Ii.getTotals(u.pageSize,u.currentPage,u.totalRows,l.rowCount),g=await ra.getFilters({fields:r.fields,req:e}),d=Kt.getColumns(r,n.columns);return{dataTable:[l],totals:f,filterData:g,columns:d,pagination:u,reportUrl:o.replace("/download-disabled","").replace("/download-disabled?",""),reportSearch:a.search,encodedSearch:a.search?encodeURIComponent(a.search):void 0,fullUrl:s}},Xo=async({req:e,res:t,reportDefinition:r,reportQuery:n,reportData:i,count:a,csrfToken:s,canDownload:o})=>{let{dataProductDefinitionsPath:u}=e.query,{nestedBaseUrl:l}=me.getValues(t),{name:f,description:g}=r,{specification:d,name:h,description:m,classification:S,printable:R}=r.variant,{data:w}=i,p=await Jo(e,a,d,n,w),L=Wo(s,r,p.columns,`${e.protocol}://${e.get("host")}${e.originalUrl}`,o,a,u,p.reportUrl,p.reportSearch,l);return{...p,reportName:f,name:h,description:m||g,count:a,type:"report",classification:S,printable:R,actions:L,warnings:i.warnings,canDownload:o,nestedBaseUrl:l}},Qo={getRenderData:Xo,getReport:dd,getReportData:zo,getReportRenderData:Jo,setActions:Wo};var hd=(e,t)=>(0,Ko.json2csv)(e,t),md=(e,t)=>{let{fields:r}=t.variant.specification,n=[];return Object.keys(e[0]).forEach(i=>{let a=r.find(s=>s.name===i);n.push({field:i,title:a.display})}),n},pd=(e,t)=>e.map(r=>Object.keys(r).filter(n=>t.includes(n)).reduce((n,i)=>(n[i]=r[i],n),{})),gd=(e,t)=>{let{fields:r}=t.variant.specification,n=r.find(i=>i.type==="HTML");if(n){let{name:i}=n;e.map(a=>{let s=/target="_blank">(.*?)<\/a>/g.exec(a[i]);return a[i]=s[1],a})}return e},Zo={async downloadReport({req:e,services:t,res:r,redirect:n,loadType:i}){let{userId:a,token:s}=me.getValues(r),{reportId:o,id:u,tableId:l,dataProductDefinitionsPath:f,reportName:g,name:d,cols:h}=e.body;if(!await t.downloadPermissionService.downloadEnabled(a,o,u))r.redirect(n);else{let S=await t.reportingService.getDefinition(s,o,u,f),R;if(i==="sync"){let{reportData:L}=await Qo.getReportData({services:t,req:e,token:s,reportId:o,id:u});R=L.data}else{let L=await t.reportingService.getAsyncCount(s,l);R=await t.reportingService.getAsyncReport(s,o,u,l,{dataProductDefinitionsPath:f,pageSize:L})}h&&(R=pd(R,JSON.parse(h))),R=gd(R,S);let w=md(R,S),p=hd(R,{keys:w});r.setHeader("Content-Type","application/json"),r.setHeader("Content-disposition",`attachment; filename=${g}-${d}-${new Date().toISOString()}.csv`),r.end(p)}}};var Er=class{constructor(t,r){this.POST=async(t,r,n)=>{let{userId:i}=me.getValues(r),{reportId:a,id:s,loadType:o,currentUrl:u,currentQueryParams:l}=t.body,f=`${u}/download-disabled`;f=l?`${f}${l}`:f,await this.services.downloadPermissionService.downloadEnabled(i,a,s)?await Zo.downloadReport({req:t,res:r,services:this.services,redirect:f,loadType:o}):r.redirect(f)};this.layoutPath=t,this.services=r}};
/*! Bundled license information:

doc-path/lib/path.js:
  (**
   * @license MIT
   * doc-path <https://github.com/mrodrig/doc-path>
   * Copyright (c) 2015-present, Michael Rodrigues.
   *)

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