@task-handoff/node-agent 0.0.24 → 0.0.25-alpha.2

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 (54) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/git-provisioning-helper.js +1 -0
  3. package/dist/node-update-worker.js +1 -1
  4. package/docker/entrypoint.sh +8 -0
  5. package/docker/git-provision.sh +126 -0
  6. package/docker/git-provisioning-helper.js +1 -0
  7. package/node_modules/node-pty/LICENSE +69 -0
  8. package/node_modules/node-pty/lib/conpty_console_list_agent.js +16 -0
  9. package/node_modules/node-pty/lib/conpty_console_list_agent.js.map +1 -0
  10. package/node_modules/node-pty/lib/eventEmitter2.js +47 -0
  11. package/node_modules/node-pty/lib/eventEmitter2.js.map +1 -0
  12. package/node_modules/node-pty/lib/eventEmitter2.test.js +30 -0
  13. package/node_modules/node-pty/lib/eventEmitter2.test.js.map +1 -0
  14. package/node_modules/node-pty/lib/index.js +52 -0
  15. package/node_modules/node-pty/lib/index.js.map +1 -0
  16. package/node_modules/node-pty/lib/interfaces.js +7 -0
  17. package/node_modules/node-pty/lib/interfaces.js.map +1 -0
  18. package/node_modules/node-pty/lib/shared/conout.js +11 -0
  19. package/node_modules/node-pty/lib/shared/conout.js.map +1 -0
  20. package/node_modules/node-pty/lib/terminal.js +190 -0
  21. package/node_modules/node-pty/lib/terminal.js.map +1 -0
  22. package/node_modules/node-pty/lib/terminal.test.js +139 -0
  23. package/node_modules/node-pty/lib/terminal.test.js.map +1 -0
  24. package/node_modules/node-pty/lib/testUtils.test.js +28 -0
  25. package/node_modules/node-pty/lib/testUtils.test.js.map +1 -0
  26. package/node_modules/node-pty/lib/types.js +7 -0
  27. package/node_modules/node-pty/lib/types.js.map +1 -0
  28. package/node_modules/node-pty/lib/unixTerminal.js +346 -0
  29. package/node_modules/node-pty/lib/unixTerminal.js.map +1 -0
  30. package/node_modules/node-pty/lib/unixTerminal.test.js +351 -0
  31. package/node_modules/node-pty/lib/unixTerminal.test.js.map +1 -0
  32. package/node_modules/node-pty/lib/utils.js +39 -0
  33. package/node_modules/node-pty/lib/utils.js.map +1 -0
  34. package/node_modules/node-pty/lib/windowsConoutConnection.js +125 -0
  35. package/node_modules/node-pty/lib/windowsConoutConnection.js.map +1 -0
  36. package/node_modules/node-pty/lib/windowsPtyAgent.js +320 -0
  37. package/node_modules/node-pty/lib/windowsPtyAgent.js.map +1 -0
  38. package/node_modules/node-pty/lib/windowsPtyAgent.test.js +90 -0
  39. package/node_modules/node-pty/lib/windowsPtyAgent.test.js.map +1 -0
  40. package/node_modules/node-pty/lib/windowsTerminal.js +199 -0
  41. package/node_modules/node-pty/lib/windowsTerminal.js.map +1 -0
  42. package/node_modules/node-pty/lib/windowsTerminal.test.js +219 -0
  43. package/node_modules/node-pty/lib/windowsTerminal.test.js.map +1 -0
  44. package/node_modules/node-pty/lib/worker/conoutSocketWorker.js +22 -0
  45. package/node_modules/node-pty/lib/worker/conoutSocketWorker.js.map +1 -0
  46. package/node_modules/node-pty/package.json +6 -0
  47. package/node_modules/node-pty/prebuilds/linux-arm64/pty.node +0 -0
  48. package/node_modules/node-pty/prebuilds/linux-x64/pty.node +0 -0
  49. package/package.json +4 -1
  50. package/runtime-artifacts/{controlled-instance-runtime-0.0.24-linux-universal.manifest.json → controlled-instance-runtime-0.0.25-alpha.2-linux-universal.manifest.json} +2 -2
  51. package/runtime-artifacts/controlled-instance-runtime-0.0.25-alpha.2-linux-universal.tar.gz +0 -0
  52. package/runtime-artifacts/controlled-instance-runtime-0.0.25-alpha.2-linux-universal.tar.gz.sha256 +1 -0
  53. package/runtime-artifacts/controlled-instance-runtime-0.0.24-linux-universal.tar.gz +0 -0
  54. package/runtime-artifacts/controlled-instance-runtime-0.0.24-linux-universal.tar.gz.sha256 +0 -1
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ workspace="/workspace"
5
+ staging="${workspace}/.task-handoff-git-provisioning"
6
+ checkout="${staging}/checkout"
7
+ owner_file="${staging}/owner"
8
+ runtime_dir="/run/task-handoff/git-runtime"
9
+ mkdir -p "${workspace}" "${runtime_dir}"
10
+
11
+ fail() {
12
+ printf 'TASK_HANDOFF_GIT_PROVISIONING_ERROR=%s\n' "$1" >&2
13
+ exit "${2:-1}"
14
+ }
15
+
16
+ agent_pids=()
17
+ cleanup() {
18
+ for agent_pid in "${agent_pids[@]}"; do kill "${agent_pid}" 2>/dev/null || true; done
19
+ find "${runtime_dir}" -type f \( -name private-key -o -name passphrase -o -name ssh-askpass.sh -o -name ssh-error \) -delete 2>/dev/null || true
20
+ }
21
+ trap cleanup EXIT INT TERM
22
+
23
+ existing="$(find "${workspace}" -mindepth 1 -maxdepth 1 ! -name .task-handoff-git-provisioning -print -quit 2>/dev/null)"
24
+ if [ -n "${existing}" ]; then
25
+ if [ -e "${workspace}/.git" ]; then
26
+ echo "Workspace is already materialized; skipping provisioning."
27
+ exit 0
28
+ fi
29
+ fail WORKSPACE_NOT_EMPTY 73
30
+ fi
31
+ if [ -e "${staging}" ]; then
32
+ if [ ! -f "${owner_file}" ] || [ "$(cat "${owner_file}")" != "${TASK_HANDOFF_INSTANCE_ID}" ]; then
33
+ fail WORKSPACE_OWNERSHIP_MISMATCH 73
34
+ fi
35
+ rm -rf -- "${staging}"
36
+ fi
37
+ chown 1000:1000 "${workspace}"
38
+ mkdir -p "${staging}"
39
+ printf '%s' "${TASK_HANDOFF_INSTANCE_ID}" >"${owner_file}"
40
+ chmod 0600 "${owner_file}"
41
+ chown -R 1000:1000 "${staging}"
42
+
43
+ if [ -d /run/task-handoff/git-auth ]; then
44
+ cp -a /run/task-handoff/git-auth/. "${runtime_dir}/"
45
+ chmod 0700 "${runtime_dir}"
46
+ find "${runtime_dir}" -type f -exec chmod 0600 {} +
47
+ chown -R 1000:1000 "${runtime_dir}"
48
+ fi
49
+ if [ -f "${runtime_dir}/ssh-askpass.sh" ]; then
50
+ chmod 0700 "${runtime_dir}/ssh-askpass.sh"
51
+ chown 1000:1000 "${runtime_dir}/ssh-askpass.sh"
52
+ fi
53
+
54
+ for credential_dir in "${runtime_dir}"/credential-*; do
55
+ if [ ! -f "${credential_dir}/private-key" ]; then continue; fi
56
+ agent_output="$(runuser -u agent -- ssh-agent -a "${credential_dir}/agent.sock" -s)"
57
+ SSH_AUTH_SOCK="$(printf '%s\n' "${agent_output}" | sed -n 's/^SSH_AUTH_SOCK=\([^;]*\);.*$/\1/p')"
58
+ agent_pid="$(printf '%s\n' "${agent_output}" | sed -n 's/^SSH_AGENT_PID=\([0-9]*\);.*$/\1/p')"
59
+ if [ -z "${SSH_AUTH_SOCK}" ] || [ -z "${agent_pid}" ]; then
60
+ fail SSH_AGENT_UNAVAILABLE 70
61
+ fi
62
+ agent_pids+=("${agent_pid}")
63
+ askpass="/bin/false"
64
+ if [ -f "${credential_dir}/ssh-askpass.sh" ]; then askpass="${credential_dir}/ssh-askpass.sh"; fi
65
+ if ! runuser -u agent -- env \
66
+ SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" \
67
+ SSH_ASKPASS="${askpass}" \
68
+ SSH_ASKPASS_REQUIRE=force \
69
+ DISPLAY=task-handoff:0 \
70
+ ssh-add "${credential_dir}/private-key" </dev/null; then
71
+ fail AUTHENTICATION_REJECTED 74
72
+ fi
73
+ runuser -u agent -- env SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" ssh-add -L >"${credential_dir}/public-identity"
74
+ chmod 0600 "${credential_dir}/public-identity"
75
+ chown 1000:1000 "${credential_dir}/public-identity"
76
+ rm -f -- "${credential_dir}/private-key" "${credential_dir}/passphrase" "${credential_dir}/ssh-askpass.sh"
77
+ done
78
+
79
+ git_config=(
80
+ -c credential.helper=
81
+ -c credential.helper="!node /run/task-handoff/bootstrap/git-provisioning-helper.js credential"
82
+ -c credential.useHttpPath=true
83
+ -c core.sshCommand="node /run/task-handoff/bootstrap/git-provisioning-helper.js ssh"
84
+ )
85
+ clone_args=(clone)
86
+ # A commit SHA is not guaranteed to be reachable from a shallow default-branch clone.
87
+ if [ -n "${TASK_HANDOFF_GIT_DEPTH:-}" ] && [ -z "${TASK_HANDOFF_GIT_COMMIT:-}" ]; then clone_args+=(--depth "${TASK_HANDOFF_GIT_DEPTH}"); fi
88
+ if [ -n "${TASK_HANDOFF_GIT_REF:-}" ]; then clone_args+=(--branch "${TASK_HANDOFF_GIT_REF}"); fi
89
+ clone_args+=(-- "${TASK_HANDOFF_GIT_URL}" "${checkout}")
90
+
91
+ mkdir -p /tmp/task-handoff-git-home
92
+ chown 1000:1000 /tmp/task-handoff-git-home
93
+
94
+ if ! runuser -u agent -- env \
95
+ HOME=/tmp/task-handoff-git-home \
96
+ GIT_TERMINAL_PROMPT=0 \
97
+ GIT_SSH_COMMAND="node /run/task-handoff/bootstrap/git-provisioning-helper.js ssh" \
98
+ git "${git_config[@]}" "${clone_args[@]}"; then
99
+ fail CLONE_FAILED 74
100
+ fi
101
+
102
+ if [ -n "${TASK_HANDOFF_GIT_COMMIT:-}" ]; then
103
+ if ! runuser -u agent -- git -C "${checkout}" checkout --detach "${TASK_HANDOFF_GIT_COMMIT}"; then
104
+ fail REF_NOT_FOUND 75
105
+ fi
106
+ fi
107
+ if [ "${TASK_HANDOFF_GIT_SUBMODULES:-false}" = "true" ]; then
108
+ if ! runuser -u agent -- env \
109
+ HOME=/tmp/task-handoff-git-home \
110
+ GIT_TERMINAL_PROMPT=0 \
111
+ GIT_SSH_COMMAND="node /run/task-handoff/bootstrap/git-provisioning-helper.js ssh" \
112
+ git "${git_config[@]}" -C "${checkout}" submodule update --init --recursive; then
113
+ fail CLONE_FAILED 74
114
+ fi
115
+ fi
116
+ if [ "${TASK_HANDOFF_GIT_LFS:-false}" = "true" ]; then
117
+ if ! runuser -u agent -- env GIT_TERMINAL_PROMPT=0 GIT_SSH_COMMAND="node /run/task-handoff/bootstrap/git-provisioning-helper.js ssh" git "${git_config[@]}" -C "${checkout}" lfs pull; then
118
+ fail LFS_FAILED 76
119
+ fi
120
+ fi
121
+ if [ -n "${TASK_HANDOFF_WORKSPACE_SUBDIRECTORY:-}" ] && [ ! -d "${checkout}/${TASK_HANDOFF_WORKSPACE_SUBDIRECTORY}" ]; then
122
+ fail SUBDIRECTORY_NOT_FOUND 75
123
+ fi
124
+ shopt -s dotglob nullglob
125
+ mv -- "${checkout}"/* "${workspace}/"
126
+ rm -rf -- "${staging}"
@@ -0,0 +1 @@
1
+ "use strict";var e,t=require("node:fs"),n=require("node:path"),r=require("node:child_process");function i(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const i=s.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){const t=o[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class o extends i{}function s(e){var t;const i=n?.Parent?new o:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const e of i._zod.deferred)e();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class o extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class s extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(e=globalThis).__zod_globalConfig??(e.__zod_globalConfig={});const a=globalThis.__zod_globalConfig;function c(e){return a}function u(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function d(e,t){return"bigint"==typeof t?t.toString():t}function p(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function l(e){return null==e}function f(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const h=Symbol("evaluating");function m(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==h)return void 0===r&&(r=h,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function g(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function v(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function y(e){return JSON.stringify(e)}const _="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function b(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const z=p(()=>{if(a.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function w(e){if(!1===b(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==b(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function k(e){return w(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const $=new Set(["string","number","symbol"]);function S(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function O(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const I={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function E(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function Z(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function T(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function N(e){return"string"==typeof e?e:e?.message}function P(e,t,n){const r=e.message?e.message:N(e.inst?._zod.def?.error?.(e))??N(t?.error?.(e))??N(n.customError?.(e))??N(n.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=s),a}function j(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function A(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const F=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,d,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},R=i("$ZodError",F),C=i("$ZodError",F,{Parent:Error}),U=e=>(t,n,r,i)=>{const s=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new o;if(a.issues.length){const t=new(i?.Err??e)(a.issues.map(e=>P(e,s,c())));throw _(t,i?.callee),t}return a.value},J=e=>async(t,n,r,i)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>P(e,o,c())));throw _(t,i?.callee),t}return s.value},M=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new o;return s.issues.length?{success:!1,error:new(e??R)(s.issues.map(e=>P(e,i,c())))}:{success:!0,data:s.value}},D=M(C),V=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>P(e,i,c())))}:{success:!0,data:o.value}},L=V(C),G=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return U(e)(t,n,i)},W=e=>(t,n,r)=>U(e)(t,n,r),K=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return J(e)(t,n,i)},H=e=>async(t,n,r)=>J(e)(t,n,r),B=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return M(e)(t,n,i)},q=e=>(t,n,r)=>M(e)(t,n,r),Y=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return V(e)(t,n,i)},X=e=>async(t,n,r)=>V(e)(t,n,r),Q=/^[cC][0-9a-z]{6,}$/,ee=/^[0-9a-z]+$/,te=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ne=/^[0-9a-vA-V]{20}$/,re=/^[A-Za-z0-9]{27}$/,ie=/^[a-zA-Z0-9_-]{21}$/,oe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,se=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ae=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ce=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ue=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,de=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,pe=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,le=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,he=/^[A-Za-z0-9_-]*$/,me=/^https?$/,ge=/^\+[1-9]\d{6,14}$/,ve="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ye=new RegExp(`^${ve}$`);function _e(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const be=/^-?\d+$/,ze=/^-?\d+(?:\.\d+)?$/,we=/^(?:true|false)$/i,ke=/^[^A-Z]*$/,$e=/^[^a-z]*$/,Se=i("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),xe={number:"number",bigint:"bigint",object:"date"},Oe=i("$ZodCheckLessThan",(e,t)=>{Se.init(e,t);const n=xe[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ie=i("$ZodCheckGreaterThan",(e,t)=>{Se.init(e,t);const n=xe[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ee=i("$ZodCheckMultipleOf",(e,t)=>{Se.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ze=i("$ZodCheckNumberFormat",(e,t)=>{Se.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=I[t.format];e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=o,n&&(r.pattern=be)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Te=i("$ZodCheckMaxLength",(e,t)=>{var n;Se.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!l(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=j(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ne=i("$ZodCheckMinLength",(e,t)=>{var n;Se.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!l(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=j(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Pe=i("$ZodCheckLengthEquals",(e,t)=>{var n;Se.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!l(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,i=r.length;if(i===t.length)return;const o=j(r),s=i>t.length;n.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),je=i("$ZodCheckStringFormat",(e,t)=>{var n,r;Se.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ae=i("$ZodCheckRegex",(e,t)=>{je.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Fe=i("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ke),je.init(e,t)}),Re=i("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=$e),je.init(e,t)}),Ce=i("$ZodCheckIncludes",(e,t)=>{Se.init(e,t);const n=S(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ue=i("$ZodCheckStartsWith",(e,t)=>{Se.init(e,t);const n=new RegExp(`^${S(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Je=i("$ZodCheckEndsWith",(e,t)=>{Se.init(e,t);const n=new RegExp(`.*${S(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Me=i("$ZodCheckOverwrite",(e,t)=>{Se.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class De{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of r)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Ve={major:4,minor:4,patch:3},Le=i("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ve;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const t of r)for(const n of t._zod.onattach)n(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,i=E(e);for(const s of t){if(s._zod.def.when){if(Z(e))continue;if(!s._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new o;if(r||a instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await a,e.issues.length!==t&&(i||(i=E(e,t)))});else{if(e.issues.length===t)continue;i||(i=E(e,t))}}return r?r.then(()=>e):e},n=(n,i,s)=>{if(E(n))return n.aborted=!0,n;const a=t(i,r,s);if(a instanceof Promise){if(!1===s.async)throw new o;return a.then(t=>e._zod.parse(t,s))}return e._zod.parse(a,s)};e._zod.run=(i,s)=>{if(s.skipChecks)return e._zod.parse(i,s);if("backward"===s.direction){const t=e._zod.parse({value:i.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,s)):n(t,i,s)}const a=e._zod.parse(i,s);if(a instanceof Promise){if(!1===s.async)throw new o;return a.then(e=>t(e,r,s))}return t(a,r,s)}}m(e,"~standard",()=>({validate:t=>{try{const n=D(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return L(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Ge=i("$ZodString",(e,t)=>{var n;Le.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),We=i("$ZodStringFormat",(e,t)=>{je.init(e,t),Ge.init(e,t)}),Ke=i("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=se),We.init(e,t)}),He=i("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ae(e))}else t.pattern??(t.pattern=ae());We.init(e,t)}),Be=i("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ce),We.init(e,t)}),qe=i("$ZodURL",(e,t)=>{We.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===me.source&&!/^https?:\/\//i.test(r))return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});const i=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=i.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ye=i("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),We.init(e,t)}),Xe=i("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ie),We.init(e,t)}),Qe=i("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Q),We.init(e,t)}),et=i("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ee),We.init(e,t)}),tt=i("$ZodULID",(e,t)=>{t.pattern??(t.pattern=te),We.init(e,t)}),nt=i("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ne),We.init(e,t)}),rt=i("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=re),We.init(e,t)}),it=i("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=_e({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${ve}T(?:${r})$`)}(t)),We.init(e,t)}),ot=i("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ye),We.init(e,t)}),st=i("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${_e(t)}$`)),We.init(e,t)}),at=i("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=oe),We.init(e,t)}),ct=i("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ue),We.init(e,t),e._zod.bag.format="ipv4"}),ut=i("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=de),We.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),dt=i("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pe),We.init(e,t)}),pt=i("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=le),We.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function lt(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const ft=i("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=fe),We.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{lt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),ht=i("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=he),We.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!he.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return lt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),mt=i("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ge),We.init(e,t)}),gt=i("$ZodJWT",(e,t)=>{We.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),vt=i("$ZodNumber",(e,t)=>{Le.init(e,t),e._zod.pattern=e._zod.bag.pattern??ze,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),yt=i("$ZodNumberFormat",(e,t)=>{Ze.init(e,t),vt.init(e,t)}),_t=i("$ZodBoolean",(e,t)=>{Le.init(e,t),e._zod.pattern=we,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),bt=i("$ZodUnknown",(e,t)=>{Le.init(e,t),e._zod.parse=e=>e}),zt=i("$ZodNever",(e,t)=>{Le.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function wt(e,t,n){e.issues.length&&t.issues.push(...T(n,e.issues)),t.value[n]=e.value}const kt=i("$ZodArray",(e,t)=>{Le.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},r);a instanceof Promise?o.push(a.then(t=>wt(t,n,e))):wt(a,n,e)}return o.length?Promise.all(o).then(()=>n):n}});function $t(e,t,n,r,i,o){const s=n in r;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...T(n,e.issues))}s||i?void 0===e.value?s&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}function St(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function xt(e,t,n,r,i,o){const s=[],a=i.keySet,c=i.catchall._zod,u=c.def.type,d="optional"===c.optin,p="optional"===c.optout;for(const i in t){if("__proto__"===i)continue;if(a.has(i))continue;if("never"===u){s.push(i);continue}const o=c.run({value:t[i],issues:[]},r);o instanceof Promise?e.push(o.then(e=>$t(e,n,i,t,d,p))):$t(o,n,i,t,d,p)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const Ot=i("$ZodObject",(e,t)=>{Le.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=p(()=>St(t));m(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n});const i=b,o=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=r.value);const a=t.value;if(!i(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],u=s.shape;for(const e of s.keys){const r=u[e],i="optional"===r._zod.optin,o="optional"===r._zod.optout,s=r._zod.run({value:a[e],issues:[]},n);s instanceof Promise?c.push(s.then(n=>$t(n,t,e,a,i,o))):$t(s,t,e,a,i,o)}return o?xt(c,a,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),It=i("$ZodObjectJIT",(e,t)=>{Ot.init(e,t);const n=e._zod.parse,r=p(()=>St(t));let i;const o=b,s=!a.jitless,c=s&&z.value,u=t.catchall;let d;e._zod.parse=(a,p)=>{d??(d=r.value);const l=a.value;return o(l)?s&&c&&!1===p?.async&&!0!==p.jitless?(i||(i=(e=>{const t=new De(["shape","payload","ctx"]),n=r.value,i=e=>{const t=y(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let s=0;for(const e of n.keys)o[e]="key_"+s++;t.write("const newResult = {};");for(const r of n.keys){const n=o[r],s=y(r),a=e[r],c="optional"===a?._zod?.optin,u="optional"===a?._zod?.optout;t.write(`const ${n} = ${i(r)};`),c&&u?t.write(`\n if (${n}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):c?t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):t.write(`\n const ${n}_present = ${s} in input;\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${s}]\n });\n }\n\n if (${n}_present) {\n if (${n}.value === undefined) {\n newResult[${s}] = undefined;\n } else {\n newResult[${s}] = ${n}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),a=i(a,p),u?xt([],l,a,p,d,e):a):n(a,p):(a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a)}});function Et(e,t,n,r){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const i=e.filter(e=>!E(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>P(e,r,c())))}),t)}const Zt=i("$ZodUnion",(e,t)=>{Le.init(e,t),m(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),m(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),m(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),m(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>f(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)s.push(t),o=!0;else{if(0===t.issues.length)return t;s.push(t)}}return o?Promise.all(s).then(t=>Et(t,r,e,i)):Et(s,r,e,i)}}),Tt=i("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Zt.init(e,t);const n=e._zod.parse;m(e._zod,"propValues",()=>{const e={};for(const n of t.options){const r=n._zod.propValues;if(!r||0===Object.keys(r).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(const r of n)e[t].add(r)}}return e});const r=p(()=>{const e=t.options,n=new Map;for(const r of e){const e=r._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,o)=>{const s=i.value;if(!b(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=r.value.get(s?.[t.discriminator]);return a?a._zod.run(i,o):t.unionFallback||"backward"===o.direction?n(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:s,path:[t.discriminator],inst:e}),i)}}),Nt=i("$ZodIntersection",(e,t)=>{Le.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>jt(e,t,n)):jt(e,i,o)}});function Pt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(w(e)&&w(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const n of r){const r=Pt(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=Pt(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function jt(e,t,n){const r=new Map;let i;for(const n of t.issues)if("unrecognized_keys"===n.code){i??(i=n);for(const e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(const t of n.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);const o=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&i&&e.issues.push({...i,keys:o}),E(e))return e;const s=Pt(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const At=i("$ZodEnum",(e,t)=>{Le.init(e,t);const n=u(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>$.has(typeof e)).map(e=>"string"==typeof e?S(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),Ft=i("$ZodLiteral",(e,t)=>{if(Le.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?S(e):e?S(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,i)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),Rt=i("$ZodTransform",(e,t)=>{Le.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new s(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new o;return n.value=i,n.fallback=!0,n}});function Ct(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Ut=i("$ZodOptional",(e,t)=>{Le.init(e,t),e._zod.optin="optional",e._zod.optout="optional",m(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),m(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${f(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Ct(e,r)):Ct(i,r)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),Jt=i("$ZodExactOptional",(e,t)=>{Ut.init(e,t),m(e._zod,"values",()=>t.innerType._zod.values),m(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Mt=i("$ZodNullable",(e,t)=>{Le.init(e,t),m(e._zod,"optin",()=>t.innerType._zod.optin),m(e._zod,"optout",()=>t.innerType._zod.optout),m(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${f(e.source)}|null)$`):void 0}),m(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),Dt=i("$ZodDefault",(e,t)=>{Le.init(e,t),e._zod.optin="optional",m(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Vt(e,t)):Vt(r,t)}});function Vt(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Lt=i("$ZodPrefault",(e,t)=>{Le.init(e,t),e._zod.optin="optional",m(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Gt=i("$ZodNonOptional",(e,t)=>{Le.init(e,t),m(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Wt(t,e)):Wt(i,e)}});function Wt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Kt=i("$ZodCatch",(e,t)=>{Le.init(e,t),e._zod.optin="optional",m(e._zod,"optout",()=>t.innerType._zod.optout),m(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>P(e,n,c()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>P(e,n,c()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Ht=i("$ZodPipe",(e,t)=>{Le.init(e,t),m(e._zod,"values",()=>t.in._zod.values),m(e._zod,"optin",()=>t.in._zod.optin),m(e._zod,"optout",()=>t.out._zod.optout),m(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Bt(e,t.in,n)):Bt(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Bt(e,t.out,n)):Bt(r,t.out,n)}});function Bt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const qt=i("$ZodReadonly",(e,t)=>{Le.init(e,t),m(e._zod,"propValues",()=>t.innerType._zod.propValues),m(e._zod,"values",()=>t.innerType._zod.values),m(e._zod,"optin",()=>t.innerType?._zod?.optin),m(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Yt):Yt(r)}});function Yt(e){return e.value=Object.freeze(e.value),e}const Xt=i("$ZodCustom",(e,t)=>{Se.init(e,t),Le.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Qt(t,n,r,e));Qt(i,n,r,e)}});function Qt(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(A(e))}}var en;(en=globalThis).__zod_globalRegistry??(en.__zod_globalRegistry=new class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});const tn=globalThis.__zod_globalRegistry;function nn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function rn(e,t){return new Oe({check:"less_than",...O(t),value:e,inclusive:!1})}function on(e,t){return new Oe({check:"less_than",...O(t),value:e,inclusive:!0})}function sn(e,t){return new Ie({check:"greater_than",...O(t),value:e,inclusive:!1})}function an(e,t){return new Ie({check:"greater_than",...O(t),value:e,inclusive:!0})}function cn(e,t){return new Ee({check:"multiple_of",...O(t),value:e})}function un(e,t){return new Te({check:"max_length",...O(t),maximum:e})}function dn(e,t){return new Ne({check:"min_length",...O(t),minimum:e})}function pn(e,t){return new Pe({check:"length_equals",...O(t),length:e})}function ln(e){return new Me({check:"overwrite",tx:e})}function fn(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??tn,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function hn(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,r);else{const n=s.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),hn(o,t,r),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(s.schema,c),"input"===t.io&&vn(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function mn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=r.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${o}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+o}})(t);r.def={...r.schema},o&&(r.defId=o);const s=r.schema;for(const e in s)delete s[e];s.$ref=i};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const r=n[1];if(t===n[0]){i(n);continue}if(e.external){const r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){i(n);continue}}const o=e.metadataRegistry.get(n[0])?.id;(o||r.cycle||r.count>1&&"ref"===e.reused)&&i(n)}}function gn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,o={...i},s=n.ref;if(n.ref=null,s){r(s);const n=e.seen.get(s),a=n.schema;if(!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),Object.assign(i,o),t._zod.parent===s)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(a.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(const t of[...e.seen.entries()].reverse())r(t[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;const s=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?i.$defs=s:i.definitions=s);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:yn(t,"input",e.processors),output:yn(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function vn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return vn(r.element,n);if("set"===r.type)return vn(r.valueType,n);if("lazy"===r.type)return vn(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return vn(r.innerType,n);if("intersection"===r.type)return vn(r.left,n)||vn(r.right,n);if("record"===r.type||"map"===r.type)return vn(r.keyType,n)||vn(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||vn(r.in,n)||vn(r.out,n);if("object"===r.type){for(const e in r.shape)if(vn(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(vn(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(vn(e,n))return!0;return!(!r.rest||!vn(r.rest,n))}return!1}const yn=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=fn({...i??{},target:o,io:t,processors:n});return hn(e,s),mn(s,e),gn(s,e)},_n={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bn=(e,t,n,r)=>{const i=e._zod.def;hn(i.innerType,t,r),t.seen.get(e).ref=i.innerType},zn=i("ZodISODateTime",(e,t)=>{it.init(e,t),Gn.init(e,t)});const wn=i("ZodISODate",(e,t)=>{ot.init(e,t),Gn.init(e,t)});const kn=i("ZodISOTime",(e,t)=>{st.init(e,t),Gn.init(e,t)});const $n=i("ZodISODuration",(e,t)=>{at.init(e,t),Gn.init(e,t)});const Sn=(e,t)=>{R.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=(e,i=[])=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if("invalid_key"===o.code)r({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...i,...o.path]);else{const e=[...i,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,i=0;for(;i<e.length;){const n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(o))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,d,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,d,2)}},isEmpty:{get:()=>0===e.issues.length}})},xn=i("ZodError",Sn,{Parent:Error}),On=U(xn),In=J(xn),En=M(xn),Zn=V(xn),Tn=G(xn),Nn=W(xn),Pn=K(xn),jn=H(xn),An=B(xn),Fn=q(xn),Rn=Y(xn),Cn=X(xn),Un=new WeakMap;function Jn(e,t,n){const r=Object.getPrototypeOf(e);let i=Un.get(r);if(i||(i=new Set,Un.set(r,i)),!i.has(t)){i.add(t);for(const e in n){const t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){const n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const Mn=i("ZodType",(e,t)=>(Le.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:yn(e,"input"),output:yn(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=fn({...n,processors:t});return hn(e,r),mn(r,e),gn(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>On(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>En(e,t,n),e.parseAsync=async(t,n)=>In(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Zn(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Tn(e,t,n),e.decode=(t,n)=>Nn(e,t,n),e.encodeAsync=async(t,n)=>Pn(e,t,n),e.decodeAsync=async(t,n)=>jn(e,t,n),e.safeEncode=(t,n)=>An(e,t,n),e.safeDecode=(t,n)=>Fn(e,t,n),e.safeEncodeAsync=async(t,n)=>Rn(e,t,n),e.safeDecodeAsync=async(t,n)=>Cn(e,t,n),Jn(e,"ZodType",{check(...e){const t=this.def;return this.clone(v(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return x(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,n){return new Gr({type:"custom",check:"custom",fn:t,...O(n)})}(0,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return function(e,t){const n=function(e,t){const n=new Se({check:"custom",...O(t)});return n._zod.check=e,n}(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(A(e,t.value,n._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=t.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),t.issues.push(A(r))}},e(t.value,t)),t);return n}(e,t)}(e,t))},overwrite(e){return this.check(ln(e))},optional(){return jr(this)},exactOptional(){return new Ar({type:"optional",innerType:this})},nullable(){return Rr(this)},nullish(){return jr(Rr(this))},nonoptional(e){return function(e,t){return new Jr({type:"nonoptional",innerType:e,...O(t)})}(this,e)},array(){return zr(this)},or(e){return new $r({type:"union",options:[this,e],...O(void 0)})},and(e){return new Or({type:"intersection",left:this,right:e})},transform(e){return Vr(this,new Nr({type:"transform",transform:e}))},default(e){return t=e,new Cr({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():k(t)}});var t},prefault(e){return t=e,new Ur({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():k(t)}});var t},catch(e){return new Mr({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:()=>t});var t},pipe(e){return Vr(this,e)},readonly(){return new Lr({type:"readonly",innerType:this})},describe(e){const t=this.clone();return tn.add(t,{description:e}),t},meta(...e){if(0===e.length)return tn.get(this);const t=this.clone();return tn.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>tn.get(e)?.description,configurable:!0}),e)),Dn=i("_ZodString",(e,t)=>{Ge.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:o,format:s,patterns:a,contentEncoding:c}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof o&&(r.maxLength=o),s&&(r.format=_n[s]??s,""===r.format&&delete r.format,"time"===s&&delete r.format),c&&(r.contentEncoding=c),a&&a.size>0){const e=[...a];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Jn(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new Ae({check:"string_format",format:"regex",...O(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new Ce({check:"string_format",format:"includes",...O(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new Ue({check:"string_format",format:"starts_with",...O(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new Je({check:"string_format",format:"ends_with",...O(t),suffix:e})}(...e))},min(...e){return this.check(dn(...e))},max(...e){return this.check(un(...e))},length(...e){return this.check(pn(...e))},nonempty(...e){return this.check(dn(1,...e))},lowercase(e){return this.check(function(e){return new Fe({check:"string_format",format:"lowercase",...O(e)})}(e))},uppercase(e){return this.check(function(e){return new Re({check:"string_format",format:"uppercase",...O(e)})}(e))},trim(){return this.check(ln(e=>e.trim()))},normalize(...e){return this.check(function(e){return ln(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(ln(e=>e.toLowerCase()))},toUpperCase(){return this.check(ln(e=>e.toUpperCase()))},slugify(){return this.check(ln(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})}),Vn=i("ZodString",(e,t)=>{Ge.init(e,t),Dn.init(e,t),e.email=t=>e.check(function(e,t){return new Wn({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}(0,t)),e.url=t=>e.check(function(e,t){return new Bn({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}(0,t)),e.jwt=t=>e.check(function(e,t){return new dr({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}(0,t)),e.emoji=t=>e.check(function(e,t){return new qn({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}(0,t)),e.guid=t=>e.check(nn(Kn,t)),e.uuid=t=>e.check(function(e,t){return new Hn({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}(0,t)),e.uuidv4=t=>e.check(function(e,t){return new Hn({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}(0,t)),e.uuidv6=t=>e.check(function(e,t){return new Hn({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}(0,t)),e.uuidv7=t=>e.check(function(e,t){return new Hn({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}(0,t)),e.nanoid=t=>e.check(function(e,t){return new Yn({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}(0,t)),e.guid=t=>e.check(nn(Kn,t)),e.cuid=t=>e.check(function(e,t){return new Xn({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}(0,t)),e.cuid2=t=>e.check(function(e,t){return new Qn({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}(0,t)),e.ulid=t=>e.check(function(e,t){return new er({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}(0,t)),e.base64=t=>e.check(function(e,t){return new ar({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}(0,t)),e.base64url=t=>e.check(function(e,t){return new cr({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}(0,t)),e.xid=t=>e.check(function(e,t){return new tr({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}(0,t)),e.ksuid=t=>e.check(function(e,t){return new nr({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}(0,t)),e.ipv4=t=>e.check(function(e,t){return new rr({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}(0,t)),e.ipv6=t=>e.check(function(e,t){return new ir({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}(0,t)),e.cidrv4=t=>e.check(function(e,t){return new or({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}(0,t)),e.cidrv6=t=>e.check(function(e,t){return new sr({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}(0,t)),e.e164=t=>e.check(function(e,t){return new ur({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}(0,t)),e.datetime=t=>e.check(function(e){return function(e,t){return new zn({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}(0,e)}(t)),e.date=t=>e.check(function(e){return function(e,t){return new wn({type:"string",format:"date",check:"string_format",...O(t)})}(0,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new kn({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}(0,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new $n({type:"string",format:"duration",check:"string_format",...O(t)})}(0,e)}(t))});function Ln(e){return function(e,t){return new Vn({type:"string",...O(t)})}(0,e)}const Gn=i("ZodStringFormat",(e,t)=>{We.init(e,t),Dn.init(e,t)}),Wn=i("ZodEmail",(e,t)=>{Be.init(e,t),Gn.init(e,t)}),Kn=i("ZodGUID",(e,t)=>{Ke.init(e,t),Gn.init(e,t)}),Hn=i("ZodUUID",(e,t)=>{He.init(e,t),Gn.init(e,t)}),Bn=i("ZodURL",(e,t)=>{qe.init(e,t),Gn.init(e,t)}),qn=i("ZodEmoji",(e,t)=>{Ye.init(e,t),Gn.init(e,t)}),Yn=i("ZodNanoID",(e,t)=>{Xe.init(e,t),Gn.init(e,t)}),Xn=i("ZodCUID",(e,t)=>{Qe.init(e,t),Gn.init(e,t)}),Qn=i("ZodCUID2",(e,t)=>{et.init(e,t),Gn.init(e,t)}),er=i("ZodULID",(e,t)=>{tt.init(e,t),Gn.init(e,t)}),tr=i("ZodXID",(e,t)=>{nt.init(e,t),Gn.init(e,t)}),nr=i("ZodKSUID",(e,t)=>{rt.init(e,t),Gn.init(e,t)}),rr=i("ZodIPv4",(e,t)=>{ct.init(e,t),Gn.init(e,t)}),ir=i("ZodIPv6",(e,t)=>{ut.init(e,t),Gn.init(e,t)}),or=i("ZodCIDRv4",(e,t)=>{dt.init(e,t),Gn.init(e,t)}),sr=i("ZodCIDRv6",(e,t)=>{pt.init(e,t),Gn.init(e,t)}),ar=i("ZodBase64",(e,t)=>{ft.init(e,t),Gn.init(e,t)}),cr=i("ZodBase64URL",(e,t)=>{ht.init(e,t),Gn.init(e,t)}),ur=i("ZodE164",(e,t)=>{mt.init(e,t),Gn.init(e,t)}),dr=i("ZodJWT",(e,t)=>{gt.init(e,t),Gn.init(e,t)}),pr=i("ZodNumber",(e,t)=>{vt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:i,maximum:o,format:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u}=e._zod.bag;"string"==typeof s&&s.includes("int")?r.type="integer":r.type="number";const d="number"==typeof u&&u>=(i??Number.NEGATIVE_INFINITY),p="number"==typeof c&&c<=(o??Number.POSITIVE_INFINITY),l="draft-04"===t.target||"openapi-3.0"===t.target;d?l?(r.minimum=u,r.exclusiveMinimum=!0):r.exclusiveMinimum=u:"number"==typeof i&&(r.minimum=i),p?l?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:"number"==typeof o&&(r.maximum=o),"number"==typeof a&&(r.multipleOf=a)})(e,t,n),Jn(e,"ZodNumber",{gt(e,t){return this.check(sn(e,t))},gte(e,t){return this.check(an(e,t))},min(e,t){return this.check(an(e,t))},lt(e,t){return this.check(rn(e,t))},lte(e,t){return this.check(on(e,t))},max(e,t){return this.check(on(e,t))},int(e){return this.check(hr(e))},safe(e){return this.check(hr(e))},positive(e){return this.check(sn(0,e))},nonnegative(e){return this.check(an(0,e))},negative(e){return this.check(rn(0,e))},nonpositive(e){return this.check(on(0,e))},multipleOf(e,t){return this.check(cn(e,t))},step(e,t){return this.check(cn(e,t))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function lr(e){return function(e,t){return new pr({type:"number",checks:[],...O(t)})}(0,e)}const fr=i("ZodNumberFormat",(e,t)=>{yt.init(e,t),pr.init(e,t)});function hr(e){return function(e,t){return new fr({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}(0,e)}const mr=i("ZodBoolean",(e,t)=>{_t.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function gr(e){return function(e,t){return new mr({type:"boolean",...O(t)})}(0,e)}const vr=i("ZodUnknown",(e,t)=>{bt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function yr(){return new vr({type:"unknown"})}const _r=i("ZodNever",(e,t)=>{zt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});const br=i("ZodArray",(e,t)=>{kt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=hn(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,Jn(e,"ZodArray",{min(e,t){return this.check(dn(e,t))},nonempty(e){return this.check(dn(1,e))},max(e,t){return this.check(un(e,t))},length(e,t){return this.check(pn(e,t))},unwrap(){return this.element}})});function zr(e,t){return function(e,t,n){return new br({type:"array",element:t,...O(n)})}(0,e,t)}const wr=i("ZodObject",(e,t)=>{It.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const e in s)i.properties[e]=hn(s[e],t,{...r,path:[...r.path,"properties",e]});const a=new Set(Object.keys(s)),c=new Set([...a].filter(e=>{const n=o.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));c.size>0&&(i.required=Array.from(c)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=hn(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),m(e,"shape",()=>t.shape),Jn(e,"ZodObject",{keyof(){return Er(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:yr()})},loose(){return this.clone({...this._zod.def,catchall:yr()})},strict(){return this.clone({...this._zod.def,catchall:function(e,t){return new _r({type:"never",...O(t)})}(0,e)});var e},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!w(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=v(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return g(this,"shape",n),n}});return x(e,r)}(this,e)},safeExtend(e){return function(e,t){if(!w(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=v(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return g(this,"shape",n),n}});return x(e,n)}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=v(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return g(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return x(e,n)}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return x(e,v(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return g(this,"shape",e),e},checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=v(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return g(this,"shape",r),r},checks:[]});return x(e,i)}(this,e)},partial(...e){return function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=v(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return g(this,"shape",i),i},checks:[]});return x(t,i)}(Pr,this,e[0])},required(...e){return function(e,t,n){const r=v(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)i[t]=new e({type:"nonoptional",innerType:r[t]});return g(this,"shape",i),i}});return x(t,r)}(Jr,this,e[0])}})});function kr(e,t){const n={type:"object",shape:e??{},...O(t)};return new wr(n)}const $r=i("ZodUnion",(e,t)=>{Zt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,n)=>hn(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=s:n.anyOf=s})(e,t,n,r),e.options=t.options}),Sr=i("ZodDiscriminatedUnion",(e,t)=>{$r.init(e,t),Tt.init(e,t)});function xr(e,t,n){return new Sr({type:"union",options:t,discriminator:e,...O(n)})}const Or=i("ZodIntersection",(e,t)=>{Nt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=hn(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=hn(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=c})(e,t,n,r)}),Ir=i("ZodEnum",(e,t)=>{At.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=u(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const r of e){if(!n.has(r))throw new Error(`Key ${r} not found in enum`);i[r]=t.entries[r]}return new Ir({...t,checks:[],...O(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new Ir({...t,checks:[],...O(r),entries:i})}});function Er(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ir({type:"enum",entries:n,...O(t)})}const Zr=i("ZodLiteral",(e,t)=>{Ft.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=e._zod.def,i=[];for(const e of r.values)if(void 0===e){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(e))}else i.push(e);if(0===i.length);else if(1===i.length){const e=i[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else i.every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),i.every(e=>"boolean"==typeof e)&&(n.type="boolean"),i.every(e=>null===e)&&(n.type="null"),n.enum=i})(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Tr(e,t){return new Zr({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}const Nr=i("ZodTransform",(e,t)=>{Rt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new s(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(A(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(A(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}}),Pr=i("ZodOptional",(e,t)=>{Ut.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bn(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function jr(e){return new Pr({type:"optional",innerType:e})}const Ar=i("ZodExactOptional",(e,t)=>{Jt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bn(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}),Fr=i("ZodNullable",(e,t)=>{Mt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=hn(i.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rr(e){return new Fr({type:"nullable",innerType:e})}const Cr=i("ZodDefault",(e,t)=>{Dt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;hn(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),Ur=i("ZodPrefault",(e,t)=>{Lt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;hn(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),Jr=i("ZodNonOptional",(e,t)=>{Gt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;hn(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}),Mr=i("ZodCatch",(e,t)=>{Kt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let o;hn(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),Dr=i("ZodPipe",(e,t)=>{Ht.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===t.io?o?i.out:i.in:i.out;hn(s,t,r),t.seen.get(e).ref=s})(e,t,0,r),e.in=t.in,e.out=t.out});function Vr(e,t){return new Dr({type:"pipe",in:e,out:t})}const Lr=i("ZodReadonly",(e,t)=>{qt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;hn(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),Gr=i("ZodCustom",(e,t)=>{Xt.init(e,t),Mn.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)}),Wr=Ln().trim().min(1).max(120).regex(/^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$/),Kr=Ln().datetime(),Hr=lr().int().nonnegative(),Br=Er(["https-token","ssh-key"]),qr=Er(["operation-only","instance-retained"]),Yr=Er(["enabled","disabled"]),Xr=Er(["pending","synced","deferred","revoking","revoked"]),Qr=kr({scheme:Er(["https","ssh"]),host:Ln().trim().min(1).max(253),port:lr().int().min(1).max(65535).optional(),pathPrefix:Ln().min(1).max(2048).default("/")}).strict();function ei(e){throw new Error(`Invalid Git credential scope: ${e}`)}function ti(e){const t=e.trim().replace(/^\[|\]$/g,"");(!t||t.includes("*")||/[/?#@\s]/.test(t))&&ei("host is invalid");try{const e=new URL(t.includes(":")?`http://[${t}]/`:`http://${t}/`).hostname.replace(/^\[|\]$/g,"").toLowerCase();return(!e||e.length>253||e.includes("*"))&&ei("host is invalid"),e}catch{ei("host is invalid")}}function ni(e){try{return decodeURIComponent(e)}catch{ei("path contains invalid percent encoding")}}function ri(e){const t=e?.trim()||"/";(t.includes("?")||t.includes("#")||t.includes("\\")||t.includes("\0"))&&ei("path contains an unsupported delimiter");const n=(t.startsWith("/")?t:`/${t}`).split("/").filter(Boolean);for(const e of n){const t=ni(e);("."===t||".."===t||t.includes("/")||t.includes("\\")||t.includes("\0"))&&ei("path contains an unsafe segment")}return 0===n.length?"/":`/${n.join("/")}/`}function ii(e){const t=Qr.parse(e),n="https"===t.scheme?443:22;return Qr.parse({scheme:t.scheme,host:ti(t.host),...void 0===t.port||t.port===n?{}:{port:t.port},pathPrefix:ri(t.pathPrefix)})}function oi(e){return ri(e.replace(/\.git\/?$/,""))}const si=kr({id:Wr,name:Ln().trim().min(1).max(160),kind:Br,scope:Qr,secretSet:Tr(!0),status:Yr,revision:Hr,createdAt:Kr,updatedAt:Kr}).strict(),ai=xr("kind",[kr({kind:Tr("https-token"),username:Ln().trim().min(1).max(240),token:Ln().min(1).max(8192)}).strict(),kr({kind:Tr("ssh-key"),privateKey:Ln().min(1).max(131072),passphrase:Ln().max(8192).optional(),pinnedKnownHosts:Ln().min(1).max(131072)}).strict()]);kr({name:Ln().trim().min(1).max(160),scope:Qr,secret:ai}).strict().superRefine((e,t)=>{"https"===e.scope.scheme!=("https-token"===e.secret.kind)&&t.addIssue({code:"custom",path:["scope","scheme"],message:"Credential kind must match the remote scheme."});try{ii(e.scope)}catch(e){t.addIssue({code:"custom",path:["scope"],message:e instanceof Error?e.message:"Invalid Git scope."})}}),kr({name:Ln().trim().min(1).max(160).optional(),scope:Qr.optional(),secret:ai.optional(),status:Yr.optional()}).strict().refine(e=>Object.keys(e).length>0,"At least one credential field must be updated."),kr({items:zr(si).max(1e4)}).strict(),kr({instanceId:Wr,credentialId:Wr,credentialRevision:Hr,assignmentRevision:Hr,status:Xr,authorizedAt:Kr,updatedAt:Kr}).strict();const ci=kr({credential:si,secret:ai}).strict().superRefine((e,t)=>{e.credential.kind!==e.secret.kind&&t.addIssue({code:"custom",path:["secret","kind"],message:"Credential payload kind mismatch."})});kr({instanceId:Wr,generation:Hr,credentialIds:zr(Wr).max(256).transform(e=>[...new Set(e)].sort()),updatedAt:Kr}).strict(),kr({remoteUrl:Ln().trim().min(1).max(4096)}).strict(),xr("status",[kr({status:Tr("ok"),username:Ln().min(1).max(240),password:Ln().min(1).max(8192)}).strict(),kr({status:Er(["none","ambiguous","unsupported","missing-host-key","rejected"])}).strict()]),kr({remoteUrl:Ln().trim().min(1).max(4096)}).strict(),xr("status",[kr({status:Tr("ok"),invocationId:Wr,publicIdentity:Ln().min(1).max(131072),pinnedKnownHosts:Ln().min(1).max(131072)}).strict(),kr({status:Er(["none","ambiguous","unsupported","missing-host-key","rejected"])}).strict()]),kr({invocationId:Wr,frame:Ln().min(1).max(1048576)}).strict(),kr({frame:Ln().min(1).max(1048576)}).strict();const ui=kr({operationId:Wr,retention:qr,payload:ci}).strict();function di(e){return`'${e.replace(/'/g,"'\\''")}'`}function pi(e){const t=e.replace(/-/g,"_").toUpperCase();return Object.assign(new Error(`TASK_HANDOFF_GIT_PROVISIONING_ERROR=${t}`),{code:t})}function li(e,r=process.env.TASK_HANDOFF_GIT_RUNTIME_DIR||"/run/task-handoff/git-runtime"){const i=function(e){return t.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isDirectory()&&e.name.startsWith("credential-")).sort((e,t)=>e.name.localeCompare(t.name)).flatMap(r=>{const i=n.join(e,r.name),o=n.join(i,"scope.json");if(!t.existsSync(o))return[];const s=t.existsSync(n.join(i,"token")),a=t.existsSync(n.join(i,"public-identity"));return s||a?[{candidate:{id:r.name,kind:s?"https-token":"ssh-key",scope:JSON.parse(t.readFileSync(o,"utf8")),status:"enabled",...a?{pinnedKnownHosts:t.existsSync(n.join(i,"known_hosts"))}:{}},directory:i}]:[]})}(r),o=function(e,t){let n;try{n=function(e){const t=e.trim();if(t&&!t.includes("\0")||ei("remote is empty or invalid"),/^https?:\/\//i.test(t)||/^ssh:\/\//i.test(t)){let e;ri(t.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]+/i,"").split(/[?#]/,1)[0]||"/");try{e=new URL(t)}catch{ei("remote URL is invalid")}"https:"!==e.protocol&&"ssh:"!==e.protocol&&ei("remote scheme is unsupported"),(e.password||"https:"===e.protocol&&e.username)&&ei("HTTPS userinfo is forbidden"),(e.search||e.hash)&&ei("query and fragment are forbidden");const n="https:"===e.protocol?"https":"ssh",r=e.port?Number(e.port):void 0;return{...ii({scheme:n,host:e.hostname,port:r,pathPrefix:oi(e.pathname)}),original:t}}/^[a-z][a-z0-9+.-]*:\/\//i.test(t)&&ei("remote scheme is unsupported");const n=/^(?:([^@/:\s]+)@)?([^/:\s]+):(.+)$/.exec(t);n||ei("remote must use HTTPS, ssh://, or scp-like SSH syntax");const[,,r,i]=n;return(i.includes("?")||i.includes("#"))&&ei("query and fragment are forbidden"),{...ii({scheme:"ssh",host:r,pathPrefix:oi(i)}),original:t}}(e)}catch(e){return{status:"unsupported",reason:e instanceof Error?e.message:"Unsupported Git remote."}}const r=t.filter(e=>"enabled"===e.status).filter(e=>"https"===n.scheme==("https-token"===e.kind)).filter(e=>function(e,t){const n=ii(e);return n.scheme===t.scheme&&n.host===t.host&&n.port===t.port&&("/"===n.pathPrefix||t.pathPrefix.startsWith(n.pathPrefix))}(e.scope,n)).map(e=>({candidate:e,specificity:ii(e.scope).pathPrefix.length}));if(0===r.length)return{status:"none",remote:n};const i=Math.max(...r.map(e=>e.specificity)),o=r.filter(e=>e.specificity===i).map(e=>e.candidate);if(o.length>1)return{status:"ambiguous",remote:n,credentialIds:o.map(e=>e.id).sort()};const s=o[0];return"ssh-key"===s.kind&&!0!==s.pinnedKnownHosts?{status:"missing-host-key",remote:n,credentialId:s.id}:{status:"unique",remote:n,credential:s}}(e,i.map(e=>e.candidate));if("unique"!==o.status)throw pi("none"===o.status?"credential-missing":o.status);const s=i.find(e=>e.candidate.id===o.credential.id);if(!s)throw pi("credential-missing");return s.directory}async function fi(e){const i=function(e){if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||e.includes("\0")))return;const t=e;let n,r="";const i=[];for(let e=0;e<t.length;e+=1){const o=t[e];if("-p"===o&&/^\d+$/.test(t[e+1]||"")&&void 0===n){const r=Number(t[++e]);if(r<1||r>65535)return;n=String(r);continue}if("-4"!==o&&"-6"!==o)if("-o"!==o||"SendEnv=GIT_PROTOCOL"!==t[e+1]){if("-oSendEnv=GIT_PROTOCOL"!==o){if(o.startsWith("-"))return;if(r=o,e+=1,e!==t.length-1)return;break}i.push(o)}else i.push("-o",t[++e]);else i.push(o)}if(!r||!/^(?:[a-zA-Z0-9._-]+@)?[^@\s]+$/.test(r))return;const o=r.replace(/^[^@]+@/,""),s=function(e){const t=/^(git-upload-pack|git-receive-pack|git-upload-archive) ([\s\S]+)$/.exec(e);if(!t)return;const n=t[2];let r;if(n.startsWith("'")){if(!n.endsWith("'"))return;if(r=n.slice(1,-1).replace(/'\\''/g,"'"),di(r)!==n)return}else{if(!/^[a-zA-Z0-9._~@%+,:\/-]+$/.test(n))return;r=n}return!r||/[\0-\x1f\x7f]/.test(r)?void 0:{service:t[1],repository:r}}(t.at(-1)||"");if(!o||!s)return;const a=`${s.service} ${di(s.repository)}`;return{remote:`ssh://${o}${n?`:${n}`:""}/${encodeURIComponent(s.repository.replace(/^\/+/,"")).replace(/%2F/gi,"/")}`,args:[...i,...n?["-p",n]:[],r,a]}}(e);if(!i)throw pi("remote-unsupported");const o=li(i.remote),s=n.join(o,"agent.sock"),a=n.join(o,"public-identity"),c=n.join(o,"known_hosts");if(!t.existsSync(s))throw pi("ssh-agent-unavailable");if(!t.existsSync(c)||0===t.statSync(c).size)throw pi("host-key-required");return function(e,t,n={}){return new Promise((t,i)=>{const o={...process.env};delete o.SSH_AUTH_SOCK,Object.assign(o,n);const s=r.spawn("ssh",e,{stdio:"inherit",shell:!1,env:o});s.once("error",i),s.once("close",(e,n)=>0===e?t():i(Object.assign(new Error("Git SSH transport failed."),{exitCode:e,signal:n})))})}(["-F","/dev/null","-oBatchMode=yes","-oPasswordAuthentication=no","-oKbdInteractiveAuthentication=no","-oIdentitiesOnly=yes","-oIdentityFile=none","-oStrictHostKeyChecking=yes",`-oUserKnownHostsFile=${c}`,"-oGlobalKnownHostsFile=/dev/null",`-oIdentityAgent=${s}`,"-i",a,...i.args],0,{SSH_AUTH_SOCK:s})}kr({operationId:Wr,instanceId:Wr,remoteUrl:Ln().trim().min(1).max(4096),ref:xr("type",[kr({type:Er(["branch","tag"]),name:Ln().trim().min(1).max(240)}).strict(),kr({type:Tr("commit"),commit:Ln().trim().regex(/^[0-9a-fA-F]{4,64}$/,"commit must be a hexadecimal Git object id")}).strict()]),clone:kr({depth:lr().int().positive().max(1e5).optional(),submodules:gr().default(!1),lfs:gr().default(!1),subdirectory:Ln().trim().max(240).refine(e=>!e.startsWith("/")&&!e.split("/").some(e=>".."===e),"subdirectory must be a relative path within the repository").transform(e=>e.split("/").filter(e=>e&&"."!==e).join("/")).default("")}).strict(),credentials:zr(ui).max(256).default([])}).strict(),async function(){const[e,...r]=process.argv.slice(2);if("credential"===e)return async function(e){if("get"!==e)return;const r=function(e){const t="https"===e.protocol?"https":void 0,n="string"==typeof e.host?e.host.trim():"",r="string"==typeof e.path?e.path.replace(/^\/+/,""):"";return t&&n?`${t}://${n}/${r}`:void 0}(await new Promise(e=>{let t="";process.stdin.setEncoding("utf8"),process.stdin.on("data",e=>{t+=e}),process.stdin.on("end",()=>e(Object.fromEntries(t.split(/\r?\n/).flatMap(e=>{const t=e.indexOf("=");return t>0?[[e.slice(0,t),e.slice(t+1)]]:[]}))))}));if(!r)throw pi("remote-unsupported");let i;try{i=li(r)}catch(e){if("CREDENTIAL_MISSING"===e.code)return void process.stderr.write(`${e.message}\n`);throw e}const o=t.readFileSync(n.join(i,"username"),"utf8"),s=t.readFileSync(n.join(i,"token"),"utf8");process.stdout.write(`username=${o}\npassword=${s}\n\n`)}(r[0]);if("ssh"===e)return fi(r);throw new Error("TASK_HANDOFF_GIT_PROVISIONING_ERROR=REMOTE_UNSUPPORTED")}().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}\n`),process.exitCode=1});
@@ -0,0 +1,69 @@
1
+ Copyright (c) 2012-2015, Christopher Jeffrey (https://github.com/chjj/)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
20
+
21
+
22
+
23
+ The MIT License (MIT)
24
+
25
+ Copyright (c) 2016, Daniel Imms (http://www.growingwiththeweb.com)
26
+
27
+ Permission is hereby granted, free of charge, to any person obtaining a copy
28
+ of this software and associated documentation files (the "Software"), to deal
29
+ in the Software without restriction, including without limitation the rights
30
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31
+ copies of the Software, and to permit persons to whom the Software is
32
+ furnished to do so, subject to the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be included in all
35
+ copies or substantial portions of the Software.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
43
+ SOFTWARE.
44
+
45
+
46
+
47
+ MIT License
48
+
49
+ Copyright (c) 2018 - present Microsoft Corporation
50
+
51
+ All rights reserved.
52
+
53
+ Permission is hereby granted, free of charge, to any person obtaining a copy
54
+ of this software and associated documentation files (the "Software"), to deal
55
+ in the Software without restriction, including without limitation the rights
56
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
57
+ copies of the Software, and to permit persons to whom the Software is
58
+ furnished to do so, subject to the following conditions:
59
+
60
+ The above copyright notice and this permission notice shall be included in all
61
+ copies or substantial portions of the Software.
62
+
63
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
64
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
65
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
66
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
67
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
68
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
69
+ SOFTWARE.
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2019, Microsoft Corporation (MIT License).
4
+ *
5
+ * This module fetches the console process list for a particular PID. It must be
6
+ * called from a different process (child_process.fork) as there can only be a
7
+ * single console attached to a process.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ var utils_1 = require("./utils");
11
+ var getConsoleProcessList = utils_1.loadNativeModule('conpty_console_list').module.getConsoleProcessList;
12
+ var shellPid = parseInt(process.argv[2], 10);
13
+ var consoleProcessList = getConsoleProcessList(shellPid);
14
+ process.send({ consoleProcessList: consoleProcessList });
15
+ process.exit(0);
16
+ //# sourceMappingURL=conpty_console_list_agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conpty_console_list_agent.js","sourceRoot":"","sources":["../src/conpty_console_list_agent.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,iCAA2C;AAE3C,IAAM,qBAAqB,GAAG,wBAAgB,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC;AACnG,IAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/C,IAAM,kBAAkB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAC3D,OAAO,CAAC,IAAK,CAAC,EAAE,kBAAkB,oBAAA,EAAE,CAAC,CAAC;AACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2019, Microsoft Corporation (MIT License).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EventEmitter2 = void 0;
7
+ var EventEmitter2 = /** @class */ (function () {
8
+ function EventEmitter2() {
9
+ this._listeners = [];
10
+ }
11
+ Object.defineProperty(EventEmitter2.prototype, "event", {
12
+ get: function () {
13
+ var _this = this;
14
+ if (!this._event) {
15
+ this._event = function (listener) {
16
+ _this._listeners.push(listener);
17
+ var disposable = {
18
+ dispose: function () {
19
+ for (var i = 0; i < _this._listeners.length; i++) {
20
+ if (_this._listeners[i] === listener) {
21
+ _this._listeners.splice(i, 1);
22
+ return;
23
+ }
24
+ }
25
+ }
26
+ };
27
+ return disposable;
28
+ };
29
+ }
30
+ return this._event;
31
+ },
32
+ enumerable: false,
33
+ configurable: true
34
+ });
35
+ EventEmitter2.prototype.fire = function (data) {
36
+ var queue = [];
37
+ for (var i = 0; i < this._listeners.length; i++) {
38
+ queue.push(this._listeners[i]);
39
+ }
40
+ for (var i = 0; i < queue.length; i++) {
41
+ queue[i].call(undefined, data);
42
+ }
43
+ };
44
+ return EventEmitter2;
45
+ }());
46
+ exports.EventEmitter2 = EventEmitter2;
47
+ //# sourceMappingURL=eventEmitter2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventEmitter2.js","sourceRoot":"","sources":["../src/eventEmitter2.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAYH;IAAA;QACU,eAAU,GAAmB,EAAE,CAAC;IAgC1C,CAAC;IA7BC,sBAAW,gCAAK;aAAhB;YAAA,iBAkBC;YAjBC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBAChB,IAAI,CAAC,MAAM,GAAG,UAAC,QAAuB;oBACpC,KAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAC/B,IAAM,UAAU,GAAG;wBACjB,OAAO,EAAE;4BACP,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gCAC/C,IAAI,KAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;oCACnC,KAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;oCAC7B,OAAO;iCACR;6BACF;wBACH,CAAC;qBACF,CAAC;oBACF,OAAO,UAAU,CAAC;gBACpB,CAAC,CAAC;aACH;YACD,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAEM,4BAAI,GAAX,UAAY,IAAO;QACjB,IAAM,KAAK,GAAmB,EAAE,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;SAChC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SAChC;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAjCD,IAiCC;AAjCY,sCAAa"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2019, Microsoft Corporation (MIT License).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var assert = require("assert");
7
+ var eventEmitter2_1 = require("./eventEmitter2");
8
+ describe('EventEmitter2', function () {
9
+ it('should fire listeners multiple times', function () {
10
+ var order = [];
11
+ var emitter = new eventEmitter2_1.EventEmitter2();
12
+ emitter.event(function (data) { return order.push(data + 'a'); });
13
+ emitter.event(function (data) { return order.push(data + 'b'); });
14
+ emitter.fire(1);
15
+ emitter.fire(2);
16
+ assert.deepEqual(order, ['1a', '1b', '2a', '2b']);
17
+ });
18
+ it('should not fire listeners once disposed', function () {
19
+ var order = [];
20
+ var emitter = new eventEmitter2_1.EventEmitter2();
21
+ emitter.event(function (data) { return order.push(data + 'a'); });
22
+ var disposeB = emitter.event(function (data) { return order.push(data + 'b'); });
23
+ emitter.event(function (data) { return order.push(data + 'c'); });
24
+ emitter.fire(1);
25
+ disposeB.dispose();
26
+ emitter.fire(2);
27
+ assert.deepEqual(order, ['1a', '1b', '1c', '2a', '2c']);
28
+ });
29
+ });
30
+ //# sourceMappingURL=eventEmitter2.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventEmitter2.test.js","sourceRoot":"","sources":["../src/eventEmitter2.test.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,+BAAiC;AACjC,iDAAgD;AAEhD,QAAQ,CAAC,eAAe,EAAE;IACxB,EAAE,CAAC,sCAAsC,EAAE;QACzC,IAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,IAAM,OAAO,GAAG,IAAI,6BAAa,EAAU,CAAC;QAC5C,OAAO,CAAC,KAAK,CAAC,UAAA,IAAI,IAAI,OAAA,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,EAAtB,CAAsB,CAAC,CAAC;QAC9C,OAAO,CAAC,KAAK,CAAC,UAAA,IAAI,IAAI,OAAA,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,EAAtB,CAAsB,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAE,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE;QAC5C,IAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,IAAM,OAAO,GAAG,IAAI,6BAAa,EAAU,CAAC;QAC5C,OAAO,CAAC,KAAK,CAAC,UAAA,IAAI,IAAI,OAAA,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,EAAtB,CAAsB,CAAC,CAAC;QAC9C,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,UAAA,IAAI,IAAI,OAAA,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,EAAtB,CAAsB,CAAC,CAAC;QAC/D,OAAO,CAAC,KAAK,CAAC,UAAA,IAAI,IAAI,OAAA,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,EAAtB,CAAsB,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,QAAQ,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License)
4
+ * Copyright (c) 2016, Daniel Imms (MIT License).
5
+ * Copyright (c) 2018, Microsoft Corporation (MIT License).
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.native = exports.open = exports.createTerminal = exports.fork = exports.spawn = void 0;
9
+ var utils_1 = require("./utils");
10
+ var terminalCtor;
11
+ if (process.platform === 'win32') {
12
+ terminalCtor = require('./windowsTerminal').WindowsTerminal;
13
+ }
14
+ else {
15
+ terminalCtor = require('./unixTerminal').UnixTerminal;
16
+ }
17
+ /**
18
+ * Forks a process as a pseudoterminal.
19
+ * @param file The file to launch.
20
+ * @param args The file's arguments as argv (string[]) or in a pre-escaped
21
+ * CommandLine format (string). Note that the CommandLine option is only
22
+ * available on Windows and is expected to be escaped properly.
23
+ * @param options The options of the terminal.
24
+ * @throws When the file passed to spawn with does not exists.
25
+ * @see CommandLineToArgvW https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391(v=vs.85).aspx
26
+ * @see Parsing C++ Comamnd-Line Arguments https://msdn.microsoft.com/en-us/library/17w5ykft.aspx
27
+ * @see GetCommandLine https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156.aspx
28
+ */
29
+ function spawn(file, args, opt) {
30
+ return new terminalCtor(file, args, opt);
31
+ }
32
+ exports.spawn = spawn;
33
+ /** @deprecated */
34
+ function fork(file, args, opt) {
35
+ return new terminalCtor(file, args, opt);
36
+ }
37
+ exports.fork = fork;
38
+ /** @deprecated */
39
+ function createTerminal(file, args, opt) {
40
+ return new terminalCtor(file, args, opt);
41
+ }
42
+ exports.createTerminal = createTerminal;
43
+ function open(options) {
44
+ return terminalCtor.open(options);
45
+ }
46
+ exports.open = open;
47
+ /**
48
+ * Expose the native API when not Windows, note that this is not public API and
49
+ * could be removed at any time.
50
+ */
51
+ exports.native = (process.platform !== 'win32' ? utils_1.loadNativeModule('pty').module : null);
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,iCAA2C;AAE3C,IAAI,YAAiB,CAAC;AACtB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC;CAC7D;KAAM;IACL,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC;CACvD;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,KAAK,CAAC,IAAa,EAAE,IAAwB,EAAE,GAA8C;IAC3G,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAFD,sBAEC;AAED,kBAAkB;AAClB,SAAgB,IAAI,CAAC,IAAa,EAAE,IAAwB,EAAE,GAA8C;IAC1G,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAFD,oBAEC;AAED,kBAAkB;AAClB,SAAgB,cAAc,CAAC,IAAa,EAAE,IAAwB,EAAE,GAA8C;IACpH,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAFD,wCAEC;AAED,SAAgB,IAAI,CAAC,OAAwB;IAC3C,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAFD,oBAEC;AAED;;;GAGG;AACU,QAAA,MAAM,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,wBAAgB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2016, Daniel Imms (MIT License).
4
+ * Copyright (c) 2018, Microsoft Corporation (MIT License).
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2020, Microsoft Corporation (MIT License).
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getWorkerPipeName = void 0;
7
+ function getWorkerPipeName(conoutPipeName) {
8
+ return conoutPipeName + "-worker";
9
+ }
10
+ exports.getWorkerPipeName = getWorkerPipeName;
11
+ //# sourceMappingURL=conout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conout.js","sourceRoot":"","sources":["../../src/shared/conout.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAUH,SAAgB,iBAAiB,CAAC,cAAsB;IACtD,OAAU,cAAc,YAAS,CAAC;AACpC,CAAC;AAFD,8CAEC"}