@northflank/js-client 0.4.1 → 0.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/dist/cjs/api-client.d.ts +6013 -0
  2. package/dist/cjs/api-client.js +1 -0
  3. package/dist/cjs/package.json +3 -0
  4. package/dist/esm/api-client.d.ts +6013 -0
  5. package/dist/esm/api-client.js +15 -0
  6. package/dist/esm/package.json +3 -0
  7. package/package.json +12 -19
  8. package/dist/api-client.d.ts +0 -481
  9. package/dist/api-client.js +0 -748
  10. package/dist/api-endpoint.d.ts +0 -63
  11. package/dist/api-endpoint.js +0 -216
  12. package/dist/context/api-client-context-provider.d.ts +0 -47
  13. package/dist/context/api-client-context-provider.js +0 -332
  14. package/dist/context/api-client-file-context-provider.d.ts +0 -11
  15. package/dist/context/api-client-file-context-provider.js +0 -138
  16. package/dist/context/api-client-in-memory-context-provider.d.ts +0 -6
  17. package/dist/context/api-client-in-memory-context-provider.js +0 -82
  18. package/dist/context/index.d.ts +0 -3
  19. package/dist/context/index.js +0 -15
  20. package/dist/endpoints/abort/addon/backup.d.ts +0 -21
  21. package/dist/endpoints/abort/addon/backup.js +0 -36
  22. package/dist/endpoints/abort/addon/restore.d.ts +0 -26
  23. package/dist/endpoints/abort/addon/restore.js +0 -36
  24. package/dist/endpoints/abort/job/build.d.ts +0 -21
  25. package/dist/endpoints/abort/job/build.js +0 -36
  26. package/dist/endpoints/abort/job/run.d.ts +0 -21
  27. package/dist/endpoints/abort/job/run.js +0 -36
  28. package/dist/endpoints/abort/service/build.d.ts +0 -21
  29. package/dist/endpoints/abort/service/build.js +0 -36
  30. package/dist/endpoints/add/domain/subdomain.d.ts +0 -33
  31. package/dist/endpoints/add/domain/subdomain.js +0 -36
  32. package/dist/endpoints/add/registryCredentials.d.ts +0 -47
  33. package/dist/endpoints/add/registryCredentials.js +0 -36
  34. package/dist/endpoints/assign/subdomain/service.d.ts +0 -28
  35. package/dist/endpoints/assign/subdomain/service.js +0 -36
  36. package/dist/endpoints/backup/addon.d.ts +0 -51
  37. package/dist/endpoints/backup/addon.js +0 -36
  38. package/dist/endpoints/create/addon.d.ts +0 -90
  39. package/dist/endpoints/create/addon.js +0 -36
  40. package/dist/endpoints/create/domain.d.ts +0 -27
  41. package/dist/endpoints/create/domain.js +0 -36
  42. package/dist/endpoints/create/job/cron.d.ts +0 -157
  43. package/dist/endpoints/create/job/cron.js +0 -36
  44. package/dist/endpoints/create/job/manual.d.ts +0 -147
  45. package/dist/endpoints/create/job/manual.js +0 -36
  46. package/dist/endpoints/create/project.d.ts +0 -29
  47. package/dist/endpoints/create/project.js +0 -36
  48. package/dist/endpoints/create/secret.d.ts +0 -79
  49. package/dist/endpoints/create/secret.js +0 -36
  50. package/dist/endpoints/create/service/build.d.ts +0 -116
  51. package/dist/endpoints/create/service/build.js +0 -36
  52. package/dist/endpoints/create/service/combined.d.ts +0 -166
  53. package/dist/endpoints/create/service/combined.js +0 -36
  54. package/dist/endpoints/create/service/deployment.d.ts +0 -137
  55. package/dist/endpoints/create/service/deployment.js +0 -36
  56. package/dist/endpoints/delete/addon.d.ts +0 -19
  57. package/dist/endpoints/delete/addon.js +0 -36
  58. package/dist/endpoints/delete/backup.d.ts +0 -21
  59. package/dist/endpoints/delete/backup.js +0 -36
  60. package/dist/endpoints/delete/domain.d.ts +0 -17
  61. package/dist/endpoints/delete/domain.js +0 -36
  62. package/dist/endpoints/delete/job.d.ts +0 -19
  63. package/dist/endpoints/delete/job.js +0 -36
  64. package/dist/endpoints/delete/project.d.ts +0 -17
  65. package/dist/endpoints/delete/project.js +0 -36
  66. package/dist/endpoints/delete/registryCredentials.d.ts +0 -17
  67. package/dist/endpoints/delete/registryCredentials.js +0 -36
  68. package/dist/endpoints/delete/secret.d.ts +0 -19
  69. package/dist/endpoints/delete/secret.js +0 -36
  70. package/dist/endpoints/delete/secretLink.d.ts +0 -21
  71. package/dist/endpoints/delete/secretLink.js +0 -36
  72. package/dist/endpoints/delete/service.d.ts +0 -19
  73. package/dist/endpoints/delete/service.js +0 -36
  74. package/dist/endpoints/delete/subdomain.d.ts +0 -19
  75. package/dist/endpoints/delete/subdomain.js +0 -36
  76. package/dist/endpoints/get/addon/backup/download.d.ts +0 -24
  77. package/dist/endpoints/get/addon/backup/download.js +0 -36
  78. package/dist/endpoints/get/addon/backup.d.ts +0 -46
  79. package/dist/endpoints/get/addon/backup.js +0 -36
  80. package/dist/endpoints/get/addon/backups.d.ts +0 -54
  81. package/dist/endpoints/get/addon/backups.js +0 -40
  82. package/dist/endpoints/get/addon/containers.d.ts +0 -40
  83. package/dist/endpoints/get/addon/containers.js +0 -40
  84. package/dist/endpoints/get/addon/credentials.d.ts +0 -24
  85. package/dist/endpoints/get/addon/credentials.js +0 -36
  86. package/dist/endpoints/get/addon/types.d.ts +0 -48
  87. package/dist/endpoints/get/addon/types.js +0 -36
  88. package/dist/endpoints/get/addon/version.d.ts +0 -53
  89. package/dist/endpoints/get/addon/version.js +0 -36
  90. package/dist/endpoints/get/addon.d.ts +0 -69
  91. package/dist/endpoints/get/addon.js +0 -36
  92. package/dist/endpoints/get/dnsId.d.ts +0 -15
  93. package/dist/endpoints/get/dnsId.js +0 -36
  94. package/dist/endpoints/get/domain.d.ts +0 -33
  95. package/dist/endpoints/get/domain.js +0 -36
  96. package/dist/endpoints/get/job/buildArguments.d.ts +0 -19
  97. package/dist/endpoints/get/job/buildArguments.js +0 -36
  98. package/dist/endpoints/get/job/builds.d.ts +0 -50
  99. package/dist/endpoints/get/job/builds.js +0 -39
  100. package/dist/endpoints/get/job/containers.d.ts +0 -40
  101. package/dist/endpoints/get/job/containers.js +0 -40
  102. package/dist/endpoints/get/job/deployment.d.ts +0 -51
  103. package/dist/endpoints/get/job/deployment.js +0 -36
  104. package/dist/endpoints/get/job/environment.d.ts +0 -24
  105. package/dist/endpoints/get/job/environment.js +0 -40
  106. package/dist/endpoints/get/job/environmentDetails.d.ts +0 -42
  107. package/dist/endpoints/get/job/environmentDetails.js +0 -36
  108. package/dist/endpoints/get/job/healthChecks.d.ts +0 -44
  109. package/dist/endpoints/get/job/healthChecks.js +0 -36
  110. package/dist/endpoints/get/job/run.d.ts +0 -42
  111. package/dist/endpoints/get/job/run.js +0 -36
  112. package/dist/endpoints/get/job/runs.d.ts +0 -52
  113. package/dist/endpoints/get/job/runs.js +0 -39
  114. package/dist/endpoints/get/job.d.ts +0 -86
  115. package/dist/endpoints/get/job.js +0 -36
  116. package/dist/endpoints/get/project.d.ts +0 -72
  117. package/dist/endpoints/get/project.js +0 -36
  118. package/dist/endpoints/get/registryCredentials.d.ts +0 -34
  119. package/dist/endpoints/get/registryCredentials.js +0 -36
  120. package/dist/endpoints/get/secret.d.ts +0 -55
  121. package/dist/endpoints/get/secret.js +0 -39
  122. package/dist/endpoints/get/secretDetails.d.ts +0 -63
  123. package/dist/endpoints/get/secretDetails.js +0 -36
  124. package/dist/endpoints/get/secretLink.d.ts +0 -44
  125. package/dist/endpoints/get/secretLink.js +0 -36
  126. package/dist/endpoints/get/service/buildArguments.d.ts +0 -19
  127. package/dist/endpoints/get/service/buildArguments.js +0 -36
  128. package/dist/endpoints/get/service/builds.d.ts +0 -50
  129. package/dist/endpoints/get/service/builds.js +0 -40
  130. package/dist/endpoints/get/service/containers.d.ts +0 -40
  131. package/dist/endpoints/get/service/containers.js +0 -40
  132. package/dist/endpoints/get/service/deployment.d.ts +0 -51
  133. package/dist/endpoints/get/service/deployment.js +0 -36
  134. package/dist/endpoints/get/service/environmentVariableDetails.d.ts +0 -42
  135. package/dist/endpoints/get/service/environmentVariableDetails.js +0 -36
  136. package/dist/endpoints/get/service/environmentVariables.d.ts +0 -24
  137. package/dist/endpoints/get/service/environmentVariables.js +0 -40
  138. package/dist/endpoints/get/service/healthChecks.d.ts +0 -44
  139. package/dist/endpoints/get/service/healthChecks.js +0 -36
  140. package/dist/endpoints/get/service/ports.d.ts +0 -35
  141. package/dist/endpoints/get/service/ports.js +0 -36
  142. package/dist/endpoints/get/service.d.ts +0 -103
  143. package/dist/endpoints/get/service.js +0 -36
  144. package/dist/endpoints/get/subdomain.d.ts +0 -30
  145. package/dist/endpoints/get/subdomain.js +0 -36
  146. package/dist/endpoints/import/addon/backup.d.ts +0 -31
  147. package/dist/endpoints/import/addon/backup.js +0 -36
  148. package/dist/endpoints/list/addons.d.ts +0 -45
  149. package/dist/endpoints/list/addons.js +0 -39
  150. package/dist/endpoints/list/domains.d.ts +0 -34
  151. package/dist/endpoints/list/domains.js +0 -39
  152. package/dist/endpoints/list/jobs.d.ts +0 -44
  153. package/dist/endpoints/list/jobs.js +0 -39
  154. package/dist/endpoints/list/plans.d.ts +0 -30
  155. package/dist/endpoints/list/plans.js +0 -36
  156. package/dist/endpoints/list/projects.d.ts +0 -32
  157. package/dist/endpoints/list/projects.js +0 -39
  158. package/dist/endpoints/list/regions.d.ts +0 -18
  159. package/dist/endpoints/list/regions.js +0 -36
  160. package/dist/endpoints/list/registryCredentials.d.ts +0 -41
  161. package/dist/endpoints/list/registryCredentials.js +0 -39
  162. package/dist/endpoints/list/secrets.d.ts +0 -52
  163. package/dist/endpoints/list/secrets.js +0 -39
  164. package/dist/endpoints/list/services.d.ts +0 -44
  165. package/dist/endpoints/list/services.js +0 -39
  166. package/dist/endpoints/list/vcs.d.ts +0 -51
  167. package/dist/endpoints/list/vcs.js +0 -36
  168. package/dist/endpoints/pause/addon.d.ts +0 -19
  169. package/dist/endpoints/pause/addon.js +0 -36
  170. package/dist/endpoints/pause/service.d.ts +0 -19
  171. package/dist/endpoints/pause/service.js +0 -36
  172. package/dist/endpoints/restart/addon.d.ts +0 -19
  173. package/dist/endpoints/restart/addon.js +0 -36
  174. package/dist/endpoints/restart/service.d.ts +0 -19
  175. package/dist/endpoints/restart/service.js +0 -36
  176. package/dist/endpoints/restore/addon/backup.d.ts +0 -21
  177. package/dist/endpoints/restore/addon/backup.js +0 -36
  178. package/dist/endpoints/resume/addon.d.ts +0 -19
  179. package/dist/endpoints/resume/addon.js +0 -36
  180. package/dist/endpoints/resume/service.d.ts +0 -24
  181. package/dist/endpoints/resume/service.js +0 -36
  182. package/dist/endpoints/scale/addon.d.ts +0 -28
  183. package/dist/endpoints/scale/addon.js +0 -36
  184. package/dist/endpoints/scale/service.d.ts +0 -26
  185. package/dist/endpoints/scale/service.js +0 -36
  186. package/dist/endpoints/start/job/build.d.ts +0 -37
  187. package/dist/endpoints/start/job/build.js +0 -36
  188. package/dist/endpoints/start/job/run.d.ts +0 -37
  189. package/dist/endpoints/start/job/run.js +0 -36
  190. package/dist/endpoints/start/service/build.d.ts +0 -41
  191. package/dist/endpoints/start/service/build.js +0 -36
  192. package/dist/endpoints/unassign/subdomain.d.ts +0 -19
  193. package/dist/endpoints/unassign/subdomain.js +0 -36
  194. package/dist/endpoints/update/addon/networkSettings.d.ts +0 -26
  195. package/dist/endpoints/update/addon/networkSettings.js +0 -36
  196. package/dist/endpoints/update/addon/security.d.ts +0 -29
  197. package/dist/endpoints/update/addon/security.js +0 -36
  198. package/dist/endpoints/update/addon/version.d.ts +0 -24
  199. package/dist/endpoints/update/addon/version.js +0 -36
  200. package/dist/endpoints/update/job/buildArguments.d.ts +0 -24
  201. package/dist/endpoints/update/job/buildArguments.js +0 -36
  202. package/dist/endpoints/update/job/cmdOverride.d.ts +0 -24
  203. package/dist/endpoints/update/job/cmdOverride.js +0 -36
  204. package/dist/endpoints/update/job/deployment.d.ts +0 -37
  205. package/dist/endpoints/update/job/deployment.js +0 -36
  206. package/dist/endpoints/update/job/environment.d.ts +0 -24
  207. package/dist/endpoints/update/job/environment.js +0 -36
  208. package/dist/endpoints/update/job/healthChecks.d.ts +0 -45
  209. package/dist/endpoints/update/job/healthChecks.js +0 -36
  210. package/dist/endpoints/update/job/settings.d.ts +0 -30
  211. package/dist/endpoints/update/job/settings.js +0 -36
  212. package/dist/endpoints/update/registryCredentials.d.ts +0 -31
  213. package/dist/endpoints/update/registryCredentials.js +0 -36
  214. package/dist/endpoints/update/secret.d.ts +0 -54
  215. package/dist/endpoints/update/secret.js +0 -36
  216. package/dist/endpoints/update/secretLink.d.ts +0 -40
  217. package/dist/endpoints/update/secretLink.js +0 -36
  218. package/dist/endpoints/update/service/buildArguments.d.ts +0 -24
  219. package/dist/endpoints/update/service/buildArguments.js +0 -36
  220. package/dist/endpoints/update/service/buildOptions.d.ts +0 -52
  221. package/dist/endpoints/update/service/buildOptions.js +0 -36
  222. package/dist/endpoints/update/service/cmdOverride.d.ts +0 -24
  223. package/dist/endpoints/update/service/cmdOverride.js +0 -36
  224. package/dist/endpoints/update/service/deployment.d.ts +0 -37
  225. package/dist/endpoints/update/service/deployment.js +0 -36
  226. package/dist/endpoints/update/service/environmentVariables.d.ts +0 -29
  227. package/dist/endpoints/update/service/environmentVariables.js +0 -36
  228. package/dist/endpoints/update/service/healthChecks.d.ts +0 -45
  229. package/dist/endpoints/update/service/healthChecks.js +0 -36
  230. package/dist/endpoints/update/service/ports.d.ts +0 -55
  231. package/dist/endpoints/update/service/ports.js +0 -36
  232. package/dist/endpoints/verify/domain.d.ts +0 -17
  233. package/dist/endpoints/verify/domain.js +0 -36
  234. package/dist/endpoints/verify/subdomain.d.ts +0 -19
  235. package/dist/endpoints/verify/subdomain.js +0 -36
  236. package/dist/port-forward/client/api-helper.d.ts +0 -30
  237. package/dist/port-forward/client/api-helper.js +0 -102
  238. package/dist/port-forward/client/atomic-write.d.ts +0 -3
  239. package/dist/port-forward/client/atomic-write.js +0 -95
  240. package/dist/port-forward/client/host-file-ast.d.ts +0 -52
  241. package/dist/port-forward/client/host-file-ast.js +0 -279
  242. package/dist/port-forward/client/host-file.d.ts +0 -26
  243. package/dist/port-forward/client/host-file.js +0 -226
  244. package/dist/port-forward/client/loopback.d.ts +0 -4
  245. package/dist/port-forward/client/loopback.js +0 -219
  246. package/dist/port-forward/client/port-forwarder.d.ts +0 -86
  247. package/dist/port-forward/client/port-forwarder.js +0 -593
  248. package/dist/port-forward/client/port-tunnel-tcp.d.ts +0 -34
  249. package/dist/port-forward/client/port-tunnel-tcp.js +0 -209
  250. package/dist/port-forward/client/port-tunnel-udp.d.ts +0 -25
  251. package/dist/port-forward/client/port-tunnel-udp.js +0 -147
  252. package/dist/port-forward/client/port-tunnel.d.ts +0 -32
  253. package/dist/port-forward/client/port-tunnel.js +0 -2
  254. package/dist/port-forward/client/promise-mutex.d.ts +0 -4
  255. package/dist/port-forward/client/promise-mutex.js +0 -62
  256. package/dist/utils.d.ts +0 -8
  257. package/dist/utils.js +0 -97
