/*! For license information please see index.js.LICENSE.txt */ (()=>{var e={9078:(e,t,n)=>{"use strict";var r=n(159),a=n(983);function o(e){if(!(this instanceof o))return new o(e);this.headers=e.headers,this.negotiator=new r(e)}function i(e){return-1===e.indexOf("/")?a.lookup(e):e}function s(e){return"string"==typeof e}e.exports=o,o.prototype.type=o.prototype.types=function(e){var t=e;if(t&&!Array.isArray(t)){t=new Array(arguments.length);for(var n=0;n{"use strict";function t(e,n,r){for(var a=0;a0&&Array.isArray(o)?t(o,n,r-1):n.push(o)}return n}function n(e,t){for(var r=0;r{"use strict";n.r(t),n.d(t,{default:()=>ui}),n(5666),n(2222),n(1539),n(8674);var r=n(7846),a=n.n(r),o=n(9268),i=n.n(o),s=n(9383),c=(n(5827),n(9720),n(4916),n(4723),n(4603),n(9714),n(9070),n(7941),n(2526),n(7327),n(5003),n(9554),n(4747),n(9337),n(3321),n(9753),n(1817),n(2165),n(6992),n(8783),n(3948),n(7042),n(8309),n(1038),n(9491)),u=n.n(c),p=n(2081),l=n(7767),d=n(4151);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:{},a=r.body,o=r.uuid,i=h({},a);o&&(i.uuid=o);var s,c=Object.entries(g[e]).reduce((function(e,t){var n=f(t,2),r=n[0],a=n[1],o=i[r];return void 0!==o&&e.push(a,String(o)),e}),["--".concat(e),"--".concat(t),"--yes"]);(0,d.HQ)({commandArgs:c},"Manage alerts with args: ");try{var m=s=(0,p.spawnSync)(l.us.usr.sbin["anvil-manage-alerts"].self,c,{encoding:"utf-8",timeout:3e4}),v=m.error,b=m.signal,y=m.status,x=m.stderr,w=m.stdout;(0,d.HQ)({error:v,signal:b,status:y,stderr:x,stdout:w},"Manage alerts returned: "),u().strictEqual(y,0,"Expected status to be 0, but got [".concat(y,"]")),u().strictEqual(v,void 0,"Expected no error, but got [".concat(v,"]"))}catch(v){throw new Error("Failed to complete manage alerts; CAUSE: ".concat(v))}return{uuid:null===(n=s.stdout.match(new RegExp(l.Ke)))||void 0===n?void 0:n[0]}},x=(n(8285),n(9653),n(972)),w=function(e,t){var n=e.hostUuid,r=e.level,a=e.mailRecipientUuid,o=(0,x.N)(n,"string"),i=(0,x.N)(r,"number"),s=(0,x.N)(a,"string");return t&&u()(l.Qt.test(t),"Expected valid UUIDv4; got [".concat(t,"]")),u()(l.Qt.test(o),"Expected valid host UUIDv4; got [".concat(o,"]")),u()(Number.isSafeInteger(i),"Expected level to be an integer; got [".concat(i,"]")),u()(l.Qt.test(s),"Expected valid mail recipient UUIDv4; got [".concat(s,"]")),{hostUuid:o,level:i,mailRecipientUuid:s}},_=(n(5212),n(6699),n(6363));const S=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.beforeReturn,r=t.elementWrapper,a=void 0===r?"":r,o=t.onEach,i=t.separator,s=void 0===i?"":i,c="".concat(a).concat(s).concat(a),u=e instanceof Array&&e.length>0?"".concat(a).concat(e.slice(1).reduce((function(e,t){return"".concat(e).concat(c).concat((0,_.Z)(o,{notCallableReturn:t,parameters:[t]}))}),e[0])).concat(a):void 0;return(0,_.Z)(n,{notCallableReturn:u,parameters:[u]})};var E=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.onFallback,a=n.beforeReturn,o=void 0===a?function(e){return e?"".concat(t," IN (").concat(e,")"):(0,_.Z)(r,{notCallableReturn:""})}:a;return S(e,{beforeReturn:o,elementWrapper:"'",separator:", "})},A=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.onFallback,a=(0,x.N)(e,"string[]",{modifierType:"sql"}),o=E(a,t,{onFallback:r});return{after:o,before:a}},k=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"all",t=arguments.length>1?arguments[1]:void 0;return e instanceof Array&&!e.some((function(e){return["all","*"].includes(e)}))?E(e,t):""},O=n(9829);function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function C(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}function R(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){C(o,r,a,i,s,"next",e)}function s(e){C(o,r,a,i,s,"throw",e)}i(void 0)}))}}const I=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.beforeRespond;return function(){var t=R(regeneratorRuntime.mark((function t(r,a){var o,i,s,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((0,d.Cr)("Calling CLI script to get data."),o={},t.prev=2,"function"!=typeof e){t.next=9;break}return t.next=6,e(r,o);case 6:t.t0=t.sent,t.next=10;break;case 9:t.t0=e;case 10:return s=t.t0,t.next=13,(0,O.IO)(s);case 13:i=t.sent,t.next=20;break;case 16:return t.prev=16,t.t1=t.catch(2),(0,d.x5)("Failed to execute query; CAUSE: ".concat(t.t1)),t.abrupt("return",a.status(500).send());case 20:(0,d.HQ)(i,"Query stdout pre-hooks (type=[".concat(j(i),"]): ")),c=o.afterQueryReturn,i=(0,_.Z)(c,{parameters:[i],notCallableReturn:i}),i=(0,_.Z)(n,{parameters:[i],notCallableReturn:i}),(0,d.HQ)(i,"Query stdout post-hooks (type=[".concat(j(i),"]): ")),a.json(i);case 26:case"end":return t.stop()}}),t,null,[[2,16]])})));return function(e,n){return t.apply(this,arguments)}}()};var T=function(e){return function(t){return t instanceof Array?e(t):t}},P=function(e,t){return T((function(n){return n.reduce(e,t)}))},N=(n(5306),function(e){return e.replace(/-.*$/,"")}),U=function(e){return e.replace(/[.].*$/,"")};function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nMath.max(t,Math.min(e,n)),z={"b-B":8n,"b-kB":8000n,"b-MB":8000000n,"b-GB":8000000000n,"b-TB":8000000000000n,"b-PB":8000000000000000n,"b-EB":8000000000000000000n,"b-ZB":8000000000000000000000n,"b-YB":8000000000000000000000000n,"b-KiB":8192n,"b-MiB":8388608n,"b-GiB":8589934592n,"b-TiB":8796093022208n,"b-PiB":9007199254740992n,"b-EiB":9223372036854775808n,"b-ZiB":9444732965739290427392n,"b-YiB":9671406556917033397649408n,"b-b":1n,"b-kbit":1000n,"b-Mbit":1000000n,"b-Gbit":1000000000n,"b-Tbit":1000000000000n,"b-Pbit":1000000000000000n,"b-Ebit":1000000000000000000n,"b-Zbit":1000000000000000000000n,"b-Ybit":1000000000000000000000000n,"b-Kibit":1024n,"b-Mibit":1048576n,"b-Gibit":1073741824n,"b-Tibit":1099511627776n,"b-Pibit":1125899906842624n,"b-Eibit":1152921504606846976n,"b-Zibit":1180591620717411303424n,"b-Yibit":1208925819614629174706176n},$=["byte","ibyte","bit","ibit"],W=["B","kB","MB","GB","TB","PB","EB","ZB","YB","B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB","b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit","b","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],G=e=>BigInt(10**e),Q=({precision:e,value:t},n,{isReverse:r}={})=>{if("b"===n)return{precision:e,value:t};const a=z[`b-${n}`];if(r)return{precision:e,value:t*a};const o=String(a).length;return{precision:e+o,value:t*G(o)/a}},Z=(e,{fromUnit:t="B",locale:n,precision:r,toUnit:a}={})=>{let o;try{o=J(e)}catch(e){return}const{max:i,min:s}=Y(r),{unit:c}=K(t,"B");o=Q(o,c,{isReverse:!0});const u=X(o,c,{toUnit:a});o=Q(o,u),o=V(o,{toPrecision:B(o.precision,s,i)}),o=ee(o,s);const p=(({precision:e,value:t},{bigintFormatOptions:n,numberFormatOptions:r,locale:a}={})=>{const o=G(e),i=t/o,s=t%o;let[c,u]="0.",p=i.toString(),l=s.toString();if(a){const e="string"==typeof a?a:void 0;[c,u]=.1.toLocaleString(e,r),p=i.toLocaleString(e,n),l=s.toLocaleString(e,{...n,useGrouping:!1})}let d=p;return e>0&&(d+=`${u}${l.padStart(e,c)}`),d})(o,{locale:n});return{value:p,unit:u}},V=({precision:e,value:t},{toPrecision:n=0}={})=>{const r={precision:n,value:t};if(n>e)r.value*=G(n-e);else if(n4&&(r.value+=1n)}return r},K=(e,t,n=W)=>{const r=n.indexOf(e);return r<0?{unit:t,unitIndex:0}:{unit:n[r],unitIndex:r}},J=e=>{var t,n;const r=String(e).split(/\D/,2),a=null!==(t=null===(n=r[1])||void 0===n?void 0:n.length)&&void 0!==t?t:0,o=r.join("");if(0===o.length)throw Error("Value is blank.");return{value:BigInt(o),precision:a}},Y=(e={})=>{var t,n;return"number"==typeof e?{max:e,min:e}:{max:null!==(t=e.max)&&void 0!==t?t:2,min:null!==(n=e.min)&&void 0!==n?n:0}},X=({precision:e,value:t},n,{conversionTable:r=z,toUnit:a,units:o=W,unitSections:i=$,unitSectionLength:s=9}={})=>{const c=o.indexOf(a);return c>=0?o[c]:((e,t,n,r,a,o,i)=>{let s=o.indexOf(n),c=t;s<0&&(s=((e,t)=>{const n=`${"i"===e[1]?"i":""}${/B$/.test(e)?"byte":"bit"}`,r=t.findIndex((e=>e===n));return{section:n,index:r}})(t,o).index);let u=s*i;const p=u+i;for(;u=r[`b-${t}`]?c=t:u=p}return c})(t/G(e),n,a,r,o,i,s)},ee=({precision:e,value:t},n)=>{const r={precision:e,value:t},a=e-n;let o=!0;for(let e=1;o&&e<=a;e+=1)0n===r.value%10n?(r.value/=10n,r.precision-=1):o=!1;return r};function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{},t=e.isSummary,n=void 0!==t&&t,r="\n host_uuid,\n host_name,\n scan_hardware_cpu_cores,\n scan_hardware_ram_total",a="";return n&&(r="\n MIN(scan_hardware_cpu_cores) AS anvil_total_cpu_cores,\n MIN(scan_hardware_ram_total) AS anvil_total_memory",a="GROUP BY anvil_uuid"),"\n SELECT\n anvil_uuid,\n ".concat(r,"\n FROM anvils AS anv\n JOIN hosts AS hos\n ON host_uuid IN (\n anvil_node1_host_uuid,\n anvil_node2_host_uuid,\n anvil_dr1_host_uuid\n )\n JOIN scan_hardware AS sca_har\n ON host_uuid = scan_hardware_host_uuid\n ").concat(a)},i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.isSummary,n=void 0!==t&&t,r="\n server_uuid,\n server_name,\n server_cpu_cores,\n server_memory_value,\n server_memory_unit",a="";return n&&(r="SUM(server_cpu_cores) AS anvil_total_allocated_cpu_cores",a="GROUP BY server_anvil_uuid"),"\n SELECT\n server_anvil_uuid,\n ".concat(r,"\n FROM servers AS ser\n JOIN (\n SELECT\n server_definition_server_uuid,\n CAST(\n SUBSTRING(\n server_definition_xml, 'cores=''([\\d]*)'''\n ) AS INTEGER\n ) AS server_cpu_cores,\n CAST(\n SUBSTRING(\n server_definition_xml, 'memory.*>([\\d]*)e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:2;return"message_022".concat(e)},fe=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,r,a,o,i,s,c,p,l,f,m,v;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.anvils,r=t.anvilUuid,a=t.hosts,o=n.anvil_uuid[r]){e.next=4;break}throw new Error("Anvil information not found with UUID ".concat(r));case 4:return i=o.anvil_name,s=o.anvil_node1_host_uuid,c=o.anvil_node2_host_uuid,p={anvil_name:i,anvil_state:"optimal",anvil_uuid:r,hosts:[]},e.prev=6,e.next=9,(0,O.IO)("SELECT\n COUNT(a.server_name),\n b.host_uuid\n FROM servers AS a\n JOIN hosts AS b\n ON a.server_host_uuid = b.host_uuid\n JOIN anvils AS c\n ON b.host_uuid IN (\n c.anvil_node1_host_uuid,\n c.anvil_node2_host_uuid\n )\n WHERE c.anvil_uuid = '".concat(r,"'\n AND a.server_state = 'running'\n GROUP BY b.host_uuid, b.host_name\n ORDER BY b.host_name;"));case 9:l=e.sent,e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(6),(0,d.x5)("Failed to get subnodes' server count; CAUSE: ".concat(e.t0)),e.t0;case 16:f=regeneratorRuntime.mark((function e(){var t,n,r,o,i,s,c,f,h,b,g,y,x,w,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=v[m],n=a.host_uuid[t],r=n.host_status,o=n.short_host_name,i=p.hosts,s=l.find((function(e){return 2===e.length&&e[1]===t})),c=s?s[0]:0,f={host_name:o,host_uuid:t,maintenance_mode:!1,server_count:c,state:"offline",state_message:de(),state_percent:0},i.push(f),"online"===r){e.next=9;break}return e.abrupt("return","continue");case 9:return h=void 0,e.prev=10,e.next=13,(0,O.IO)("SELECT\n scan_cluster_node_in_ccm,\n scan_cluster_node_crmd_member,\n scan_cluster_node_cluster_member,\n scan_cluster_node_maintenance_mode\n FROM\n scan_cluster_nodes\n WHERE\n scan_cluster_node_host_uuid = '".concat(t,"';"));case 13:h=e.sent,u().ok(h.length,"No node cluster info"),e.next=21;break;case 17:return e.prev=17,e.t0=e.catch(10),(0,d.x5)("Failed to get node ".concat(t," cluster status; CAUSE: ").concat(e.t0)),e.abrupt("return","continue");case 21:b=ue(h,1),g=ue(b[0],4),y=g[0],x=g[1],w=g[2],_=g[3],f.maintenance_mode=Boolean(_),w?(f.state="online",f.state_message=de(3),f.state_percent=100):x?(f.state="crmd",f.state_message=de(4),f.state_percent=75):y?(f.state="in_ccm",f.state_message=de(5),f.state_percent=50):(f.state="booted",f.state_message=de(6),f.state_percent=25);case 24:case"end":return e.stop()}}),e,null,[[10,17]])})),m=0,v=[s,c];case 18:if(!(me.length)&&(t=e.length);for(var n=0,r=new Array(t);n([\\d]*)0&&(c=String(s.reduce((function(e,t){var n,r,a=he(t,2),o=a[0],i=a[1],s=null!==(n=null===(r=Z(o,{fromUnit:i,toUnit:"B"}))||void 0===r?void 0:r.value)&&void 0!==n?n:"0";return e+BigInt(s)}),BigInt(0)))),e.abrupt("return",n.status(200).send({allocated:c,hosts:i,reserved:String(l.Su),total:o}));case 28:case"end":return e.stop()}}),e,null,[[1,7],[15,21]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ge(o,r,a,i,s,"next",e)}function s(e){ge(o,r,a,i,s,"throw",e)}i(void 0)}))});return function(e,n){return t.apply(this,arguments)}}();function xe(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}function we(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_e(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nt?1:-1},Ae=function(e){var t=Object.entries(e).sort((function(e,t){var n=we(e,2),r=n[0],a=n[1].type,o=we(t,2),i=o[0],s="bond"===a,c="bond"===o[1].type;return s&&c?Ee(r,i):s?-1:c?1:Ee(r,i)})).reduce((function(e,t){var n=we(t,2),r=n[0],a=n[1],o=a.type;if("bond"===o){var i=a,s=i.active_interface,c=i.uuid;e[c]={active_interface:s,bond_name:r,bond_uuid:c,links:[]}}else if("interface"===o){var u=a,p=u.bond_uuid,d=u.operational,f=u.speed,m=u.uuid;if(!l.Qt.test(p))return e;var v=e[p],h=v.active_interface,b=v.links,g="up"===d?"optimal":"down";b.forEach((function(e){var t=e.link_speed,n=e.link_state;tf&&(g=Se(g))})),b.push({is_active:r===h,link_name:r,link_speed:f,link_state:g,link_uuid:m})}return e}),{});return Object.values(t)},ke=function(){var e,t=(e=regeneratorRuntime.mark((function e(t,n){var r,a,o,i,s,c,p,f,m,v,h,b,g,y,w;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.params.anvilUuid,a=(0,x.N)(r,"string",{modifierType:"sql"}),e.prev=2,u()(l.Qt.test(a),"Param UUID must be a valid UUIDv4; got [".concat(a,"]")),e.next=10;break;case 6:return e.prev=6,e.t0=e.catch(2),(0,d.x5)("Failed to assert value during get anvil network; CAUSE: ".concat(e.t0)),e.abrupt("return",n.status(400).send());case 10:return e.prev=10,e.next=13,(0,O.nP)();case 13:return o=e.sent,e.next=16,(0,O.zM)();case 16:i=e.sent,e.next=23;break;case 19:return e.prev=19,e.t1=e.catch(10),(0,d.x5)("Failed to get anvil and host data; CAUSE: ".concat(e.t1)),e.abrupt("return",n.status(500).send());case 23:s=o.anvil_uuid[a],c=s.anvil_node1_host_uuid,p=s.anvil_node2_host_uuid,f={hosts:[]},m=0,v=[c,p];case 26:if(!(me.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(m.badSshKeys=b.reduce((function(e,t){var n,r,a=(r=2,function(e){if(Array.isArray(e))return e}(n=t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(n,r)||function(e,t){if(e){if("string"==typeof e)return Le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Le(e,t):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],i=a[1],s=e[i],c=void 0===s?[]:s;return c.push(o),e[i]=c,e}),{})),n.status(200).send(m);case 42:case"end":return e.stop()}}),e,null,[[6,12],[16,22],[28,34]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Fe(o,r,a,i,s,"next",e)}function s(e){Fe(o,r,a,i,s,"throw",e)}i(void 0)}))});return function(e,n){return t.apply(this,arguments)}}();function He(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qe(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==i[1]?i[1]:{}).isActiveMember){e.next=3;break}return e.abrupt("return",void 0);case 3:return e.next=5,(0,O.IO)("SELECT\n CASE\n WHEN host_status = 'online'\n THEN CAST('1' AS BOOLEAN)\n ELSE CAST('0' AS BOOLEAN)\n END\n FROM hosts WHERE host_uuid = '".concat(t,"';"));case 5:return n=e.sent,u().ok(n.length,"No entry found"),r=ze(n,1),a=ze(r[0],1),o=a[0],e.abrupt("return",o?{job_command:l.us.usr.sbin["anvil-safe-start"].self,job_description:"job_0337",job_host_uuid:t,job_name:"set_membership::join",job_title:"job_0336"}:void 0);case 9:case"end":return e.stop()}}),e)}))),function(e){return Ze.apply(this,arguments)}),leave:(Qe=Ge(regeneratorRuntime.mark((function e(t){var n,r,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{},r=n.isActiveMember,e.abrupt("return",r?{job_command:l.us.usr.sbin["anvil-safe-stop"].self,job_description:"job_0339",job_host_uuid:t,job_name:"set_membership::leave",job_title:"job_0338"}:void 0);case 2:case"end":return e.stop()}}),e)}))),function(e){return Qe.apply(this,arguments)})},Ke=function(e){return function(){var t=Ge(regeneratorRuntime.mark((function t(n,r){var a,o,i,s,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=n.params.uuid,o=(0,x.N)(a,"string",{modifierType:"sql"}),t.prev=2,u()(l.Qt.test(o),"Param UUID must be a valid UUIDv4; got: [".concat(o,"]")),t.next=10;break;case 6:return t.prev=6,t.t0=t.catch(2),(0,d.x5)("Failed to assert value when changing host membership; CAUSE: ".concat(t.t0)),t.abrupt("return",r.status(500).send());case 10:return t.prev=10,t.next=13,(0,O.IO)("SELECT\n scan_cluster_node_in_ccm,\n scan_cluster_node_crmd_member,\n scan_cluster_node_cluster_member\n FROM scan_cluster_nodes\n WHERE scan_cluster_node_host_uuid = '".concat(o,"';"));case 13:i=t.sent,u().ok(i.length,"No entry found"),t.next=21;break;case 17:return t.prev=17,t.t1=t.catch(10),(0,d.x5)("Failed to get cluster status of host ".concat(o,"; CAUSE: ").concat(t.t1)),t.abrupt("return",r.status(500).send());case 21:return s=i[0].every((function(e){return Boolean(e)})),t.prev=22,t.next=25,Ve[e](o,{isActiveMember:s});case 25:if(!(c=t.sent)){t.next=29;break}return t.next=29,(0,O.ZP)(qe({file:__filename},c));case 29:t.next=35;break;case 31:return t.prev=31,t.t2=t.catch(22),(0,d.x5)("Failed to initiate ".concat(e," cluster for host ").concat(o,"; CAUSE: ").concat(t.t2)),t.abrupt("return",r.status(500).send());case 35:return t.abrupt("return",r.status(204).send());case 36:case"end":return t.stop()}}),t,null,[[2,6],[10,17],[22,31]])})));return function(e,n){return t.apply(this,arguments)}}()},Je=Ke("join"),Ye=Ke("leave");function Xe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(e,t)||tt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function et(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=tt(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}function tt(e,t){if(e){if("string"==typeof e)return nt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nt(e,t):void 0}}function nt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{},t=e.uuid;return{job_command:"".concat(l.us.usr.sbin["striker-boot-machine"].self," --host-uuid '").concat(t,"'"),job_description:"job_0335",job_name:"set_power::on",job_title:"job_0334"}},startserver:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.runOn,n=e.uuid;return{job_command:"".concat(l.us.usr.sbin["anvil-boot-server"].self),job_data:"server-uuid=".concat(n),job_description:"job_0341",job_host_uuid:t,job_name:"set_power::server::on",job_title:"job_0340"}},stop:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.isStopServers,n=e.uuid,r=e.runOn,a=void 0===r?n:r;return{job_command:"".concat(l.us.usr.sbin["anvil-safe-stop"].self," --power-off").concat(t?" --stop-servers":""),job_description:"job_0333",job_host_uuid:a,job_name:"set_power::off",job_title:"job_0332"}},stopserver:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.force,n=e.runOn,r=e.uuid,a=l.us.usr.sbin["anvil-shutdown-server"].self;return t&&(a+=" --immediate"),{job_command:a,job_data:"server-uuid=".concat(r),job_description:"job_0343",job_host_uuid:n,job_name:"set_power::server::off",job_title:"job_0342"}}},ut=function(){var e=st(regeneratorRuntime.mark((function e(t,n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=at({file:__filename},ct[t](n)),e.next=3,(0,O.ZP)(r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),pt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getJobHostUuid;return function(){var t=st(regeneratorRuntime.mark((function t(r,a){var o,i,s,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=r.params.uuid,i=r.query.force,s=(0,x.N)(i,"boolean"),t.prev=2,o&&u()(l.Qt.test(o),"Param UUID must be a valid UUIDv4; got [".concat(o,"]")),t.next=10;break;case 6:return t.prev=6,t.t0=t.catch(2),(0,d.x5)("Failed to ".concat(e,"; CAUSE: ").concat(t.t0)),t.abrupt("return",a.status(400).send());case 10:return t.prev=10,t.next=13,null==n?void 0:n.call(null,o);case 13:return c=t.sent,t.next=16,ut(e,{force:s,runOn:c,uuid:o});case 16:t.next=22;break;case 18:return t.prev=18,t.t1=t.catch(10),(0,d.x5)("Failed to ".concat(e," ").concat(null!=o?o:l.Fe,"; CAUSE: ").concat(t.t1)),t.abrupt("return",a.status(500).send());case 22:a.status(204).send();case 23:case"end":return t.stop()}}),t,null,[[2,6],[10,18]])})));return function(e,n){return t.apply(this,arguments)}}()},lt=function(e){return function(){var t=st(regeneratorRuntime.mark((function t(n,r){var a,o,i,s,c,p;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=n.params.uuid,o=(0,x.N)(a,"string",{modifierType:"sql"}),t.prev=2,u()(l.Qt.test(o),"Param UUID must be a valid UUIDv4; got: [".concat(o,"]")),t.next=10;break;case 6:return t.prev=6,t.t0=t.catch(2),(0,d.x5)("Failed to assert value during power operation on anvil subnode"),t.abrupt("return",r.status(400).send());case 10:return t.prev=10,t.next=13,(0,O.IO)("SELECT anvil_node1_host_uuid, anvil_node2_host_uuid\n FROM anvils WHERE anvil_uuid = '".concat(o,"';"));case 13:i=t.sent,u().ok(i.length,"No entry found"),t.next=21;break;case 17:return t.prev=17,t.t1=t.catch(10),(0,d.x5)("Failed to get anvil subnodes' UUID; CAUSE: ".concat(t.t1)),t.abrupt("return",r.status(500).send());case 21:s=et(i[0]),t.prev=22,s.s();case 24:if((c=s.n()).done){t.next=37;break}return p=c.value,t.prev=26,t.next=29,ut(e,{isStopServers:!0,uuid:p});case 29:t.next=35;break;case 31:return t.prev=31,t.t2=t.catch(26),(0,d.x5)("Failed to ".concat(e," host ").concat(p,"; CAUSE: ").concat(t.t2)),t.abrupt("return",r.status(500).send());case 35:t.next=24;break;case 37:t.next=42;break;case 39:t.prev=39,t.t3=t.catch(22),s.e(t.t3);case 42:return t.prev=42,s.f(),t.finish(42);case 45:return t.abrupt("return",r.status(204).send());case 46:case"end":return t.stop()}}),t,null,[[2,6],[10,17],[22,39,42,45],[26,31]])})));return function(e,n){return t.apply(this,arguments)}}()},dt=function(e){return pt(e,{getJobHostUuid:(t=st(regeneratorRuntime.mark((function e(t){var n,r,a,o,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,(0,O.IO)("SELECT\n COALESCE(a.server_host_uuid, b.anvil_node1_host_uuid)\n FROM servers AS a\n LEFT JOIN anvils AS b\n ON a.server_anvil_uuid = b.anvil_uuid\n WHERE server_state != '".concat(l.oZ,"'\n AND server_uuid = '").concat(t,"';"));case 5:r=e.sent,u().ok(r.length,"No entry found"),a=Xe(r,1),o=Xe(a[0],1),(i=o[0])&&(n=i),e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(2),new Error("Failed to get server host; CAUSE: ".concat(e.t0));case 14:return e.abrupt("return",n);case 15:case"end":return e.stop()}}),e,null,[[2,11]])}))),function(e){return t.apply(this,arguments)})});var t},ft=pt("poweroff"),mt=pt("reboot"),vt=n(9831),ht=n(5230);function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}function ln(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,Cn);return Pn(function(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:2;return t.reduce((function(t,r,a){if(r){var o=r.networkInterfaceMACAddress,i=a+1;t[Un(n,"".concat(e,"_link").concat(i,"_mac_to_set"))]={step:n,value:o}}return t}),{})};function Ln(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Fn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},n=t.netconfStep,r=void 0===n?2:n,a=t.netcountStep,o=void 0===a?1:a,i=e.reduce((function(e,t){var n,a=t.createBridge,o=t.interfaces,i=t.ipAddress,s=t.subnetMask,c=t.type,u=e.counters;u[c]=u[c]?u[c]+1:1;var p="".concat(c).concat(u[c]);return e.data=Hn(Hn({},e.data),{},(qn(n={},Un(r,"".concat(p,"_ip")),{step:r,value:i}),qn(n,Un(r,"".concat(p,"_subnet_mask")),{step:r,value:s}),n),Dn(p,o)),a&&(e.data[Un(r,"".concat(p,"_create_bridge"))]={step:r,value:a}),e}),{counters:{},data:{}}),s=i.counters,c=i.data;return Object.entries(s).forEach((function(e){var t=Ln(e,2),n=t[0],r=t[1];c[Un(o,"".concat(n,"_count"))]={value:r}})),c};function zn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,"Data host number can only contain digits; got [".concat(E,"]")),u()(l.ah.test(A),"Data network DNS must be a comma separated list of valid IPv4 addresses; got [".concat(A,"]")),u()(l.tf.test(k),"Data network gateway must be a valid IPv4 address; got [".concat(k,"]")),u()(l.OU.test(j),"Data gateway interface must be a peaceful string; got [".concat(j,"]")),u()(C.length>0,"Data organization name cannot be empty; got [".concat(C,"]")),u()(/^[a-z0-9]{1,5}$/.test(R),"Data organization prefix can only contain 1 to 5 lowercase alphanumeric characters; got [".concat(R,"]")),e.next=28;break;case 24:return e.prev=24,e.t0=e.catch(12),(0,d.x5)("Failed to assert value when trying to initialize striker; CAUSE: ".concat(e.t0,".")),e.abrupt("return",n.status(400).send());case 28:I=Wn((Gn(r={},Un(1,"domain"),{value:_}),Gn(r,Un(1,"organization"),{value:C}),Gn(r,Un(1,"prefix"),{value:R}),Gn(r,Un(1,"sequence"),{value:E}),Gn(r,Un(2,"dns"),{step:2,value:A}),Gn(r,Un(2,"gateway"),{step:2,value:k}),Gn(r,Un(2,"gateway_interface"),{step:2,value:j}),Gn(r,Un(2,"host_name"),{step:2,value:S}),Gn(r,Un(2,"striker_password"),{step:2,value:w}),Gn(r,Un(2,"striker_user"),{step:2,value:"admin"}),r),Bn(b)),(0,d.HQ)(I,"Config data before initiating striker config: "),T=Object.entries(I),e.prev=31,P=(0,O.gA)(),N=0,U=T;case 34:if(!(Ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},n=t.locales;return"".concat(e[0].toLocaleUpperCase(n)).concat(e.slice(1))},ar=function(){for(var e=arguments.length,t=new Array(e),n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:{},a=t[0],o=t.length;if(!a)return n;var i=1,s=r[a];return r[a]=i0&&void 0!==arguments[0]?arguments[0]:{},t=e.keys,n=void 0===t?"*":t,r=k(n,"WHERE a.host_uuid");(0,d.Cr)("condHostUUIDs=[".concat(r,"]"));var a="\n SELECT\n a.host_ipmi,\n a.host_name,\n a.host_status,\n a.host_type,\n a.host_uuid,\n b.variable_name,\n b.variable_value,\n SUBSTRING(\n b.variable_name, '".concat(mr,"([^:]+)'\n ) as cvar_name,\n SUBSTRING(\n b.variable_name, '").concat(mr,"([a-z]{2,3})\\d+'\n ) AS network_type,\n SUBSTRING(\n b.variable_name, '").concat(mr,"[a-z]{2,3}\\d+_(link\\d+)'\n ) AS network_link,\n c.network_interface_uuid\n FROM hosts AS a\n LEFT JOIN variables AS b\n ON b.variable_source_uuid = a.host_uuid\n AND (\n b.variable_name LIKE '").concat(fr,"%'\n OR b.variable_name = 'install-target::enabled'\n )\n LEFT JOIN network_interfaces AS c\n ON b.variable_name LIKE '%link%_mac%'\n AND b.variable_value = c.network_interface_mac_address\n AND a.host_uuid = c.network_interface_host_uuid\n ").concat(r,"\n ORDER BY a.host_name ASC,\n cvar_name ASC,\n b.variable_name ASC;"),o=T((function(e){if(0===e.length)return{};var t=cr(e[0],5),n=t[0],r=t[1],a=t[2],o=t[3],i=t[4],s=U(r),c={command:n,ip:n.replace(/^.*--ip\s+([^\s'"]+).*$/,"$1"),password:n.replace(/^.*--password\s+"(.*)"$/,"$1"),username:n.replace(/^.*--username\s+(\w+).*$/,"$1")};return e.reduce((function(e,t){var n=t[5],r=t[6],a=t[8],o=t[9],i=t[10];if(!n)return e;var s=ir(n.split("::")),c=s[0],u=s.slice(1),p=vr[c](u);return hr(p,r,e),o?(p[p.length-1]="".concat(o,"Uuid"),hr(p,i,e)):a&&(p[p.length-1]="type",hr(p,a,e)),e}),{hostName:r,hostStatus:a,hostType:o,hostUUID:i,ipmi:c,shortHostName:s})}));return{query:a,afterQueryReturn:o}};function gr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(s+="WHERE ".concat(i));var c="\n SELECT\n a.host_name,\n a.host_status,\n a.host_type,\n a.host_uuid\n FROM hosts AS a\n ".concat(s,"\n ORDER BY a.host_name ASC;"),u=P((function(e,t){var n,r,a=(r=4,function(e){if(Array.isArray(e))return e}(n=t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(n,r)||function(e,t){if(e){if("string"==typeof e)return gr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gr(e,t):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=a[0],s=a[1],c=a[2],u=a[3];return e[(0,Yn.s)(u,o)]={hostName:i,hostStatus:s,hostType:c,hostUUID:u,shortHostName:U(i)},e}),{});if(r){var p=br({keys:(0,x.N)(r,"string[]",{modifierType:"sql"})});c=p.query,u=p.afterQueryReturn}return t&&(t.afterQueryReturn=u),c})),xr=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.fallbackResult,o=void 0===a?[]:a;return null!==(n=e.match(t))&&void 0!==n?n:o};function wr(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}function _r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Sr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:{},r=n.defaultPort,a=void 0===r?5432:r,o=n.defaultUser,i=void 0===o?"admin":o;return Object.entries(t).reduce((function(t,n){var r=_r(n,2),o=r[0],s=r[1],c=s.host,u=s.ping,p=s.port,l=void 0===p?a:p,d=s.user,f=void 0===d?i:d,m=Number(l);return o===e?(t.inbound.port=m,t.inbound.user=f):t.peer[c]={hostUUID:o,ipAddress:c,isPing:"1"===u,port:m,user:f},t}),{inbound:{ipAddress:{},port:a,user:i},peer:{}})},Ar=I(function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){wr(o,r,a,i,s,"next",e)}function s(e){wr(o,r,a,i,s,"throw",e)}i(void 0)}))}}(regeneratorRuntime.mark((function e(t,n){var r,a,o,i,s,c,u,p,l,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.query.hostUUIDs,o="a.ip_address_host_uuid",i=(0,O.gA)(),s=A(r,o,{onFallback:function(){return"".concat(o," = '").concat(i,"'")}}),c=s.after,u=s.before,p=u.length>0?u:[i],l=function(e){return(0,Yn.s)(e,i)},(0,d.Cr)("condHostUUIDs=[".concat(c,"]")),e.prev=7,e.next=10,(0,O.pT)();case 10:a=e.sent,e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(7),new Error("Failed to get anvil data; CAUSE: ".concat(e.t0));case 16:return f=p.reduce((function(e,t){return e[l(t)]=Er(t,a),e}),{}),(0,d.HQ)(f,"connections="),n&&(n.afterQueryReturn=P((function(e,t){var n=_r(t,4),r=n[0],a=n[1],o=n[2],i=n[3],s=_r(xr(i,/^(.*n)(\d+)_link(\d+)$/),4),c=s[1],u=s[2],p=s[3],d=l(a);return f[d].inbound.ipAddress[o]={hostUUID:a,ifaceId:i,ipAddress:o,ipAddressUUID:r,networkLinkNumber:Number(p),networkNumber:Number(u),networkType:c},e}),f)),e.abrupt("return","SELECT\n a.ip_address_uuid,\n a.ip_address_host_uuid,\n a.ip_address_address,\n CASE\n WHEN a.ip_address_on_type = 'interface'\n THEN (\n CASE\n WHEN b.network_interface_name ~* '.*n\\d+_link\\d+'\n THEN b.network_interface_name\n ELSE b.network_interface_device\n END\n )\n ELSE d.bond_active_interface\n END AS network_name\n FROM ip_addresses AS a\n LEFT JOIN network_interfaces AS b\n ON a.ip_address_on_uuid = b.network_interface_uuid\n LEFT JOIN bridges AS c\n ON a.ip_address_on_uuid = c.bridge_uuid\n LEFT JOIN bonds AS d\n ON c.bridge_uuid = d.bond_bridge_uuid\n OR a.ip_address_on_uuid = d.bond_uuid\n WHERE ".concat(c,"\n AND a.ip_address_note != 'DELETED';"));case 20:case"end":return e.stop()}}),e,null,[[7,13]])})));return function(t,n){return e.apply(this,arguments)}}()),kr=I((function(e,t){var n=e.params.hostUUID,r=(0,Yn.H)(n),a=br({keys:[(0,xn.f)(r)]}),o=a.afterQueryReturn,i=a.query;return t&&(t.afterQueryReturn=o),i}));function Or(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}var jr=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Or(o,r,a,i,s,"next",e)}function s(e){Or(o,r,a,i,s,"throw",e)}i(void 0)}))}}(regeneratorRuntime.mark((function e(t,n){var r,a,o,i,s,c,p,f,m,v,h,b,g,y,w,_,S,E,A,k,j,C,R,I;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.body,a=(r=void 0===r?{}:r).enterpriseUUID,o=r.hostIPAddress,i=r.hostName,s=r.hostPassword,c=r.hostSSHPort,p=r.hostType,f=r.hostUser,m=r.hostUUID,v=r.redhatPassword,h=r.redhatUser,b=Boolean(a),g=Boolean(m),y=Boolean(v)||Boolean(h),w=(0,x.N)(a,"string"),_=(0,x.N)(o,"string"),S=(0,x.N)(i,"string"),E=(0,x.N)(s,"string"),A=(0,x.N)(c,"number",{fallback:22}),k=(0,x.N)(p,"string"),j=(0,x.N)(f,"string",{fallback:"root"}),C=(0,x.N)(m,"string"),R=(0,x.N)(v,"string"),I=(0,x.N)(h,"string"),e.prev=16,u()(l.tf.test(_),"Data host IP address must be a valid IPv4 address; got [".concat(_,"]")),u()(l.FZ.test(S),"Data host name can only contain alphanumeric, hyphen, and dot characters; got [".concat(S,"]")),u()(l.OU.test(E),"Data host password must be peaceful string; got [".concat(E,"]")),u()(/^node|dr$/.test(k),'Data host type must be one of "node" or "dr"; got ['.concat(k,"]")),u()(l.OU.test(j),"Data host user must be a peaceful string; got [".concat(j,"]")),b&&u()(l.Qt.test(w),"Data enterprise UUID must be a valid UUIDv4; got [".concat(w,"]")),g&&u()(l.Qt.test(C),"Data host UUID must be a valid UUIDv4; got [".concat(C,"]")),y&&(u()(l.OU.test(R),"Data redhat password must be a peaceful string; got [".concat(R,"]")),u()(l.OU.test(I),"Data redhat user must be a peaceful string; got [".concat(I,"]"))),e.next=31;break;case 27:return e.prev=27,e.t0=e.catch(16),(0,d.x5)("Failed to assert value when trying to prepare host; CAUSE: ".concat(e.t0)),e.abrupt("return",n.status(400).send());case 31:if(e.prev=31,!g){e.next=35;break}return e.next=35,(0,O.VD)({file:__filename,update_value_only:1,variable_name:"system::configured",variable_source_table:"hosts",variable_source_uuid:C,variable_value:0});case 35:return e.next=37,(0,O.ZP)({file:__filename,job_command:l.us.usr.sbin["striker-initialize-host"].self,job_data:Nn({obj:{enterprise_uuid:w,host_ip_address:_,host_name:S,password:E,rh_password:R,rh_user:I,ssh_port:A,type:k}}),job_description:"job_0022",job_name:"initialize::".concat(k,"::").concat(_),job_title:"job_002".concat("dr"===k?"1":"0")});case 37:e.next=43;break;case 39:return e.prev=39,e.t1=e.catch(31),(0,d.x5)("Failed to init host; CAUSE: ".concat(e.t1)),e.abrupt("return",n.status(500).send());case 43:n.status(200).send();case 44:case"end":return e.stop()}}),e,null,[[16,27],[31,39]])})));return function(t,n){return e.apply(this,arguments)}}();function Cr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Rr(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n= '".concat(c,"')")}catch(e){throw new Error("Failed to build date condition for job query; CAUSE: ".concat(e))}var u="";return l.OU.test(i)&&(u="AND job.job_command LIKE '%".concat(i,"%'")),(0,d.Cr)("condModifiedDate=[".concat(s,"]")),t&&(t.afterQueryReturn=function(e){var t=e;return e instanceof Array&&(t=e.reduce((function(e,t){var n,r,a=(r=6,function(e){if(Array.isArray(e))return e}(n=t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(n,r)||function(e,t){if(e){if("string"==typeof e)return $r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$r(e,t):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],i=a[1],s=a[2],c=a[3],u=a[4],p=a[5];return e[o]={jobCommand:u,jobHostName:c,jobHostUUID:s,jobName:i,jobProgress:parseFloat(p),jobUUID:o},e}),{})),t}),"\n SELECT\n job.job_uuid,\n job.job_name,\n job.job_host_uuid,\n hos.host_name,\n job.job_command,\n job.job_progress\n FROM jobs AS job\n JOIN hosts AS hos\n ON job.job_host_uuid = hos.host_uuid\n WHERE (job.job_progress < 100 ".concat(s,")\n ").concat(u,"\n AND job_name NOT LIKE 'get_server_screenshot%';")}));function Gr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}function Aa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nu?p=1:ic?p=1:ol?d=1:cp?d=1:se.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}function no(e,t){if(e){if("string"==typeof e)return ro(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ro(e,t):void 0}}function ro(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nt.timestamp?1:-1})),h=v.pop(),(0,d.HQ)(h,"Latest server screenshot: "),h&&(b=h.name,g=h.timestamp,y=(0,an.readFileSync)(cn().join(f,b),{encoding:"base64"}),p.screenshot=y,p.timestamp=g),e.abrupt("return",n.send(p));case 30:if(!c){e.next=44;break}return e.prev=31,e.next=34,(0,O.eX)(r);case 34:w=e.sent,e.next=41;break;case 37:return e.prev=37,e.t2=e.catch(31),(0,d.x5)("Failed to get server ".concat(r," VNC info; CAUSE: ").concat(e.t2)),e.abrupt("return",n.status(500).send());case 41:return e.abrupt("return",n.send(w));case 44:n.send();case 45:case"end":return e.stop()}}),e,null,[[4,8],[15,19],[31,37]])})));return function(t,n){return e.apply(this,arguments)}}(),fo=i().Router();fo.delete("/",oo).delete("/:serverUuid",oo).get("/",so).get("/:serverUUID",lo).post("/",Xa);const mo=fo;function vo(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}var ho=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){vo(o,r,a,i,s,"next",e)}function s(e){vo(o,r,a,i,s,"throw",e)}i(void 0)}))}}(regeneratorRuntime.mark((function e(t,n){var r,a,o,i,s,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.body,a=Object.keys(r),o=0,i=a;case 3:if(!(oe.length)&&(t=e.length);for(var n=0,r=new Array(t);n1){var p=i.slice(u.length),l=u.slice(0,-1).replace(/\/+/g,"/"),f="".concat(l).concat(p);return console.log("redirect=".concat(f)),a.redirect(f)}u="/index"}var m=/\.html$/.test(u)?u:"".concat(u,".html"),v="".concat(So).concat(m),h=(0,an.existsSync)(v);return(0,d.Cr)("static:[".concat(u,"] requested; html=").concat(h)),h?(0,s.assertInit)({fail:function(e,t,n){var r=e.path,a="/init";return t.setHeader("Cache-Control","must-revalidate, no-store"),r.startsWith(a)?n():t.redirect(a)},invert:!0,succeed:(0,s.assertAuthentication)({fail:function(e,t,n,r){var a="/login";return t.path.startsWith(a)?r():n.redirect(e?"".concat(a,"?rt=").concat(e):a)},failReturnTo:!u.startsWith("/login"),succeed:function(e,t,n){var r=e.path,a=e.query,o=a.re,i=a.rt,s=void 0===i?"/":i;return r.startsWith("/login")?t.redirect(String(s)):r.startsWith("/init")&&!o?t.redirect("/"):n()}})}).apply(void 0,t):o()}),i().static(So,{extensions:["html"]}));const Eo=_o;function Ao(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}var ko=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Ao(o,r,a,i,s,"next",e)}function s(e){Ao(o,r,a,i,s,"throw",e)}i(void 0)}))}}(regeneratorRuntime.mark((function e(t,n){var r,a,o,i,s,c,p,f,m,v,h,b;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.body,a=(r=void 0===r?{}:r).agent,o=r.ipAddress,i=r.name,s=t.params.uuid,c=(0,x.N)(a,"string"),p=(0,x.N)(o,"string"),f=(0,x.N)(i,"string"),m=(0,x.N)(s,"string",{fallback:(0,d.Vj)()}),e.prev=7,u()(l.OU.test(c),"Agent must be a peaceful string; got [".concat(c,"]")),u()(l.tf.test(p),"IP address must be a valid IPv4; got [".concat(p,"]")),u()(l.OU.test(f),"Name must be a peaceful string; got [".concat(f,"]")),u()(l.Qt.test(m),"UPS UUID must be a valid UUIDv4; got [".concat(m,"]")),e.next=18;break;case 14:return e.prev=14,e.t0=e.catch(7),(0,d.x5)("Assert value failed when working with UPS; CAUSE: ".concat(e.t0)),e.abrupt("return",n.status(400).send());case 18:return v=(0,O.AB)(),e.prev=19,e.next=22,(0,O.cW)("INSERT INTO\n upses (\n ups_uuid,\n ups_name,\n ups_agent,\n ups_ip_address,\n modified_date\n ) VALUES (\n '".concat(m,"',\n '").concat(f,"',\n '").concat(c,"',\n '").concat(p,"',\n '").concat(v,"'\n ) ON CONFLICT (ups_uuid)\n DO UPDATE SET\n ups_name = '").concat(f,"',\n ups_agent = '").concat(c,"',\n ups_ip_address = '").concat(p,"',\n modified_date = '").concat(v,"';"));case 22:h=e.sent,u()(0===h,"Write exited with code ".concat(h)),e.next=30;break;case 26:return e.prev=26,e.t1=e.catch(19),(0,d.x5)("Failed to write UPS record; CAUSE: ".concat(e.t1)),e.abrupt("return",n.status(500).send());case 30:return b=s?200:201,e.abrupt("return",n.status(b).send());case 32:case"end":return e.stop()}}),e,null,[[7,14],[19,26]])})));return function(t,n){return e.apply(this,arguments)}}();function Oo(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}var jo=qt({delete:function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Oo(o,r,a,i,s,"next",e)}function s(e){Oo(o,r,a,i,s,"throw",e)}i(void 0)}))}}(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.cW)("UPDATE upses\n SET ups_ip_address = '".concat(l.oZ,"'\n WHERE ups_uuid IN (").concat(S(t,{elementWrapper:"'",separator:","}),");"));case 2:if(0===(n=e.sent)){e.next=5;break}throw Error("Write exited with code ".concat(n));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()});function Co(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Do(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Lo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n]+href=[\\"]+([^\s]+)[\\"]+.+[>]([^<]+)[<]/),u=Po(Po({},s),{},{brand:o,description:i,links:{}});if(c){var p=Do(c,4),l=p[1],d=p[2],f=p[3];u.description=l,u.links[0]={linkHref:d,linkLabel:f}}return/apc/i.test(o)&&(e[r]=u),e}),{}),n.status(200).send(a);case 13:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,n){return e.apply(this,arguments)}}(),Ho=ko,qo=i().Router();qo.delete("/:uuid?",jo).get("/",Ro).get("/template",Mo).post("/",ko).put("/:uuid",Ho);const Bo=qo;function zo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?s:[o],(0,d.HQ)({ulist:c}),e.prev=10,p=0,u()(c.every((function(e,t){return p=t,l.Qt.test(e)})),"All UUIDs must be valid UUIDv4; failed at ".concat(p,", got [").concat(c[p],"]")),e.next=19;break;case 15:return e.prev=15,e.t0=e.catch(10),(0,d.x5)("Failed to assert value during delete user; CAUSE: ".concat(e.t0)),e.abrupt("return",n.status(400).send());case 19:return e.prev=19,e.next=22,(0,O.cW)("UPDATE users\n SET user_algorithm = '".concat(l.oZ,"'\n WHERE user_uuid IN (").concat(S(c,{elementWrapper:"'",separator:","}),");"));case 22:f=e.sent,u()(0===f,"Write exited with code ".concat(f)),e.next=30;break;case 26:return e.prev=26,e.t1=e.catch(19),(0,d.x5)("Failed to delete user(s); CAUSE: ".concat(e.t1)),e.abrupt("return",n.status(500).send());case 30:n.status(204).send();case 31:case"end":return e.stop()}}),e,null,[[10,15],[19,26]])})));return function(t,n){return e.apply(this,arguments)}}();function Vo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:{},a=r.assign,o=void 0===a?function(e){return[e]}:a,i=r.key,s=r.route,c=void 0===s?"/":s;if("route"in n){var u=o(n),p=u.length;(0,d.Cr)("Set up route ".concat(c," with ").concat(p," handler(s)")),t.use.apply(t,[c].concat(ai(u)))}else i?e(t,n[i],{assign:o,route:cn().posix.join(c,String(i))}):Object.entries(n).forEach((function(n){var r=ri(n,2),a=r[0],i=r[1];e(t,i,{assign:o,route:cn().posix.join(c,a)})}))};function ci(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}const ui=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ci(o,r,a,i,s,"next",e)}function s(e){ci(o,r,a,i,s,"throw",e)}i(void 0)}))}}(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t=i()()).use((0,o.json)()),t.use(a()({origin:!0,credentials:!0})),e.t0=t,e.next=6,s.session;case 6:return e.t1=e.sent,e.t0.use.call(e.t0,e.t1),t.use(s.passport.initialize()),t.use(s.passport.authenticate("session")),t.use((function(e,t,n){var r=e.originalUrl,a=e.method;(0,d.Cr)("Received ".concat(a," ").concat(r)),n()})),si(t,ni.private,{assign:function(e){return[s.guardApi,e]},route:"/api"}),si(t,ni.public,{route:"/api"}),t.use(ni.static),e.abrupt("return",t);case 15:case"end":return e.stop()}}),e)})))()},9829:(e,t,n)=>{"use strict";n.d(t,{Pd:()=>I,pQ:()=>F,HI:()=>H,nP:()=>z,Yu:()=>q,pT:()=>$,M6:()=>W,zM:()=>G,tS:()=>Q,gA:()=>Z,R5:()=>V,QY:()=>K,rV:()=>J,Q7:()=>Y,eX:()=>X,OP:()=>D,ZP:()=>U,IO:()=>P,lu:()=>T,AB:()=>M,VD:()=>L,cW:()=>N}),n(8304),n(489),n(2419),n(8011),n(7941),n(2526),n(9753),n(1817),n(2165),n(8783),n(1038),n(7042),n(8309),n(5003),n(9554),n(4747),n(9337),n(3321),n(5666),n(7327),n(1539),n(2222),n(2564),n(4916),n(5306),n(2772),n(9600),n(8674),n(1249),n(935),n(3210),n(6992),n(3948),n(9653),n(3123),n(9070);var r=n(2081),a=n(2361),o=n.n(a),i=n(7147),s=n(7767),c=function(e){return e.replace(/\s+/g," ")},u=(n(2481),n(4151));function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}var l=["args"],d=["args","gid","restartInterval","stdio","uid"],f=["job_progress","line"];function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(e,t)||x(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){v(o,r,a,i,s,"next",e)}function s(e){v(o,r,a,i,s,"throw",e)}i(void 0)}))}}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=t.eventEmitterOptions,r=void 0===n?{}:n,a=t.startOptions,o=void 0===a?{}:a;S(this,c),C(O(e=i.call(this,r)),"MAP_TO_EVT_HDL",{connected:function(t){var n=t.options,r=t.ps;(0,u.HQ)(n,"Successfully started anvil-access-module daemon (pid=".concat(r.pid,"): ")),e.emit("active",r.pid)}});var s=o.args,p=void 0===s?[]:s,d=_(o,l),f=[].concat(y(p),["--emit-events",c.VERBOSE]).filter((function(e){return""!==e}));return e.ps=e.start(g({args:f},d)),e}return t=c,n=[{key:"start",value:function(){var e,t,n=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=a.args,i=void 0===o?[]:o,c=a.gid,p=void 0===c?s.cI:c,l=a.restartInterval,f=void 0===l?1e4:l,m=a.stdio,v=void 0===m?"pipe":m,h=a.uid,b=void 0===h?s.NF:h,y=_(a,d),x=g({args:i,gid:p,restartInterval:f,stdio:v,uid:b},y);(0,u.HQ)(x,"Starting anvil-access-module daemon with: ");var w=(0,r.spawn)(s.us.usr.sbin["anvil-access-module"].self,i,g({gid:p,stdio:v,uid:b},y));w.once("error",(function(e){(0,u.x5)("anvil-access-module daemon (pid=".concat(w.pid,") error: ").concat(e.message),e)})),w.once("close",(function(e,t){(0,u.HQ)({code:e,options:x,signal:t},"anvil-access-module daemon (pid=".concat(w.pid,") closed: ")),n.emit("inactive",w.pid),(0,u.Cr)("Waiting ".concat(f," before restarting.")),setTimeout((function(){n.ps=n.start(x)}),f)})),null===(e=w.stderr)||void 0===e||e.setEncoding("utf-8").on("data",(function(e){(0,u.x5)("anvil-access-module daemon stderr: ".concat(e))}));var S="";return null===(t=w.stdout)||void 0===t||t.setEncoding("utf-8").on("data",(function(e){for(var t=e.replace(/(\n)?event=([^\n]*)\n/g,(function(){for(var e,t=arguments.length,r=new Array(t),a=0;a1?a-1:0),i=1;i2&&void 0!==arguments[2]?arguments[2]:{},r=n.prefix,a=void 0===r?"":r,o=e.repeat(t);return o?"".concat(a).concat(o):""}("v",s.ST,{prefix:"-"}));var I=new R,T=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r,a,o,i,s,c,u,p=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=p.length>1&&void 0!==p[1]?p[1]:{},r=n.params,a=void 0===r?[]:r,o=n.pre,i="".concat((void 0===o?["Database"]:o).join("->"),"->").concat(t),s=a.map((function(e){var t;try{t=JSON.stringify(e)}catch(n){t=String(e)}return'"'.concat(t.replaceAll('"','\\"'),'"')})),e.next=5,I.interact.apply(I,["x",i].concat(y(s)));case 5:return c=e.sent,u=c.sub_results,e.abrupt("return",u);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),P=function(e){return I.interact("r",c(e))},N=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,I.interact("w",c(t));case 2:return n=e.sent,r=n.write_code,e.abrupt("return",r);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),U=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r,a,o,i,c,u,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.job_progress,r=void 0===n?s.sw:n,a=t.line,o=void 0===a?0:a,i=_(t,f),e.next=3,T("insert_or_update_jobs",{params:[g({job_progress:r,line:o},i)]});case 3:return c=e.sent,u=m(c,1),p=u[0],e.abrupt("return",p);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),D=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T("insert_or_update_users",{params:[t]});case 2:return n=e.sent,r=m(n,1),a=r[0],e.abrupt("return",a);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),L=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T("insert_or_update_variables",{params:[t]});case 2:return n=e.sent,r=m(n,1),a=r[0],e.abrupt("return",a);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),F=function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{jobHostUUID:void 0},o=a.jobHostUUID,i={file:__filename,job_command:s.us.usr.sbin["anvil-sync-shared"].self,job_data:t,job_name:"storage::".concat(e),job_title:"job_".concat(n),job_description:"job_".concat(r)};return o&&(i.job_host_uuid=o),U(i)},M=function(){var e;try{e=(0,u.hT)("--rfc-3339","ns").trim()}catch(e){throw new Error("Failed to get timestamp for database use; CAUSE: ".concat(e))}return e},H=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T("encrypt_password",{params:[t],pre:["Account"]});case 2:return n=e.sent,r=m(n,1),a=r[0],e.abrupt("return",a);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),q=function(){var e=h(regeneratorRuntime.mark((function e(){var t,n,r,a,o,i,s,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=c.length,n=new Array(t),r=0;r")),e.next=4,I.interact("x",a);case 4:return o=e.sent,i=m(o.sub_results,1),s=i[0],(0,u.HQ)(s,"".concat(a," data: ")),e.abrupt("return",s);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),B=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r,a,o,i,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.keys,r=t.operator,a=t.value,o="data->".concat(n.join("->")),e.next=4,I.interact("x",o,r,a);case 4:return i=e.sent,s=m(i.sub_results,1),c=s[0],(0,u.HQ)(c,"".concat(o," data: ")),e.abrupt("return",c);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),z=function(){var e=h(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T("get_anvils");case 2:return e.abrupt("return",q("anvils"));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),$=function(){var e=h(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B({keys:["database"],operator:"=",value:"{}"});case 2:return e.next=4,T("read_config",{pre:["Storage"]});case 4:if(t=e.sent,n=m(t,1),r=n[0],0===Number(r)){e.next=9;break}throw new Error("Failed to read config");case 9:return e.abrupt("return",q("database"));case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),W=function(){var e=h(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T("get_fence_data",{pre:["Striker"]});case 2:return e.abrupt("return",q("fence_data"));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),G=function(){var e=h(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T("get_hosts");case 2:return e.abrupt("return",q("hosts"));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Q=function(){var e;try{e=(0,i.readFileSync)(s.us.etc.hostname.self,{encoding:"utf-8"}).trim()}catch(e){throw new Error("Failed to get local host name; CAUSE: ".concat(e))}return(0,u.Cr)("localHostName=".concat(e)),e},Z=function(){var e;try{e=(0,i.readFileSync)(s.us.etc.anvil["host.uuid"].self,{encoding:"utf-8"}).trim()}catch(e){throw new Error("Failed to get local host UUID; CAUSE: ".concat(e))}return(0,u.Cr)("localHostUUID=[".concat(e,"]")),e},V=function(){var e=h(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T("load_manifest",{params:[{manifest_uuid:t}],pre:["Striker"]});case 2:return e.abrupt("return",q("manifests"));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),K=function(){var e=h(regeneratorRuntime.mark((function e(t,n){var r,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n){e.next=6;break}return e.next=4,G();case 4:a=e.sent,r=a.host_uuid[t].short_host_name;case 6:return e.next=8,T("load_interfaces",{params:[{host:r,host_uuid:t}],pre:["Network"]});case 8:return e.abrupt("return",q("network"));case 9:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),J=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r,a,o,i,s,c,u,p,l,d,f,v=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=v.length>1&&void 0!==v[1]?v[1]:{},r=n.password,a=n.port,e.next=3,T("get_peer_data",{params:[{password:r,port:a,target:t}],pre:["Striker"]});case 3:return o=e.sent,i=m(o,2),s=i[0],c=i[1],u=c.host_name,p=c.host_os,l=c.host_uuid,d=c.internet,f=c.os_registered,e.abrupt("return",{hostName:u,hostOS:p,hostUUID:l,isConnected:"1"===s,isInetConnected:"1"===d,isOSRegistered:"yes"===f});case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Y=function(){var e=h(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T("get_ups_data",{pre:["Striker"]});case 2:return e.abrupt("return",q("ups_data"));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),X=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r,a,o,i,s,c,p,l,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,P("SELECT variable_value FROM variables WHERE variable_name = 'server::".concat(t,"::vncinfo';"));case 2:if((n=e.sent).length){e.next=5;break}throw new Error("No record found");case 5:return r=m(n,1),a=m(r[0],1),o=a[0],i=o.split(":"),s=m(i,2),c=s[0],p=s[1],l=Number(p),d={domain:c,port:l,protocol:"ws"},(0,u.HQ)(d,"VNC info for server [".concat(t,"]: ")),e.abrupt("return",d);case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},6363:(e,t,n)=>{"use strict";function r(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);no}),n(9753),n(2526),n(1817),n(1539),n(2165),n(6992),n(8783),n(3948),n(1038),n(7042),n(8309),n(4916);const o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.parameters,a=void 0===n?[]:n,o=t.notCallableReturn;return"function"==typeof e?e.apply(void 0,r(a)):o}},3233:(e,t,n)=>{"use strict";n.d(t,{Q:()=>a}),n(2222);var r=n(7767),a=function(e){return"".concat(r.gM,".").concat(e)}},4541:(e,t,n)=>{"use strict";n.d(t,{F:()=>r});var r="local"},4707:(e,t,n)=>{"use strict";n.d(t,{I:()=>i}),n(4916),n(3123),n(3210),n(5827),n(1539),n(5306),n(9753),n(2526),n(1817),n(2165),n(6992),n(8783),n(3948),n(7042),n(8309),n(1038);var r=n(2081),a=n(5230);function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n{"use strict";n.d(t,{FZ:()=>u,Ke:()=>c,OU:()=>d,Qt:()=>f,ah:()=>l,tf:()=>p}),n(2222),n(4603),n(4916),n(9714);var r="[a-f0-9]",a="(?:25[0-5]|(?:2[0-4]|1[0-9]|[1-9]|)[0-9])",o="[a-z0-9]",i="[a-z0-9-]",s="(?:".concat(a,"[.]){3}").concat(a),c="".concat(r,"{8}-(?:").concat(r,"{4}-){3}").concat(r,"{12}"),u=new RegExp("^(?:".concat(o,"(?:").concat(i,"{0,61}").concat(o,")?[.])+").concat(o).concat(i,"{0,61}").concat(o,"$")),p=new RegExp("^".concat(s,"$")),l=new RegExp("(?:".concat(s,",)*").concat(s)),d=/^[^'"/\\><}{]+$/,f=new RegExp("^".concat(c,"$"))},5230:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o}),n(9554),n(1539),n(4747),n(7941),n(9600);var r=n(1017),a=n.n(r);const o=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a().parse(process.cwd()).root;return Object.keys(t).forEach((function(r){if("self"!==r){var o=a().join(n,r);t[r].self=o,e(t[r],o)}})),t}({etc:{anvil:{"host.uuid":{}},hostname:{}},mnt:{shared:{incoming:{}}},opt:{alteeve:{screenshots:{}}},tmp:{},usr:{bin:{date:{},getent:{},mkfifo:{},openssl:{},psql:{},rm:{},sed:{},uuidgen:{}},sbin:{"anvil-access-module":{},"anvil-boot-server":{},"anvil-configure-host":{},"anvil-delete-server":{},"anvil-join-anvil":{},"anvil-manage-alerts":{},"anvil-manage-keys":{},"anvil-manage-power":{},"anvil-provision-server":{},"anvil-safe-start":{},"anvil-safe-stop":{},"anvil-shutdown-server":{},"anvil-sync-shared":{},"anvil-update-system":{},"striker-boot-machine":{},"striker-initialize-host":{},"striker-manage-install-target":{},"striker-manage-peers":{},"striker-parse-os-list":{}}},var:{www:{html:{}}}})},7767:(e,t,n)=>{"use strict";n.d(t,{Vn:()=>l,gM:()=>p,ST:()=>d,sw:()=>f,oZ:()=>c,bR:()=>b,rj:()=>g,Uq:()=>y,Fe:()=>x.F,Su:()=>w,Im:()=>_.I,cI:()=>h,px:()=>m,NF:()=>v,Ke:()=>S.Ke,FZ:()=>S.FZ,tf:()=>S.tf,ah:()=>S.ah,OU:()=>S.OU,Qt:()=>S.Qt,us:()=>i.Z,C_:()=>s,wO:()=>E});var r,a,o,i=n(5230),s="striker-ui-api::session::secret",c="DELETED",u=(n(9653),n(4151)),p=null!==(r=process.env.COOKIE_PREFIX)&&void 0!==r?r:"suiapi",l=Number(process.env.COOKIE_ORIGINAL_MAX_AGE)||288e5,d=Number(process.env.DEBUG_ACCESS)||0,f=Number(process.env.DEFAULT_JOB_PROGRESS)||0,m=Number(process.env.PORT)||8080,v=(0,u.Sd)(null!==(a=process.env.PUID)&&void 0!==a?a:"striker-ui-api"),h=(0,u.X2)(null!==(o=process.env.PGID)&&void 0!==o?o:v),b=1,g=2,y="host_key_changed::",x=n(4541),w=8589934592,_=n(4707),S=n(9831),E="258EAFA5-E914-47DA-95CA-C5AB0DC85B11"},6151:(e,t,n)=>{"use strict";n.d(t,{H:()=>o,s:()=>i});var r=n(4541),a=n(9829),o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,a.gA)();return e===r.F?t:e},i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,a.gA)();return e===t?r.F:e}},972:(e,t,n)=>{"use strict";n.d(t,{N:()=>i}),n(4678),n(5827),n(1539),n(4916),n(3123);var r=n(6363),a={none:void 0,sql:n(4633).f},o={boolean:function(e){return Boolean(e)},number:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return parseFloat(String(e))||n},string:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e?t(e):n},"string[]":function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=n;return e instanceof Array?r=e.reduce((function(e,n){return n&&e.push(t(n)),e}),[]):e&&(r=t(e).split(/[,;]/)),r}},i=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.fallback,s=n.modifierType,c=void 0===s?"none":s,u=n.modifier,p=void 0===u?a[c]:u;return o[t](e,(function(e){var t=String(e);return(0,r.Z)(p,{notCallableReturn:t,parameters:[t]})}),i)}},4633:(e,t,n)=>{"use strict";n.d(t,{f:()=>r}),n(4916),n(5306);var r=function(e){return e.replace(/'/g,"''")}},4151:(e,t,n)=>{"use strict";n.d(t,{Cr:()=>b,HQ:()=>g,Sd:()=>v,Tt:()=>u,Vj:()=>y,X2:()=>m,aq:()=>l,hT:()=>p,rm:()=>d,x5:()=>h}),n(2222),n(9653),n(4916),n(3123),n(3210),n(9070),n(7941),n(2526),n(7327),n(1539),n(5003),n(9554),n(4747),n(9337),n(3321);var r=n(2081),a=n(5230);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=t.eol,r=void 0===n?"\n":n,a=t.stream,o=void 0===a?"stdout":a;return process[o].write("".concat(e).concat(r))},u=function(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:"Variables: ";return c("".concat(t).concat(JSON.stringify(e,null,2)))},y=function(){return function(){for(var e=arguments.length,t=new Array(e),n=0;n{"use strict";n.r(t),n.d(t,{assertAuthentication:()=>N,assertInit:()=>H,guardApi:()=>U,passport:()=>m,proxyServerVnc:()=>Z,proxyServerVncUpgrade:()=>V,session:()=>P}),n(5666),n(2222),n(8309),n(1539),n(8674),n(9753),n(2526),n(1817),n(2165),n(6992),n(8783),n(3948),n(7042),n(1038),n(4916);var r=n(8212),a=n.n(r),o=n(8462),i=n(7767),s=n(9829),c=n(972),u=n(4151);function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,"No existing session secret found."),o=n[0],c=1,r=function(e){if(Array.isArray(e))return e}(o)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(o,c)||function(e,t){if(e){if("string"==typeof e)return x(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x(e,t):void 0}}(o,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),t=r[0],(0,u.Cr)("Found an existing session secret."),e.abrupt("return",t);case 11:e.prev=11,e.t0=e.catch(0),(0,u.x5)("Failed to get session secret from database; CAUSE: ".concat(e.t0));case 14:try{t=(0,u.aq)("rand","-base64","32").trim(),(0,u.Cr)("Generated a new session secret.")}catch(e){(0,u.x5)("Failed to generate session secret; CAUSE: ".concat(e)),process.exit(i.rj)}return e.prev=15,e.next=18,(0,s.VD)({file:__filename,variable_name:i.C_,variable_value:t});case 18:a=e.sent,(0,u.Cr)("Recorded session secret as variable identified by ".concat(a,".")),e.next=26;break;case 22:e.prev=22,e.t1=e.catch(15),(0,u.x5)("Failed to record session secret; CAUSE: ".concat(e.t1)),process.exit(i.rj);case 26:return e.abrupt("return",t);case 27:case"end":return e.stop()}var o,c}),e,null,[[0,11],[15,22]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){w(o,r,a,i,s,"next",e)}function s(e){w(o,r,a,i,s,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{};return O(this,m),f.call(this,e)}return t=m,n=[{key:"destroy",value:(p=k(regeneratorRuntime.mark((function e(t,n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(0,u.Cr)("Destroy session ".concat(t)),e.prev=1,e.next=4,(0,s.cW)("UPDATE sessions\n SET session_salt = '".concat(i.oZ,"', modified_date = '").concat((0,s.AB)(),"'\n WHERE session_uuid = '").concat(t,"';"));case 4:r=e.sent,h()(0===r,"Write exited with code ".concat(r)),e.next=12;break;case 8:return e.prev=8,e.t0=e.catch(1),(0,u.x5)("Failed to complete DB write in destroy session ".concat(t,"; CAUSE: ").concat(e.t0)),e.abrupt("return",null==n?void 0:n.call(null,e.t0));case 12:return e.abrupt("return",null==n?void 0:n.call(null));case 13:case"end":return e.stop()}}),e,null,[[1,8]])}))),function(e,t){return p.apply(this,arguments)})},{key:"get",value:(c=k(regeneratorRuntime.mark((function e(t,n){var r,a,o,c,p,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(0,u.Cr)("Get session ".concat(t)),e.prev=1,e.next=4,(0,s.IO)("SELECT\n s.session_uuid,\n u.user_uuid,\n s.modified_date\n FROM sessions AS s\n JOIN users AS u\n ON s.session_user_uuid = u.user_uuid\n WHERE s.session_salt != '".concat(i.oZ,"'\n AND s.session_uuid = '").concat(t,"';"));case 4:r=e.sent,e.next=10;break;case 7:return e.prev=7,e.t0=e.catch(1),e.abrupt("return",n(e.t0));case 10:if(r.length){e.next=12;break}return e.abrupt("return",n(null));case 12:return d=r[0],f=3,a=function(e){if(Array.isArray(e))return e}(d)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}}(d,f)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}(d,f)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=a[1],c=a[2],p=m.calculateCookieMaxAge(c),l={cookie:{maxAge:p,originalMaxAge:i.Vn},passport:{user:o}},e.abrupt("return",n(null,l));case 16:case"end":return e.stop()}var d,f}),e,null,[[1,7]])}))),function(e,t){return c.apply(this,arguments)})},{key:"set",value:(o=k(regeneratorRuntime.mark((function e(t,n,r){var a,o,i,c,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(0,u.HQ)({session:n},"Set session ".concat(t,": ")),a=n.passport,o=(a=void 0===a?{}:a).user,e.prev=4,h().ok(o,"Missing user identifier"),i=(0,s.gA)(),c=(0,s.AB)(),e.next=10,(0,s.cW)("INSERT INTO\n sessions (\n session_uuid,\n session_host_uuid,\n session_user_uuid,\n session_salt,\n modified_date\n )\n VALUES\n (\n '".concat(t,"',\n '").concat(i,"',\n '").concat(o,"',\n '',\n '").concat(c,"'\n )\n ON CONFLICT (session_uuid)\n DO UPDATE SET modified_date = '").concat(c,"';"));case 10:p=e.sent,h()(0===p,"Write exited with code ".concat(p)),e.next=18;break;case 14:return e.prev=14,e.t0=e.catch(4),(0,u.x5)("Failed to complete DB write in set session ".concat(t,"; CAUSE: ").concat(e.t0)),e.abrupt("return",null==r?void 0:r.call(null,e.t0));case 18:return e.abrupt("return",null==r?void 0:r.call(null));case 19:case"end":return e.stop()}}),e,null,[[4,14]])}))),function(e,t,n){return o.apply(this,arguments)})},{key:"touch",value:(a=k(regeneratorRuntime.mark((function e(t,n,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(0,u.HQ)({session:n},"Touch session ".concat(t,": ")),e.abrupt("return",null==r?void 0:r.call(null));case 2:case"end":return e.stop()}}),e)}))),function(e,t,n){return a.apply(this,arguments)})}],r=[{key:"calculateCookieMaxAge",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.Vn,n=Date.parse(e),r=n+t,a=r-Date.now();return(0,u.HQ)({sessionModifiedDate:e,sessionDeadlineEpoch:r,cookieMaxAge:a}),a}}],n&&j(t.prototype,n),r&&j(t,r),Object.defineProperty(t,"prototype",{writable:!1}),m}(b.Store);const P=k(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=g(),e.t1={httpOnly:!0,maxAge:i.Vn,secure:!1},e.t2=function(e){var t=e.originalUrl,n=(0,u.Vj)();return(0,u.Cr)("Generated session identifier ".concat(n,"; access to ").concat(t)),n},e.t3=(0,y.Q)("sid"),e.next=6,_();case 6:return e.t4=e.sent,e.t5=new T,e.t6={cookie:e.t1,genid:e.t2,name:e.t3,resave:!1,saveUninitialized:!1,secret:e.t4,store:e.t5},e.abrupt("return",(0,e.t0)(e.t6));case 10:case"end":return e.stop()}}),e)})))();var N=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.fail,r=void 0===n?function(e,t,n){return n.status(404).send()}:n,a=t.failReturnTo,o=t.succeed,i=void 0===o?function(e,t,n){return n()}:o;!0===a?e=function(e){var t=e.originalUrl,n=e.url;return t||n}:"string"==typeof a&&(e=function(){return a});var s="string"==typeof r?function(e,t,n){return n.redirect(e?"".concat(r,"?rt=").concat(e):r)}:r,c="string"==typeof i?function(e,t){return t.redirect(i)}:i;return function(){for(var t,n=arguments.length,r=new Array(n),a=0;a0&&void 0!==arguments[0]?arguments[0]:{},t=e.fail,n=void 0===t?function(e,t){return t.status(401).send()}:t,r=e.hostUuid,a=void 0===r?i.Fe:r,o=e.invert,c=e.succeed,p=void 0===c?function(e,t,n){return n()}:c;return F(regeneratorRuntime.mark((function e(){var t,r,i,c,l,d,f,m=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=m.length,r=new Array(t),i=0;i0&&void 0!==arguments[0]?arguments[0]:"";return e.replace(new RegExp("^".concat(G,"/(").concat(i.Ke,")")),"$1")},Z=(0,B.createProxyMiddleware)({changeOrigin:!0,pathFilter:"".concat(G,"/*"),router:($=regeneratorRuntime.mark((function e(t){var n,r,a,o,i,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.url,r=Q(n),(0,u.Cr)("Got param [".concat(r,"] from [").concat(n,"]")),e.prev=3,e.next=6,(0,s.eX)(r);case 6:c=e.sent,a=c.domain,o=c.port,i=c.protocol,e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(3),(0,u.x5)("Failed to get server ".concat(r," VNC info; CAUSE: ").concat(e.t0)),e.abrupt("return");case 16:return e.abrupt("return",{host:a,protocol:i,port:o});case 17:case"end":return e.stop()}}),e,null,[[3,12]])})),W=function(){var e=this,t=arguments;return new Promise((function(n,r){var a=$.apply(e,t);function o(e){z(a,n,r,o,i,"next",e)}function i(e){z(a,n,r,o,i,"throw",e)}o(void 0)}))},function(e){return W.apply(this,arguments)}),on:{error:function(e,t,n){if((0,u.x5)("VNC proxy error: ".concat(e)),n){var r=Q(t.url),a=(0,y.Q)("vncerror.".concat(r)),o={code:"72c969b",message:e.message,name:e.name},s=JSON.stringify(o),c=encodeURIComponent(s),p="".concat(a,"=j:").concat(c,"; Path=/server; SameSite=Lax; Max-Age=3");if((0,u.HQ)({errapiCookie:p},"Error cookie: "),"writeHead"in n)return(0,u.Cr)("Found ServerResponse object"),n.writeHead(500,{"Set-Cookie":"".concat(p)}).end();(0,u.Cr)("Found Socket object");var l=t.headers["sec-websocket-key"],d=(0,q.createHash)("sha1").update(l+i.wO,"binary").digest("base64"),f=["HTTP/1.1 101 Switching Protocols","Connection: upgrade","Sec-WebSocket-Accept: ".concat(d),"Set-Cookie: ".concat(p),"Upgrade: websocket"];n.end("".concat(f.join("\r\n"),"\r\n"),"utf-8")}else(0,u.x5)("Missing response; got [".concat(n,"]"))}},ws:!0}),V=null!==(M=Z.upgrade)&&void 0!==M?M:function(){(0,u.Cr)("No upgrade handler for server VNC connection(s).")}},46:(e,t,n)=>{"use strict";var r=n(412)("body-parser"),a=Object.create(null);function o(e){return function(){return function(e){var t=a[e];if(void 0!==t)return t;switch(e){case"json":t=n(6035);break;case"raw":t=n(187);break;case"text":t=n(6560);break;case"urlencoded":t=n(4861)}return a[e]=t}(e)}}t=e.exports=r.function((function(e){var n=Object.create(e||null,{type:{configurable:!0,enumerable:!0,value:void 0,writable:!0}}),r=t.urlencoded(n),a=t.json(n);return function(e,t,n){a(e,t,(function(a){if(a)return n(a);r(e,t,n)}))}}),"bodyParser: use individual json/urlencoded middlewares"),Object.defineProperty(t,"json",{configurable:!0,enumerable:!0,get:o("json")}),Object.defineProperty(t,"raw",{configurable:!0,enumerable:!0,get:o("raw")}),Object.defineProperty(t,"text",{configurable:!0,enumerable:!0,get:o("text")}),Object.defineProperty(t,"urlencoded",{configurable:!0,enumerable:!0,get:o("urlencoded")})},3211:(e,t,n)=>{"use strict";var r=n(9009),a=n(6149),o=n(1045),i=n(4914),s=n(338),c=n(8170),u=n(9796);e.exports=function(e,t,n,p,l,d){var f,m,v=d;e._body=!0;var h=null!==v.encoding?v.encoding:null,b=v.verify;try{m=function(e,t,n){var a,o=(e.headers["content-encoding"]||"identity").toLowerCase(),i=e.headers["content-length"];if(t('content-encoding "%s"',o),!1===n&&"identity"!==o)throw r(415,"content encoding unsupported",{encoding:o,type:"encoding.unsupported"});switch(o){case"deflate":a=u.createInflate(),t("inflate body"),e.pipe(a);break;case"gzip":a=u.createGunzip(),t("gunzip body"),e.pipe(a);break;case"identity":(a=e).length=i;break;default:throw r(415,'unsupported content encoding "'+o+'"',{encoding:o,type:"encoding.unsupported"})}return a}(e,l,v.inflate),f=m.length,m.length=void 0}catch(e){return n(e)}if(v.length=f,v.encoding=b?null:h,null===v.encoding&&null!==h&&!i.encodingExists(h))return n(r(415,'unsupported charset "'+h.toUpperCase()+'"',{charset:h.toLowerCase(),type:"charset.unsupported"}));l("read body"),o(m,v,(function(o,u){var d;if(o)return d="encoding.unsupported"===o.type?r(415,'unsupported charset "'+h.toUpperCase()+'"',{charset:h.toLowerCase(),type:"charset.unsupported"}):r(400,o),m!==e&&(c(e),a(m,!0)),void function(e,t){s.isFinished(e)?t():(s(e,t),e.resume())}(e,(function(){n(r(400,d))}));if(b)try{l("verify body"),b(e,t,u,h)}catch(e){return void n(r(403,e,{body:u,type:e.type||"entity.verify.failed"}))}var f=u;try{l("parse body"),f="string"!=typeof u&&null!==h?i.decode(u,h):u,e.body=p(f)}catch(e){return void n(r(400,e,{body:f,type:e.type||"entity.parse.failed"}))}n()}))}},6035:(e,t,n)=>{"use strict";var r=n(9830),a=n(7811),o=n(9009),i=n(5158)("body-parser:json"),s=n(3211),c=n(273);e.exports=function(e){var t=e||{},n="number"!=typeof t.limit?r.parse(t.limit||"100kb"):t.limit,f=!1!==t.inflate,m=t.reviver,v=!1!==t.strict,h=t.type||"application/json",b=t.verify||!1;if(!1!==b&&"function"!=typeof b)throw new TypeError("option verify must be function");var g="function"!=typeof h?function(e){return function(t){return Boolean(c(t,e))}}(h):h;function y(e){if(0===e.length)return{};if(v){var t=(n=e,(r=u.exec(n))?r[1]:void 0);if("{"!==t&&"["!==t)throw i("strict violation"),function(e,t){var n=e.indexOf(t),r="";if(-1!==n){r=e.substring(0,n)+p;for(var a=n+1;a{"use strict";var r=n(9830),a=n(5158)("body-parser:raw"),o=n(3211),i=n(273);e.exports=function(e){var t=e||{},n=!1!==t.inflate,s="number"!=typeof t.limit?r.parse(t.limit||"100kb"):t.limit,c=t.type||"application/octet-stream",u=t.verify||!1;if(!1!==u&&"function"!=typeof u)throw new TypeError("option verify must be function");var p="function"!=typeof c?function(e){return function(t){return Boolean(i(t,e))}}(c):c;function l(e){return e}return function(e,t,r){return e._body?(a("body already parsed"),void r()):(e.body=e.body||{},i.hasBody(e)?(a("content-type %j",e.headers["content-type"]),p(e)?void o(e,t,r,l,a,{encoding:null,inflate:n,limit:s,verify:u}):(a("skip parsing"),void r())):(a("skip empty body"),void r()))}}},6560:(e,t,n)=>{"use strict";var r=n(9830),a=n(7811),o=n(5158)("body-parser:text"),i=n(3211),s=n(273);e.exports=function(e){var t=e||{},n=t.defaultCharset||"utf-8",c=!1!==t.inflate,u="number"!=typeof t.limit?r.parse(t.limit||"100kb"):t.limit,p=t.type||"text/plain",l=t.verify||!1;if(!1!==l&&"function"!=typeof l)throw new TypeError("option verify must be function");var d="function"!=typeof p?function(e){return function(t){return Boolean(s(t,e))}}(p):p;function f(e){return e}return function(e,t,r){if(e._body)return o("body already parsed"),void r();if(e.body=e.body||{},!s.hasBody(e))return o("skip empty body"),void r();if(o("content-type %j",e.headers["content-type"]),!d(e))return o("skip parsing"),void r();var p=function(e){try{return(a.parse(e).parameters.charset||"").toLowerCase()}catch(e){return}}(e)||n;i(e,t,r,f,o,{encoding:p,inflate:c,limit:u,verify:l})}}},4861:(e,t,n)=>{"use strict";var r=n(9830),a=n(7811),o=n(9009),i=n(5158)("body-parser:urlencoded"),s=n(412)("body-parser"),c=n(3211),u=n(273);e.exports=function(e){var t=e||{};void 0===t.extended&&s("undefined extended: provide extended option");var n=!1!==t.extended,p=!1!==t.inflate,f="number"!=typeof t.limit?r.parse(t.limit||"100kb"):t.limit,m=t.type||"application/x-www-form-urlencoded",v=t.verify||!1;if(!1!==v&&"function"!=typeof v)throw new TypeError("option verify must be function");var h=n?function(e){var t=void 0!==e.parameterLimit?e.parameterLimit:1e3,n=d("qs");if(isNaN(t)||t<1)throw new TypeError("option parameterLimit must be a positive number");return isFinite(t)&&(t|=0),function(e){var r=l(e,t);if(void 0===r)throw i("too many parameters"),o(413,"too many parameters",{type:"parameters.too.many"});var a=Math.max(100,r);return i("parse extended urlencoding"),n(e,{allowPrototypes:!0,arrayLimit:a,depth:1/0,parameterLimit:t})}}(t):function(e){var t=void 0!==e.parameterLimit?e.parameterLimit:1e3,n=d("querystring");if(isNaN(t)||t<1)throw new TypeError("option parameterLimit must be a positive number");return isFinite(t)&&(t|=0),function(e){if(void 0===l(e,t))throw i("too many parameters"),o(413,"too many parameters",{type:"parameters.too.many"});return i("parse urlencoding"),n(e,void 0,void 0,{maxKeys:t})}}(t),b="function"!=typeof m?function(e){return function(t){return Boolean(u(t,e))}}(m):m;function g(e){return e.length?h(e):{}}return function(e,t,n){if(e._body)return i("body already parsed"),void n();if(e.body=e.body||{},!u.hasBody(e))return i("skip empty body"),void n();if(i("content-type %j",e.headers["content-type"]),!b(e))return i("skip parsing"),void n();var r=function(e){try{return(a.parse(e).parameters.charset||"").toLowerCase()}catch(e){return}}(e)||"utf-8";if("utf-8"!==r)return i("invalid charset"),void n(o(415,'unsupported charset "'+r.toUpperCase()+'"',{charset:r,type:"charset.unsupported"}));c(e,t,n,g,i,{debug:i,encoding:r,inflate:p,limit:f,verify:v})}};var p=Object.create(null);function l(e,t){for(var n=0,r=0;-1!==(r=e.indexOf("&",r));)if(r++,++n===t)return;return n}function d(e){var t=p[e];if(void 0!==t)return t.parse;switch(e){case"qs":t=n(129);break;case"querystring":t=n(3477)}return p[e]=t,t.parse}},6744:(e,t,n)=>{"use strict";const r=n(3349),a=n(7529),o=n(8050),i=n(4339),s=(e,t={})=>{let n=[];if(Array.isArray(e))for(const r of e){const e=s.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(s.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};s.parse=(e,t={})=>i(e,t),s.stringify=(e,t={})=>r("string"==typeof e?s.parse(e,t):e,t),s.compile=(e,t={})=>("string"==typeof e&&(e=s.parse(e,t)),a(e,t)),s.expand=(e,t={})=>{"string"==typeof e&&(e=s.parse(e,t));let n=o(e,t);return!0===t.noempty&&(n=n.filter(Boolean)),!0===t.nodupes&&(n=[...new Set(n)]),n},s.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?s.compile(e,t):s.expand(e,t),e.exports=s},7529:(e,t,n)=>{"use strict";const r=n(2664),a=n(3083);e.exports=(e,t={})=>{const n=(e,o={})=>{const i=a.isInvalidBrace(o),s=!0===e.invalid&&!0===t.escapeInvalid,c=!0===i||!0===s,u=!0===t.escapeInvalid?"\\":"";let p="";if(!0===e.isOpen)return u+e.value;if(!0===e.isClose)return console.log("node.isClose",u,e.value),u+e.value;if("open"===e.type)return c?u+e.value:"(";if("close"===e.type)return c?u+e.value:")";if("comma"===e.type)return"comma"===e.prev.type?"":c?e.value:"|";if(e.value)return e.value;if(e.nodes&&e.ranges>0){const n=a.reduce(e.nodes),o=r(...n,{...t,wrap:!1,toRegex:!0,strictZeros:!0});if(0!==o.length)return n.length>1&&o.length>1?`(${o})`:o}if(e.nodes)for(const t of e.nodes)p+=n(t,e);return p};return n(e)}},6611:e=>{"use strict";e.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"}},8050:(e,t,n)=>{"use strict";const r=n(2664),a=n(3349),o=n(3083),i=(e="",t="",n=!1)=>{const r=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return n?o.flatten(t).map((e=>`{${e}}`)):t;for(const a of e)if(Array.isArray(a))for(const e of a)r.push(i(e,t,n));else for(let e of t)!0===n&&"string"==typeof e&&(e=`{${e}}`),r.push(Array.isArray(e)?i(a,e,n):a+e);return o.flatten(r)};e.exports=(e,t={})=>{const n=void 0===t.rangeLimit?1e3:t.rangeLimit,s=(e,c={})=>{e.queue=[];let u=c,p=c.queue;for(;"brace"!==u.type&&"root"!==u.type&&u.parent;)u=u.parent,p=u.queue;if(e.invalid||e.dollar)return void p.push(i(p.pop(),a(e,t)));if("brace"===e.type&&!0!==e.invalid&&2===e.nodes.length)return void p.push(i(p.pop(),["{}"]));if(e.nodes&&e.ranges>0){const s=o.reduce(e.nodes);if(o.exceedsLimit(...s,t.step,n))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let c=r(...s,t);return 0===c.length&&(c=a(e,t)),p.push(i(p.pop(),c)),void(e.nodes=[])}const l=o.encloseBrace(e);let d=e.queue,f=e;for(;"brace"!==f.type&&"root"!==f.type&&f.parent;)f=f.parent,d=f.queue;for(let t=0;t{"use strict";const r=n(3349),{MAX_LENGTH:a,CHAR_BACKSLASH:o,CHAR_BACKTICK:i,CHAR_COMMA:s,CHAR_DOT:c,CHAR_LEFT_PARENTHESES:u,CHAR_RIGHT_PARENTHESES:p,CHAR_LEFT_CURLY_BRACE:l,CHAR_RIGHT_CURLY_BRACE:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_RIGHT_SQUARE_BRACKET:m,CHAR_DOUBLE_QUOTE:v,CHAR_SINGLE_QUOTE:h,CHAR_NO_BREAK_SPACE:b,CHAR_ZERO_WIDTH_NOBREAK_SPACE:g}=n(6611);e.exports=(e,t={})=>{if("string"!=typeof e)throw new TypeError("Expected a string");const n=t||{},y="number"==typeof n.maxLength?Math.min(a,n.maxLength):a;if(e.length>y)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${y})`);const x={type:"root",input:e,nodes:[]},w=[x];let _=x,S=x,E=0;const A=e.length;let k,O=0,j=0;const C=()=>e[O++],R=e=>{if("text"===e.type&&"dot"===S.type&&(S.type="text"),!S||"text"!==S.type||"text"!==e.type)return _.nodes.push(e),e.parent=_,e.prev=S,S=e,e;S.value+=e.value};for(R({type:"bos"});O0){if(_.ranges>0){_.ranges=0;const e=_.nodes.shift();_.nodes=[e,{type:"text",value:r(_)}]}R({type:"comma",value:k}),_.commas++}else if(k===c&&j>0&&0===_.commas){const e=_.nodes;if(0===j||0===e.length){R({type:"text",value:k});continue}if("dot"===S.type){if(_.range=[],S.value+=k,S.type="range",3!==_.nodes.length&&5!==_.nodes.length){_.invalid=!0,_.ranges=0,S.type="text";continue}_.ranges++,_.args=[];continue}if("range"===S.type){e.pop();const t=e[e.length-1];t.value+=S.value+k,S=t,_.ranges--;continue}R({type:"dot",value:k})}else R({type:"text",value:k});else{if("brace"!==_.type){R({type:"text",value:k});continue}const e="close";_=w.pop(),_.close=!0,R({type:e,value:k}),j--,_=w[w.length-1]}else{j++;const e=S.value&&"$"===S.value.slice(-1)||!0===_.dollar;_=R({type:"brace",open:!0,close:!1,dollar:e,depth:j,commas:0,ranges:0,nodes:[]}),w.push(_),R({type:"open",value:k})}else{const e=k;let n;for(!0!==t.keepQuotes&&(k="");O{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));const e=w[w.length-1],t=e.nodes.indexOf(_);e.nodes.splice(t,1,..._.nodes)}}while(w.length>0);return R({type:"eos"}),x}},3349:(e,t,n)=>{"use strict";const r=n(3083);e.exports=(e,t={})=>{const n=(e,a={})=>{const o=t.escapeInvalid&&r.isInvalidBrace(a),i=!0===e.invalid&&!0===t.escapeInvalid;let s="";if(e.value)return(o||i)&&r.isOpenOrClose(e)?"\\"+e.value:e.value;if(e.value)return e.value;if(e.nodes)for(const t of e.nodes)s+=n(t);return s};return n(e)}},3083:(e,t)=>{"use strict";t.isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),t.find=(e,t)=>e.nodes.find((e=>e.type===t)),t.exceedsLimit=(e,n,r=1,a)=>!1!==a&&!(!t.isInteger(e)||!t.isInteger(n))&&(Number(n)-Number(e))/Number(r)>=a,t.escapeNode=(e,t=0,n)=>{const r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},t.encloseBrace=e=>"brace"===e.type&&e.commas>>0+e.ranges>>0==0&&(e.invalid=!0,!0),t.isInvalidBrace=e=>!("brace"!==e.type||!0!==e.invalid&&!e.dollar&&(e.commas>>0+e.ranges>>0!=0&&!0===e.open&&!0===e.close||(e.invalid=!0,0))),t.isOpenOrClose=e=>"open"===e.type||"close"===e.type||!0===e.open||!0===e.close,t.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),t.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r{"use strict";const{parseContentType:r}=n(1510),a=[n(7626),n(4403)].filter((function(e){return"function"==typeof e.detect}));e.exports=e=>{if("object"==typeof e&&null!==e||(e={}),"object"!=typeof e.headers||null===e.headers||"string"!=typeof e.headers["content-type"])throw new Error("Missing Content-Type");return function(e){const t=e.headers,n=r(t["content-type"]);if(!n)throw new Error("Malformed content type");for(const r of a){if(!r.detect(n))continue;const a={limits:e.limits,headers:t,conType:n,highWaterMark:void 0,fileHwm:void 0,defCharset:void 0,defParamCharset:void 0,preservePath:!1};return e.highWaterMark&&(a.highWaterMark=e.highWaterMark),e.fileHwm&&(a.fileHwm=e.fileHwm),a.defCharset=e.defCharset,a.defParamCharset=e.defParamCharset,a.preservePath=e.preservePath,new r(a)}throw new Error(`Unsupported content type: ${t["content-type"]}`)}(e)}},7626:(e,t,n)=>{"use strict";const{Readable:r,Writable:a}=n(2781),o=n(1301),{basename:i,convertToUTF8:s,getDecoder:c,parseContentType:u,parseDisposition:p}=n(1510),l=Buffer.from("\r\n"),d=Buffer.from("\r"),f=Buffer.from("-");function m(){}const v=16384;class h{constructor(e){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name="",this.value="",this.crlf=0,this.cb=e}reset(){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name="",this.value="",this.crlf=0}push(e,t,n){let r=t;for(;t{if(this._read(),0==--t._fileEndsLeft&&t._finalcb){const e=t._finalcb;t._finalcb=null,process.nextTick(e)}}))}_read(e){const t=this._readcb;t&&(this._readcb=null,t())}}const g={push:(e,t)=>{},destroy:()=>{}};function y(e,t){return e}function x(e,t,n){if(n)return t(n);t(n=w(e))}function w(e){if(e._hparser)return new Error("Malformed part header");const t=e._fileStream;return t&&(e._fileStream=null,t.destroy(new Error("Unexpected end of file"))),e._complete?void 0:new Error("Unexpected end of form")}const _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],S=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];e.exports=class extends a{constructor(e){if(super({autoDestroy:!0,emitClose:!0,highWaterMark:"number"==typeof e.highWaterMark?e.highWaterMark:void 0}),!e.conType.params||"string"!=typeof e.conType.params.boundary)throw new Error("Multipart: Boundary not found");const t=e.conType.params.boundary,n="string"==typeof e.defParamCharset&&e.defParamCharset?c(e.defParamCharset):y,r=e.defCharset||"utf8",a=e.preservePath,v={autoDestroy:!0,emitClose:!0,highWaterMark:"number"==typeof e.fileHwm?e.fileHwm:void 0},x=e.limits,w=x&&"number"==typeof x.fieldSize?x.fieldSize:1048576,_=x&&"number"==typeof x.fileSize?x.fileSize:1/0,S=x&&"number"==typeof x.files?x.files:1/0,E=x&&"number"==typeof x.fields?x.fields:1/0,A=x&&"number"==typeof x.parts?x.parts:1/0;let k=-1,O=0,j=0,C=!1;this._fileEndsLeft=0,this._fileStream=void 0,this._complete=!1;let R,I,T,P,N,U=0,D=0,L=!1,F=!1,M=!1;this._hparser=null;const H=new h((e=>{let t;if(this._hparser=null,C=!1,P="text/plain",I=r,T="7bit",N=void 0,L=!1,!e["content-disposition"])return void(C=!0);const o=p(e["content-disposition"][0],n);if(o&&"form-data"===o.type){if(o.params&&(o.params.name&&(N=o.params.name),o.params["filename*"]?t=o.params["filename*"]:o.params.filename&&(t=o.params.filename),void 0===t||a||(t=i(t))),e["content-type"]){const t=u(e["content-type"][0]);t&&(P=`${t.type}/${t.subtype}`,t.params&&"string"==typeof t.params.charset&&(I=t.params.charset.toLowerCase()))}if(e["content-transfer-encoding"]&&(T=e["content-transfer-encoding"][0].toLowerCase()),"application/octet-stream"===P||void 0!==t){if(j===S)return F||(F=!0,this.emit("filesLimit")),void(C=!0);if(++j,0===this.listenerCount("file"))return void(C=!0);U=0,this._fileStream=new b(v,this),++this._fileEndsLeft,this.emit("file",N,this._fileStream,{filename:t,encoding:T,mimeType:P})}else{if(O===E)return M||(M=!0,this.emit("fieldsLimit")),void(C=!0);if(++O,0===this.listenerCount("field"))return void(C=!0);R=[],D=0}}else C=!0}));let q=0;const B=(e,t,n,r,a)=>{e:for(;t;){if(null!==this._hparser){const e=this._hparser.push(t,n,r);if(-1===e){this._hparser=null,H.reset(),this.emit("error",new Error("Malformed part header"));break}n=e}if(n===r)break;if(0!==q){if(1===q){switch(t[n]){case 45:q=2,++n;break;case 13:q=3,++n;break;default:q=0}if(n===r)return}if(2===q){if(q=0,45===t[n])return this._complete=!0,void(this._bparser=g);const e=this._writecb;this._writecb=m,B(!1,f,0,1,!1),this._writecb=e}else if(3===q){if(q=0,10===t[n]){if(++n,k>=A)break;if(this._hparser=H,n===r)break;continue e}{const e=this._writecb;this._writecb=m,B(!1,d,0,1,!1),this._writecb=e}}}if(!C)if(this._fileStream){let e;const o=Math.min(r-n,_-U);a?e=t.slice(n,n+o):(e=Buffer.allocUnsafe(o),t.copy(e,0,n,n+o)),U+=e.length,U===_?(e.length>0&&this._fileStream.push(e),this._fileStream.emit("limit"),this._fileStream.truncated=!0,C=!0):this._fileStream.push(e)||(this._writecb&&(this._fileStream._readcb=this._writecb),this._writecb=null)}else if(void 0!==R){let e;const o=Math.min(r-n,w-D);a?e=t.slice(n,n+o):(e=Buffer.allocUnsafe(o),t.copy(e,0,n,n+o)),D+=o,R.push(e),D===w&&(C=!0,L=!0)}break}if(e){if(q=1,this._fileStream)this._fileStream.push(null),this._fileStream=null;else if(void 0!==R){let e;switch(R.length){case 0:e="";break;case 1:e=s(R[0],I,0);break;default:e=s(Buffer.concat(R,D),I,0)}R=void 0,D=0,this.emit("field",N,e,{nameTruncated:!1,valueTruncated:L,encoding:T,mimeType:P})}++k===A&&this.emit("partsLimit")}};this._bparser=new o(`\r\n--${t}`,B),this._writecb=null,this._finalcb=null,this.write(l)}static detect(e){return"multipart"===e.type&&"form-data"===e.subtype}_write(e,t,n){this._writecb=n,this._bparser.push(e,0),this._writecb&&function(e,t){const n=e._writecb;e._writecb=null,n&&n()}(this)}_destroy(e,t){this._hparser=null,this._bparser=g,e||(e=w(this));const n=this._fileStream;n&&(this._fileStream=null,n.destroy(e)),t(e)}_final(e){if(this._bparser.destroy(),!this._complete)return e(new Error("Unexpected end of form"));this._fileEndsLeft?this._finalcb=x.bind(null,this,e):x(this,e)}}},4403:(e,t,n)=>{"use strict";const{Writable:r}=n(2781),{getDecoder:a}=n(1510);function o(e,t,n,r){if(n>=r)return r;if(-1===e._byte){const a=c[t[n++]];if(-1===a)return-1;if(a>=8&&(e._encode=2),ne.fieldNameSizeLimit){for(e._keyTrunc||e._lastPose.fieldSizeLimit){for(e._valTrunc||e._lastPos=this.fieldsLimit)return n();let r=0;const a=e.length;if(this._lastPos=0,-2!==this._byte){if(r=o(this,e,r,a),-1===r)return n(new Error("Malformed urlencoded form"));if(r>=a)return n();this._inKey?++this._bytesKey:++this._bytesVal}e:for(;r0&&this.emit("field",this._key,"",{nameTruncated:this._keyTrunc,valueTruncated:!1,encoding:this.charset,mimeType:"text/plain"}),this._key="",this._val="",this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit("fieldsLimit"),n();continue;case 43:this._lastPos=a)return n();++this._bytesKey,r=i(this,e,r,a);continue}++r,++this._bytesKey,r=i(this,e,r,a)}this._lastPos0||this._bytesVal>0)&&this.emit("field",this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:"text/plain"}),this._key="",this._val="",this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit("fieldsLimit"),n();continue e;case 43:this._lastPos=a)return n();++this._bytesVal,r=s(this,e,r,a);continue}++r,++this._bytesVal,r=s(this,e,r,a)}this._lastPos0||this._bytesVal>0)&&(this._inKey?this._key=this._decoder(this._key,this._encode):this._val=this._decoder(this._val,this._encode),this.emit("field",this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:"text/plain"})),e()}}},1510:function(e){"use strict";function t(e,t,n){for(;t=128?r=2:0===r&&(r=1);continue}return}break}}if(m+=e.slice(d,t),m=o(m,f,r),void 0===m)return}else{if(++t===e.length)return;if(34===e.charCodeAt(t)){d=++t;let n=!1;for(;t{if(0===e.length)return"";if("string"==typeof e){if(t<2)return e;e=Buffer.from(e,"latin1")}return e.utf8Slice(0,e.length)},latin1:(e,t)=>0===e.length?"":"string"==typeof e?e:e.latin1Slice(0,e.length),utf16le:(e,t)=>0===e.length?"":("string"==typeof e&&(e=Buffer.from(e,"latin1")),e.ucs2Slice(0,e.length)),base64:(e,t)=>0===e.length?"":("string"==typeof e&&(e=Buffer.from(e,"latin1")),e.base64Slice(0,e.length)),other:(e,t)=>{if(0===e.length)return"";"string"==typeof e&&(e=Buffer.from(e,"latin1"));try{return new TextDecoder(this).decode(e)}catch{}}};function o(e,t,n){const a=r(t);if(a)return a(e,n)}const i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],p=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];e.exports={basename:function(e){if("string"!=typeof e)return"";for(let t=e.length-1;t>=0;--t)switch(e.charCodeAt(t)){case 47:case 92:return".."===(e=e.slice(t+1))||"."===e?"":e}return".."===e||"."===e?"":e},convertToUTF8:o,getDecoder:r,parseContentType:function(e){if(0===e.length)return;const n=Object.create(null);let r=0;for(;r{"use strict";e.exports=function(e,t){return"string"==typeof e?i(e):"number"==typeof e?o(e,t):null},e.exports.format=o,e.exports.parse=i;var t=/\B(?=(\d{3})+(?!\d))/g,n=/(?:\.0*|(\.[^0]+)0+)$/,r={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},a=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function o(e,a){if(!Number.isFinite(e))return null;var o=Math.abs(e),i=a&&a.thousandsSeparator||"",s=a&&a.unitSeparator||"",c=a&&void 0!==a.decimalPlaces?a.decimalPlaces:2,u=Boolean(a&&a.fixedDecimals),p=a&&a.unit||"";p&&r[p.toLowerCase()]||(p=o>=r.pb?"PB":o>=r.tb?"TB":o>=r.gb?"GB":o>=r.mb?"MB":o>=r.kb?"KB":"B");var l=(e/r[p.toLowerCase()]).toFixed(c);return u||(l=l.replace(n,"$1")),i&&(l=l.split(".").map((function(e,n){return 0===n?e.replace(t,i):e})).join(".")),l+s+p}function i(e){if("number"==typeof e&&!isNaN(e))return e;if("string"!=typeof e)return null;var t,n=a.exec(e),o="b";return n?(t=parseFloat(n[1]),o=n[4].toLowerCase()):(t=parseInt(e,10),o="b"),isNaN(t)?null:Math.floor(r[o]*t)}},1924:(e,t,n)=>{"use strict";var r=n(210),a=n(5559),o=a(r("String.prototype.indexOf"));e.exports=function(e,t){var n=r(e,!!t);return"function"==typeof n&&o(e,".prototype.")>-1?a(n):n}},5559:(e,t,n)=>{"use strict";var r=n(8612),a=n(210),o=a("%Function.prototype.apply%"),i=a("%Function.prototype.call%"),s=a("%Reflect.apply%",!0)||r.call(i,o),c=a("%Object.getOwnPropertyDescriptor%",!0),u=a("%Object.defineProperty%",!0),p=a("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function(e){var t=s(r,i,arguments);if(c&&u){var n=c(t,"length");n.configurable&&u(t,"length",{value:1+p(0,e.length-(arguments.length-1))})}return t};var l=function(){return s(r,o,arguments)};u?u(e.exports,"apply",{value:l}):e.exports.apply=l},7389:(e,t,n)=>{"use strict";e.exports=function(e,t){var n=t||{},a=n.type||"attachment",o=function(e,t){if(void 0!==e){var n={};if("string"!=typeof e)throw new TypeError("filename must be a string");if(void 0===t&&(t=!0),"string"!=typeof t&&"boolean"!=typeof t)throw new TypeError("fallback must be a string or boolean");if("string"==typeof t&&c.test(t))throw new TypeError("fallback must be ISO-8859-1 string");var a=r(e),o=d.test(a),s="string"!=typeof t?t&&b(a):r(t),u="string"==typeof s&&s!==a;return(u||!o||i.test(a))&&(n["filename*"]=a),(o||u)&&(n.filename=u?s:a),n}}(e,n.fallback);return function(e){var t=e.parameters,n=e.type;if(!n||"string"!=typeof n||!f.test(n))throw new TypeError("invalid type");var r=String(n).toLowerCase();if(t&&"object"==typeof t)for(var a,o=Object.keys(t).sort(),i=0;i?@[\\\]{}\x7f]/g,i=/%[0-9A-Fa-f]{2}/,s=/%([0-9A-Fa-f]{2})/g,c=/[^\x20-\x7e\xa0-\xff]/g,u=/\\([\u0000-\u007f])/g,p=/([\\"])/g,l=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,d=/^[\x20-\x7e\x80-\xff]+$/,f=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,m=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,v=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function h(e){var t=m.exec(e);if(!t)throw new TypeError("invalid extended field value");var n,r=t[1].toLowerCase(),o=t[2].replace(s,g);switch(r){case"iso-8859-1":n=b(o);break;case"utf-8":n=a.from(o,"binary").toString("utf8");break;default:throw new TypeError("unsupported charset in extended field")}return n}function b(e){return String(e).replace(c,"?")}function g(e,t){return String.fromCharCode(parseInt(t,16))}function y(e){return"%"+String(e).charCodeAt(0).toString(16).toUpperCase()}function x(e){return'"'+String(e).replace(p,"\\$1")+'"'}function w(e){var t=String(e);return"UTF-8''"+encodeURIComponent(t).replace(o,y)}function _(e,t){this.type=e,this.parameters=t}},7296:(e,t,n)=>{var r=n(4300),a=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return a(e,t,n)}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=i),i.prototype=Object.create(a.prototype),o(a,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return a(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=a(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},7811:(e,t)=>{"use strict";var n=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,a=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,o=/\\([\u000b\u0020-\u00ff])/g,i=/([\\"])/g,s=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function c(e){var t=String(e);if(a.test(t))return t;if(t.length>0&&!r.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(i,"\\$1")+'"'}function u(e){this.parameters=Object.create(null),this.type=e}t.format=function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,n=e.type;if(!n||!s.test(n))throw new TypeError("invalid type");var r=n;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),u=0;u{var r=n(6113);function a(e){return r.createHash("sha1").update(e).digest("hex")}t.sign=function(e,t){if("string"!=typeof e)throw new TypeError("Cookie value must be provided as a string.");if("string"!=typeof t)throw new TypeError("Secret string must be provided.");return e+"."+r.createHmac("sha256",t).update(e).digest("base64").replace(/\=+$/,"")},t.unsign=function(e,n){if("string"!=typeof e)throw new TypeError("Signed cookie string must be provided.");if("string"!=typeof n)throw new TypeError("Secret string must be provided.");var r=e.slice(0,e.lastIndexOf("."));return a(t.sign(r,n))==a(e)&&r}},6489:(e,t)=>{"use strict";t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},r=(t||{}).decode||a,o=0;o{var r=n(614),a=n(6330),o=TypeError;e.exports=function(e){if(r(e))return e;throw o(a(e)+" is not a function")}},9483:(e,t,n)=>{var r=n(4411),a=n(6330),o=TypeError;e.exports=function(e){if(r(e))return e;throw o(a(e)+" is not a constructor")}},6077:(e,t,n)=>{var r=n(614),a=String,o=TypeError;e.exports=function(e){if("object"==typeof e||r(e))return e;throw o("Can't set "+a(e)+" as a prototype")}},1223:(e,t,n)=>{var r=n(5112),a=n(30),o=n(3070).f,i=r("unscopables"),s=Array.prototype;null==s[i]&&o(s,i,{configurable:!0,value:a(null)}),e.exports=function(e){s[i][e]=!0}},1530:(e,t,n)=>{"use strict";var r=n(8710).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},5787:(e,t,n)=>{var r=n(7976),a=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw a("Incorrect invocation")}},9670:(e,t,n)=>{var r=n(111),a=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw o(a(e)+" is not an object")}},8533:(e,t,n)=>{"use strict";var r=n(2092).forEach,a=n(9341)("forEach");e.exports=a?[].forEach:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}},8457:(e,t,n)=>{"use strict";var r=n(9974),a=n(6916),o=n(7908),i=n(3411),s=n(7659),c=n(4411),u=n(6244),p=n(6135),l=n(4121),d=n(1246),f=Array;e.exports=function(e){var t=o(e),n=c(this),m=arguments.length,v=m>1?arguments[1]:void 0,h=void 0!==v;h&&(v=r(v,m>2?arguments[2]:void 0));var b,g,y,x,w,_,S=d(t),E=0;if(!S||this===f&&s(S))for(b=u(t),g=n?new this(b):f(b);b>E;E++)_=h?v(t[E],E):t[E],p(g,E,_);else for(w=(x=l(t,S)).next,g=n?new this:[];!(y=a(w,x)).done;E++)_=h?i(x,v,[y.value,E],!0):y.value,p(g,E,_);return g.length=E,g}},1318:(e,t,n)=>{var r=n(5656),a=n(1400),o=n(6244),i=function(e){return function(t,n,i){var s,c=r(t),u=o(c),p=a(i,u);if(e&&n!=n){for(;u>p;)if((s=c[p++])!=s)return!0}else for(;u>p;p++)if((e||p in c)&&c[p]===n)return e||p||0;return!e&&-1}};e.exports={includes:i(!0),indexOf:i(!1)}},2092:(e,t,n)=>{var r=n(9974),a=n(1702),o=n(8361),i=n(7908),s=n(6244),c=n(5417),u=a([].push),p=function(e){var t=1==e,n=2==e,a=3==e,p=4==e,l=6==e,d=7==e,f=5==e||l;return function(m,v,h,b){for(var g,y,x=i(m),w=o(x),_=r(v,h),S=s(w),E=0,A=b||c,k=t?A(m,S):n||d?A(m,0):void 0;S>E;E++)if((f||E in w)&&(y=_(g=w[E],E,x),e))if(t)k[E]=y;else if(y)switch(e){case 3:return!0;case 5:return g;case 6:return E;case 2:u(k,g)}else switch(e){case 4:return!1;case 7:u(k,g)}return l?-1:a||p?p:k}};e.exports={forEach:p(0),map:p(1),filter:p(2),some:p(3),every:p(4),find:p(5),findIndex:p(6),filterReject:p(7)}},1194:(e,t,n)=>{var r=n(7293),a=n(5112),o=n(7392),i=a("species");e.exports=function(e){return o>=51||!r((function(){var t=[];return(t.constructor={})[i]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},9341:(e,t,n)=>{"use strict";var r=n(7293);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){return 1},1)}))}},3671:(e,t,n)=>{var r=n(9662),a=n(7908),o=n(8361),i=n(6244),s=TypeError,c=function(e){return function(t,n,c,u){r(n);var p=a(t),l=o(p),d=i(p),f=e?d-1:0,m=e?-1:1;if(c<2)for(;;){if(f in l){u=l[f],f+=m;break}if(f+=m,e?f<0:d<=f)throw s("Reduce of empty array with no initial value")}for(;e?f>=0:d>f;f+=m)f in l&&(u=n(u,l[f],f,p));return u}};e.exports={left:c(!1),right:c(!0)}},1589:(e,t,n)=>{var r=n(1400),a=n(6244),o=n(6135),i=Array,s=Math.max;e.exports=function(e,t,n){for(var c=a(e),u=r(t,c),p=r(void 0===n?c:n,c),l=i(s(p-u,0)),d=0;u{var r=n(1702);e.exports=r([].slice)},4362:(e,t,n)=>{var r=n(1589),a=Math.floor,o=function(e,t){var n=e.length,c=a(n/2);return n<8?i(e,t):s(e,o(r(e,0,c),t),o(r(e,c),t),t)},i=function(e,t){for(var n,r,a=e.length,o=1;o0;)e[r]=e[--r];r!==o++&&(e[r]=n)}return e},s=function(e,t,n,r){for(var a=t.length,o=n.length,i=0,s=0;i{var r=n(3157),a=n(4411),o=n(111),i=n(5112)("species"),s=Array;e.exports=function(e){var t;return r(e)&&(t=e.constructor,(a(t)&&(t===s||r(t.prototype))||o(t)&&null===(t=t[i]))&&(t=void 0)),void 0===t?s:t}},5417:(e,t,n)=>{var r=n(7475);e.exports=function(e,t){return new(r(e))(0===t?0:t)}},3411:(e,t,n)=>{var r=n(9670),a=n(9212);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){a(e,"throw",t)}}},7072:(e,t,n)=>{var r=n(5112)("iterator"),a=!1;try{var o=0,i={next:function(){return{done:!!o++}},return:function(){a=!0}};i[r]=function(){return this},Array.from(i,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!a)return!1;var n=!1;try{var o={};o[r]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch(e){}return n}},4326:(e,t,n)=>{var r=n(1702),a=r({}.toString),o=r("".slice);e.exports=function(e){return o(a(e),8,-1)}},648:(e,t,n)=>{var r=n(1694),a=n(614),o=n(4326),i=n(5112)("toStringTag"),s=Object,c="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=s(e),i))?n:c?o(t):"Object"==(r=o(t))&&a(t.callee)?"Arguments":r}},9920:(e,t,n)=>{var r=n(2597),a=n(3887),o=n(1236),i=n(3070);e.exports=function(e,t,n){for(var s=a(t),c=i.f,u=o.f,p=0;p{var r=n(5112)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},8544:(e,t,n)=>{var r=n(7293);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},6178:e=>{e.exports=function(e,t){return{value:e,done:t}}},8880:(e,t,n)=>{var r=n(9781),a=n(3070),o=n(9114);e.exports=r?function(e,t,n){return a.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},9114:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},6135:(e,t,n)=>{"use strict";var r=n(4948),a=n(3070),o=n(9114);e.exports=function(e,t,n){var i=r(t);i in e?a.f(e,i,o(0,n)):e[i]=n}},7045:(e,t,n)=>{var r=n(6339),a=n(3070);e.exports=function(e,t,n){return n.get&&r(n.get,t,{getter:!0}),n.set&&r(n.set,t,{setter:!0}),a.f(e,t,n)}},8052:(e,t,n)=>{var r=n(614),a=n(3070),o=n(6339),i=n(3072);e.exports=function(e,t,n,s){s||(s={});var c=s.enumerable,u=void 0!==s.name?s.name:t;if(r(n)&&o(n,u,s),s.global)c?e[t]=n:i(t,n);else{try{s.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=n:a.f(e,t,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},3072:(e,t,n)=>{var r=n(7854),a=Object.defineProperty;e.exports=function(e,t){try{a(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},5117:(e,t,n)=>{"use strict";var r=n(6330),a=TypeError;e.exports=function(e,t){if(!delete e[t])throw a("Cannot delete property "+r(t)+" of "+r(e))}},9781:(e,t,n)=>{var r=n(7293);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4154:e=>{var t="object"==typeof document&&document.all,n=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:n}},317:(e,t,n)=>{var r=n(7854),a=n(111),o=r.document,i=a(o)&&a(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},7207:e=>{var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},8324:e=>{e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},8509:(e,t,n)=>{var r=n(317)("span").classList,a=r&&r.constructor&&r.constructor.prototype;e.exports=a===Object.prototype?void 0:a},8886:(e,t,n)=>{var r=n(8113).match(/firefox\/(\d+)/i);e.exports=!!r&&+r[1]},7871:(e,t,n)=>{var r=n(3823),a=n(5268);e.exports=!r&&!a&&"object"==typeof window&&"object"==typeof document},9363:e=>{e.exports="function"==typeof Bun&&Bun&&"string"==typeof Bun.version},3823:e=>{e.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},256:(e,t,n)=>{var r=n(8113);e.exports=/MSIE|Trident/.test(r)},1528:(e,t,n)=>{var r=n(8113);e.exports=/ipad|iphone|ipod/i.test(r)&&"undefined"!=typeof Pebble},6833:(e,t,n)=>{var r=n(8113);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(r)},5268:(e,t,n)=>{var r=n(4326);e.exports="undefined"!=typeof process&&"process"==r(process)},1036:(e,t,n)=>{var r=n(8113);e.exports=/web0s(?!.*chrome)/i.test(r)},8113:e=>{e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7392:(e,t,n)=>{var r,a,o=n(7854),i=n(8113),s=o.process,c=o.Deno,u=s&&s.versions||c&&c.version,p=u&&u.v8;p&&(a=(r=p.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!a&&i&&(!(r=i.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=i.match(/Chrome\/(\d+)/))&&(a=+r[1]),e.exports=a},8008:(e,t,n)=>{var r=n(8113).match(/AppleWebKit\/(\d+)\./);e.exports=!!r&&+r[1]},748:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:(e,t,n)=>{var r=n(7854),a=n(1236).f,o=n(8880),i=n(8052),s=n(3072),c=n(9920),u=n(4705);e.exports=function(e,t){var n,p,l,d,f,m=e.target,v=e.global,h=e.stat;if(n=v?r:h?r[m]||s(m,{}):(r[m]||{}).prototype)for(p in t){if(d=t[p],l=e.dontCallGetSet?(f=a(n,p))&&f.value:n[p],!u(v?p:m+(h?".":"#")+p,e.forced)&&void 0!==l){if(typeof d==typeof l)continue;c(d,l)}(e.sham||l&&l.sham)&&o(d,"sham",!0),i(n,p,d,e)}}},7293:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},7007:(e,t,n)=>{"use strict";n(4916);var r=n(1470),a=n(8052),o=n(2261),i=n(7293),s=n(5112),c=n(8880),u=s("species"),p=RegExp.prototype;e.exports=function(e,t,n,l){var d=s(e),f=!i((function(){var t={};return t[d]=function(){return 7},7!=""[e](t)})),m=f&&!i((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[u]=function(){return n},n.flags="",n[d]=/./[d]),n.exec=function(){return t=!0,null},n[d](""),!t}));if(!f||!m||n){var v=r(/./[d]),h=t(d,""[e],(function(e,t,n,a,i){var s=r(e),c=t.exec;return c===o||c===p.exec?f&&!i?{done:!0,value:v(t,n,a)}:{done:!0,value:s(n,t,a)}:{done:!1}}));a(String.prototype,e,h[0]),a(p,d,h[1])}l&&c(p[d],"sham",!0)}},2104:(e,t,n)=>{var r=n(4374),a=Function.prototype,o=a.apply,i=a.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?i.bind(o):function(){return i.apply(o,arguments)})},9974:(e,t,n)=>{var r=n(1470),a=n(9662),o=n(4374),i=r(r.bind);e.exports=function(e,t){return a(e),void 0===t?e:o?i(e,t):function(){return e.apply(t,arguments)}}},4374:(e,t,n)=>{var r=n(7293);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},7065:(e,t,n)=>{"use strict";var r=n(1702),a=n(9662),o=n(111),i=n(2597),s=n(206),c=n(4374),u=Function,p=r([].concat),l=r([].join),d={},f=function(e,t,n){if(!i(d,t)){for(var r=[],a=0;a{var r=n(4374),a=Function.prototype.call;e.exports=r?a.bind(a):function(){return a.apply(a,arguments)}},6530:(e,t,n)=>{var r=n(9781),a=n(2597),o=Function.prototype,i=r&&Object.getOwnPropertyDescriptor,s=a(o,"name"),c=s&&"something"===function(){}.name,u=s&&(!r||r&&i(o,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:u}},5668:(e,t,n)=>{var r=n(1702),a=n(9662);e.exports=function(e,t,n){try{return r(a(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},1470:(e,t,n)=>{var r=n(4326),a=n(1702);e.exports=function(e){if("Function"===r(e))return a(e)}},1702:(e,t,n)=>{var r=n(4374),a=Function.prototype,o=a.call,i=r&&a.bind.bind(o,o);e.exports=r?i:function(e){return function(){return o.apply(e,arguments)}}},5005:(e,t,n)=>{var r=n(7854),a=n(614),o=function(e){return a(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?o(r[e]):r[e]&&r[e][t]}},1246:(e,t,n)=>{var r=n(648),a=n(8173),o=n(8554),i=n(7497),s=n(5112)("iterator");e.exports=function(e){if(!o(e))return a(e,s)||a(e,"@@iterator")||i[r(e)]}},4121:(e,t,n)=>{var r=n(6916),a=n(9662),o=n(9670),i=n(6330),s=n(1246),c=TypeError;e.exports=function(e,t){var n=arguments.length<2?s(e):t;if(a(n))return o(r(n,e));throw c(i(e)+" is not iterable")}},8044:(e,t,n)=>{var r=n(1702),a=n(3157),o=n(614),i=n(4326),s=n(1340),c=r([].push);e.exports=function(e){if(o(e))return e;if(a(e)){for(var t=e.length,n=[],r=0;r{var r=n(9662),a=n(8554);e.exports=function(e,t){var n=e[t];return a(n)?void 0:r(n)}},647:(e,t,n)=>{var r=n(1702),a=n(7908),o=Math.floor,i=r("".charAt),s=r("".replace),c=r("".slice),u=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,p=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,n,r,l,d){var f=n+e.length,m=r.length,v=p;return void 0!==l&&(l=a(l),v=u),s(d,v,(function(a,s){var u;switch(i(s,0)){case"$":return"$";case"&":return e;case"`":return c(t,0,n);case"'":return c(t,f);case"<":u=l[c(s,1,-1)];break;default:var p=+s;if(0===p)return a;if(p>m){var d=o(p/10);return 0===d?a:d<=m?void 0===r[d-1]?i(s,1):r[d-1]+i(s,1):a}u=r[p-1]}return void 0===u?"":u}))}},7854:e=>{var t=function(e){return e&&e.Math==Math&&e};e.exports=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof global&&global)||function(){return this}()||Function("return this")()},2597:(e,t,n)=>{var r=n(1702),a=n(7908),o=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(a(e),t)}},3501:e=>{e.exports={}},842:e=>{e.exports=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}}},490:(e,t,n)=>{var r=n(5005);e.exports=r("document","documentElement")},4664:(e,t,n)=>{var r=n(9781),a=n(7293),o=n(317);e.exports=!r&&!a((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},8361:(e,t,n)=>{var r=n(1702),a=n(7293),o=n(4326),i=Object,s=r("".split);e.exports=a((function(){return!i("z").propertyIsEnumerable(0)}))?function(e){return"String"==o(e)?s(e,""):i(e)}:i},9587:(e,t,n)=>{var r=n(614),a=n(111),o=n(7674);e.exports=function(e,t,n){var i,s;return o&&r(i=t.constructor)&&i!==n&&a(s=i.prototype)&&s!==n.prototype&&o(e,s),e}},2788:(e,t,n)=>{var r=n(1702),a=n(614),o=n(5465),i=r(Function.toString);a(o.inspectSource)||(o.inspectSource=function(e){return i(e)}),e.exports=o.inspectSource},9909:(e,t,n)=>{var r,a,o,i=n(4811),s=n(7854),c=n(111),u=n(8880),p=n(2597),l=n(5465),d=n(6200),f=n(3501),m="Object already initialized",v=s.TypeError,h=s.WeakMap;if(i||l.state){var b=l.state||(l.state=new h);b.get=b.get,b.has=b.has,b.set=b.set,r=function(e,t){if(b.has(e))throw v(m);return t.facade=e,b.set(e,t),t},a=function(e){return b.get(e)||{}},o=function(e){return b.has(e)}}else{var g=d("state");f[g]=!0,r=function(e,t){if(p(e,g))throw v(m);return t.facade=e,u(e,g,t),t},a=function(e){return p(e,g)?e[g]:{}},o=function(e){return p(e,g)}}e.exports={set:r,get:a,has:o,enforce:function(e){return o(e)?a(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=a(t)).type!==e)throw v("Incompatible receiver, "+e+" required");return n}}}},7659:(e,t,n)=>{var r=n(5112),a=n(7497),o=r("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(a.Array===e||i[o]===e)}},3157:(e,t,n)=>{var r=n(4326);e.exports=Array.isArray||function(e){return"Array"==r(e)}},614:(e,t,n)=>{var r=n(4154),a=r.all;e.exports=r.IS_HTMLDDA?function(e){return"function"==typeof e||e===a}:function(e){return"function"==typeof e}},4411:(e,t,n)=>{var r=n(1702),a=n(7293),o=n(614),i=n(648),s=n(5005),c=n(2788),u=function(){},p=[],l=s("Reflect","construct"),d=/^\s*(?:class|function)\b/,f=r(d.exec),m=!d.exec(u),v=function(e){if(!o(e))return!1;try{return l(u,p,e),!0}catch(e){return!1}},h=function(e){if(!o(e))return!1;switch(i(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return m||!!f(d,c(e))}catch(e){return!0}};h.sham=!0,e.exports=!l||a((function(){var e;return v(v.call)||!v(Object)||!v((function(){e=!0}))||e}))?h:v},4705:(e,t,n)=>{var r=n(7293),a=n(614),o=/#|\.prototype\./,i=function(e,t){var n=c[s(e)];return n==p||n!=u&&(a(t)?r(t):!!t)},s=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=i.data={},u=i.NATIVE="N",p=i.POLYFILL="P";e.exports=i},5988:(e,t,n)=>{var r=n(111),a=Math.floor;e.exports=Number.isInteger||function(e){return!r(e)&&isFinite(e)&&a(e)===e}},8554:e=>{e.exports=function(e){return null==e}},111:(e,t,n)=>{var r=n(614),a=n(4154),o=a.all;e.exports=a.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:r(e)||e===o}:function(e){return"object"==typeof e?null!==e:r(e)}},1913:e=>{e.exports=!1},7850:(e,t,n)=>{var r=n(111),a=n(4326),o=n(5112)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[o])?!!t:"RegExp"==a(e))}},2190:(e,t,n)=>{var r=n(5005),a=n(614),o=n(7976),i=n(3307),s=Object;e.exports=i?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return a(t)&&o(t.prototype,s(e))}},408:(e,t,n)=>{var r=n(9974),a=n(6916),o=n(9670),i=n(6330),s=n(7659),c=n(6244),u=n(7976),p=n(4121),l=n(1246),d=n(9212),f=TypeError,m=function(e,t){this.stopped=e,this.result=t},v=m.prototype;e.exports=function(e,t,n){var h,b,g,y,x,w,_,S=n&&n.that,E=!(!n||!n.AS_ENTRIES),A=!(!n||!n.IS_RECORD),k=!(!n||!n.IS_ITERATOR),O=!(!n||!n.INTERRUPTED),j=r(t,S),C=function(e){return h&&d(h,"normal",e),new m(!0,e)},R=function(e){return E?(o(e),O?j(e[0],e[1],C):j(e[0],e[1])):O?j(e,C):j(e)};if(A)h=e.iterator;else if(k)h=e;else{if(!(b=l(e)))throw f(i(e)+" is not iterable");if(s(b)){for(g=0,y=c(e);y>g;g++)if((x=R(e[g]))&&u(v,x))return x;return new m(!1)}h=p(e,b)}for(w=A?e.next:h.next;!(_=a(w,h)).done;){try{x=R(_.value)}catch(e){d(h,"throw",e)}if("object"==typeof x&&x&&u(v,x))return x}return new m(!1)}},9212:(e,t,n)=>{var r=n(6916),a=n(9670),o=n(8173);e.exports=function(e,t,n){var i,s;a(e);try{if(!(i=o(e,"return"))){if("throw"===t)throw n;return n}i=r(i,e)}catch(e){s=!0,i=e}if("throw"===t)throw n;if(s)throw i;return a(i),n}},3061:(e,t,n)=>{"use strict";var r=n(3383).IteratorPrototype,a=n(30),o=n(9114),i=n(8003),s=n(7497),c=function(){return this};e.exports=function(e,t,n,u){var p=t+" Iterator";return e.prototype=a(r,{next:o(+!u,n)}),i(e,p,!1,!0),s[p]=c,e}},1656:(e,t,n)=>{"use strict";var r=n(2109),a=n(6916),o=n(1913),i=n(6530),s=n(614),c=n(3061),u=n(9518),p=n(7674),l=n(8003),d=n(8880),f=n(8052),m=n(5112),v=n(7497),h=n(3383),b=i.PROPER,g=i.CONFIGURABLE,y=h.IteratorPrototype,x=h.BUGGY_SAFARI_ITERATORS,w=m("iterator"),_="keys",S="values",E="entries",A=function(){return this};e.exports=function(e,t,n,i,m,h,k){c(n,t,i);var O,j,C,R=function(e){if(e===m&&U)return U;if(!x&&e in P)return P[e];switch(e){case _:case S:case E:return function(){return new n(this,e)}}return function(){return new n(this)}},I=t+" Iterator",T=!1,P=e.prototype,N=P[w]||P["@@iterator"]||m&&P[m],U=!x&&N||R(m),D="Array"==t&&P.entries||N;if(D&&(O=u(D.call(new e)))!==Object.prototype&&O.next&&(o||u(O)===y||(p?p(O,y):s(O[w])||f(O,w,A)),l(O,I,!0,!0),o&&(v[I]=A)),b&&m==S&&N&&N.name!==S&&(!o&&g?d(P,"name",S):(T=!0,U=function(){return a(N,this)})),m)if(j={values:R(S),keys:h?U:R(_),entries:R(E)},k)for(C in j)(x||T||!(C in P))&&f(P,C,j[C]);else r({target:t,proto:!0,forced:x||T},j);return o&&!k||P[w]===U||f(P,w,U,{name:m}),v[t]=U,j}},3383:(e,t,n)=>{"use strict";var r,a,o,i=n(7293),s=n(614),c=n(111),u=n(30),p=n(9518),l=n(8052),d=n(5112),f=n(1913),m=d("iterator"),v=!1;[].keys&&("next"in(o=[].keys())?(a=p(p(o)))!==Object.prototype&&(r=a):v=!0),!c(r)||i((function(){var e={};return r[m].call(e)!==e}))?r={}:f&&(r=u(r)),s(r[m])||l(r,m,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:v}},7497:e=>{e.exports={}},6244:(e,t,n)=>{var r=n(7466);e.exports=function(e){return r(e.length)}},6339:(e,t,n)=>{var r=n(1702),a=n(7293),o=n(614),i=n(2597),s=n(9781),c=n(6530).CONFIGURABLE,u=n(2788),p=n(9909),l=p.enforce,d=p.get,f=String,m=Object.defineProperty,v=r("".slice),h=r("".replace),b=r([].join),g=s&&!a((function(){return 8!==m((function(){}),"length",{value:8}).length})),y=String(String).split("String"),x=e.exports=function(e,t,n){"Symbol("===v(f(t),0,7)&&(t="["+h(f(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!i(e,"name")||c&&e.name!==t)&&(s?m(e,"name",{value:t,configurable:!0}):e.name=t),g&&n&&i(n,"arity")&&e.length!==n.arity&&m(e,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?s&&m(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=l(e);return i(r,"source")||(r.source=b(y,"string"==typeof t?t:"")),e};Function.prototype.toString=x((function(){return o(this)&&d(this).source||u(this)}),"toString")},4758:e=>{var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},5948:(e,t,n)=>{var r,a,o,i,s,c=n(7854),u=n(9974),p=n(1236).f,l=n(261).set,d=n(8572),f=n(6833),m=n(1528),v=n(1036),h=n(5268),b=c.MutationObserver||c.WebKitMutationObserver,g=c.document,y=c.process,x=c.Promise,w=p(c,"queueMicrotask"),_=w&&w.value;if(!_){var S=new d,E=function(){var e,t;for(h&&(e=y.domain)&&e.exit();t=S.get();)try{t()}catch(e){throw S.head&&r(),e}e&&e.enter()};f||h||v||!b||!g?!m&&x&&x.resolve?((i=x.resolve(void 0)).constructor=x,s=u(i.then,i),r=function(){s(E)}):h?r=function(){y.nextTick(E)}:(l=u(l,c),r=function(){l(E)}):(a=!0,o=g.createTextNode(""),new b(E).observe(o,{characterData:!0}),r=function(){o.data=a=!a}),_=function(e){S.head||r(),S.add(e)}}e.exports=_},8523:(e,t,n)=>{"use strict";var r=n(9662),a=TypeError,o=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw a("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new o(e)}},3929:(e,t,n)=>{var r=n(7850),a=TypeError;e.exports=function(e){if(r(e))throw a("The method doesn't accept regular expressions");return e}},2814:(e,t,n)=>{var r=n(7854),a=n(7293),o=n(1702),i=n(1340),s=n(3111).trim,c=n(1361),u=o("".charAt),p=r.parseFloat,l=r.Symbol,d=l&&l.iterator,f=1/p(c+"-0")!=-1/0||d&&!a((function(){p(Object(d))}));e.exports=f?function(e){var t=s(i(e)),n=p(t);return 0===n&&"-"==u(t,0)?-0:n}:p},30:(e,t,n)=>{var r,a=n(9670),o=n(6048),i=n(748),s=n(3501),c=n(490),u=n(317),p=n(6200)("IE_PROTO"),l=function(){},d=function(e){return"