@@ -0,0 +1,15 @@
1
+ import t,{EventEmitter as e}from"events";import n,{Transform as r}from"stream";import o from"http";import i,{fileURLToPath as s}from"url";import a from"https";import c from"zlib";import u from"os";import*as l from"net";import d,{Socket as p}from"net";import{spawn as f,execSync as h}from"child_process";import v from"fs";import m from"path";import b from"tls";import y from"crypto";import g from"dgram";
2
+ /*! *****************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */var w=function(t,e){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},w(t,e)};function _(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}w(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var j=function(){return j=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},j.apply(this,arguments)};function S(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}function x(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function k(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}var I="object"==typeof global&&global&&global.Object===Object&&global,O="object"==typeof self&&self&&self.Object===Object&&self,E=I||O||Function("return this")(),A=E.Symbol,C=Object.prototype,P=C.hasOwnProperty,U=C.toString,T=A?A.toStringTag:void 0;var N=Object.prototype.toString;var L=A?A.toStringTag:void 0;function R(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":L&&L in Object(t)?function(t){var e=P.call(t,T),n=t[T];try{t[T]=void 0;var r=!0}catch(t){}var o=U.call(t);return r&&(e?t[T]=n:delete t[T]),o}(t):function(t){return N.call(t)}(t)}function B(t){return null!=t&&"object"==typeof t}function D(t){return"symbol"==typeof t||B(t)&&"[object Symbol]"==R(t)}function F(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}var M=Array.isArray,W=A?A.prototype:void 0,$=W?W.toString:void 0;function G(t){if("string"==typeof t)return t;if(M(t))return F(t,G)+"";if(D(t))return $?$.call(t):"";var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function q(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function z(t){return t}function V(t){if(!q(t))return!1;var e=R(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var H,J=E["__core-js_shared__"],Y=(H=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||""))?"Symbol(src)_1."+H:"";var K=Function.prototype.toString;function X(t){if(null!=t){try{return K.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var Z=/^\[object .+?Constructor\]$/,Q=Function.prototype,tt=Object.prototype,et=Q.toString,nt=tt.hasOwnProperty,rt=RegExp("^"+et.call(nt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ot(t){return!(!q(t)||(e=t,Y&&Y in e))&&(V(t)?rt:Z).test(X(t));var e}function it(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return ot(n)?n:void 0}var st=it(E,"WeakMap"),at=Object.create,ct=function(){function t(){}return function(e){if(!q(e))return{};if(at)return at(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function ut(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var lt=Date.now;var dt,pt,ft,ht=function(){try{var t=it(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),vt=ht,mt=vt?function(t,e){return vt(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:z,bt=(dt=mt,pt=0,ft=0,function(){var t=lt(),e=16-(t-ft);if(ft=t,e>0){if(++pt>=800)return arguments[0]}else pt=0;return dt.apply(void 0,arguments)}),yt=/^(?:0|[1-9]\d*)$/;function gt(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&yt.test(t))&&t>-1&&t%1==0&&t<e}function wt(t,e,n){"__proto__"==e&&vt?vt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function _t(t,e){return t===e||t!=t&&e!=e}var jt=Object.prototype.hasOwnProperty;function St(t,e,n){var r=t[e];jt.call(t,e)&&_t(r,n)&&(void 0!==n||e in t)||wt(t,e,n)}var xt=Math.max;function kt(t,e){return bt(function(t,e,n){return e=xt(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=xt(r.length-e,0),s=Array(i);++o<i;)s[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];return a[e]=n(s),ut(t,this,a)}}(t,e,z),t+"")}function It(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Ot(t){return null!=t&&It(t.length)&&!V(t)}var Et=Object.prototype;function At(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Et)}function Ct(t){return B(t)&&"[object Arguments]"==R(t)}var Pt=Object.prototype,Ut=Pt.hasOwnProperty,Tt=Pt.propertyIsEnumerable,Nt=Ct(function(){return arguments}())?Ct:function(t){return B(t)&&Ut.call(t,"callee")&&!Tt.call(t,"callee")};var Lt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Rt=Lt&&"object"==typeof module&&module&&!module.nodeType&&module,Bt=Rt&&Rt.exports===Lt?E.Buffer:void 0,Dt=(Bt?Bt.isBuffer:void 0)||function(){return!1},Ft={};Ft["[object Float32Array]"]=Ft["[object Float64Array]"]=Ft["[object Int8Array]"]=Ft["[object Int16Array]"]=Ft["[object Int32Array]"]=Ft["[object Uint8Array]"]=Ft["[object Uint8ClampedArray]"]=Ft["[object Uint16Array]"]=Ft["[object Uint32Array]"]=!0,Ft["[object Arguments]"]=Ft["[object Array]"]=Ft["[object ArrayBuffer]"]=Ft["[object Boolean]"]=Ft["[object DataView]"]=Ft["[object Date]"]=Ft["[object Error]"]=Ft["[object Function]"]=Ft["[object Map]"]=Ft["[object Number]"]=Ft["[object Object]"]=Ft["[object RegExp]"]=Ft["[object Set]"]=Ft["[object String]"]=Ft["[object WeakMap]"]=!1;var Mt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Wt=Mt&&"object"==typeof module&&module&&!module.nodeType&&module,$t=Wt&&Wt.exports===Mt&&I.process,Gt=function(){try{var t=Wt&&Wt.require&&Wt.require("util").types;return t||$t&&$t.binding&&$t.binding("util")}catch(t){}}(),qt=Gt&&Gt.isTypedArray,zt=qt?function(t){return function(e){return t(e)}}(qt):function(t){return B(t)&&It(t.length)&&!!Ft[R(t)]},Vt=zt,Ht=Object.prototype.hasOwnProperty;function Jt(t,e){var n=M(t),r=!n&&Nt(t),o=!n&&!r&&Dt(t),i=!n&&!r&&!o&&Vt(t),s=n||r||o||i,a=s?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var u in t)!e&&!Ht.call(t,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||gt(u,c))||a.push(u);return a}function Yt(t,e){return function(n){return t(e(n))}}var Kt=Yt(Object.keys,Object),Xt=Object.prototype.hasOwnProperty;function Zt(t){return Ot(t)?Jt(t):function(t){if(!At(t))return Kt(t);var e=[];for(var n in Object(t))Xt.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}var Qt=Object.prototype.hasOwnProperty;function te(t){if(!q(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=At(t),n=[];for(var r in t)("constructor"!=r||!e&&Qt.call(t,r))&&n.push(r);return n}function ee(t){return Ot(t)?Jt(t,!0):te(t)}var ne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,re=/^\w*$/;function oe(t,e){if(M(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!D(t))||(re.test(t)||!ne.test(t)||null!=e&&t in Object(e))}var ie=it(Object,"create");var se=Object.prototype.hasOwnProperty;var ae=Object.prototype.hasOwnProperty;function ce(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function ue(t,e){for(var n=t.length;n--;)if(_t(t[n][0],e))return n;return-1}ce.prototype.clear=function(){this.__data__=ie?ie(null):{},this.size=0},ce.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},ce.prototype.get=function(t){var e=this.__data__;if(ie){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return se.call(e,t)?e[t]:void 0},ce.prototype.has=function(t){var e=this.__data__;return ie?void 0!==e[t]:ae.call(e,t)},ce.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ie&&void 0===e?"__lodash_hash_undefined__":e,this};var le=Array.prototype.splice;function de(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}de.prototype.clear=function(){this.__data__=[],this.size=0},de.prototype.delete=function(t){var e=this.__data__,n=ue(e,t);return!(n<0)&&(n==e.length-1?e.pop():le.call(e,n,1),--this.size,!0)},de.prototype.get=function(t){var e=this.__data__,n=ue(e,t);return n<0?void 0:e[n][1]},de.prototype.has=function(t){return ue(this.__data__,t)>-1},de.prototype.set=function(t,e){var n=this.__data__,r=ue(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var pe=it(E,"Map");function fe(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function he(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}he.prototype.clear=function(){this.size=0,this.__data__={hash:new ce,map:new(pe||de),string:new ce}},he.prototype.delete=function(t){var e=fe(this,t).delete(t);return this.size-=e?1:0,e},he.prototype.get=function(t){return fe(this,t).get(t)},he.prototype.has=function(t){return fe(this,t).has(t)},he.prototype.set=function(t,e){var n=fe(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function ve(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=t.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(ve.Cache||he),n}ve.Cache=he;var me=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,be=/\\(\\)?/g,ye=function(t){var e=ve(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(me,(function(t,n,r,o){e.push(r?o.replace(be,"$1"):n||t)})),e})),ge=ye;function we(t){return null==t?"":G(t)}function _e(t,e){return M(t)?t:oe(t,e)?[t]:ge(we(t))}function je(t){if("string"==typeof t||D(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function Se(t,e){for(var n=0,r=(e=_e(e,t)).length;null!=t&&n<r;)t=t[je(e[n++])];return n&&n==r?t:void 0}function xe(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}var ke=A?A.isConcatSpreadable:void 0;function Ie(t){return M(t)||Nt(t)||!!(ke&&t&&t[ke])}function Oe(t,e,n,r,o){var i=-1,s=t.length;for(n||(n=Ie),o||(o=[]);++i<s;){var a=t[i];e>0&&n(a)?e>1?Oe(a,e-1,n,r,o):xe(o,a):r||(o[o.length]=a)}return o}var Ee=Yt(Object.getPrototypeOf,Object),Ae=Function.prototype,Ce=Object.prototype,Pe=Ae.toString,Ue=Ce.hasOwnProperty,Te=Pe.call(Object);function Ne(t){var e=this.__data__=new de(t);this.size=e.size}Ne.prototype.clear=function(){this.__data__=new de,this.size=0},Ne.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Ne.prototype.get=function(t){return this.__data__.get(t)},Ne.prototype.has=function(t){return this.__data__.has(t)},Ne.prototype.set=function(t,e){var n=this.__data__;if(n instanceof de){var r=n.__data__;if(!pe||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new he(r)}return n.set(t,e),this.size=n.size,this};var Le="object"==typeof exports&&exports&&!exports.nodeType&&exports,Re=Le&&"object"==typeof module&&module&&!module.nodeType&&module,Be=Re&&Re.exports===Le?E.Buffer:void 0,De=Be?Be.allocUnsafe:void 0;var Fe=Object.prototype.propertyIsEnumerable,Me=Object.getOwnPropertySymbols,We=Me?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var s=t[n];e(s,n,t)&&(i[o++]=s)}return i}(Me(t),(function(e){return Fe.call(t,e)})))}:function(){return[]};function $e(t){return function(t,e,n){var r=e(t);return M(t)?r:xe(r,n(t))}(t,Zt,We)}var Ge=it(E,"DataView"),qe=it(E,"Promise"),ze=it(E,"Set"),Ve=X(Ge),He=X(pe),Je=X(qe),Ye=X(ze),Ke=X(st),Xe=R;(Ge&&"[object DataView]"!=Xe(new Ge(new ArrayBuffer(1)))||pe&&"[object Map]"!=Xe(new pe)||qe&&"[object Promise]"!=Xe(qe.resolve())||ze&&"[object Set]"!=Xe(new ze)||st&&"[object WeakMap]"!=Xe(new st))&&(Xe=function(t){var e=R(t),n="[object Object]"==e?t.constructor:void 0,r=n?X(n):"";if(r)switch(r){case Ve:return"[object DataView]";case He:return"[object Map]";case Je:return"[object Promise]";case Ye:return"[object Set]";case Ke:return"[object WeakMap]"}return e});var Ze=Xe,Qe=E.Uint8Array;function tn(t,e){var n,r,o=e?(n=t.buffer,r=new n.constructor(n.byteLength),new Qe(r).set(new Qe(n)),r):t.buffer;return new t.constructor(o,t.byteOffset,t.length)}function en(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new he;++e<n;)this.add(t[e])}function nn(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}en.prototype.add=en.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},en.prototype.has=function(t){return this.__data__.has(t)};function rn(t,e,n,r,o,i){var s=1&n,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=i.get(t),l=i.get(e);if(u&&l)return u==e&&l==t;var d=-1,p=!0,f=2&n?new en:void 0;for(i.set(t,e),i.set(e,t);++d<a;){var h=t[d],v=e[d];if(r)var m=s?r(v,h,d,e,t,i):r(h,v,d,t,e,i);if(void 0!==m){if(m)continue;p=!1;break}if(f){if(!nn(e,(function(t,e){if(s=e,!f.has(s)&&(h===t||o(h,t,n,r,i)))return f.push(e);var s}))){p=!1;break}}else if(h!==v&&!o(h,v,n,r,i)){p=!1;break}}return i.delete(t),i.delete(e),p}function on(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function sn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var an=A?A.prototype:void 0,cn=an?an.valueOf:void 0;var un=Object.prototype.hasOwnProperty;var ln="[object Object]",dn=Object.prototype.hasOwnProperty;function pn(t,e,n,r,o,i){var s=M(t),a=M(e),c=s?"[object Array]":Ze(t),u=a?"[object Array]":Ze(e),l=(c="[object Arguments]"==c?ln:c)==ln,d=(u="[object Arguments]"==u?ln:u)==ln,p=c==u;if(p&&Dt(t)){if(!Dt(e))return!1;s=!0,l=!1}if(p&&!l)return i||(i=new Ne),s||Vt(t)?rn(t,e,n,r,o,i):function(t,e,n,r,o,i,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new Qe(t),new Qe(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return _t(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=on;case"[object Set]":var c=1&r;if(a||(a=sn),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;r|=2,s.set(t,e);var l=rn(a(t),a(e),r,o,i,s);return s.delete(t),l;case"[object Symbol]":if(cn)return cn.call(t)==cn.call(e)}return!1}(t,e,c,n,r,o,i);if(!(1&n)){var f=l&&dn.call(t,"__wrapped__"),h=d&&dn.call(e,"__wrapped__");if(f||h){var v=f?t.value():t,m=h?e.value():e;return i||(i=new Ne),o(v,m,n,r,i)}}return!!p&&(i||(i=new Ne),function(t,e,n,r,o,i){var s=1&n,a=$e(t),c=a.length;if(c!=$e(e).length&&!s)return!1;for(var u=c;u--;){var l=a[u];if(!(s?l in e:un.call(e,l)))return!1}var d=i.get(t),p=i.get(e);if(d&&p)return d==e&&p==t;var f=!0;i.set(t,e),i.set(e,t);for(var h=s;++u<c;){var v=t[l=a[u]],m=e[l];if(r)var b=s?r(m,v,l,e,t,i):r(v,m,l,t,e,i);if(!(void 0===b?v===m||o(v,m,n,r,i):b)){f=!1;break}h||(h="constructor"==l)}if(f&&!h){var y=t.constructor,g=e.constructor;y==g||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof g&&g instanceof g||(f=!1)}return i.delete(t),i.delete(e),f}(t,e,n,r,o,i))}function fn(t,e,n,r,o){return t===e||(null==t||null==e||!B(t)&&!B(e)?t!=t&&e!=e:pn(t,e,n,r,fn,o))}function hn(t){return t==t&&!q(t)}function vn(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}function mn(t){var e=function(t){for(var e=Zt(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,hn(o)]}return e}(t);return 1==e.length&&e[0][2]?vn(e[0][0],e[0][1]):function(n){return n===t||function(t,e,n,r){var o=n.length,i=o,s=!r;if(null==t)return!i;for(t=Object(t);o--;){var a=n[o];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<i;){var c=(a=n[o])[0],u=t[c],l=a[1];if(s&&a[2]){if(void 0===u&&!(c in t))return!1}else{var d=new Ne;if(r)var p=r(u,l,c,t,e,d);if(!(void 0===p?fn(l,u,3,r,d):p))return!1}}return!0}(n,t,e)}}function bn(t,e){return null!=t&&e in Object(t)}function yn(t,e){return null!=t&&function(t,e,n){for(var r=-1,o=(e=_e(e,t)).length,i=!1;++r<o;){var s=je(e[r]);if(!(i=null!=t&&n(t,s)))break;t=t[s]}return i||++r!=o?i:!!(o=null==t?0:t.length)&&It(o)&&gt(s,o)&&(M(t)||Nt(t))}(t,e,bn)}function gn(t,e){return oe(t)&&hn(e)?vn(je(t),e):function(n){var r=function(t,e,n){var r=null==t?void 0:Se(t,e);return void 0===r?n:r}(n,t);return void 0===r&&r===e?yn(n,t):fn(e,r,3)}}function wn(t){return oe(t)?(e=je(t),function(t){return null==t?void 0:t[e]}):function(t){return function(e){return Se(e,t)}}(t);var e}function _n(t){return"function"==typeof t?t:null==t?z:"object"==typeof t?M(t)?gn(t[0],t[1]):mn(t):wn(t)}var jn,Sn=function(t,e,n){for(var r=-1,o=Object(t),i=n(t),s=i.length;s--;){var a=i[jn?s:++r];if(!1===e(o[a],a,o))break}return t};var xn=function(t,e){return function(n,r){if(null==n)return n;if(!Ot(n))return t(n,r);for(var o=n.length,i=e?o:-1,s=Object(n);(e?i--:++i<o)&&!1!==r(s[i],i,s););return n}}((function(t,e){return t&&Sn(t,e,Zt)})),kn=xn;function In(t,e,n){(void 0!==n&&!_t(t[e],n)||void 0===n&&!(e in t))&&wt(t,e,n)}function On(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function En(t){return function(t,e,n,r){var o=!n;n||(n={});for(var i=-1,s=e.length;++i<s;){var a=e[i],c=r?r(n[a],t[a],a,n,t):void 0;void 0===c&&(c=t[a]),o?wt(n,a,c):St(n,a,c)}return n}(t,ee(t))}function An(t,e,n,r,o,i,s){var a=On(t,n),c=On(e,n),u=s.get(c);if(u)In(t,n,u);else{var l,d=i?i(a,c,n+"",t,e,s):void 0,p=void 0===d;if(p){var f=M(c),h=!f&&Dt(c),v=!f&&!h&&Vt(c);d=c,f||h||v?M(a)?d=a:B(l=a)&&Ot(l)?d=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(a):h?(p=!1,d=function(t,e){if(e)return t.slice();var n=t.length,r=De?De(n):new t.constructor(n);return t.copy(r),r}(c,!0)):v?(p=!1,d=tn(c,!0)):d=[]:function(t){if(!B(t)||"[object Object]"!=R(t))return!1;var e=Ee(t);if(null===e)return!0;var n=Ue.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Pe.call(n)==Te}(c)||Nt(c)?(d=a,Nt(a)?d=En(a):q(a)&&!V(a)||(d=function(t){return"function"!=typeof t.constructor||At(t)?{}:ct(Ee(t))}(c))):p=!1}p&&(s.set(c,d),o(d,c,r,i,s),s.delete(c)),In(t,n,d)}}function Cn(t,e,n,r,o){t!==e&&Sn(e,(function(i,s){if(o||(o=new Ne),q(i))An(t,e,s,n,Cn,r,o);else{var a=r?r(On(t,s),i,s+"",t,e,o):void 0;void 0===a&&(a=i),In(t,s,a)}}),ee)}var Pn=/[\\^$.*+?()[\]{}|]/g,Un=RegExp(Pn.source);function Tn(t,e){var n=-1,r=Ot(t)?Array(t.length):[];return kn(t,(function(t,o,i){r[++n]=e(t,o,i)})),r}function Nn(t,e){return Oe(function(t,e){return(M(t)?F:Tn)(t,_n(e))}(t,e),1)}function Ln(t,e){return t>e}function Rn(t){return"string"==typeof t||!M(t)&&B(t)&&"[object String]"==R(t)}function Bn(t,e){return t&&t.length?function(t,e,n){for(var r=-1,o=t.length;++r<o;){var i=t[r],s=e(i);if(null!=s&&(void 0===a?s==s&&!D(s):n(s,a)))var a=s,c=i}return c}(t,_n(e),Ln):void 0}var Dn,Fn=(Dn=function(t,e,n){Cn(t,e,n)},kt((function(t,e){var n=-1,r=e.length,o=r>1?e[r-1]:void 0,i=r>2?e[2]:void 0;for(o=Dn.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(t,e,n){if(!q(n))return!1;var r=typeof e;return!!("number"==r?Ot(n)&&gt(e,n.length):"string"==r&&e in n)&&_t(n[e],t)}(e[0],e[1],i)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var s=e[n];s&&Dn(t,s,n,o)}return t})));const Mn=n.Readable,Wn=Symbol("buffer"),$n=Symbol("type");class Gn{constructor(){this[$n]="";const t=arguments[0],e=arguments[1],n=[];let r=0;if(t){const e=t,o=Number(e.length);for(let t=0;t<o;t++){const o=e[t];let i;i=o instanceof Buffer?o:ArrayBuffer.isView(o)?Buffer.from(o.buffer,o.byteOffset,o.byteLength):o instanceof ArrayBuffer?Buffer.from(o):o instanceof Gn?o[Wn]:Buffer.from("string"==typeof o?o:String(o)),r+=i.length,n.push(i)}}this[Wn]=Buffer.concat(n);let o=e&&void 0!==e.type&&String(e.type).toLowerCase();o&&!/[^\u0020-\u007E]/.test(o)&&(this[$n]=o)}get size(){return this[Wn].length}get type(){return this[$n]}text(){return Promise.resolve(this[Wn].toString())}arrayBuffer(){const t=this[Wn],e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return Promise.resolve(e)}stream(){const t=new Mn;return t._read=function(){},t.push(this[Wn]),t.push(null),t}toString(){return"[object Blob]"}slice(){const t=this.size,e=arguments[0],n=arguments[1];let r,o;r=void 0===e?0:e<0?Math.max(t+e,0):Math.min(e,t),o=void 0===n?t:n<0?Math.max(t+n,0):Math.min(n,t);const i=Math.max(o-r,0),s=this[Wn].slice(r,r+i),a=new Gn([],{type:arguments[2]});return a[Wn]=s,a}}function qn(t,e,n){Error.call(this,t),this.message=t,this.type=e,n&&(this.code=this.errno=n.code),Error.captureStackTrace(this,this.constructor)}let zn;Object.defineProperties(Gn.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(Gn.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),qn.prototype=Object.create(Error.prototype),qn.prototype.constructor=qn,qn.prototype.name="FetchError";try{zn=require("encoding").convert}catch(t){}const Vn=Symbol("Body internals"),Hn=n.PassThrough;function Jn(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.size;let i=void 0===o?0:o;var s=r.timeout;let a=void 0===s?0:s;null==t?t=null:Kn(t)?t=Buffer.from(t.toString()):Xn(t)||Buffer.isBuffer(t)||("[object ArrayBuffer]"===Object.prototype.toString.call(t)?t=Buffer.from(t):ArrayBuffer.isView(t)?t=Buffer.from(t.buffer,t.byteOffset,t.byteLength):t instanceof n||(t=Buffer.from(String(t)))),this[Vn]={body:t,disturbed:!1,error:null},this.size=i,this.timeout=a,t instanceof n&&t.on("error",(function(t){const n="AbortError"===t.name?t:new qn(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t);e[Vn].error=n}))}function Yn(){var t=this;if(this[Vn].disturbed)return Jn.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[Vn].disturbed=!0,this[Vn].error)return Jn.Promise.reject(this[Vn].error);let e=this.body;if(null===e)return Jn.Promise.resolve(Buffer.alloc(0));if(Xn(e)&&(e=e.stream()),Buffer.isBuffer(e))return Jn.Promise.resolve(e);if(!(e instanceof n))return Jn.Promise.resolve(Buffer.alloc(0));let r=[],o=0,i=!1;return new Jn.Promise((function(n,s){let a;t.timeout&&(a=setTimeout((function(){i=!0,s(new qn(`Response timeout while trying to fetch ${t.url} (over ${t.timeout}ms)`,"body-timeout"))}),t.timeout)),e.on("error",(function(e){"AbortError"===e.name?(i=!0,s(e)):s(new qn(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e))})),e.on("data",(function(e){if(!i&&null!==e){if(t.size&&o+e.length>t.size)return i=!0,void s(new qn(`content size at ${t.url} over limit: ${t.size}`,"max-size"));o+=e.length,r.push(e)}})),e.on("end",(function(){if(!i){clearTimeout(a);try{n(Buffer.concat(r,o))}catch(e){s(new qn(`Could not create Buffer from response body for ${t.url}: ${e.message}`,"system",e))}}}))}))}function Kn(t){return"object"==typeof t&&"function"==typeof t.append&&"function"==typeof t.delete&&"function"==typeof t.get&&"function"==typeof t.getAll&&"function"==typeof t.has&&"function"==typeof t.set&&("URLSearchParams"===t.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(t)||"function"==typeof t.sort)}function Xn(t){return"object"==typeof t&&"function"==typeof t.arrayBuffer&&"string"==typeof t.type&&"function"==typeof t.stream&&"function"==typeof t.constructor&&"string"==typeof t.constructor.name&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}function Zn(t){let e,r,o=t.body;if(t.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof n&&"function"!=typeof o.getBoundary&&(e=new Hn,r=new Hn,o.pipe(e),o.pipe(r),t[Vn].body=e,o=r),o}function Qn(t){return null===t?null:"string"==typeof t?"text/plain;charset=UTF-8":Kn(t)?"application/x-www-form-urlencoded;charset=UTF-8":Xn(t)?t.type||null:Buffer.isBuffer(t)||"[object ArrayBuffer]"===Object.prototype.toString.call(t)||ArrayBuffer.isView(t)?null:"function"==typeof t.getBoundary?`multipart/form-data;boundary=${t.getBoundary()}`:t instanceof n?null:"text/plain;charset=UTF-8"}function tr(t){const e=t.body;return null===e?0:Xn(e)?e.size:Buffer.isBuffer(e)?e.length:e&&"function"==typeof e.getLengthSync&&(e._lengthRetrievers&&0==e._lengthRetrievers.length||e.hasKnownLength&&e.hasKnownLength())?e.getLengthSync():null}Jn.prototype={get body(){return this[Vn].body},get bodyUsed(){return this[Vn].disturbed},arrayBuffer(){return Yn.call(this).then((function(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}))},blob(){let t=this.headers&&this.headers.get("content-type")||"";return Yn.call(this).then((function(e){return Object.assign(new Gn([],{type:t.toLowerCase()}),{[Wn]:e})}))},json(){var t=this;return Yn.call(this).then((function(e){try{return JSON.parse(e.toString())}catch(e){return Jn.Promise.reject(new qn(`invalid json response body at ${t.url} reason: ${e.message}`,"invalid-json"))}}))},text(){return Yn.call(this).then((function(t){return t.toString()}))},buffer(){return Yn.call(this)},textConverted(){var t=this;return Yn.call(this).then((function(e){return function(t,e){if("function"!=typeof zn)throw new Error("The package `encoding` must be installed to use the textConverted() function");const n=e.get("content-type");let r,o,i="utf-8";n&&(r=/charset=([^;]*)/i.exec(n));o=t.slice(0,1024).toString(),!r&&o&&(r=/<meta.+?charset=(['"])(.+?)\1/i.exec(o));!r&&o&&(r=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(o),r||(r=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(o),r&&r.pop()),r&&(r=/charset=(.*)/i.exec(r.pop())));!r&&o&&(r=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(o));r&&(i=r.pop(),"gb2312"!==i&&"gbk"!==i||(i="gb18030"));return zn(t,"UTF-8",i).toString()}(e,t.headers)}))}},Object.defineProperties(Jn.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),Jn.mixIn=function(t){for(const e of Object.getOwnPropertyNames(Jn.prototype))if(!(e in t)){const n=Object.getOwnPropertyDescriptor(Jn.prototype,e);Object.defineProperty(t,e,n)}},Jn.Promise=global.Promise;const er=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,nr=/[^\t\x20-\x7e\x80-\xff]/;function rr(t){if(t=`${t}`,er.test(t)||""===t)throw new TypeError(`${t} is not a legal HTTP header name`)}function or(t){if(t=`${t}`,nr.test(t))throw new TypeError(`${t} is not a legal HTTP header value`)}function ir(t,e){e=e.toLowerCase();for(const n in t)if(n.toLowerCase()===e)return n}const sr=Symbol("map");class ar{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[sr]=Object.create(null),t instanceof ar){const e=t.raw(),n=Object.keys(e);for(const t of n)for(const n of e[t])this.append(t,n)}else if(null==t);else{if("object"!=typeof t)throw new TypeError("Provided initializer must be an object");{const e=t[Symbol.iterator];if(null!=e){if("function"!=typeof e)throw new TypeError("Header pairs must be iterable");const n=[];for(const e of t){if("object"!=typeof e||"function"!=typeof e[Symbol.iterator])throw new TypeError("Each header pair must be iterable");n.push(Array.from(e))}for(const t of n){if(2!==t.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(t[0],t[1])}}else for(const e of Object.keys(t)){const n=t[e];this.append(e,n)}}}}get(t){rr(t=`${t}`);const e=ir(this[sr],t);return void 0===e?null:this[sr][e].join(", ")}forEach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=cr(this),r=0;for(;r<n.length;){var o=n[r];const i=o[0],s=o[1];t.call(e,s,i,this),n=cr(this),r++}}set(t,e){e=`${e}`,rr(t=`${t}`),or(e);const n=ir(this[sr],t);this[sr][void 0!==n?n:t]=[e]}append(t,e){e=`${e}`,rr(t=`${t}`),or(e);const n=ir(this[sr],t);void 0!==n?this[sr][n].push(e):this[sr][t]=[e]}has(t){return rr(t=`${t}`),void 0!==ir(this[sr],t)}delete(t){rr(t=`${t}`);const e=ir(this[sr],t);void 0!==e&&delete this[sr][e]}raw(){return this[sr]}keys(){return lr(this,"key")}values(){return lr(this,"value")}[Symbol.iterator](){return lr(this,"key+value")}}function cr(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";const n=Object.keys(t[sr]).sort();return n.map("key"===e?function(t){return t.toLowerCase()}:"value"===e?function(e){return t[sr][e].join(", ")}:function(e){return[e.toLowerCase(),t[sr][e].join(", ")]})}ar.prototype.entries=ar.prototype[Symbol.iterator],Object.defineProperty(ar.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(ar.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const ur=Symbol("internal");function lr(t,e){const n=Object.create(dr);return n[ur]={target:t,kind:e,index:0},n}const dr=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==dr)throw new TypeError("Value of `this` is not a HeadersIterator");var t=this[ur];const e=t.target,n=t.kind,r=t.index,o=cr(e,n);return r>=o.length?{value:void 0,done:!0}:(this[ur].index=r+1,{value:o[r],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function pr(t){const e=Object.assign({__proto__:null},t[sr]),n=ir(t[sr],"Host");return void 0!==n&&(e[n]=e[n][0]),e}Object.defineProperty(dr,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const fr=Symbol("Response internals"),hr=o.STATUS_CODES;class vr{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Jn.call(this,t,e);const n=e.status||200,r=new ar(e.headers);if(null!=t&&!r.has("Content-Type")){const e=Qn(t);e&&r.append("Content-Type",e)}this[fr]={url:e.url,status:n,statusText:e.statusText||hr[n],headers:r,counter:e.counter}}get url(){return this[fr].url||""}get status(){return this[fr].status}get ok(){return this[fr].status>=200&&this[fr].status<300}get redirected(){return this[fr].counter>0}get statusText(){return this[fr].statusText}get headers(){return this[fr].headers}clone(){return new vr(Zn(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}Jn.mixIn(vr.prototype),Object.defineProperties(vr.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(vr.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const mr=Symbol("Request internals"),br=i.parse,yr=i.format,gr="destroy"in n.Readable.prototype;function wr(t){return"object"==typeof t&&"object"==typeof t[mr]}class _r{constructor(t){let e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};wr(t)?e=br(t.url):(e=t&&t.href?br(t.href):br(`${t}`),t={});let r=n.method||t.method||"GET";if(r=r.toUpperCase(),(null!=n.body||wr(t)&&null!==t.body)&&("GET"===r||"HEAD"===r))throw new TypeError("Request with GET/HEAD method cannot have body");let o=null!=n.body?n.body:wr(t)&&null!==t.body?Zn(t):null;Jn.call(this,o,{timeout:n.timeout||t.timeout||0,size:n.size||t.size||0});const i=new ar(n.headers||t.headers||{});if(null!=o&&!i.has("Content-Type")){const t=Qn(o);t&&i.append("Content-Type",t)}let s=wr(t)?t.signal:null;if("signal"in n&&(s=n.signal),null!=s&&!function(t){const e=t&&"object"==typeof t&&Object.getPrototypeOf(t);return!(!e||"AbortSignal"!==e.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[mr]={method:r,redirect:n.redirect||t.redirect||"follow",headers:i,parsedURL:e,signal:s},this.follow=void 0!==n.follow?n.follow:void 0!==t.follow?t.follow:20,this.compress=void 0!==n.compress?n.compress:void 0===t.compress||t.compress,this.counter=n.counter||t.counter||0,this.agent=n.agent||t.agent}get method(){return this[mr].method}get url(){return yr(this[mr].parsedURL)}get headers(){return this[mr].headers}get redirect(){return this[mr].redirect}get signal(){return this[mr].signal}clone(){return new _r(this)}}function jr(t){Error.call(this,t),this.type="aborted",this.message=t,Error.captureStackTrace(this,this.constructor)}Jn.mixIn(_r.prototype),Object.defineProperty(_r.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(_r.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),jr.prototype=Object.create(Error.prototype),jr.prototype.constructor=jr,jr.prototype.name="AbortError";const Sr=n.PassThrough,xr=i.resolve;function kr(t,e){if(!kr.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return Jn.Promise=kr.Promise,new kr.Promise((function(r,i){const s=new _r(t,e),u=function(t){const e=t[mr].parsedURL,r=new ar(t[mr].headers);if(r.has("Accept")||r.set("Accept","*/*"),!e.protocol||!e.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(e.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(t.signal&&t.body instanceof n.Readable&&!gr)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let o=null;if(null==t.body&&/^(POST|PUT)$/i.test(t.method)&&(o="0"),null!=t.body){const e=tr(t);"number"==typeof e&&(o=String(e))}o&&r.set("Content-Length",o),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=t.agent;return"function"==typeof i&&(i=i(e)),r.has("Connection")||i||r.set("Connection","close"),Object.assign({},e,{method:t.method,headers:pr(r),agent:i})}(s),l=("https:"===u.protocol?a:o).request,d=s.signal;let p=null;const f=function(){let t=new jr("The user aborted a request.");i(t),s.body&&s.body instanceof n.Readable&&s.body.destroy(t),p&&p.body&&p.body.emit("error",t)};if(d&&d.aborted)return void f();const h=function(){f(),b()},v=l(u);let m;function b(){v.abort(),d&&d.removeEventListener("abort",h),clearTimeout(m)}d&&d.addEventListener("abort",h),s.timeout&&v.once("socket",(function(t){m=setTimeout((function(){i(new qn(`network timeout at: ${s.url}`,"request-timeout")),b()}),s.timeout)})),v.on("error",(function(t){i(new qn(`request to ${s.url} failed, reason: ${t.message}`,"system",t)),b()})),v.on("response",(function(t){clearTimeout(m);const e=function(t){const e=new ar;for(const n of Object.keys(t))if(!er.test(n))if(Array.isArray(t[n]))for(const r of t[n])nr.test(r)||(void 0===e[sr][n]?e[sr][n]=[r]:e[sr][n].push(r));else nr.test(t[n])||(e[sr][n]=[t[n]]);return e}(t.headers);if(kr.isRedirect(t.statusCode)){const n=e.get("Location"),o=null===n?null:xr(s.url,n);switch(s.redirect){case"error":return i(new qn(`uri requested responds with a redirect, redirect mode is set to error: ${s.url}`,"no-redirect")),void b();case"manual":if(null!==o)try{e.set("Location",o)}catch(t){i(t)}break;case"follow":if(null===o)break;if(s.counter>=s.follow)return i(new qn(`maximum redirect reached at: ${s.url}`,"max-redirect")),void b();const n={headers:new ar(s.headers),follow:s.follow,counter:s.counter+1,agent:s.agent,compress:s.compress,method:s.method,body:s.body,signal:s.signal,timeout:s.timeout,size:s.size};return 303!==t.statusCode&&s.body&&null===tr(s)?(i(new qn("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void b()):(303!==t.statusCode&&(301!==t.statusCode&&302!==t.statusCode||"POST"!==s.method)||(n.method="GET",n.body=void 0,n.headers.delete("content-length")),r(kr(new _r(o,n))),void b())}}t.once("end",(function(){d&&d.removeEventListener("abort",h)}));let n=t.pipe(new Sr);const o={url:s.url,status:t.statusCode,statusText:t.statusMessage,headers:e,size:s.size,timeout:s.timeout,counter:s.counter},a=e.get("Content-Encoding");if(!s.compress||"HEAD"===s.method||null===a||204===t.statusCode||304===t.statusCode)return p=new vr(n,o),void r(p);const u={flush:c.Z_SYNC_FLUSH,finishFlush:c.Z_SYNC_FLUSH};if("gzip"==a||"x-gzip"==a)return n=n.pipe(c.createGunzip(u)),p=new vr(n,o),void r(p);if("deflate"!=a&&"x-deflate"!=a){if("br"==a&&"function"==typeof c.createBrotliDecompress)return n=n.pipe(c.createBrotliDecompress()),p=new vr(n,o),void r(p);p=new vr(n,o),r(p)}else{t.pipe(new Sr).once("data",(function(t){n=8==(15&t[0])?n.pipe(c.createInflate()):n.pipe(c.createInflateRaw()),p=new vr(n,o),r(p)}))}})),function(t,e){const n=e.body;null===n?t.end():Xn(n)?n.stream().pipe(t):Buffer.isBuffer(n)?(t.write(n),t.end()):n.pipe(t)}(v,s)}))}kr.isRedirect=function(t){return 301===t||302===t||303===t||307===t||308===t},kr.Promise=global.Promise;var Ir=function(){function t(t){this.contextProvider=t}return t.prototype.getServiceDetails=function(t,e){return S(this,void 0,void 0,(function(){return x(this,(function(n){return[2,this.fetch("".concat(this.contextProvider.getCurrentBaseUrl(),"/v1/port-forwarding/info/projects/").concat(t,"/services/").concat(e))]}))}))},t.prototype.getAddonDetails=function(t,e){return S(this,void 0,void 0,(function(){return x(this,(function(n){return[2,this.fetch("".concat(this.contextProvider.getCurrentBaseUrl(),"/v1/port-forwarding/info/projects/").concat(t,"/addons/").concat(e))]}))}))},t.prototype.fetch=function(t,e){return S(this,void 0,void 0,(function(){var n,r,o,i,s;return x(this,(function(a){switch(a.label){case 0:return n=Fn({},{headers:{Authorization:"Bearer ".concat(this.contextProvider.getCurrentToken()),"Content-Type":"application/json"}},j({},e)),[4,kr(t,n)];case 1:return(r=a.sent()).ok?[3,3]:(o=Error.bind,s=(i=JSON).stringify,[4,r.json()]);case 2:throw new(o.apply(Error,[void 0,s.apply(i,[a.sent()])]));case 3:return[4,r.json()];case 4:return[2,a.sent()]}}))}))},t}(),Or=function(t,e,n){return S(void 0,void 0,void 0,(function(){var r,o,i,s,a;return x(this,(function(c){switch(c.label){case 0:if(r=Cr(e||"127.0.0.1"),(o=Cr(n||"127.255.255.255"))<r)throw new Error("Invalid IP range");"darwin"===u.platform()&&(i=function(t){return S(void 0,void 0,void 0,(function(){var e;return x(this,(function(n){switch(n.label){case 0:return e="lo0 alias ".concat(t," up"),[4,Ar.apply(void 0,e.split(" "))];case 1:return n.sent(),[2]}}))}))}),s=r,c.label=1;case 1:return s<=o?(a=Pr(s),[4,Er(t,a)]):[3,6];case 2:return c.sent()?i?[4,i(a)]:[3,4]:[3,5];case 3:c.sent(),c.label=4;case 4:return[2,a];case 5:return s+=1,[3,1];case 6:throw new Error("No ip available")}}))}))},Er=function(t,e){return new Promise((function(n){var r=new p,o=!1;r.on("connect",(function(){o=!0,r.destroy()})),r.setTimeout(400),r.on("timeout",(function(){o=!1,r.destroy()})),r.on("error",(function(){o=!1})),r.on("close",(function(){n(!o)})),e?r.connect(t,e):r.connect(t)}))},Ar=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return S(void 0,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return"/sbin/ifconfig",[4,Ur("/sbin/ifconfig",t).resultPromise];case 1:return[2,e.sent()]}}))}))},Cr=function(t){var e=t.split(".").reverse();if(4!==e.length)throw new Error("Invalid ip address: ".concat(t));for(var n=0,r=0;r<4;r+=1){var o=Number.parseInt(e[r],10);if(o<0||o>255)throw new Error("Invalid ip address: ".concat(t));n+=o<<8*r}return n},Pr=function(t){if(!Number.isSafeInteger(t))throw new Error("Number is not an integer");if(t<0||t>4294967295)throw new Error("Number is out of range 0x0-0xffffffff");for(var e=[],n=0;n<4;n+=1)e.push(t>>8*n&255);return e.reverse().join(".")},Ur=function(t,e,n){var r=f(t,e,j({windowsHide:!0},n)),o=new Promise((function(o,i){var s="",a="";(null===(null==n?void 0:n.stdio)||void 0===(null==n?void 0:n.stdio))&&(r.stdout&&r.stdout.on("data",(function(t){s+=t})),r.stderr&&r.stderr.on("data",(function(t){a+=t}))),r.on("close",(function(n){var r={code:n,stdout:s,stderr:a};if(0!==n){var c="Error during execution of command '".concat(t," ").concat(e.join(" "),"': ").concat(a);i({message:c,result:r})}else o(r)}))}));return{process:r,resultPromise:o}},Tr=function(t,e,n){return S(void 0,void 0,void 0,(function(){var r,o;return x(this,(function(i){switch(i.label){case 0:return r=Nr(t,10),[4,v.promises.writeFile(r,e,n)];case 1:i.sent(),i.label=2;case 2:return i.trys.push([2,4,,6]),[4,v.promises.rename(r,t)];case 3:return i.sent(),[3,6];case 4:return o=i.sent(),[4,v.promises.unlink(r).catch((function(){}))];case 5:throw i.sent(),o;case 6:return[2]}}))}))},Nr=function(t,e){for(var n,r=m.dirname(t),o=m.basename(t),i=0;null===(n=i<e)||void 0===n||n;i+=1){var s=k([],Array(16),!0).map((function(){return Math.floor(16*Math.random()).toString(16)})).join(""),a=".".concat(s,".").concat(o),c=m.join(r,a);if(!v.existsSync(c))return c}throw new Error("Could not write file to file '".concat(t,"'."))},Lr="win32"===process.platform?"\r\n":"\n",Rr=function(){function t(t,e){this.nodes=t,this.config=e}return t.prototype.add=function(t,e,n){var r=this;if(0===e.length)return this;var o=this.findOrCreateEntry(t,n);return e.forEach((function(t){if(!o.hosts.find((function(e){return e.host===t}))){var e=1;0===o.hosts.length&&(e=r.config.indent-"".concat(o.ipPrefixWhitespace).concat(o.ip).length),o.hosts.push({whitespace:" ".repeat(e<1?1:e),host:t})}})),this},t.prototype.remove=function(t,e){var n=this;return this.findEntries(t).forEach((function(t){e.forEach((function(e){var r=t.hosts.findIndex((function(t){return t.host===e}));r<0||(0===r&&void 0!==t.hosts[1]&&(t.hosts[1].whitespace=t.hosts[0].whitespace),t.hosts.splice(r,1),0===t.hosts.length&&n.removeEntry(t))}))})),this},t.prototype.removeHosts=function(t){var e=this;Gr(this.nodes,"entry").forEach((function(n){e.remove(n.ip,t)}))},t.prototype.removeIps=function(t){var e=this;return t.forEach((function(t){e.findEntries(t).forEach((function(t){return e.removeEntry(t)}))})),this},t.prototype.resolveHosts=function(t){return Nn(this.findEntries(t),(function(t){return t.hosts.map((function(t){return t.host}))}))},t.prototype.resolveIps=function(t){return Gr(this.nodes,"entry").filter((function(e){return e.hosts.some((function(e){return e.host===t}))})).map((function(t){return t.ip}))},t.prototype.toString=function(){return Mr(this.nodes,this.config.eol)},t.prototype.removeEntry=function(t){var e,n="number"==typeof(e=t)||B(e)&&"[object Number]"==R(e)?t:this.nodes.findIndex((function(e){return e===t}));n<0||this.nodes.splice(n,1)},t.prototype.findEntries=function(t){return Gr(this.nodes,"entry").filter((function(e){return e.ip===t}))},t.prototype.findOrCreateEntry=function(t,e){var n=this.findEntries(t)[0];if(n)return n;var r=this.makeEntry(t);if(e){var o=Fr(e),i=this.nodes.findIndex((function(t){return"comment"===t.type&&t.line===o}));if(i>=0)this.insertAt(i+1,r);else{var s="blank"!==this.nodes[this.nodes.length-1].type?[Br(),Dr(o),r]:[Dr(o),r];this.insertAt.apply(this,k([this.nodes.length],s,!1))}}else this.insertAt(this.nodes.length,r);return r},t.prototype.insertAt=function(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];(e=this.nodes).splice.apply(e,k([t,0],n,!1))},t.prototype.makeEntry=function(t,e){var n=this.config.ipPrefixWhitespace;return j({type:"entry",ip:t,ipPrefixWhitespace:n,hosts:[]},e)},t.fromNodes=function(e,n){var r,o;return new t(e.filter((function(t){return"eol"!==t.type})),{eol:null!==(r=null==n?void 0:n.eol)&&void 0!==r?r:function(){var t,n=Gr(e,"eol").map((function(t){return t.line}));return null!==(t=qr(n))&&void 0!==t?t:Lr}(),indent:null!==(o=null==n?void 0:n.indent)&&void 0!==o?o:function(){var t,n=Nn(Gr(e,"entry"),(function(t){var e=t.ipPrefixWhitespace,n=t.ip,r=t.hosts[0];return r?["".concat(e).concat(n).concat(r.whitespace).length]:[]}));return null!==(t=qr(n))&&void 0!==t?t:17}(),ipPrefixWhitespace:""})},t.parse=function(t,e){return this.fromNodes(Wr(t),e)},t}(),Br=function(){return{type:"blank",line:""}},Dr=function(t){return{type:"comment",line:Fr(t)}},Fr=function(t){return t.startsWith("#")?t:"# ".concat(t)},Mr=function(t,e){return t.map((function(t){switch(t.type){case"entry":var e=t.hosts.map((function(t){var e=t.whitespace,n=t.host;return"".concat(e).concat(n)})).join("");return"".concat(t.ipPrefixWhitespace).concat(t.ip).concat(e);case"blank":case"comment":case"invalid":return t.line;default:return""}})).join(null!=e?e:Lr)},Wr=function(t){return t.split(/(\r?\n)/).map((function(t){return function(t){return t.match(/^\s*#.*$/)}(t)?{type:"comment",line:t}:function(t){return t.match(/^(\r?\n)$/)}(t)?{type:"eol",line:t}:function(t){return t.match(/^\s*$/)}(t)?{type:"blank",line:t}:$r(t)}))},$r=function(t){var e=t.match(/^(\s*)(\S+)(.+)?$/);if(!e)return{type:"invalid",line:t};var n=e[1],r=e[2],o=e.slice(3),i=!1,s=Nn(o.filter((function(t){return void 0!==t})),(function(t){var e=t.match(/(\s+)(\S+)/g);return e?e.map((function(t){var e=t.match(/^(\s+)(\S+)$/);e||(i=!0);var n=null!=e?e:[];return{whitespace:n[1],host:n[2]}})):(i=!0,[])}));return i?{type:"invalid",line:t}:{type:"entry",ipPrefixWhitespace:n,ip:r,hosts:s}},Gr=function(t,e){return t.filter((function(t){return t.type===e}))},qr=function(t){var e=new Map;t.forEach((function(t){var n;e.set(t,(null!==(n=e.get(t))&&void 0!==n?n:0)+1)}));var n=Bn(Array.from(e.entries()),(function(t){return t[1]}));if(n)return n[0]},zr="win32"===process.platform?"C:/Windows/System32/drivers/etc/hosts":"/etc/hosts",Vr=function(){function t(t){this.ast=Rr.fromNodes([]);var e={writeMode:"atomic",hostsFile:zr};this.config=j(j({},e),t)}return t.prototype.add=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!Rn(t))throw new Error("Expected 'ip' to be a string, but got ".concat(typeof t,"."));return e.forEach((function(t){if(!Rn(t))throw new Error("Expected 'host' to be a string, but got ".concat(typeof t,"."))})),this.ast.add(t,e,this.config.header),this},t.prototype.remove=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!Rn(t))throw new Error("Expected 'ip' to be a string, but got ".concat(typeof t,"."));return e.forEach((function(t){if(!Rn(t))throw new Error("Expected 'host' to be a string, but got ".concat(typeof t,"."))})),this.ast.remove(t,e),this},t.prototype.removeHosts=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.forEach((function(t){if(!Rn(t))throw new Error("Expected 'host' to be a string, but got ".concat(typeof t,"."))})),this.ast.removeHosts(t),this},t.prototype.removeIps=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.forEach((function(t){if(!Rn(t))throw new Error("Expected 'ip' to be a string, but got ".concat(typeof t,"."))})),this.ast.removeIps(t),this},t.prototype.read=function(){return S(this,void 0,void 0,(function(){var t;return x(this,(function(e){switch(e.label){case 0:return[4,v.promises.readFile(this.config.hostsFile)];case 1:return t=e.sent(),this.ast=Rr.parse(t.toString(),this.config),[2,this]}}))}))},t.prototype.write=function(t){return S(this,void 0,void 0,(function(){var e,n,r,o;return x(this,(function(i){switch(i.label){case 0:switch(e=j(j({},this.config),t),n=e.hostsFile,r=e.writeMode,o=this.ast.toString(),r){case void 0:case"atomic":return[3,1];case"standard":return[3,3];case"disabled":return[3,5]}return[3,5];case 1:return[4,Tr(n,o)];case 2:case 4:return i.sent(),[3,6];case 3:return[4,v.promises.writeFile(n,o)];case 5:return[3,6];case 6:return[2,this]}}))}))},t.prototype.backup=function(t){return S(this,void 0,void 0,(function(){var e,n,r,o;return x(this,(function(i){switch(i.label){case 0:return v.existsSync(this.config.hostsFile)?(e=m.dirname(this.config.hostsFile),n=m.basename(this.config.hostsFile),r="".concat(n).concat(t.suffix),o=m.resolve(e,r),v.existsSync(o)&&!t.rewrite?[3,2]:[4,v.promises.copyFile(this.config.hostsFile,o)]):[2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.load=function(e){return S(this,void 0,void 0,(function(){return x(this,(function(n){switch(n.label){case 0:return[4,new t(e).read()];case 1:return[2,n.sent()]}}))}))},t}(),Hr=function(){function t(){this.previousPromise=Promise.resolve()}return t.prototype.enter=function(t){return S(this,void 0,void 0,(function(){var e;return x(this,(function(n){return e=this.previousPromise.then((function(){return t()})).catch((function(){return t()})),this.previousPromise=e,[2,e]}))}))},t}(),Jr=function t(e,n){if(e&&n)return t(e)(n);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach((function(t){r[t]=e[t]})),r;function r(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),o=t[t.length-1];return"function"==typeof r&&r!==o&&Object.keys(o).forEach((function(t){r[t]=o[t]})),r}};var Yr=Jr(Xr),Kr=Jr(Zr);function Xr(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function Zr(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},n=t.name||"Function wrapped with `once`";return e.onceError=n+" shouldn't be called more than once",e.called=!1,e}Xr.proto=Xr((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Xr(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Zr(this)},configurable:!0})})),Yr.strict=Kr;var Qr=function(){},to=function(t,e,n){if("function"==typeof e)return to(t,null,e);e||(e={}),n=Yr(n||Qr);var r=t._writableState,o=t._readableState,i=e.readable||!1!==e.readable&&t.readable,s=e.writable||!1!==e.writable&&t.writable,a=!1,c=function(){t.writable||u()},u=function(){s=!1,i||n.call(t)},l=function(){i=!1,s||n.call(t)},d=function(e){n.call(t,e?new Error("exited with error code: "+e):null)},p=function(e){n.call(t,e)},f=function(){process.nextTick(h)},h=function(){if(!a)return(!i||o&&o.ended&&!o.destroyed)&&(!s||r&&r.ended&&!r.destroyed)?void 0:n.call(t,new Error("premature close"))},v=function(){t.req.on("finish",u)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(t)?s&&!r&&(t.on("end",c),t.on("close",c)):(t.on("complete",u),t.on("abort",f),t.req?v():t.on("request",v)),function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length}(t)&&t.on("exit",d),t.on("end",l),t.on("finish",u),!1!==e.error&&t.on("error",p),t.on("close",f),function(){a=!0,t.removeListener("complete",u),t.removeListener("abort",f),t.removeListener("request",v),t.req&&t.req.removeListener("finish",u),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",u),t.removeListener("exit",d),t.removeListener("end",l),t.removeListener("error",p),t.removeListener("close",f)}},eo=to,no=function(){},ro=/^v?\.0/.test(process.version),oo=function(t){return"function"==typeof t},io=function(t,e,n,r){r=Yr(r);var o=!1;t.on("close",(function(){o=!0})),eo(t,{readable:e,writable:n},(function(t){if(t)return r(t);o=!0,r()}));var i=!1;return function(e){if(!o&&!i)return i=!0,function(t){return!!ro&&!!v&&(t instanceof(v.ReadStream||no)||t instanceof(v.WriteStream||no))&&oo(t.close)}(t)?t.close(no):function(t){return t.setHeader&&oo(t.abort)}(t)?t.abort():oo(t.destroy)?t.destroy():void r(e||new Error("stream was destroyed"))}},so=function(t){t()},ao=function(t,e){return t.pipe(e)},co=function(){var t,e=Array.prototype.slice.call(arguments),n=oo(e[e.length-1]||no)&&e.pop()||no;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var r=e.map((function(o,i){var s=i<e.length-1;return io(o,s,i>0,(function(e){t||(t=e),e&&r.forEach(so),s||(r.forEach(so),n(t))}))}));return e.reduce(ao)};const{Duplex:uo}=n;function lo(t){t.emit("close")}function po(){!this.destroyed&&this._writableState.finished&&this.destroy()}function fo(t){this.removeListener("error",fo),this.destroy(),0===this.listenerCount("error")&&this.emit("error",t)}var ho=function(t,e){let n=!0;const r=new uo({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",(function(e,n){const o=!n&&r._readableState.objectMode?e.toString():e;r.push(o)||t.pause()})),t.once("error",(function(t){r.destroyed||(n=!1,r.destroy(t))})),t.once("close",(function(){r.destroyed||r.push(null)})),r._destroy=function(e,o){if(t.readyState===t.CLOSED)return o(e),void process.nextTick(lo,r);let i=!1;t.once("error",(function(t){i=!0,o(t)})),t.once("close",(function(){i||o(e),process.nextTick(lo,r)})),n&&t.terminate()},r._final=function(e){t.readyState!==t.CONNECTING?null!==t._socket&&(t._socket._writableState.finished?(e(),r._readableState.endEmitted&&r.destroy()):(t._socket.once("finish",(function(){e()})),t.close())):t.once("open",(function(){r._final(e)}))},r._read=function(){t.isPaused&&t.resume()},r._write=function(e,n,o){t.readyState!==t.CONNECTING?t.send(e,o):t.once("open",(function(){r._write(e,n,o)}))},r.on("end",po),r.on("error",fo),r};function vo(t,e){return t(e={exports:{}},e.exports),e.exports}var mo={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}},bo="function"==typeof __webpack_require__?__non_webpack_require__:function(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")},yo=process.config&&process.config.variables||{},go=!!process.env.PREBUILDS_ONLY,wo=process.versions.modules,_o=!(!process.versions||!process.versions.electron)||!!process.env.ELECTRON_RUN_AS_NODE||"undefined"!=typeof window&&window.process&&"renderer"===window.process.type?"electron":"node",jo=u.arch(),So=u.platform(),xo=process.env.LIBC||(function(t){return"linux"===t&&v.existsSync("/etc/alpine-release")}(So)?"musl":"glibc"),ko=process.env.ARM_VERSION||("arm64"===jo?"8":yo.arm_version)||"",Io=(process.versions.uv||"").split(".")[0],Oo=Eo;function Eo(t){return bo(Eo.path(t))}function Ao(t){try{return v.readdirSync(t)}catch(t){return[]}}function Co(t,e){var n=Ao(t).filter(e);return n[0]&&m.join(t,n[0])}function Po(t){return/\.node$/.test(t)}function Uo(t){var e=t.split("-");if(2===e.length){var n=e[0],r=e[1].split("+");if(n&&r.length&&r.every(Boolean))return{name:t,platform:n,architectures:r}}}function To(t,e){return function(n){return null!=n&&(n.platform===t&&n.architectures.includes(e))}}function No(t,e){return t.architectures.length-e.architectures.length}function Lo(t){var e=t.split("."),n={file:t,specificity:0};if("node"===e.pop()){for(var r=0;r<e.length;r++){var o=e[r];if("node"===o||"electron"===o||"node-webkit"===o)n.runtime=o;else if("napi"===o)n.napi=!0;else if("abi"===o.slice(0,3))n.abi=o.slice(3);else if("uv"===o.slice(0,2))n.uv=o.slice(2);else if("armv"===o.slice(0,4))n.armv=o.slice(4);else{if("glibc"!==o&&"musl"!==o)continue;n.libc=o}n.specificity++}return n}}function Ro(t,e){return function(n){return null!=n&&(!(n.runtime!==t&&!function(t){return"node"===t.runtime&&t.napi}(n))&&(!(n.abi!==e&&!n.napi)&&((!n.uv||n.uv===Io)&&((!n.armv||n.armv===ko)&&(!n.libc||n.libc===xo)))))}}function Bo(t){return function(e,n){return e.runtime!==n.runtime?e.runtime===t?-1:1:e.abi!==n.abi?e.abi?-1:1:e.specificity!==n.specificity?e.specificity>n.specificity?-1:1:0}}Eo.path=function(t){t=m.resolve(t||".");try{var e=bo(m.join(t,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[e+"_PREBUILD"]&&(t=process.env[e+"_PREBUILD"])}catch(t){}if(!go){var n=Co(m.join(t,"build/Release"),Po);if(n)return n;var r=Co(m.join(t,"build/Debug"),Po);if(r)return r}var o=a(t);if(o)return o;var i=a(m.dirname(process.execPath));if(i)return i;var s=["platform="+So,"arch="+jo,"runtime="+_o,"abi="+wo,"uv="+Io,ko?"armv="+ko:"","libc="+xo,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"","function"==typeof __webpack_require__?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+s+"\n loaded from: "+t+"\n");function a(t){var e=Ao(m.join(t,"prebuilds")).map(Uo).filter(To(So,jo)).sort(No)[0];if(e){var n=m.join(t,"prebuilds",e.name),r=Ao(n).map(Lo).filter(Ro(_o,wo)).sort(Bo(_o))[0];return r?m.join(n,r.file):void 0}}},Eo.parseTags=Lo,Eo.matchTags=Ro,Eo.compareTags=Bo,Eo.parseTuple=Uo,Eo.matchTuple=To,Eo.compareTuples=No;var Do={mask:(t,e,n,r,o)=>{for(var i=0;i<o;i++)n[r+i]=t[i]^e[3&i]},unmask:(t,e)=>{const n=t.length;for(var r=0;r<n;r++)t[r]^=e[3&r]}},Fo=vo((function(t){try{t.exports=Oo(__dirname)}catch(e){t.exports=Do}})),Mo=vo((function(t){const{EMPTY_BUFFER:e}=mo;function n(t,n){if(0===t.length)return e;if(1===t.length)return t[0];const r=Buffer.allocUnsafe(n);let o=0;for(let e=0;e<t.length;e++){const n=t[e];r.set(n,o),o+=n.length}return o<n?r.slice(0,o):r}function r(t,e,n,r,o){for(let i=0;i<o;i++)n[r+i]=t[i]^e[3&i]}function o(t,e){for(let n=0;n<t.length;n++)t[n]^=e[3&n]}function i(t){return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function s(t){if(s.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=Buffer.from(t):ArrayBuffer.isView(t)?e=Buffer.from(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),s.readOnly=!1),e}try{const e=Fo;t.exports={concat:n,mask(t,n,o,i,s){s<48?r(t,n,o,i,s):e.mask(t,n,o,i,s)},toArrayBuffer:i,toBuffer:s,unmask(t,n){t.length<32?o(t,n):e.unmask(t,n)}}}catch(e){t.exports={concat:n,mask:r,toArrayBuffer:i,toBuffer:s,unmask:o}}}));Mo.concat,Mo.mask,Mo.toArrayBuffer,Mo.toBuffer,Mo.unmask;const Wo=Symbol("kDone"),$o=Symbol("kRun");var Go=class{constructor(t){this[Wo]=()=>{this.pending--,this[$o]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[$o]()}[$o](){if(this.pending!==this.concurrency&&this.jobs.length){const t=this.jobs.shift();this.pending++,t(this[Wo])}}};const{kStatusCode:qo}=mo,zo=Buffer.from([0,0,255,255]),Vo=Symbol("permessage-deflate"),Ho=Symbol("total-length"),Jo=Symbol("callback"),Yo=Symbol("buffers"),Ko=Symbol("error");let Xo;var Zo=class{constructor(t,e,n){if(this._maxPayload=0|n,this._options=t||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!e,this._deflate=null,this._inflate=null,this.params=null,!Xo){const t=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;Xo=new Go(t)}}static get extensionName(){return"permessage-deflate"}offer(){const t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const t=this._deflate[Jo];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){const e=this._options,n=t.find((t=>!(!1===e.serverNoContextTakeover&&t.server_no_context_takeover||t.server_max_window_bits&&(!1===e.serverMaxWindowBits||"number"==typeof e.serverMaxWindowBits&&e.serverMaxWindowBits>t.server_max_window_bits)||"number"==typeof e.clientMaxWindowBits&&!t.client_max_window_bits)));if(!n)throw new Error("None of the extension offers can be accepted");return e.serverNoContextTakeover&&(n.server_no_context_takeover=!0),e.clientNoContextTakeover&&(n.client_no_context_takeover=!0),"number"==typeof e.serverMaxWindowBits&&(n.server_max_window_bits=e.serverMaxWindowBits),"number"==typeof e.clientMaxWindowBits?n.client_max_window_bits=e.clientMaxWindowBits:!0!==n.client_max_window_bits&&!1!==e.clientMaxWindowBits||delete n.client_max_window_bits,n}acceptAsClient(t){const e=t[0];if(!1===this._options.clientNoContextTakeover&&e.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(e.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&e.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(e.client_max_window_bits=this._options.clientMaxWindowBits);return e}normalizeParams(t){return t.forEach((t=>{Object.keys(t).forEach((e=>{let n=t[e];if(n.length>1)throw new Error(`Parameter "${e}" must have only a single value`);if(n=n[0],"client_max_window_bits"===e){if(!0!==n){const t=+n;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${e}": ${n}`);n=t}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${e}": ${n}`)}else if("server_max_window_bits"===e){const t=+n;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${e}": ${n}`);n=t}else{if("client_no_context_takeover"!==e&&"server_no_context_takeover"!==e)throw new Error(`Unknown parameter "${e}"`);if(!0!==n)throw new TypeError(`Invalid value for parameter "${e}": ${n}`)}t[e]=n}))})),t}decompress(t,e,n){Xo.add((r=>{this._decompress(t,e,((t,e)=>{r(),n(t,e)}))}))}compress(t,e,n){Xo.add((r=>{this._compress(t,e,((t,e)=>{r(),n(t,e)}))}))}_decompress(t,e,n){const r=this._isServer?"client":"server";if(!this._inflate){const t=`${r}_max_window_bits`,e="number"!=typeof this.params[t]?c.Z_DEFAULT_WINDOWBITS:this.params[t];this._inflate=c.createInflateRaw({...this._options.zlibInflateOptions,windowBits:e}),this._inflate[Vo]=this,this._inflate[Ho]=0,this._inflate[Yo]=[],this._inflate.on("error",ei),this._inflate.on("data",ti)}this._inflate[Jo]=n,this._inflate.write(t),e&&this._inflate.write(zo),this._inflate.flush((()=>{const t=this._inflate[Ko];if(t)return this._inflate.close(),this._inflate=null,void n(t);const o=Mo.concat(this._inflate[Yo],this._inflate[Ho]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ho]=0,this._inflate[Yo]=[],e&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),n(null,o)}))}_compress(t,e,n){const r=this._isServer?"server":"client";if(!this._deflate){const t=`${r}_max_window_bits`,e="number"!=typeof this.params[t]?c.Z_DEFAULT_WINDOWBITS:this.params[t];this._deflate=c.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:e}),this._deflate[Ho]=0,this._deflate[Yo]=[],this._deflate.on("data",Qo)}this._deflate[Jo]=n,this._deflate.write(t),this._deflate.flush(c.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let t=Mo.concat(this._deflate[Yo],this._deflate[Ho]);e&&(t=t.slice(0,t.length-4)),this._deflate[Jo]=null,this._deflate[Ho]=0,this._deflate[Yo]=[],e&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),n(null,t)}))}};function Qo(t){this[Yo].push(t),this[Ho]+=t.length}function ti(t){this[Ho]+=t.length,this[Vo]._maxPayload<1||this[Ho]<=this[Vo]._maxPayload?this[Yo].push(t):(this[Ko]=new RangeError("Max payload size exceeded"),this[Ko].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Ko][qo]=1009,this.removeListener("data",ti),this.reset())}function ei(t){this[Vo]._inflate=null,t[qo]=1007,this[Jo](t)}var ni=function(t){const e=t.length;let n=0;for(;n<e;)if(0==(128&t[n]))n++;else if(192==(224&t[n])){if(n+1===e||128!=(192&t[n+1])||192==(254&t[n]))return!1;n+=2}else if(224==(240&t[n])){if(n+2>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||224===t[n]&&128==(224&t[n+1])||237===t[n]&&160==(224&t[n+1]))return!1;n+=3}else{if(240!=(248&t[n]))return!1;if(n+3>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||128!=(192&t[n+3])||240===t[n]&&128==(240&t[n+1])||244===t[n]&&t[n+1]>143||t[n]>244)return!1;n+=4}return!0},ri=vo((function(t){try{t.exports=Oo(__dirname)}catch(e){t.exports=ni}})),oi=vo((function(t){const e=[0,0,0,0,0,0,0,0,0,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];function n(t){return t>=1e3&&t<=1014&&1004!==t&&1005!==t&&1006!==t||t>=3e3&&t<=4999}function r(t){const e=t.length;let n=0;for(;n<e;)if(0==(128&t[n]))n++;else if(192==(224&t[n])){if(n+1===e||128!=(192&t[n+1])||192==(254&t[n]))return!1;n+=2}else if(224==(240&t[n])){if(n+2>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||224===t[n]&&128==(224&t[n+1])||237===t[n]&&160==(224&t[n+1]))return!1;n+=3}else{if(240!=(248&t[n]))return!1;if(n+3>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||128!=(192&t[n+3])||240===t[n]&&128==(240&t[n+1])||244===t[n]&&t[n+1]>143||t[n]>244)return!1;n+=4}return!0}try{const o=ri;t.exports={isValidStatusCode:n,isValidUTF8:t=>t.length<150?r(t):o(t),tokenChars:e}}catch(o){t.exports={isValidStatusCode:n,isValidUTF8:r,tokenChars:e}}}));oi.isValidStatusCode,oi.isValidUTF8,oi.tokenChars;const{Writable:ii}=n,{BINARY_TYPES:si,EMPTY_BUFFER:ai,kStatusCode:ci,kWebSocket:ui}=mo,{concat:li,toArrayBuffer:di,unmask:pi}=Mo,{isValidStatusCode:fi,isValidUTF8:hi}=oi;var vi=class extends ii{constructor(t={}){super(),this._binaryType=t.binaryType||si[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=0|t.maxPayload,this._skipUTF8Validation=!!t.skipUTF8Validation,this[ui]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(t,e,n){if(8===this._opcode&&0==this._state)return n();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){const e=this._buffers[0];return this._buffers[0]=e.slice(t),e.slice(0,t)}const e=Buffer.allocUnsafe(t);do{const n=this._buffers[0],r=e.length-t;t>=n.length?e.set(this._buffers.shift(),r):(e.set(new Uint8Array(n.buffer,n.byteOffset,t),r),this._buffers[0]=n.slice(t)),t-=n.length}while(t>0);return e}startLoop(t){let e;this._loop=!0;do{switch(this._state){case 0:e=this.getInfo();break;case 1:e=this.getPayloadLength16();break;case 2:e=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:e=this.getData(t);break;default:return void(this._loop=!1)}}while(this._loop);t(e)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const t=this.consume(2);if(0!=(48&t[0]))return this._loop=!1,mi(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const e=64==(64&t[0]);if(e&&!this._extensions[Zo.extensionName])return this._loop=!1,mi(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&t[0]),this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(e)return this._loop=!1,mi(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,mi(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,mi(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=e}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,mi(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,mi(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(e)return this._loop=!1,mi(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,mi(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&t[1]),this._isServer){if(!this._masked)return this._loop=!1,mi(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,mi(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const t=this.consume(8),e=t.readUInt32BE(0);return e>Math.pow(2,21)-1?(this._loop=!1,mi(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=e*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,mi(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(t){let e=ai;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);e=this.consume(this._payloadLength),this._masked&&0!=(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])&&pi(e,this._mask)}return this._opcode>7?this.controlMessage(e):this._compressed?(this._state=5,void this.decompress(e,t)):(e.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(e)),this.dataMessage())}decompress(t,e){this._extensions[Zo.extensionName].decompress(t,this._fin,((t,n)=>{if(t)return e(t);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return e(mi(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(n)}const r=this.dataMessage();if(r)return e(r);this.startLoop(e)}))}dataMessage(){if(this._fin){const t=this._messageLength,e=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let n;n="nodebuffer"===this._binaryType?li(e,t):"arraybuffer"===this._binaryType?di(li(e,t)):e,this.emit("message",n,!0)}else{const n=li(e,t);if(!this._skipUTF8Validation&&!hi(n))return this._loop=!1,mi(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",n,!1)}}this._state=0}controlMessage(t){if(8===this._opcode)if(this._loop=!1,0===t.length)this.emit("conclude",1005,ai),this.end();else{if(1===t.length)return mi(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const e=t.readUInt16BE(0);if(!fi(e))return mi(RangeError,`invalid status code ${e}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const n=t.slice(2);if(!this._skipUTF8Validation&&!hi(n))return mi(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",e,n),this.end()}}else 9===this._opcode?this.emit("ping",t):this.emit("pong",t);this._state=0}};function mi(t,e,n,r,o){const i=new t(n?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(i,mi),i.code=o,i[ci]=r,i}const{randomFillSync:bi}=y,{EMPTY_BUFFER:yi}=mo,{isValidStatusCode:gi}=oi,{mask:wi,toBuffer:_i}=Mo,ji=Buffer.alloc(4);class Si{constructor(t,e,n){this._extensions=e||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(t,e){let n,r=!1,o=2,i=!1;e.mask&&(n=e.maskBuffer||ji,e.generateMask?e.generateMask(n):bi(n,0,4),i=0==(n[0]|n[1]|n[2]|n[3]),e.readOnly&&!i&&(r=!0),o=6);let s=t.length;t.length>=65536?(o+=8,s=127):t.length>125&&(o+=2,s=126);const a=Buffer.allocUnsafe(r?t.length+o:o);return a[0]=e.fin?128|e.opcode:e.opcode,e.rsv1&&(a[0]|=64),a[1]=s,126===s?a.writeUInt16BE(t.length,2):127===s&&(a[2]=a[3]=0,a.writeUIntBE(t.length,4,6)),e.mask?(a[1]|=128,a[o-4]=n[0],a[o-3]=n[1],a[o-2]=n[2],a[o-1]=n[3],i?[a,t]:r?(wi(t,n,a,o,t.length),[a]):(wi(t,n,t,0,t.length),[a,t])):[a,t]}close(t,e,n,r){let o;if(void 0===t)o=yi;else{if("number"!=typeof t||!gi(t))throw new TypeError("First argument must be a valid error code number");if(void 0!==e&&e.length){const n=Buffer.byteLength(e);if(n>123)throw new RangeError("The message must not be greater than 123 bytes");o=Buffer.allocUnsafe(2+n),o.writeUInt16BE(t,0),"string"==typeof e?o.write(e,2):o.set(e,2)}else o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0)}this._deflating?this.enqueue([this.doClose,o,n,r]):this.doClose(o,n,r)}doClose(t,e,n){this.sendFrame(Si.frame(t,{fin:!0,rsv1:!1,opcode:8,mask:e,maskBuffer:this._maskBuffer,generateMask:this._generateMask,readOnly:!1}),n)}ping(t,e,n){const r=_i(t);if(r.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPing,r,e,_i.readOnly,n]):this.doPing(r,e,_i.readOnly,n)}doPing(t,e,n,r){this.sendFrame(Si.frame(t,{fin:!0,rsv1:!1,opcode:9,mask:e,maskBuffer:this._maskBuffer,generateMask:this._generateMask,readOnly:n}),r)}pong(t,e,n){const r=_i(t);if(r.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPong,r,e,_i.readOnly,n]):this.doPong(r,e,_i.readOnly,n)}doPong(t,e,n,r){this.sendFrame(Si.frame(t,{fin:!0,rsv1:!1,opcode:10,mask:e,maskBuffer:this._maskBuffer,generateMask:this._generateMask,readOnly:n}),r)}send(t,e,n){const r=_i(t),o=this._extensions[Zo.extensionName];let i=e.binary?2:1,s=e.compress;if(this._firstFragment?(this._firstFragment=!1,s&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(s=r.length>=o._threshold),this._compress=s):(s=!1,i=0),e.fin&&(this._firstFragment=!0),o){const t={fin:e.fin,rsv1:s,opcode:i,mask:e.mask,maskBuffer:this._maskBuffer,generateMask:this._generateMask,readOnly:_i.readOnly};this._deflating?this.enqueue([this.dispatch,r,this._compress,t,n]):this.dispatch(r,this._compress,t,n)}else this.sendFrame(Si.frame(r,{fin:e.fin,rsv1:!1,opcode:i,mask:e.mask,maskBuffer:this._maskBuffer,generateMask:this._generateMask,readOnly:_i.readOnly}),n)}dispatch(t,e,n,r){if(!e)return void this.sendFrame(Si.frame(t,n),r);const o=this._extensions[Zo.extensionName];this._bufferedBytes+=t.length,this._deflating=!0,o.compress(t,n.fin,((e,o)=>{if(this._socket.destroyed){const t=new Error("The socket was closed while data was being compressed");"function"==typeof r&&r(t);for(let e=0;e<this._queue.length;e++){const n=this._queue[e][4];"function"==typeof n&&n(t)}}else this._bufferedBytes-=t.length,this._deflating=!1,n.readOnly=!1,this.sendFrame(Si.frame(o,n),r),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const t=this._queue.shift();this._bufferedBytes-=t[1].length,Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[1].length,this._queue.push(t)}sendFrame(t,e){2===t.length?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],e),this._socket.uncork()):this._socket.write(t[0],e)}}var xi=Si;const{kForOnEventAttribute:ki,kListener:Ii}=mo,Oi=Symbol("kCode"),Ei=Symbol("kData"),Ai=Symbol("kError"),Ci=Symbol("kMessage"),Pi=Symbol("kReason"),Ui=Symbol("kTarget"),Ti=Symbol("kType"),Ni=Symbol("kWasClean");class Li{constructor(t){this[Ui]=null,this[Ti]=t}get target(){return this[Ui]}get type(){return this[Ti]}}Object.defineProperty(Li.prototype,"target",{enumerable:!0}),Object.defineProperty(Li.prototype,"type",{enumerable:!0});class Ri extends Li{constructor(t,e={}){super(t),this[Oi]=void 0===e.code?0:e.code,this[Pi]=void 0===e.reason?"":e.reason,this[Ni]=void 0!==e.wasClean&&e.wasClean}get code(){return this[Oi]}get reason(){return this[Pi]}get wasClean(){return this[Ni]}}Object.defineProperty(Ri.prototype,"code",{enumerable:!0}),Object.defineProperty(Ri.prototype,"reason",{enumerable:!0}),Object.defineProperty(Ri.prototype,"wasClean",{enumerable:!0});class Bi extends Li{constructor(t,e={}){super(t),this[Ai]=void 0===e.error?null:e.error,this[Ci]=void 0===e.message?"":e.message}get error(){return this[Ai]}get message(){return this[Ci]}}Object.defineProperty(Bi.prototype,"error",{enumerable:!0}),Object.defineProperty(Bi.prototype,"message",{enumerable:!0});class Di extends Li{constructor(t,e={}){super(t),this[Ei]=void 0===e.data?null:e.data}get data(){return this[Ei]}}Object.defineProperty(Di.prototype,"data",{enumerable:!0});const Fi={addEventListener(t,e,n={}){let r;if("message"===t)r=function(t,n){const r=new Di("message",{data:n?t:t.toString()});r[Ui]=this,e.call(this,r)};else if("close"===t)r=function(t,n){const r=new Ri("close",{code:t,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[Ui]=this,e.call(this,r)};else if("error"===t)r=function(t){const n=new Bi("error",{error:t,message:t.message});n[Ui]=this,e.call(this,n)};else{if("open"!==t)return;r=function(){const t=new Li("open");t[Ui]=this,e.call(this,t)}}r[ki]=!!n[ki],r[Ii]=e,n.once?this.once(t,r):this.on(t,r)},removeEventListener(t,e){for(const n of this.listeners(t))if(n[Ii]===e&&!n[ki]){this.removeListener(t,n);break}}};var Mi={CloseEvent:Ri,ErrorEvent:Bi,Event:Li,EventTarget:Fi,MessageEvent:Di};const{tokenChars:Wi}=oi;function $i(t,e,n){void 0===t[e]?t[e]=[n]:t[e].push(n)}var Gi={format:function(t){return Object.keys(t).map((e=>{let n=t[e];return Array.isArray(n)||(n=[n]),n.map((t=>[e].concat(Object.keys(t).map((e=>{let n=t[e];return Array.isArray(n)||(n=[n]),n.map((t=>!0===t?e:`${e}=${t}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(t){const e=Object.create(null);let n,r,o=Object.create(null),i=!1,s=!1,a=!1,c=-1,u=-1,l=-1,d=0;for(;d<t.length;d++)if(u=t.charCodeAt(d),void 0===n)if(-1===l&&1===Wi[u])-1===c&&(c=d);else if(0===d||32!==u&&9!==u){if(59!==u&&44!==u)throw new SyntaxError(`Unexpected character at index ${d}`);{if(-1===c)throw new SyntaxError(`Unexpected character at index ${d}`);-1===l&&(l=d);const r=t.slice(c,l);44===u?($i(e,r,o),o=Object.create(null)):n=r,c=l=-1}}else-1===l&&-1!==c&&(l=d);else if(void 0===r)if(-1===l&&1===Wi[u])-1===c&&(c=d);else if(32===u||9===u)-1===l&&-1!==c&&(l=d);else if(59===u||44===u){if(-1===c)throw new SyntaxError(`Unexpected character at index ${d}`);-1===l&&(l=d),$i(o,t.slice(c,l),!0),44===u&&($i(e,n,o),o=Object.create(null),n=void 0),c=l=-1}else{if(61!==u||-1===c||-1!==l)throw new SyntaxError(`Unexpected character at index ${d}`);r=t.slice(c,d),c=l=-1}else if(s){if(1!==Wi[u])throw new SyntaxError(`Unexpected character at index ${d}`);-1===c?c=d:i||(i=!0),s=!1}else if(a)if(1===Wi[u])-1===c&&(c=d);else if(34===u&&-1!==c)a=!1,l=d;else{if(92!==u)throw new SyntaxError(`Unexpected character at index ${d}`);s=!0}else if(34===u&&61===t.charCodeAt(d-1))a=!0;else if(-1===l&&1===Wi[u])-1===c&&(c=d);else if(-1===c||32!==u&&9!==u){if(59!==u&&44!==u)throw new SyntaxError(`Unexpected character at index ${d}`);{if(-1===c)throw new SyntaxError(`Unexpected character at index ${d}`);-1===l&&(l=d);let s=t.slice(c,l);i&&(s=s.replace(/\\/g,""),i=!1),$i(o,r,s),44===u&&($i(e,n,o),o=Object.create(null),n=void 0),r=void 0,c=l=-1}}else-1===l&&(l=d);if(-1===c||a||32===u||9===u)throw new SyntaxError("Unexpected end of input");-1===l&&(l=d);const p=t.slice(c,l);return void 0===n?$i(e,p,o):(void 0===r?$i(o,p,!0):$i(o,r,i?p.replace(/\\/g,""):p),$i(e,n,o)),e}};const{randomBytes:qi,createHash:zi}=y,{URL:Vi}=i,{BINARY_TYPES:Hi,EMPTY_BUFFER:Ji,GUID:Yi,kForOnEventAttribute:Ki,kListener:Xi,kStatusCode:Zi,kWebSocket:Qi,NOOP:ts}=mo,{EventTarget:{addEventListener:es,removeEventListener:ns}}=Mi,{format:rs,parse:os}=Gi,{toBuffer:is}=Mo,ss=["CONNECTING","OPEN","CLOSING","CLOSED"],as=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,cs=[8,13];class us extends t{constructor(t,e,n){super(),this._binaryType=Hi[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Ji,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=us.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==t?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===e?e=[]:Array.isArray(e)||("object"==typeof e&&null!==e?(n=e,e=[]):e=[e]),ds(this,t,e,n)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(t){Hi.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,e,n){const r=new vi({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation});this._sender=new xi(t,this._extensions,n.generateMask),this._receiver=r,this._socket=t,r[Qi]=this,t[Qi]=this,r.on("conclude",bs),r.on("drain",ys),r.on("error",gs),r.on("message",_s),r.on("ping",js),r.on("pong",Ss),t.setTimeout(0),t.setNoDelay(),e.length>0&&t.unshift(e),t.on("close",ks),t.on("data",Is),t.on("end",Os),t.on("error",Es),this._readyState=us.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=us.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[Zo.extensionName]&&this._extensions[Zo.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=us.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,e){if(this.readyState!==us.CLOSED){if(this.readyState===us.CONNECTING){const t="WebSocket was closed before the connection was established";return vs(this,this._req,t)}this.readyState!==us.CLOSING?(this._readyState=us.CLOSING,this._sender.close(t,e,!this._isServer,(t=>{t||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}pause(){this.readyState!==us.CONNECTING&&this.readyState!==us.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,e,n){if(this.readyState===us.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(n=t,t=e=void 0):"function"==typeof e&&(n=e,e=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===us.OPEN?(void 0===e&&(e=!this._isServer),this._sender.ping(t||Ji,e,n)):ms(this,t,n)}pong(t,e,n){if(this.readyState===us.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(n=t,t=e=void 0):"function"==typeof e&&(n=e,e=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===us.OPEN?(void 0===e&&(e=!this._isServer),this._sender.pong(t||Ji,e,n)):ms(this,t,n)}resume(){this.readyState!==us.CONNECTING&&this.readyState!==us.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,e,n){if(this.readyState===us.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof e&&(n=e,e={}),"number"==typeof t&&(t=t.toString()),this.readyState!==us.OPEN)return void ms(this,t,n);const r={binary:"string"!=typeof t,mask:!this._isServer,compress:!0,fin:!0,...e};this._extensions[Zo.extensionName]||(r.compress=!1),this._sender.send(t||Ji,r,n)}terminate(){if(this.readyState!==us.CLOSED){if(this.readyState===us.CONNECTING){const t="WebSocket was closed before the connection was established";return vs(this,this._req,t)}this._socket&&(this._readyState=us.CLOSING,this._socket.destroy())}}}Object.defineProperty(us,"CONNECTING",{enumerable:!0,value:ss.indexOf("CONNECTING")}),Object.defineProperty(us.prototype,"CONNECTING",{enumerable:!0,value:ss.indexOf("CONNECTING")}),Object.defineProperty(us,"OPEN",{enumerable:!0,value:ss.indexOf("OPEN")}),Object.defineProperty(us.prototype,"OPEN",{enumerable:!0,value:ss.indexOf("OPEN")}),Object.defineProperty(us,"CLOSING",{enumerable:!0,value:ss.indexOf("CLOSING")}),Object.defineProperty(us.prototype,"CLOSING",{enumerable:!0,value:ss.indexOf("CLOSING")}),Object.defineProperty(us,"CLOSED",{enumerable:!0,value:ss.indexOf("CLOSED")}),Object.defineProperty(us.prototype,"CLOSED",{enumerable:!0,value:ss.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((t=>{Object.defineProperty(us.prototype,t,{enumerable:!0})})),["open","error","close","message"].forEach((t=>{Object.defineProperty(us.prototype,`on${t}`,{enumerable:!0,get(){for(const e of this.listeners(t))if(e[Ki])return e[Xi];return null},set(e){for(const e of this.listeners(t))if(e[Ki]){this.removeListener(t,e);break}"function"==typeof e&&this.addEventListener(t,e,{[Ki]:!0})}})})),us.prototype.addEventListener=es,us.prototype.removeEventListener=ns;var ls=us;function ds(t,e,n,r){const i={protocolVersion:cs[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,host:void 0,path:void 0,port:void 0};if(!cs.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${cs.join(", ")})`);let s;if(e instanceof Vi)s=e,t._url=e.href;else{try{s=new Vi(e)}catch(t){throw new SyntaxError(`Invalid URL: ${e}`)}t._url=e}const c="wss:"===s.protocol,u="ws+unix:"===s.protocol;let l;if("ws:"===s.protocol||c||u?u&&!s.pathname?l="The URL's pathname is empty":s.hash&&(l="The URL contains a fragment identifier"):l='The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"',l){const e=new SyntaxError(l);if(0===t._redirects)throw e;return void ps(t,e)}const d=c?443:80,p=qi(16).toString("base64"),f=c?a.get:o.get,h=new Set;let v;if(i.createConnection=c?hs:fs,i.defaultPort=i.defaultPort||d,i.port=s.port||d,i.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,i.headers={"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":p,Connection:"Upgrade",Upgrade:"websocket",...i.headers},i.path=s.pathname+s.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(v=new Zo(!0!==i.perMessageDeflate?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=rs({[Zo.extensionName]:v.offer()})),n.length){for(const t of n){if("string"!=typeof t||!as.test(t)||h.has(t))throw new SyntaxError("An invalid or duplicated subprotocol was specified");h.add(t)}i.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(s.username||s.password)&&(i.auth=`${s.username}:${s.password}`),u){const t=i.path.split(":");i.socketPath=t[0],i.path=t[1]}let m=t._req=f(i);i.timeout&&m.on("timeout",(()=>{vs(t,m,"Opening handshake has timed out")})),m.on("error",(e=>{null===m||m.aborted||(m=t._req=null,ps(t,e))})),m.on("response",(o=>{const s=o.headers.location,a=o.statusCode;if(s&&i.followRedirects&&a>=300&&a<400){if(++t._redirects>i.maxRedirects)return void vs(t,m,"Maximum redirects exceeded");let o;m.abort();try{o=new Vi(s,e)}catch(e){const n=new SyntaxError(`Invalid URL: ${s}`);return void ps(t,n)}ds(t,o,n,r)}else t.emit("unexpected-response",m,o)||vs(t,m,`Unexpected server response: ${o.statusCode}`)})),m.on("upgrade",((e,n,r)=>{if(t.emit("upgrade",e),t.readyState!==us.CONNECTING)return;m=t._req=null;const o=zi("sha1").update(p+Yi).digest("base64");if(e.headers["sec-websocket-accept"]!==o)return void vs(t,n,"Invalid Sec-WebSocket-Accept header");const s=e.headers["sec-websocket-protocol"];let a;if(void 0!==s?h.size?h.has(s)||(a="Server sent an invalid subprotocol"):a="Server sent a subprotocol but none was requested":h.size&&(a="Server sent no subprotocol"),a)return void vs(t,n,a);s&&(t._protocol=s);const c=e.headers["sec-websocket-extensions"];if(void 0!==c){if(!v){return void vs(t,n,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let e;try{e=os(c)}catch(e){return void vs(t,n,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(e);if(1!==r.length||r[0]!==Zo.extensionName){return void vs(t,n,"Server indicated an extension that was not requested")}try{v.accept(e[Zo.extensionName])}catch(e){return void vs(t,n,"Invalid Sec-WebSocket-Extensions header")}t._extensions[Zo.extensionName]=v}t.setSocket(n,r,{generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}))}function ps(t,e){t._readyState=us.CLOSING,t.emit("error",e),t.emitClose()}function fs(t){return t.path=t.socketPath,d.connect(t)}function hs(t){return t.path=void 0,t.servername||""===t.servername||(t.servername=d.isIP(t.host)?"":t.host),b.connect(t)}function vs(t,e,n){t._readyState=us.CLOSING;const r=new Error(n);Error.captureStackTrace(r,vs),e.setHeader?(e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),e.once("abort",t.emitClose.bind(t)),t.emit("error",r)):(e.destroy(r),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function ms(t,e,n){if(e){const n=is(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(n){n(new Error(`WebSocket is not open: readyState ${t.readyState} (${ss[t.readyState]})`))}}function bs(t,e){const n=this[Qi];n._closeFrameReceived=!0,n._closeMessage=e,n._closeCode=t,void 0!==n._socket[Qi]&&(n._socket.removeListener("data",Is),process.nextTick(xs,n._socket),1005===t?n.close():n.close(t,e))}function ys(){const t=this[Qi];t.isPaused||t._socket.resume()}function gs(t){const e=this[Qi];void 0!==e._socket[Qi]&&(e._socket.removeListener("data",Is),process.nextTick(xs,e._socket),e.close(t[Zi])),e.emit("error",t)}function ws(){this[Qi].emitClose()}function _s(t,e){this[Qi].emit("message",t,e)}function js(t){const e=this[Qi];e.pong(t,!e._isServer,ts),e.emit("ping",t)}function Ss(t){this[Qi].emit("pong",t)}function xs(t){t.resume()}function ks(){const t=this[Qi];let e;this.removeListener("close",ks),this.removeListener("data",Is),this.removeListener("end",Os),t._readyState=us.CLOSING,this._readableState.endEmitted||t._closeFrameReceived||t._receiver._writableState.errorEmitted||null===(e=t._socket.read())||t._receiver.write(e),t._receiver.end(),this[Qi]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",ws),t._receiver.on("finish",ws))}function Is(t){this[Qi]._receiver.write(t)||this.pause()}function Os(){const t=this[Qi];t._readyState=us.CLOSING,t._receiver.end(),this.end()}function Es(){const t=this[Qi];this.removeListener("error",Es),this.on("error",ts),t&&(t._readyState=us.CLOSING,this.destroy())}var As=function(t){function e(e,n,r,o,i){void 0===i&&(i=5e3);var s=t.call(this)||this;s.endpoint=e,s.headers=n,s.rewriteHostHeader=r,s.bindToAssign=o,s.closeTimeout=i,s.protocol="TCP",s.openConnections=new Set,s.tcpServer=l.createServer(s.handleConnection.bind(s));var a=null==r?void 0:r.altHostnames.map((function(t){return(e=we(e=t))&&Un.test(e)?e.replace(Pn,"\\$&"):e;var e})).join("|");return s.hostRegex=new RegExp("Host: (?:".concat(a,")(:.*$|$)"),"im"),s}return _(e,t),Object.defineProperty(e.prototype,"bindTo",{get:function(){var t;return null!==(t=this.boundTo)&&void 0!==t?t:this.bindToAssign},enumerable:!1,configurable:!0}),e.prototype.open=function(){return S(this,void 0,void 0,(function(){var t=this;return x(this,(function(e){return[2,new Promise((function(e){if(t.bindToAssign){var n=t.bindToAssign,r=n.port,o=n.address;t.tcpServer.listen(r,o,(function(){t.emit("tunnel-open",{address:o,port:r}),e({address:o,port:r})}))}else t.tcpServer.listen(0,(function(){var n=t.tcpServer.address(),r=n.address,o=n.port,i="0.0.0.0"===r||"::"===r?"127.0.0.1":r;t.boundTo={address:i,port:o},t.emit("tunnel-open",t.boundTo),e(t.boundTo)}))}))]}))}))},e.prototype.close=function(){return S(this,void 0,void 0,(function(){var t,e=this;return x(this,(function(n){switch(n.label){case 0:return t=!1,[4,Promise.race([new Promise((function(n){e.tcpServer.close((function(){t=!0,e.emit("tunnel-close"),n()}))})),new Promise((function(n){new Promise((function(t){return setTimeout(t,e.closeTimeout)})).then((function(){t||(e.openConnections.forEach((function(t){t.destroy(),e.openConnections.delete(t)})),n())}))}))])];case 1:return n.sent(),[2]}}))}))},e.prototype.handleConnection=function(t){var e=this;this.openConnections.add(t);var n=new ls(this.endpoint.replace("https:","wss:"),{headers:this.headers}),r=ho(n),o=this.getHeaderTransform();this.rewriteHostHeader&&o?co(t,o,r):co(t,r),co(r,t),n.on("close",(function(t,n,r){e.emit("connection-close",t,n,r)})),r.on("error",(function(t){e.emit("connection-error",t)})),t.on("error",(function(t){e.emit("connection-error",t)})),this.emit("connection-accept")},e.prototype.getHeaderTransform=function(){if(this.rewriteHostHeader){var t=this.rewriteHostHeader.targetHostname,e=this.hostRegex;return new r({transform:function(n,r,o){var i=n.toString();if(i.split("\n",1)[0].includes("HTTP")){var s=i.replace(e,"Host: ".concat(t));o(null,Buffer.from(s))}else o(null,n)}})}},e}(e),Cs=function(t){function e(e,n,r){var o=t.call(this)||this;return o.endpoint=e,o.headers=n,o.bindToAssign=r,o.protocol="UDP",o.udpSocket=g.createSocket("udp4"),o.handleConnection(),o}return _(e,t),Object.defineProperty(e.prototype,"bindTo",{get:function(){return this.boundTo},enumerable:!1,configurable:!0}),e.prototype.open=function(){return S(this,void 0,void 0,(function(){var t=this;return x(this,(function(e){return[2,new Promise((function(e){if(t.bindToAssign){var n=t.bindToAssign,r=n.port,o=n.address;t.udpSocket.bind(r,o,(function(){t.emit("tunnel-open",{address:o,port:r}),e({address:o,port:r})}))}else t.udpSocket.bind(0,(function(){var n=t.udpSocket.address(),r=n.address,o=n.port,i="0.0.0.0"===r||"::"===r?"127.0.0.1":r;t.boundTo={address:i,port:o},t.emit("tunnel-open",t.boundTo),e(t.boundTo)}))}))]}))}))},e.prototype.close=function(){return S(this,void 0,void 0,(function(){var t=this;return x(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){t.udpSocket.close((function(){t.emit("tunnel-close"),e()}))}))];case 1:return e.sent(),[2]}}))}))},e.prototype.handleConnection=function(){var t,e=this,n=new ls(this.endpoint.replace("https:","wss:"),{headers:this.headers}),r=ho(n);this.udpSocket.on("message",(function(e,n){t=n,r.write(e)})),r.on("data",(function(n){t&&e.udpSocket.send(n,t.port,t.address,(function(t){t&&e.emit("connection-error",t)}))})),this.udpSocket.on("error",(function(t){e.emit("connection-error",t)})),r.on("error",(function(t){e.emit("connection-error",t)})),n.on("connection-close",(function(t,n,r){e.emit("connection-close",t,n,r)})),n.on("connection-error",(function(t){e.emit("connection-error",t)})),this.emit("connection-accept")},e}(e);var Ps="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,Us=function(t,e){return S(void 0,void 0,void 0,(function(){var n;return x(this,(function(r){return n=Promise.resolve([]),[2,t.reduce((function(t,n){return t.then((function(t){return e(n).then((function(e){return t.push(e),t}))}))}),n)]}))}))},Ts=function(t){function e(e,n,r){var o=t.call(this)||this;return o.contextProvider=e,o.listServices=n,o.listAddons=r,o.connections=[],o.hostsFileMutex=new Hr,o.ipAllocationMutex=new Hr,o.stopForwarding=function(t){return S(o,void 0,void 0,(function(){var e,n,r,o,i,s;return x(this,(function(a){switch(a.label){case 0:return[4,t.tunnel.close()];case 1:return a.sent(),e=t.forwardingContext,n=e.projectId,r=e.type,o=e.id,(i=e.hostnames).length>0?[4,this.unregisterHostnames(null===(s=t.tunnel.bindTo)||void 0===s?void 0:s.address,i)]:[3,3];case 2:a.sent(),a.label=3;case 3:return this.connections.splice(this.connections.findIndex((function(t){var e=t.forwardingContext,i=e.type,s=e.id,a=e.projectId;return s===o&&a===n&&i===r})),1),[2]}}))}))},o.canExecuteWithHostnames=function(){return"win32"!==process.platform?process.getuid&&0!==process.getuid()?{error:!0,message:"You are not running this command with sufficient privileges (uid=".concat(process.getuid(),"). Try running with 'sudo'.")}:{error:!1,type:"unix-admin"}:function(){try{return h("fsutil dirty query %systemdrive%"),!0}catch(t){if("ENOENT"===t.code)try{return h("fltmc"),!0}catch(t){return!1}return!1}}()?{error:!1,type:"windows-admin"}:{error:!0,message:"You are not running this command as administrator. Please start command line with admin rights."}},o.assertStartedWithNodejs=function(){if(!Ps)throw new Error("Port forwarding only possible when started with nodejs")},o.proxyApiClient=new Ir(e),o}return _(e,t),e.prototype.withProjectForwarding=function(t,e,n){return void 0===n&&(n=!0),S(this,void 0,void 0,(function(){var r;return x(this,(function(o){switch(o.label){case 0:return[4,this.forwardProject(t,n)];case 1:r=o.sent(),o.label=2;case 2:return o.trys.push([2,,4,6]),[4,e(r)];case 3:return[2,o.sent()];case 4:return[4,this.stopProjectForwarding(t)];case 5:return o.sent(),[7];case 6:return[2]}}))}))},e.prototype.forwardProject=function(t,e){return void 0===e&&(e=!0),S(this,void 0,void 0,(function(){var n,r,o,i,s,a=this;return x(this,(function(c){switch(c.label){case 0:return this.assertStartedWithNodejs(),n=t.projectId,[4,this.listServices({parameters:{projectId:n}})];case 1:return r=c.sent(),[4,this.listAddons({parameters:{projectId:n}})];case 2:return o=c.sent(),[4,Promise.all(r.data.services.map((function(t){return S(a,void 0,void 0,(function(){return x(this,(function(r){return[2,this.forwardService({projectId:n,serviceId:t.id},e)]}))}))})))];case 3:return i=c.sent(),[4,Promise.all(o.data.addons.map((function(t){return S(a,void 0,void 0,(function(){return x(this,(function(r){switch(r.label){case 0:return[4,this.forwardAddon({projectId:n,addonId:t.id},e)];case 1:return[2,r.sent()]}}))}))})))];case 4:return s=c.sent(),[2,{services:i,addons:s}]}}))}))},e.prototype.withServiceForwarding=function(t,e,n){return void 0===n&&(n=!0),S(this,void 0,void 0,(function(){var r;return x(this,(function(o){switch(o.label){case 0:return[4,this.forwardService(t,n)];case 1:r=o.sent(),o.label=2;case 2:return o.trys.push([2,,4,6]),[4,e(r)];case 3:return[2,o.sent()];case 4:return[4,this.stopServiceForwarding(t)];case 5:return o.sent(),[7];case 6:return[2]}}))}))},e.prototype.forwardService=function(t,e){return void 0===e&&(e=!0),S(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,u=this;return x(this,(function(l){switch(l.label){case 0:return this.assertStartedWithNodejs(),n=t.projectId,r=t.serviceId,[4,this.proxyApiClient.getServiceDetails(n,r)];case 1:return o=l.sent(),i=o.namespace,s=o.targetDomain,a=o.instances,c=o.ports,0===a.length?[2,[]]:[4,Us(c,(function(t){var o,c="https://".concat(s,"/tunnel/projects/").concat(n,"/services/").concat(r,"/instance/").concat(a[0].podName,"/port/").concat(t.internalPort),l="".concat(r,".").concat(i,".svc.cluster.local"),d=["".concat(r)];t.name&&d.push("".concat(t.name,".").concat(r)),"HTTP"===t.protocol&&(o={altHostnames:d,targetHostname:l});var p=e?[]:k([l],d,!0);return u.forwardPort(c,t,p,"service",r,n,e,o)}))];case 2:return[2,l.sent()]}}))}))},e.prototype.withAddonForwarding=function(t,e,n){return void 0===n&&(n=!0),S(this,void 0,void 0,(function(){var r;return x(this,(function(o){switch(o.label){case 0:return[4,this.forwardAddon(t,n)];case 1:r=o.sent(),o.label=2;case 2:return o.trys.push([2,,4,6]),[4,e(r)];case 3:return[2,o.sent()];case 4:return[4,this.stopAddonForwarding(t)];case 5:return o.sent(),[7];case 6:return[2]}}))}))},e.prototype.forwardAddon=function(t,e){return void 0===e&&(e=!0),S(this,void 0,void 0,(function(){var n,r,o,i,s=this;return x(this,(function(a){switch(a.label){case 0:return this.assertStartedWithNodejs(),n=t.addonId,r=t.projectId,[4,this.proxyApiClient.getAddonDetails(r,n)];case 1:return o=a.sent(),i=o.instances.map((function(t){var e=t.podName,n=t.internalHostname;return t.ports.map((function(t){return{podName:e,internalHostname:n,port:t}}))})),[4,Us((c=i,null!=c&&c.length?Oe(c,1/0):[]),(function(t){var i=t.podName,a=t.internalHostname,c=t.port;return S(s,void 0,void 0,(function(){var t;return x(this,(function(s){return t="https://".concat(o.targetDomain,"/tunnel/projects/").concat(r,"/addons/").concat(n,"/instance/").concat(i,"/port/").concat(c.internalPort),[2,this.forwardPort(t,c,e?[]:[a],"addon",n,r,e)]}))}))}))];case 2:return[2,a.sent()]}var c}))}))},e.prototype.allocateIpAddress=function(t){return S(this,void 0,void 0,(function(){var e=this;return x(this,(function(n){return[2,this.ipAllocationMutex.enter((function(){return S(e,void 0,void 0,(function(){var e,n,r,o,i;return x(this,(function(s){switch(s.label){case 0:return e="127.24.1.1",n="127.24.255.255",r=null!==(i=this.nextIpAddress)&&void 0!==i?i:e,[4,Or(t,r,n)];case 1:return o=s.sent(),this.nextIpAddress=Pr(Cr(o)+1),Cr(this.nextIpAddress)>Cr(n)&&(this.nextIpAddress=e),[2,o]}}))}))}))]}))}))},e.prototype.forwardPort=function(t,e,n,r,o,i,s,a){var c;return void 0===s&&(s=!0),S(this,void 0,void 0,(function(){var u,l,d,p,f,h,v=this;return x(this,(function(m){switch(m.label){case 0:if(u={Authorization:"Bearer ".concat(this.contextProvider.getCurrentToken())},!s&&(l=this.canExecuteWithHostnames()).error)throw new Error("".concat(l.message," Alternatively, you can use the ipOnly mode when port-forwarding (apiClient.forwarding.forwardAddon({ projectId, addonId }, true))"));return[4,this.determineSocketAddress(i,o,r,e,s)];case 1:return d=m.sent(),p="UDP"===e.protocol?new Cs(t,u,d):new As(t,u,a,d),s?[3,3]:[4,this.registerHostnames(null===(c=p.bindTo)||void 0===c?void 0:c.address,n)];case 2:m.sent(),m.label=3;case 3:return p.on("connection-accept",(function(){return v.emit("connection-accept",p)})),p.on("connection-close",(function(){return S(v,void 0,void 0,(function(){return x(this,(function(t){return[2,this.emit("connection-close",p)]}))}))})),[4,p.open()];case 4:return f=m.sent(),h={projectId:i,id:o,type:r,hostnames:n,port:f.port,address:f.address,protocol:e.protocol,portName:e.name},this.emit("tunnel-open",p,h),p.on("connection-error",(function(t){return v.emit("connection-error",p,h,t)})),p.on("tunnel-close",(function(){return v.emit("tunnel-close",p,h)})),this.connections.push({tunnel:p,forwardingContext:h}),[2,{data:h}]}}))}))},e.prototype.determineSocketAddress=function(t,e,n,r,o){var i;return S(this,void 0,void 0,(function(){var s,a,c;return x(this,(function(u){switch(u.label){case 0:return o?[2,void 0]:(s=this.connections.find((function(r){return r.forwardingContext.projectId===t&&r.forwardingContext.id===e&&r.forwardingContext.type===n})),a=(null===(i=null==s?void 0:s.forwardingContext)||void 0===i?void 0:i.port)!==r.internalPort,s&&a?[2,{address:s.forwardingContext.address,port:r.internalPort}]:(c={},[4,this.allocateIpAddress(r.internalPort)]));case 1:return[2,(c.address=u.sent(),c.port=r.internalPort,c)]}}))}))},e.prototype.registerHostnames=function(t,e){return S(this,void 0,void 0,(function(){return x(this,(function(n){switch(n.label){case 0:return[4,this.modifyHostsFile((function(n){n.removeHosts.apply(n,e),n.add.apply(n,k([t],e,!1))}))];case 1:return n.sent(),[2]}}))}))},e.prototype.unregisterHostnames=function(t,e){return S(this,void 0,void 0,(function(){return x(this,(function(n){switch(n.label){case 0:return[4,this.modifyHostsFile((function(n){n.remove.apply(n,k([t],e,!1))}))];case 1:return n.sent(),[2]}}))}))},e.prototype.modifyHostsFile=function(t){return S(this,void 0,void 0,(function(){var e=this;return x(this,(function(n){switch(n.label){case 0:return[4,this.hostsFileMutex.enter((function(){return S(e,void 0,void 0,(function(){var e,n=this;return x(this,(function(r){switch(r.label){case 0:return[4,Vr.load({header:"Northflank Proxy"})];case 1:return e=r.sent(),t(e),[4,e.backup({suffix:".backup-pre-northflank"})];case 2:r.sent(),r.label=3;case 3:return r.trys.push([3,5,,7]),[4,Ns(5)((function(){return S(n,void 0,void 0,(function(){return x(this,(function(t){switch(t.label){case 0:return[4,e.write({writeMode:"atomic"})];case 1:return t.sent(),[2]}}))}))}))];case 4:return r.sent(),[3,7];case 5:return r.sent(),[4,Ns(5)((function(){return S(n,void 0,void 0,(function(){return x(this,(function(t){switch(t.label){case 0:return[4,e.write({writeMode:"standard"})];case 1:return t.sent(),[2]}}))}))}))];case 6:return r.sent(),[3,7];case 7:return[2]}}))}))}))];case 1:return n.sent(),[2]}}))}))},e.prototype.stopProjectForwarding=function(t){return S(this,void 0,void 0,(function(){var e=this;return x(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter((function(e){return e.forwardingContext.projectId===t.projectId})).map((function(t){return e.stopForwarding(t)})))];case 1:return n.sent(),[2]}}))}))},e.prototype.stopServiceForwarding=function(t){return S(this,void 0,void 0,(function(){var e=this;return x(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter((function(e){return"service"===e.forwardingContext.type&&e.forwardingContext.projectId===t.projectId&&e.forwardingContext.id===t.serviceId})).map((function(t){return e.stopForwarding(t)})))];case 1:return n.sent(),[2]}}))}))},e.prototype.stopAddonForwarding=function(t){return S(this,void 0,void 0,(function(){var e=this;return x(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter((function(e){return"addon"===e.forwardingContext.type&&e.forwardingContext.projectId===t.projectId&&e.forwardingContext.id===t.addonId})).map((function(t){return e.stopForwarding(t)})))];case 1:return n.sent(),[2]}}))}))},e.prototype.stop=function(){return S(this,void 0,void 0,(function(){var t=this;return x(this,(function(e){switch(e.label){case 0:return[4,Promise.all(this.connections.map((function(e){return S(t,void 0,void 0,(function(){return x(this,(function(t){return[2,this.stopForwarding(e)]}))}))})))];case 1:return e.sent(),[2]}}))}))},e}(e),Ns=function(t,e){return void 0===e&&(e=50),function(n){var r=t,o=function(){return S(void 0,void 0,void 0,(function(){var t;return x(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,4]),[4,n()];case 1:return[2,i.sent()];case 2:if(t=i.sent(),r<=0)throw t;return r-=1,[4,new Promise((function(t){return setTimeout((function(){return t()}),e)}))];case 3:return i.sent(),[2,o()];case 4:return[2]}}))}))};return o()}},Ls=Ps?kr:window.fetch,Rs=function(){if(Ps)try{return JSON.parse(v.readFileSync(m.join(m.dirname(s(import.meta.url)),"../../package.json")).toString())}catch(t){return console.log("Failed to check version of northflank CLI (".concat(t.message,")")),{}}return{}},Bs=function(){function t(t,e){var n=this;this.opts=e,this.call=function(t){return S(n,void 0,void 0,(function(){var e,n,r,o,i,s,a,c,u,l,d,p,f=this;return x(this,(function(h){switch(h.label){case 0:if(e=this.method,n={method:e,headers:this.getDefaultHeaders()},!(r=null===(p=this.contextProvider)||void 0===p?void 0:p.getCurrentBaseUrl()))throw new Error("Api client context not correctly initialized, please provide a url to the context.");return o="".concat(r).concat(this.endpointUrl(t)),i=this.body(t),s=j(j({url:o},n),{body:i}),[4,Ws(o,j(j({},n),{body:i}))];case 1:return[4,(a=h.sent()).text()];case 2:return c=h.sent(),u=function(){if(200!==a.status){var t=null==l?void 0:l.error,e=401===a.status?" (Make sure your API token has sufficient permissions)":"",n="".concat((null==t?void 0:t.message)||"").concat(e);if(f.opts.throwErrorOnHttpErrorCode)throw Error(n);return{status:a.status,message:n,id:null==t?void 0:t.id,details:null==t?void 0:t.details}}},l=function(){try{return JSON.parse(c)}catch(t){throw Error("Failed reading api request result: \n\tStatus: ".concat(a.statusText," (").concat(a.status,")\n\tMessage: ").concat(c))}}(),d=u(),[2,{data:null==l?void 0:l.data,rawResponse:a,request:s,error:d,pagination:null==l?void 0:l.pagination}]}}))}))},this.contextProvider=t}return t.prototype.getDefaultHeaders=function(){var t,e,n=this.contextProvider.getCurrentToken(),r=(null===(t=this.opts)||void 0===t?void 0:t.customUserAgent)?" (".concat(this.opts.customUserAgent,")"):"";return{Authorization:this.withAuth?"Bearer ".concat(n):void 0,"Content-Type":"application/json","User-Agent":"northflank-js-client/".concat(null===(e=Rs())||void 0===e?void 0:e.version).concat(r)}},t}(),Ds=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.method="get",e.body=function(){},e}return _(e,t),e}(Bs),Fs=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.method="post",e}return _(e,t),e}(Bs),Ms=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.method="delete",e.body=function(){},e}return _(e,t),e}(Bs),Ws=function(t,e,n,r){return void 0===e&&(e={}),void 0===n&&(n=3),void 0===r&&(r=500),new Promise((function(o,i){var s=function(n){return Ls(t,e).then((function(t){o(t)})).catch((function(t){return S(void 0,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return n>0?[4,(o=r,new Promise((function(t){setTimeout((function(){t()}),o)})))]:[3,2];case 1:return e.sent(),[2,s(n-1)];case 2:return[2,i(t)]}var o}))}))}))};return s(n)}))},$s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists projects for the authenticated user or team.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects".concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),Gs=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new project.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects"},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),qs=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get information about the given project",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId)},e.body=function(){},e}return _(e,t),e}(Ds),zs=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Delete the given project. Fails if the project isn't empty.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId)},e.body=function(){},e}return _(e,t),e}(Ms),Vs=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of addons belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/addons").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),Hs=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new addon",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Js=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the given addon",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return _(e,t),e}(Ds),Ys=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return _(e,t),e}(Ms),Ks=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns the credentials for connecting to the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/credentials")},e.body=function(){},e}return _(e,t),e}(Ds),Xs=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the available addon types",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/addon-types"},e.body=function(){},e}return _(e,t),e}(Ds),Zs=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Modifies the allocated resources for the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/scale")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Qs=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about the current addon version including available upgrades and upgrade history.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/version")},e.body=function(){},e}return _(e,t),e}(Ds),ta=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Upgrades the addon to a new version.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/version")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),ea=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the network settings for the addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/network-settings")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),na=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the security rules for the addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/security")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),ra=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns a list of backups for the given addon.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),oa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Initiates a backup for the given addon",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),ia=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about a given backup including restore history",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId)},e.body=function(){},e}return _(e,t),e}(Ds),sa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes a given backup",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId)},e.body=function(){},e}return _(e,t),e}(Ms),aa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Restores the given addon to the given backup state.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/restore")},e.body=function(){},e}return _(e,t),e}(Fs),ca=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Imports a database from an external archive or existing live database.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/import")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),ua=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of containers for the given addon.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/containers").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),la=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Pause the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/pause")},e.body=function(){},e}return _(e,t),e}(Fs),da=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Resume the given addon if it is paused.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/resume")},e.body=function(){},e}return _(e,t),e}(Fs),pa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Restart the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/restart")},e.body=function(){},e}return _(e,t),e}(Fs),fa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the in progress backup.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/abort")},e.body=function(){},e}return _(e,t),e}(Fs),ha=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Generates a temporary download link for downloading the given backup.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/download-link")},e.body=function(){},e}return _(e,t),e}(Ds),va=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts an in-progress backup restore.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/abort-restore")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),ma=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of jobs belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),ba=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the given job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId)},e.body=function(){},e}return _(e,t),e}(Ds),ya=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId)},e.body=function(){},e}return _(e,t),e}(Ms),ga=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new manual job that only runs when initiated via the UI, CLI, API or JS client.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/manual")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),wa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new cron job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/cron")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),_a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Fetches run history for the given job",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),ja=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Starts a new job run for the given job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Sa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns data about the given job run",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs/").concat(t.parameters.runId)},e.body=function(){},e}return _(e,t),e}(Ds),xa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the given job run",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs/").concat(t.parameters.runId)},e.body=function(){},e}return _(e,t),e}(Ms),ka=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates settings for the job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/settings")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Ia=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the health checks for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/health-checks")},e.body=function(){},e}return _(e,t),e}(Ds),Oa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates health checks for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/health-checks")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Ea=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists builds for the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),Aa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Start a new build for the given job. Given a commit sha, it will build that commit.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Ca=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the given job build",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build/").concat(t.parameters.buildId)},e.body=function(){},e}return _(e,t),e}(Ms),Pa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the build options for a given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-options")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Ua=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the Docker CMD override for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/cmd-override")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Ta=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets the build arguments of the given job. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-arguments").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),Na=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets build arguments for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-arguments")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),La=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the build arguments accessible by the given service. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-arguments/details")},e.body=function(){},e}return _(e,t),e}(Ds),Ra=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns the environment variables for the given job. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/environment").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),Ba=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the environment variables for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/environment")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Da=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the environment variables accessible by the given job. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/environment/details")},e.body=function(){},e}return _(e,t),e}(Ds),Fa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the deployment of the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/deployment")},e.body=function(){},e}return _(e,t),e}(Ds),Ma=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the deployment settings of the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/deployment")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Wa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of containers for the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/containers").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),$a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the branches of the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/branches").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),Ga=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the pull-requests of the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/pull-requests").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),qa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the container registry credentials saved to this account. Does not display secrets.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/registry-credentials".concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),za=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Adds a new set of container registry credentials to this account.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials"},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Va=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Views a set of registry credential data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials/".concat(t.parameters.credentialId)},e.body=function(){},e}return _(e,t),e}(Ds),Ha=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes a set of registry credential data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials/".concat(t.parameters.credentialId)},e.body=function(){},e}return _(e,t),e}(Ms),Ja=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates a set of registry credential data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials/".concat(t.parameters.credentialId,"/modify")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Ya=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists available domains",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/domains".concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),Ka=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Registers a new domain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains"},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Xa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about domain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain)},e.body=function(){},e}return _(e,t),e}(Ds),Za=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes a domain and each of its registered subdomains.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain)},e.body=function(){},e}return _(e,t),e}(Ms),Qa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Attempts to verify the domain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/verify")},e.body=function(){},e}return _(e,t),e}(Fs),tc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Adds a new subdomain to the domain.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),ec=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about the given subdomain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain)},e.body=function(){},e}return _(e,t),e}(Ds),nc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Removes a subdomain from a domain.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain)},e.body=function(){},e}return _(e,t),e}(Ms),rc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about the given subdomain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain,"/verify")},e.body=function(){},e}return _(e,t),e}(Fs),oc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Assigns a service port to the given subdomain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain,"/assign")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),ic=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Removes a subdomain from its assigned service",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain,"/assign")},e.body=function(){},e}return _(e,t),e}(Ms),sc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists available billing plans",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/plans"},e.body=function(){},e}return _(e,t),e}(Ds),ac=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists available project regions",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/regions"},e.body=function(){},e}return _(e,t),e}(Ds),cc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns the partially random string used when generating host names for the authenticated account.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/dns-id"},e.body=function(){},e}return _(e,t),e}(Ds),uc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists linked version control providers",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/vcs"},e.body=function(){},e}return _(e,t),e}(Ds),lc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of secrets belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/secrets").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),dc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a secret with the specified payload",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),pc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="View a secret including its contents",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId).concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),fc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Delete a secret",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId)},e.body=function(){},e}return _(e,t),e}(Ms),hc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Update a secret",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId)},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),vc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="View a secret with details about its linked addons",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/details")},e.body=function(){},e}return _(e,t),e}(Ds),mc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Link an addon to the secret group or edit the settings of the linked addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/addons/").concat(t.parameters.addonId)},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),bc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about a given addon link.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return _(e,t),e}(Ds),yc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Unlinks an addon from the secret group.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return _(e,t),e}(Ms),gc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of services belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),wc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new combined service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/combined")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),_c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new deployment service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/deployment")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),jc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new build service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/build")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Sc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId)},e.body=function(){},e}return _(e,t),e}(Ds),xc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId)},e.body=function(){},e}return _(e,t),e}(Ms),kc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Modifies the scaling settings for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/scale")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Ic=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the deployment of the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/deployment")},e.body=function(){},e}return _(e,t),e}(Ds),Oc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the deployment settings of the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/deployment")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Ec=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Restarts the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/restart")},e.body=function(){},e}return _(e,t),e}(Fs),Ac=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Pause the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/pause")},e.body=function(){},e}return _(e,t),e}(Fs),Cc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Resumes the given service. Optionally takes `instances` to resume with a given number of instances.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/resume")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Pc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the ports for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/ports")},e.body=function(){},e}return _(e,t),e}(Ds),Uc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the list of ports for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/ports")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Tc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the build options for a given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-options")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Nc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the Docker CMD override for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/cmd-override")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Lc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the health checks for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/health-checks")},e.body=function(){},e}return _(e,t),e}(Ds),Rc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates health checks for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/health-checks")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Bc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the builds for the service",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),Dc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Start a new build for the given combined or build service. If given a commit sha, it will build that commit. Otherwise, the most recent relevant commit will be built. If the service provided is a build service, a branch name or pull request to build from is required.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Fc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the given service build",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build/").concat(t.parameters.buildId)},e.body=function(){},e}return _(e,t),e}(Ms),Mc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of containers for the given service.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/containers").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),Wc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the branches of the given service.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/branches").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),$c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the pull-requests of the given service.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/pull-requests").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),Gc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of repositories accessible to this account",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/vcs/repos".concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),qc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of branches for the repo",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/vcs/repos/".concat(t.parameters.vcsService,"/").concat(t.parameters.repositoryOwner,"/").concat(t.parameters.repositoryName,"/branches").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),zc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of volumes belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes")},e.body=function(){},e}return _(e,t),e}(Ds),Vc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a volume with the specified payload",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Hc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Retrieve a volume",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId)},e.body=function(){},e}return _(e,t),e}(Ds),Jc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Update volume mounts and storage size",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId)},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Yc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes this volume and its associated data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId)},e.body=function(){},e}return _(e,t),e}(Ms),Kc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Attach a volume",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId,"/attach")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Xc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Detach a volume",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId,"/detach")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),Zc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets the build arguments of the given service. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-arguments").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),Qc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the build arguments for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-arguments")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),tu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the build arguments accessible by the given service. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-arguments/details")},e.body=function(){},e}return _(e,t),e}(Ds),eu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets the environment variables of the given service. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/environment").concat(r)},e.body=function(){},e}return _(e,t),e}(Ds),nu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the environment variables for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/environment")},e.body=function(t){return JSON.stringify(t.data)},e}return _(e,t),e}(Fs),ru=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the environment variables accessible by the given service. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/environment/details")},e.body=function(){},e}return _(e,t),e}(Ds),ou=function(){function t(){this.loadContext()}return t.prototype.loadContext=function(){this.contextWrapper=this.loadContextWrapper()},t.prototype.getInfo=function(){return""},t.prototype.storeContext=function(t){return S(this,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return[4,this.writeContext(t)];case 1:return e.sent(),this.contextWrapper=t,[2]}}))}))},t.prototype.addContext=function(t,e){return void 0===e&&(e=!0),S(this,void 0,void 0,(function(){var n,r,o;return x(this,(function(i){switch(i.label){case 0:if(e||void 0===this.findContext(t.name))return[3,1];throw new Error("Context with name ".concat(t.name," already exists"));case 1:return[4,this.removeContext(t.name)];case 2:i.sent(),i.label=3;case 3:return n=j({host:"https://api.northflank.com"},t),r=this.contextWrapper,o={current:n.name,contexts:k(k([],r.contexts,!0),[n],!1),lastUpdateCheck:r.lastUpdateCheck},[4,this.storeContext(o)];case 4:return i.sent(),[2]}}))}))},t.prototype.removeContext=function(t){return S(this,void 0,void 0,(function(){var e,n,r,o;return x(this,(function(i){switch(i.label){case 0:return e=this.contextWrapper,n=e.contexts.filter((function(e){return e.name!==t})),r=e.current===t?void 0:e.current,o={current:r,contexts:k([],n,!0),lastUpdateCheck:e.lastUpdateCheck},[4,this.storeContext(o)];case 1:return i.sent(),[2]}}))}))},t.prototype.getCurrentContext=function(){var t=this.contextWrapper.current;return void 0===t?t:this.findContext(t)},t.prototype.findContext=function(t){return this.contextWrapper.contexts.find((function(e){return e.name===t}))},t.prototype.getCurrentBaseUrl=function(){var t=this.getCurrentContext();return null==t?void 0:t.host},t.prototype.getCurrentProjectName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.project},t.prototype.getCurrentName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.name},t.prototype.getCurrentToken=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.token},t.prototype.getCurrentServiceName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.service},t.prototype.getCurrentJobName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.job},t.prototype.getCurrentPlanId=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.plan},t.prototype.getCurrentRegion=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.region},t.prototype.useContext=function(t){return S(this,void 0,void 0,(function(){var e,n;return x(this,(function(r){switch(r.label){case 0:if(!this.findContext(t))throw new Error("Context with name ".concat(t," doesn't exist"));return e=this.contextWrapper,n=j(j({},e),{current:t}),[4,this.storeContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.updateToken=function(t,e){return S(this,void 0,void 0,(function(){var n,r,o,i,s;return x(this,(function(a){switch(a.label){case 0:if(n=null!=e?e:this.getCurrentName(),!(r=this.findContext(n)))throw new Error("Context with name ".concat(e," doesn't exist"));return o=this.contextWrapper,i=o.contexts.map((function(e){return e.name===n?j(j({},r),{token:t}):e})),s=j(j({},o),{contexts:i}),[4,this.storeContext(s)];case 1:return a.sent(),[2]}}))}))},t.prototype.useProjectId=function(t){return S(this,void 0,void 0,(function(){var e,n;return x(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set project id to current context, current context not defined");return n=j(j({},e),{project:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.useServiceId=function(t){return S(this,void 0,void 0,(function(){var e,n;return x(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set service id to current context, current context not defined");return n=j(j({},e),{service:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.useJobId=function(t){return S(this,void 0,void 0,(function(){var e,n;return x(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set job id to current context, current context not defined");return n=j(j({},e),{job:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.usePlanId=function(t){return S(this,void 0,void 0,(function(){var e,n;return x(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set plan id to current context, current context not defined");return n=j(j({},e),{plan:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.useRegion=function(t){return S(this,void 0,void 0,(function(){var e,n;return x(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set region id to current context, current context not defined");return n=j(j({},e),{region:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.getLastUpdateCheck=function(){return this.contextWrapper.lastUpdateCheck||new Date},t.prototype.setLastUpdateCheck=function(t){return S(this,void 0,void 0,(function(){var e,n;return x(this,(function(r){switch(r.label){case 0:return e=this.contextWrapper,n=j(j({},e),{lastUpdateCheck:t}),[4,this.storeContext(n)];case 1:return r.sent(),[2]}}))}))},t}(),iu=function(t){function e(e){var n=t.call(this)||this;return n.assertDir=function(t){return S(n,void 0,void 0,(function(){var e;return x(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,v.promises.mkdir(t,{recursive:!0})];case 1:return[2,n.sent()];case 2:throw e=n.sent(),console.log("Failed to login, local files could not be created: ".concat(t,", error: ").concat(e.message)),e;case 3:return[2]}}))}))},n.configPath=e||"".concat(u.homedir(),"/.northflank"),n.configFile="".concat(n.configPath,"/config.json"),n.loadContext(),n}return _(e,t),e.prototype.loadContextWrapper=function(){try{return JSON.parse(v.readFileSync(this.configFile,"utf8"))}catch(t){return{contexts:[],lastUpdateCheck:new Date(0)}}},e.prototype.writeContext=function(t){return S(this,void 0,void 0,(function(){var e;return x(this,(function(n){switch(n.label){case 0:return[4,this.assertConfigDir()];case 1:n.sent(),n.label=2;case 2:return n.trys.push([2,4,,5]),[4,v.promises.writeFile(this.configFile,JSON.stringify(t,null,"\t"),{mode:416})];case 3:return n.sent(),[3,5];case 4:throw e=n.sent(),console.log("Failed to persist api context, local files could not be created, error: ".concat(e.message)),e;case 5:return[2]}}))}))},e.prototype.assertConfigDir=function(){return S(this,void 0,void 0,(function(){return x(this,(function(t){switch(t.label){case 0:return[4,this.assertDir(this.configPath)];case 1:return t.sent(),[2]}}))}))},e.prototype.getInfo=function(){return"Cli config stored in: ".concat(this.configPath)},e}(ou),su=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.inMemoryContextWrapper={contexts:[],lastUpdateCheck:new Date(0)},e}return _(e,t),e.prototype.loadContextWrapper=function(){return this.inMemoryContextWrapper||(this.inMemoryContextWrapper={contexts:[],lastUpdateCheck:new Date(0)}),this.inMemoryContextWrapper},e.prototype.writeContext=function(t){return S(this,void 0,void 0,(function(){return x(this,(function(e){return this.inMemoryContextWrapper=t,[2]}))}))},e}(ou),au=function(t,e){var n,r=this;void 0===e&&(e={}),this.baseUrl=function(){return r.contextProvider.getCurrentBaseUrl()},this.contextProvider=t,this.forwarding=new Ts(t,new gc(t,e).call,new Vs(t,e).call),this.endpoints={list:(n={},n.projects=new $s(t,e),n.addons=new Vs(t,e),n.jobs=new ma(t,e),n.registryCredentials=new qa(t,e),n.domains=new Ya(t,e),n.plans=new sc(t,e),n.regions=new ac(t,e),n.vcs=new uc(t,e),n.secrets=new lc(t,e),n.services=new gc(t,e),n.repos=new Gc(t,e),n.branches=new qc(t,e),n.volumes=new zc(t,e),n),create:function(){var n,r={};return r.project=new Gs(t,e),r.addon=new Hs(t,e),r.job=((n={}).manual=new ga(t,e),n.cron=new wa(t,e),n),r.domain=new Ka(t,e),r.secret=new dc(t,e),r.service=function(){var n={};return n.combined=new wc(t,e),n.deployment=new _c(t,e),n.build=new jc(t,e),n}(),r.volume=new Vc(t,e),r}(),get:function(){var n,r,o={};return o.project=new qs(t,e),o.addon=((r=new Js(t,e)).credentials=new Ks(t,e),r.types=new Xs(t,e),r.version=new Qs(t,e),r.backups=new ra(t,e),r.backup=((n=new ia(t,e)).download=new ha(t,e),n),r.containers=new ua(t,e),r),o.job=function(){var n=new ba(t,e);return n.runs=new _a(t,e),n.run=new Sa(t,e),n.healthChecks=new Ia(t,e),n.builds=new Ea(t,e),n.buildArguments=new Ta(t,e),n.buildArgumentDetails=new La(t,e),n.environment=new Ra(t,e),n.environmentDetails=new Da(t,e),n.deployment=new Fa(t,e),n.containers=new Wa(t,e),n.branches=new $a(t,e),n.pullRequests=new Ga(t,e),n}(),o.registryCredentials=new Va(t,e),o.domain=new Xa(t,e),o.subdomain=new ec(t,e),o.dnsId=new cc(t,e),o.secret=new pc(t,e),o.secretDetails=new vc(t,e),o.secretLink=new bc(t,e),o.service=function(){var n=new Sc(t,e);return n.deployment=new Ic(t,e),n.ports=new Pc(t,e),n.healthChecks=new Lc(t,e),n.builds=new Bc(t,e),n.containers=new Mc(t,e),n.branches=new Wc(t,e),n.pullRequests=new $c(t,e),n.buildArguments=new Zc(t,e),n.buildArgumentDetails=new tu(t,e),n.environmentVariables=new eu(t,e),n.environmentVariableDetails=new ru(t,e),n}(),o.volume=new Hc(t,e),o}(),delete:function(){var n={};return n.project=new zs(t,e),n.addon=new Ys(t,e),n.backup=new sa(t,e),n.job=new ya(t,e),n.registryCredentials=new Ha(t,e),n.domain=new Za(t,e),n.subdomain=new nc(t,e),n.secret=new fc(t,e),n.secretLink=new yc(t,e),n.service=new xc(t,e),n.volume=new Yc(t,e),n}(),scale:function(){var n={};return n.addon=new Zs(t,e),n.service=new kc(t,e),n}(),update:function(){var n,r={};return r.addon=((n={}).version=new ta(t,e),n.networkSettings=new ea(t,e),n.security=new na(t,e),n),r.job=function(){var n={};return n.settings=new ka(t,e),n.healthChecks=new Oa(t,e),n.buildOptions=new Pa(t,e),n.cmdOverride=new Ua(t,e),n.buildArguments=new Na(t,e),n.environment=new Ba(t,e),n.deployment=new Ma(t,e),n}(),r.registryCredentials=new Ja(t,e),r.secret=new hc(t,e),r.secretLink=new mc(t,e),r.service=function(){var n={};return n.deployment=new Oc(t,e),n.ports=new Uc(t,e),n.buildOptions=new Tc(t,e),n.cmdOverride=new Nc(t,e),n.healthChecks=new Rc(t,e),n.buildArguments=new Qc(t,e),n.environmentVariables=new nu(t,e),n}(),r.volume=new Jc(t,e),r}(),backup:function(){var n={};return n.addon=new oa(t,e),n}(),restore:function(){var n,r={};return r.addon=((n={}).backup=new aa(t,e),n),r}(),import:function(){var n,r={};return r.addon=((n={}).backup=new ca(t,e),n),r}(),pause:function(){var n={};return n.addon=new la(t,e),n.service=new Ac(t,e),n}(),resume:function(){var n={};return n.addon=new da(t,e),n.service=new Cc(t,e),n}(),restart:function(){var n={};return n.addon=new pa(t,e),n.service=new Ec(t,e),n}(),abort:function(){var n,r={};return r.addon=((n={}).backup=new fa(t,e),n.restore=new va(t,e),n),r.job=function(){var n={};return n.run=new xa(t,e),n.build=new Ca(t,e),n}(),r.service=function(){var n={};return n.build=new Fc(t,e),n}(),r}(),start:function(){var n,r={};return r.job=((n={}).run=new ja(t,e),n.build=new Aa(t,e),n),r.service=function(){var n={};return n.build=new Dc(t,e),n}(),r}(),add:function(){var n,r={};return r.registryCredentials=new za(t,e),r.domain=((n={}).subdomain=new tc(t,e),n),r}(),verify:function(){var n={};return n.domain=new Qa(t,e),n.subdomain=new rc(t,e),n}(),assign:function(){var n,r={};return r.subdomain=((n={}).service=new oc(t,e),n),r}(),unassign:function(){var n={};return n.subdomain=new ic(t,e),n}(),attach:function(){var n={};return n.volume=new Kc(t,e),n}(),detach:function(){var n={};return n.volume=new Xc(t,e),n}()},this.list=function(){var t={};return t.projects=r.endpoints.list.projects.call,t.addons=r.endpoints.list.addons.call,t.jobs=r.endpoints.list.jobs.call,t.registryCredentials=r.endpoints.list.registryCredentials.call,t.domains=r.endpoints.list.domains.call,t.plans=r.endpoints.list.plans.call,t.regions=r.endpoints.list.regions.call,t.vcs=r.endpoints.list.vcs.call,t.secrets=r.endpoints.list.secrets.call,t.services=r.endpoints.list.services.call,t.repos=r.endpoints.list.repos.call,t.branches=r.endpoints.list.branches.call,t.volumes=r.endpoints.list.volumes.call,t}(),this.create=function(){var t,e={};return e.project=r.endpoints.create.project.call,e.addon=r.endpoints.create.addon.call,e.job=((t={}).manual=r.endpoints.create.job.manual.call,t.cron=r.endpoints.create.job.cron.call,t),e.domain=r.endpoints.create.domain.call,e.secret=r.endpoints.create.secret.call,e.service=function(){var t={};return t.combined=r.endpoints.create.service.combined.call,t.deployment=r.endpoints.create.service.deployment.call,t.build=r.endpoints.create.service.build.call,t}(),e.volume=r.endpoints.create.volume.call,e}(),this.get=function(){var t,e,n={};return n.project=r.endpoints.get.project.call,n.addon=((e=r.endpoints.get.addon.call).credentials=r.endpoints.get.addon.credentials.call,e.types=r.endpoints.get.addon.types.call,e.version=r.endpoints.get.addon.version.call,e.backups=r.endpoints.get.addon.backups.call,e.backup=((t=r.endpoints.get.addon.backup.call).download=r.endpoints.get.addon.backup.download.call,t),e.containers=r.endpoints.get.addon.containers.call,e),n.job=function(){var t=r.endpoints.get.job.call;return t.runs=r.endpoints.get.job.runs.call,t.run=r.endpoints.get.job.run.call,t.healthChecks=r.endpoints.get.job.healthChecks.call,t.builds=r.endpoints.get.job.builds.call,t.buildArguments=r.endpoints.get.job.buildArguments.call,t.buildArgumentDetails=r.endpoints.get.job.buildArgumentDetails.call,t.environment=r.endpoints.get.job.environment.call,t.environmentDetails=r.endpoints.get.job.environmentDetails.call,t.deployment=r.endpoints.get.job.deployment.call,t.containers=r.endpoints.get.job.containers.call,t.branches=r.endpoints.get.job.branches.call,t.pullRequests=r.endpoints.get.job.pullRequests.call,t}(),n.registryCredentials=r.endpoints.get.registryCredentials.call,n.domain=r.endpoints.get.domain.call,n.subdomain=r.endpoints.get.subdomain.call,n.dnsId=r.endpoints.get.dnsId.call,n.secret=r.endpoints.get.secret.call,n.secretDetails=r.endpoints.get.secretDetails.call,n.secretLink=r.endpoints.get.secretLink.call,n.service=function(){var t=r.endpoints.get.service.call;return t.deployment=r.endpoints.get.service.deployment.call,t.ports=r.endpoints.get.service.ports.call,t.healthChecks=r.endpoints.get.service.healthChecks.call,t.builds=r.endpoints.get.service.builds.call,t.containers=r.endpoints.get.service.containers.call,t.branches=r.endpoints.get.service.branches.call,t.pullRequests=r.endpoints.get.service.pullRequests.call,t.buildArguments=r.endpoints.get.service.buildArguments.call,t.buildArgumentDetails=r.endpoints.get.service.buildArgumentDetails.call,t.environmentVariables=r.endpoints.get.service.environmentVariables.call,t.environmentVariableDetails=r.endpoints.get.service.environmentVariableDetails.call,t}(),n.volume=r.endpoints.get.volume.call,n}(),this.delete=function(){var t={};return t.project=r.endpoints.delete.project.call,t.addon=r.endpoints.delete.addon.call,t.backup=r.endpoints.delete.backup.call,t.job=r.endpoints.delete.job.call,t.registryCredentials=r.endpoints.delete.registryCredentials.call,t.domain=r.endpoints.delete.domain.call,t.subdomain=r.endpoints.delete.subdomain.call,t.secret=r.endpoints.delete.secret.call,t.secretLink=r.endpoints.delete.secretLink.call,t.service=r.endpoints.delete.service.call,t.volume=r.endpoints.delete.volume.call,t}(),this.scale=function(){var t={};return t.addon=r.endpoints.scale.addon.call,t.service=r.endpoints.scale.service.call,t}(),this.update=function(){var t,e={};return e.addon=((t={}).version=r.endpoints.update.addon.version.call,t.networkSettings=r.endpoints.update.addon.networkSettings.call,t.security=r.endpoints.update.addon.security.call,t),e.job=function(){var t={};return t.settings=r.endpoints.update.job.settings.call,t.healthChecks=r.endpoints.update.job.healthChecks.call,t.buildOptions=r.endpoints.update.job.buildOptions.call,t.cmdOverride=r.endpoints.update.job.cmdOverride.call,t.buildArguments=r.endpoints.update.job.buildArguments.call,t.environment=r.endpoints.update.job.environment.call,t.deployment=r.endpoints.update.job.deployment.call,t}(),e.registryCredentials=r.endpoints.update.registryCredentials.call,e.secret=r.endpoints.update.secret.call,e.secretLink=r.endpoints.update.secretLink.call,e.service=function(){var t={};return t.deployment=r.endpoints.update.service.deployment.call,t.ports=r.endpoints.update.service.ports.call,t.buildOptions=r.endpoints.update.service.buildOptions.call,t.cmdOverride=r.endpoints.update.service.cmdOverride.call,t.healthChecks=r.endpoints.update.service.healthChecks.call,t.buildArguments=r.endpoints.update.service.buildArguments.call,t.environmentVariables=r.endpoints.update.service.environmentVariables.call,t}(),e.volume=r.endpoints.update.volume.call,e}(),this.backup=function(){var t={};return t.addon=r.endpoints.backup.addon.call,t}(),this.restore=function(){var t,e={};return e.addon=((t={}).backup=r.endpoints.restore.addon.backup.call,t),e}(),this.import=function(){var t,e={};return e.addon=((t={}).backup=r.endpoints.import.addon.backup.call,t),e}(),this.pause=function(){var t={};return t.addon=r.endpoints.pause.addon.call,t.service=r.endpoints.pause.service.call,t}(),this.resume=function(){var t={};return t.addon=r.endpoints.resume.addon.call,t.service=r.endpoints.resume.service.call,t}(),this.restart=function(){var t={};return t.addon=r.endpoints.restart.addon.call,t.service=r.endpoints.restart.service.call,t}(),this.abort=function(){var t,e={};return e.addon=((t={}).backup=r.endpoints.abort.addon.backup.call,t.restore=r.endpoints.abort.addon.restore.call,t),e.job=function(){var t={};return t.run=r.endpoints.abort.job.run.call,t.build=r.endpoints.abort.job.build.call,t}(),e.service=function(){var t={};return t.build=r.endpoints.abort.service.build.call,t}(),e}(),this.start=function(){var t,e={};return e.job=((t={}).run=r.endpoints.start.job.run.call,t.build=r.endpoints.start.job.build.call,t),e.service=function(){var t={};return t.build=r.endpoints.start.service.build.call,t}(),e}(),this.add=function(){var t,e={};return e.registryCredentials=r.endpoints.add.registryCredentials.call,e.domain=((t={}).subdomain=r.endpoints.add.domain.subdomain.call,t),e}(),this.verify=function(){var t={};return t.domain=r.endpoints.verify.domain.call,t.subdomain=r.endpoints.verify.subdomain.call,t}(),this.assign=function(){var t,e={};return e.subdomain=((t={}).service=r.endpoints.assign.subdomain.service.call,t),e}(),this.unassign=function(){var t={};return t.subdomain=r.endpoints.unassign.subdomain.call,t}(),this.attach=function(){var t={};return t.volume=r.endpoints.attach.volume.call,t}(),this.detach=function(){var t={};return t.volume=r.endpoints.detach.volume.call,t}()};export{fa as AbortAddonBackupEndpoint,va as AbortAddonRestoreEndpoint,Ca as AbortJobBuildEndpoint,xa as AbortJobRunEndpoint,Fc as AbortServiceBuildEndpoint,tc as AddDomainSubdomainEndpoint,za as AddRegistrycredentialsEndpoint,au as ApiClient,ou as ApiClientContextProvider,iu as ApiClientFileContextProvider,su as ApiClientInMemoryContextProvider,Bs as ApiEndpoint,oc as AssignSubdomainServiceEndpoint,Kc as AttachVolumeEndpoint,oa as BackupAddonEndpoint,Hs as CreateAddonEndpoint,Ka as CreateDomainEndpoint,wa as CreateJobCronEndpoint,ga as CreateJobManualEndpoint,Gs as CreateProjectEndpoint,dc as CreateSecretEndpoint,jc as CreateServiceBuildEndpoint,wc as CreateServiceCombinedEndpoint,_c as CreateServiceDeploymentEndpoint,Vc as CreateVolumeEndpoint,Ys as DeleteAddonEndpoint,Ms as DeleteApiEndpoint,sa as DeleteBackupEndpoint,Za as DeleteDomainEndpoint,ya as DeleteJobEndpoint,zs as DeleteProjectEndpoint,Ha as DeleteRegistrycredentialsEndpoint,fc as DeleteSecretEndpoint,yc as DeleteSecretlinkEndpoint,xc as DeleteServiceEndpoint,nc as DeleteSubdomainEndpoint,Yc as DeleteVolumeEndpoint,Xc as DetachVolumeEndpoint,ha as GetAddonBackupDownloadEndpoint,ia as GetAddonBackupEndpoint,ra as GetAddonBackupsEndpoint,ua as GetAddonContainersEndpoint,Ks as GetAddonCredentialsEndpoint,Js as GetAddonEndpoint,Xs as GetAddonTypesEndpoint,Qs as GetAddonVersionEndpoint,Ds as GetApiEndpoint,cc as GetDnsidEndpoint,Xa as GetDomainEndpoint,$a as GetJobBranchesEndpoint,La as GetJobBuildargumentdetailsEndpoint,Ta as GetJobBuildargumentsEndpoint,Ea as GetJobBuildsEndpoint,Wa as GetJobContainersEndpoint,Fa as GetJobDeploymentEndpoint,ba as GetJobEndpoint,Ra as GetJobEnvironmentEndpoint,Da as GetJobEnvironmentdetailsEndpoint,Ia as GetJobHealthchecksEndpoint,Ga as GetJobPullrequestsEndpoint,Sa as GetJobRunEndpoint,_a as GetJobRunsEndpoint,qs as GetProjectEndpoint,Va as GetRegistrycredentialsEndpoint,pc as GetSecretEndpoint,vc as GetSecretdetailsEndpoint,bc as GetSecretlinkEndpoint,Wc as GetServiceBranchesEndpoint,tu as GetServiceBuildargumentdetailsEndpoint,Zc as GetServiceBuildargumentsEndpoint,Bc as GetServiceBuildsEndpoint,Mc as GetServiceContainersEndpoint,Ic as GetServiceDeploymentEndpoint,Sc as GetServiceEndpoint,ru as GetServiceEnvironmentvariabledetailsEndpoint,eu as GetServiceEnvironmentvariablesEndpoint,Lc as GetServiceHealthchecksEndpoint,Pc as GetServicePortsEndpoint,$c as GetServicePullrequestsEndpoint,ec as GetSubdomainEndpoint,Hc as GetVolumeEndpoint,ca as ImportAddonBackupEndpoint,Vs as ListAddonsEndpoint,qc as ListBranchesEndpoint,Ya as ListDomainsEndpoint,ma as ListJobsEndpoint,sc as ListPlansEndpoint,$s as ListProjectsEndpoint,ac as ListRegionsEndpoint,qa as ListRegistrycredentialsEndpoint,Gc as ListReposEndpoint,lc as ListSecretsEndpoint,gc as ListServicesEndpoint,uc as ListVcsEndpoint,zc as ListVolumesEndpoint,Ts as NorthflankPortForwarder,la as PauseAddonEndpoint,Ac as PauseServiceEndpoint,Fs as PostApiEndpoint,pa as RestartAddonEndpoint,Ec as RestartServiceEndpoint,aa as RestoreAddonBackupEndpoint,da as ResumeAddonEndpoint,Cc as ResumeServiceEndpoint,Zs as ScaleAddonEndpoint,kc as ScaleServiceEndpoint,Aa as StartJobBuildEndpoint,ja as StartJobRunEndpoint,Dc as StartServiceBuildEndpoint,ic as UnassignSubdomainEndpoint,ea as UpdateAddonNetworksettingsEndpoint,na as UpdateAddonSecurityEndpoint,ta as UpdateAddonVersionEndpoint,Na as UpdateJobBuildargumentsEndpoint,Pa as UpdateJobBuildoptionsEndpoint,Ua as UpdateJobCmdoverrideEndpoint,Ma as UpdateJobDeploymentEndpoint,Ba as UpdateJobEnvironmentEndpoint,Oa as UpdateJobHealthchecksEndpoint,ka as UpdateJobSettingsEndpoint,Ja as UpdateRegistrycredentialsEndpoint,hc as UpdateSecretEndpoint,mc as UpdateSecretlinkEndpoint,Qc as UpdateServiceBuildargumentsEndpoint,Tc as UpdateServiceBuildoptionsEndpoint,Nc as UpdateServiceCmdoverrideEndpoint,Oc as UpdateServiceDeploymentEndpoint,nu as UpdateServiceEnvironmentvariablesEndpoint,Rc as UpdateServiceHealthchecksEndpoint,Uc as UpdateServicePortsEndpoint,Jc as UpdateVolumeEndpoint,Qa as VerifyDomainEndpoint,rc as VerifySubdomainEndpoint};
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
package/package.json CHANGED
@@ -1,32 +1,25 @@
1
1
  {
2
2
  "name": "@northflank/js-client",
3
- "version": "0.4.1",
3
+ "version": "0.5.0-beta.0",
4
4
  "license": "MIT",
5
5
  "author": "Marco Suter",
6
- "main": "./dist/api-client.js",
7
- "typings": "./dist/api-client.d.ts",
8
- "scripts": {
9
- "dev-example": "ts-node src/_dev/dev-example.ts",
10
- "dev-forwarding": "ts-node src/_dev/dev-example-forwarding.ts",
11
- "dev": "babel-node --root-mode upward --ignore \"node_modules\" --extensions \".js,.ts\" src/_dev/dev-example.ts",
12
- "build": "rm -rf dist && tsc",
13
- "lint": "eslint ."
6
+ "main": "dist/cjs/api-client.js",
7
+ "typings": "dist/esm/api-client.d.ts",
8
+ "module": "dist/esm/api-client.js",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/esm/api-client.js",
12
+ "require": "./dist/cjs/api-client.js"
13
+ }
14
14
  },
15
- "bin": "./dist/api-client.js",
16
15
  "dependencies": {
16
+ "lodash-es": "^4.17.21",
17
17
  "node-fetch": "2.6.1",
18
18
  "pump": "^3.0.0",
19
- "ws": "^8.2.1",
20
- "lodash": "^4.17.21"
21
- },
22
- "devDependencies": {
23
- "ts-node": "^8.10.2",
24
- "typescript": "^4.0.3",
25
- "mysql2": "^2.3.0"
19
+ "ws": "^8.2.1"
26
20
  },
27
21
  "files": [
28
- "package.json",
29
- "dist",
22
+ "dist/",
30
23
  "LICENSE"
31
24
  ],
32
25
  "keywords": [