diff --git a/builds/cmake/CMakePresets.json b/builds/cmake/CMakePresets.json index 82686095..3ecb059a 100644 --- a/builds/cmake/CMakePresets.json +++ b/builds/cmake/CMakePresets.json @@ -26,6 +26,7 @@ "name": "nix-base", "description": "Factored base settings for non-windows *nix based platforms.", "hidden": true, + "inherits": [ "base-pathing" ], "condition": { "type": "inList", "string": "${hostSystemName}", @@ -39,6 +40,7 @@ "name": "win-base", "description": "Factored base settings for windows platforms (msvc developer environment).", "hidden": true, + "inherits": [ "base-pathing" ], "generator": "Ninja", "condition": { "type": "equals", @@ -66,6 +68,7 @@ "name": "gnu-debug", "description": "Factored gnu specific debug settings.", "hidden": true, + "inherits": [ "config-debug" ], "cacheVariables": { "CMAKE_C_FLAGS": "$env{CMAKE_C_FLAGS} -Og -g1 --coverage -fprofile-update=atomic", "CMAKE_CXX_FLAGS": "$env{CMAKE_CXX_FLAGS} -Og -g1 --coverage -fprofile-update=atomic" @@ -75,6 +78,7 @@ "name": "gnu-release", "description": "Factored gnu specific release settings.", "hidden": true, + "inherits": [ "config-release" ], "cacheVariables": { "CMAKE_C_FLAGS": "$env{CMAKE_C_FLAGS} -O3", "CMAKE_CXX_FLAGS": "$env{CMAKE_CXX_FLAGS} -O3" @@ -124,9 +128,10 @@ "name": "optimization-host-native", "description": "Factored settings for march/mtune using for local execution.", "hidden": true, - "cacheVariables": { - "CMAKE_C_FLAGS": "$env{CMAKE_C_FLAGS} -march=native -mtune=native", - "CMAKE_CXX_FLAGS": "$env{CMAKE_CXX_FLAGS} -march=native -mtune=native" + "inherits": [ "nix-base" ], + "environment": { + "CMAKE_C_FLAGS": "$penv{CMAKE_C_FLAGS} -march=native -mtune=native", + "CMAKE_CXX_FLAGS": "$penv{CMAKE_CXX_FLAGS} -march=native -mtune=native" } }, { @@ -175,7 +180,7 @@ }, { "name": "nix-gnu-debug-static-native", - "displayName": "*nix/GNU/Debug/Static", + "displayName": "*nix/GNU/Debug/Static/Native", "description": "Debug build with static linking for native architecture.", "hidden": false, "inherits": [ @@ -187,7 +192,7 @@ }, { "name": "nix-gnu-debug-shared-native", - "displayName": "*nix/GNU/Debug/Shared", + "displayName": "*nix/GNU/Debug/Shared/Native", "description": "Debug build with shared linking for native architecture.", "hidden": false, "inherits": [ @@ -199,7 +204,7 @@ }, { "name": "nix-gnu-release-static-native", - "displayName": "*nix/GNU/Release/Static", + "displayName": "*nix/GNU/Release/Static/Native", "description": "Release build with static linking and standard optimizations for native architecture.", "hidden": false, "inherits": [ @@ -211,7 +216,7 @@ }, { "name": "nix-gnu-release-shared-native", - "displayName": "*nix/GNU/Release/Shared", + "displayName": "*nix/GNU/Release/Shared/Native", "description": "Release build with shared linking and standard optimizations for native architecture.", "hidden": false, "inherits": [ @@ -354,25 +359,25 @@ }, { "name": "nix-gnu-debug-static-native", - "displayName": "*nix/GNU/Debug/Static", + "displayName": "*nix/GNU/Debug/Static/Native", "inherits": [ "nix-target-list" ], "configurePreset": "nix-gnu-debug-static-native" }, { "name": "nix-gnu-debug-shared-native", - "displayName": "*nix/GNU/Debug/Shared", + "displayName": "*nix/GNU/Debug/Shared/Native", "inherits": [ "nix-target-list" ], "configurePreset": "nix-gnu-debug-shared-native" }, { "name": "nix-gnu-release-static-native", - "displayName": "*nix/GNU/Release/Static", + "displayName": "*nix/GNU/Release/Static/Native", "inherits": [ "nix-target-list" ], "configurePreset": "nix-gnu-release-static-native" }, { "name": "nix-gnu-release-shared-native", - "displayName": "*nix/GNU/Release/Shared", + "displayName": "*nix/GNU/Release/Shared/Native", "inherits": [ "nix-target-list" ], "configurePreset": "nix-gnu-release-shared-native" }, diff --git a/builds/msvc/vs2026/bs/bs.vcxproj b/builds/msvc/vs2026/bs/bs.vcxproj index 0a4ac263..31ef6b49 100644 --- a/builds/msvc/vs2026/bs/bs.vcxproj +++ b/builds/msvc/vs2026/bs/bs.vcxproj @@ -165,6 +165,7 @@ + @@ -204,10 +205,8 @@ - - diff --git a/builds/msvc/vs2026/bs/bs.vcxproj.filters b/builds/msvc/vs2026/bs/bs.vcxproj.filters index 2f29dccf..f0d8c5ee 100644 --- a/builds/msvc/vs2026/bs/bs.vcxproj.filters +++ b/builds/msvc/vs2026/bs/bs.vcxproj.filters @@ -286,6 +286,9 @@ web\admin_dashboard\src\lib + + web\admin_dashboard\src\lib + web\admin_dashboard\src\lib @@ -403,18 +406,12 @@ web\native\src\lib\api - - web\native\src\lib\api\providers - web\native\src\lib\api\providers web\native\src\lib\api\providers - - web\native\src\lib\api\providers - web\native\src\lib\hooks diff --git a/console/embedded/admin_css.cpp b/console/embedded/admin_css.cpp index d826f68b..b058cb1f 100644 --- a/console/embedded/admin_css.cpp +++ b/console/embedded/admin_css.cpp @@ -74,12 +74,12 @@ R"DELIM(/*! * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:#00000012;position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-500:oklch(60.6% .25 292.717);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-500:oklch(55.4% .046 257.417);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-500:oklch(55.2% .016 285.938);--color-black:#000;--spacing:.25rem;--container-xl:36rem;--container-4xl:56rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--radius-md:.375rem;--radius-xl:.75rem;--radius-2xl:1rem;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji)DELIM" -R"DELIM(;line-height:1.5}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}input:where([type=text]),input:where(:not([type])),input:where([type=email]),input:where([type=url]),input:where([type=password]),input:where([type=number]),input:where([type=date]),input:where([type=datetime-local]),input:where([type=month]),input:where([type=search]),input:where([type=tel]),input:where([type=time]),input:where([type=week]),select:where([multiple]),textarea,select{appearance:none;--tw-shadow:0 0 #0000;background-color:#fff;border-width:1px;border-color:#6a7282;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem}:is(input:where([type=text]),input:where(:not([type])),input:where([type=email]),input:where([type=url]),input:where([type=password]),input:where([type=number]),input:where([type=date]),input:where([type=datetime-local]),input:where([type=month]),input:where([type=search]),input:where([type=tel]),input:where([type=time]),input:where([type=week]),select:where([multiple]),textarea,select):focus{outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:oklch(54.6% .245 262.881);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#155dfc;outline:2px solid #0000}input::placeholder,textarea::placeholder{color:#6a7282;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-year-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-month-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-day-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-hour-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-minute-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-second-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-millisecond-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}select{-webkit-print-color-adjust:exact;print-color-adjust:exact;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='oklch(55.1%25 0.027 264.364)' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem}select:where([multiple]),select:where([size]:not([size="1"])){background-image:initial;background-position:initial;background-repeat:unset;background-size:initial;-webkit-print-color-adjust:unset;print-color-adjust:unset;padding-right:.75rem}input:where([type=checkbox]),input:where([type=radio]){appearance:none;-webkit-print-color-adjust:exact;print-color-adjust:exact;vertical-align:middle;-webkit-user-select:none;user-select:none;color:#155dfc;--tw-shadow:0 0 #0000;background-color:#fff;background-origin:border-box;border-width:1px;border-color:#6a7282;flex-shrink:0;width:1rem;height:1rem;padding:0;display:inline-block}input:where([type=checkbox]){border-radius:0}input:where([type=radio]){border-radius:100%}input:where([type=checkbox]):focus,input:where([type=radio]):focus{outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:oklch(54.6% .245 262.881);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid #0000}input:where([type=checkbox]):checked,input:where([type=radio]):checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:#0000}input:where([type=checkbox]):checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")}@media(forced-colors:active){input:where([type=checkbox]):checked{appearance:auto}}input:where([type=radio]):checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e")}@media(forced-colors:active){input:where([type=radio]):checked{appearance:auto}}input:where([type=checkbox]):checked:hover,input:where([type=checkbox]):checked:focus,input:where([type=radio]):checked:hover,input:where([type=radio]):checked:focus{background-color:currentColor;border-color:#0000}input:where([type=checkbox]):indeterminate{background-color:currentColor;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' )DELIM" -R"DELIM(viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:#0000}@media(forced-colors:active){input:where([type=checkbox]):indeterminate{appearance:auto}}input:where([type=checkbox]):indeterminate:hover,input:where([type=checkbox]):indeterminate:focus{background-color:currentColor;border-color:#0000}input:where([type=file]){background:unset;border-color:inherit;font-size:unset;line-height:inherit;border-width:0;border-radius:0;padding:0}input:where([type=file]):focus{outline:1px solid buttontext;outline:1px auto -webkit-focus-ring-color}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{inset-inline:0}.top-0{top:0}.right-4{right:calc(var(--spacing) * 4)}.bottom-4{bottom:calc(var(--spacing) * 4)}.left-4{left:calc(var(--spacing) * 4)}.z-10{z-index:10}.z-50{z-index:50}.z-\[60\]{z-index:60}.order-1{order:1}.order-2{order:2}.order-3{order:3}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-auto{margin:auto}.mx-auto{margin-inline:auto}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.table{display:table}.h-3{height:calc(var(--spacing) * 3)}.h-10{height:calc(var(--spacing) * 10)}.h-\[min\(60vh\,32rem\)\]{height:min(60vh,32rem)}.h-full{height:100%}.max-h-56{max-height:calc(var(--spacing) * 56)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[92vh\]{max-height:92vh}.max-h-\[calc\(100vh-2rem\)\]{max-height:calc(100vh - 2rem)}.min-h-32{min-height:calc(var(--spacing) * 32)}.min-h-72{min-height:calc(var(--spacing) * 72)}.min-h-\[calc\(100vh-4rem\)\]{min-height:calc(100vh - 4rem)}.min-h-screen{min-height:100vh}.w-24{width:calc(var(--spacing) * 24)}.w-\[min\(60rem\,90vw\)\]{width:min(60rem,90vw)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-4xl{max-width:var(--container-4xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:0}.min-w-56{min-width:calc(var(--spacing) * 56)}.min-w-\[32rem\]{min-width:32rem}.flex-1{flex:1}.shrink-0{flex-shrink:0}.cursor-pointer{cursor:pointer}.grid-cols-\[5\.5rem_4\.5rem_minmax\(0\,1fr\)\]{grid-template-columns:5.5rem 4.5rem minmax(0,1fr)}.grid-cols-\[8\.5rem_10rem_minmax\(0\,1fr\)\]{grid-template-columns:8.5rem 10rem minmax(0,1fr)}.grid-cols-\[10rem_max-content\]{grid-template-columns:10rem max-content}.grid-cols-\[10rem_max-content_auto\]{grid-template-columns:10rem max-content auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-px{gap:1px}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-5{column-gap:calc(var(--spacing) * 5)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-1{row-gap:var(--spacing)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-4{row-gap:calc(var(--spacing) * 4)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-accentSecondary\/20>:not(:last-child)){border-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){:where(.divide-accentSecondary\/20>:not(:last-child)){border-color:color-mix(in oklab,var(--theme-accent-secondary) 20%,transparent)}}.self-center{align-self:center}.self-end{align-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:2147483647px}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-accent\/10{border-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\/10{border-color:color-mix(in oklab,var(--theme-accent) 10%,transparent)}}.border-accent\/20{border-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\/20{border-color:color-mix(in oklab,var(--theme-accent) 20%,transparent)}}.border-accent\/30{border-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\/30{border-color:color-mix(in oklab,var(--theme-accent) 30%,transparent)}}.border-accent\/35{border-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\/35{border-color:color-mix(in oklab,var(--theme-accent) 35%,transparent)}}.border-accent\/40{border-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\/40{border-color:color-mix(in oklab,var(--theme-accent) 40%,transparent)}}.border-accentSecondary\/20{border-color:var(--theme)DELIM" -R"DELIM(-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.border-accentSecondary\/20{border-color:color-mix(in oklab,var(--theme-accent-secondary) 20%,transparent)}}.border-accentSecondary\/30{border-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.border-accentSecondary\/30{border-color:color-mix(in oklab,var(--theme-accent-secondary) 30%,transparent)}}.border-amber-400\/35{border-color:#fcbb0059}@supports (color:color-mix(in lab,red,red)){.border-amber-400\/35{border-color:color-mix(in oklab,var(--color-amber-400) 35%,transparent)}}.border-amber-400\/60{border-color:#fcbb0099}@supports (color:color-mix(in lab,red,red)){.border-amber-400\/60{border-color:color-mix(in oklab,var(--color-amber-400) 60%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-emerald-400\/35{border-color:#00d29459}@supports (color:color-mix(in lab,red,red)){.border-emerald-400\/35{border-color:color-mix(in oklab,var(--color-emerald-400) 35%,transparent)}}.border-emerald-500\/50{border-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/50{border-color:color-mix(in oklab,var(--color-emerald-500) 50%,transparent)}}.border-slate-500\/40{border-color:#62748e66}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/40{border-color:color-mix(in oklab,var(--color-slate-500) 40%,transparent)}}.bg-accent,.bg-accent\/5{background-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.bg-accent\/5{background-color:color-mix(in oklab,var(--theme-accent) 5%,transparent)}}.bg-accent\/15{background-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.bg-accent\/15{background-color:color-mix(in oklab,var(--theme-accent) 15%,transparent)}}.bg-accentSecondary\/10{background-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.bg-accentSecondary\/10{background-color:color-mix(in oklab,var(--theme-accent-secondary) 10%,transparent)}}.bg-accentSecondary\/15{background-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.bg-accentSecondary\/15{background-color:color-mix(in oklab,var(--theme-accent-secondary) 15%,transparent)}}.bg-accentSecondary\/20{background-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.bg-accentSecondary\/20{background-color:color-mix(in oklab,var(--theme-accent-secondary) 20%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-background,.bg-background\/60{background-color:var(--theme-background)}@supports (color:color-mix(in lab,red,red)){.bg-background\/60{background-color:color-mix(in oklab,var(--theme-background) 60%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-blue-500\/15{background-color:#3080ff26}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/15{background-color:color-mix(in oklab,var(--color-blue-500) 15%,transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500) 15%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.bg-indigo-500\/15{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/15{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.bg-noticeSuccess\/95{background-color:var(--theme-notice-success)}@supports (color:color-mix(in lab,red,red)){.bg-noticeSuccess\/95{background-color:color-mix(in oklab,var(--theme-notice-success) 95%,transparent)}}.bg-noticeWarning\/95{background-color:var(--theme-notice-warning)}@supports (color:color-mix(in lab,red,red)){.bg-noticeWarning\/95{background-color:color-mix(in oklab,var(--theme-notice-warning) 95%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500) 20%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.bg-sky-500\/15{background-color:#00a5ef26}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/15{background-color:color-mix(in oklab,var(--color-sky-500) 15%,transparent)}}.bg-slate-500\/20{background-color:#62748e33}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/20{background-color:color-mix(in oklab,var(--color-slate-500) 20%,transparent)}}.bg-surface,.bg-surface\/80{background-color:var(--theme-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/80{background-color:color-mix(in oklab,var(--theme-surface) 80%,transparent)}}.bg-surface\/90{background-color:var(--theme-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/90{background-color:color-mix(in oklab,var(--theme-surface) 90%,transparent)}}.bg-surface\/95{background-color:var(--theme-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/95{background-color:color-mix(in oklab,var(--theme-surface) 95%,transparent)}}.bg-violet-500\/15{background-color:#8d54ff26}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/15{background-color:color-mix(in oklab,var(--color-violet-500) 15%,transparent)}}.bg-zinc-500\/20{background-color:#71717b33}@supports (color:color-mix(in lab,red,red)){.bg-zinc-500\/20{background-color:color-mix(in oklab,var(--color-zinc-500) 20%,transparent)}}.p-1{padding:var(--spacing)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-16{padding-block:calc(var(--spacing) * 16)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);)DELIM" -R"DELIM(line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--theme-accent)}.text-accentSecondary{color:var(--theme-accent-secondary)}.text-amber-200{color:var(--color-amber-200)}.text-amber-300{color:var(--color-amber-300)}.text-blue-300{color:var(--color-blue-300)}.text-cyan-300{color:var(--color-cyan-300)}.text-emerald-200{color:var(--color-emerald-200)}.text-emerald-300{color:var(--color-emerald-300)}.text-indigo-300{color:var(--color-indigo-300)}.text-noticeText\/60{color:var(--theme-notice-text)}@supports (color:color-mix(in lab,red,red)){.text-noticeText\/60{color:color-mix(in oklab,var(--theme-notice-text) 60%,transparent)}}.text-noticeText\/75{color:var(--theme-notice-text)}@supports (color:color-mix(in lab,red,red)){.text-noticeText\/75{color:color-mix(in oklab,var(--theme-notice-text) 75%,transparent)}}.text-orange-300{color:var(--color-orange-300)}.text-red-300{color:var(--color-red-300)}.text-sky-300{color:var(--color-sky-300)}.text-slate-300{color:var(--color-slate-300)}.text-textMuted{color:var(--theme-text-muted)}.text-textPrimary{color:var(--theme-text-primary)}.text-violet-300{color:var(--color-violet-300)}.text-zinc-300{color:var(--color-zinc-300)}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal, ) var(--tw-slashed-zero, ) var(--tw-numeric-figure, ) var(--tw-numeric-spacing, ) var(--tw-numeric-fraction, )}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-black\/50{--tw-shadow-color:#00000080}@supports (color:color-mix(in lab,red,red)){.shadow-black\/50{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 50%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/60{--tw-shadow-color:#0009}@supports (color:color-mix(in lab,red,red)){.shadow-black\/60{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 60%, transparent) var(--tw-shadow-alpha), transparent)}}.filter{filter:var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, )}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, )}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, )}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-700{--tw-duration:.7s;transition-duration:.7s}.placeholder\:text-textMuted\/50::placeholder{color:var(--theme-text-muted)}@supports (color:color-mix(in lab,red,red)){.placeholder\:text-textMuted\/50::placeholder{color:color-mix(in oklab,var(--theme-text-muted) 50%,transparent)}}.placeholder\:text-textMuted\/60::placeholder{color:var(--theme-text-muted)}@supports (color:color-mix(in lab,red,red)){.placeholder\:text-textMuted\/60::placeholder{color:color-mix(in oklab,var(--theme-text-muted) 60%,transparent)}}.backdrop\:bg-black\/60::backdrop{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.backdrop\:bg-black\/60::backdrop{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.first\:border-t-0:first-child{border-top-style:var(--tw-border-style);border-top-width:0}.first\:pt-0:first-child{padding-top:0}@media(hover:hover){.hover\:border-accent:hover{border-color:var(--theme-accent)}.hover\:bg-accentSecondary\/10:hover{background-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accentSecondary\/10:hover{background-color:color-mix(in oklab,var(--theme-accent-secondary) 10%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.hover\:text-accent:hover{color:var(--theme-accent)}.hover\:text-accentSecondary:hover{color:var(--theme-accent-secondary)}.hover\:text-noticeText:hover{color:var(--theme-notice-text)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:border-accent:focus{border-color:var(--theme-accent)}.focus\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-accent:focus{--tw-ring-color:var(--theme-accent)}.focus-visible\:bg-accentSecondary\/20:focus-visible{background-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.focus-visible\:bg-accentSecondary\/20:focus-visible{background-color:color-mix(in oklab,var(--theme-accent-secondary) 20%,transparent)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-textMuted:disabled{color:var(--theme-text-muted)}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(min-width:40rem){.sm\:left-auto{left:auto}.sm\:w-96{width:calc(var(--spacing) * 96)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-\[7\.5rem_7\.5r)DELIM" -R"DELIM(em_minmax\(0\,1fr\)\]{grid-template-columns:7.5rem 7.5rem minmax(0,1fr)}.sm\:p-5{padding:calc(var(--spacing) * 5)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}}@media(min-width:48rem){.md\:order-2{order:2}.md\:order-3{order:3}.md\:w-auto{width:auto}.md\:grid-cols-\[minmax\(0\,1fr\)_11rem_11rem\]{grid-template-columns:minmax(0,1fr) 11rem 11rem}}@media(min-width:64rem){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-\[minmax\(12rem\,1\.2fr\)_minmax\(11rem\,1fr\)_minmax\(9rem\,0\.8fr\)_3\.5rem_auto\]{grid-template-columns:minmax(12rem,1.2fr) minmax(11rem,1fr) minmax(9rem,.8fr) 3.5rem auto}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-\[1\.1fr_0\.9fr\]{grid-template-columns:1.1fr .9fr}}}:root{color-scheme:dark;--theme-background:#272822;--theme-surface:#1f211c;--theme-accent:#ffa022;--theme-accent-secondary:#c85637;--theme-text-primary:#ededed;--theme-text-muted:#cfcfcf;--theme-inset:#0000004d;--theme-notice-success:#022c22;--theme-notice-warning:#451a03;--theme-notice-text:#fff;--chart-grid:#c8563733;--chart-ticks:#ffa0224d}:root[data-theme=light]{color-scheme:light;--theme-background:#f5f3ed;--theme-surface:#fff;--theme-accent:#9c4a04;--theme-accent-secondary:#9b4430;--theme-text-primary:#222923;--theme-text-muted:#526052;--theme-inset:#2229230d;--theme-notice-success:#ecfdf5;--theme-notice-warning:#fffbeb;--theme-notice-text:#222923;--chart-grid:#52605226;--chart-ticks:#52605266;--chart-color-0:#9c4a04;--chart-color-1:#0369a1;--chart-color-2:#047857;--chart-color-3:#7e22ce;--chart-color-4:#be123c;--chart-color-5:#a21caf;--chart-color-6:#854d0e;--chart-color-7:#1d4ed8;--color-emerald-200:#065f46;--color-emerald-300:#065f46;--color-amber-200:#92400e;--color-amber-300:#92400e;--color-red-300:#991b1b;--color-rose-300:#9f1239;--color-orange-300:#9a3412;--color-sky-300:#075985;--color-cyan-300:#155e75;--color-blue-300:#1e40af;--color-violet-300:#5b21b6;--color-slate-300:#475569}:root[data-theme=midnight]{color-scheme:dark;--theme-background:#0e1525;--theme-surface:#141e32;--theme-accent:#7dd3fc;--theme-accent-secondary:#a5b4fc;--theme-text-primary:#e6edf7;--theme-text-muted:#a9bad0;--theme-inset:#00000040;--chart-grid:#a5b4fc33;--chart-ticks:#7dd3fc4d}html{scrollbar-gutter:stable}body{background-color:var(--theme-background);color:var(--theme-text-primary);font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}::selection{background-color:var(--theme-accent);color:var(--theme-background)}.uplot{color:var(--color-textMuted);font-family:var(--font-sans)}.uplot .u-legend{margin-bottom:.75rem;font-size:.75rem}.uplot .u-legend .u-series{padding:.2rem .45rem}.uplot .u-select{background:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.uplot .u-select{background:color-mix(in srgb,var(--theme-accent) 12%,transparent)}}.uplot .u-select{border:1px solid var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.uplot .u-select{border:1px solid color-mix(in srgb,var(--theme-accent) 35%,transparent)}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false} +.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:#00000012;position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial}}}@layer theme{:root,:host{--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-500:oklch(60.6% .25 292.717);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-500:oklch(55.4% .046 257.417);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-500:oklch(55.2% .016 285.938);--color-black:#000;--spacing:.25rem;--container-xl:36rem;--container-4xl:56rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--radius-sm:.25rem;--radius-md:.375rem;--radius-xl:.75rem;--radius-2xl:1rem;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-fami)DELIM" +R"DELIM(ly:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}input:where([type=text]),input:where(:not([type])),input:where([type=email]),input:where([type=url]),input:where([type=password]),input:where([type=number]),input:where([type=date]),input:where([type=datetime-local]),input:where([type=month]),input:where([type=search]),input:where([type=tel]),input:where([type=time]),input:where([type=week]),select:where([multiple]),textarea,select{appearance:none;--tw-shadow:0 0 #0000;background-color:#fff;border-width:1px;border-color:#6a7282;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem}:is(input:where([type=text]),input:where(:not([type])),input:where([type=email]),input:where([type=url]),input:where([type=password]),input:where([type=number]),input:where([type=date]),input:where([type=datetime-local]),input:where([type=month]),input:where([type=search]),input:where([type=tel]),input:where([type=time]),input:where([type=week]),select:where([multiple]),textarea,select):focus{outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:oklch(54.6% .245 262.881);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#155dfc;outline:2px solid #0000}input::placeholder,textarea::placeholder{color:#6a7282;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-year-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-month-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-day-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-hour-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-minute-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-second-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-millisecond-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}select{-webkit-print-color-adjust:exact;print-color-adjust:exact;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='oklch(55.1%25 0.027 264.364)' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem}select:where([multiple]),select:where([size]:not([size="1"])){background-image:initial;background-position:initial;background-repeat:unset;background-size:initial;-webkit-print-color-adjust:unset;print-color-adjust:unset;padding-right:.75rem}input:where([type=checkbox]),input:where([type=radio]){appearance:none;-webkit-print-color-adjust:exact;print-color-adjust:exact;vertical-align:middle;-webkit-user-select:none;user-select:none;color:#155dfc;--tw-shadow:0 0 #0000;background-color:#fff;background-origin:border-box;border-width:1px;border-color:#6a7282;flex-shrink:0;width:1rem;height:1rem;padding:0;display:inline-block}input:where([type=checkbox]){border-radius:0}input:where([type=radio]){border-radius:100%}input:where([type=checkbox]):focus,input:where([type=radio]):focus{outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:oklch(54.6% .245 262.881);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid #0000}input:where([type=checkbox]):checked,input:where([type=radio]):checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:#0000}input:where([type=checkbox]):checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")}@media(forced-colors:active){input:where([type=checkbox]):checked{appearance:auto}}input:where([type=radio]):checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e")}@media(forced-colors:active){input:where([type=radio]):checked{appearance:auto}}input:where([type=checkbox]):checked:hover,input:where([type=checkbox]):checked:focus,input:where([type=radio]):checked:hover,input:where([type=radio]):checked:focus{background-color:currentColor;border-color:#0000}input:where([type=checkbox]):indeterminate{background-color:curre)DELIM" +R"DELIM(ntColor;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:#0000}@media(forced-colors:active){input:where([type=checkbox]):indeterminate{appearance:auto}}input:where([type=checkbox]):indeterminate:hover,input:where([type=checkbox]):indeterminate:focus{background-color:currentColor;border-color:#0000}input:where([type=file]){background:unset;border-color:inherit;font-size:unset;line-height:inherit;border-width:0;border-radius:0;padding:0}input:where([type=file]):focus{outline:1px solid buttontext;outline:1px auto -webkit-focus-ring-color}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{inset-inline:0}.top-0{top:0}.right-4{right:calc(var(--spacing) * 4)}.bottom-4{bottom:calc(var(--spacing) * 4)}.left-4{left:calc(var(--spacing) * 4)}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[60\]{z-index:60}.order-1{order:1}.order-2{order:2}.order-3{order:3}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-auto{margin:auto}.mx-auto{margin-inline:auto}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.table{display:table}.h-2{height:calc(var(--spacing) * 2)}.h-4{height:calc(var(--spacing) * 4)}.h-10{height:calc(var(--spacing) * 10)}.h-\[min\(60vh\,32rem\)\]{height:min(60vh,32rem)}.h-full{height:100%}.max-h-56{max-height:calc(var(--spacing) * 56)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[92vh\]{max-height:92vh}.max-h-\[calc\(100vh-2rem\)\]{max-height:calc(100vh - 2rem)}.min-h-32{min-height:calc(var(--spacing) * 32)}.min-h-72{min-height:calc(var(--spacing) * 72)}.min-h-\[calc\(100vh-4rem\)\]{min-height:calc(100vh - 4rem)}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing) * 3)}.w-24{width:calc(var(--spacing) * 24)}.w-\[min\(60rem\,90vw\)\]{width:min(60rem,90vw)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-4xl{max-width:var(--container-4xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:0}.min-w-56{min-width:calc(var(--spacing) * 56)}.min-w-\[32rem\]{min-width:32rem}.flex-1{flex:1}.shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, )}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.grid-cols-\[5\.5rem_4\.5rem_minmax\(0\,1fr\)\]{grid-template-columns:5.5rem 4.5rem minmax(0,1fr)}.grid-cols-\[8\.5rem_10rem_minmax\(0\,1fr\)\]{grid-template-columns:8.5rem 10rem minmax(0,1fr)}.grid-cols-\[10rem_max-content\]{grid-template-columns:10rem max-content}.grid-cols-\[10rem_max-content_auto\]{grid-template-columns:10rem max-content auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-px{gap:1px}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-5{column-gap:calc(var(--spacing) * 5)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-1{row-gap:var(--spacing)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-4{row-gap:calc(var(--spacing) * 4)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-accentSecondary\/20>:not(:last-child)){border-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){:where(.divide-accentSecondary\/20>:not(:last-child)){border-color:color-mix(in oklab,var(--theme-accent-secondary) 20%,transparent)}}.self-center{align-self:center}.self-end{align-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:2147483647px}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-accent\/10{border-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\/10{border-color:color-mix(in oklab,var(--theme-accent) 10%,transparent)}}.border-accent\/20{border-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\/20{border-color:color-mix(in oklab,var(--theme-accent) 20%,transparent)}}.border-accent\/30{border-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\/30{border-color:color-mix(in oklab,var(--theme-acc)DELIM" +R"DELIM(ent) 30%,transparent)}}.border-accent\/35{border-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\/35{border-color:color-mix(in oklab,var(--theme-accent) 35%,transparent)}}.border-accent\/40{border-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\/40{border-color:color-mix(in oklab,var(--theme-accent) 40%,transparent)}}.border-accentSecondary\/20{border-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.border-accentSecondary\/20{border-color:color-mix(in oklab,var(--theme-accent-secondary) 20%,transparent)}}.border-accentSecondary\/30{border-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.border-accentSecondary\/30{border-color:color-mix(in oklab,var(--theme-accent-secondary) 30%,transparent)}}.border-amber-400\/35{border-color:#fcbb0059}@supports (color:color-mix(in lab,red,red)){.border-amber-400\/35{border-color:color-mix(in oklab,var(--color-amber-400) 35%,transparent)}}.border-amber-400\/60{border-color:#fcbb0099}@supports (color:color-mix(in lab,red,red)){.border-amber-400\/60{border-color:color-mix(in oklab,var(--color-amber-400) 60%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-emerald-400\/35{border-color:#00d29459}@supports (color:color-mix(in lab,red,red)){.border-emerald-400\/35{border-color:color-mix(in oklab,var(--color-emerald-400) 35%,transparent)}}.border-emerald-500\/50{border-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/50{border-color:color-mix(in oklab,var(--color-emerald-500) 50%,transparent)}}.border-slate-500\/40{border-color:#62748e66}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/40{border-color:color-mix(in oklab,var(--color-slate-500) 40%,transparent)}}.bg-accent\/5{background-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.bg-accent\/5{background-color:color-mix(in oklab,var(--theme-accent) 5%,transparent)}}.bg-accent\/15{background-color:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.bg-accent\/15{background-color:color-mix(in oklab,var(--theme-accent) 15%,transparent)}}.bg-accentSecondary\/10{background-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.bg-accentSecondary\/10{background-color:color-mix(in oklab,var(--theme-accent-secondary) 10%,transparent)}}.bg-accentSecondary\/15{background-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.bg-accentSecondary\/15{background-color:color-mix(in oklab,var(--theme-accent-secondary) 15%,transparent)}}.bg-accentSecondary\/20{background-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.bg-accentSecondary\/20{background-color:color-mix(in oklab,var(--theme-accent-secondary) 20%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-background,.bg-background\/60{background-color:var(--theme-background)}@supports (color:color-mix(in lab,red,red)){.bg-background\/60{background-color:color-mix(in oklab,var(--theme-background) 60%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-blue-500\/15{background-color:#3080ff26}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/15{background-color:color-mix(in oklab,var(--color-blue-500) 15%,transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500) 15%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.bg-indigo-500\/15{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/15{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.bg-noticeSuccess\/95{background-color:var(--theme-notice-success)}@supports (color:color-mix(in lab,red,red)){.bg-noticeSuccess\/95{background-color:color-mix(in oklab,var(--theme-notice-success) 95%,transparent)}}.bg-noticeWarning\/95{background-color:var(--theme-notice-warning)}@supports (color:color-mix(in lab,red,red)){.bg-noticeWarning\/95{background-color:color-mix(in oklab,var(--theme-notice-warning) 95%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500) 20%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.bg-sky-500\/15{background-color:#00a5ef26}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/15{background-color:color-mix(in oklab,var(--color-sky-500) 15%,transparent)}}.bg-slate-500\/20{background-color:#62748e33}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/20{background-color:color-mix(in oklab,var(--color-slate-500) 20%,transparent)}}.bg-surface,.bg-surface\/80{background-color:var(--theme-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/80{background-color:color-mix(in oklab,var(--theme-surface) 80%,transparent)}}.bg-surface\/90{background-color:var(--theme-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/90{background-color:color-mix(in oklab,var(--theme-surface) 90%,transparent)}}.bg-surface\/95{background-color:var(--theme-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/95{background-color:color-mix(in oklab,var(--theme-surface) 95%,transparent)}}.bg-violet-500\/15{background-color:#8d54ff26}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/15{background-color:color-mix(in oklab,var(--color-violet-500) 15%,transparent)}}.bg-zinc-500\/20{background-color:#71717b33}@supports (color:color-mix(in lab,red,red)){.bg-zinc-500\/20{background-color:color-mix(in oklab,var(--color-zinc-500) 20%,transparent)}}.p-1{padding:var(--spacing)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-16{padding-block:calc(var(--spacing) * 16)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,v)DELIM" +R"DELIM(ar(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--theme-accent)}.text-accentSecondary{color:var(--theme-accent-secondary)}.text-amber-200{color:var(--color-amber-200)}.text-amber-300{color:var(--color-amber-300)}.text-blue-300{color:var(--color-blue-300)}.text-cyan-300{color:var(--color-cyan-300)}.text-emerald-200{color:var(--color-emerald-200)}.text-emerald-300{color:var(--color-emerald-300)}.text-indigo-300{color:var(--color-indigo-300)}.text-noticeText\/60{color:var(--theme-notice-text)}@supports (color:color-mix(in lab,red,red)){.text-noticeText\/60{color:color-mix(in oklab,var(--theme-notice-text) 60%,transparent)}}.text-noticeText\/75{color:var(--theme-notice-text)}@supports (color:color-mix(in lab,red,red)){.text-noticeText\/75{color:color-mix(in oklab,var(--theme-notice-text) 75%,transparent)}}.text-orange-300{color:var(--color-orange-300)}.text-red-300{color:var(--color-red-300)}.text-sky-300{color:var(--color-sky-300)}.text-slate-300{color:var(--color-slate-300)}.text-textMuted{color:var(--theme-text-muted)}.text-textPrimary{color:var(--theme-text-primary)}.text-violet-300{color:var(--color-violet-300)}.text-zinc-300{color:var(--color-zinc-300)}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal, ) var(--tw-slashed-zero, ) var(--tw-numeric-figure, ) var(--tw-numeric-spacing, ) var(--tw-numeric-fraction, )}.opacity-50{opacity:.5}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-black\/50{--tw-shadow-color:#00000080}@supports (color:color-mix(in lab,red,red)){.shadow-black\/50{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 50%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/60{--tw-shadow-color:#0009}@supports (color:color-mix(in lab,red,red)){.shadow-black\/60{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 60%, transparent) var(--tw-shadow-alpha), transparent)}}.filter{filter:var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, )}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, )}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, )}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.placeholder\:text-textMuted\/50::placeholder{color:var(--theme-text-muted)}@supports (color:color-mix(in lab,red,red)){.placeholder\:text-textMuted\/50::placeholder{color:color-mix(in oklab,var(--theme-text-muted) 50%,transparent)}}.placeholder\:text-textMuted\/60::placeholder{color:var(--theme-text-muted)}@supports (color:color-mix(in lab,red,red)){.placeholder\:text-textMuted\/60::placeholder{color:color-mix(in oklab,var(--theme-text-muted) 60%,transparent)}}.backdrop\:bg-black\/60::backdrop{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.backdrop\:bg-black\/60::backdrop{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.first\:border-t-0:first-child{border-top-style:var(--tw-border-style);border-top-width:0}.first\:pt-0:first-child{padding-top:0}@media(hover:hover){.hover\:border-accent:hover{border-color:var(--theme-accent)}.hover\:bg-accentSecondary\/10:hover{background-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accentSecondary\/10:hover{background-color:color-mix(in oklab,var(--theme-accent-secondary) 10%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.hover\:text-accent:hover{color:var(--theme-accent)}.hover\:text-accentSecondary:hover{color:var(--theme-accent-secondary)}.hover\:text-noticeText:hover{color:var(--theme-notice-text)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:border-accent:focus{border-color:var(--theme-accent)}.focus\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-accent:focus{--tw-ring-color:var(--theme-accent)}.focus-visible\:bg-accentSecondary\/20:focus-visible{background-color:var(--theme-accent-secondary)}@supports (color:color-mix(in lab,red,red)){.focus-visible\:bg-accentSecondary\/20:focus-visible{background-color:color-mix(in oklab,var(--theme-accent-secondary) 20%,transparent)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-textMuted:disabled{color:var(--theme-text-muted)}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(min-wid)DELIM" +R"DELIM(th:40rem){.sm\:left-auto{left:auto}.sm\:w-96{width:calc(var(--spacing) * 96)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-\[7\.5rem_7\.5rem_minmax\(0\,1fr\)\]{grid-template-columns:7.5rem 7.5rem minmax(0,1fr)}.sm\:p-5{padding:calc(var(--spacing) * 5)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}}@media(min-width:48rem){.md\:order-2{order:2}.md\:order-3{order:3}.md\:w-auto{width:auto}.md\:grid-cols-\[minmax\(0\,1fr\)_11rem_11rem\]{grid-template-columns:minmax(0,1fr) 11rem 11rem}}@media(min-width:64rem){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-\[minmax\(12rem\,1\.2fr\)_minmax\(11rem\,1fr\)_minmax\(9rem\,0\.8fr\)_3\.5rem_auto\]{grid-template-columns:minmax(12rem,1.2fr) minmax(11rem,1fr) minmax(9rem,.8fr) 3.5rem auto}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-\[1\.1fr_0\.9fr\]{grid-template-columns:1.1fr .9fr}}}:root{color-scheme:dark;--theme-background:#272822;--theme-surface:#1f211c;--theme-accent:#ffa022;--theme-accent-secondary:#c85637;--theme-text-primary:#ededed;--theme-text-muted:#cfcfcf;--theme-inset:#0000004d;--theme-notice-success:#022c22;--theme-notice-warning:#451a03;--theme-notice-text:#fff;--chart-grid:#c8563733;--chart-ticks:#ffa0224d}:root[data-theme=light]{color-scheme:light;--theme-background:#f5f3ed;--theme-surface:#fff;--theme-accent:#9c4a04;--theme-accent-secondary:#9b4430;--theme-text-primary:#222923;--theme-text-muted:#526052;--theme-inset:#2229230d;--theme-notice-success:#ecfdf5;--theme-notice-warning:#fffbeb;--theme-notice-text:#222923;--chart-grid:#52605226;--chart-ticks:#52605266;--chart-color-0:#9c4a04;--chart-color-1:#0369a1;--chart-color-2:#047857;--chart-color-3:#7e22ce;--chart-color-4:#be123c;--chart-color-5:#a21caf;--chart-color-6:#854d0e;--chart-color-7:#1d4ed8;--color-emerald-200:#065f46;--color-emerald-300:#065f46;--color-amber-200:#92400e;--color-amber-300:#92400e;--color-red-300:#991b1b;--color-rose-300:#9f1239;--color-orange-300:#9a3412;--color-sky-300:#075985;--color-cyan-300:#155e75;--color-blue-300:#1e40af;--color-violet-300:#5b21b6;--color-slate-300:#475569}:root[data-theme=midnight]{color-scheme:dark;--theme-background:#0e1525;--theme-surface:#141e32;--theme-accent:#7dd3fc;--theme-accent-secondary:#a5b4fc;--theme-text-primary:#e6edf7;--theme-text-muted:#a9bad0;--theme-inset:#00000040;--chart-grid:#a5b4fc33;--chart-ticks:#7dd3fc4d}html{scrollbar-gutter:stable}body{background-color:var(--theme-background);color:var(--theme-text-primary);font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}::selection{background-color:var(--theme-accent);color:var(--theme-background)}.uplot{color:var(--color-textMuted);font-family:var(--font-sans)}.uplot .u-legend{margin-bottom:.75rem;font-size:.75rem}.uplot .u-legend .u-series{padding:.2rem .45rem;opacity:1!important}.uplot .u-legend .u-marker{display:none}.uplot .u-select{background:var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.uplot .u-select{background:color-mix(in srgb,var(--theme-accent) 12%,transparent)}}.uplot .u-select{border:1px solid var(--theme-accent)}@supports (color:color-mix(in lab,red,red)){.uplot .u-select{border:1px solid color-mix(in srgb,var(--theme-accent) 35%,transparent)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false} )DELIM" ) diff --git a/console/embedded/admin_ecma.cpp b/console/embedded/admin_ecma.cpp index c2c7fda3..1677b55f 100644 --- a/console/embedded/admin_ecma.cpp +++ b/console/embedded/admin_ecma.cpp @@ -174,83 +174,83 @@ R"DELIM(/*! * SOFTWARE. */ (function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))l(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function a(u){const f={};return u.integrity&&(f.integrity=u.integrity),u.referrerPolicy&&(f.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?f.credentials="include":u.crossOrigin==="anonymous"?f.credentials="omit":f.credentia)DELIM" -R"DELIM(ls="same-origin",f}function l(u){if(u.ep)return;u.ep=!0;const f=a(u);fetch(u.href,f)}})();function s1(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Am={exports:{}},pu={};var W0;function Ez(){if(W0)return pu;W0=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function a(l,u,f){var d=null;if(f!==void 0&&(d=""+f),u.key!==void 0&&(d=""+u.key),"key"in u){f={};for(var m in u)m!=="key"&&(f[m]=u[m])}else f=u;return u=f.ref,{$$typeof:n,type:l,key:d,ref:u!==void 0?u:null,props:f}}return pu.Fragment=i,pu.jsx=a,pu.jsxs=a,pu}var eb;function Oz(){return eb||(eb=1,Am.exports=Ez()),Am.exports}var x=Oz(),Mm={exports:{}},Ze={};var tb;function Nz(){if(tb)return Ze;tb=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),d=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),w=Symbol.for("react.view_transition"),O=Symbol.iterator;function T(M){return M===null||typeof M!="object"?null:(M=O&&M[O]||M["@@iterator"],typeof M=="function"?M:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,L={};function D(M,F,le){this.props=M,this.context=F,this.refs=L,this.updater=le||A}D.prototype.isReactComponent={},D.prototype.setState=function(M,F){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,F,"setState")},D.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function X(){}X.prototype=D.prototype;function G(M,F,le){this.props=M,this.context=F,this.refs=L,this.updater=le||A}var ee=G.prototype=new X;ee.constructor=G,k(ee,D.prototype),ee.isPureReactComponent=!0;var V=Array.isArray;function ne(){}var ae={H:null,A:null,T:null,S:null},ye=Object.prototype.hasOwnProperty;function ue(M,F,le){var re=le.ref;return{$$typeof:n,type:M,key:F,ref:re!==void 0?re:null,props:le}}function J(M,F){return ue(M.type,F,M.props)}function we(M){return typeof M=="object"&&M!==null&&M.$$typeof===n}function he(M){var F={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(le){return F[le]})}var Oe=/\/+/g;function fe(M,F){return typeof M=="object"&&M!==null&&M.key!=null?he(""+M.key):F.toString(36)}function Q(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(ne,ne):(M.status="pending",M.then(function(F){M.status==="pending"&&(M.status="fulfilled",M.value=F)},function(F){M.status==="pending"&&(M.status="rejected",M.reason=F)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function W(M,F,le,re,$e){var Ue=typeof M;(Ue==="undefined"||Ue==="boolean")&&(M=null);var Ae=!1;if(M===null)Ae=!0;else switch(Ue){case"bigint":case"string":case"number":Ae=!0;break;case"object":switch(M.$$typeof){case n:case i:Ae=!0;break;case b:return Ae=M._init,W(Ae(M._payload),F,le,re,$e)}}if(Ae)return $e=$e(M),Ae=re===""?"."+fe(M,0):re,V($e)?(le="",Ae!=null&&(le=Ae.replace(Oe,"$&/")+"/"),W($e,F,le,"",function(Bt){return Bt})):$e!=null&&(we($e)&&($e=J($e,le+($e.key==null||M&&M.key===$e.key?"":(""+$e.key).replace(Oe,"$&/")+"/")+Ae)),F.push($e)),1;Ae=0;var pe=re===""?".":re+":";if(V(M))for(var Ne=0;Ne>>1,Se=Q[Me];if(0>>1;Meu(be,xe))Mu(F,be)?(Q[Me]=F,Q[M]=xe,Me=M):(Q[Me]=be,Q[Re]=xe,Me=Re);else if(Mu(F,xe))Q[Me]=F,Q[M]=xe,Me=M;else break e}}return W}function u(Q,W){var xe=Q.sortIndex-W.sortIndex;return xe!==0?xe:Q.id-W.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var d=Date,m=d.now();n.unstable_now=function(){return d.now()-m}}var p=[],g=[],b=1,y=null,w=3,O=!1,T=!1,A=!1,k=!1,L=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,X=typeof setImmediate<"u"?setImmediate:null;function G(Q){for(var W=a(g);W!==null;){if(W.callback===null)l(g);else if(W.startTime<=Q)l(g),W.sortIndex=W.expirationTime,i(p,W);else break;W=a(g)}}function ee(Q){if(A=!1,G(Q),!T)if(a(p)!==null)T=!0,V||(V=!0,we());else{var W=a(g);W!==null&&fe(ee,W.startTime-Q)}}var V=!1,ne=-1,ae=5,ye=-1;function ue(){return k?!0:!(n.unstable_now()-yeQ&&ue());){var Me=y.callback;if(typeof Me=="function"){y.callback=null,w=y.priorityLevel;var Se=Me(y.expirationTime<=Q);if(Q=n.unstable_now(),typeof Se=="function"){y.callback=Se,G(Q),W=!0;break t}y===a(p)&&l(p),G(Q)}else l(p);y=a(p)}if(y!==null)W=!0;else{var Be=a(g);Be!==null&&fe(ee,Be.startTime-Q),W=!1}}break e}finally{y=null,w=xe,O=!1}W=void 0}}finally{W?we():V=!1}}}var we;if(typeof X=="function")we=function(){X(J)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,Oe=he.port2;he.port1.onmessage=J,we=function(){Oe.postMessage(null)}}else we=function(){L(J,0)};function fe(Q,W){ne=L(function(){Q(n.unstable_now())},W)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(Q){Q.callback=null},n.unstable_forceFrameRate=function(Q){0>Q||125Me?(Q.sortIndex=xe,i(g,Q),a(p)===null&&Q===a(g)&&(A?(D(ne),ne=-1):A=!0,fe(ee,xe-Me))):(Q.sortIndex=Se,i(p,Q),T||O||(T=!0,V||(V=!0,we()))),Q},n.unstable_shouldYield=ue,n.unstable_wrapCallback=function(Q){var W=w;return function(){var xe=w;w=W;try{return Q.apply(this,arguments)}finally{w=xe}}}})(Rm)),Rm}var rb;function jz(){return rb||(rb=1,km.exports=Mz()),km.exports}var Cm={exports:{}},Cn={};var sb;function kz(){if(sb)return Cn;sb=1;var n=Ap();function i(b){var y="https://react.dev/errors/"+b;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Cm.exports=kz(),Cm.exports}var lb;function Cz(){if(lb)return gu;lb=1;var n=jz(),i=Ap(),a=Rz();function l(e){var t="https://react.dev/errors/"+e;if(1bi||(e.current=Li[bi],Li[bi]=null,bi--)}function tt(e,t){bi++,Li[bi]=e.current,e.current=t}var vn=En(null),Gt=En(null),Kn=En(null),li=En(null);function Hi(e,t){switch(tt(Kn,t),tt(Gt,e),tt(vn,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?o0(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=o0(t),e=u0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ut(vn),tt(vn,e)}function Ce(){Ut(vn),Ut(Gt),Ut(Kn)}function me(e){var t=e.memoizedState;t!==null&&(Fl._currentValue=t.memoizedState,tt(li,e)),t=vn.current;var r=u0(t,e.type);t!==r&&(tt(Gt,e),tt(vn,r))}function nt(e){Gt.current===e&&(Ut(vn),Ut(Gt)),li.current===e&&(Ut(li),Fl._currentValue=Bt)}var Zt,qr;function Zn(e){if(Zt===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Zt=t&&t[1]||"",qr=-1)":-1>>1,Se=X[Me];if(0>>1;Meu(be,xe))Mu(J,be)?(X[Me]=J,X[M]=xe,Me=M):(X[Me]=be,X[Re]=xe,Me=Re);else if(Mu(J,xe))X[Me]=J,X[M]=xe,Me=M;else break e}}return ee}function u(X,ee){var xe=X.sortIndex-ee.sortIndex;return xe!==0?xe:X.id-ee.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var d=Date,h=d.now();n.unstable_now=function(){return d.now()-h}}var p=[],g=[],b=1,v=null,w=3,T=!1,E=!1,A=!1,k=!1,L=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,W=typeof setImmediate<"u"?setImmediate:null;function I(X){for(var ee=a(g);ee!==null;){if(ee.callback===null)l(g);else if(ee.startTime<=X)l(g),ee.sortIndex=ee.expirationTime,i(p,ee);else break;ee=a(g)}}function Q(X){if(A=!1,I(X),!E)if(a(p)!==null)E=!0,V||(V=!0,ae());else{var ee=a(g);ee!==null&&fe(Q,ee.startTime-X)}}var V=!1,ne=-1,ie=5,Ae=-1;function ye(){return k?!0:!(n.unstable_now()-AeX&&ye());){var Me=v.callback;if(typeof Me=="function"){v.callback=null,w=v.priorityLevel;var Se=Me(v.expirationTime<=X);if(X=n.unstable_now(),typeof Se=="function"){v.callback=Se,I(X),ee=!0;break t}v===a(p)&&l(p),I(X)}else l(p);v=a(p)}if(v!==null)ee=!0;else{var Be=a(g);Be!==null&&fe(Q,Be.startTime-X),ee=!1}}break e}finally{v=null,w=xe,T=!1}ee=void 0}}finally{ee?ae():V=!1}}}var ae;if(typeof W=="function")ae=function(){W(Y)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,ze=se.port2;se.port1.onmessage=Y,ae=function(){ze.postMessage(null)}}else ae=function(){L(Y,0)};function fe(X,ee){ne=L(function(){X(n.unstable_now())},ee)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(X){X.callback=null},n.unstable_forceFrameRate=function(X){0>X||125Me?(X.sortIndex=xe,i(g,X),a(p)===null&&X===a(g)&&(A?(U(ne),ne=-1):A=!0,fe(Q,xe-Me))):(X.sortIndex=Se,i(p,X),E||T||(E=!0,V||(V=!0,ae()))),X},n.unstable_shouldYield=ye,n.unstable_wrapCallback=function(X){var ee=w;return function(){var xe=w;w=ee;try{return X.apply(this,arguments)}finally{w=xe}}}})(Zm)),Zm}var ab;function Cz(){return ab||(ab=1,Um.exports=Rz()),Um.exports}var Lm={exports:{}},Cn={};var lb;function Dz(){if(lb)return Cn;lb=1;var n=Rp();function i(b){var v="https://react.dev/errors/"+b;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Lm.exports=Dz(),Lm.exports}var ub;function Zz(){if(ub)return vu;ub=1;var n=Cz(),i=Rp(),a=Uz();function l(e){var t="https://react.dev/errors/"+e;if(1bi||(e.current=$i[bi],$i[bi]=null,bi--)}function tt(e,t){bi++,$i[bi]=e.current,e.current=t}var vn=Tn(null),Gt=Tn(null),Kn=Tn(null),li=Tn(null);function Hi(e,t){switch(tt(Kn,t),tt(Gt,e),tt(vn,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?c0(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=c0(t),e=f0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ut(vn),tt(vn,e)}function Ce(){Ut(vn),Ut(Gt),Ut(Kn)}function me(e){var t=e.memoizedState;t!==null&&(Ql._currentValue=t.memoizedState,tt(li,e)),t=vn.current;var s=f0(t,e.type);t!==s&&(tt(Gt,e),tt(vn,s))}function nt(e){Gt.current===e&&(Ut(vn),Ut(Gt)),li.current===e&&(Ut(li),Ql._currentValue=Bt)}var Zt,qs;function Zn(e){if(Zt===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);Zt=t&&t[1]||"",qs=-1)":-1o||N[s]!==Z[o]){var q=` -`+N[s].replace(" at new "," at ");return e.displayName&&q.includes("")&&(q=q.replace("",e.displayName)),q}while(1<=s&&0<=o);break}}}finally{oi=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?Zn(r):""}function Gn(e,t){switch(e.tag){case 26:case 27:case 5:return Zn(e.type);case 16:return Zn("Lazy");case 13:return e.child!==t&&t!==null?Zn("Suspense Fallback"):Zn("Suspense");case 19:return Zn("SuspenseList");case 0:case 15:return nr(e.type,!1);case 11:return nr(e.type.render,!1);case 1:return nr(e.type,!0);case 31:return Zn("Activity");case 30:return Zn("ViewTransition");default:return""}}function Yn(e){try{var t="",r=null;do t+=Gn(e,r),r=e,e=e.return;while(e);return t}catch(s){return` -Error generating stack: `+s.message+` -`+s.stack}}var yn=Object.prototype.hasOwnProperty,Fn=n.unstable_scheduleCallback,ia=n.unstable_cancelCallback,il=n.unstable_shouldYield,ms=n.unstable_requestPaint,Yt=n.unstable_now,rl=n.unstable_getCurrentPriorityLevel,Qn=n.unstable_ImmediatePriority,sl=n.unstable_UserBlockingPriority,ra=n.unstable_NormalPriority,dd=n.unstable_LowPriority,Vu=n.unstable_IdlePriority,hd=n.log,md=n.unstable_setDisableYieldValue,sa=null,Ft=null;function Tt(e){if(typeof hd=="function"&&md(e),Ft&&typeof Ft.setStrictMode=="function")try{Ft.setStrictMode(sa,e)}catch{}}var Nt=Math.clz32?Math.clz32:ui,ps=Math.log,gs=Math.LN2;function ui(e){return e>>>=0,e===0?32:31-(ps(e)/gs|0)|0}var ir=256,rr=262144,aa=4194304;function Sr(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function al(e,t,r){var s=e.pendingLanes;if(s===0)return 0;var o=0,c=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var _=s&134217727;return _!==0?(s=_&~c,s!==0?o=Sr(s):(h&=_,h!==0?o=Sr(h):r||(r=_&~e,r!==0&&(o=Sr(r))))):(_=s&~c,_!==0?o=Sr(_):h!==0?o=Sr(h):r||(r=s&~e,r!==0&&(o=Sr(r)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,r=t&-t,c>=r||c===32&&(r&4194048)!==0)?t:o}function la(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function xr(e,t){(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0r;r++)t.push(e);return t}function ci(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function un(e,t,r,s,o,c){var h=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var _=e.entanglements,N=e.expirationTimes,Z=e.hiddenUpdates;for(r=h&~r;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),No=!1;if(ar)try{var ga={};Object.defineProperty(ga,"passive",{get:function(){No=!0}}),window.addEventListener("test",ga,ga),window.removeEventListener("test",ga,ga)}catch{No=!1}var Er=null,wi=null,zi=null;function Or(){if(zi)return zi;var e,t=wi,r=t.length,s,o="value"in Er?Er.value:Er.textContent,c=o.length;for(e=0;e=P),ce=" ",de=!1;function ge(e,t){switch(e){case"keyup":return R.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function De(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ie=!1;function Je(e,t){switch(e){case"compositionend":return De(t);case"keypress":return t.which!==32?null:(de=!0,ce);case"textInput":return e=t.data,e===ce&&de?null:e;default:return null}}function qe(e,t){if(Ie)return e==="compositionend"||!H&&ge(e,t)?(e=Or(),zi=wi=Er=null,Ie=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Sg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xg(e,t){var r=Sg(e);e=0;for(var s;r;){if(r.nodeType===3){if(s=e+r.textContent.length,e<=t&&s>=t)return{node:r,offset:t-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Sg(r)}}function wg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Sd(e.document);t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Sd(e.document)}return t}function xd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Cx=ar&&"documentMode"in document&&11>=document.documentMode,yl=null,wd=null,Do=null,zd=!1;function Tg(e,t,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;zd||yl==null||yl!==Sd(s)||(s=yl,"selectionStart"in s&&xd(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Do&&Ss(Do,s)||(Do=s,s=tf(wd,"onSelect"),0>=h,o-=h,Ar=1<<32-Nt(t)+o|r<ke?(sn=Ee,Ee=null):sn=Ee.sibling;var Xe=C(U,Ee,$[ke],I);if(Xe===null){Ee===null&&(Ee=sn);break}e&&Ee&&Xe.alternate===null&&t(U,Ee),j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe,Ee=sn}if(ke===$.length)return r(U,Ee),Ve&&ts(U,ke),ve;if(Ee===null){for(;ke<$.length;ke++)Ee=K(U,$[ke],I),Ee!==null&&(j=c(Ee,j,ke),Fe===null?ve=Ee:Fe.sibling=Ee,Fe=Ee);return Ve&&ts(U,ke),ve}for(Ee=s(Ee);ke<$.length;ke++)sn=B(Ee,U,ke,$[ke],I),sn!==null&&(e&&(Xe=sn.alternate,Xe!==null&&Ee.delete(Xe.key===null?ke:Xe.key)),j=c(sn,j,ke),Fe===null?ve=sn:Fe.sibling=sn,Fe=sn);return e&&Ee.forEach(function(Ps){return t(U,Ps)}),Ve&&ts(U,ke),ve}function _e(U,j,$,I){if($==null)throw Error(l(151));for(var ve=null,Fe=null,Ee=j,ke=j=0,sn=null,Xe=$.next();Ee!==null&&!Xe.done;ke++,Xe=$.next()){Ee.index>ke?(sn=Ee,Ee=null):sn=Ee.sibling;var Ps=C(U,Ee,Xe.value,I);if(Ps===null){Ee===null&&(Ee=sn);break}e&&Ee&&Ps.alternate===null&&t(U,Ee),j=c(Ps,j,ke),Fe===null?ve=Ps:Fe.sibling=Ps,Fe=Ps,Ee=sn}if(Xe.done)return r(U,Ee),Ve&&ts(U,ke),ve;if(Ee===null){for(;!Xe.done;ke++,Xe=$.next())Xe=K(U,Xe.value,I),Xe!==null&&(j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe);return Ve&&ts(U,ke),ve}for(Ee=s(Ee);!Xe.done;ke++,Xe=$.next())Xe=B(Ee,U,ke,Xe.value,I),Xe!==null&&(e&&(sn=Xe.alternate,sn!==null&&Ee.delete(sn.key===null?ke:sn.key)),j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe);return e&&Ee.forEach(function(Tz){return t(U,Tz)}),Ve&&ts(U,ke),ve}function He(U,j,$,I){if(typeof $=="object"&&$!==null&&$.type===J&&$.key===null&&$.props.ref===void 0&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case ye:e:{for(var ve=$.key;j!==null;){if(j.key===ve){if(ve=$.type,ve===J){if(j.tag===7){r(U,j.sibling),I=o(j,$.props.children),Es(I,$),I.return=U,U=I;break e}}else if(j.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===Se&&Ca(ve)===j.type){r(U,j.sibling),I=o(j,$.props),Es(I,$),I.return=U,U=I;break e}r(U,j);break}else t(U,j);j=j.sibling}$.type===J?(I=Oa($.props.children,U.mode,I,$.key),Es(I,$),I.return=U,U=I):(I=ac($.type,$.key,$.props,null,U.mode,I),Es(I,$),I.return=U,U=I)}return h(U);case ue:e:{for(ve=$.key;j!==null;){if(j.key===ve)if(j.tag===4&&j.stateNode.containerInfo===$.containerInfo&&j.stateNode.implementation===$.implementation){r(U,j.sibling),I=o(j,$.children||[]),I.return=U,U=I;break e}else{r(U,j);break}else t(U,j);j=j.sibling}I=jd($,U.mode,I),I.return=U,U=I}return h(U);case Se:return $=Ca($),He(U,j,$,I)}if(Ae($))return oe(U,j,$,I);if(re($)){if(ve=re($),typeof ve!="function")throw Error(l(150));return $=ve.call($),_e(U,j,$,I)}if(typeof $.then=="function")return He(U,j,gc($),I);if($.$$typeof===fe)return He(U,j,dc(U,$),I);vc(U,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,j!==null&&j.tag===6?(r(U,j.sibling),I=o(j,$),I.return=U,U=I):(r(U,j),I=Md($,U.mode,I),I.return=U,U=I),h(U)):r(U,j)}return function(U,j,$,I){try{Bo=0;var ve=He(U,j,$,I);return Ol=null,ve}catch(Ee){if(Ee===El||Ee===mc)throw Ee;var Fe=di(29,Ee,null,U.mode);return Fe.lanes=I,Fe.return=U,Fe}}}var Ua=Fg(!0),Qg=Fg(!1),Os=!1;function Bd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ns(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function As(e,t,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(it&2)!==0){var o=s.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),s.pending=t,t=sc(e),Rg(e,null,r),t}return rc(e,s,t,r),sc(e)}function qo(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,Jt(e,r)}}function Vd(e,t){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var o=null,c=null;if(r=r.firstBaseUpdate,r!==null){do{var h={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};c===null?o=c=h:c=c.next=h,r=r.next}while(r!==null);c===null?o=c=t:c=c.next=t}else o=c=t;r={baseState:s.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:s.shared,callbacks:s.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}var Id=!1;function Vo(){if(Id){var e=Tl;if(e!==null)throw e}}function Io(e,t,r,s){Id=!1;var o=e.updateQueue;Os=!1;var c=o.firstBaseUpdate,h=o.lastBaseUpdate,_=o.share)DELIM" -R"DELIM(d.pending;if(_!==null){o.shared.pending=null;var N=_,Z=N.next;N.next=null,h===null?c=Z:h.next=Z,h=N;var q=e.alternate;q!==null&&(q=q.updateQueue,_=q.lastBaseUpdate,_!==h&&(_===null?q.firstBaseUpdate=Z:_.next=Z,q.lastBaseUpdate=N))}if(c!==null){var K=o.baseState;h=0,q=Z=N=null,_=c;do{var C=_.lane&-536870913,B=C!==_.lane;if(B?(Ye&C)===C:(s&C)===C){C!==0&&C===ka&&(Id=!0),q!==null&&(q=q.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var oe=e,_e=_;C=t;var He=r;switch(_e.tag){case 1:if(oe=_e.payload,typeof oe=="function"){K=oe.call(He,K,C);break e}K=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=_e.payload,C=typeof oe=="function"?oe.call(He,K,C):oe,C==null)break e;K=ne({},K,C);break e;case 2:Os=!0}}C=_.callback,C!==null&&(e.flags|=64,B&&(e.flags|=8192),B=o.callbacks,B===null?o.callbacks=[C]:B.push(C))}else B={lane:C,tag:_.tag,payload:_.payload,callback:_.callback,next:null},q===null?(Z=q=B,N=K):q=q.next=B,h|=C;if(_=_.next,_===null){if(_=o.shared.pending,_===null)break;B=_,_=B.next,B.next=null,o.lastBaseUpdate=B,o.shared.pending=null}}while(!0);q===null&&(N=K),o.baseState=N,o.firstBaseUpdate=Z,o.lastBaseUpdate=q,c===null&&(o.shared.lanes=0),Us|=h,e.lanes=h,e.memoizedState=K}}function Jg(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Xg(e,t){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;ec?c:8;var h=pe.T,_={};_.types=h!==null?h.types:null,pe.T=_,ch(e,!1,t,r);try{var N=o(),Z=pe.S;if(Z!==null&&Z(_,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var q=Px(N,s);Yo(e,t,q,ki(e))}else Yo(e,t,s,ki(e))}catch(K){Yo(e,t,{then:function(){},status:"rejected",reason:K},ki())}finally{Ne.p=c,h!==null&&_.types!==null&&(h.types=_.types),pe.T=h}}function Jx(){}function oh(e,t,r,s){if(e.tag!==5)throw Error(l(476));var o=Mv(e).queue;Av(e,o,t,Bt,r===null?Jx:function(){return jv(e),r(s)})}function Mv(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Bt,baseState:Bt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:Bt},next:null};var r={};return t.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:r},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function jv(e){var t=Mv(e);t.next===null&&(t=e.alternate.memoizedState),Yo(e,t.next.queue,{},ki())}function uh(){return An(Fl)}function kv(){return Xt().memoizedState}function Rv(){return Xt().memoizedState}function Xx(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var r=ki();e=Ns(r);var s=As(t,e,r);s!==null&&(gi(s,t,r),qo(s,t,r)),t={cache:Zd()},e.payload=t;return}t=t.return}}function Wx(e,t,r){var s=ki();r={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Oc(e)?Dv(t,r):(r=Nd(e,t,r,s),r!==null&&(gi(r,e,s),Uv(r,t,s)))}function Cv(e,t,r){var s=ki();Yo(e,t,r,s)}function Yo(e,t,r,s){var o={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Oc(e))Dv(t,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var h=t.lastRenderedState,_=c(h,r);if(o.hasEagerState=!0,o.eagerState=_,ut(_,h))return rc(e,t,o,0),bt===null&&ic(),!1}catch{}if(r=Nd(e,t,o,s),r!==null)return gi(r,e,s),Uv(r,t,s),!0}return!1}function ch(e,t,r,s){if(s={lane:2,revertLane:em(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Oc(e)){if(t)throw Error(l(479))}else t=Nd(e,r,s,2),t!==null&&gi(t,e,2)}function Oc(e){var t=e.alternate;return e===Le||t!==null&&t===Le}function Dv(e,t){Nl=_c=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Uv(e,t,r){if((r&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,Jt(e,r)}}var Nc={readContext:An,use:wc,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useLayoutEffect:It,useInsertionEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useSyncExternalStore:It,useId:It,useHostTransitionStatus:It,useFormState:It,useActionState:It,useOptimistic:It,useMemoCache:It,useCacheRefresh:It,useEffectEvent:It},Zv={readContext:An,use:wc,useCallback:function(e,t){return ni().memoizedState=[e,t===void 0?null:t],e},useContext:An,useEffect:_v,useImperativeHandle:function(e,t,r){r=r!=null?r.concat([e]):null,Tc(4194308,4,zv.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Tc(4194308,4,e,t)},useInsertionEffect:function(e,t){Tc(4,2,e,t)},useMemo:function(e,t){var r=ni();t=t===void 0?null:t;var s=e();if(Za){Tt(!0);try{e()}finally{Tt(!1)}}return r.memoizedState=[s,t],s},useReducer:function(e,t,r){var s=ni();if(r!==void 0){var o=r(t);if(Za){Tt(!0);try{r(t)}finally{Tt(!1)}}}else o=t;return s.memoizedState=s.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},s.queue=e,e=e.dispatch=Wx.bind(null,Le,e),[s.memoizedState,e]},useRef:function(e){var t=ni();return e={current:e},t.memoizedState=e},useState:function(e){e=ih(e);var t=e.queue,r=Cv.)DELIM" -R"DELIM(bind(null,Le,t);return t.dispatch=r,[e.memoizedState,r]},useDebugValue:ah,useDeferredValue:function(e,t){var r=ni();return lh(r,e,t)},useTransition:function(){var e=ih(!1);return e=Av.bind(null,Le,e.queue,!0,!1),ni().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,r){var s=Le,o=ni();if(Ve){if(r===void 0)throw Error(l(407));r=r()}else{if(r=t(),bt===null)throw Error(l(349));(Ye&127)!==0||rv(s,t,r)}o.memoizedState=r;var c={value:r,getSnapshot:t};return o.queue=c,_v(av.bind(null,s,c,e),[e]),s.flags|=2048,Ml(9,{destroy:void 0},sv.bind(null,s,c,r,t),null),r},useId:function(){var e=ni(),t=bt.identifierPrefix;if(Ve){var r=Mr,s=Ar;r=(s&~(1<<32-Nt(s)-1)).toString(32)+r,t="_"+t+"R_"+r,r=Sc++,0<\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof s.is=="string"?h.createElement("select",{is:s.is}):h.createElement("select"),s.multiple?c.multiple=!0:s.size&&(c.size=s.size);break;default:c=typeof s.is=="string"?h.createElement(o,{is:s.is}):h.createElement(o)}}c[At]=t,c[bn]=s;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)c.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=c;e:switch(Rn(c,o,s),o){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&ls(t)}}return zt(t),t.subtreeFlags&=-33554433,wh(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,r),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ls(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(l(166));if(e=Kn.current,zl(t)){if(e=t.stateNode,r=t.memoizedProps,s=null,o=xn,o!==null)switch(o.tag){case 27:case 5:s=o.memoizedProps}e[At]=t,e=!!(e.nodeValue===r||s!==null&&s.suppressHydrationWarning===!0||a0(e.nodeValue,r)),e||zs(t,!0)}else e=lu(e).createTextNode(s),e[At]=t,t.stateNode=e}return zt(t),null;case 31:if(r=t.memoizedState,e===null||e.memoizedState!==null){if(s=zl(t),r!==null){if(e===null){if(!s)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[At]=t}else Na(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zt(t),e=!1}else r=Cd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return t.flags&256?(Ni(t),t):(Ni(t),null);if((t.flags&128)!==0)throw Error(l(558))}return zt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=zl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(l(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(l(317));o[At]=t}else Na(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zt(t),o=!1}else o=Cd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Ni(t),t):(Ni(t),null)}return Ni(t),(t.flags&128)!==0?(t.lanes=r,t):(r=s!==null,e=e!==null&&e.memoizedState!==null,r&&(s=t.child,o=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(o=s.alternate.memoizedState.cachePool.pool),c=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),c!==o&&(s.flags|=2048)),r!==e&&r&&(t.child.flags|=8192),Cc(t,t.updateQueue),zt(t),null);case 4:return Ce(),e===null&&rm(t.stateNode.containerInfo),t.flags|=67108864,zt(t),null;case 10:return is(t.type),zt(t),null;case 19:if(Yd(t),s=t.memoizedState,s===null)return zt(t),null;if(o=(t.flags&128)!==0,c=s.rendering,c===null)if(o)Qo(s,!1);else{if(Pt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=bc(e),c!==null){for(t.flags|=128,Qo(s,!1),e=c.updateQueue,t.updateQueue=e,Cc(t,e),t.subtreeFlags=0,e=r,r=t.child;r!==null;)Cg(r,e),r=r.sibling;return Po(t,jn.current&1|2),Ve&&ts(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Yt()>Kc&&(t.flags|=128,o=!0,Qo(s,!1),t.lanes=4194304)}else{if(!o)if(e=bc(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Cc(t,e),Qo(s,!0),s.tail===null&&s.tailMode!=="collapsed"&&s.tailMode!=="visible"&&!c.alternate&&!Ve)return zt(t),null}else 2*Yt()-s.renderingStartTime>Kc&&r!==536870912&&(t.flags|=128,o=!0,Qo(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(e=s.last,e!==null?e.sibling=c:t.child=c,s.last=c)}if(s.tail!==null){e=s.tail;e:{for(r=e;r!==null;){if(r.alternate!==null){r=!1;break e}r=r.sibling}r=!0}return s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Yt(),e.sibling=null,c=jn.current,c=o?c&1|2:c&1,s.tailMode==="visible"||s.tailMode==="collapsed"||!r||Ve?Po(t,c):(r=c,tt(Mn,t),tt(jn,r),Vn===null&&(Vn=t)),Ve&&ts(t,s.treeForkCount),e}return zt(t),null;case 22:case 23:return Ni(t),Kd(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(r&536870912)!==0&&(t.flags&128)===0&&(zt(t),t.subtreeFlags&6&&(t.flags|=8192)):zt(t),r=t.updateQueue,r!==null&&Cc(t,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==r&&(t.flags|=2048),e!==null&&Ut(Ra),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),is(tn),zt(t),null;case 25:return null;case 30:return t.flags|=33554432,zt(t),null}throw Error(l(156,t.tag))}function aw(e,t){switch(kd(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return is(tn),Ce(),e=t.flags,(e&65536)!==0&)DELIM" -R"DELIM(&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return nt(t),null;case 31:if(t.memoizedState!==null){if(Ni(t),t.alternate===null)throw Error(l(340));Na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ni(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Yd(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Ce(),null;case 10:return is(t.type),null;case 22:case 23:return Ni(t),Kd(),e!==null&&Ut(Ra),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return is(tn),null;case 25:return null;default:return null}}function oy(e,t){switch(kd(t),t.tag){case 3:is(tn),Ce();break;case 26:case 27:case 5:nt(t);break;case 4:Ce();break;case 31:t.memoizedState!==null&&Ni(t);break;case 13:Ni(t);break;case 19:Yd(t);break;case 10:is(t.type);break;case 22:case 23:Ni(t),Kd(),e!==null&&Ut(Ra);break;case 24:is(tn)}}function Jo(e,t){try{var r=t.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var o=s.next;r=o;do{if((r.tag&e)===e){s=void 0;var c=r.create,h=r.inst;s=c(),h.destroy=s}r=r.next}while(r!==o)}}catch(_){ft(t,t.return,_)}}function Rs(e,t,r){try{var s=t.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var c=o.next;s=c;do{if((s.tag&e)===e){var h=s.inst,_=h.destroy;if(_!==void 0){h.destroy=void 0,o=t;var N=r,Z=_;try{Z()}catch(q){ft(o,N,q)}}}s=s.next}while(s!==c)}}catch(q){ft(t,t.return,q)}}function uy(e){var t=e.updateQueue;if(t!==null){var r=e.stateNode;try{Xg(t,r)}catch(s){ft(e,e.return,s)}}}function cy(e,t,r){r.props=$a(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(s){ft(e,t,s)}}function jr(e,t){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:var o=e.stateNode,c=Xr(e.memoizedProps,o);(o.ref===null||o.ref.name!==c)&&(o.ref=v0(c)),s=o.ref;break;case 7:if(e.stateNode===null){var h=new Ri(e);y(e.child,!1,Qw,h,void 0,void 0),e.stateNode=h}s=e.stateNode;break;default:s=e.stateNode}typeof r=="function"?e.refCleanup=r(s):r.current=s}}catch(_){ft(e,t,_)}}function kn(e,t){var r=e.ref,s=e.refCleanup;if(r!==null)if(typeof s=="function")try{s()}catch(o){ft(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(o){ft(e,t,o)}else r.current=null}function Dc(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var r=0;r title"))),Rn(s,t,r),s[At]=e,Wt(s),t=s;break e;case"link":if(c=C0("link","href",o).get(t+(r.href||""))){for(h=0;hHe&&(h=He,He=_e,_e=h);var U=xg(_,_e),j=xg(_,He);if(U&&j&&(B.rangeCount!==1||B.anchorNode!==U.node||B.anchorOffset!==U.offset||B.focusNode!==j.node||B.focusOffset!==j.offset)){var $=K.createRange();$.setStart(U.node,U.offset),B.removeAllRanges(),_e>He?(B.addRange($),B.extend(j.node,j.offset)):($.setEnd(j.node,j.offset),B.addRange($))}}}}for(K=[],B=_;B=B.parentNode;)B.nodeType===1&&K.push({element:B,left:B.scrollLeft,top:B.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_r?32:r,pe.T=null,r=Ih,Ih=null;var c=pr,h=Zr;if(Lt=0,qa=pr=null,Zr=0,(it&6)!==0)throw Error(l(331));var _=it;if(it|=4,Ry(c.current),My(c,c.current,h,r),it=_,ru(0,!1),Ft&&typeof Ft.onPostCommitFiberRoot=="function")try{Ft.onPostCommitFiberRoot(sa,c)}catch{}return!0}finally{Ne.p=o,pe.T=s,Yy(e,t)}}function Fy(e,t,r){t=Ii(r,t),t=hh(e.stateNode,t,2),e=As(e,t,2),e!==null&&(ci(e,2),$r(e))}function ft(e,t,r){if(e.tag===3)Fy(e,e,r);else for(;t!==null;){if(t.tag===3){Fy(t,e,r);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Zs===null||!Zs.has(s))){e=Ii(r,e),r=Pv(2),s=As(t,r,2),s!==null&&(Kv(r,)DELIM" -R"DELIM(s,t,e),ci(s,2),$r(s));break}}t=t.return}}function Jh(e,t,r){var s=e.pingCache;if(s===null){s=e.pingCache=new cw;var o=new Set;s.set(t,o)}else o=s.get(t),o===void 0&&(o=new Set,s.set(t,o));o.has(r)||(Bh=!0,o.add(r),e=yw.bind(null,e,t,r),t.then(e,e))}function yw(e,t,r){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,bt===e&&(Ye&r)===r&&((Pt===4||Pt===3&&(Ye&62914560)===Ye&&300>Yt()-Pc)&&(it&2)===0?Bl(e,0):Ic|=r,Ul===Ye&&(Ul=0)),$r(e)}function Qy(e,t){t===0&&(t=vs()),e=Ea(e,t),e!==null&&(ci(e,t),$r(e))}function bw(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Qy(e,r)}function _w(e,t){var r=0;switch(e.tag){case 31:case 13:var s=e.stateNode,o=e.memoizedState;o!==null&&(r=o.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(l(314))}s!==null&&s.delete(t),Qy(e,r)}function Sw(e,t){return Fn(e,t)}var Vl=null,Il=null,Xh=!1,Wc=!1,Wh=!1,Ls=0;function $r(e){e!==Il&&e.next===null&&(Il===null?Vl=Il=e:Il=Il.next=e),Wc=!0,Xh||(Xh=!0,ww())}function ru(e,t){if(!Wh&&Wc){Wh=!0;do for(var r=!1,s=Vl;s!==null;){if(e!==0){var o=s.pendingLanes;if(o===0)var c=0;else{var h=s.suspendedLanes,_=s.pingedLanes;c=(1<<31-Nt(42|e)+1)-1,c&=o&~(h&~_),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(r=!0,e0(s,c))}else c=Ye,c=al(s,s===bt?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(c&3)===0||la(s,c)||(r=!0,e0(s,c));s=s.next}while(r);Wh=!1}}function xw(){Jy()}function Jy(){Wc=Xh=!1;var e=0;Ls!==0&&Cw()&&(e=Ls);for(var t=Yt(),r=null,s=Vl;s!==null;){var o=s.next,c=Xy(s,t);c===0?(s.next=null,r===null?Vl=o:r.next=o,o===null&&(Il=r)):(r=s,(e!==0||(c&3)!==0)&&(Wc=!0)),s=o}Lt!==0&&Lt!==5||ru(e),Ls!==0&&(Ls=0)}function Xy(e,t){for(var r=e.suspendedLanes,s=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0_)break;var q=N.transferSize,K=N.initiatorType;q&&l0(K)&&(N=N.responseEnd,h+=q*(N<_?1:(_-Z)/(N-Z)))}if(--s,t+=8*(c+h)/(o.duration/1e3),e++,10sf){_e.length=oe;break}$=new Promise(Hw.bind($)),_e.push($)}}}if(0<_e.length)return C=Promise.race([Promise.all(_e),new Promise(function(ve){return setTimeout(ve,500)})]).then(o,o),(B?Promise.allSettled([B.finished,C]):C).then(c,c);if(o(),B)return B.finished.then(c,c);c()},types:r});Z.__reactViewTransition=q;var K=[];return q.ready.then(function(){for(var C=Z.documentElement.getAnimations({subtree:!0}),B=0;B"u"?null:document;function M0(e,t,r){var s=Kl;if(s&&typeof t=="string"&&t){var o=Xn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof r=="string"&&(o+='[crossorigin="'+r+'"]'),A0.has(o)||(A0.add(o),e={rel:e,crossOrigin:r,href:t},s.querySelector(o)===null&&(t=s.createElement("link"),Rn(t,"link",e),Wt(t),s.head.appendChild(t)))}}function sz(e){us.D(e),M0("dns-prefetch",e,null)}function az(e,t){us.C(e,t),M0("preconnect",e,t)}function lz(e,t,r){us.L(e,t,r);var s=Kl;if(s&&e&&t){var o='link[rel="preload"][as="'+Xn(t)+'"]';t==="image"&&r&&r.imageSrcSet?(o+='[imagesrcset="'+Xn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(o+='[imagesizes="'+Xn(r.imageSizes)+'"]')):o+='[href="'+Xn(e)+'"]';var c=o;switch(t){case"style":c=Gl(e);break;case"script":c=Yl(e)}if(!(Qi.has(c)||(e=ne({rel:"preload",href:t==="image"&&r&&r.imageSrcSet?void 0:e,as:t},r),Qi.set(c,e),s.querySelector(o)!==null||t==="style"&&s.querySelector(uu(c))||t==="script"&&s.querySelector(cu(c))))){var h=s.createElement("link");Rn(h,"link",e),t==="style"&&(h[cn]=!0,h.onload=h.onerror=function(){Iu(h)}),Wt(h),s.head.appendChild(h)}}}function oz(e,t){us.m(e,t);var r=Kl;if(r&&e){var s=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Xn(s)+'"][href="'+Xn(e)+'"]',c=o;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Yl(e)}if(!Qi.has(c)&&(e=ne({rel:"modulepreload",href:e},t),Qi.set(c,e),r.querySelector(o)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(cu(c)))return}s=r.createElement("link"),Rn(s,"link",e),Wt(s),r.head.appendChild(s)}}}function uz(e,t,r){us.S(e,t,r);var s=Kl;if(s&&e){var o=bs(s).hoistableStyles,c=Gl(e);t=t||"default";var h=o.get(c);if(!h){var _={loading:0,preload:null};if(h=s.querySelector(uu(c)))_.loading=5;else{e=ne({rel:"stylesheet",href:e,"data-precedence":t},r),(r=Qi.get(c))&&_m(e,r);var N=h=s.createElement("link");Wt(N),Rn(N,"link",e),N._p=new Promise(function(Z,q){N.onload=Z,N.onerror=q}),N.addEventListener("load",function(){_.loading|=1}),N.addEventListener("error",function(){_.loading|=2}),_.loading|=4,nf(h,t,s)}h={type:"stylesheet",instance:h,count:1,state:_},o.set(c,h)}}}function cz(e,t){us.X(e,t);var r=Kl;if(r&&e){var s=bs(r).hoistableScripts,o=Yl(e),c=s.get(o);c||(c=r.querySelector(cu(o)),c||(e=ne({src:e,async:!0},t),(t=Qi.get(o))&&Sm(e,t),c=r.createElement("script"),Wt(c),Rn(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function fz(e,t){us.M(e,t);var r=Kl;if(r&&e){var s=bs(r).hoistableScripts,o=Yl(e),c=s.get(o);c||(c=r.querySelector(cu(o)),c||(e=ne({src:e,async:!0,type:"module"},t),(t=Qi.get(o))&&Sm(e,t),c=r.createElement("script"),Wt(c),Rn(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function j0(e,t,r,s){var o=(o=Kn.current)?ou(o):null;if(!o)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(r=Gl(r.href),t=bs(o).hoistableStyles,s=t.get(r),s||(s={type:"style",instance:null,count:0,state:null},t.set(r,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=Gl(r.href);var c=bs(o).hoistableStyles,h=c.get(e);if(h||(o=o.ownerDocument||o,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,h),(c=o.querySelector(uu(e)))?c._p||(h.instance=c,h.state.loading=5):(c=Qi.get(e),c||(c={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Qi.set(e,c)),dz(o,e,c,h.state))),t&&s===null)throw Error(l(528,""));return h}if(t&&s!==null)throw Error(l(529,""));return null;case"script":return t=r.async,r=r.src,typeof r=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(r=Yl(r),t=bs(o).hoistableScripts,s=t.get(r),s||(s={type:"script",instance:null,count:0,state:null},t.set(r,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Gl(e){return'href="'+Xn(e)+'"'}function uu(e){return'link[rel="stylesheet"]['+e+"]"}function k0(e){return ne({},e,{"data-precedence":e.precedence,precedence:null})}function dz(e,t,r,s){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[cn]!==!0){s.loading=1;return}}else t=e.createElement("link"),t[cn]=!0,t.onload=t.onerror=Iu.bind(null,t),Rn(t,"link",r),Wt(t),e.head.appendChild(t);s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2})}function Yl(e){return'[src="'+Xn(e)+'"]'}function cu(e){return"script[async]"+e}function R0(e,t,r){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Xn(r.href)+'"]');if(s)return t.instance=s,Wt(s),s;var o=ne({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Wt(s),Rn(s,"style",o),nf(s,r.precedence,e),t.instance=s;case"stylesheet":o=Gl(r.href);var c=e.querySelector(uu(o));if(c)return t.state.loading|=4,t.instance=c,Wt(c),c;s=k0(r),(o=Qi.get(o))&&_m(s,o),c=(e.ownerDocument||e).createElement("link"),Wt(c);var h=c;return h._p=new Promise(function(_,N){h.onload=_,h.onerror=N}),Rn(c,"link",s),t.state.loading|=4,nf(c,r.precedence,e),t.instance=c;case"script":return c=Yl(r.src),(o=e.querySelector(cu(c)))?(t.instance=o,Wt(o),o):(s=r,(o=Qi.get(c))&&(s=ne({},r),Sm(s,o)),e=e.ownerDocument||e,o=e.createElement("script"),Wt(o),Rn(o,"link",s),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,nf(s,r.precedence,e));return t.instance}function nf(e,t,r){for(var s=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=s.length?s[s.length-1]:null,c=o,h=0;h title"):null)}function hz(e,t,r){if(r===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function D0(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function U0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Z0(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function $0(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=Z0(t),e.suspenseyImages.push(t)),e=gz.bind(e),t.decode().then(e,e))}function mz(e,t,r,s){if(r.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var o=Gl(s.href),c=t.querySelector(uu(o));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=fu.bind(e),t.then(e,e)),r.state.loading|=4,r.instance=c,Wt(c);return}c=t.ownerDocument||t,s=k0(s),(o=Qi.get(o))&&_m(s,o),c=c.createElement("link"),Wt(c);var h=c;h._p=new Promise(function(_,N){h.onload=_,h.onerror=N}),Rn(c,"link",s),r.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,t),(t=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=fu.bind(e),t.addEventListener("load",r),t.addEventListener("error",r))}}var sf=0;function pz(e,t){return e.stylesheets&&e.count===0&&lf(e,e.stylesheets),0sf?50:800)+t);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(o)}}:null}function L0(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)lf(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function fu(){this.count--,L0(this)}function gz(){this.imgCount--,L0(this)}var af=null;function lf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,af=new Map,t.forEach(vz,e),af=null,fu.call(e))}function vz(e,t){if(!(t.state.loading&4)){var r=af.get(e);if(r)var s=r.get(null);else{r=new Map,af.set(e,r);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),jm.exports=Cz(),jm.exports}var Uz=Dz();const Zz=s1(Uz),$z=[{id:"current",label:"Classic"},{id:"light",label:"Light"},{id:"midnight",label:"Midnight"}],Mp="libbitcoinTheme",Rf="libbitcoin-theme-change";function jp(n){return n==="light"||n==="midnight"?n:"current"}function a1(){try{return jp(localStorage.getItem(Mp))}catch{return"current"}}function kp(n){document.documentElement.dataset.theme=n;const i=getComputedStyle(document.documentElement).getPropertyValue("--theme-background").trim();i&&document.querySelector('meta[name="theme-color"]')?.setAttribute("content",i)}function Lz(){kp(a1()),globalThis.addEventListener("storage",qz)}function Hz(n){const i=jp(n);kp(i);try{localStorage.setItem(Mp,i)}catch{}globalThis.dispatchEvent(new Event(Rf))}function Bz(){return jp(document.documentElement.dataset.theme)}function qz(n){n.key!==null&&n.key!==Mp||(kp(a1()),globalThis.dispatchEvent(new Event(Rf)))}function Vz(n){return globalThis.addEventListener(Rf,n),()=>{globalThis.removeEventListener(Rf,n)}}function Rp(){return se.useSyncExternalStore(Vz,Bz,()=>"current")}function Iz(){const n=Rp();return x.jsx("select",{"aria-label":"Theme",value:n,onChange:i=>{Hz(i.target.value)},className:"border-accent/40 bg-surface text-textPrimary focus:border-accent focus:ring-)DELIM" -R"DELIM(accent rounded-md border py-1.5 pr-8 pl-3 text-sm",children:$z.map(i=>x.jsx("option",{value:i.id,children:i.label},i.id))})}const l1="libbitcoinAdminDashboardBrowserNotifications";function o1(){try{return globalThis.window?.localStorage??null}catch{return null}}function Cp(){const n=globalThis.Notification;return typeof n=="function"?n:null}function u1(){return Cp()?.permission??"unsupported"}async function Pz(){const n=Cp();return n?n.permission!=="default"?n.permission:n.requestPermission():"unsupported"}function Kz(n=o1()){try{return u1()==="granted"&&n?.getItem(l1)==="true"}catch{return!1}}function Gz(n,i=o1()){try{i?.setItem(l1,String(n))}catch{}}function Yz(n,i){const a=Cp();if(!a||a.permission!=="granted")return!1;try{return new a(n,i),!0}catch{return!1}}function Fz({browserNotificationsEnabled:n,onClose:i,onBrowserNotificationsEnabledChange:a}){const[l,u]=se.useState(u1),[f,d]=se.useState(!1),[m,p]=se.useState(null),g=n&&l==="granted";async function b(){if(g){a(!1);return}d(!0),p(null);try{const y=await Pz();u(y),y==="granted"?a(!0):y==="denied"&&p("Permission was denied. It can be changed in your browser settings.")}catch{p("The browser could not enable notifications.")}finally{d(!1)}}return x.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&i()},children:x.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",className:"border-accent/30 bg-surface/95 max-h-[calc(100vh-2rem)] w-full max-w-xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/50",children:[x.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[x.jsx("h2",{id:"settings-title",className:"text-accent text-xl font-semibold",children:"Settings"}),x.jsx("button",{type:"button",onClick:i,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close settings",children:"×"})]}),x.jsxs("div",{className:"space-y-5 p-5",children:[x.jsx(Iz,{}),x.jsxs("div",{className:"border-accentSecondary/20 bg-accent/5 space-y-3 rounded-xl border p-4",children:[x.jsxs("div",{children:[x.jsx("h3",{className:"text-textPrimary text-sm font-medium",children:"Browser notifications"}),x.jsx("p",{id:"browser-notifications-help",className:"text-textMuted mt-1 text-xs",children:Jz(l,g,f)})]}),x.jsx("button",{type:"button","aria-describedby":"browser-notifications-help",disabled:f||l==="unsupported"||l==="denied",onClick:()=>{b()},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:Qz(l,g,f)}),m&&x.jsx("p",{className:"text-sm text-red-300",role:"alert",children:m})]}),x.jsx("div",{className:"flex justify-end pt-2",children:x.jsx("button",{type:"button",onClick:i,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-4 py-2 text-sm",children:"Done"})})]})]})})}function Qz(n,i,a){return a?"Requesting permission…":n==="unsupported"?"Notifications unavailable":n==="denied"?"Blocked by browser":i?"Disable notifications":"Enable notifications"}function Jz(n,i,a){return a?"Waiting for your browser permission choice.":n==="unsupported"?"This browser does not support system notifications.":n==="denied"?"Notifications are blocked. Allow them in your browser settings to enable this feature.":i?"System notifications will appear when the node enters or leaves the near-current range.":"Get a system notification when the node enters or leaves the near-current range."}function Xm(n){const i=Object.values(n).filter(l=>typeof l=="number");return Object.entries(n).filter(([l,u])=>i.indexOf(+l)===-1).map(([l,u])=>u)}function ub(n,i="|"){return n.map(a=>p1(a)).join(i)}function Wm(n,i){return typeof i=="bigint"?i.toString():i}class Xz{constructor(i){this._getter=i,this._value=void 0}get value(){const i=this._getter;return i!==void 0&&(this._value=i(),this._getter=void 0),this._value}}function Dp(n){return new Xz(n)}function Wz(n){return n==null}function Up(n){const i=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;return n.slice(i,a)}function eT(n,i){const a=n/i,l=Math.round(a),u=4*Number.EPSILON*Math.max(Math.abs(a),1);return Math.abs(a-l){const m=i._zod.def.shape[f];return l?l(m,f):m}):d1(n,f,l?l(d.value,f):d.value))}}function tT(n,i){for(const a of Reflect.ownKeys(i)){const l=Object.getOwnPropertyDescriptor(i,a);l.enumerable&&(l.get?f1(n,a,()=>i[a]):d1(n,a,l.value))}}function Di(...n){const i={};for(const a of n){const l=Object.getOwnPropertyDescriptors(a);Object.assign(i,l)}return Object.defineProperties({},i)}function nT(n){return JSON.stringify(n)}function iT(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const h1="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function Cf(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const rT=Dp(()=>{if(er.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function io(n){if(Cf(n)===!1)return!1;const i=n.constructor;if(i===void 0||typeof i!="function")return!0;const a=i.prototype;return!(Cf(a)===!1||Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")===!1)}function m1(n){return io(n)?{...n}:Array.isArray(n)?[...n]:n instanceof Map?new Map(n):n instanceof Set?new Set(n):n}const sT=new Set(["string","number","symbol"]);function ro(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function na(n,i,a){const l=new n._zod.constr(i??n._zod.def);return(!i||a?.parent)&&(l._zod.parent=n),l}function Te(n){const i=n;if(!i)return{};if(typeof i=="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");i.error=i.message}return delete i.message,typeof i.error=="string"?{...i,error:()=>i.error}:i}function p1(n){return typeof n=="bigint"?n.toString()+"n":typeof n=="string"?`"${n}"`:`${n}`}function aT(n){return Object.keys(n).filter(i=>n[i]._zod.optin!==void 0&&n[i]._zod.optout==="optional")}const g1={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]},lT={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function oT(n,i){const a=n._zod.def,l=a.checks;if(l&&l.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const f={};return Wa(f,n,Qf(n,i)),na(n,Di(a,{shape:f,checks:[]}))}function Qf(n,i){const a=hs(n),l=[];for(const u of Reflect.ownKeys(i)){if(!Object.getOwnPropertyDescriptor(a,u)?.enumerable)throw new Error(`Unrecognized key: "${String(u)}"`);i[u]&&l.push(u)}return l}function uT(n,i){const a=n._zod.def,l=a.checks;if(l&&l.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const f=new Set(Qf(n,i)),d={};return Wa(d,n,Reflect.ownKeys(hs(n)).filter(m=>!f.has(m))),na(n,Di(a,{shape:d,checks:[]}))}function cT(n,i){if(!io(i))throw new Error("Invalid input to extend: expected a plain object");const a=n._zod.def.checks;if(a&&a.length>0){const u=hs(n);for(const f of Reflect.ownKeys(i))if(Obje)DELIM" -R"DELIM(ct.getOwnPropertyDescriptor(u,f)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return na(n,Di(n._zod.def,{shape:v1(n,i)}))}function v1(n,i){const a={};return Wa(a,n,Reflect.ownKeys(hs(n))),tT(a,i),a}function fT(n,i){if(!io(i))throw new Error("Invalid input to safeExtend: expected a plain object");return na(n,Di(n._zod.def,{shape:v1(n,i)}))}function dT(n,i){if(!i?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(n._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const a={};Wa(a,n,Reflect.ownKeys(hs(n))),Wa(a,i,Reflect.ownKeys(hs(i)));const l=Di(n._zod.def,{shape:a,get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return na(n,l)}function cb(n,i,a,l="partial"){const f=i._zod.def.checks;if(f&&f.length>0)throw new Error(`.${l}() cannot be used on object schemas containing refinements`);const m=a?new Set(Qf(i,a)):void 0,p={};return Wa(p,i,Reflect.ownKeys(hs(i)),n&&((g,b)=>m&&!m.has(b)?g:new n({type:"optional",innerType:g}))),na(i,Di(i._zod.def,{shape:p,checks:[]}))}function hT(n,i,a){const l=a?new Set(Qf(i,a)):void 0,u={};return Wa(u,i,Reflect.ownKeys(hs(i)),(f,d)=>l&&!l.has(d)?f:new n({type:"nonoptional",innerType:f})),na(i,Di(i._zod.def,{shape:u}))}function _r(n,i=0){if(n.aborted===!0)return!0;for(let a=i;a{var l;return(l=a).path??(l.path=[]),a.path.unshift(n),a})}function vu(n){return typeof n=="string"?n:n?.message}function fb(n){const i=[];for(const a of n??[]){const l=a._zod.def;if(!/_(length|size)$|_equals$/.test(l.check))break;const u=l.maximum??l.length??l.size;u>=0&&i.push([u,a])}return i}function ep(n,i,a){var l;for(let u=i;un;return i[xT]=!0,i}var db;const Um={value:void 0,enumerable:!1};let hb="captureStackTrace"in Error?Error:null;function zT(n){const i=hb;if(i){const a=i.stackTraceLimit;if(typeof a=="number"){try{i.stackTraceLimit=0}catch{return hb=null,new n}try{return new n}finally{i.stackTraceLimit=a}}}return new n}function Y(n,i,a,l){const u={};function f(w){this.def=w,this.constr=y,this.traits=new Set}f.prototype=u;const d=a,m=d&&new WeakSet;function p(w,O){if(w._zod){if(w._zod.traits.has(n))return}else{Um.value=new f(O);try{Object.defineProperty(w,"_zod",Um)}finally{Um.value=void 0}}if(w._zod.traits.add(n),i(w,O),m){const A=Object.getPrototypeOf(w),k=w._zod.constr.prototype;let L=A;for(;L&&L!==k;)L=Object.getPrototypeOf(L);const D=L??A;m.has(D)||(m.add(D),vT(D,d))}const T=y.prototype;for(const A in T)Object.prototype.hasOwnProperty.call(T,A)&&(A in w||(w[A]=T[A].bind(w)))}const g=l?.Parent??Object;class b extends g{}Object.defineProperty(b,"name",{value:n});function y(w){const O=l?.Parent?zT(b):this;p(O,w);const T=O._zod.deferred;if(T){for(const k of T)k();O._zod.deferred=void 0}const A=globalThis.__zod_globalConfig?.postProcessor;return A&&A(O),O}return Object.defineProperty(y,"init",{value:p}),Object.defineProperty(y,Symbol.hasInstance,{value:w=>l?.Parent&&w instanceof l.Parent?!0:w?._zod?.traits?.has(n)}),Object.defineProperty(y,"name",{value:n}),y}class Ja extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _1 extends Error{constructor(i){super(`Encountered unidirectional transform during encode: ${i}`),this.name="ZodEncodeError"}}(db=globalThis).__zod_globalConfig??(db.__zod_globalConfig={});const er=globalThis.__zod_globalConfig;function Br(n){return n&&Object.assign(er,n),er}function TT(){const n=this._zod;return n.message??(n.message=JSON.stringify(n.def,Wm,2)),n.message}function ET(n){this._zod.message=n}const OT={get:TT,set:ET,enumerable:!0,configurable:!0},Zm={value:void 0,enumerable:!1},mb=new WeakSet([Object.prototype,Error.prototype]),NT=(n,i)=>{n.name="$ZodError",Zm.value=i,Object.defineProperty(n,"issues",Zm),Zm.value=void 0,Object.defineProperty(n,"message",OT);const a=Object.getPrototypeOf(n);mb.has(a)||(mb.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){const l=()=>this.message;return Object.defineProperty(this,"toString",{value:l,configurable:!0,writable:!0}),l},set(l){Object.defineProperty(this,"toString",{value:l,configurable:!0,writable:!0})}}))},AT=Y("$ZodError",NT);function MT(n,i,a){return Object.prototype.hasOwnProperty.call(n,i)||(i==="__proto__"?Object.defineProperty(n,i,{value:a(),writable:!0,enumerable:!0,configurable:!0}):n[i]=a()),n[i]}function jT(n,i=a=>a.message){const a={},l=[];for(const u of n.issues)u.path.length>0?MT(a,u.path[0],()=>[]).push(i(u)):l.push(i(u));return{formErrors:l,fieldErrors:a}}function kT(n,i=a=>a.message){const a={_errors:[]},l=(u,f=[])=>{for(const d of u.issues)if(d.code==="invalid_union"&&d.errors.length)d.errors.map(m=>l({issues:m},[...f,...d.path]));else if(d.code==="invalid_key")l({issues:d.issu)DELIM" -R"DELIM(es},[...f,...d.path]);else if(d.code==="invalid_element")l({issues:d.issues},[...f,...d.path]);else{const m=[...f,...d.path];if(m.length===0)a._errors.push(i(d));else{let p=a,g=0;for(;g{const i=(a,l,u,f)=>{const d=u?{...u,async:!1}:{async:!1},m=a._zod.run({value:l,issues:[]},d);if(m instanceof Promise)throw new Ja;if(m.issues.length){const p=new(f?.Err??n)(m.issues.map(g=>Js(g,d,Br())));throw h1(p,f?.callee??i),p}return m.value};return i},Hp=n=>{const i=async(a,l,u,f)=>{const d=u?{...u,async:!0}:{async:!0};let m=a._zod.run({value:l,issues:[]},d);if(m instanceof Promise&&(m=await m),m.issues.length){const p=new(f?.Err??n)(m.issues.map(g=>Js(g,d,Br())));throw h1(p,f?.callee??i),p}return m.value};return i},Bp=n=>(i,a,l)=>{const u=l?{...l,async:!1}:{async:!1},f=i._zod.run({value:a,issues:[]},u);if(f instanceof Promise)throw new Ja;return f.issues.length?S1(n,f.issues,u):{success:!0,data:f.value}};function S1(n,i,a){let l;return{success:!1,get error(){return l||(l=new n(i.map(u=>Js(u,a,Br()))),i=void 0,a=void 0),l},set error(u){l=u,i=void 0,a=void 0}}}const qp=n=>async(i,a,l)=>{const u=l?{...l,async:!0}:{async:!0};let f=i._zod.run({value:a,issues:[]},u);return f instanceof Promise&&(f=await f),f.issues.length?S1(n,f.issues,u):{success:!0,data:f.value}},RT=Symbol.for("zod.compile.invalid"),CT=Symbol.for("zod.compile.fallback"),DT=((n,i,a)=>{const l=n._zod.bag.validator;if(l!==void 0){if(l(i)!==RT)return!0;if(l.definite===!0&&a===void 0)return!1}return UT(n,i,a)});function UT(n,i,a){const l=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},u=n._zod.bag.fallbackRun;let f;if(u?(l[CT]=!0,f=u({value:i,issues:[]},l)):f=n._zod.run({value:i,issues:[]},l),f instanceof Promise)throw new Ja;return f.issues.length===0}const ZT=async(n,i,a)=>{const l=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let u=n._zod.run({value:i,issues:[]},l);return u instanceof Promise&&(u=await u),u.issues.length===0},$T=n=>{const i=Lp(n),a=(l,u,f,d)=>{const m=f?{...f,direction:"backward"}:{direction:"backward"};return i(l,u,m,Jf(a,d))};return a},LT=n=>{const i=Lp(n),a=(l,u,f,d)=>i(l,u,f,Jf(a,d));return a},HT=n=>{const i=Hp(n),a=async(l,u,f,d)=>{const m=f?{...f,direction:"backward"}:{direction:"backward"};return await i(l,u,m,Jf(a,d))};return a},BT=n=>{const i=Hp(n),a=async(l,u,f,d)=>await i(l,u,f,Jf(a,d));return a},qT=n=>(i,a,l)=>{const u=l?{...l,direction:"backward"}:{direction:"backward"};return Bp(n)(i,a,u)},VT=n=>(i,a,l)=>Bp(n)(i,a,l),IT=n=>async(i,a,l)=>{const u=l?{...l,direction:"backward"}:{direction:"backward"};return qp(n)(i,a,u)},PT=n=>async(i,a,l)=>qp(n)(i,a,l),KT=/^[cC][0-9a-z]{6,}$/,GT=/^[0-9a-z]+$/,YT=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,FT=/^[0-9a-vA-V]{20}$/,QT=/^[A-Za-z0-9]{27}$/,JT=/^[a-zA-Z0-9_-]{21}$/;function XT(n){return new RegExp(`^[a-zA-Z0-9_-]{${n}}$`)}const WT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,eE=/^([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})$/,pb=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[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)$/,tE=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,nE="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function iE(){return new RegExp(nE,"u")}const rE=/^(?:(?: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])$/,sE=/^(([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}|:))$/,aE=/^((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}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,oE=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uE=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,cE=/^https?$/,fE=/^\+[1-9]\d{6,14}$/,x1="(?:(?:\\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])))";function dE(n){return new RegExp(`^${n}$`)}const hE=dE(x1);function tp(n){const i="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${i}`:n.precision===0?`${i}:[0-5]\\d`:`${i}:[0-5]\\d\\.\\d{${n.precision}}`:n.seconds?`${i}:[0-5]\\d(?:\\.\\d+)?`:`${i}(?::[0-5]\\d(?:\\.\\d+)?)?`}function mE(n){return new RegExp(`^${tp(n)}$`)}function pE(n){const i=["Z"];n.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${tp({precision:n.precision,seconds:!0})}(?:${i.join("|")})`,l=n.local?`${a}|${tp({precision:n.precision})}`:a;return new RegExp(`^${x1}T(?:${l})$`)}const gE=/^[\s\S]{0,}$/,vE=/^-?\d+$/,Vp=/^-?\d+(?:\.\d+)?$/,yE=/^(?:true|false)$/i,bE=/^[^A-Z]*$/,_E=/^[^a-z]*$/,yi=Y("$ZodCheck",(n,i)=>{var a;n._zod??(n._zod={}),n._zod.def=i,(a=n._zod).onattach??(a.onattach=[])}),Ip=n=>{const i=n.value;return!Wz(i)&&i.length!==void 0},Df={number:"number",bigint:"bigint",object:"date"},w1=Y("$ZodCheckLessThan",(n,i)=>{yi.init(n,i);const a=Df[typeof i.value];n._zod.check=l=>{(i.inclusive?l.value<=i.value:l.value{yi.init(n,i);const a=Df[typeof i.value];n._zod.check=l=>{(i.inclusive?l.value>=i.value:l.value>i.value)||l.issues.push({origin:Df[typeof l.value]??a,code:"too_small",minimum:typeof i.value=="object"?i.value.getTime():i.value,input:l.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),SE=Y("$ZodCheckMultipleOf",(n,i)=>{yi.init(n,i),n._zod.check=a=>{if(typeof a.value!=typeof i.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof a.value=="bigint"?i.value!==BigInt(0)&&a.value%i.value===BigInt(0):eT(a.value,i.value)===0)||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:i.value,input:a.value,inst:n,continue:!i.abort})}}),xE=Y("$ZodCheckNumberFormat",(n,i)=>{yi.init(n,i),i.format=i.format||"float64";const a=i.format?.includes("int"),l=a?"int":"number",[u,f]=g1[i.format];n._zod.check=d=>{const m=d.value;if(a){if(!Number.isInteger(m)){d.issues.push({expected:l,format:i.format,code:"invalid_type",continue:!1,input:m,inst:n});return}if(!Number.isSafeInteger(m)){m>0?d.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:l,inclusive:!0,continue:!i.abort}):d.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst)DELIM" -R"DELIM(:n,origin:l,inclusive:!0,continue:!i.abort});return}}mf&&d.issues.push({origin:"number",input:m,code:"too_big",maximum:f,inclusive:!0,inst:n,continue:!i.abort})}}),wE=Y("$ZodCheckMaxLength",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Ip),n._zod.check=l=>{const u=l.value,f=u.length;if((typeof u=="string"&&f>i.maximum?Zp(u):f)<=i.maximum)return;const m=$p(u);l.issues.push({origin:m,code:"too_big",maximum:i.maximum,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),zE=Y("$ZodCheckMinLength",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Ip),n._zod.check=l=>{const u=l.value,f=u.length;if((typeof u=="string"&&f>=i.minimum&&f=i.minimum)return;const m=$p(u);l.issues.push({origin:m,code:"too_small",minimum:i.minimum,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),TE=Y("$ZodCheckLengthEquals",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Ip),n._zod.check=l=>{const u=l.value,f=u.length,d=typeof u=="string"&&f>=i.length&&f<=i.length*2?Zp(u):f;if(d===i.length)return;const m=$p(u),p=d>i.length;l.issues.push({origin:m,...p?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:l.value,inst:n,continue:!i.abort})}}),Xf=Y("$ZodCheckStringFormat",(n,i)=>{var a,l;yi.init(n,i),i.pattern?(a=n._zod).check??(a.check=u=>{i.pattern.lastIndex=0,!i.pattern.test(u.value)&&u.issues.push({origin:"string",code:"invalid_format",format:i.format,input:u.value,...i.pattern?{pattern:i.pattern.toString()}:{},inst:n,continue:!i.abort})}):(l=n._zod).check??(l.check=()=>{})}),EE=Y("$ZodCheckRegex",(n,i)=>{Xf.init(n,i),n._zod.check=a=>{i.pattern.lastIndex=0,!i.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),OE=Y("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=bE),Xf.init(n,i)}),NE=Y("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=_E),Xf.init(n,i)}),AE=Y("$ZodCheckIncludes",(n,i)=>{yi.init(n,i);const a=ro(i.includes),l=new RegExp(typeof i.position=="number"?`^.{${i.position},}${a}`:a);i.pattern=l,n._zod.check=u=>{u.value.includes(i.includes,i.position)||u.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:i.includes,input:u.value,inst:n,continue:!i.abort})}}),ME=Y("$ZodCheckStartsWith",(n,i)=>{yi.init(n,i);const a=new RegExp(`^${ro(i.prefix)}.*`);i.pattern??(i.pattern=a),n._zod.check=l=>{l.value.startsWith(i.prefix)||l.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:l.value,inst:n,continue:!i.abort})}}),jE=Y("$ZodCheckEndsWith",(n,i)=>{yi.init(n,i);const a=new RegExp(`.*${ro(i.suffix)}$`);i.pattern??(i.pattern=a),n._zod.check=l=>{l.value.endsWith(i.suffix)||l.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:l.value,inst:n,continue:!i.abort})}}),kE=Y("$ZodCheckOverwrite",(n,i)=>{yi.init(n,i),n._zod.check=a=>{a.value=i.tx(a.value)}});class RE{constructor(i=[],a={}){this.content=[],this.indent=0,this.args=i,this.closed=a}indented(i){this.indent+=1;try{i(this)}finally{this.indent-=1}}write(i){if(typeof i=="function"){i(this,{execution:"sync"}),i(this,{execution:"async"});return}const l=i.split(` +`);for(o=r=0;ro||N[r]!==Z[o]){var q=` +`+N[r].replace(" at new "," at ");return e.displayName&&q.includes("")&&(q=q.replace("",e.displayName)),q}while(1<=r&&0<=o);break}}}finally{oi=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?Zn(s):""}function Gn(e,t){switch(e.tag){case 26:case 27:case 5:return Zn(e.type);case 16:return Zn("Lazy");case 13:return e.child!==t&&t!==null?Zn("Suspense Fallback"):Zn("Suspense");case 19:return Zn("SuspenseList");case 0:case 15:return ns(e.type,!1);case 11:return ns(e.type.render,!1);case 1:return ns(e.type,!0);case 31:return Zn("Activity");case 30:return Zn("ViewTransition");default:return""}}function Yn(e){try{var t="",s=null;do t+=Gn(e,s),s=e,e=e.return;while(e);return t}catch(r){return` +Error generating stack: `+r.message+` +`+r.stack}}var yn=Object.prototype.hasOwnProperty,Fn=n.unstable_scheduleCallback,sa=n.unstable_cancelCallback,sl=n.unstable_shouldYield,mr=n.unstable_requestPaint,Yt=n.unstable_now,rl=n.unstable_getCurrentPriorityLevel,Qn=n.unstable_ImmediatePriority,al=n.unstable_UserBlockingPriority,ra=n.unstable_NormalPriority,gd=n.unstable_LowPriority,Pu=n.unstable_IdlePriority,vd=n.log,yd=n.unstable_setDisableYieldValue,aa=null,Ft=null;function Tt(e){if(typeof vd=="function"&&yd(e),Ft&&typeof Ft.setStrictMode=="function")try{Ft.setStrictMode(aa,e)}catch{}}var At=Math.clz32?Math.clz32:ui,pr=Math.log,gr=Math.LN2;function ui(e){return e>>>=0,e===0?32:31-(pr(e)/gr|0)|0}var is=256,ss=262144,la=4194304;function Ss(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ll(e,t,s){var r=e.pendingLanes;if(r===0)return 0;var o=0,c=e.suspendedLanes,m=e.pingedLanes;e=e.warmLanes;var _=r&134217727;return _!==0?(r=_&~c,r!==0?o=Ss(r):(m&=_,m!==0?o=Ss(m):s||(s=_&~e,s!==0&&(o=Ss(s))))):(_=r&~c,_!==0?o=Ss(_):m!==0?o=Ss(m):s||(s=r&~e,s!==0&&(o=Ss(s)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,s=t&-t,c>=s||c===32&&(s&4194048)!==0)?t:o}function oa(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function xs(e,t){(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0s;s++)t.push(e);return t}function ci(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function un(e,t,s,r,o,c){var m=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var _=e.entanglements,N=e.expirationTimes,Z=e.hiddenUpdates;for(s=m&~s;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ao=!1;if(as)try{var va={};Object.defineProperty(va,"passive",{get:function(){Ao=!0}}),window.addEventListener("test",va,va),window.removeEventListener("test",va,va)}catch{Ao=!1}var Ts=null,wi=null,zi=null;function Os(){if(zi)return zi;var e,t=wi,s=t.length,r,o="value"in Ts?Ts.value:Ts.textContent,c=o.length;for(e=0;e=K),de=" ",he=!1;function ge(e,t){switch(e){case"keyup":return R.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function De(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ve=!1;function Je(e,t){switch(e){case"compositionend":return De(t);case"keypress":return t.which!==32?null:(he=!0,de);case"textInput":return e=t.data,e===de&&he?null:e;default:return null}}function qe(e,t){if(Ve)return e==="compositionend"||!H&&ge(e,t)?(e=Os(),zi=wi=Ts=null,Ve=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function wg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function zg(e,t){var s=wg(e);e=0;for(var r;s;){if(s.nodeType===3){if(r=e+s.textContent.length,e<=t&&r>=t)return{node:s,offset:t-e};e=r}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=wg(s)}}function Eg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Eg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ed(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Ed(e.document)}return t}function Td(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Zx=as&&"documentMode"in document&&11>=document.documentMode,bl=null,Od=null,Uo=null,Nd=!1;function Og(e,t,s){var r=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Nd||bl==null||bl!==Ed(r)||(r=bl,"selectionStart"in r&&Td(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Uo&&Sr(Uo,r)||(Uo=r,r=sf(Od,"onSelect"),0>=m,o-=m,As=1<<32-At(t)+o|s<ke?(rn=Te,Te=null):rn=Te.sibling;var Xe=C(D,Te,$[ke],P);if(Xe===null){Te===null&&(Te=rn);break}e&&Te&&Xe.alternate===null&&t(D,Te),j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe,Te=rn}if(ke===$.length)return s(D,Te),Ie&&tr(D,ke),ve;if(Te===null){for(;ke<$.length;ke++)Te=G(D,$[ke],P),Te!==null&&(j=c(Te,j,ke),Fe===null?ve=Te:Fe.sibling=Te,Fe=Te);return Ie&&tr(D,ke),ve}for(Te=r(Te);ke<$.length;ke++)rn=B(Te,D,ke,$[ke],P),rn!==null&&(e&&(Xe=rn.alternate,Xe!==null&&Te.delete(Xe.key===null?ke:Xe.key)),j=c(rn,j,ke),Fe===null?ve=rn:Fe.sibling=rn,Fe=rn);return e&&Te.forEach(function(Pr){return t(D,Pr)}),Ie&&tr(D,ke),ve}function _e(D,j,$,P){if($==null)throw Error(l(151));for(var ve=null,Fe=null,Te=j,ke=j=0,rn=null,Xe=$.next();Te!==null&&!Xe.done;ke++,Xe=$.next()){Te.index>ke?(rn=Te,Te=null):rn=Te.sibling;var Pr=C(D,Te,Xe.value,P);if(Pr===null){Te===null&&(Te=rn);break}e&&Te&&Pr.alternate===null&&t(D,Te),j=c(Pr,j,ke),Fe===null?ve=Pr:Fe.sibling=Pr,Fe=Pr,Te=rn}if(Xe.done)return s(D,Te),Ie&&tr(D,ke),ve;if(Te===null){for(;!Xe.done;ke++,Xe=$.next())Xe=G(D,Xe.value,P),Xe!==null&&(j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe);return Ie&&tr(D,ke),ve}for(Te=r(Te);!Xe.done;ke++,Xe=$.next())Xe=B(Te,D,ke,Xe.value,P),Xe!==null&&(e&&(rn=Xe.alternate,rn!==null&&Te.delete(rn.key===null?ke:rn.key)),j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe);return e&&Te.forEach(function(Nz){return t(D,Nz)}),Ie&&tr(D,ke),ve}function He(D,j,$,P){if(typeof $=="object"&&$!==null&&$.type===Y&&$.key===null&&$.props.ref===void 0&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case Ae:e:{for(var ve=$.key;j!==null;){if(j.key===ve){if(ve=$.type,ve===Y){if(j.tag===7){s(D,j.sibling),P=o(j,$.props.children),Tr(P,$),P.return=D,D=P;break e}}else if(j.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===Se&&Da(ve)===j.type){s(D,j.sibling),P=o(j,$.props),Tr(P,$),P.return=D,D=P;break e}s(D,j);break}else t(D,j);j=j.sibling}$.type===Y?(P=Na($.props.children,D.mode,P,$.key),Tr(P,$),P.return=D,D=P):(P=oc($.type,$.key,$.props,null,D.mode,P),Tr(P,$),P.return=D,D=P)}return m(D);case ye:e:{for(ve=$.key;j!==null;){if(j.key===ve)if(j.tag===4&&j.stateNode.containerInfo===$.containerInfo&&j.stateNode.implementation===$.implementation){s(D,j.sibling),P=o(j,$.children||[]),P.return=D,D=P;break e}else{s(D,j);break}else t(D,j);j=j.sibling}P=Dd($,D.mode,P),P.return=D,D=P}return m(D);case Se:return $=Da($),He(D,j,$,P)}if(Ne($))return ce(D,j,$,P);if(oe($)){if(ve=oe($),typeof ve!="function")throw Error(l(150));return $=ve.call($),_e(D,j,$,P)}if(typeof $.then=="function")return He(D,j,yc($),P);if($.$$typeof===fe)return He(D,j,mc(D,$),P);bc(D,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,j!==null&&j.tag===6?(s(D,j.sibling),P=o(j,$),P.return=D,D=P):(s(D,j),P=Cd($,D.mode,P),P.return=D,D=P),m(D)):s(D,j)}return function(D,j,$,P){try{qo=0;var ve=He(D,j,$,P);return Nl=null,ve}catch(Te){if(Te===Ol||Te===gc)throw Te;var Fe=di(29,Te,null,D.mode);return Fe.lanes=P,Fe.return=D,Fe}}}var Za=Jg(!0),Xg=Jg(!1),Or=!1;function Pd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Nr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ar(e,t,s){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(it&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=lc(e),Dg(e,null,s),t}return ac(e,r,t,s),lc(e)}function Io(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,Jt(e,s)}}function Gd(e,t){var s=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,s===r)){var o=null,c=null;if(s=s.firstBaseUpdate,s!==null){do{var m={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};c===null?o=c=m:c=c.next=m,s=s.next}while(s!==null);c===null?o=c=t:c=c.next=t}else o=c=t;s={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:r.shared,callbacks:r.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var Yd=!1;function Vo(){if(Yd){var e=Tl;if(e!==null)throw e}}function Po(e,t,s,r){Yd=!1;var o=e.updateQueue;Or=!1;var c=o.firs)DELIM" +R"DELIM(tBaseUpdate,m=o.lastBaseUpdate,_=o.shared.pending;if(_!==null){o.shared.pending=null;var N=_,Z=N.next;N.next=null,m===null?c=Z:m.next=Z,m=N;var q=e.alternate;q!==null&&(q=q.updateQueue,_=q.lastBaseUpdate,_!==m&&(_===null?q.firstBaseUpdate=Z:_.next=Z,q.lastBaseUpdate=N))}if(c!==null){var G=o.baseState;m=0,q=Z=N=null,_=c;do{var C=_.lane&-536870913,B=C!==_.lane;if(B?(Ye&C)===C:(r&C)===C){C!==0&&C===Ra&&(Yd=!0),q!==null&&(q=q.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var ce=e,_e=_;C=t;var He=s;switch(_e.tag){case 1:if(ce=_e.payload,typeof ce=="function"){G=ce.call(He,G,C);break e}G=ce;break e;case 3:ce.flags=ce.flags&-65537|128;case 0:if(ce=_e.payload,C=typeof ce=="function"?ce.call(He,G,C):ce,C==null)break e;G=ne({},G,C);break e;case 2:Or=!0}}C=_.callback,C!==null&&(e.flags|=64,B&&(e.flags|=8192),B=o.callbacks,B===null?o.callbacks=[C]:B.push(C))}else B={lane:C,tag:_.tag,payload:_.payload,callback:_.callback,next:null},q===null?(Z=q=B,N=G):q=q.next=B,m|=C;if(_=_.next,_===null){if(_=o.shared.pending,_===null)break;B=_,_=B.next,B.next=null,o.lastBaseUpdate=B,o.shared.pending=null}}while(!0);q===null&&(N=G),o.baseState=N,o.firstBaseUpdate=Z,o.lastBaseUpdate=q,c===null&&(o.shared.lanes=0),Ur|=m,e.lanes=m,e.memoizedState=G}}function Wg(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function ev(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;ec?c:8;var m=pe.T,_={};_.types=m!==null?m.types:null,pe.T=_,mh(e,!1,t,s);try{var N=o(),Z=pe.S;if(Z!==null&&Z(_,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var q=Yx(N,r);Fo(e,t,q,ki(e))}else Fo(e,t,r,ki(e))}catch(G){Fo(e,t,{then:function(){},status:"rejected",reason:G},ki())}finally{Oe.p=c,m!==null&&_.types!==null&&(m.types=_.types),pe.T=m}}function ew(){}function dh(e,t,s,r){if(e.tag!==5)throw Error(l(476));var o=kv(e).queue;jv(e,o,t,Bt,s===null?ew:function(){return Rv(e),s(r)})}function kv(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Bt,baseState:Bt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rr,lastRenderedState:Bt},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rr,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Rv(e){var t=kv(e);t.next===null&&(t=e.alternate.memoizedState),Fo(e,t.next.queue,{},ki())}function hh(){return An(Ql)}function Cv(){return Xt().memoizedState}function Dv(){return Xt().memoizedState}function tw(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=ki();e=Nr(s);var r=Ar(t,e,s);r!==null&&(gi(r,t,s),Io(r,t,s)),t={cache:Bd()},e.payload=t;return}t=t.return}}function nw(e,t,s){var r=ki();s={lane:r,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Ac(e)?Zv(t,s):(s=kd(e,t,s,r),s!==null&&(gi(s,e,r),Lv(s,t,r)))}function Uv(e,t,s){var r=ki();Fo(e,t,s,r)}function Fo(e,t,s,r){var o={lane:r,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Ac(e))Zv(t,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var m=t.lastRenderedState,_=c(m,s);if(o.hasEagerState=!0,o.eagerState=_,ut(_,m))return ac(e,t,o,0),bt===null&&rc(),!1}catch{}if(s=kd(e,t,o,r),s!==null)return gi(s,e,r),Lv(s,t,r),!0}return!1}function mh(e,t,s,r){if(r={lane:2,revertLane:sm(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ac(e)){if(t)throw Error(l(479))}else t=kd(e,s,r,2),t!==null&&gi(t,e,2)}function Ac(e){var t=e.alternate;return e===$e||t!==null&&t===$e}function Zv(e,t){Al=xc=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function Lv(e,t,s){if((s&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,Jt(e,s)}}var Mc={readContext:An,use:Ec,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useLayoutEffect:Vt,useInsertionEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useSyncExternalStore:Vt,useId:Vt,useHostTransitionStatus:Vt,useFormState:Vt,useActionState:Vt,useOptimistic:Vt,useMemoCache:Vt,useCacheRefresh:Vt,useEffectEvent:Vt},$v={readContext:An,use:Ec,useCallback:function(e,t){return ni().memoizedState=[e,t===void 0?null:t],e},useContext:An,useEffect:xv,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,Oc(4194308,4,Tv.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Oc(4194308,4,e,t)},useInsertionEffect:function(e,t){Oc(4,2,e,t)},useMemo:function(e,t){var s=ni();t=t===void 0?null:t;var r=e();if(La){Tt(!0);try{e()}finally{Tt(!1)}}return s.memoizedState=[r,t],r},useReducer:function(e,t,s){var r=ni();if(s!==void 0){var o=s(t);if(La){Tt(!0);try{s(t)}finally{Tt(!1)}}}else o=t;return r.memoizedState=r.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},r.queue=e,e=e.dispatch=nw.bind(null,$e,e),[r.memoizedState,e]},useRef:function(e){var t=ni();return e={current:e},t.memoizedState=e},useState)DELIM" +R"DELIM(:function(e){e=lh(e);var t=e.queue,s=Uv.bind(null,$e,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:ch,useDeferredValue:function(e,t){var s=ni();return fh(s,e,t)},useTransition:function(){var e=lh(!1);return e=jv.bind(null,$e,e.queue,!0,!1),ni().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var r=$e,o=ni();if(Ie){if(s===void 0)throw Error(l(407));s=s()}else{if(s=t(),bt===null)throw Error(l(349));(Ye&127)!==0||av(r,t,s)}o.memoizedState=s;var c={value:s,getSnapshot:t};return o.queue=c,xv(ov.bind(null,r,c,e),[e]),r.flags|=2048,jl(9,{destroy:void 0},lv.bind(null,r,c,s,t),null),s},useId:function(){var e=ni(),t=bt.identifierPrefix;if(Ie){var s=Ms,r=As;s=(r&~(1<<32-At(r)-1)).toString(32)+s,t="_"+t+"R_"+s,s=wc++,0<\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof r.is=="string"?m.createElement("select",{is:r.is}):m.createElement("select"),r.multiple?c.multiple=!0:r.size&&(c.size=r.size);break;default:c=typeof r.is=="string"?m.createElement(o,{is:r.is}):m.createElement(o)}}c[Mt]=t,c[bn]=r;e:for(m=t.child;m!==null;){if(m.tag===5||m.tag===6)c.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===t)break e;for(;m.sibling===null;){if(m.return===null||m.return===t)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}t.stateNode=c;e:switch(Rn(c,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&lr(t)}}return zt(t),t.subtreeFlags&=-33554433,Oh(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&lr(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(l(166));if(e=Kn.current,El(t)){if(e=t.stateNode,s=t.memoizedProps,r=null,o=xn,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}e[Mt]=t,e=!!(e.nodeValue===s||r!==null&&r.suppressHydrationWarning===!0||o0(e.nodeValue,s)),e||zr(t,!0)}else e=ou(e).createTextNode(r),e[Mt]=t,t.stateNode=e}return zt(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(r=El(t),s!==null){if(e===null){if(!r)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[Mt]=t}else Aa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zt(t),e=!1}else s=Ld(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(Ni(t),t):(Ni(t),null);if((t.flags&128)!==0)throw Error(l(558))}return zt(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=El(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(l(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(l(317));o[Mt]=t}else Aa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zt(t),o=!1}else o=Ld(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Ni(t),t):(Ni(t),null)}return Ni(t),(t.flags&128)!==0?(t.lanes=s,t):(s=r!==null,e=e!==null&&e.memoizedState!==null,s&&(r=t.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),c=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),c!==o&&(r.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),Uc(t,t.updateQueue),zt(t),null);case 4:return Ce(),e===null&&om(t.stateNode.containerInfo),t.flags|=67108864,zt(t),null;case 10:return ir(t.type),zt(t),null;case 19:if(Xd(t),r=t.memoizedState,r===null)return zt(t),null;if(o=(t.flags&128)!==0,c=r.rendering,c===null)if(o)Jo(r,!1);else{if(Pt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=Sc(e),c!==null){for(t.flags|=128,Jo(r,!1),e=c.updateQueue,t.updateQueue=e,Uc(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)Ug(s,e),s=s.sibling;return Ko(t,jn.current&1|2),Ie&&tr(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Yt()>Yc&&(t.flags|=128,o=!0,Jo(r,!1),t.lanes=4194304)}else{if(!o)if(e=Sc(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Uc(t,e),Jo(r,!0),r.tail===null&&r.tailMode!=="collapsed"&&r.tailMode!=="visible"&&!c.alternate&&!Ie)return zt(t),null}else 2*Yt()-r.renderingStartTime>Yc&&s!==536870912&&(t.flags|=128,o=!0,Jo(r,!1),t.lanes=4194304);r.isBackwards?(c.sibling=t.child,t.child=c):(e=r.last,e!==null?e.sibling=c:t.child=c,r.last=c)}if(r.tail!==null){e=r.tail;e:{for(s=e;s!==null;){if(s.alternate!==null){s=!1;break e}s=s.sibling}s=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Yt(),e.sibling=null,c=jn.current,c=o?c&1|2:c&1,r.tailMode==="visible"||r.tailMode==="collapsed"||!s||Ie?Ko(t,c):(s=c,tt(Mn,t),tt(jn,s),In===null&&(In=t)),Ie&&tr(t,r.treeForkCount),e}return zt(t),null;case 22:case 23:return Ni(t),Qd(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(s&536870912)!==0&&(t.flags&128)===0&&(zt(t),t.subtreeFlags&6&&(t.flags|=8192)):zt(t),s=t.updateQueue,s!==null&&Uc(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==s&&(t.flags|=2048),e!==null&&Ut(Ca),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),ir(tn),zt(t),null;case 25:return null;case 30:return t.flags|=33554432,zt(t),null}throw Error(l(156,t.tag))}function uw(e,t){switch(Ud(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:ret)DELIM" +R"DELIM(urn ir(tn),Ce(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return nt(t),null;case 31:if(t.memoizedState!==null){if(Ni(t),t.alternate===null)throw Error(l(340));Aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ni(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Xd(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Ce(),null;case 10:return ir(t.type),null;case 22:case 23:return Ni(t),Qd(),e!==null&&Ut(Ca),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ir(tn),null;case 25:return null;default:return null}}function cy(e,t){switch(Ud(t),t.tag){case 3:ir(tn),Ce();break;case 26:case 27:case 5:nt(t);break;case 4:Ce();break;case 31:t.memoizedState!==null&&Ni(t);break;case 13:Ni(t);break;case 19:Xd(t);break;case 10:ir(t.type);break;case 22:case 23:Ni(t),Qd(),e!==null&&Ut(Ca);break;case 24:ir(tn)}}function Xo(e,t){try{var s=t.updateQueue,r=s!==null?s.lastEffect:null;if(r!==null){var o=r.next;s=o;do{if((s.tag&e)===e){r=void 0;var c=s.create,m=s.inst;r=c(),m.destroy=r}s=s.next}while(s!==o)}}catch(_){ft(t,t.return,_)}}function Rr(e,t,s){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var c=o.next;r=c;do{if((r.tag&e)===e){var m=r.inst,_=m.destroy;if(_!==void 0){m.destroy=void 0,o=t;var N=s,Z=_;try{Z()}catch(q){ft(o,N,q)}}}r=r.next}while(r!==c)}}catch(q){ft(t,t.return,q)}}function fy(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{ev(t,s)}catch(r){ft(e,e.return,r)}}}function dy(e,t,s){s.props=$a(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(r){ft(e,t,r)}}function js(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var o=e.stateNode,c=Xs(e.memoizedProps,o);(o.ref===null||o.ref.name!==c)&&(o.ref=b0(c)),r=o.ref;break;case 7:if(e.stateNode===null){var m=new Ri(e);v(e.child,!1,Ww,m,void 0,void 0),e.stateNode=m}r=e.stateNode;break;default:r=e.stateNode}typeof s=="function"?e.refCleanup=s(r):s.current=r}}catch(_){ft(e,t,_)}}function kn(e,t){var s=e.ref,r=e.refCleanup;if(s!==null)if(typeof r=="function")try{r()}catch(o){ft(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(o){ft(e,t,o)}else s.current=null}function Zc(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var s=0;s title"))),Rn(r,t,s),r[Mt]=e,Wt(r),t=r;break e;case"link":if(c=U0("link","href",o).get(t+(s.href||""))){for(m=0;mHe&&(m=He,He=_e,_e=m);var D=zg(_,_e),j=zg(_,He);if(D&&j&&(B.rangeCount!==1||B.anchorNode!==D.node||B.anchorOffset!==D.offset||B.focusNode!==j.node||B.focusOffset!==j.offset)){var $=G.createRange();$.setStart(D.node,D.offset),B.removeAllRanges(),_e>He?(B.addRange($),B.extend(j.node,j.offset)):($.setEnd(j.node,j.offset),B.addRange($))}}}}for(G=[],B=_;B=B.parentNode;)B.nodeType===1&&G.push({element:B,left:B.scrollLeft,top:B.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_s?32:s,pe.T=null,s=Yh,Yh=null;var c=ps,m=Zs;if($t=0,Ia=ps=null,Zs=0,(it&6)!==0)throw Error(l(331));var _=it;if(it|=4,Dy(c.current),ky(c,c.current,m,s),it=_,ru(0,!1),Ft&&typeof Ft.onPostCommitFiberRoot=="function")try{Ft.onPostCommitFiberRoot(aa,c)}catch{}return!0}finally{Oe.p=o,pe.T=r,Qy(e,t)}}function Jy(e,t,s){t=Vi(s,t),t=vh(e.stateNode,t,2),e=Ar(e,t,2),e!==null&&(ci(e,2),Ls(e))}function ft(e,t,s){if(e.tag===3)Jy(e,e,s);else for(;t!==null;){if(t.tag===3){Jy(t,e,s);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Zr===null||!Zr.has(r))){e=Vi(s)DELIM" +R"DELIM(,e),s=Gv(2),r=Ar(t,s,2),r!==null&&(Yv(s,r,t,e),ci(r,2),Ls(r));break}}t=t.return}}function tm(e,t,s){var r=e.pingCache;if(r===null){r=e.pingCache=new hw;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(s)||(Ph=!0,o.add(s),e=Sw.bind(null,e,t,s),t.then(e,e))}function Sw(e,t,s){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,bt===e&&(Ye&s)===s&&((Pt===4||Pt===3&&(Ye&62914560)===Ye&&300>Yt()-Gc)&&(it&2)===0?ql(e,0):Kc|=s,Zl===Ye&&(Zl=0)),Ls(e)}function Xy(e,t){t===0&&(t=vr()),e=Oa(e,t),e!==null&&(ci(e,t),Ls(e))}function xw(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Xy(e,s)}function ww(e,t){var s=0;switch(e.tag){case 31:case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(s=o.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(l(314))}r!==null&&r.delete(t),Xy(e,s)}function zw(e,t){return Fn(e,t)}var Vl=null,Pl=null,nm=!1,tf=!1,im=!1,$r=0;function Ls(e){e!==Pl&&e.next===null&&(Pl===null?Vl=Pl=e:Pl=Pl.next=e),tf=!0,nm||(nm=!0,Tw())}function ru(e,t){if(!im&&tf){im=!0;do for(var s=!1,r=Vl;r!==null;){if(e!==0){var o=r.pendingLanes;if(o===0)var c=0;else{var m=r.suspendedLanes,_=r.pingedLanes;c=(1<<31-At(42|e)+1)-1,c&=o&~(m&~_),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(s=!0,n0(r,c))}else c=Ye,c=ll(r,r===bt?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(c&3)===0||oa(r,c)||(s=!0,n0(r,c));r=r.next}while(s);im=!1}}function Ew(){Wy()}function Wy(){tf=nm=!1;var e=0;$r!==0&&Zw()&&(e=$r);for(var t=Yt(),s=null,r=Vl;r!==null;){var o=r.next,c=e0(r,t);c===0?(r.next=null,s===null?Vl=o:s.next=o,o===null&&(Pl=s)):(s=r,(e!==0||(c&3)!==0)&&(tf=!0)),r=o}$t!==0&&$t!==5||ru(e),$r!==0&&($r=0)}function e0(e,t){for(var s=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0_)break;var q=N.transferSize,G=N.initiatorType;q&&u0(G)&&(N=N.responseEnd,m+=q*(N<_?1:(_-Z)/(N-Z)))}if(--r,t+=8*(c+m)/(o.duration/1e3),e++,10lf){_e.length=ce;break}$=new Promise(Iw.bind($)),_e.push($)}}}if(0<_e.length)return C=Promise.race([Promise.all(_e),new Promise(function(ve){return setTimeout(ve,500)})]).then(o,o),(B?Promise.allSettled([B.finished,C]):C).then(c,c);if(o(),B)return B.finished.then(c,c);c()},types:s});Z.__reactViewTransition=q;var G=[];return q.ready.then(function(){for(var C=Z.documentElement.getAnimations({subtree:!0}),B=0;B"u"?null:document;function k0(e,t,s){var r=Gl;if(r&&typeof t=="string"&&t){var o=Xn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof s=="string"&&(o+='[crossorigin="'+s+'"]'),j0.has(o)||(j0.add(o),e={rel:e,crossOrigin:s,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),Rn(t,"link",e),Wt(t),r.head.appendChild(t)))}}function oz(e){ur.D(e),k0("dns-prefetch",e,null)}function uz(e,t){ur.C(e,t),k0("preconnect",e,t)}function cz(e,t,s){ur.L(e,t,s);var r=Gl;if(r&&e&&t){var o='link[rel="preload"][as="'+Xn(t)+'"]';t==="image"&&s&&s.imageSrcSet?(o+='[imagesrcset="'+Xn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(o+='[imagesizes="'+Xn(s.imageSizes)+'"]')):o+='[href="'+Xn(e)+'"]';var c=o;switch(t){case"style":c=Yl(e);break;case"script":c=Fl(e)}if(!(Qi.has(c)||(e=ne({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),Qi.set(c,e),r.querySelector(o)!==null||t==="style"&&r.querySelector(cu(c))||t==="script"&&r.querySelector(fu(c))))){var m=r.createElement("link");Rn(m,"link",e),t==="style"&&(m[cn]=!0,m.onload=m.onerror=function(){Ku(m)}),Wt(m),r.head.appendChild(m)}}}function fz(e,t){ur.m(e,t);var s=Gl;if(s&&e){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Xn(r)+'"][href="'+Xn(e)+'"]',c=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Fl(e)}if(!Qi.has(c)&&(e=ne({rel:"modulepreload",href:e},t),Qi.set(c,e),s.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(fu(c)))return}r=s.createElement("link"),Rn(r,"link",e),Wt(r),s.head.appendChild(r)}}}function dz(e,t,s){ur.S(e,t,s);var r=Gl;if(r&&e){var o=br(r).hoistableStyles,c=Yl(e);t=t||"default";var m=o.get(c);if(!m){var _={loading:0,preload:null};if(m=r.querySelector(cu(c)))_.loading=5;else{e=ne({rel:"stylesheet",href:e,"data-precedence":t},s),(s=Qi.get(c))&&zm(e,s);var N=m=r.createElement("link");Wt(N),Rn(N,"link",e),N._p=new Promise(function(Z,q){N.onload=Z,N.onerror=q}),N.addEventListener("load",function(){_.loading|=1}),N.addEventListener("error",function(){_.loading|=2}),_.loading|=4,rf(m,t,r)}m={type:"stylesheet",instance:m,count:1,state:_},o.set(c,m)}}}function hz(e,t){ur.X(e,t);var s=Gl;if(s&&e){var r=br(s).hoistableScripts,o=Fl(e),c=r.get(o);c||(c=s.querySelector(fu(o)),c||(e=ne({src:e,async:!0},t),(t=Qi.get(o))&&Em(e,t),c=s.createElement("script"),Wt(c),Rn(c,"link",e),s.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},r.set(o,c))}}function mz(e,t){ur.M(e,t);var s=Gl;if(s&&e){var r=br(s).hoistableScripts,o=Fl(e),c=r.get(o);c||(c=s.querySelector(fu(o)),c||(e=ne({src:e,async:!0,type:"module"},t),(t=Qi.get(o))&&Em(e,t),c=s.createElement("script"),Wt(c),Rn(c,"link",e),s.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},r.set(o,c))}}function R0(e,t,s,r){var o=(o=Kn.current)?uu(o):null;if(!o)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(s=Yl(s.href),t=br(o).hoistableStyles,r=t.get(s),r||(r={type:"style",instance:null,count:0,state:null},t.set(s,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=Yl(s.href);var c=br(o).hoistableStyles,m=c.get(e);if(m||(o=o.ownerDocument||o,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,m),(c=o.querySelector(cu(e)))?c._p||(m.instance=c,m.state.loading=5):(c=Qi.get(e),c||(c={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Qi.set(e,c)),pz(o,e,c,m.state))),t&&r===null)throw Error(l(528,""));return m}if(t&&r!==null)throw Error(l(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(s=Fl(s),t=br(o).hoistableScripts,r=t.get(s),r||(r={type:"script",instance:null,count:0,state:null},t.set(s,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Yl(e){return'href="'+Xn(e)+'"'}function cu(e){return'link[rel="stylesheet"]['+e+"]"}function C0(e){return ne({},e,{"data-precedence":e.precedence,precedence:null})}function pz(e,t,s,r){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[cn]!==!0){r.loading=1;return}}else t=e.createElement("link"),t[cn]=!0,t.onload=t.onerror=Ku.bind(null,t),Rn(t,"link",s),Wt(t),e.head.appendChild(t);r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2})}function Fl(e){return'[src="'+Xn(e)+'"]'}function fu(e){return"script[async]"+e}function D0(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Xn(s.href)+'"]');if(r)return t.instance=r,Wt(r),r;var o=ne({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Wt(r),Rn(r,"style",o),rf(r,s.precedence,e),t.instance=r;case"stylesheet":o=Yl(s.href);var c=e.querySelector(cu(o));if(c)return t.state.loading|=4,t.instance=c,Wt(c),c;r=C0(s),(o=Qi.get(o))&&zm(r,o),c=(e.ownerDocument||e).createElement("link"),Wt(c);var m=c;return m._p=new Promise(function(_,N){m.onload=_,m.onerror=N}),Rn(c,"link",r),t.state.loading|=4,rf(c,s.precedence,e),t.instance=c;case"script":return c=Fl(s.src),(o=e.querySelector(fu(c)))?(t.instance=o,Wt(o),o):(r=s,(o=Qi.get(c))&&(r=ne({},s),Em(r,o)),e=e.ownerDocument||e,o=e.createElement("script"),Wt(o),Rn(o,"link",r),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,rf(r,s.precedence,e));return t.instance}function rf(e,t,s){for(var r=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,c=o,m=0;m title"):null)}function gz(e,t,s){if(s===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Z0(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function L0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function $0(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function H0(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=$0(t),e.suspenseyImages.push(t)),e=bz.bind(e),t.decode().then(e,e))}function vz(e,t,s,r){if(s.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var o=Yl(r.href),c=t.querySelector(cu(o));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=du.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=c,Wt(c);return}c=t.ownerDocument||t,r=C0(r),(o=Qi.get(o))&&zm(r,o),c=c.createElement("link"),Wt(c);var m=c;m._p=new Promise(function(_,N){m.onload=_,m.onerror=N}),Rn(c,"link",r),s.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=du.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var lf=0;function yz(e,t){return e.stylesheets&&e.count===0&&uf(e,e.stylesheets),0lf?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function B0(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)uf(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function du(){this.count--,B0(this)}function bz(){this.imgCount--,B0(this)}var of=null;function uf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,of=new Map,t.forEach(_z,e),of=null,du.call(e))}function _z(e,t){if(!(t.state.loading&4)){var s=of.get(e);if(s)var r=s.get(null);else{s=new Map,of.set(e,s);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Dm.exports=Zz(),Dm.exports}var $z=Lz();const Hz=u1($z),Bz=[{id:"current",label:"Classic"},{id:"light",label:"Light"},{id:"midnight",label:"Midnight"}],Cp="libbitcoinTheme",Df="libbitcoin-theme-change";function Dp(n){return n==="light"||n==="midnight"?n:"current"}function c1(){try{return Dp(localStorage.getItem(Cp))}catch{return"current"}}function Up(n){document.documentElement.dataset.theme=n;const i=getComputedStyle(document.documentElement).getPropertyValue("--theme-background").trim();i&&document.querySelector('meta[name="theme-color"]')?.setAttribute("content",i)}function qz(){Up(c1()),globalThis.addEventListener("storage",Pz)}function Iz(n){const i=Dp(n);Up(i);try{localStorage.setItem(Cp,i)}catch{}globalThis.dispatchEvent(new Event(Df))}function Vz(){return Dp(document.documentElement.dataset.theme)}function Pz(n){n.key!==null&&n.key!==Cp||(Up(c1()),globalThis.dispatchEvent(new Event(Df)))}function Kz(n){return globalThis.addEventListener(Df,n),()=>{globalThis.removeEventListener(Df,n)}}function Xf(){return le.useSyncExternalStore(Kz,Vz,()=>"current")}function Gz(){const n=Xf();return x.jsx("select",{"aria-label":"Theme",value:n,onChange:i=>{Iz(i.target.value)},className:"border-accent/40 bg-surface text-textP)DELIM" +R"DELIM(rimary focus:border-accent focus:ring-accent rounded-md border py-1.5 pr-8 pl-3 text-sm",children:Bz.map(i=>x.jsx("option",{value:i.id,children:i.label},i.id))})}const f1="libbitcoinAdminDashboardBrowserNotifications";function d1(){try{return globalThis.window?.localStorage??null}catch{return null}}function Zp(){const n=globalThis.Notification;return typeof n=="function"?n:null}function h1(){return Zp()?.permission??"unsupported"}async function Yz(){const n=Zp();return n?n.permission!=="default"?n.permission:n.requestPermission():"unsupported"}function Fz(n=d1()){try{return h1()==="granted"&&n?.getItem(f1)==="true"}catch{return!1}}function Qz(n,i=d1()){try{i?.setItem(f1,String(n))}catch{}}function Jz(n,i){const a=Zp();if(!a||a.permission!=="granted")return!1;try{return new a(n,i),!0}catch{return!1}}function Xz({browserNotificationsEnabled:n,onClose:i,onBrowserNotificationsEnabledChange:a}){const[l,u]=le.useState(h1),[f,d]=le.useState(!1),[h,p]=le.useState(null),g=n&&l==="granted";async function b(){if(g){a(!1);return}d(!0),p(null);try{const v=await Yz();u(v),v==="granted"?a(!0):v==="denied"&&p("Permission was denied. It can be changed in your browser settings.")}catch{p("The browser could not enable notifications.")}finally{d(!1)}}return x.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:v=>{v.target===v.currentTarget&&i()},children:x.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",className:"border-accent/30 bg-surface/95 max-h-[calc(100vh-2rem)] w-full max-w-xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/50",children:[x.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[x.jsx("h2",{id:"settings-title",className:"text-accent text-xl font-semibold",children:"Settings"}),x.jsx("button",{type:"button",onClick:i,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close settings",children:"×"})]}),x.jsxs("div",{className:"space-y-5 p-5",children:[x.jsx(Gz,{}),x.jsxs("div",{className:"border-accentSecondary/20 bg-accent/5 space-y-3 rounded-xl border p-4",children:[x.jsxs("div",{children:[x.jsx("h3",{className:"text-textPrimary text-sm font-medium",children:"Browser notifications"}),x.jsx("p",{id:"browser-notifications-help",className:"text-textMuted mt-1 text-xs",children:eE(l,g,f)})]}),x.jsx("button",{type:"button","aria-describedby":"browser-notifications-help",disabled:f||l==="unsupported"||l==="denied",onClick:()=>{b()},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:Wz(l,g,f)}),h&&x.jsx("p",{className:"text-sm text-red-300",role:"alert",children:h})]}),x.jsx("div",{className:"flex justify-end pt-2",children:x.jsx("button",{type:"button",onClick:i,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-4 py-2 text-sm",children:"Done"})})]})]})})}function Wz(n,i,a){return a?"Requesting permission…":n==="unsupported"?"Notifications unavailable":n==="denied"?"Blocked by browser":i?"Disable notifications":"Enable notifications"}function eE(n,i,a){return a?"Waiting for your browser permission choice.":n==="unsupported"?"This browser does not support system notifications.":n==="denied"?"Notifications are blocked. Allow them in your browser settings to enable this feature.":i?"System notifications will appear when the node enters or leaves the near-current range.":"Get a system notification when the node enters or leaves the near-current range."}function np(n){const i=Object.values(n).filter(l=>typeof l=="number");return Object.entries(n).filter(([l,u])=>i.indexOf(+l)===-1).map(([l,u])=>u)}function fb(n,i="|"){return n.map(a=>b1(a)).join(i)}function ip(n,i){return typeof i=="bigint"?i.toString():i}class tE{constructor(i){this._getter=i,this._value=void 0}get value(){const i=this._getter;return i!==void 0&&(this._value=i(),this._getter=void 0),this._value}}function Lp(n){return new tE(n)}function nE(n){return n==null}function $p(n){const i=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;return n.slice(i,a)}function iE(n,i){const a=n/i,l=Math.round(a),u=4*Number.EPSILON*Math.max(Math.abs(a),1);return Math.abs(a-l){const h=i._zod.def.shape[f];return l?l(h,f):h}):g1(n,f,l?l(d.value,f):d.value))}}function sE(n,i){for(const a of Reflect.ownKeys(i)){const l=Object.getOwnPropertyDescriptor(i,a);l.enumerable&&(l.get?p1(n,a,()=>i[a]):g1(n,a,l.value))}}function Di(...n){const i={};for(const a of n){const l=Object.getOwnPropertyDescriptors(a);Object.assign(i,l)}return Object.defineProperties({},i)}function rE(n){return JSON.stringify(n)}function aE(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const v1="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function Uf(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const lE=Lp(()=>{if(es.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function so(n){if(Uf(n)===!1)return!1;const i=n.constructor;if(i===void 0||typeof i!="function")return!0;const a=i.prototype;return!(Uf(a)===!1||Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")===!1)}function y1(n){return so(n)?{...n}:Array.isArray(n)?[...n]:n instanceof Map?new Map(n):n instanceof Set?new Set(n):n}const oE=new Set(["string","number","symbol"]);function ro(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function na(n,i,a){const l=new n._zod.constr(i??n._zod.def);return(!i||a?.parent)&&(l._zod.parent=n),l}function Ee(n){const i=n;if(!i)return{};if(typeof i=="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");i.error=i.message}return delete i.message,typeof i.error=="string"?{...i,error:()=>i.error}:i}function b1(n){return typeof n=="bigint"?n.toString()+"n":typeof n=="string"?`"${n}"`:`${n}`}function uE(n){return Object.keys(n).filter(i=>n[i]._zod.optin!==void 0&&n[i]._zod.optout==="optional")}const _1={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]},cE={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function fE(n,i){const a=n._zod.def,l=a.checks;if(l&&l.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const f={};return el(f,n,Wf(n,i)),na(n,Di(a,{shape:f,checks:[]}))}function Wf(n,i){const a=hr(n),l=[];for(const u of Reflect.ownKeys(i)){if(!Object.getOwnPropertyDescriptor(a,u)?.enumerable)throw new Error(`Unrecognized key: "${String(u)}"`);i[u]&&l.push(u)}return l}function dE(n,i){const a=n._zod.def,l=a.checks;if(l&&l.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const f=new Set(Wf(n,i)),d={};return el(d,n,Reflect.ownKeys(hr(n)).filter(h=>!f.has(h))),na(n,Di(a,{shape:d,checks:[]}))}function hE(n,i){if(!so(i))throw new Error("Invalid input to extend: expected a plain object");const a=n._zod.def.checks;if(a&&a.length>0){const u=hr(n);for)DELIM" +R"DELIM((const f of Reflect.ownKeys(i))if(Object.getOwnPropertyDescriptor(u,f)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return na(n,Di(n._zod.def,{shape:S1(n,i)}))}function S1(n,i){const a={};return el(a,n,Reflect.ownKeys(hr(n))),sE(a,i),a}function mE(n,i){if(!so(i))throw new Error("Invalid input to safeExtend: expected a plain object");return na(n,Di(n._zod.def,{shape:S1(n,i)}))}function pE(n,i){if(!i?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(n._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const a={};el(a,n,Reflect.ownKeys(hr(n))),el(a,i,Reflect.ownKeys(hr(i)));const l=Di(n._zod.def,{shape:a,get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return na(n,l)}function db(n,i,a,l="partial"){const f=i._zod.def.checks;if(f&&f.length>0)throw new Error(`.${l}() cannot be used on object schemas containing refinements`);const h=a?new Set(Wf(i,a)):void 0,p={};return el(p,i,Reflect.ownKeys(hr(i)),n&&((g,b)=>h&&!h.has(b)?g:new n({type:"optional",innerType:g}))),na(i,Di(i._zod.def,{shape:p,checks:[]}))}function gE(n,i,a){const l=a?new Set(Wf(i,a)):void 0,u={};return el(u,i,Reflect.ownKeys(hr(i)),(f,d)=>l&&!l.has(d)?f:new n({type:"nonoptional",innerType:f})),na(i,Di(i._zod.def,{shape:u}))}function _s(n,i=0){if(n.aborted===!0)return!0;for(let a=i;a{var l;return(l=a).path??(l.path=[]),a.path.unshift(n),a})}function yu(n){return typeof n=="string"?n:n?.message}function hb(n){const i=[];for(const a of n??[]){const l=a._zod.def;if(!/_(length|size)$|_equals$/.test(l.check))break;const u=l.maximum??l.length??l.size;u>=0&&i.push([u,a])}return i}function sp(n,i,a){var l;for(let u=i;un;return i[EE]=!0,i}var mb;const Hm={value:void 0,enumerable:!1};let pb="captureStackTrace"in Error?Error:null;function OE(n){const i=pb;if(i){const a=i.stackTraceLimit;if(typeof a=="number"){try{i.stackTraceLimit=0}catch{return pb=null,new n}try{return new n}finally{i.stackTraceLimit=a}}}return new n}function F(n,i,a,l){const u={};function f(w){this.def=w,this.constr=v,this.traits=new Set}f.prototype=u;const d=a,h=d&&new WeakSet;function p(w,T){if(w._zod){if(w._zod.traits.has(n))return}else{Hm.value=new f(T);try{Object.defineProperty(w,"_zod",Hm)}finally{Hm.value=void 0}}if(w._zod.traits.add(n),i(w,T),h){const A=Object.getPrototypeOf(w),k=w._zod.constr.prototype;let L=A;for(;L&&L!==k;)L=Object.getPrototypeOf(L);const U=L??A;h.has(U)||(h.add(U),_E(U,d))}const E=v.prototype;for(const A in E)Object.prototype.hasOwnProperty.call(E,A)&&(A in w||(w[A]=E[A].bind(w)))}const g=l?.Parent??Object;class b extends g{}Object.defineProperty(b,"name",{value:n});function v(w){const T=l?.Parent?OE(b):this;p(T,w);const E=T._zod.deferred;if(E){for(const k of E)k();T._zod.deferred=void 0}const A=globalThis.__zod_globalConfig?.postProcessor;return A&&A(T),T}return Object.defineProperty(v,"init",{value:p}),Object.defineProperty(v,Symbol.hasInstance,{value:w=>l?.Parent&&w instanceof l.Parent?!0:w?._zod?.traits?.has(n)}),Object.defineProperty(v,"name",{value:n}),v}class Xa extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class z1 extends Error{constructor(i){super(`Encountered unidirectional transform during encode: ${i}`),this.name="ZodEncodeError"}}(mb=globalThis).__zod_globalConfig??(mb.__zod_globalConfig={});const es=globalThis.__zod_globalConfig;function Bs(n){return n&&Object.assign(es,n),es}function NE(){const n=this._zod;return n.message??(n.message=JSON.stringify(n.def,ip,2)),n.message}function AE(n){this._zod.message=n}const ME={get:NE,set:AE,enumerable:!0,configurable:!0},Bm={value:void 0,enumerable:!1},gb=new WeakSet([Object.prototype,Error.prototype]),jE=(n,i)=>{n.name="$ZodError",Bm.value=i,Object.defineProperty(n,"issues",Bm),Bm.value=void 0,Object.defineProperty(n,"message",ME);const a=Object.getPrototypeOf(n);gb.has(a)||(gb.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){const l=()=>this.message;return Object.defineProperty(this,"toString",{value:l,configurable:!0,writable:!0}),l},set(l){Object.defineProperty(this,"toString",{value:l,configurable:!0,writable:!0})}}))},kE=F("$ZodError",jE);function RE(n,i,a){return Object.prototype.hasOwnProperty.call(n,i)||(i==="__proto__"?Object.defineProperty(n,i,{value:a(),writable:!0,enumerable:!0,configurable:!0}):n[i]=a()),n[i]}function CE(n,i=a=>a.message){const a={},l=[];for(const u of n.issues)u.path.length>0?RE(a,u.path[0],()=>[]).push(i(u)):l.push(i(u));return{formErrors:l,fieldErrors:a}}function DE(n,i=a=>a.message){const a={_errors:[]},l=(u,f=[])=>{for(const d of u.issues)if(d.code==="invalid_union"&&d.errors.length)d.errors.map(h=>l({issues:h},[...f,...d.path]));else if(d)DELIM" +R"DELIM(.code==="invalid_key")l({issues:d.issues},[...f,...d.path]);else if(d.code==="invalid_element")l({issues:d.issues},[...f,...d.path]);else{const h=[...f,...d.path];if(h.length===0)a._errors.push(i(d));else{let p=a,g=0;for(;g{const i=(a,l,u,f)=>{const d=u?{...u,async:!1}:{async:!1},h=a._zod.run({value:l,issues:[]},d);if(h instanceof Promise)throw new Xa;if(h.issues.length){const p=new(f?.Err??n)(h.issues.map(g=>Jr(g,d,Bs())));throw v1(p,f?.callee??i),p}return h.value};return i},Ip=n=>{const i=async(a,l,u,f)=>{const d=u?{...u,async:!0}:{async:!0};let h=a._zod.run({value:l,issues:[]},d);if(h instanceof Promise&&(h=await h),h.issues.length){const p=new(f?.Err??n)(h.issues.map(g=>Jr(g,d,Bs())));throw v1(p,f?.callee??i),p}return h.value};return i},Vp=n=>(i,a,l)=>{const u=l?{...l,async:!1}:{async:!1},f=i._zod.run({value:a,issues:[]},u);if(f instanceof Promise)throw new Xa;return f.issues.length?E1(n,f.issues,u):{success:!0,data:f.value}};function E1(n,i,a){let l;return{success:!1,get error(){return l||(l=new n(i.map(u=>Jr(u,a,Bs()))),i=void 0,a=void 0),l},set error(u){l=u,i=void 0,a=void 0}}}const Pp=n=>async(i,a,l)=>{const u=l?{...l,async:!0}:{async:!0};let f=i._zod.run({value:a,issues:[]},u);return f instanceof Promise&&(f=await f),f.issues.length?E1(n,f.issues,u):{success:!0,data:f.value}},UE=Symbol.for("zod.compile.invalid"),ZE=Symbol.for("zod.compile.fallback"),LE=((n,i,a)=>{const l=n._zod.bag.validator;if(l!==void 0){if(l(i)!==UE)return!0;if(l.definite===!0&&a===void 0)return!1}return $E(n,i,a)});function $E(n,i,a){const l=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},u=n._zod.bag.fallbackRun;let f;if(u?(l[ZE]=!0,f=u({value:i,issues:[]},l)):f=n._zod.run({value:i,issues:[]},l),f instanceof Promise)throw new Xa;return f.issues.length===0}const HE=async(n,i,a)=>{const l=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let u=n._zod.run({value:i,issues:[]},l);return u instanceof Promise&&(u=await u),u.issues.length===0},BE=n=>{const i=qp(n),a=(l,u,f,d)=>{const h=f?{...f,direction:"backward"}:{direction:"backward"};return i(l,u,h,ed(a,d))};return a},qE=n=>{const i=qp(n),a=(l,u,f,d)=>i(l,u,f,ed(a,d));return a},IE=n=>{const i=Ip(n),a=async(l,u,f,d)=>{const h=f?{...f,direction:"backward"}:{direction:"backward"};return await i(l,u,h,ed(a,d))};return a},VE=n=>{const i=Ip(n),a=async(l,u,f,d)=>await i(l,u,f,ed(a,d));return a},PE=n=>(i,a,l)=>{const u=l?{...l,direction:"backward"}:{direction:"backward"};return Vp(n)(i,a,u)},KE=n=>(i,a,l)=>Vp(n)(i,a,l),GE=n=>async(i,a,l)=>{const u=l?{...l,direction:"backward"}:{direction:"backward"};return Pp(n)(i,a,u)},YE=n=>async(i,a,l)=>Pp(n)(i,a,l),FE=/^[cC][0-9a-z]{6,}$/,QE=/^[0-9a-z]+$/,JE=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,XE=/^[0-9a-vA-V]{20}$/,WE=/^[A-Za-z0-9]{27}$/,eT=/^[a-zA-Z0-9_-]{21}$/;function tT(n){return new RegExp(`^[a-zA-Z0-9_-]{${n}}$`)}const nT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,iT=/^([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})$/,vb=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[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)$/,sT=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rT="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function aT(){return new RegExp(rT,"u")}const lT=/^(?:(?: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])$/,oT=/^(([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}|:))$/,uT=/^((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])$/,cT=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dT=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,hT=/^https?$/,mT=/^\+[1-9]\d{6,14}$/,T1="(?:(?:\\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])))";function pT(n){return new RegExp(`^${n}$`)}const gT=pT(T1);function rp(n){const i="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${i}`:n.precision===0?`${i}:[0-5]\\d`:`${i}:[0-5]\\d\\.\\d{${n.precision}}`:n.seconds?`${i}:[0-5]\\d(?:\\.\\d+)?`:`${i}(?::[0-5]\\d(?:\\.\\d+)?)?`}function vT(n){return new RegExp(`^${rp(n)}$`)}function yT(n){const i=["Z"];n.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${rp({precision:n.precision,seconds:!0})}(?:${i.join("|")})`,l=n.local?`${a}|${rp({precision:n.precision})}`:a;return new RegExp(`^${T1}T(?:${l})$`)}const bT=/^[\s\S]{0,}$/,_T=/^-?\d+$/,Kp=/^-?\d+(?:\.\d+)?$/,ST=/^(?:true|false)$/i,xT=/^[^A-Z]*$/,wT=/^[^a-z]*$/,yi=F("$ZodCheck",(n,i)=>{var a;n._zod??(n._zod={}),n._zod.def=i,(a=n._zod).onattach??(a.onattach=[])}),Gp=n=>{const i=n.value;return!nE(i)&&i.length!==void 0},Zf={number:"number",bigint:"bigint",object:"date"},O1=F("$ZodCheckLessThan",(n,i)=>{yi.init(n,i);const a=Zf[typeof i.value];n._zod.check=l=>{(i.inclusive?l.value<=i.value:l.value{yi.init(n,i);const a=Zf[typeof i.value];n._zod.check=l=>{(i.inclusive?l.value>=i.value:l.value>i.value)||l.issues.push({origin:Zf[typeof l.value]??a,code:"too_small",minimum:typeof i.value=="object"?i.value.getTime():i.value,input:l.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),zT=F("$ZodCheckMultipleOf",(n,i)=>{yi.init(n,i),n._zod.check=a=>{if(typeof a.value!=typeof i.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof a.value=="bigint"?i.value!==BigInt(0)&&a.value%i.value===BigInt(0):iE(a.value,i.value)===0)||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:i.value,input:a.value,inst:n,continue:!i.abort})}}),ET=F("$ZodCheckNumberFormat",(n,i)=>{yi.init(n,i),i.format=i.format||"float64";const a=i.format?.includes("int"),l=a?"int":"number",[u,f]=_1[i.format];n._zod.check=d=>{const h=d.value;if(a){if(!Number.isInteger(h)){d.issues.push({expected:l,format:i.format,code:"invalid_type",continue:!1,input:h,inst:n});return}if(!Number.isSafeInteger(h)){h>0?d.issues.push({input:h,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:l,inclusive:!0,continue:!i.abort}):d.issues.push({input:h,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must b)DELIM" +R"DELIM(e within the safe integer range.",inst:n,origin:l,inclusive:!0,continue:!i.abort});return}}hf&&d.issues.push({origin:"number",input:h,code:"too_big",maximum:f,inclusive:!0,inst:n,continue:!i.abort})}}),TT=F("$ZodCheckMaxLength",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Gp),n._zod.check=l=>{const u=l.value,f=u.length;if((typeof u=="string"&&f>i.maximum?Hp(u):f)<=i.maximum)return;const h=Bp(u);l.issues.push({origin:h,code:"too_big",maximum:i.maximum,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),OT=F("$ZodCheckMinLength",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Gp),n._zod.check=l=>{const u=l.value,f=u.length;if((typeof u=="string"&&f>=i.minimum&&f=i.minimum)return;const h=Bp(u);l.issues.push({origin:h,code:"too_small",minimum:i.minimum,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),NT=F("$ZodCheckLengthEquals",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Gp),n._zod.check=l=>{const u=l.value,f=u.length,d=typeof u=="string"&&f>=i.length&&f<=i.length*2?Hp(u):f;if(d===i.length)return;const h=Bp(u),p=d>i.length;l.issues.push({origin:h,...p?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:l.value,inst:n,continue:!i.abort})}}),td=F("$ZodCheckStringFormat",(n,i)=>{var a,l;yi.init(n,i),i.pattern?(a=n._zod).check??(a.check=u=>{i.pattern.lastIndex=0,!i.pattern.test(u.value)&&u.issues.push({origin:"string",code:"invalid_format",format:i.format,input:u.value,...i.pattern?{pattern:i.pattern.toString()}:{},inst:n,continue:!i.abort})}):(l=n._zod).check??(l.check=()=>{})}),AT=F("$ZodCheckRegex",(n,i)=>{td.init(n,i),n._zod.check=a=>{i.pattern.lastIndex=0,!i.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),MT=F("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=xT),td.init(n,i)}),jT=F("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=wT),td.init(n,i)}),kT=F("$ZodCheckIncludes",(n,i)=>{yi.init(n,i);const a=ro(i.includes),l=new RegExp(typeof i.position=="number"?`^.{${i.position},}${a}`:a);i.pattern=l,n._zod.check=u=>{u.value.includes(i.includes,i.position)||u.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:i.includes,input:u.value,inst:n,continue:!i.abort})}}),RT=F("$ZodCheckStartsWith",(n,i)=>{yi.init(n,i);const a=new RegExp(`^${ro(i.prefix)}.*`);i.pattern??(i.pattern=a),n._zod.check=l=>{l.value.startsWith(i.prefix)||l.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:l.value,inst:n,continue:!i.abort})}}),CT=F("$ZodCheckEndsWith",(n,i)=>{yi.init(n,i);const a=new RegExp(`.*${ro(i.suffix)}$`);i.pattern??(i.pattern=a),n._zod.check=l=>{l.value.endsWith(i.suffix)||l.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:l.value,inst:n,continue:!i.abort})}}),DT=F("$ZodCheckOverwrite",(n,i)=>{yi.init(n,i),n._zod.check=a=>{a.value=i.tx(a.value)}});class UT{constructor(i=[],a={}){this.content=[],this.indent=0,this.args=i,this.closed=a}indented(i){this.indent+=1;try{i(this)}finally{this.indent-=1}}write(i){if(typeof i=="function"){i(this,{execution:"sync"}),i(this,{execution:"async"});return}const l=i.split(` `).filter(d=>d),u=Math.min(...l.map(d=>d.length-d.trimStart().length)),f=l.map(d=>d.slice(u)).map(d=>" ".repeat(this.indent*2)+d);for(const d of f)this.content.push(d)}compile(){const i=Function,a=this?.content??[""];return new i(...Object.keys(this.closed),`return function (${this.args.join(", ")}) { ${a.join(` `)} -};`)(...Object.values(this.closed))}}const CE={major:4,minor:6,patch:7},Ot=Y("$ZodType",(n,i)=>{var a;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=CE;const l=n._zod.def.checks,u=n._zod.traits.has("$ZodCheck")?[n,...l??[]]:l?.length?[...l]:[];for(const f of u)for(const d of f._zod.onattach)d(n);if(u.length===0)(a=n._zod).deferred??(a.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{const f=(m,p,g)=>{if(m.memo)return m;let b=_r(m),y;for(const w of p){if(w._zod.def.when){if(mT(m)||!w._zod.def.when(m))continue}else if(b)continue;const O=m.issues.length,T=w._zod.check(m);if(T instanceof Promise&&g?.async===!1)throw new Ja;if(y||T instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await T,m.issues.length!==O&&(ep(m.issues,O,n),b||(b=_r(m,O)))});else{if(m.issues.length===O)continue;ep(m.issues,O,n),b||(b=_r(m,O))}}return y?y.then(()=>m):m},d=(m,p,g)=>{if(_r(m))return m.aborted=!0,m;const b=f(p,u,g);if(b instanceof Promise){if(g.async===!1)throw new Ja;return b.then(y=>n._zod.parse(y,g))}return n._zod.parse(b,g)};n._zod.run=(m,p)=>{if(p.skipChecks)return n._zod.parse(m,p);if(p.direction==="backward"){const b=n._zod.parse({value:m.value,issues:[]},{...p,skipChecks:!0});return b instanceof Promise?b.then(y=>d(y,m,p)):d(b,m,p)}const g=n._zod.parse(m,p);if(g instanceof Promise){if(p.async===!1)throw new Ja;return g.then(b=>f(b,u,p))}return f(g,u,p)}}},{get"~standard"(){return y1(this,"~standard",E1(this))},set"~standard"(n){Xs(this,"~standard",n)}}),T1=(n,i)=>n.issues.length?{issues:n.issues.map(a=>Js(a,i,Br()))}:{value:n.value};async function DE(n,i){const a={async:!0};return T1(await n._zod.run({value:i,issues:[]},a),a)}function E1(n){return{validate:i=>{const a={async:!1};try{const l=n._zod.run({value:i,issues:[]},a);if(!(l instanceof Promise))return T1(l,a)}catch{}return DE(n,i)},vendor:"zod",version:1}}const Pp=Y("$ZodString",(n,i)=>{Ot.init(n,i),n._zod.pattern=i.pattern??gE,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:n}),a}}),Ct=Y("$ZodStringFormat",(n,i)=>{Xf.init(n,i),Pp.init(n,i)}),UE=Y("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=eE),Ct.init(n,i)}),ZE=Y("$ZodUUID",(n,i)=>{if(i.version){const l={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(l===void 0)throw new Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=pb(l))}else i.pattern??(i.pattern=pb());Ct.init(n,i)}),$E=Y("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=tE),Ct.init(n,i)}),O1=1,Uf=2;function N1(n){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(n):(new URL(n),!0)}catch{return!1}}function LE(n,i){return!("normalize"in i)&&!("hostname"in i)&&!("protocol"in i)?N1(n)||Uf:HE(n,i)}function HE(n,i){if(!i.normalize&&i.protocol?.source===cE.source&&!/^https?:\/\//i.test(n))return O1;try{if(typeof URL<"u"){const a=URL;if(typeof a.parse=="function")return a.parse(n)??Uf}return new URL(n)}catch{return Uf}}const BE=/[\t\n\r]/g;function gb(n){return n.replace(BE,"")}function qE(n,i){return i.lastIndex=0,i.test(n.hostname)}function VE(n,i){return i.lastIndex=0,i.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)}const IE=Y("$ZodURL",(n,i)=>{Ct.init(n,i),n._zod.check=a=>{try{const l=a.value.trim(),u=LE(l,i);if(u===O1){a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:n,continue:!i.abort});return}if(u===Uf){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:n,continue:!i.abort});return}if(u===!0){a.value=gb(l);return}i.hostname&&!qE(u,i.hostname)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:a.value,inst:n,continue:!i.abort}),i.protocol&&!VE(u,i.protocol)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:a.value,inst:n,continue:!i.abort}),a.value=i.normalize?u.href:gb(l);return}catch{a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:n,continue:!i.abort})}}}),PE=Y("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=iE()),Ct.init(n,i)}),KE=Y("$ZodNanoID",(n,i)=>{if(i.length!==void 0&&(!Number.isInteger(i.length)||i.length<1))throw new Error(`Invalid nanoid length: ${i.length}`);i.pattern??(i.pat)DELIM" -R"DELIM(tern=i.length===void 0?JT:XT(i.length)),Ct.init(n,i)}),GE=Y("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=KT),Ct.init(n,i)}),YE=Y("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=GT),Ct.init(n,i)}),FE=Y("$ZodULID",(n,i)=>{i.pattern??(i.pattern=YT),Ct.init(n,i)}),QE=Y("$ZodXID",(n,i)=>{i.pattern??(i.pattern=FT),Ct.init(n,i)}),JE=Y("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=QT),Ct.init(n,i)}),XE=Y("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=pE(i)),Ct.init(n,i)}),WE=Y("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=hE),Ct.init(n,i)}),eO=Y("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=mE(i)),Ct.init(n,i)}),tO=Y("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=WT),Ct.init(n,i)}),nO=Y("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=rE),Ct.init(n,i)}),iO=/^[0-9a-fA-F:.]+$/;function A1(n){return iO.test(n)?N1(`http://[${n}]`):!1}const rO=Y("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=sE),Ct.init(n,i),n._zod.check=a=>{A1(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:n,continue:!i.abort})}}),sO=Y("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=aE),Ct.init(n,i)});function aO(n){const i=n.split("/");if(i.length!==2)return!1;const[a,l]=i;if(!l)return!1;const u=Number(l);return`${u}`!==l||u<0||u>128?!1:A1(a)}const lO=Y("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=lE),Ct.init(n,i),n._zod.check=a=>{aO(a.value)||a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:n,continue:!i.abort})}});function M1(n){if(n==="")return!0;if(/\s/.test(n)||n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const j1=/^[0-9a-zA-Z+/]*={0,2}$/,oO=Y("$ZodBase64",(n,i)=>{i.pattern??(i.pattern=j1),Ct.init(n,i),n._zod.check=a=>{M1(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:n,continue:!i.abort})}}),Kp=/^[A-Za-z0-9_-]*$/;function uO(n){if(!Kp.test(n))return!1;const i=n.replace(/[-_]/g,l=>l==="-"?"+":"/"),a=i.padEnd(Math.ceil(i.length/4)*4,"=");return M1(a)}const cO=Y("$ZodBase64URL",(n,i)=>{i.pattern??(i.pattern=Kp),Ct.init(n,i),n._zod.check=a=>{uO(a.value)||a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:n,continue:!i.abort})}}),fO=Y("$ZodE164",(n,i)=>{i.pattern??(i.pattern=fE),Ct.init(n,i)});function dO(n,i=null){try{const a=n.split(".");if(a.length!==3)return!1;const[l]=a;if(!l)return!1;const u=JSON.parse(atob(l));return!("typ"in u&&u?.typ!=="JWT"||!u.alg||i&&(!("alg"in u)||u.alg!==i))}catch{return!1}}const hO=Y("$ZodJWT",(n,i)=>{Ct.init(n,i),n._zod.check=a=>{dO(a.value,i.alg)||a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:n,continue:!i.abort})}}),k1=Y("$ZodNumber",(n,i)=>{Ot.init(n,i),n._zod.pattern=Vp,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=Number(a.value)}catch{}const u=a.value;if(typeof u=="number"&&!Number.isNaN(u)&&Number.isFinite(u))return a;const f=typeof u=="number"?Number.isNaN(u)?"NaN":Number.isFinite(u)?void 0:String(u):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:u,inst:n,...f?{received:f}:{}}),a}}),mO=Y("$ZodNumberFormat",(n,i)=>{xE.init(n,i),k1.init(n,i)}),pO=Y("$ZodBoolean",(n,i)=>{Ot.init(n,i),n._zod.pattern=yE,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=!!a.value}catch{}const u=a.value;return typeof u=="boolean"||a.issues.push({expected:"boolean",code:"invalid_type",input:u,inst:n}),a}}),gO=Y("$ZodUnknown",(n,i)=>{Ot.init(n,i),n._zod.parse=a=>a}),vO=Y("$ZodNever",(n,i)=>{Ot.init(n,i),n._zod.parse=(a,l)=>(a.issues.push({expected:"never",code:"invalid_type",input:a.value,inst:n}),a)});function yO(n,i){const a=fb(n._zod.def.checks);if(!a.length)return;const l=Math.min(...a.map(f=>f[0])),u=n._zod.parse;n._zod.parse=(f,d)=>{const m=i(f.value);if(m>l&&!d?.skipChecks&&d?.direction!=="backward"){for(const[p,g]of fb(n._zod.def.checks))if(m>p&&g._zod.def.when(f)){const b=f.issues.length;return g._zod.check(f),f.issues[b].continue=!1,ep(f.issues,b,n),f}}return u(f,d)}}const bO=n=>Array.isArray(n)?n.length:-1;function vb(n,i,a){n.issues.length&&i.issues.push(...Qs(a,n.issues)),i.value[a]=n.value}const _O=Y("$ZodArray",(n,i)=>{Ot.init(n,i);const a=er.memoizer;a?.attach(n),n._zod.parse=(l,u)=>{const f=l.value;if(!Array.isArray(f))return l.issues.push({expected:"array",code:"invalid_type",input:f,inst:n}),l;l.value=a?a.alloc(n,l,Array(f.length),u):Array(f.length);const d=[],m=u?.abortEarly;for(let p=0;pvb(y,l,p)));else if(vb(b,l,p),m&&b.issues.length!==0&&_r(b))break}return d.length?Promise.all(d).then(()=>l):l},yO(n,bO)});function Zf(n,i,a,l,u,f){const d=a in l,m=f==="optional";if(!(!d&&m&&u==="optional")){if(n.issues.length){if(u!==void 0&&m&&!d)return;i.issues.push(...Qs(a,n.issues))}if(!d&&u===void 0){n.issues.length||i.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}n.value===void 0?(d||u==="defaulted"&&!m)&&(i.value[a]=void 0):i.value[a]=n.value}}const SO=[];function R1(n){const i=Object.keys(n.shape),a=Object.getOwnPropertySymbols(n.shape),l=a.length?a:SO,u=l.length?[...i,...l]:i;for(const d of u)if(!n.shape?.[d]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(d)}": expected a Zod schema`);const f=aT(n.shape);return{...n,allKeys:u,symbolKeys:l,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(f)}}function C1(n,i,a,l,u,f,d){const m=[],p=u.keySet,g=u.catchall._zod,b=g.def.type,y=g.optin,w=g.optout;let O=0;for(const T in i){if(d&&a.issues.length!==O){if(_r(a,O))break;O=a.issues.length}if(p.has(T))continue;if(T==="__proto__"){b==="never"&&m.push(T);continue}if(b==="never"){m.push(T);continue}const A=g.run({value:i[T],issues:[]},l);A instanceof Promise?n.push(A.then(k=>Zf(k,a,T,i,y,w))):Zf(A,a,T,i,y,w)}return m.length&&a.issues.push({code:"unrecognized_keys",keys:m,input:i,inst:f,continue:!0}),n.length?Promise.all(n).then(()=>a):a}const xO=Y("$ZodObject",(n,i)=>{Ot.init(n,i);const a=Object.getOwnPropertyDescriptor(i,"shape"),l=a?.get?a.get.raw:i.shape??{};if(l){const g=()=>{const b={...l};return Object.defineProperty(i,"shape",{value:b}),g.raw=b,b};g.raw=l,Object.defineProperty(i,"shape",{get:g})}const u=Dp(()=>R1(i));ot(n,"propValues",g=>{const b=g.def.shape,y={};for(const w in b){const O=b[w]._zod;if(O.values){Object.prototype.hasOwnProperty.call(y,w)||ta(y,w,new Set);for(const T of O.values)y[w].add(T);O.optin!==void 0&&y[w].add(void 0)}}return y});const f=Cf,d=i.catchall;let m;const p=er.memoizer;p?.attach(n),n._zod.parse=(g,b)=>{m??(m=u.value);const y=g.value;if(!f(y))return g.issues.push({expected:"object",code:"invalid_type",input:y,inst:n}),g;g.value=p?p.alloc(n,g,{},b):{};const w=[],O=m.shape,T=b?.abortEarly;let A=g.issues.length;for(const k of m.allKeys){if(T&&g.issues.length!==A){if(_r(g,A))break;A=g.issues.length}if(k==="__proto__")continue;const L=O[k],D=L._zod.optin,X=L._zod.optout,G=L._zod.run({value:y[k],issues:[]},b);G instanceof Promise?w.push(G.then(ee=>Zf(ee,g,k,y,D,X))):Zf(G,g,k,y,D,X)}return d?C1(w,y,g,b,u.value,n,T===!0):w.length?Promise.all(w).then(()=>g):g}}),wO=Y("$ZodObjectJIT",(n,i)=>{xO.init(n,i);const a=n._zod.parse,l=Dp(()=>R1(i)),u=er.memoizer,f=O=>{const T=l.value,A=T.symbolKeys,k=new RE(["payload","ctx"],{shape:O,inst:n,memo:u,syms:A}),L=ee=>`shape[${ee}]._zod.run({ value: input[${ee}], issues: [] }, ctx)`,D=(ee,V)=>` - let ${ee}_ab = false; - for (let i = 0; i < ${ee}.issues.length; i++) { - const iss = ${ee}.issues[i]; +};`)(...Object.values(this.closed))}}const ZT={major:4,minor:6,patch:7},Nt=F("$ZodType",(n,i)=>{var a;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=ZT;const l=n._zod.def.checks,u=n._zod.traits.has("$ZodCheck")?[n,...l??[]]:l?.length?[...l]:[];for(const f of u)for(const d of f._zod.onattach)d(n);if(u.length===0)(a=n._zod).deferred??(a.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{const f=(h,p,g)=>{if(h.memo)return h;let b=_s(h),v;for(const w of p){if(w._zod.def.when){if(vE(h)||!w._zod.def.when(h))continue}else if(b)continue;const T=h.issues.length,E=w._zod.check(h);if(E instanceof Promise&&g?.async===!1)throw new Xa;if(v||E instanceof Promise)v=(v??Promise.resolve()).then(async()=>{await E,h.issues.length!==T&&(sp(h.issues,T,n),b||(b=_s(h,T)))});else{if(h.issues.length===T)continue;sp(h.issues,T,n),b||(b=_s(h,T))}}return v?v.then(()=>h):h},d=(h,p,g)=>{if(_s(h))return h.aborted=!0,h;const b=f(p,u,g);if(b instanceof Promise){if(g.async===!1)throw new Xa;return b.then(v=>n._zod.parse(v,g))}return n._zod.parse(b,g)};n._zod.run=(h,p)=>{if(p.skipChecks)return n._zod.parse(h,p);if(p.direction==="backward"){const b=n._zod.parse({value:h.value,issues:[]},{...p,skipChecks:!0});return b instanceof Promise?b.then(v=>d(v,h,p)):d(b,h,p)}const g=n._zod.parse(h,p);if(g instanceof Promise){if(p.async===!1)throw new Xa;return g.then(b=>f(b,u,p))}return f(g,u,p)}}},{get"~standard"(){return x1(this,"~standard",M1(this))},set"~standard"(n){Xr(this,"~standard",n)}}),A1=(n,i)=>n.issues.length?{issues:n.issues.map(a=>Jr(a,i,Bs()))}:{value:n.value};async function LT(n,i){const a={async:!0};return A1(await n._zod.run({value:i,issues:[]},a),a)}function M1(n){return{validate:i=>{const a={async:!1};try{const l=n._zod.run({value:i,issues:[]},a);if(!(l instanceof Promise))return A1(l,a)}catch{}return LT(n,i)},vendor:"zod",version:1}}const Yp=F("$ZodString",(n,i)=>{Nt.init(n,i),n._zod.pattern=i.pattern??bT,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:n}),a}}),Ct=F("$ZodStringFormat",(n,i)=>{td.init(n,i),Yp.init(n,i)}),$T=F("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=iT),Ct.init(n,i)}),HT=F("$ZodUUID",(n,i)=>{if(i.version){const l={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(l===void 0)throw new Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=vb(l))}else i.pattern??(i.pattern=vb());Ct.init(n,i)}),BT=F("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=sT),Ct.init(n,i)}),j1=1,Lf=2;function k1(n){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(n):(new URL(n),!0)}catch{return!1}}function qT(n,i){return!("normalize"in i)&&!("hostname"in i)&&!("protocol"in i)?k1(n)||Lf:IT(n,i)}function IT(n,i){if(!i.normalize&&i.protocol?.source===hT.source&&!/^https?:\/\//i.test(n))return j1;try{if(typeof URL<"u"){const a=URL;if(typeof a.parse=="function")return a.parse(n)??Lf}return new URL(n)}catch{return Lf}}const VT=/[\t\n\r]/g;function yb(n){return n.replace(VT,"")}function PT(n,i){return i.lastIndex=0,i.test(n.hostname)}function KT(n,i){return i.lastIndex=0,i.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)}const GT=F("$ZodURL",(n,i)=>{Ct.init(n,i),n._zod.check=a=>{try{const l=a.value.trim(),u=qT(l,i);if(u===j1){a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:n,continue:!i.abort});return}if(u===Lf){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:n,continue:!i.abort});return}if(u===!0){a.value=yb(l);return}i.hostname&&!PT(u,i.hostname)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:a.value,inst:n,continue:!i.abort}),i.protocol&&!KT(u,i.protocol)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:a.value,inst:n,continue:!i.abort}),a.value=i.normalize?u.href:yb(l);return}catch{a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:n,continue:!i.abort})}}}),YT=F("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=aT()),Ct.init(n,i)}),FT=F("$ZodNanoID",(n,i)=>{if(i.length!==void 0&&(!Number.isInteger(i.length)||i.length<1))throw new Error(`Invalid nanoid l)DELIM" +R"DELIM(ength: ${i.length}`);i.pattern??(i.pattern=i.length===void 0?eT:tT(i.length)),Ct.init(n,i)}),QT=F("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=FE),Ct.init(n,i)}),JT=F("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=QE),Ct.init(n,i)}),XT=F("$ZodULID",(n,i)=>{i.pattern??(i.pattern=JE),Ct.init(n,i)}),WT=F("$ZodXID",(n,i)=>{i.pattern??(i.pattern=XE),Ct.init(n,i)}),e2=F("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=WE),Ct.init(n,i)}),t2=F("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=yT(i)),Ct.init(n,i)}),n2=F("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=gT),Ct.init(n,i)}),i2=F("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=vT(i)),Ct.init(n,i)}),s2=F("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=nT),Ct.init(n,i)}),r2=F("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=lT),Ct.init(n,i)}),a2=/^[0-9a-fA-F:.]+$/;function R1(n){return a2.test(n)?k1(`http://[${n}]`):!1}const l2=F("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=oT),Ct.init(n,i),n._zod.check=a=>{R1(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:n,continue:!i.abort})}}),o2=F("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=uT),Ct.init(n,i)});function u2(n){const i=n.split("/");if(i.length!==2)return!1;const[a,l]=i;if(!l)return!1;const u=Number(l);return`${u}`!==l||u<0||u>128?!1:R1(a)}const c2=F("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=cT),Ct.init(n,i),n._zod.check=a=>{u2(a.value)||a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:n,continue:!i.abort})}});function C1(n){if(n==="")return!0;if(/\s/.test(n)||n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const D1=/^[0-9a-zA-Z+/]*={0,2}$/,f2=F("$ZodBase64",(n,i)=>{i.pattern??(i.pattern=D1),Ct.init(n,i),n._zod.check=a=>{C1(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:n,continue:!i.abort})}}),Fp=/^[A-Za-z0-9_-]*$/;function d2(n){if(!Fp.test(n))return!1;const i=n.replace(/[-_]/g,l=>l==="-"?"+":"/"),a=i.padEnd(Math.ceil(i.length/4)*4,"=");return C1(a)}const h2=F("$ZodBase64URL",(n,i)=>{i.pattern??(i.pattern=Fp),Ct.init(n,i),n._zod.check=a=>{d2(a.value)||a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:n,continue:!i.abort})}}),m2=F("$ZodE164",(n,i)=>{i.pattern??(i.pattern=mT),Ct.init(n,i)});function p2(n,i=null){try{const a=n.split(".");if(a.length!==3)return!1;const[l]=a;if(!l)return!1;const u=JSON.parse(atob(l));return!("typ"in u&&u?.typ!=="JWT"||!u.alg||i&&(!("alg"in u)||u.alg!==i))}catch{return!1}}const g2=F("$ZodJWT",(n,i)=>{Ct.init(n,i),n._zod.check=a=>{p2(a.value,i.alg)||a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:n,continue:!i.abort})}}),U1=F("$ZodNumber",(n,i)=>{Nt.init(n,i),n._zod.pattern=Kp,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=Number(a.value)}catch{}const u=a.value;if(typeof u=="number"&&!Number.isNaN(u)&&Number.isFinite(u))return a;const f=typeof u=="number"?Number.isNaN(u)?"NaN":Number.isFinite(u)?void 0:String(u):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:u,inst:n,...f?{received:f}:{}}),a}}),v2=F("$ZodNumberFormat",(n,i)=>{ET.init(n,i),U1.init(n,i)}),y2=F("$ZodBoolean",(n,i)=>{Nt.init(n,i),n._zod.pattern=ST,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=!!a.value}catch{}const u=a.value;return typeof u=="boolean"||a.issues.push({expected:"boolean",code:"invalid_type",input:u,inst:n}),a}}),b2=F("$ZodUnknown",(n,i)=>{Nt.init(n,i),n._zod.parse=a=>a}),_2=F("$ZodNever",(n,i)=>{Nt.init(n,i),n._zod.parse=(a,l)=>(a.issues.push({expected:"never",code:"invalid_type",input:a.value,inst:n}),a)});function S2(n,i){const a=hb(n._zod.def.checks);if(!a.length)return;const l=Math.min(...a.map(f=>f[0])),u=n._zod.parse;n._zod.parse=(f,d)=>{const h=i(f.value);if(h>l&&!d?.skipChecks&&d?.direction!=="backward"){for(const[p,g]of hb(n._zod.def.checks))if(h>p&&g._zod.def.when(f)){const b=f.issues.length;return g._zod.check(f),f.issues[b].continue=!1,sp(f.issues,b,n),f}}return u(f,d)}}const x2=n=>Array.isArray(n)?n.length:-1;function bb(n,i,a){n.issues.length&&i.issues.push(...Qr(a,n.issues)),i.value[a]=n.value}const w2=F("$ZodArray",(n,i)=>{Nt.init(n,i);const a=es.memoizer;a?.attach(n),n._zod.parse=(l,u)=>{const f=l.value;if(!Array.isArray(f))return l.issues.push({expected:"array",code:"invalid_type",input:f,inst:n}),l;l.value=a?a.alloc(n,l,Array(f.length),u):Array(f.length);const d=[],h=u?.abortEarly;for(let p=0;pbb(v,l,p)));else if(bb(b,l,p),h&&b.issues.length!==0&&_s(b))break}return d.length?Promise.all(d).then(()=>l):l},S2(n,x2)});function $f(n,i,a,l,u,f){const d=a in l,h=f==="optional";if(!(!d&&h&&u==="optional")){if(n.issues.length){if(u!==void 0&&h&&!d)return;i.issues.push(...Qr(a,n.issues))}if(!d&&u===void 0){n.issues.length||i.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}n.value===void 0?(d||u==="defaulted"&&!h)&&(i.value[a]=void 0):i.value[a]=n.value}}const z2=[];function Z1(n){const i=Object.keys(n.shape),a=Object.getOwnPropertySymbols(n.shape),l=a.length?a:z2,u=l.length?[...i,...l]:i;for(const d of u)if(!n.shape?.[d]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(d)}": expected a Zod schema`);const f=uE(n.shape);return{...n,allKeys:u,symbolKeys:l,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(f)}}function L1(n,i,a,l,u,f,d){const h=[],p=u.keySet,g=u.catchall._zod,b=g.def.type,v=g.optin,w=g.optout;let T=0;for(const E in i){if(d&&a.issues.length!==T){if(_s(a,T))break;T=a.issues.length}if(p.has(E))continue;if(E==="__proto__"){b==="never"&&h.push(E);continue}if(b==="never"){h.push(E);continue}const A=g.run({value:i[E],issues:[]},l);A instanceof Promise?n.push(A.then(k=>$f(k,a,E,i,v,w))):$f(A,a,E,i,v,w)}return h.length&&a.issues.push({code:"unrecognized_keys",keys:h,input:i,inst:f,continue:!0}),n.length?Promise.all(n).then(()=>a):a}const E2=F("$ZodObject",(n,i)=>{Nt.init(n,i);const a=Object.getOwnPropertyDescriptor(i,"shape"),l=a?.get?a.get.raw:i.shape??{};if(l){const g=()=>{const b={...l};return Object.defineProperty(i,"shape",{value:b}),g.raw=b,b};g.raw=l,Object.defineProperty(i,"shape",{get:g})}const u=Lp(()=>Z1(i));ot(n,"propValues",g=>{const b=g.def.shape,v={};for(const w in b){const T=b[w]._zod;if(T.values){Object.prototype.hasOwnProperty.call(v,w)||ta(v,w,new Set);for(const E of T.values)v[w].add(E);T.optin!==void 0&&v[w].add(void 0)}}return v});const f=Uf,d=i.catchall;let h;const p=es.memoizer;p?.attach(n),n._zod.parse=(g,b)=>{h??(h=u.value);const v=g.value;if(!f(v))return g.issues.push({expected:"object",code:"invalid_type",input:v,inst:n}),g;g.value=p?p.alloc(n,g,{},b):{};const w=[],T=h.shape,E=b?.abortEarly;let A=g.issues.length;for(const k of h.allKeys){if(E&&g.issues.length!==A){if(_s(g,A))break;A=g.issues.length}if(k==="__proto__")continue;const L=T[k],U=L._zod.optin,W=L._zod.optout,I=L._zod.run({value:v[k],issues:[]},b);I instanceof Promise?w.push(I.then(Q=>$f(Q,g,k,v,U,W))):$f(I,g,k,v,U,W)}return d?L1(w,v,g,b,u.value,n,E===!0):w.length?Promise.all(w).then(()=>g):g}}),T2=F("$ZodObjectJIT",(n,i)=>{E2.init(n,i);const a=n._zod.parse,l=Lp(()=>Z1(i)),u=es.memoizer,f=T=>{const E=l.value,A=E.symbolKeys,k=new UT(["payload","ctx"],{shape:T,inst:n,memo:u,syms:A}),L=Q=>`shape[${Q}]._zod.run({ value: input[${Q}], issues: [] }, ctx)`,U=(Q,V)=>` + let ${Q}_ab = false; + for (let i = 0; i < ${Q}.issues.length; i++) { + const iss = ${Q}.issues[i]; iss.path = iss.path ? [${V}, ...iss.path] : [${V}]; payload.issues.push(iss); - if (iss.continue !== true) ${ee}_ab = true; + if (iss.continue !== true) ${Q}_ab = true; } - if (${ee}_ab && ctx && ctx.abortEarly) { + if (${Q}_ab && ctx && ctx.abortEarly) { payload.value = newResult; return payload; - }`;k.write("const input = payload.value;");const X=Object.create(null);let G=0;for(const ee of T.allKeys)X[ee]=`key_${G++}`;k.write(u?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const ee of T.allKeys){if(ee==="__proto__")continue;const V=X)DELIM" -R"DELIM([ee],ne=typeof ee=="symbol"?`syms[${A.indexOf(ee)}]`:nT(ee),ae=`${ne} in input`,ye=O[ee],ue=ye?._zod?.optin,J=ue!==void 0,we=ye?._zod?.optout==="optional";if(k.write(`const ${V} = ${L(ne)};`),J&&we){const he=ue==="optional"?`${V}_present`:`${V}.value !== undefined || ${V}_present`;k.write(` - const ${V}_present = ${ae}; + }`;k.write("const input = payload.value;");const W=Object.create(null);let I=0;for(const Q of E.allKeys)W[Q]=`key_${I++}`;k.write(u?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const Q of E.allKeys){if(Q==="__prot)DELIM" +R"DELIM(o__")continue;const V=W[Q],ne=typeof Q=="symbol"?`syms[${A.indexOf(Q)}]`:rE(Q),ie=`${ne} in input`,Ae=T[Q],ye=Ae?._zod?.optin,Y=ye!==void 0,ae=Ae?._zod?.optout==="optional";if(k.write(`const ${V} = ${L(ne)};`),Y&&ae){const se=ye==="optional"?`${V}_present`:`${V}.value !== undefined || ${V}_present`;k.write(` + const ${V}_present = ${ie}; if (!${V}.issues.length || ${V}_present) { - if (${V}.issues.length) {${D(V,ne)} + if (${V}.issues.length) {${U(V,ne)} } - if (${he}) { + if (${se}) { newResult[${ne}] = ${V}.value; } } - `)}else J?(k.write(` - if (${V}.issues.length) {${D(V,ne)} + `)}else Y?(k.write(` + if (${V}.issues.length) {${U(V,ne)} } - `),ue==="defaulted"?k.write(`newResult[${ne}] = ${V}.value;`):k.write(` - if (${V}.value !== undefined || ${ae}) { + `),ye==="defaulted"?k.write(`newResult[${ne}] = ${V}.value;`):k.write(` + if (${V}.value !== undefined || ${ie}) { newResult[${ne}] = ${V}.value; } `)):k.write(` - const ${V}_present = ${ae}; - if (${V}.issues.length) {${D(V,ne)} + const ${V}_present = ${ie}; + if (${V}.issues.length) {${U(V,ne)} } if (!${V}_present && !${V}.issues.length) { payload.issues.push({ @@ -269,56 +269,57 @@ R"DELIM([ee],ne=typeof ee=="symbol"?`syms[${A.indexOf(ee)}]`:nT(ee),ae=`${ne} in newResult[${ne}] = ${V}.value; } - `)}return k.write("payload.value = newResult;"),k.write("return payload;"),k.compile()};let d;const m=Cf,p=!er.jitless,b=p&&rT.value,y=i.catchall;let w;n._zod.parse=(O,T)=>{w??(w=l.value);const A=O.value;return m(A)?p&&b&&T?.async===!1&&T.jitless!==!0?(d||(d=f(i.shape)),O=d(O,T),y?C1([],A,O,T,w,n,T?.abortEarly===!0):O):a(O,T):(O.issues.push({expected:"object",code:"invalid_type",input:A,inst:n}),O)}});function yb(n,i,a,l){for(const f of n)if(f.issues.length===0)return i.value=f.value,i;const u=n.filter(f=>!_r(f));return u.length===1?(i.value=u[0].value,u[0]):(i.issues.push({code:"invalid_union",input:i.value,inst:a,errors:n.map(f=>f.issues.map(d=>Js(d,l,Br())))}),i)}const zO=Y("$ZodUnion",(n,i)=>{Ot.init(n,i),ot(n,"optin",l=>l.def.options.some(u=>u._zod.optin==="defaulted")?"defaulted":l.def.options.some(u=>u._zod.optin!==void 0)?"optional":void 0),ot(n,"optout",l=>l.def.options.some(u=>u._zod.optout==="optional")?"optional":void 0),ot(n,"values",l=>{if(l.def.options.every(u=>u._zod.values))return new Set(l.def.options.flatMap(u=>Array.from(u._zod.values)))}),ot(n,"pattern",l=>{if(l.def.options.every(u=>u._zod.pattern)){const u=l.def.options.map(f=>f._zod.pattern);return new RegExp(`^(${u.map(f=>Up(f.source)).join("|")})$`)}});const a=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(l,u)=>{if(a)return a(l,u);let f=!1;const d=[];for(const m of i.options){const p=m._zod.run({value:l.value,issues:[]},u);if(p instanceof Promise)d.push(p),f=!0;else{if(p.issues.length===0)return p;d.push(p)}}return f?Promise.all(d).then(m=>yb(m,l,n,u)):yb(d,l,n,u)}}),TO=Y("$ZodIntersection",(n,i)=>{Ot.init(n,i),n._zod.parse=(a,l)=>{const u=a.value,f=i.left._zod.run({value:u,issues:[]},l),d=i.right._zod.run({value:u,issues:[]},l);return f instanceof Promise||d instanceof Promise?Promise.all([f,d]).then(([p,g])=>bb(a,p,g)):bb(a,f,d)}});function np(n,i){if(n===i)return{valid:!0,data:n};if(n instanceof Date&&i instanceof Date&&+n==+i)return{valid:!0,data:n};if(io(n)&&io(i)){const a=Object.keys(i),l=Object.keys(n).filter(f=>a.indexOf(f)!==-1),u={...n,...i};Object.prototype.hasOwnProperty.call(u,"__proto__")&&delete u.__proto__;for(const f of l){if(f==="__proto__")continue;const d=np(n[f],i[f]);if(!d.valid)return{valid:!1,mergeErrorPath:[f,...d.mergeErrorPath]};u[f]=d.data}return{valid:!0,data:u}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let l=0;l{let y;if(g.code==="unrecognized_keys"&&!g.path?.length)u??(u=g),y=g.keys;else if(g.code==="invalid_key"&&g.origin==="record"&&g.path?.length===1){const w=String(g.path[0]);f.has(w)||f.set(w,g),y=[w]}else return!1;for(const w of y)l.has(w)||l.set(w,{}),l.get(w)[b]=!0;return!0};for(const g of i.issues)d(g,"l")||n.issues.push(g);for(const g of a.issues)d(g,"r")||n.issues.push(g);const m=[...l].filter(([,g])=>g.l&&g.r).map(([g])=>g);if(m.length){const g=u?m.filter(b=>u.keys.includes(b)):[];g.length&&n.issues.push({...u,keys:g});for(const b of m)!g.includes(b)&&f.has(b)&&n.issues.push(f.get(b))}const p=np(i.value,a.value);if(!p.valid){if(_r(n))return n;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(p.mergeErrorPath)}`)}return n.value=p.data,n}const EO=Y("$ZodTuple",(n,i)=>{Ot.init(n,i);const a=i.items,l=er.memoizer;l?.attach(n),n._zod.parse=(u,f)=>{const d=u.value;if(!Array.isArray(d))return u.issues.push({input:d,inst:n,expected:"tuple",code:"invalid_type"}),u;u.value=l?l.alloc(n,u,[],f):[];const m=[],p=_b(a,"optin"),g=_b(a,"optout");if(!i.rest){if(d.lengtha.length&&u.issues.push({code:"too_big",maximum:a.length,inclusive:!0,input:d,inst:n,origin:"array"})}const b=new Array(a.length),y=i.rest?f?.abortEarly:void 0;let w=!1;for(let O=0;O{b[O]=A})):(b[O]=T,y&&!w&&T.issues.length&&(w=_r(T)))}if(i.rest&&!w){let O=a.length-1;const T=d.slice(a.length);let A=u.issues.length;for(const k of T){if(y&&u.issues.length!==A){if(_r(u,A))break;A=u.issues.length}O++;const L=i.rest._zod.run({value:k,issues:[]},f);L instanceof Promise?m.push(L.then(D=>Sb(D,u,O))):Sb(L,u,O)}}return m.length?Promise.all(m).then(()=>xb(b,u,a,d,g)):xb(b,u,a,d,g)}});function _b(n,i){for(let a=n.length-1;a>=0;a--)if(!(i==="optin"?n[a]._zod.optin!==void 0:n[a]._zod.optout==="optional"))return a+1;return 0}function Sb(n,i,a){n.issues.length&&i.issues.push(...Qs(a,n.issues)),i.value[a]=n.value}function xb(n,i,a,l,u){for(let f=0;f=u&&a[f]._zod.optin==="optional"){i.value.length=f;break}if(d.issues.length){if(!m&&f>=u){i.value.length=f;break}i.issues.push(...Qs(f,d.issues))}i.value[f]=d.value}for(let f=i.value.length-1;f>=l.length&&(a[f]._zod.optout==="optional"&&i.value[f]===void 0);f--)i.value.length=f;return i}const OO=Y("$ZodRecord",(n,i)=>{Ot.init(n,i);const a=er.memoizer;a?.attach(n),n._zod.parse=(l,u)=>{const f=l.value;if(!io(f))return l.issues.push({expected:"record",code:"invalid_type",input:f,inst:n}),l;const d=[],m=i.keyType._zod.values;if(m&&!i.partial){l.value=a?a.alloc(n,l,{},u):{};const p=new Set;for(const b of m)if(typeof b=="string"||typeof b=="number"||typeof b=="symbol"){if(p.add(typeof b=="number"?b.toString():b),b==="__proto__")continue;const y=i.keyType._zod.run({value:b,issues:[]},u);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(y.issues.length){l.issues.push({code:"invalid_key",origin:"record",issues:y.issues.map(T=>Js(T,u,Br())),input:b,path:[b],inst:n});continue}const w=y.value;if(w==="__proto__")continue;const O=i.valueType._zod.run({value:f[b],issues:[]},u);O instanceof Promise?d.push(O.then(T=>{T.issues.length&&l.issues.push(...Qs(b,T.issues)),l.value[w]=T.value})):(O.issues.length&&l.issues.push(...Qs(b,O.issues)),l.value[w]=O.value)}let g;for(const b in f)if(!p.has(b))if(i.mode==="loose"){if(b==="__proto__")continue;l.value[b]=f[b]}else g=g??[],g.push(b);g&&g.length>0&&l.issues.push({code:"unrecognized_keys",input:f,inst:n,keys:g,continue:!0})}else{l.value=a?a.alloc(n,l,{},u):{};let p;for(const g of Reflect.ownKeys(f)){if(g==="__proto__"||!Object.prototype.propertyIsEnumerable.call(f,g))continue;let b=i.keyType._zod.run({value:g,issues:[]},u);if(b instanceof Promise)throw new Error("As)DELIM" -R"DELIM(ync schemas not supported in object keys currently");if(typeof g=="string"&&Vp.test(g)&&b.issues.length){const T=i.keyType._zod.run({value:Number(g),issues:[]},u);if(T instanceof Promise)throw new Error("Async schemas not supported in object keys currently");T.issues.length===0&&(b=T)}if(b.issues.length){i.mode==="loose"?l.value[g]=f[g]:m?(p=p??[],p.push(g)):l.issues.push({code:"invalid_key",origin:"record",issues:b.issues.map(T=>Js(T,u,Br())),input:g,path:[g],inst:n});continue}const w=b.value;if(w==="__proto__")continue;const O=i.valueType._zod.run({value:f[g],issues:[]},u);O instanceof Promise?d.push(O.then(T=>{T.issues.length&&l.issues.push(...Qs(g,T.issues)),l.value[w]=T.value})):(O.issues.length&&l.issues.push(...Qs(g,O.issues)),l.value[w]=O.value)}p&&p.length>0&&l.issues.push({code:"unrecognized_keys",input:f,inst:n,keys:p,continue:!0})}return d.length?Promise.all(d).then(()=>l):l}}),NO=Y("$ZodEnum",(n,i)=>{Ot.init(n,i);const a=Xm(i.entries),l=new Set(a);n._zod.values=l,ot(n,"pattern",u=>{const f=Xm(u.def.entries).filter(d=>sT.has(typeof d));return new RegExp(f.length?`^(${f.map(d=>ro(d.toString())).join("|")})$`:"^[^\\s\\S]$")}),n._zod.parse=(u,f)=>{const d=u.value;return l.has(d)||u.issues.push({code:"invalid_value",values:a,input:d,inst:n}),u}}),AO=Y("$ZodLiteral",(n,i)=>{Ot.init(n,i);const a=new Set(i.values);n._zod.values=a,ot(n,"pattern",l=>{const u=l.def.values;return new RegExp(u.length?`^(${u.map(f=>typeof f=="string"?ro(f):f?ro(f.toString()):String(f)).join("|")})$`:"^[^\\s\\S]$")}),n._zod.parse=(l,u)=>{const f=l.value;return a.has(f)||l.issues.push({code:"invalid_value",values:i.values,input:f,inst:n}),l}}),MO=Y("$ZodTransform",(n,i)=>{Ot.init(n,i),n._zod.optin="optional",er.memoizer?.guard(n),n._zod.parse=(a,l)=>{if(l.direction==="backward")throw new _1(n.constructor.name);const u=i.transform(a.value,a);if(l.async)return(u instanceof Promise?u:Promise.resolve(u)).then(d=>(a.value=d,a));if(u instanceof Promise)throw new Ja;return a.value=u,a}});function wb(n,i){return n.value=i.issues.length?void 0:i.value,n}const D1=Y("$ZodOptional",(n,i)=>{Ot.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),n._zod.optout="optional",ot(n,"values",a=>{const l=a.def.innerType._zod.values;return l?new Set([...l,void 0]):void 0}),ot(n,"pattern",a=>{const l=a.def.innerType._zod.pattern;return l?new RegExp(`^(${Up(l.source)})?$`):void 0}),n._zod.parse=(a,l)=>{if(a.value===void 0){if(i.innerType._zod.optin!=="defaulted")return a;const u=i.innerType._zod.run({value:a.value,issues:[]},l);return u instanceof Promise?u.then(f=>wb(a,f)):wb(a,u)}return i.innerType._zod.run(a,l)}}),jO=Y("$ZodExactOptional",(n,i)=>{D1.init(n,i),ot(n,"values",a=>a.def.innerType._zod.values),ot(n,"pattern",a=>a.def.innerType._zod.pattern),n._zod.parse=(a,l)=>i.innerType._zod.run(a,l)}),kO=Y("$ZodNullable",(n,i)=>{Ot.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin),ot(n,"optout",a=>a.def.innerType._zod.optout),ot(n,"pattern",a=>{const l=a.def.innerType._zod.pattern;return l?new RegExp(`^(${Up(l.source)}|null)$`):void 0}),ot(n,"values",a=>a.def.innerType._zod.values?new Set([...a.def.innerType._zod.values,null]):void 0),n._zod.parse=(a,l)=>a.value===null?a:i.innerType._zod.run(a,l)}),RO=Y("$ZodDefault",(n,i)=>{Ot.init(n,i),n._zod.optin="defaulted",ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);if(a.value===void 0)return a.value=i.defaultValue,a;const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(f=>zb(f,i)):zb(u,i)}});function zb(n,i){return n.value===void 0&&(n.value=i.defaultValue),n}const CO=Y("$ZodPrefault",(n,i)=>{Ot.init(n,i),n._zod.optin="defaulted",ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>(l.direction==="backward"||a.value===void 0&&(a.value=i.defaultValue),i.innerType._zod.run(a,l))}),DO=Y("$ZodNonOptional",(n,i)=>{Ot.init(n,i),ot(n,"values",a=>{const l=a.def.innerType._zod.values;return l?new Set([...l].filter(u=>u!==void 0)):void 0}),n._zod.parse=(a,l)=>{const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(f=>Tb(f,n)):Tb(u,n)}});function Tb(n,i){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:i}),n}function Eb(n,i,a,l){return i.issues.length?(n.value=a.catchValue({...i,value:n.value,error:{issues:i.issues.map(u=>Js(u,l,Br()))},input:n.value}),n):(n.value=i.value,i.memo&&(n.memo=!0),n)}const UO=Y("$ZodCatch",(n,i)=>{Ot.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ot(n,"optout",a=>a.def.innerType._zod.optout),ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);const u=i.innerType._zod.run({value:a.value,issues:[]},l);return u instanceof Promise?u.then(f=>Eb(a,f,i,l)):Eb(a,u,i,l)}}),ZO=Y("$ZodPipe",(n,i)=>{Ot.init(n,i),ot(n,"values",a=>a.def.in._zod.values),ot(n,"optin",a=>a.def.in._zod.optin),ot(n,"optout",a=>a.def.out._zod.optout),ot(n,"propValues",a=>a.def.in._zod.propValues),n._zod.parse=(a,l)=>{if(l.direction==="backward"){const f=i.out._zod.run(a,l);return f instanceof Promise?f.then(d=>mf(d,i.in,l)):mf(f,i.in,l)}const u=i.in._zod.run(a,l);return u instanceof Promise?u.then(f=>mf(f,i.out,l)):mf(u,i.out,l)}});function mf(n,i,a){return n.issues.some(l=>l.code!=="unrecognized_keys")?(n.aborted=!0,n):i._zod.run({value:n.value,issues:n.issues},a)}const $O=Y("$ZodReadonly",(n,i)=>{Ot.init(n,i),ot(n,"propValues",a=>a.def.innerType._zod.propValues),ot(n,"values",a=>a.def.innerType._zod.values),ot(n,"optin",a=>a.def.innerType?._zod?.optin),ot(n,"optout",a=>a.def.innerType?._zod?.optout),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(Ob):Ob(u)}});function Ob(n){return n.memo||(n.value=Object.freeze(n.value)),n}const LO=Y("$ZodCustom",(n,i)=>{yi.init(n,i),Ot.init(n,i),n._zod.parse=(a,l)=>a,n._zod.check=a=>{const l=a.value,u=i.fn(l);if(u instanceof Promise)return u.then(f=>Nb(f,a,l,n));Nb(u,a,l,n)}});function Nb(n,i,a,l){if(!n){const u={code:"custom",input:a,inst:l,path:[...l._zod.def.path??[]],continue:!l._zod.def.abort};l._zod.def.params&&(u.params=l._zod.def.params),i.issues.push(Ru(u))}}class HO extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const ip="~memo",Ab=[];function U1(n){return n!==null&&typeof n=="object"}function $m(n){return n.map(i=>i.path?{...i,path:i.path.slice()}:{...i})}const Z1=new WeakMap,xu=0,Of=1,Ou=2;function Nf(n,i,a){const l=Z1.get(n);if(l!==void 0)return l?Ou:xu;if(i.has(n))return Ou;i.add(n);let u=xu;const f=b=>{if(u!==Ou&&b?._zod){const y=Nf(b,i);y>u&&(u=y)}},d=(b,y)=>{let w=xu;for(const O of Reflect.ownKeys(b)){const T=Object.getOwnPropertyDescriptor(b,O);if(!T.enumerable)continue;const A=T.get?Of:T.value?._zod?Nf(T.value,i):xu;A>w&&(w=A)}return w},m=b=>{b>u&&(u=b)},p=n._zod.def;switch(p.type){case"object":{const b=c1(p);m(b?d(b):Of),f(p.catchall);break}case"array":f(p.element);break;case"tuple":for(const b of p.items)f(b);f(p.rest);break;case"record":case"map":f(p.keyType),f(p.valueType);break;case"set":f(p.valueType);break;case"union":for(const b of p.options)f(b);break;case"intersection":f(p.left),f(p.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":f(p.innerType);break;case"pipe":f(p.in),f(p.out);break;case"function":f(p.input),f(p.output);break;case"lazy":{const b=p._cachedInner??void 0;m(b?Nf(b,i):Of);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const b in p){cons)DELIM" -R"DELIM(t y=Object.getOwnPropertyDescriptor(p,b);if(!y||y.get)continue;const w=y.value;if(!(!w||typeof w!="object")){if(w._zod)f(w);else if(Array.isArray(w))for(const O of w)f(O)}}}return i.delete(n),BO(n,u)}function BO(n,i){return i!==Of&&Z1.set(n,i===Ou),i}function qO(n,i){let a=n.buckets.get(i);return a||(a=new WeakMap,n.buckets.set(i,a)),a}let pf;const gf=[],VO={alloc(n,i,a){const l=pf;if(!l)return a;pf=void 0;const u={value:a,issues:null};return l.set(i.value,u),gf.push(u),a},guard(n){var i;(i=n._zod).deferred??(i.deferred=[]),n._zod.deferred.push(()=>{const a=n._zod.parse,l=(u,f)=>{if(f.direction!=="backward"&&PO(f,u.value))throw new HO;return a(u,f)};n._zod.parse=l,n._zod.run===a&&(n._zod.run=l)})},attach(n){var i;let a,l=!1,u,f;(i=n._zod).deferred??(i.deferred=[]),n._zod.deferred.push(()=>{const d=n._zod.parse,m=(p,g)=>{if(a===void 0){const L=Nf(n,new Set);if(L===xu)return n._zod.parse=d,n._zod.run===m&&(n._zod.run=d),d(p,g);L===Ou||l?a=!0:l=!0}const b=p.value;if(!U1(b))return d(p,g);let y=g[ip];y||(y={buckets:new WeakMap,backEdges:void 0},g[ip]=y);let w;u===g?w=f:(w=qO(y,n),u=g,f=w);const O=w.get(b);if(O)return p.value=O.value,O.issues?O.issues.length&&p.issues.push(...$m(O.issues)):(p.memo=!0,y.backEdges??(y.backEdges=new WeakSet),y.backEdges.add(O.value)),p;pf=w;const T=gf.length,A=d(p,g);pf=void 0;const k=gf.length>T?gf.pop():void 0;return A instanceof Promise?A.then(L=>(k&&(k.issues=L.issues.length?$m(L.issues):Ab),L)):(k&&(k.issues=A.issues.length?$m(A.issues):Ab),A)};n._zod.parse=m,n._zod.run===d&&(n._zod.run=m)})}};function IO(){return VO}function PO(n,i){const a=n[ip]?.backEdges;return a!==void 0&&U1(i)&&a.has(i)}const KO=()=>{const n={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function i(f){return n[f]??null}const a={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},l={nan:"NaN"};function u(f,d){return f==="number"&&typeof d=="number"&&!Number.isFinite(d)?String(d):l[f]??f}return f=>{switch(f.code){case"invalid_type":{const d=u(f.expected),m=gT(f.input),p=u(m,f.input);return`Invalid input: expected ${d}, received ${p}`}case"invalid_value":return f.values.length===1?`Invalid input: expected ${p1(f.values[0])}`:`Invalid option: expected one of ${ub(f.values,"|")}`;case"too_big":{const d=f.exact?"exactly ":f.inclusive?"<=":"<",m=i(f.origin);return m?`Too big: expected ${f.origin??"value"} to have ${d}${f.maximum.toString()} ${m.unit??"elements"}`:`Too big: expected ${f.origin??"value"} to be ${d}${f.maximum.toString()}`}case"too_small":{const d=f.exact?"exactly ":f.inclusive?">=":">",m=i(f.origin);return m?`Too small: expected ${f.origin} to have ${d}${f.minimum.toString()} ${m.unit}`:`Too small: expected ${f.origin} to be ${d}${f.minimum.toString()}`}case"invalid_format":{const d=f;return d.format==="starts_with"?`Invalid string: must start with "${d.prefix}"`:d.format==="ends_with"?`Invalid string: must end with "${d.suffix}"`:d.format==="includes"?`Invalid string: must include "${d.includes}"`:d.format==="regex"?`Invalid string: must match pattern ${d.pattern}`:`Invalid ${a[d.format]??f.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${f.divisor}`;case"unrecognized_keys":return`Unrecognized key${f.keys.length>1?"s":""}: ${ub(f.keys,", ")}`;case"invalid_key":return`Invalid key in ${f.origin}`;case"invalid_union":return f.options&&Array.isArray(f.options)&&f.options.length>0?`Invalid discriminator value. Expected ${f.options.map(m=>`'${m}'`).join(" | ")}`:f.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${f.origin}`;default:return"Invalid input"}}};function GO(){return{localeError:KO()}}var Mb;class YO{constructor(){this._map=new WeakMap,this._idmap=new Map}add(i,...a){const l=a[0];return this._map.set(i,l),l&&typeof l=="object"&&"id"in l&&this._idmap.set(l.id,i),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(i){const a=this._map.get(i);return a&&typeof a=="object"&&"id"in a&&this._idmap.delete(a.id),this._map.delete(i),this}get(i){const a=i._zod.parent;if(a){const l={...this.get(a)??{}};delete l.id;const u={...l,...this._map.get(i)};return Object.keys(u).length?u:void 0}return this._map.get(i)}has(i){return this._map.has(i)}}function FO(){return new YO}(Mb=globalThis).__zod_globalRegistry??(Mb.__zod_globalRegistry=FO());const wu=globalThis.__zod_globalRegistry;function $1(n){return n.checks&&(n.checks=[...n.checks]),n}function QO(n,i){return new n($1({type:"string",...Te(i)}))}function JO(n,i){return new n({type:"string",format:"email",check:"string_format",abort:!1,...Te(i)})}function XO(n,i){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...Te(i)})}function WO(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(i)})}function e2(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(i)})}function t2(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(i)})}function n2(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(i)})}function i2(n,i){return new n({type:"string",format:"url",check:"string_format",abort:!1,...Te(i)})}function r2(n,i){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(i)})}function s2(n,i){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(i)})}function a2(n,i){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(i)})}function l2(n,i){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(i)})}function o2(n,i){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(i)})}function u2(n,i){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...Te(i)})}function c2(n,i){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(i)})}function f2(n,i){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(i)})}function d2(n,i){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(i)})}function h2(n,i){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(i)})}function m2(n,i){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(i)})}function p2(n,i){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...Te(i)})}function g2(n,i){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(i)})}function v2(n,i){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...Te(i)})}function y2(n,i){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(i)})}function b2(n,i){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(i)})}function _2(n,i){return new n({type:"string",format:"date",check:"string_format",...Te(i)})}function S2(n,i){return new n({type:"string",format:"time",check:"string_format",precision:null,...Te(i)})}function x2(n,i){return new n({type:"string",format:"duration",check:"string_format",...Te(i)})}function w2(n,i){return new n($1({type:"number",checks:[],...Te(i)}))}function z2(n,i){return new n({type:"number")DELIM" -R"DELIM(,check:"number_format",abort:!1,format:"safeint",...Te(i)})}function T2(n,i){return new n({type:"boolean",...Te(i)})}function E2(n){return new n({type:"unknown"})}function O2(n,i){return new n({type:"never",...Te(i)})}function jb(n,i){return new w1({check:"less_than",...Te(i),value:n,inclusive:!1})}function Lm(n,i){return new w1({check:"less_than",...Te(i),value:n,inclusive:!0})}function kb(n,i){return new z1({check:"greater_than",...Te(i),value:n,inclusive:!1})}function Hm(n,i){return new z1({check:"greater_than",...Te(i),value:n,inclusive:!0})}function Rb(n,i){return new SE({check:"multiple_of",...Te(i),value:n})}function L1(n,i){return new wE({check:"max_length",...Te(i),maximum:n})}function $f(n,i){return new zE({check:"min_length",...Te(i),minimum:n})}function H1(n,i){return new TE({check:"length_equals",...Te(i),length:n})}function N2(n,i){return new EE({check:"string_format",format:"regex",...Te(i),pattern:n})}function A2(n){return new OE({check:"string_format",format:"lowercase",...Te(n)})}function M2(n){return new NE({check:"string_format",format:"uppercase",...Te(n)})}function j2(n,i){return new AE({check:"string_format",format:"includes",...Te(i),includes:n})}function k2(n,i){return new ME({check:"string_format",format:"starts_with",...Te(i),prefix:n})}function R2(n,i){return new jE({check:"string_format",format:"ends_with",...Te(i),suffix:n})}function ho(n){return new kE({check:"overwrite",tx:n})}function C2(n){return ho(i=>i.normalize(n))}function D2(){return ho(n=>n.trim())}function U2(){return ho(n=>n.toLowerCase())}function Z2(){return ho(n=>n.toUpperCase())}function $2(){return ho(n=>iT(n))}function L2(n,i,a){return new n({type:"array",element:i,...Te(a)})}function H2(n,i,a){return new n({type:"custom",check:"custom",fn:i,...Te(a)})}function B2(n,i){const a=q2(l=>(l.addIssue=u=>{if(typeof u=="string")l.issues.push(Ru(u,l.value,a._zod.def));else{const f=u;f.fatal&&(f.continue=!1),f.code??(f.code="custom"),"input"in f||(f.input=l.value),f.inst??(f.inst=a),f.continue??(f.continue=!a._zod.def.abort),l.issues.push(Ru(f))}},n(l.value,l)),i);return a}function q2(n,i){const a=new yi({check:"custom",...Te(i)});return a._zod.check=n,a}function Nu(n,...i){for(const a of i)for(const l of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,l)&&ta(n,l,a[l]);return n}function B1(n){let i=n?.target??"draft-2020-12";return i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),{processors:n.processors??{},metadataRegistry:n?.metadata??wu,target:i,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:n?.cycles??"ref",reused:n?.reused??"inline",intersections:[],deferred:[],external:n?.external??void 0}}function Ws(n,i,a,l,u){const f=typeof i.unrepresentable=="function"?i.unrepresentable({zodSchema:n,path:l.path,message:u}):i.unrepresentable;if(f==="any")return!1;if(f===void 0||f==="throw")throw new Error(u);return Object.assign(a,f),!0}function Kt(n,i,a={path:[],schemaPath:[]}){var l;const u=n._zod.def,f=i.seen.get(n);if(f)return f.count++,a.schemaPath.includes(n)&&(f.cycle=a.path),f.schema;const d={schema:{},count:1,cycle:void 0,path:a.path};i.seen.set(n,d),i.sharedDefsExtractedFor=void 0,i.sharedEmitDoneFor=void 0;const m=n._zod.toJSONSchema?.();if(m)d.schema=m;else{const b={...a,schemaPath:[...a.schemaPath,n],path:a.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(i,d.schema,b);else{const w=d.schema,O=i.processors[u.type];if(!O)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${u.type}`);O(n,i,w,b)}const y=n._zod.parent;y&&(d.ref||(d.ref=y),Kt(y,i,b),i.seen.get(y).isParent=!0)}const p=i.metadataRegistry.get(n);return p&&Nu(d.schema,p),i.io==="input"&&si(n)&&(delete d.schema.examples,delete d.schema.default),i.io==="input"&&"_prefault"in d.schema&&((l=d.schema).default??(l.default=d.schema._prefault)),delete d.schema._prefault,i.seen.get(n).schema}function Cb(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}function q1(n,i){const a=n.seen.get(i);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");if(n.external&&n.sharedDefsExtractedFor===n.external)return;const l=new Map;for(const d of n.seen.entries()){const m=n.metadataRegistry.get(d[0])?.id;if(m){const p=l.get(m);if(p&&p!==d[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);l.set(m,d[0])}}const u=d=>{const m=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const y=n.external.registry.get(d[0])?.id,w=n.external.uri??(T=>T);if(y)return{ref:w(y)};const O=d[1].defId??d[1].schema.id??`schema${n.counter++}`;return d[1].defId=O,{defId:O,ref:`${w("__shared")}#/${m}/${Cb(O)}`}}const p="#",g=`${p}/${m}/`;if(d[1]===a&&!d[1].schema.id)return{ref:p};const b=d[1].schema.id??`__schema${n.counter++}`;return{defId:b,ref:g+Cb(b)}},f=d=>{if(d[1].schema.$ref)return;const m=d[1],{ref:p,defId:g}=u(d);m.def={...m.schema},g&&(m.defId=g);const b=m.schema;for(const y in b)delete b[y];b.$ref=p};if(n.cycles==="throw")for(const d of n.seen.entries()){const m=d[1];if(m.cycle)throw new Error(`Cycle detected: #/${m.cycle?.join("/")}/ + `)}return k.write("payload.value = newResult;"),k.write("return payload;"),k.compile()};let d;const h=Uf,p=!es.jitless,b=p&&lE.value,v=i.catchall;let w;n._zod.parse=(T,E)=>{w??(w=l.value);const A=T.value;return h(A)?p&&b&&E?.async===!1&&E.jitless!==!0?(d||(d=f(i.shape)),T=d(T,E),v?L1([],A,T,E,w,n,E?.abortEarly===!0):T):a(T,E):(T.issues.push({expected:"object",code:"invalid_type",input:A,inst:n}),T)}});function _b(n,i,a,l){for(const f of n)if(f.issues.length===0)return i.value=f.value,i;const u=n.filter(f=>!_s(f));return u.length===1?(i.value=u[0].value,u[0]):(i.issues.push({code:"invalid_union",input:i.value,inst:a,errors:n.map(f=>f.issues.map(d=>Jr(d,l,Bs())))}),i)}const O2=F("$ZodUnion",(n,i)=>{Nt.init(n,i),ot(n,"optin",l=>l.def.options.some(u=>u._zod.optin==="defaulted")?"defaulted":l.def.options.some(u=>u._zod.optin!==void 0)?"optional":void 0),ot(n,"optout",l=>l.def.options.some(u=>u._zod.optout==="optional")?"optional":void 0),ot(n,"values",l=>{if(l.def.options.every(u=>u._zod.values))return new Set(l.def.options.flatMap(u=>Array.from(u._zod.values)))}),ot(n,"pattern",l=>{if(l.def.options.every(u=>u._zod.pattern)){const u=l.def.options.map(f=>f._zod.pattern);return new RegExp(`^(${u.map(f=>$p(f.source)).join("|")})$`)}});const a=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(l,u)=>{if(a)return a(l,u);let f=!1;const d=[];for(const h of i.options){const p=h._zod.run({value:l.value,issues:[]},u);if(p instanceof Promise)d.push(p),f=!0;else{if(p.issues.length===0)return p;d.push(p)}}return f?Promise.all(d).then(h=>_b(h,l,n,u)):_b(d,l,n,u)}}),N2=F("$ZodIntersection",(n,i)=>{Nt.init(n,i),n._zod.parse=(a,l)=>{const u=a.value,f=i.left._zod.run({value:u,issues:[]},l),d=i.right._zod.run({value:u,issues:[]},l);return f instanceof Promise||d instanceof Promise?Promise.all([f,d]).then(([p,g])=>Sb(a,p,g)):Sb(a,f,d)}});function ap(n,i){if(n===i)return{valid:!0,data:n};if(n instanceof Date&&i instanceof Date&&+n==+i)return{valid:!0,data:n};if(so(n)&&so(i)){const a=Object.keys(i),l=Object.keys(n).filter(f=>a.indexOf(f)!==-1),u={...n,...i};Object.prototype.hasOwnProperty.call(u,"__proto__")&&delete u.__proto__;for(const f of l){if(f==="__proto__")continue;const d=ap(n[f],i[f]);if(!d.valid)return{valid:!1,mergeErrorPath:[f,...d.mergeErrorPath]};u[f]=d.data}return{valid:!0,data:u}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let l=0;l{let v;if(g.code==="unrecognized_keys"&&!g.path?.length)u??(u=g),v=g.keys;else if(g.code==="invalid_key"&&g.origin==="record"&&g.path?.length===1){const w=String(g.path[0]);f.has(w)||f.set(w,g),v=[w]}else return!1;for(const w of v)l.has(w)||l.set(w,{}),l.get(w)[b]=!0;return!0};for(const g of i.issues)d(g,"l")||n.issues.push(g);for(const g of a.issues)d(g,"r")||n.issues.push(g);const h=[...l].filter(([,g])=>g.l&&g.r).map(([g])=>g);if(h.length){const g=u?h.filter(b=>u.keys.includes(b)):[];g.length&&n.issues.push({...u,keys:g});for(const b of h)!g.includes(b)&&f.has(b)&&n.issues.push(f.get(b))}const p=ap(i.value,a.value);if(!p.valid){if(_s(n))return n;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(p.mergeErrorPath)}`)}return n.value=p.data,n}const A2=F("$ZodTuple",(n,i)=>{Nt.init(n,i);const a=i.items,l=es.memoizer;l?.attach(n),n._zod.parse=(u,f)=>{const d=u.value;if(!Array.isArray(d))return u.issues.push({input:d,inst:n,expected:"tuple",code:"invalid_type"}),u;u.value=l?l.alloc(n,u,[],f):[];const h=[],p=xb(a,"optin"),g=xb(a,"optout");if(!i.rest){if(d.lengtha.length&&u.issues.push({code:"too_big",maximum:a.length,inclusive:!0,input:d,inst:n,origin:"array"})}const b=new Array(a.length),v=i.rest?f?.abortEarly:void 0;let w=!1;for(let T=0;T{b[T]=A})):(b[T]=E,v&&!w&&E.issues.length&&(w=_s(E)))}if(i.rest&&!w){let T=a.length-1;const E=d.slice(a.length);let A=u.issues.length;for(const k of E){if(v&&u.issues.length!==A){if(_s(u,A))break;A=u.issues.length}T++;const L=i.rest._zod.run({value:k,issues:[]},f);L instanceof Promise?h.push(L.then(U=>wb(U,u,T))):wb(L,u,T)}}return h.length?Promise.all(h).then(()=>zb(b,u,a,d,g)):zb(b,u,a,d,g)}});function xb(n,i){for(let a=n.length-1;a>=0;a--)if(!(i==="optin"?n[a]._zod.optin!==void 0:n[a]._zod.optout==="optional"))return a+1;return 0}function wb(n,i,a){n.issues.length&&i.issues.push(...Qr(a,n.issues)),i.value[a]=n.value}function zb(n,i,a,l,u){for(let f=0;f=u&&a[f]._zod.optin==="optional"){i.value.length=f;break}if(d.issues.length){if(!h&&f>=u){i.value.length=f;break}i.issues.push(...Qr(f,d.issues))}i.value[f]=d.value}for(let f=i.value.length-1;f>=l.length&&(a[f]._zod.optout==="optional"&&i.value[f]===void 0);f--)i.value.length=f;return i}const M2=F("$ZodRecord",(n,i)=>{Nt.init(n,i);const a=es.memoizer;a?.attach(n),n._zod.parse=(l,u)=>{const f=l.value;if(!so(f))return l.issues.push({expected:"record",code:"invalid_type",input:f,inst:n}),l;const d=[],h=i.keyType._zod.values;if(h&&!i.partial){l.value=a?a.alloc(n,l,{},u):{};const p=new Set;for(const b of h)if(typeof b=="string"||typeof b=="number"||typeof b=="symbol"){if(p.add(typeof b=="number"?b.toString():b),b==="__proto__")continue;const v=i.keyType._zod.run({value:b,issues:[]},u);if(v instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(v.issues.length){l.issues.push({code:"invalid_key",origin:"record",issues:v.issues.map(E=>Jr(E,u,Bs())),input:b,path:[b],inst:n});continue}const w=v.value;if(w==="__proto__")continue;const T=i.valueType._zod.run({value:f[b],issues:[]},u);T instanceof Promise?d.push(T.then(E=>{E.issues.length&&l.issues.push(...Qr(b,E.issues)),l.value[w]=E.value})):(T.issues.length&&l.issues.push(...Qr(b,T.issues)),l.value[w]=T.value)}let g;for(const b in f)if(!p.has(b))if(i.mode==="loose"){if(b==="__proto__")continue;l.value[b]=f[b]}else g=g??[],g.push(b);g&&g.length>0&&l.issues.push({code:"unrecognized_keys",input:f,inst:n,keys:g,continue:!0})}else{l.value=a?a.alloc(n,l,{},u):{};let p;for(const g of Reflect.ownKeys(f)){if(g==="__proto__"||!Object.prototype.propertyIsEnumerable.call(f,g))continue;let b=i.keyType._zod.run({value:g,issues:[]},u);if(b instanceof Promise)t)DELIM" +R"DELIM(hrow new Error("Async schemas not supported in object keys currently");if(typeof g=="string"&&Kp.test(g)&&b.issues.length){const E=i.keyType._zod.run({value:Number(g),issues:[]},u);if(E instanceof Promise)throw new Error("Async schemas not supported in object keys currently");E.issues.length===0&&(b=E)}if(b.issues.length){i.mode==="loose"?l.value[g]=f[g]:h?(p=p??[],p.push(g)):l.issues.push({code:"invalid_key",origin:"record",issues:b.issues.map(E=>Jr(E,u,Bs())),input:g,path:[g],inst:n});continue}const w=b.value;if(w==="__proto__")continue;const T=i.valueType._zod.run({value:f[g],issues:[]},u);T instanceof Promise?d.push(T.then(E=>{E.issues.length&&l.issues.push(...Qr(g,E.issues)),l.value[w]=E.value})):(T.issues.length&&l.issues.push(...Qr(g,T.issues)),l.value[w]=T.value)}p&&p.length>0&&l.issues.push({code:"unrecognized_keys",input:f,inst:n,keys:p,continue:!0})}return d.length?Promise.all(d).then(()=>l):l}}),j2=F("$ZodEnum",(n,i)=>{Nt.init(n,i);const a=np(i.entries),l=new Set(a);n._zod.values=l,ot(n,"pattern",u=>{const f=np(u.def.entries).filter(d=>oE.has(typeof d));return new RegExp(f.length?`^(${f.map(d=>ro(d.toString())).join("|")})$`:"^[^\\s\\S]$")}),n._zod.parse=(u,f)=>{const d=u.value;return l.has(d)||u.issues.push({code:"invalid_value",values:a,input:d,inst:n}),u}}),k2=F("$ZodLiteral",(n,i)=>{Nt.init(n,i);const a=new Set(i.values);n._zod.values=a,ot(n,"pattern",l=>{const u=l.def.values;return new RegExp(u.length?`^(${u.map(f=>typeof f=="string"?ro(f):f?ro(f.toString()):String(f)).join("|")})$`:"^[^\\s\\S]$")}),n._zod.parse=(l,u)=>{const f=l.value;return a.has(f)||l.issues.push({code:"invalid_value",values:i.values,input:f,inst:n}),l}}),R2=F("$ZodTransform",(n,i)=>{Nt.init(n,i),n._zod.optin="optional",es.memoizer?.guard(n),n._zod.parse=(a,l)=>{if(l.direction==="backward")throw new z1(n.constructor.name);const u=i.transform(a.value,a);if(l.async)return(u instanceof Promise?u:Promise.resolve(u)).then(d=>(a.value=d,a));if(u instanceof Promise)throw new Xa;return a.value=u,a}});function Eb(n,i){return n.value=i.issues.length?void 0:i.value,n}const $1=F("$ZodOptional",(n,i)=>{Nt.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),n._zod.optout="optional",ot(n,"values",a=>{const l=a.def.innerType._zod.values;return l?new Set([...l,void 0]):void 0}),ot(n,"pattern",a=>{const l=a.def.innerType._zod.pattern;return l?new RegExp(`^(${$p(l.source)})?$`):void 0}),n._zod.parse=(a,l)=>{if(a.value===void 0){if(i.innerType._zod.optin!=="defaulted")return a;const u=i.innerType._zod.run({value:a.value,issues:[]},l);return u instanceof Promise?u.then(f=>Eb(a,f)):Eb(a,u)}return i.innerType._zod.run(a,l)}}),C2=F("$ZodExactOptional",(n,i)=>{$1.init(n,i),ot(n,"values",a=>a.def.innerType._zod.values),ot(n,"pattern",a=>a.def.innerType._zod.pattern),n._zod.parse=(a,l)=>i.innerType._zod.run(a,l)}),D2=F("$ZodNullable",(n,i)=>{Nt.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin),ot(n,"optout",a=>a.def.innerType._zod.optout),ot(n,"pattern",a=>{const l=a.def.innerType._zod.pattern;return l?new RegExp(`^(${$p(l.source)}|null)$`):void 0}),ot(n,"values",a=>a.def.innerType._zod.values?new Set([...a.def.innerType._zod.values,null]):void 0),n._zod.parse=(a,l)=>a.value===null?a:i.innerType._zod.run(a,l)}),U2=F("$ZodDefault",(n,i)=>{Nt.init(n,i),n._zod.optin="defaulted",ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);if(a.value===void 0)return a.value=i.defaultValue,a;const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(f=>Tb(f,i)):Tb(u,i)}});function Tb(n,i){return n.value===void 0&&(n.value=i.defaultValue),n}const Z2=F("$ZodPrefault",(n,i)=>{Nt.init(n,i),n._zod.optin="defaulted",ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>(l.direction==="backward"||a.value===void 0&&(a.value=i.defaultValue),i.innerType._zod.run(a,l))}),L2=F("$ZodNonOptional",(n,i)=>{Nt.init(n,i),ot(n,"values",a=>{const l=a.def.innerType._zod.values;return l?new Set([...l].filter(u=>u!==void 0)):void 0}),n._zod.parse=(a,l)=>{const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(f=>Ob(f,n)):Ob(u,n)}});function Ob(n,i){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:i}),n}function Nb(n,i,a,l){return i.issues.length?(n.value=a.catchValue({...i,value:n.value,error:{issues:i.issues.map(u=>Jr(u,l,Bs()))},input:n.value}),n):(n.value=i.value,i.memo&&(n.memo=!0),n)}const $2=F("$ZodCatch",(n,i)=>{Nt.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ot(n,"optout",a=>a.def.innerType._zod.optout),ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);const u=i.innerType._zod.run({value:a.value,issues:[]},l);return u instanceof Promise?u.then(f=>Nb(a,f,i,l)):Nb(a,u,i,l)}}),H2=F("$ZodPipe",(n,i)=>{Nt.init(n,i),ot(n,"values",a=>a.def.in._zod.values),ot(n,"optin",a=>a.def.in._zod.optin),ot(n,"optout",a=>a.def.out._zod.optout),ot(n,"propValues",a=>a.def.in._zod.propValues),n._zod.parse=(a,l)=>{if(l.direction==="backward"){const f=i.out._zod.run(a,l);return f instanceof Promise?f.then(d=>gf(d,i.in,l)):gf(f,i.in,l)}const u=i.in._zod.run(a,l);return u instanceof Promise?u.then(f=>gf(f,i.out,l)):gf(u,i.out,l)}});function gf(n,i,a){return n.issues.some(l=>l.code!=="unrecognized_keys")?(n.aborted=!0,n):i._zod.run({value:n.value,issues:n.issues},a)}const B2=F("$ZodReadonly",(n,i)=>{Nt.init(n,i),ot(n,"propValues",a=>a.def.innerType._zod.propValues),ot(n,"values",a=>a.def.innerType._zod.values),ot(n,"optin",a=>a.def.innerType?._zod?.optin),ot(n,"optout",a=>a.def.innerType?._zod?.optout),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(Ab):Ab(u)}});function Ab(n){return n.memo||(n.value=Object.freeze(n.value)),n}const q2=F("$ZodCustom",(n,i)=>{yi.init(n,i),Nt.init(n,i),n._zod.parse=(a,l)=>a,n._zod.check=a=>{const l=a.value,u=i.fn(l);if(u instanceof Promise)return u.then(f=>Mb(f,a,l,n));Mb(u,a,l,n)}});function Mb(n,i,a,l){if(!n){const u={code:"custom",input:a,inst:l,path:[...l._zod.def.path??[]],continue:!l._zod.def.abort};l._zod.def.params&&(u.params=l._zod.def.params),i.issues.push(Du(u))}}class I2 extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const lp="~memo",jb=[];function H1(n){return n!==null&&typeof n=="object"}function qm(n){return n.map(i=>i.path?{...i,path:i.path.slice()}:{...i})}const B1=new WeakMap,wu=0,Af=1,Nu=2;function Mf(n,i,a){const l=B1.get(n);if(l!==void 0)return l?Nu:wu;if(i.has(n))return Nu;i.add(n);let u=wu;const f=b=>{if(u!==Nu&&b?._zod){const v=Mf(b,i);v>u&&(u=v)}},d=(b,v)=>{let w=wu;for(const T of Reflect.ownKeys(b)){const E=Object.getOwnPropertyDescriptor(b,T);if(!E.enumerable)continue;const A=E.get?Af:E.value?._zod?Mf(E.value,i):wu;A>w&&(w=A)}return w},h=b=>{b>u&&(u=b)},p=n._zod.def;switch(p.type){case"object":{const b=m1(p);h(b?d(b):Af),f(p.catchall);break}case"array":f(p.element);break;case"tuple":for(const b of p.items)f(b);f(p.rest);break;case"record":case"map":f(p.keyType),f(p.valueType);break;case"set":f(p.valueType);break;case"union":for(const b of p.options)f(b);break;case"intersection":f(p.left),f(p.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":f(p.innerType);break;case"pipe":f(p.in),f(p.out);break;case"function":f(p.input),f(p.output);break;case"lazy":{const b=p._cachedInner??void 0;h(b?Mf(b,i):Af);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for()DELIM" +R"DELIM(const b in p){const v=Object.getOwnPropertyDescriptor(p,b);if(!v||v.get)continue;const w=v.value;if(!(!w||typeof w!="object")){if(w._zod)f(w);else if(Array.isArray(w))for(const T of w)f(T)}}}return i.delete(n),V2(n,u)}function V2(n,i){return i!==Af&&B1.set(n,i===Nu),i}function P2(n,i){let a=n.buckets.get(i);return a||(a=new WeakMap,n.buckets.set(i,a)),a}let vf;const yf=[],K2={alloc(n,i,a){const l=vf;if(!l)return a;vf=void 0;const u={value:a,issues:null};return l.set(i.value,u),yf.push(u),a},guard(n){var i;(i=n._zod).deferred??(i.deferred=[]),n._zod.deferred.push(()=>{const a=n._zod.parse,l=(u,f)=>{if(f.direction!=="backward"&&Y2(f,u.value))throw new I2;return a(u,f)};n._zod.parse=l,n._zod.run===a&&(n._zod.run=l)})},attach(n){var i;let a,l=!1,u,f;(i=n._zod).deferred??(i.deferred=[]),n._zod.deferred.push(()=>{const d=n._zod.parse,h=(p,g)=>{if(a===void 0){const L=Mf(n,new Set);if(L===wu)return n._zod.parse=d,n._zod.run===h&&(n._zod.run=d),d(p,g);L===Nu||l?a=!0:l=!0}const b=p.value;if(!H1(b))return d(p,g);let v=g[lp];v||(v={buckets:new WeakMap,backEdges:void 0},g[lp]=v);let w;u===g?w=f:(w=P2(v,n),u=g,f=w);const T=w.get(b);if(T)return p.value=T.value,T.issues?T.issues.length&&p.issues.push(...qm(T.issues)):(p.memo=!0,v.backEdges??(v.backEdges=new WeakSet),v.backEdges.add(T.value)),p;vf=w;const E=yf.length,A=d(p,g);vf=void 0;const k=yf.length>E?yf.pop():void 0;return A instanceof Promise?A.then(L=>(k&&(k.issues=L.issues.length?qm(L.issues):jb),L)):(k&&(k.issues=A.issues.length?qm(A.issues):jb),A)};n._zod.parse=h,n._zod.run===d&&(n._zod.run=h)})}};function G2(){return K2}function Y2(n,i){const a=n[lp]?.backEdges;return a!==void 0&&H1(i)&&a.has(i)}const F2=()=>{const n={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function i(f){return n[f]??null}const a={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},l={nan:"NaN"};function u(f,d){return f==="number"&&typeof d=="number"&&!Number.isFinite(d)?String(d):l[f]??f}return f=>{switch(f.code){case"invalid_type":{const d=u(f.expected),h=bE(f.input),p=u(h,f.input);return`Invalid input: expected ${d}, received ${p}`}case"invalid_value":return f.values.length===1?`Invalid input: expected ${b1(f.values[0])}`:`Invalid option: expected one of ${fb(f.values,"|")}`;case"too_big":{const d=f.exact?"exactly ":f.inclusive?"<=":"<",h=i(f.origin);return h?`Too big: expected ${f.origin??"value"} to have ${d}${f.maximum.toString()} ${h.unit??"elements"}`:`Too big: expected ${f.origin??"value"} to be ${d}${f.maximum.toString()}`}case"too_small":{const d=f.exact?"exactly ":f.inclusive?">=":">",h=i(f.origin);return h?`Too small: expected ${f.origin} to have ${d}${f.minimum.toString()} ${h.unit}`:`Too small: expected ${f.origin} to be ${d}${f.minimum.toString()}`}case"invalid_format":{const d=f;return d.format==="starts_with"?`Invalid string: must start with "${d.prefix}"`:d.format==="ends_with"?`Invalid string: must end with "${d.suffix}"`:d.format==="includes"?`Invalid string: must include "${d.includes}"`:d.format==="regex"?`Invalid string: must match pattern ${d.pattern}`:`Invalid ${a[d.format]??f.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${f.divisor}`;case"unrecognized_keys":return`Unrecognized key${f.keys.length>1?"s":""}: ${fb(f.keys,", ")}`;case"invalid_key":return`Invalid key in ${f.origin}`;case"invalid_union":return f.options&&Array.isArray(f.options)&&f.options.length>0?`Invalid discriminator value. Expected ${f.options.map(h=>`'${h}'`).join(" | ")}`:f.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${f.origin}`;default:return"Invalid input"}}};function Q2(){return{localeError:F2()}}var kb;class J2{constructor(){this._map=new WeakMap,this._idmap=new Map}add(i,...a){const l=a[0];return this._map.set(i,l),l&&typeof l=="object"&&"id"in l&&this._idmap.set(l.id,i),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(i){const a=this._map.get(i);return a&&typeof a=="object"&&"id"in a&&this._idmap.delete(a.id),this._map.delete(i),this}get(i){const a=i._zod.parent;if(a){const l={...this.get(a)??{}};delete l.id;const u={...l,...this._map.get(i)};return Object.keys(u).length?u:void 0}return this._map.get(i)}has(i){return this._map.has(i)}}function X2(){return new J2}(kb=globalThis).__zod_globalRegistry??(kb.__zod_globalRegistry=X2());const zu=globalThis.__zod_globalRegistry;function q1(n){return n.checks&&(n.checks=[...n.checks]),n}function W2(n,i){return new n(q1({type:"string",...Ee(i)}))}function eO(n,i){return new n({type:"string",format:"email",check:"string_format",abort:!1,...Ee(i)})}function tO(n,i){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...Ee(i)})}function nO(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...Ee(i)})}function iO(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ee(i)})}function sO(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ee(i)})}function rO(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ee(i)})}function aO(n,i){return new n({type:"string",format:"url",check:"string_format",abort:!1,...Ee(i)})}function lO(n,i){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...Ee(i)})}function oO(n,i){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ee(i)})}function uO(n,i){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...Ee(i)})}function cO(n,i){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ee(i)})}function fO(n,i){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...Ee(i)})}function dO(n,i){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...Ee(i)})}function hO(n,i){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ee(i)})}function mO(n,i){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ee(i)})}function pO(n,i){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ee(i)})}function gO(n,i){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ee(i)})}function vO(n,i){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ee(i)})}function yO(n,i){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...Ee(i)})}function bO(n,i){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...Ee(i)})}function _O(n,i){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...Ee(i)})}function SO(n,i){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...Ee(i)})}function xO(n,i){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ee(i)})}function wO(n,i){return new n({type:"string",format:"date",check:"string_format",...Ee(i)})}function zO(n,i){return new n({type:"string",format:"time",check:"string_format",precision:null,...Ee(i)})}function EO(n,i){return new n({type:"string",format:"duration",check:"string_format",...Ee(i)})}function TO(n,i){return new n(q1({type:"number",checks:[],...Ee(i)}))}function OO(n,i){return ne)DELIM" +R"DELIM(w n({type:"number",check:"number_format",abort:!1,format:"safeint",...Ee(i)})}function NO(n,i){return new n({type:"boolean",...Ee(i)})}function AO(n){return new n({type:"unknown"})}function MO(n,i){return new n({type:"never",...Ee(i)})}function Rb(n,i){return new O1({check:"less_than",...Ee(i),value:n,inclusive:!1})}function Im(n,i){return new O1({check:"less_than",...Ee(i),value:n,inclusive:!0})}function Cb(n,i){return new N1({check:"greater_than",...Ee(i),value:n,inclusive:!1})}function Vm(n,i){return new N1({check:"greater_than",...Ee(i),value:n,inclusive:!0})}function Db(n,i){return new zT({check:"multiple_of",...Ee(i),value:n})}function I1(n,i){return new TT({check:"max_length",...Ee(i),maximum:n})}function Hf(n,i){return new OT({check:"min_length",...Ee(i),minimum:n})}function V1(n,i){return new NT({check:"length_equals",...Ee(i),length:n})}function jO(n,i){return new AT({check:"string_format",format:"regex",...Ee(i),pattern:n})}function kO(n){return new MT({check:"string_format",format:"lowercase",...Ee(n)})}function RO(n){return new jT({check:"string_format",format:"uppercase",...Ee(n)})}function CO(n,i){return new kT({check:"string_format",format:"includes",...Ee(i),includes:n})}function DO(n,i){return new RT({check:"string_format",format:"starts_with",...Ee(i),prefix:n})}function UO(n,i){return new CT({check:"string_format",format:"ends_with",...Ee(i),suffix:n})}function mo(n){return new DT({check:"overwrite",tx:n})}function ZO(n){return mo(i=>i.normalize(n))}function LO(){return mo(n=>n.trim())}function $O(){return mo(n=>n.toLowerCase())}function HO(){return mo(n=>n.toUpperCase())}function BO(){return mo(n=>aE(n))}function qO(n,i,a){return new n({type:"array",element:i,...Ee(a)})}function IO(n,i,a){return new n({type:"custom",check:"custom",fn:i,...Ee(a)})}function VO(n,i){const a=PO(l=>(l.addIssue=u=>{if(typeof u=="string")l.issues.push(Du(u,l.value,a._zod.def));else{const f=u;f.fatal&&(f.continue=!1),f.code??(f.code="custom"),"input"in f||(f.input=l.value),f.inst??(f.inst=a),f.continue??(f.continue=!a._zod.def.abort),l.issues.push(Du(f))}},n(l.value,l)),i);return a}function PO(n,i){const a=new yi({check:"custom",...Ee(i)});return a._zod.check=n,a}function Au(n,...i){for(const a of i)for(const l of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,l)&&ta(n,l,a[l]);return n}function P1(n){let i=n?.target??"draft-2020-12";return i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),{processors:n.processors??{},metadataRegistry:n?.metadata??zu,target:i,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:n?.cycles??"ref",reused:n?.reused??"inline",intersections:[],deferred:[],external:n?.external??void 0}}function Wr(n,i,a,l,u){const f=typeof i.unrepresentable=="function"?i.unrepresentable({zodSchema:n,path:l.path,message:u}):i.unrepresentable;if(f==="any")return!1;if(f===void 0||f==="throw")throw new Error(u);return Object.assign(a,f),!0}function Kt(n,i,a={path:[],schemaPath:[]}){var l;const u=n._zod.def,f=i.seen.get(n);if(f)return f.count++,a.schemaPath.includes(n)&&(f.cycle=a.path),f.schema;const d={schema:{},count:1,cycle:void 0,path:a.path};i.seen.set(n,d),i.sharedDefsExtractedFor=void 0,i.sharedEmitDoneFor=void 0;const h=n._zod.toJSONSchema?.();if(h)d.schema=h;else{const b={...a,schemaPath:[...a.schemaPath,n],path:a.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(i,d.schema,b);else{const w=d.schema,T=i.processors[u.type];if(!T)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${u.type}`);T(n,i,w,b)}const v=n._zod.parent;v&&(d.ref||(d.ref=v),Kt(v,i,b),i.seen.get(v).isParent=!0)}const p=i.metadataRegistry.get(n);return p&&Au(d.schema,p),i.io==="input"&&ri(n)&&(delete d.schema.examples,delete d.schema.default),i.io==="input"&&"_prefault"in d.schema&&((l=d.schema).default??(l.default=d.schema._prefault)),delete d.schema._prefault,i.seen.get(n).schema}function Ub(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}function K1(n,i){const a=n.seen.get(i);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");if(n.external&&n.sharedDefsExtractedFor===n.external)return;const l=new Map;for(const d of n.seen.entries()){const h=n.metadataRegistry.get(d[0])?.id;if(h){const p=l.get(h);if(p&&p!==d[0])throw new Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);l.set(h,d[0])}}const u=d=>{const h=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const v=n.external.registry.get(d[0])?.id,w=n.external.uri??(E=>E);if(v)return{ref:w(v)};const T=d[1].defId??d[1].schema.id??`schema${n.counter++}`;return d[1].defId=T,{defId:T,ref:`${w("__shared")}#/${h}/${Ub(T)}`}}const p="#",g=`${p}/${h}/`;if(d[1]===a&&!d[1].schema.id)return{ref:p};const b=d[1].schema.id??`__schema${n.counter++}`;return{defId:b,ref:g+Ub(b)}},f=d=>{if(d[1].schema.$ref)return;const h=d[1],{ref:p,defId:g}=u(d);h.def={...h.schema},g&&(h.defId=g);const b=h.schema;for(const v in b)delete b[v];b.$ref=p};if(n.cycles==="throw")for(const d of n.seen.entries()){const h=d[1];if(h.cycle)throw new Error(`Cycle detected: #/${h.cycle?.join("/")}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of n.seen.entries()){const m=d[1];if(i===d[0]){f(d);continue}if(n.external){const g=n.external.registry.get(d[0])?.id;if(i!==d[0]&&g){f(d);continue}}if(n.metadataRegistry.get(d[0])?.id){f(d);continue}if(m.cycle){f(d);continue}m.count>1&&n.reused==="ref"&&f(d)}n.external&&(n.sharedDefsExtractedFor=n.external)}function V1(n){const i=n.anyOf;if(!Array.isArray(i)||i.length===0||n.type!==void 0)return;const a=[];for(const l of i){if(!l||typeof l!="object")return;V1(l);const u=Object.keys(l);if(u.length!==1||u[0]!=="type")return;const f=l.type;for(const d of Array.isArray(f)?f:[f]){if(typeof d!="string")return;a.includes(d)||a.push(d)}}delete n.anyOf,n.type=a.length===1?a[0]:a}const I1=new Set(["type","properties","required","additionalProperties"]),Db=["oneOf","anyOf"];function Ub(n){const i=n.additionalProperties;return i===void 0||i===!1||typeof i!="object"||i===null?null:Object.keys(i).length?i:null}function rp(n){const i=[];for(const f of n){if(typeof f!="object"||f.type!=="object")return null;for(const d in f)if(!I1.has(d))return null;i.push(f)}const a={},l=new Set;for(const f of i){for(const d in f.properties){if(Object.prototype.hasOwnProperty.call(a,d))continue;const m=[];for(const g of i){const b=g.properties?.[d]??Ub(g);b!=null&&(m.some(y=>JSON.stringify(y)===JSON.stringify(b))||m.push(b))}const p=m.length===1?m[0]:rp(m)??{allOf:m};ta(a,d,p)}for(const d of f.required??[])l.add(d)}const u={type:"object",properties:a};if(l.size&&(u.required=[...l]),i.every(f=>f.additionalProperties===!1))u.additionalProperties=!1;else{const f=[];for(const d of i){const m=Ub(d);m&&!f.some(p=>JSON.stringify(p)===JSON.stringify(m))&&f.push(m)}f.length===1?u.additionalProperties=f[0]:f.length>1&&(u.additionalProperties={allOf:f})}return u}function V2(n){const i=n.allOf;if(!Array.isArray(i)||i.length<2)return;for(const u of I1)if(u in n)return;const a=i.filter(u=>Db.some(f=>Array.isArray(u[f])));let l=null;if(!a.length)l=rp(i);else{const u=a[0],f=Db.find(p=>Array.isArray(u[p]));if(Object.keys(u).length!==1)return;const d=i.filter(p=>p!==u),m=u[f].map(p=>rp([...d,p]));if(m.some(p=>!p))return;l={[f]:m}}l&&(delete n.allOf,Nu(n,l))}function P1(n,i){const a=n.seen.get(i);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=m=>{const p=n.seen.get(m);if(p.ref===null)return;const g=p.def??p.schema,b={...g},y=p.ref;if(p.ref=null,y){l(y);const O=n.seen.get(y),T=O.schema;if(T.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(T)):Nu(g,T),Nu(g,b),m._zod.parent===y)for(const k in g)k==="$ref"||k==="allOf"||k in b||delete g[k];if(T.$ref&&)DELIM" -R"DELIM(O.def)for(const k in g)k==="$ref"||k==="allOf"||k in O.def&&JSON.stringify(g[k])===JSON.stringify(O.def[k])&&delete g[k]}const w=m._zod.parent;if(w&&w!==y){l(w);const O=n.seen.get(w);if(O?.schema.$ref&&(g.$ref=O.schema.$ref,O.def))for(const T in g)T==="$ref"||T==="allOf"||T in O.def&&JSON.stringify(g[T])===JSON.stringify(O.def[T])&&delete g[T]}n.override({zodSchema:m,jsonSchema:g,path:p.path??[]})};if(!n.external||n.sharedEmitDoneFor!==n.external){for(const m of[...n.seen.entries()].reverse())l(m[0]);if(n.target!=="openapi-3.0")for(const m of n.seen.entries())V1(m[1].def??m[1].schema);for(const m of n.deferred)m();if(n.intersections.length){const m=new Map;for(const p of n.seen.values())for(const g of[p.schema,p.def]){const b=g?.allOf;if(!Array.isArray(b))continue;const y=m.get(b);y?y.push(g):m.set(b,[g])}for(const p of n.intersections)for(const g of m.get(p)??[])V2(g)}}const u={};if(n.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?u.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?u.$schema="http://json-schema.org/draft-04/schema#":n.target,n.external?.uri){const m=n.external.registry.get(i)?.id;if(!m)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(m)}Nu(u,a.defId?a.schema:a.def??a.schema);const f=n.metadataRegistry.get(i)?.id;f!==void 0&&u.id===f&&delete u.id;const d=n.external?.defs??{};if(!n.external||n.sharedEmitDoneFor!==n.external)for(const m of n.seen.entries()){const p=m[1];p.def&&p.defId&&(p.def.id===p.defId&&delete p.def.id,ta(d,p.defId,p.def))}n.external&&(n.sharedEmitDoneFor=n.external),n.external||Object.keys(d).length>0&&(n.target==="draft-2020-12"?u.$defs=d:u.definitions=d);try{const m=JSON.parse(JSON.stringify(u));return Object.defineProperty(m,"~standard",{value:{...i["~standard"],jsonSchema:{input:Lf(i,"input",n.processors),output:Lf(i,"output",n.processors)}},enumerable:!1,writable:!1}),m}catch{throw new Error("Error converting schema to JSON.")}}function si(n,i){const a=i??{seen:new Set};if(a.seen.has(n))return!1;a.seen.add(n);const l=n._zod.def;if(l.type==="transform")return!0;if(l.type==="array")return si(l.element,a);if(l.type==="set")return si(l.valueType,a);if(l.type==="lazy")return si(l.getter(),a);if(l.type==="promise"||l.type==="optional"||l.type==="nonoptional"||l.type==="nullable"||l.type==="readonly"||l.type==="default"||l.type==="prefault"||l.type==="catch")return si(l.innerType,a);if(l.type==="intersection")return si(l.left,a)||si(l.right,a);if(l.type==="record"||l.type==="map")return si(l.keyType,a)||si(l.valueType,a);if(l.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:si(l.in,a)||si(l.out,a);if(l.type==="object"){for(const u in l.shape)if(si(l.shape[u],a))return!0;return!1}if(l.type==="union"){for(const u of l.options)if(si(u,a))return!0;return!1}if(l.type==="tuple"){for(const u of l.items)if(si(u,a))return!0;return!!(l.rest&&si(l.rest,a))}return!1}const I2=(n,i={})=>a=>{const l=B1({...a,processors:i});return Kt(n,l),q1(l,n),P1(l,n)},Lf=(n,i,a={})=>l=>{const{libraryOptions:u,target:f}=l??{},d=B1({...u??{},target:f,io:i,processors:a});return Kt(n,d),q1(d,n),P1(d,n)},so=(n,i,a)=>{(n[i]===void 0||a>n[i])&&(n[i]=a)},ao=(n,i,a)=>{(n[i]===void 0||a{so(n,"minimum",i),ao(n,"maximum",i)},K1=(n,i)=>{n.multipleOf??(n.multipleOf=[]),n.multipleOf.includes(i)||n.multipleOf.push(i)},G1=(n,i)=>{n.patterns??(n.patterns=new Set),n.patterns.add(i)},Y1=(n,i)=>{n.mime=n.mime?n.mime.filter(a=>i.includes(a)):[...i]},F1=(n,i)=>{n.format=i,i.includes("int")&&(n.isInt=!0)},$b=(n,i)=>so(n,"minimum",i.minimum),Lb=(n,i)=>ao(n,"maximum",i.maximum),Hb=n=>(i,a)=>{F1(i,a.format);const[l,u]=n[a.format];so(i,"minimum",l),ao(i,"maximum",u)},P2={greater_than:(n,i)=>so(n,i.inclusive?"minimum":"exclusiveMinimum",i.value),less_than:(n,i)=>ao(n,i.inclusive?"maximum":"exclusiveMaximum",i.value),multiple_of:(n,i)=>K1(n,i.value),number_format:Hb(g1),bigint_format:Hb(lT),min_length:$b,max_length:Lb,length_equals:(n,i)=>Zb(n,i.length),min_size:$b,max_size:Lb,size_equals:(n,i)=>Zb(n,i.size),string_format:(n,i)=>{F1(n,i.format),i.pattern&&G1(n,i.pattern),(i.format==="base64"||i.format==="base64url")&&(n.contentEncoding=i.format),(i.local||i.precision===-1)&&(n.laxFormat=!0)},mime_type:(n,i)=>Y1(n,i.mime)};function Wi(n){const i={},a=n._zod.def,l=n._zod.traits.has("$ZodCheck")?[n,...a.checks??[]]:a.checks??[];for(const f of l)P2[f._zod.def.check]?.(i,f._zod.def);const u=n._zod.bag;u.minimum!==void 0&&so(i,"minimum",u.minimum),u.exclusiveMinimum!==void 0&&so(i,"exclusiveMinimum",u.exclusiveMinimum),u.maximum!==void 0&&ao(i,"maximum",u.maximum),u.exclusiveMaximum!==void 0&&ao(i,"exclusiveMaximum",u.exclusiveMaximum),u.multipleOf!==void 0&&K1(i,u.multipleOf),u.format!==void 0&&(i.format??(i.format=u.format),u.format.includes("int")&&(i.isInt=!0)),u.mime&&Y1(i,u.mime);for(const f of u.patterns??[])G1(i,f);return i}const K2={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},G2=new Map([[j1,oE],[Kp,uE]]),Q1=n=>G2.get(n)??n,Y2=(n,i,a,l)=>{const u=a;u.type="string";const{minimum:f,maximum:d,format:m,patterns:p,contentEncoding:g,laxFormat:b}=Wi(n);if(typeof f=="number"&&(u.minLength=f),typeof d=="number"&&(u.maxLength=d),m&&(u.format=K2[m]??m,u.format===""&&delete u.format,(m==="time"||b)&&delete u.format),g&&(u.contentEncoding=g),p&&p.size>0){const y=[...p].map(Q1);y.length===1?u.pattern=y[0].source:y.length>1&&(u.allOf=[...y.map(w=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))])}},F2=(n,i,a,l)=>{const u=a,{minimum:f,maximum:d,multipleOf:m,exclusiveMaximum:p,exclusiveMinimum:g,isInt:b}=Wi(n);u.type=b?"integer":"number";const y=typeof g=="number"&&g>=(f??Number.NEGATIVE_INFINITY),w=typeof p=="number"&&p<=(d??Number.POSITIVE_INFINITY),O=i.target==="draft-04"||i.target==="openapi-3.0";if(y?O?(u.minimum=g,u.exclusiveMinimum=!0):u.exclusiveMinimum=g:typeof f=="number"&&(u.minimum=f),w?O?(u.maximum=p,u.exclusiveMaximum=!0):u.exclusiveMaximum=p:typeof d=="number"&&(u.maximum=d),m){const T=new Set;for(const L of m)Number.isFinite(L)&&L!==0?T.add(Math.abs(L)):Ws(n,i,u,l,`A multipleOf divisor of ${L} cannot be represented in JSON Schema`);const[A,...k]=T;A!==void 0&&(u.multipleOf=A),k.length&&(u.allOf=[...u.allOf??[],...k.map(L=>({multipleOf:L}))])}},Q2=(n,i,a,l)=>{a.type="boolean"},J2=(n,i,a,l)=>{a.not={}},X2=(n,i,a,l)=>{},W2=(n,i,a,l)=>{const u=n._zod.def,f=Xm(u.entries);if(f.length===0){a.not={};return}f.every(d=>typeof d=="number")&&(a.type="number"),f.every(d=>typeof d=="string")&&(a.type="string"),a.enum=f},eN=(n,i,a,l)=>{const u=n._zod.def;if(u.values.length===0){a.not={};return}const f=[];for(const d of u.values)if(d===void 0){if(Ws(n,i,a,l,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof d=="bigint"){if(Ws(n,i,a,l,"BigInt literals cannot be represented in JSON Schema"))return;f.push(Number(d))}else f.push(d);if(f.length!==0)if(f.length===1){const d=f[0];a.type=d===null?"null":typeof d,i.target==="draft-04"||i.target==="openapi-3.0"?a.enum=[d]:a.const=d}else f.every(d=>typeof d=="number")&&(a.type="number"),f.every(d=>typeof d=="string")&&(a.type="string"),f.every(d=>typeof d=="boolean")&&(a.type="boolean"),f.every(d=>d===null)&&(a.type="null"),a.enum=f},tN=(n,i,a,l)=>{Ws(n,i,a,l,"Custom types cannot be represented in JSON Schema")},nN=(n,i,a,l)=>{Ws(n,i,a,l,"Transforms cannot be represented in JSON Schema")},iN=(n,i,a,l)=>{const u=a,f=n._zod.def,{minimum:d,maximum:m}=Wi(n);typeof d=="number"&&(u.minItems=d),typeof m=="number"&&(u.maxItems=m),u.type="array",u.items=Kt(f.element,i,{...l,path:[...l.path,"items"]})};function Cu(n){const i=n._zod.def;return i.type==="pipe"&&i.in._zod.traits.has("$ZodTransform")?Cu(i.out):i.type==="catch"?Cu(i.innerType):n._zod.optin}const rN=(n,i,a,l)=>{const u=a,f=n._zod.def,d=f.shape;if(Object.getOwnPropertySymbols(d).length&&Ws(n,i,u,l,"Symbol keys cannot be represented)DELIM" -R"DELIM( in JSON Schema"))return;u.type="object",u.properties={};for(const g in d)ta(u.properties,g,Kt(d[g],i,{...l,path:[...l.path,"properties",g]}));const p=[];for(const g of Object.keys(d)){const b=f.shape[g];(i.io==="input"?Cu(b)===void 0:b._zod.optout===void 0)&&p.push(g)}p.length>0&&(u.required=p),f.catchall?._zod.def.type==="never"?u.additionalProperties=!1:f.catchall?f.catchall&&(u.additionalProperties=Kt(f.catchall,i,{...l,path:[...l.path,"additionalProperties"]})):i.io==="output"&&(u.additionalProperties=!1)},sN=(n,i,a,l)=>{const u=n._zod.def,f=u.inclusive===!1,d=u.options.map((m,p)=>Kt(m,i,{...l,path:[...l.path,f?"oneOf":"anyOf",p]}));f?a.oneOf=d:a.anyOf=d},aN=(n,i,a,l)=>{const u=n._zod.def,f=Kt(u.left,i,{...l,path:[...l.path,"allOf",0]}),d=Kt(u.right,i,{...l,path:[...l.path,"allOf",1]}),m=g=>"allOf"in g&&Object.keys(g).length===1,p=[...m(f)?f.allOf:[f],...m(d)?d.allOf:[d]];a.allOf=p,i.intersections.push(p)},lN=(n,i,a,l)=>{const u=a,f=n._zod.def;u.type="array";const d=i.target==="draft-2020-12"?"prefixItems":"items",m=i.target==="draft-2020-12"||i.target==="openapi-3.0"?"items":"additionalItems",p=f.items.map((A,k)=>Kt(A,i,{...l,path:[...l.path,d,k]})),g=f.rest?Kt(f.rest,i,{...l,path:[...l.path,m,...i.target==="openapi-3.0"?[f.items.length]:[]]}):null;let b=f.items.length;for(;b>0;){const A=f.items[b-1];if(!(i.io==="input"?Cu(A)!==void 0:A._zod.optout==="optional"))break;b--}const y=f.items.length,w=!f.rest;i.target==="draft-2020-12"?(u.prefixItems=p,w?u.items=!1:g&&(u.items=g),b>0&&(u.minItems=b),w&&(u.maxItems=y)):i.target==="openapi-3.0"?(u.items={anyOf:p},g&&u.items.anyOf.push(g),b>0&&(u.minItems=b),w&&(u.maxItems=y)):(u.items=p,w?u.additionalItems=!1:g&&(u.additionalItems=g),b>0&&(u.minItems=b),w&&(u.maxItems=y));const{minimum:O,maximum:T}=Wi(n);typeof O=="number"&&(u.minItems=O),typeof T=="number"&&(u.maxItems=T)};function sp(n,i,a){if(i.$ref){if(a.has(i))return i;a.add(i);const T=n.get(i)?.def;if(!T)return i;const A=sp(n,T,a);return A===T?i:A}for(const T of["anyOf","oneOf"]){const A=i[T];if(!Array.isArray(A))continue;const k=A.map(L=>sp(n,L,a));k.some((L,D)=>L!==A[D])&&(i={...i,[T]:k})}const l=Array.isArray(i.type)?i.type:[i.type],u=!l.includes("string")&&l.some(T=>T==="number"||T==="integer"),f=i.enum??(i.const!==void 0?[i.const]:void 0);if(!u&&!f?.some(T=>typeof T=="number"))return i;const{minimum:d,maximum:m,exclusiveMinimum:p,exclusiveMaximum:g,multipleOf:b,format:y,id:w,...O}=i;return O.enum?O.enum=O.enum.map(T=>typeof T=="number"?String(T):T):typeof O.const=="number"&&(O.const=String(O.const)),u&&(O.type="string",f||(O.pattern=(l.includes("number")?Vp:vE).source)),O}const ap=new WeakMap;function oN(n){const i=new Map;for(const l of n.seen.values())l.def&&!i.has(l.schema)&&i.set(l.schema,l);const a=new Map;for(const l of ap.get(n)??[]){const u=n.seen.get(l),f=(u?.def??u?.schema)?.propertyNames;if(!f||f===!0||a.has(f))continue;const d=sp(i,f,new Set);d!==f&&a.set(f,d)}if(a.size)for(const l of n.seen.values())for(const u of[l.schema,l.def]){const f=u&&a.get(u.propertyNames);f&&(u.propertyNames=f)}}const uN=(n,i,a,l)=>{const u=a,f=n._zod.def;u.type="object";const d=f.keyType,m=Wi(d).patterns;if(f.mode==="loose"&&m&&m.size>0){const b=Kt(f.valueType,i,{...l,path:[...l.path,"patternProperties","*"]});u.patternProperties={};for(const y of m)ta(u.patternProperties,Q1(y).source,b)}else{if(i.target==="draft-07"||i.target==="draft-2020-12"){u.propertyNames=Kt(f.keyType,i,{...l,path:[...l.path,"propertyNames"]});let b=ap.get(i);b||(b=[],ap.set(i,b),i.deferred.push(()=>oN(i))),b.push(n)}u.additionalProperties=Kt(f.valueType,i,{...l,path:[...l.path,"additionalProperties"]})}const p=d._zod.values,g=i.io==="input"&&Cu(f.valueType)!==void 0;if(p&&!f.partial&&!g){const b=[...p].filter(y=>typeof y=="string"||typeof y=="number");b.length>0&&(u.required=b.map(String))}},cN=(n,i,a,l)=>{const u=n._zod.def,f=Kt(u.innerType,i,l),d=i.seen.get(n);i.target==="openapi-3.0"?(d.ref=u.innerType,a.nullable=!0):a.anyOf=[f,{type:"null"}]},fN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType},Gp=Symbol();function J1(n,i,a,l,u){let f=!1;const d=JSON.stringify(n,(m,p)=>typeof p!="bigint"?p:(f=!0,null));return f?(Ws(i,a,l,u,"BigInt defaults cannot be represented in JSON Schema"),Gp):JSON.parse(d)}const dN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType;const d=J1(u.defaultValue,n,i,a,l);d!==Gp&&(a.default=d)},hN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);if(f.ref=u.innerType,i.io!=="input")return;const d=J1(u.defaultValue,n,i,a,l);d!==Gp&&(a._prefault=d)},mN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType;let d;try{d=u.catchValue(void 0)}catch{Ws(n,i,a,l,"Dynamic catch values are not supported in JSON Schema");return}a.default=d},pN=(n,i,a,l)=>{const u=n._zod.def,f=u.in._zod.traits.has("$ZodTransform"),d=i.io==="input"?f?u.out:u.in:u.out;Kt(d,i,l);const m=i.seen.get(n);m.ref=d},gN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType,a.readOnly=!0},X1=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType},Bb=new WeakSet([Object.prototype,Error.prototype]);function vf(n,i,a){Object.defineProperty(n,i,{configurable:!0,enumerable:!1,get(){const l=a(this);return Object.defineProperty(this,i,{value:l,configurable:!0,writable:!0}),l},set(l){Object.defineProperty(this,i,{value:l,configurable:!0,writable:!0})}})}const vN=(n,i)=>{AT.init(n,i),n.name="ZodError";const a=Object.getPrototypeOf(n);Bb.has(a)||(Bb.add(a),vf(a,"format",l=>u=>kT(l,u)),vf(a,"flatten",l=>u=>jT(l,u)),vf(a,"addIssue",l=>u=>{l.issues.push(u),l.message=JSON.stringify(l.issues,Wm,2)}),vf(a,"addIssues",l=>u=>{l.issues.push(...u),l.message=JSON.stringify(l.issues,Wm,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},tr=Y("ZodError",vN,void 0,{Parent:Error}),yN=Lp(tr),bN=Hp(tr),_N=Bp(tr),SN=qp(tr),xN=$T(tr),wN=LT(tr),zN=HT(tr),TN=BT(tr),EN=qT(tr),ON=VT(tr),NN=IT(tr),AN=PT(tr);function MN(){er.localeError||Br(GO())}function Hu(){er.memoizer||Br({memoizer:IO()})}const Dt=Y("ZodType",(n,i)=>(MN(),Ot.init(n,i),n.def=i,n.type=i.type,n),{check(...n){const i=this.def;return this.clone(Di(i,{checks:[...i.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return na(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(AA(n,i))},superRefine(n,i){return this.check(MA(n,i))},overwrite(n){return this.check(ho(n))},optional(){return Pb(this)},exactOptional(){return gA(this)},nullable(){return Kb(this)},nullish(){return Pb(Kb(this))},nonoptional(n){return xA(this,n)},array(){return Wf(this)},or(n){return ed([this,n])},and(n){return uA(this,n)},transform(n){return Gb(this,pA(n))},default(n){return bA(this,n)},prefault(n){return SA(this,n)},catch(n){return zA(this,n)},pipe(n){return Gb(this,n)},readonly(){return OA(this)},describe(n){const i=this.clone();return wu.add(i,{description:n}),i},meta(...n){if(n.length===0)return wu.get(this);const i=this.clone();return wu.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n,...i){return i.length===0?n(this):n(this,...i)},get"~standard"(){return y1(this,"~standard",{...E1(this),jsonSchema:{input:Lf(this,"input"),output:Lf(this,"output")}})},set"~standard"(n){Xs(this,"~standard",n)},parse:function n(i,a){return yN(this,i,a,{callee:n})},parseAsync:async function n(i,a){return await bN(this,i,a,{callee:n})},safeParse(n,i){return _N(this,n,i)},async safeParseAsync(n,i){return SN(this,n,i)},get spa(){return this?.safeParseAsync},set spa(n){Xs(this,"spa",n)},validate(n,i){return DT(this,n,i)},validateAsync(n,i){return ZT(this,n,i)},encode:function n(i,a){return xN(this,i,a,{callee:n})DELIM" -R"DELIM()},decode:function n(i,a){return wN(this,i,a,{callee:n})},encodeAsync:async function n(i,a){return await zN(this,i,a,{callee:n})},decodeAsync:async function n(i,a){return await TN(this,i,a,{callee:n})},safeEncode(n,i){return EN(this,n,i)},safeDecode(n,i){return ON(this,n,i)},async safeEncodeAsync(n,i){return NN(this,n,i)},async safeDecodeAsync(n,i){return AN(this,n,i)},toJSONSchema(n){return I2(this,{})(n)},get description(){return wu.get(this)?.description},get _def(){return this._zod.def}}),W1=Y("_ZodString",(n,i)=>{Pp.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>Y2(n,a,l)},b1({format:n=>Wi(n).format??null,minLength:n=>Wi(n).minimum??null,maxLength:n=>Wi(n).maximum??null},{regex(...n){return this.check(N2(...n))},includes(...n){return this.check(j2(...n))},startsWith(...n){return this.check(k2(...n))},endsWith(...n){return this.check(R2(...n))},min(...n){return this.check($f(...n))},max(...n){return this.check(L1(...n))},length(...n){return this.check(H1(...n))},nonempty(...n){return this.check($f(1,...n))},lowercase(n){return this.check(A2(n))},uppercase(n){return this.check(M2(n))},trim(){return this.check(D2())},normalize(...n){return this.check(C2(...n))},toLowerCase(){return this.check(U2())},toUpperCase(){return this.check(Z2())},slugify(){return this.check($2())}})),jN=Y("ZodString",(n,i)=>{Pp.init(n,i),W1.init(n,i)},{email(n){return this.check(JO(UN,n))},url(n){return this.check(i2($N,n))},jwt(n){return this.check(y2(WN,n))},emoji(n){return this.check(r2(LN,n))},guid(n){return this.check(XO(ZN,n))},uuid(n){return this.check(WO(yf,n))},uuidv4(n){return this.check(e2(yf,n))},uuidv6(n){return this.check(t2(yf,n))},uuidv7(n){return this.check(n2(yf,n))},nanoid(n){return this.check(s2(HN,n))},cuid(n){return this.check(a2(BN,n))},cuid2(n){return this.check(l2(qN,n))},ulid(n){return this.check(o2(VN,n))},base64(n){return this.check(p2(QN,n))},base64url(n){return this.check(g2(JN,n))},xid(n){return this.check(u2(IN,n))},ksuid(n){return this.check(c2(PN,n))},ipv4(n){return this.check(f2(KN,n))},ipv6(n){return this.check(d2(GN,n))},cidrv4(n){return this.check(h2(YN,n))},cidrv6(n){return this.check(m2(FN,n))},e164(n){return this.check(v2(XN,n))},datetime(n){return this.check(b2(kN,n))},date(n){return this.check(_2(RN,n))},time(n){return this.check(S2(CN,n))},duration(n){return this.check(x2(DN,n))}});function Pn(n){return QO(jN,n)}const Ht=Y("ZodStringFormat",(n,i)=>{Ct.init(n,i),W1.init(n,i)}),kN=Y("ZodISODateTime",(n,i)=>{XE.init(n,i),Ht.init(n,i)}),RN=Y("ZodISODate",(n,i)=>{WE.init(n,i),Ht.init(n,i)}),CN=Y("ZodISOTime",(n,i)=>{eO.init(n,i),Ht.init(n,i)}),DN=Y("ZodISODuration",(n,i)=>{tO.init(n,i),Ht.init(n,i)}),UN=Y("ZodEmail",(n,i)=>{$E.init(n,i),Ht.init(n,i)}),ZN=Y("ZodGUID",(n,i)=>{UE.init(n,i),Ht.init(n,i)}),yf=Y("ZodUUID",(n,i)=>{ZE.init(n,i),Ht.init(n,i)}),$N=Y("ZodURL",(n,i)=>{IE.init(n,i),Ht.init(n,i)}),LN=Y("ZodEmoji",(n,i)=>{PE.init(n,i),Ht.init(n,i)}),HN=Y("ZodNanoID",(n,i)=>{KE.init(n,i),Ht.init(n,i)}),BN=Y("ZodCUID",(n,i)=>{GE.init(n,i),Ht.init(n,i)}),qN=Y("ZodCUID2",(n,i)=>{YE.init(n,i),Ht.init(n,i)}),VN=Y("ZodULID",(n,i)=>{FE.init(n,i),Ht.init(n,i)}),IN=Y("ZodXID",(n,i)=>{QE.init(n,i),Ht.init(n,i)}),PN=Y("ZodKSUID",(n,i)=>{JE.init(n,i),Ht.init(n,i)}),KN=Y("ZodIPv4",(n,i)=>{nO.init(n,i),Ht.init(n,i)}),GN=Y("ZodIPv6",(n,i)=>{rO.init(n,i),Ht.init(n,i)}),YN=Y("ZodCIDRv4",(n,i)=>{sO.init(n,i),Ht.init(n,i)}),FN=Y("ZodCIDRv6",(n,i)=>{lO.init(n,i),Ht.init(n,i)}),QN=Y("ZodBase64",(n,i)=>{oO.init(n,i),Ht.init(n,i)}),JN=Y("ZodBase64URL",(n,i)=>{cO.init(n,i),Ht.init(n,i)}),XN=Y("ZodE164",(n,i)=>{fO.init(n,i),Ht.init(n,i)}),WN=Y("ZodJWT",(n,i)=>{hO.init(n,i),Ht.init(n,i)}),eS=Y("ZodNumber",(n,i)=>{k1.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>F2(n,a,l,u),n.isFinite=!0},b1({minValue:n=>{const{minimum:i,exclusiveMinimum:a}=Wi(n);return Math.max(i??Number.NEGATIVE_INFINITY,a??Number.NEGATIVE_INFINITY)},maxValue:n=>{const{maximum:i,exclusiveMaximum:a}=Wi(n);return Math.min(i??Number.POSITIVE_INFINITY,a??Number.POSITIVE_INFINITY)},isInt:n=>{const{isInt:i,multipleOf:a}=Wi(n);return!!i||!!a?.some(Number.isSafeInteger)},format:n=>Wi(n).format??null},{gt(n,i){return this.check(kb(n,i))},gte(n,i){return this.check(Hm(n,i))},min(n,i){return this.check(Hm(n,i))},lt(n,i){return this.check(jb(n,i))},lte(n,i){return this.check(Lm(n,i))},max(n,i){return this.check(Lm(n,i))},int(n){return this.check(qb(n))},safe(n){return this.check(qb(n))},positive(n){return this.check(kb(0,n))},nonnegative(n){return this.check(Hm(0,n))},negative(n){return this.check(jb(0,n))},nonpositive(n){return this.check(Lm(0,n))},multipleOf(n,i){return this.check(Rb(n,i))},step(n,i){return this.check(Rb(n,i))},finite(){return this}}));function hn(n){return w2(eS,n)}const eA=Y("ZodNumberFormat",(n,i)=>{mO.init(n,i),eS.init(n,i)});function qb(n){return z2(eA,n)}const tA=Y("ZodBoolean",(n,i)=>{pO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>Q2(n,a,l)});function Dn(n){return T2(tA,n)}const nA=Y("ZodUnknown",(n,i)=>{gO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>X2()});function Vb(){return E2(nA)}const iA=Y("ZodNever",(n,i)=>{vO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>J2(n,a,l)});function rA(n){return O2(iA,n)}const sA=Y("ZodArray",(n,i)=>{Hu(),_O.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>iN(n,a,l,u),n.element=i.element},{min(n,i){return this.check($f(n,i))},nonempty(n){return this.check($f(1,n))},max(n,i){return this.check(L1(n,i))},length(n,i){return this.check(H1(n,i))},unwrap(){return this.element}});function Wf(n,i){return L2(sA,n,i)}const aA=Y("ZodObject",(n,i)=>{Hu(),wO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>rN(n,a,l,u),ST(n,"shape",a=>a._zod.def.shape,!1)},{keyof(){return Du(Object.keys(this._zod.def.shape))},catchall(n){return this.clone(Di(this._zod.def,{catchall:n}))},passthrough(){return this.clone(Di(this._zod.def,{catchall:Vb()}))},loose(){return this.clone(Di(this._zod.def,{catchall:Vb()}))},strict(){return this.clone(Di(this._zod.def,{catchall:rA()}))},strip(){return this.clone(Di(this._zod.def,{catchall:void 0}))},extend(n){return cT(this,n)},safeExtend(n){return fT(this,n)},merge(n){return dT(this,n)},pick(n){return oT(this,n)},omit(n){return uT(this,n)},partial(...n){return cb(Yp,this,n[0])},exactPartial(...n){return cb(tS,this,n[0],"exactPartial")},required(...n){return hT(nS,this,n[0])}});function In(n,i){const a={type:"object",shape:n??{},...Te(i)};return new aA(a)}const lA=Y("ZodUnion",(n,i)=>{zO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>sN(n,a,l,u),n.options=i.options});function ed(n,i){return new lA({type:"union",options:n,...Te(i)})}const oA=Y("ZodIntersection",(n,i)=>{TO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>aN(n,a,l,u)});function uA(n,i){return new oA({type:"intersection",left:n,right:i})}const cA=Y("ZodTuple",(n,i)=>{Hu(),EO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>lN(n,a,l,u)},{rest(n){return this.clone({...this._zod.def,rest:n})},partial(){const n=this._zod.def;if(n.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...n,items:n.items.map(i=>new Yp({type:"optional",innerType:i}))})}});function fA(n,i,a){const l=i instanceof Ot,u=l?a:i,f=l?i:null;return new cA({type:"tuple",items:n,rest:f,...Te(u)})}const Ib=Y("ZodRecord",(n,i)=>{Hu(),OO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>uN(n,a,l,u),n.keyType=i.keyType,n.valueType=i.valueType});function dA(n,i,a){return!i||!i._zod?new Ib({type:"record",keyType:Pn(),valueType:n,...Te(i)}):new Ib({type:"record",keyType:n,valueType:i,...Te(a)})}const lp=Y("ZodEnum",(n,i)=>{NO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(l,u,f)=>W2(n,l,u),n.enum=i.entries,n.options=[...n._zod.values];const a=new Set(Object.keys(i.entries));n.extract=(l,u)=>{const f={};for(const d of l)if(a.has(d))f[d]=i.entries[d];else throw new Error(`Key ${d} not found in enum`);return new lp({...i,checks:[],...Te(u),entrie)DELIM" -R"DELIM(s:f})},n.exclude=(l,u)=>{const f={...i.entries};for(const d of l)if(a.has(d))delete f[d];else throw new Error(`Key ${d} not found in enum`);return new lp({...i,checks:[],...Te(u),entries:f})}});function Du(n,i){const a=Array.isArray(n)?Object.fromEntries(n.map(l=>[l,l])):n;return new lp({type:"enum",entries:a,...Te(i)})}const hA=Y("ZodLiteral",(n,i)=>{AO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>eN(n,a,l,u),n.values=new Set(i.values),Object.defineProperty(n,"value",{get(){if(i.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return i.values[0]}})});function Au(n,i){return new hA({type:"literal",values:Array.isArray(n)?n:[n],...Te(i)})}const mA=Y("ZodTransform",(n,i)=>{Hu(),MO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>nN(n,a,l,u),n._zod.parse=(a,l)=>{if(l.direction==="backward")throw new _1(n.constructor.name);a.addIssue=f=>{if(typeof f=="string")a.issues.push(Ru(f,a.value,i));else{const d=f;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),"input"in d||(d.input=a.value),d.inst??(d.inst=n),a.issues.push(Ru(d))}};const u=i.transform(a.value,a);return u instanceof Promise?u.then(f=>(a.value=f,a)):(a.value=u,a)}});function pA(n){return new mA({type:"transform",transform:n})}const Yp=Y("ZodOptional",(n,i)=>{D1.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>X1(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function Pb(n){return new Yp({type:"optional",innerType:n})}const tS=Y("ZodExactOptional",(n,i)=>{jO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>X1(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function gA(n){return new tS({type:"optional",innerType:n})}const vA=Y("ZodNullable",(n,i)=>{kO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>cN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function Kb(n){return new vA({type:"nullable",innerType:n})}const yA=Y("ZodDefault",(n,i)=>{RO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>dN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function bA(n,i){return new yA({type:"default",innerType:n,get defaultValue(){return typeof i=="function"?i():m1(i)}})}const _A=Y("ZodPrefault",(n,i)=>{CO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>hN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function SA(n,i){return new _A({type:"prefault",innerType:n,get defaultValue(){return typeof i=="function"?i():m1(i)}})}const nS=Y("ZodNonOptional",(n,i)=>{DO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>fN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function xA(n,i){return new nS({type:"nonoptional",innerType:n,...Te(i)})}const wA=Y("ZodCatch",(n,i)=>{UO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>mN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function zA(n,i){return new wA({type:"catch",innerType:n,catchValue:typeof i=="function"?i:wT(i)})}const TA=Y("ZodPipe",(n,i)=>{ZO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>pN(n,a,l,u),n.in=i.in,n.out=i.out});function Gb(n,i){return new TA({type:"pipe",in:n,out:i})}const EA=Y("ZodReadonly",(n,i)=>{$O.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>gN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function OA(n){return new EA({type:"readonly",innerType:n})}const NA=Y("ZodCustom",(n,i)=>{LO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>tN(n,a,l,u)});function AA(n,i={}){return H2(NA,n,i)}function MA(n,i){return B2(n,i)}const Bu=[{id:0,name:"application",label:"Application"},{id:1,name:"news",label:"News"},{id:2,name:"session",label:"Session"},{id:3,name:"protocol",label:"Protocol"},{id:4,name:"proxy",label:"Proxy"},{id:5,name:"remote",label:"Remote"},{id:6,name:"fault",label:"Fault"},{id:7,name:"quitting",label:"Quitting"},{id:8,name:"objects",label:"Objects"},{id:9,name:"verbose",label:"Verbose"}],Hf=[{id:0,name:"header_archived",label:"Header archived",category:"headers",valueKind:"height"},{id:1,name:"header_organized",label:"Header organized",category:"headers",valueKind:"height"},{id:2,name:"header_reorganized",label:"Header reorganized",category:"headers",valueKind:"height"},{id:3,name:"block_archived",label:"Block archived",category:"blocks",valueKind:"height"},{id:4,name:"block_buffered",label:"Block buffered",category:"blocks",valueKind:"height"},{id:5,name:"block_validated",label:"Block validated",category:"blocks",valueKind:"height"},{id:6,name:"block_confirmed",label:"Block confirmed",category:"blocks",valueKind:"height"},{id:7,name:"block_unconfirmable",label:"Block unconfirmable",category:"blocks",valueKind:"height"},{id:8,name:"validate_bypassed",label:"Validation bypassed",category:"blocks",valueKind:"height"},{id:9,name:"confirm_bypassed",label:"Confirmation bypassed",category:"blocks",valueKind:"height"},{id:10,name:"tx_archived",label:"Transaction archived",category:"transactions",valueKind:"fee-rate"},{id:11,name:"tx_validated",label:"Transaction validated",category:"transactions",valueKind:"count"},{id:12,name:"tx_invalidated",label:"Transaction invalidated",category:"transactions",valueKind:"count"},{id:13,name:"block_organized",label:"Block organized",category:"chain",valueKind:"height"},{id:14,name:"block_reorganized",label:"Block reorganized",category:"chain",valueKind:"height"},{id:15,name:"template_issued",label:"Mining template issued",category:"mining",valueKind:"count"},{id:16,name:"snapshot_secs",label:"Snapshot",category:"timing",valueKind:"seconds"},{id:17,name:"prune_msecs",label:"Prune",category:"timing",valueKind:"milliseconds"},{id:18,name:"reload_msecs",label:"Store reload",category:"timing",valueKind:"milliseconds"},{id:19,name:"block_usecs",label:"Serve block",category:"timing",valueKind:"microseconds"},{id:20,name:"ancestry_msecs",label:"Serve ancestry",category:"timing",valueKind:"milliseconds"},{id:21,name:"filter_msecs",label:"Serve filter",category:"timing",valueKind:"milliseconds"},{id:22,name:"filterhashes_msecs",label:"Serve filter hashes",category:"timing",valueKind:"milliseconds"},{id:23,name:"filterchecks_msecs",label:"Serve filter checkpoints",category:"timing",valueKind:"milliseconds"},{id:24,name:"ecdsa_secs",label:"ECDSA batch verification",category:"timing",valueKind:"seconds"},{id:25,name:"schnorr_secs",label:"Schnorr batch verification",category:"timing",valueKind:"seconds"},{id:26,name:"silent_secs",label:"Silent payment scan",category:"timing",valueKind:"seconds"},{id:27,name:"validate_usecs",label:"Block validation",category:"timing",valueKind:"microseconds"},{id:28,name:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],iS=hn().int().nonnegative().max(864e13),jA=In({level:hn().int().nonnegative(),time:iS,message:Pn()}),kA=In({event:hn().int().nonnegative(),value:hn().nonnegative(),time:iS}),RA=In({previous:hn().nonnegative()});ed([jA,kA,RA]);const Fp=2**Bu.length-1,to=Fp,CA=2**0+2**1+2**2+2**6+2**7;function DA(n,i){return Number.isInteger(i)&&i>=0&&i0?`${String(a)}d ${String(l)}h`:l>0?`${String(l)}h ${String(u)}m`:u>0?`${String(u)}m ${String(f)}s`:`${String(f)}s`}function sS(n,i){switch(mo(n).valueKind){case"height":return`height ${pn(i)}`;case"seconds":return`${Fa(i)} s`;case"milliseconds":return`${Fa(i)} ms`;case"microseconds":return`${Fa(i)} µs`;case"count":return pn(i);case"fee-rate":return`${Fa(i/1e3,3)} sat/vB`;default:return String(i)}}function qA(n){return n>=100?`${Fa(n,0)}/s`:n>=10?`${Fa(n,1)}/s`:`${Fa(n,2)}/s`}const Bf=32,VA=[{value:"all",label:"All categories"},{value:"headers",label:"Headers"},{value:"blocks",label:"Blocks"},{value:"transactions",label:"Transactions"},{value:"chain",label:"Confirmed chain"},{value:"mining",label:"Mining"},{value:"timing",label:"Timing"}],IA={headers:"bg-violet-500/15 text-violet-300",blocks:"bg-accent/15 text-accent",transactions:"bg-sky-500/15 text-sky-300",chain:"bg-emerald-500/15 text-emerald-300",mining:"bg-amber-500/15 text-amber-300",timing:"bg-cyan-500/15 text-cyan-300"};function PA({metrics:n,paused:i,onPausedChange:a,onClear:l}){const[u,f]=se.useState(""),[d,m]=se.useState("all"),[p,g]=se.useState({offset:0,search:u,category:d}),b=p.search===u&&p.category===d?p.offset:0,y=se.useRef(null),w=se.useSyncExternalStore(n.subscribeEvents,n.getEventWindow,n.getEventWindow);return se.useEffect(()=>{n.setEventQuery({search:u,category:d,offset:b})},[n,u,d,b]),se.useEffect(()=>{y.current&&(y.current.scrollTop=0)},[u,d]),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Node lifecycle"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Live events"}),x.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"Heights are event payloads; timing values retain their source units."}),x.jsx("p",{className:"text-textMuted mt-1 text-xs",children:"Pause freezes this view; collection and charts continue."})]}),x.jsxs("div",{className:"flex gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{i&&(y.current&&(y.current.scrollTop=0),g({offset:0,search:u,category:d})),a(!i)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:i?"Resume display":"Pause display"}),x.jsx("button",{type:"button",onClick:l,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:"Clear"})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 flex flex-wrap gap-3 rounded-2xl border p-4",children:[x.jsxs("label",{className:"min-w-56 flex-1",children:[x.jsx("span",{className:"sr-only",children:"Search events"}),x.jsx("input",{type:"search",value:u,onChange:O=>{f(O.target.value)},placeholder:"Search event names or values…",className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),x.jsxs("label",{children:[x.jsx("span",{className:"sr-only",children:"Filter event category"}),x.jsx("select",{value:d,onChange:O=>{m(O.target.value)},className:"border-accent/40 bg-background text-textPrimary focus:border-accent rounded-md border px-3 py-2 text-sm focus:ring-0",children:VA.map(O=>x.jsx("option",{value:O.value,children:O.label},O.value))})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-xl border",children:[x.jsxs("div",{className:"border-accentSecondary/30 bg-accentSecondary/20 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[x.jsx("span",{children:i?"Display paused · collection continues":b>0?"Viewing older rows · collection continues":"Live stream · newest first"}),x.jsxs("span",{children:[String(w.matched)," matching · ",String(w.retained)," retained"]})]}),x.jsx("div",{ref:y,role:"region","aria-label":"Scrollable event history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:O=>{g({offset:Math.max(0,Math.floor(O.currentTarget.scrollTop/Bf)-8),search:u,category:d})},children:w.matched===0?x.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching events."}):x.jsx("ol",{"aria-label":"Received events",className:"relative min-w-[32rem]",style:{height:w.matched*Bf},children:w.events.map((O,T)=>x.jsx(KA,{event:O,index:w.offset+T,total:w.matched},O.id))})})]}),!i&&x.jsx("div",{className:"flex justify-end text-xs",children:x.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{y.current&&(y.current.scrollTop=0),g({offset:0,search:u,category:d})},children:"Jump to latest"})}),x.jsxs("details",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-4 py-3 text-sm",children:["Event contract (",String(Hf.length)," identifiers)"]}),x.jsx("div",{className:"border-accentSecondary/20 grid gap-2 border-t p-4 sm:grid-cols-2 lg:grid-cols-3",children:Hf.map(O=>x.jsxs("div",{className:"text-xs",children:[x.jsx("span",{className:"text-textMuted font-mono",children:String(O.id).padStart(2,"0")}),x.jsx("span",{className:"text-textPrimary ml-2",children:O.name})]},O.id))})]})]})}const KA=se.memo(function({event:i,index:a,total:l}){const u=mo(i.event);return x.jsxs("li",{"aria-setsize":l,"aria-posinset":a+1,className:"border-accentSecondary/20 absolute inset-x-0 grid grid-cols-[8.5rem_10rem_minmax(0,1fr)] items-center gap-2 border-b px-4 text-xs",style:{top:a*Bf,height:Bf},children:[x.jsx("time",{dateTime:Qp(i.time),className:"text-textMuted font-mono tabular-nums",children:Uu(i.time)}),x.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${IA[u.category]}`,children:u.name}),x.jsx("span",{className:"text-textPrimary font-mono tabular-nums",children:sS(i.event,i.value)})]})}),qf=32,Yb={0:"bg-sky-500/15 text-sky-300",1:"bg-emerald-500/15 text-emerald-300",2:"bg-violet-500/15 text-violet-300",3:"bg-cyan-500/15 text-cyan-300",4:"bg-indigo-500/15 text-indigo-300",5:"bg-blue-500/15 text-blue-300",6:"bg-red-500/20 text-red-300",7:"bg-orange-500/20 text-orange-300",8:"bg-slate-500/20 text-slate-300",9:"bg-zinc-500/20 text-zinc-300"};function GA({metrics:n,delivery:i,status:a,logFilter:l,paused:u,onLogFilterChange:f,onPausedChange:d,onClear:m}){const[p,g]=se.useState(""),[b,y]=se.useState({offset:0,search:p,filter:l}),w=b.search===p&&b.filter===l?b.offset:0,[O,T]=se.useState(null),A=se.useRef(null),k=se.useSyncExternalStore(n.subscribeLogs,n.getLogWindow,n.getLogWindow);return se.useEffect(()=>{n.setLogQuery({search:p,filter:l,offset:w})},[n,p,l,w]),se.useEffect(()=>{A.current&&(A.current.scrollTop=0)},[p,l]),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Diagnostic stream"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Node logs"}),x.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"The newest 1,000 messages are retained in this browser session."})]}),x.jsxs("div",{className:"flex gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{u&&(A.current&&(A.current.scrollTop=0),y({offset:0,search:p,filter:l})),d(!u)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:u?"Resume display":"Pause display"}),x.jsx("button",{type:"button",onClick:m,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary r)DELIM" -R"DELIM(ounded-md border px-3 py-2 text-sm font-medium",children:"Clear"})]})]}),x.jsxs("fieldset",{className:"border-accent/30 bg-surface/80 space-y-3 rounded-2xl border p-4",children:[x.jsx("legend",{className:"text-textPrimary px-1 text-sm font-medium",children:"Requested log levels"}),x.jsx("p",{className:"text-textMuted text-xs",children:"Only checked levels are sent by the server. Pause freezes this view; collection and charts continue. Skipped log levels are not replayed."}),x.jsx("div",{className:"flex flex-wrap gap-x-5 gap-y-3",children:Bu.map(L=>x.jsxs("label",{className:"text-textPrimary flex items-center gap-2 text-sm",children:[x.jsx("input",{type:"checkbox",checked:DA(l,L.id),onChange:()=>{f(l^1<{f(CA)},className:"text-accent hover:underline",children:"Operational levels"}),x.jsx("button",{type:"button",onClick:()=>{f(Fp)},className:"text-accent hover:underline",children:"All levels"}),x.jsx("button",{type:"button",onClick:()=>{f(0)},className:"text-accent hover:underline",children:"No levels"}),x.jsx("span",{className:"text-textMuted",children:"Selection is saved in this browser."})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 space-y-2 rounded-2xl border p-4 text-xs",children:[x.jsx("dl",{"aria-label":"Log delivery statistics",className:"flex flex-wrap gap-x-6 gap-y-2",children:[["Received logs",i.totalLogs],["Rolled out of history",i.evictedLogs],["Cleared from history",i.clearedLogs],["Invalid admin frames",i.invalidFrames],["Reconnects",a.reconnects]].map(([L,D])=>x.jsxs("div",{children:[x.jsx("dt",{className:"text-textMuted",children:L}),x.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:D.toLocaleString()})]},L))}),x.jsx("p",{className:"text-textMuted",children:"Live rows refresh every 100 ms and can skip intermediate messages on screen. Every valid log at a requested level is counted; older messages leave the 1,000-message history as new ones arrive. These counters continue while display is paused. Reconnects can leave gaps that the server does not replay."}),x.jsxs("p",{className:"text-textMuted",role:"status",children:["Admin connection: ",a.phase,a.error?` · ${a.error}`:""]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 flex flex-wrap gap-3 rounded-2xl border p-4",children:[x.jsxs("label",{className:"min-w-56 flex-1",children:[x.jsx("span",{className:"sr-only",children:"Search logs"}),x.jsx("input",{type:"search",value:p,onChange:L=>{g(L.target.value)},placeholder:"Search received messages…",className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),x.jsx("p",{className:"text-textMuted self-center text-xs",children:"Search filters received messages only."})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-xl border",children:[x.jsxs("div",{className:"border-accentSecondary/30 bg-accentSecondary/20 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[x.jsx("span",{children:u?"Display paused · collection continues":l===0?"Log delivery disabled":w>0?"Viewing older rows · collection continues":"Live stream · newest first"}),x.jsxs("span",{children:[String(k.matched)," matching · ",String(k.retained)," retained"]})]}),x.jsx("div",{ref:A,role:"region","aria-label":"Scrollable log history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:L=>{y({offset:Math.max(0,Math.floor(L.currentTarget.scrollTop/qf)-8),search:p,filter:l})},children:k.matched===0?x.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching log messages."}):x.jsx("ol",{"aria-label":"Received logs",className:"relative",style:{height:k.matched*qf},children:k.logs.map((L,D)=>x.jsx(YA,{log:L,index:k.offset+D,total:k.matched,onSelect:T},L.id))})})]}),x.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[x.jsx("p",{className:"text-textMuted",children:"Select a row to read its full message."}),!u&&x.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{A.current&&(A.current.scrollTop=0),y({offset:0,search:p,filter:l})},children:"Jump to latest"})]}),O&&x.jsx(FA,{log:O,onClose:()=>{T(null)}})]})}const YA=se.memo(function({log:i,index:a,total:l,onSelect:u}){return x.jsx("li",{"aria-setsize":l,"aria-posinset":a+1,className:"border-accentSecondary/20 absolute inset-x-0 border-b",style:{top:a*qf,height:qf},children:x.jsxs("button",{type:"button",onClick:()=>{u(i)},className:"hover:bg-accentSecondary/10 focus-visible:bg-accentSecondary/20 grid h-full w-full grid-cols-[5.5rem_4.5rem_minmax(0,1fr)] items-center gap-2 px-4 text-left text-xs sm:grid-cols-[7.5rem_7.5rem_minmax(0,1fr)]",children:[x.jsx("time",{dateTime:Qp(i.time),className:"text-textMuted font-mono tabular-nums",children:Uu(i.time,!1)}),x.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${Yb[i.level]??Yb[8]}`,children:rS(i.level).name}),x.jsx("span",{className:"text-textPrimary min-w-0 truncate font-mono",children:i.message.replaceAll(` -`," ↵ ")})]})})});function FA({log:n,onClose:i}){const a=se.useRef(null);return se.useEffect(()=>{const l=a.current;return l?.showModal(),()=>{l?.close()}},[]),x.jsxs("dialog",{ref:a,onClose:i,"aria-labelledby":"log-detail-title",className:"border-accent/30 bg-surface/95 text-textPrimary fixed inset-0 m-auto max-h-[80vh] w-[min(60rem,90vw)] rounded-2xl border p-5 shadow-xl backdrop:bg-black/60",children:[x.jsxs("header",{className:"mb-4 flex items-center justify-between gap-4",children:[x.jsxs("h3",{id:"log-detail-title",className:"text-accent text-lg font-semibold",children:[rS(n.level).label," · ",Qp(n.time)??"Invalid time"]}),x.jsx("button",{type:"button",onClick:i,className:"text-accent rounded px-3 py-2",children:"Close"})]}),x.jsx("pre",{className:"text-sm break-words whitespace-pre-wrap",children:n.message})]})}const QA="Unknown",JA={bitcoin:{p2kh:{0:"mainnet (1)",111:"test networks (m, n)"},p2sh:{5:"mainnet (3)",196:"test networks (2)"},wif:{128:"mainnet (5, K, L)",239:"test networks (9, c)"},witness:{bc:"mainnet",tb:"testnet and signet",bcrt:"regtest"},silent:{sp:"mainnet",tsp:"testnet and signet",sprt:"regtest"},hdPrivate:{76066276:"mainnet (xprv)",77428856:"mainnet BIP49 (yprv)",78791436:"mainnet BIP84 (zprv)",70615956:"test networks (tprv)",71978536:"test networks BIP49 (uprv)",73341116:"test networks BIP84 (vprv)"},hdPublic:{76067358:"mainnet (xpub)",77429938:"mainnet BIP49 (ypub)",78792518:"mainnet BIP84 (zpub)",70617039:"test networks (tpub)",71979618:"test networks BIP49 (upub)",73342198:"test networks BIP84 (vpub)"}},litecoin:{p2kh:{48:"mainnet (L)",111:"test networks (m, n)"},p2sh:{5:"mainnet deprecated (3)",50:"mainnet (M)",58:"test networks (Q)",196:"test networks deprecated (2)"},wif:{176:"mainnet (6, T)",239:"test networks (9, c)"},witness:{ltc:"mainnet",tltc:"testnet",rltc:"regtest"},silent:{},hdPrivate:{76066276:"mainnet (xprv)",27106558:"mainnet (Ltpv)",28469138:"mainnet BIP49 (Mtpv)",70615956:"test networks (tprv)",70709117:"test networks (ttpv)"},hdPublic:{76067358:"mainnet (xpub)",27108450:"mainnet (Ltub)",28471030:"mainnet BIP49 (Mtub)",70617039:"test networks (tpub)",70711009:"test networks (ttub)"}}};function aS(n){return n.includes("ltc_scrypt_proof_of_work")?"litecoin":"bitcoin"}function Ia(n,i,a){return JA[n][i][String(a)]??QA}function op(){return globalThis.window?.location.origin??"http://localhost"}function Vf(n){const i=n.trim();if(!i)throw new Error("Endpoint URL is required");const a=/^[a-z][a-z\d+\-.]*:\/\//iu.test(i)?i:`http://${i}`,l=new URL(a);if(l.protocol!=="http:"&&l.protocol!=="https:")throw new Error("Endpoint must use HTTP or HTTPS"))DELIM" -R"DELIM(;return l.pathname=l.pathname.replace(/\/+$/u,"")||"/",l.search="",l.hash="",l.toString().replace(/\/$/u,"")}function XA(n){const i=new URL(Vf(n));return i.protocol=i.protocol==="https:"?"wss:":"ws:",i.pathname="/",i.search="",i.hash="",i.toString()}function WA(n,i=op()){return new URL(Vf(n)).origin===new URL(i).origin}function e3(){try{globalThis.localStorage.removeItem("libbitcoinAdminDashboardEndpoints")}catch{}return{adminUrl:Vf(op()),nativeUrl:Vf(op())}}const t3=In({store:In({address:Dn(),filter:Dn(),silent:hn().int().nonnegative().nullable(),turbo:Dn(),pruned:hn().int().nonnegative()}),node:In({network:Pn(),limited:Dn().optional(),blocks:Dn().optional(),witness:Dn().optional(),filters:Dn().optional(),privacy:Dn().optional()}),wallet:In({p2kh:hn().int(),p2sh:hn().int(),wif:hn().int(),witness:Pn(),silent:Pn(),hd_private:hn().int(),hd_public:hn().int()}).optional(),network:In({relay:Dn(),alert:Dn(),reject:Dn(),compact:Dn(),address:Dn(),witness_tx:Dn(),memory_pool:Dn(),not_found:Dn(),protocol_maximum:hn().int(),protocol_minimum:hn().int()}).optional(),forks:dA(Pn(),Dn()).transform(n=>Object.keys(n).filter(i=>n[i]))}),lS=Pn().regex(/^[0-9a-f]{64}$/u),n3=In({hash:lS,height:hn().int().nonnegative(),timestamp:hn().int().positive().max(4294967295)}),Fb=In({hash:lS,height:hn().int().nonnegative()}),i3=In({confirmed:Fb,candidate:Fb}),bf=hn().int().nonnegative().max(Number.MAX_SAFE_INTEGER),r3=In({count:bf,virtual:bf,fee:bf,histogram:Wf(fA([hn().nonnegative(),bf]))}),s3="/v1/fees?format=json",a3=5e3,Zu=15e3;function Af(n,i){return new URL(i,`${n.replace(/\/+$/u,"")}/`).toString()}async function Mf(n,i){const a=await fetch(n,{headers:{Accept:"application/json"},signal:i});if(!a.ok)throw new Error(`Native API request failed with status ${String(a.status)}`);return await a.json()}async function l3(n,i){const[a,l]=await Promise.all([Mf(Af(n,"/v1/configuration?format=json"),i),Mf(Af(n,"/v1/top?format=json"),i)]),u=t3.parse(a),f=i3.parse(l),d=Date.now();let m=null;if(f.candidate.height>f.confirmed.height)try{const p=o3(f.confirmed.height),g=n3.parse(await Mf(Af(n,p),i));g.height===f.confirmed.height&&(m=g)}catch{i?.throwIfAborted()}return{configuration:u,tops:f,branch:m,receivedAt:d}}function o3(n){return`/v1/block/height/${String(n)}/header?format=json&candidate=true`}async function u3(n,i){return{data:r3.parse(await Mf(Af(n,s3),i)),receivedAt:Date.now()}}const Bm=["line","area","bar"],Qb=["line","step","area"],c3=["line","step","area"],oS={"occurrence-count":{id:"occurrence-count",label:"Occurrences per bucket",description:"Number of frames observed in each one-second bucket.",unit:"occurrences",chartTypes:Bm},"occurrence-rate":{id:"occurrence-rate",label:"Occurrence rate",description:"Frames observed per second.",unit:"occurrences-per-second",chartTypes:Bm},"cumulative-occurrences":{id:"cumulative-occurrences",label:"Cumulative occurrences",description:"Running number of frames observed during this browser session.",unit:"occurrences",chartTypes:Qb},"payload-latest":{id:"payload-latest",label:"Latest value",description:"Most recently observed payload value.",unit:"count",chartTypes:c3},"payload-average":{id:"payload-average",label:"Average value",description:"Average payload value within each one-second bucket.",unit:"count",chartTypes:["line","area","bar"]},"payload-minimum":{id:"payload-minimum",label:"Minimum value",description:"Minimum payload value within each one-second bucket.",unit:"count",chartTypes:["line","step"]},"payload-maximum":{id:"payload-maximum",label:"Maximum value",description:"Maximum payload value within each one-second bucket.",unit:"count",chartTypes:["line","step"]},"payload-sum":{id:"payload-sum",label:"Value per bucket",description:"Sum of count payloads within each one-second bucket.",unit:"count",chartTypes:["line","area","bar"]},"payload-cumulative":{id:"payload-cumulative",label:"Cumulative value",description:"Running sum of count payloads during this browser session.",unit:"count",chartTypes:Qb},"payload-change-rate":{id:"payload-change-rate",label:"Height change rate",description:"Change in the latest observed height per second.",unit:"height-per-second",chartTypes:Bm}},el=["occurrence-rate","occurrence-count","cumulative-occurrences"],f3=["payload-latest","payload-maximum","payload-change-rate",...el],d3=["payload-average","payload-latest","payload-minimum","payload-maximum",...el],h3=["payload-sum","payload-cumulative","payload-latest","payload-average",...el],uS=["payload-latest","payload-average","payload-minimum","payload-maximum"],cS=[{field:"count",id:"pool:count",label:"Pool transactions",payloadKind:"transactions",description:"Current confirmable transaction count in the pool."},{field:"virtual",id:"pool:vsize",label:"Pool virtual size",payloadKind:"vbytes",description:"Total virtual size of the current pool, in vbytes."},{field:"fee",id:"pool:total_fee",label:"Pool total fees",payloadKind:"satoshis",description:"Total fees of the current pool, in satoshis."}];function Ui(n){return`event:${String(n)}`}function Gs(n){return`log:${String(n)}`}const If="native:top";function m3(n){switch(n){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";case"fee-rate":return"fee-rate";default:return"unknown"}}function p3(n){switch(n){case"height":return f3;case"duration":return d3;case"count":return h3;case"fee-rate":return[...uS,...el];default:return el}}function g3(n){switch(n){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function fS(n){const i=mo(n),a=m3(i.valueKind);return{id:Ui(n),source:"event",sourceId:n,name:i.name,label:i.label,category:i.category,payloadKind:a,allowedMeasures:p3(a),defaultMeasure:g3(a),description:n===10?"Newly archived transactions, including compact-block recovery. Occurrences measure archival, not all received transactions. Fee rate is normalized to sat/vB.":a==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${i.label} event with a ${a} payload.`}}const v3=[...cS.map(n=>({id:n.id,source:"pool",sourceId:n.field,name:n.field,label:n.label,category:"pool",payloadKind:n.payloadKind,allowedMeasures:uS,defaultMeasure:"payload-latest",description:n.description})),...Hf.map(n=>fS(n.id)),...Bu.map(n=>({id:Gs(n.id),source:"log",sourceId:n.id,name:n.name,label:`${n.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:el,defaultMeasure:"occurrence-rate",description:`${n.label} log message volume. Message text is not interpreted as numeric data.`})),{id:If,source:"native",sourceId:"top",name:"canonical_top",label:"Current top",category:"native",payloadKind:"height",allowedMeasures:["payload-latest","payload-maximum","payload-change-rate"],defaultMeasure:"payload-latest",description:"Canonical chain height reported by the native interface."}],Jp=v3,y3=new Map(Jp.map(n=>[n.id,n]));function cs(n){const i=y3.get(n);if(i)return i;const a=/^event:(\d+)$/u.exec(n);return a?fS(Number(a[1])):{id:n,source:"event",sourceId:-1,name:n,label:n,category:"unknown",payloadKind:"unknown",allowedMeasures:el,defaultMeasure:"occurrence-rate",description:"Unknown signal; only occurrence measurements are available."}}function Fs(n,i){const a=oS[i];if(i.startsWith("occurrence")||i==="cumulative-occurrences")return a;const l=i==="payload-change-rate"?"height-per-second":n.payloadKind==="height"?"height":n.payloadKind==="duration"?"milliseconds":n.payloadKind==="fee-rate"?"sat-per-vbyte":n.payloadKind==="transactions"||n.payloadKind==="vbytes"||n.payloadKind==="satoshis"?n.payloadKind:"count";return{...a,unit:l}}function b3(n,i){return n.allowedMeasures.includes(i)}function _3(n,i){return mo(n).valueKind==="fee-rate"?i/1e3:LA(n,i)??i}const S3=3600*1e3,x3=1e3,w3=1e3,z3=1e3;class Jb{constructor(i){this.capacity=i,this.#e=Array.from({length:i})}capacity;#e;#t=0;#n=0;#i=null;get size(){return this.#n}push(i){const a=this.#n===this.capacity)DELIM" -R"DELIM(;return this.#i=null,this.#e[this.#t]=i,this.#t=(this.#t+1)%this.capacity,this.#n=Math.min(this.#n+1,this.capacity),a}clear(){this.#i=null,this.#e.fill(void 0),this.#t=0,this.#n=0}newestFirst(){if(this.#i)return this.#i;const i=[];for(let a=0;athis.#k;getRecentLogs=()=>this.#i.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=i=>(this.#n.add(i),()=>{this.#n.delete(i)});start(){this.#O||(this.tick(),this.#O=setInterval(()=>{this.tick()},1e3))}stop(){this.#O&&(clearInterval(this.#O),this.#O=null),this.#d&&(clearTimeout(this.#d),this.#d=null)}ingest(i,a=this.#e()){const l=this.#N(a);this.#_+=1,UA(i)?this.#U(i,l):ZA(i)?this.#j(i,l):$A(i)&&(this.#v+=1),this.#C()}recordInvalidFrame(){this.#w+=1,this.#C()}recordNativeTop(i,a=this.#e()){const l=this.#N(a),u=this.#a[If];u?.value===i&&l-u.time<15e3||(this.#R(If,l,i),this.#D(l),this.#C())}recordNativeFees(i,a=this.#e()){if(!Number.isFinite(a)||a=Zu||this.#M!==null&&a<=this.#M.receivedAt)return;const l=this.#N(a);this.#M={data:i,receivedAt:a};for(const u of cS)this.#R(u.id,l,i[u.field]);this.#D(l),this.#C()}clearLogs(){this.#E+=this.#i.size,this.#i.clear(),this.flush()}clearEvents(){this.#s.clear(),this.flush()}reset(){this.#i.clear(),this.#s.clear(),this.#r.clear(),this.#l={},this.#f={},this.#u={},this.#o={},this.#b={},this.#a={},this.#g={},this.#c=this.#N(this.#e()),this.#_=0,this.#m=0,this.#S=0,this.#E=0,this.#x=0,this.#v=0,this.#w=0,this.#p=null,this.#A=null,this.#M=null,this.#T=0,this.#z(this.#c),this.flush()}tick(){const i=this.#N(this.#e());this.#z(i),this.#D(i),this.#C()}flush(){this.#d&&(clearTimeout(this.#d),this.#d=null),this.#k=this.#Z();for(const i of this.#n)i()}#U(i,a){this.#m+=1,this.#p=a,this.#T+=1,this.#i.push({...i,id:this.#T,receivedAt:a})&&(this.#S+=1),this.#R(Gs(i.level),a,null)}#j(i,a){this.#x+=1,this.#A=a,this.#T+=1,this.#s.push({...i,id:this.#T,receivedAt:a}),this.#R(Ui(i.event),a,_3(i.event,i.value))}#N(i){return Number.isFinite(i)?(this.#h=Math.max(this.#h,i),this.#h):this.#h}#R(i,a,l){const u=this.#z(a);u.snapshot=null;const f=u.signals.get(i)??T3();if(f.count+=1,_f(this.#o,i,1),l!==null){f.samples+=1,f.sum+=l,f.minimum=f.minimum===null?l:Math.min(f.minimum,l),f.maximum=f.maximum===null?l:Math.max(f.maximum,l),(f.firstAt===null||a=f.lastAt)&&(f.last=l,f.lastAt=a),_f(this.#b,i,l);const d=this.#a[i];(!d||a>=d.time)&&(this.#a[i]={value:l,time:a}),this.#g[i]=Math.max(this.#g[i]??l,l)}u.signals.set(i,f)}#z(i){const a=Math.floor(i/1e3)*1e3,l=this.#r.get(a);if(l)return l;const u={time:a,signals:new Map,snapshot:null};return this.#r.set(a,u),u}#D(i){const a=i-S3;for(const[l,u]of this.#r){if(l>=a)break;for(const[f,d]of u.signals)if(_f(this.#l,f,d.count),_f(this.#f,f,d.sum),d.last!==null&&d.lastAt!==null){const m=this.#u[f];(!m||d.lastAt>=m.time)&&(this.#u[f]={value:d.last,time:d.lastAt})}this.#r.delete(l)}}#C(){!this.#t||this.#d||(this.#d=setTimeout(()=>{this.#d=null,this.flush()},x3))}#Z(){const i=[...this.#r.values()].map(a=>(a.snapshot??={time:a.time,signals:Object.fromEntries([...a.signals].map(([l,u])=>[l,{...u}]))},a.snapshot));return{now:this.#N(this.#e()),sessionStartedAt:this.#c,totalFrames:this.#_,totalLogs:this.#m,evictedLogs:this.#S,clearedLogs:this.#E,totalEvents:this.#x,totalAcks:this.#v,invalidFrames:this.#w,buckets:i,priorSignalCounts:{...this.#l},priorSignalSums:{...this.#f},priorSignalLatest:Xb(this.#u),signalTotals:{...this.#o},signalSums:{...this.#b},signalLatest:Xb(this.#a),signalMaximums:{...this.#g},recentLogs:this.#i.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#p,lastEventAt:this.#A,poolSnapshot:this.#M}}}function E3(n,i,a,l,u=n[0]?.time??a){const f=a-l*1e3,d=f<=u,m=d?Math.floor(u/1e3)*1e3:Math.ceil(f/1e3)*1e3,p=d?u:m,g=Math.floor(a/1e3)*1e3,y=n.filter(O=>O.time>=m&&O.time<=g).reduce((O,T)=>O+(T.signals[i]?.count??0),0),w=Math.max(0,(a-p)/1e3);return w>0?y/w:0}function O3(n,i){const a=d=>E3(n.buckets,Ui(d),n.now,i,n.sessionStartedAt),l=a(2)+a(14);if(l>0)return{label:"Reorganizing",rate:l};const f=[{label:"Confirming blocks",rate:a(6)},{label:"Validating blocks",rate:a(5)},{label:"Archiving blocks",rate:a(3)},{label:"Synchronizing headers",rate:Math.max(a(0),a(1))}].reduce((d,m)=>m.rate>d.rate?m:d);return f.rate>0?f:{label:"Idle",rate:0}}const td=18;function N3(n,i){if(n===null)return null;const{confirmed:a,candidate:l}=n;return{confirmed:a,candidate:l,blocksRemaining:Math.max(0,l.height-a.height),progress:l.height===0?100:Math.min(100,a.height/l.height*100),diverged:A3(a,l,i)}}function A3(n,i,a){return i.height({...a,id:i?Mu("series"):a.id}))}:{...n,id:i?Mu("chart"):n.id}}function jf(){return[Xp,mS,pS,id,gS,vS,yS].map(n=>Wp(n))}function Z3(n){const i=bS.find(a=>a.id===n);return Wp(i?.chart??Xp,!0)}function SS(){return{id:Mu("chart"),title:"Custom chart",visualization:"line",scale:"linear",range:900,series:[{id:Mu("series"),signalId:Ui(3),measure:"occurrence-rate",color:Rt[0]}]}}function $3(n){const i=" copy",a=`${n.title.slice(0,nd-i.length).trimEnd()}${i}`;return{...Wp(n,!0),title:a}}function fp(n){if(!ln(n))return"vbytes";const i=new Set(n.series.map(a=>Fs(cs(a.signalId),a.measure).unit));return i.size===1?[...i][0]??null:null}function xS(n){const i=hS.safeParse(n);if(!i.success)return i.error.issues[0]?.message??"Invalid chart configuration";if(!ln(n))return null;for(const a of n.series){const l=cs(a.signalId);if(!b3(l,a.measure))return`${oS[a.measure].label} is not valid for ${l.label}.`;const u=Fs(l,a.measure);if(!u.chartTypes.includes(n.visualization))return`${u.label} cannot be displayed as a ${n.visualization} chart.`}return fp(n)===null?"All series on a chart must use compatible units.":null}function wS(n){const i=U3.safeParse(n);return!i.success||new Set(i.data.charts.map(a=>a.id)).size!==i.data.charts.length||i.data.charts.some(a=>ln(a)&&new Set(a.series.map(l=>l.id)).size!==a.series.length)?null:i.data.charts.every(a=>xS(a)===null)?i.data.charts:null}function zS(){try{return globalThis.window?.localStorage??null}catch{return null}}function L3(n=zS()){try{const i=n?.getItem(_S);return i?wS(JSON.parse(i))??jf():jf()}catch{return jf()}}function H3(n,i=zS()){try{const a={version:1,charts:n};if(!wS(a))return;i?.setItem(_S,JSON.stringify(a))}catch{}}function eg(n,i){return n.signals[i]}function n_(n,i,a,l){let u=l==="count"?n.priorSignalCounts[i]??0:n.priorSignalSums[i]??0;for(const f of n.buckets){if(f.time>=a)break;const d=eg(f,i);u+=l==="count"?d?.count??0:d?.sum??0}return u}function B3(n,i,a){let l=n.priorSignalLatest[i]??null;for(const u of n.buckets){if(u.time>=a)break;const f=eg(u,i);f?.last!==null&&f?.last!==void 0&&f.lastAt!==null&&(l={value:f.last,time:f.lastAt})}return l}function q3(n,i){const a=i<=n.sessionStartedAt?Math.floor(n.sessionStartedAt/1e3)*1e3:Math.ceil(i/1e3)*1e3,l=Math.floor(n.now/1e3)*1e3,u=new Map(n.buckets.map(d=>[d.time,d])),f=[];for(let d=a;d<=l;d+=1e3)f.push(u.get(d)??{time:d,signals:{}});return f}function V3(n,i,a){const l=Math.max(n.time,a),u=Math.min(i,n.time+1e3);return Math.max(0,(u-l)/1e3)}function I3(n,i,a,l){const u=cs(l.signalId);let f=l.measure==="cumulative-occurrences"?n_(n,l.signalId,a,"count"):l.measure==="payload-cumulative"?n_(n,l.signalId,a,"sum"):0,d=B3(n,l.signalId,a);return i.map(m=>{const p=eg(m,l.signalId);switch(l.measure){case"occurrence-count":return p?.count??0;case"occurrence-rate":{const g=V3(m,n.now,n.sessionStartedAt);return g>0?(p?.count??0)/g:0}case"cumulative-occurrences":return f+=p?.count??0,f;case"payload-sum":return p&&p.samples>0?p.sum:null;case"payload-cumulative":return f+=p?.sum??0,f;case"payload-average":return p&&p.samples>0?p.sum/p.samples:null;case"payload-minimum":return p?.minimum??null;case"payload-maximum":return p?.maximum??null;case"payload-latest":{if(p?.last!==null&&p?.last!==void 0&&p.lastAt!==null)return d={value:p.last,time:p.lastAt},p.last;if(u.source==="pool"){const g=Math.min(m.time+1e3,n.now);return d&&g-d.time0?(p.last-g.value)/b:null}}})}function P3(n,i){const a=n.now-i.range*1e3,l=q3(n,a),u=l[0]?.time??Math.floor(n.now/1e3)*1e3,f=i.series[0],d=Fs(cs(f.signalId),f.measure).unit,m=i.series.filter(p=>(n.signalTotals[p.signalId]??0)===0).map(p=>p.label??cs(p.signalId).label);return{data:[l.map(p=>p.time/1e3),...i.series.map(p=>I3(n,l,u,p))],unit:d,hasObservedData:m.length{const a=()=>{i(Date.now())},l=setInterval(a,1e3);return window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),()=>{clearInterval(l),window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a)}},[]),n}const Y3={300:"5 minutes",900:"15 minutes",3600:"1 hour"},F3={line:"Line",step:"Step",area:"Area",bar:"Bar"};function Q3(n){return ln(n)?{...n,series:n.series.map(i=>({...i}))}:{...n}}function J3(){const n=new Map;for(const i of Jp){const a=n.get(i.category)??[];a.push(i),n.set(i.category,a)}return[...n]}const X3=J3();function W3({chart:n,mode:i,onCancel:a,onSave:l}){const[u,f]=se.useState(()=>Q3(n)),d=xS(u),m=fp(u);se.useEffect(()=>{function T(A){A.key==="Escape"&&a()}return globalThis.addEventListener("keydown",T),()=>{globalThis.removeEventListener("keydown",T)}},[a]);const p=se.useMemo(()=>new Set(cp.filter(T=>ln(u)&&u.series.every(A=>Fs(cs(A.signalId),A.measure).chartTypes.includes(T)))),[u]);function g(T){f(A=>ln(A)?T(A):A)}function b(T,A){g(k=>({...k,series:k.series.map((L,D)=>D===T?A:L)}))}function y(T,A){if(!ln(u))return;const k=u.series[T],L=cs(A);b(T,{...k,signalId:A,measure:L.defaultMeasure})}function w(){if(!ln(u)||u.series.length>=up)return;const T=fp(u),A=Jp.find(D=>D.allowedMeasures.some(X=>T===null||Fs(D,X).unit===T));if(!A)return;const k=A.allowedMeasures.find(D=>T===null||Fs(A,D).unit===T)??A.defaultMeasure,L={id:`series-${Date.now().toString(36)}-${String(u.series.length+1)}`,signalId:A.id,measure:k,color:Rt[u.series.length%Rt.length]??Rt[0]};g(D=>({...D,series:[...D.series,L]}))}function O(T){T.preventDefault(),!d&&l({...u,title:u.title.trim()})}return x.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:T=>{T.target===T.currentTarget&&a()},children:x.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"chart-editor-title",className:"border-accent/30 bg-surface/95 max-h-[92vh] w-full max-w-4xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/60",children:[x.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Dashboard builder"}),x.jsx("h2",{id:"chart-editor-title",className:"text-accent mt-1 text-xl font-semibold",children:i==="add"?"Add chart":"Edit chart"})]}),x.jsx("button",{type:"button",onClick:a,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close chart editor",children:"×"})]}),i==="add"&&x.jsxs("div",{className:"border-accentSecondary/20 border-b p-5",children:[x.jsx("p",{className:"text-accentSecondary mb-3 text-xs tracking-wide uppercase",children:"Start from a template"}),x.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-5",children:[bS.map(T=>x.jsxs("button",{type:"button",onClick:()=>{f(Z3(T.id))},className:"border-accent/30 bg-background hover:border-accent rounded-md border p-3 text-left",children:[x.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:T.label}),x.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:T.description})]},T.id)),x.jsxs("button",{type:"button",onClick:()=>{f(SS())},className:"border-accent/30 bg-background hover:border-accent rounded-md border p-3 text-left",children:[x.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:"Custom"}),x.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:"Begin with one editable series."})]})]})]}),x.jsxs("form",{onSubmit:O,className:"space-y-6 p-5",children:[x.jsxs("div",{className:"grid gap-4 md:grid-cols-[minmax(0,1fr)_11rem_11rem]",children:[x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Chart title"}),x.jsx("input",{value:u.title,maxLength:nd,onChange:T=>{f(A=>({...A,title:T.target.value}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),ln(u)?x.jsxs(x.Fragment,{children:[x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Chart type"}),x.jsx("select",{value:u.visualization,onChange:T=>{g(A=>({...A,visualization:T.target.value}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0",children:cp.map(T=>x.jsx("option",{value:T,disabled:!p.has(T),children:F3[T]},T))})]}),x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Time range"}),x.jsx("select",{value:u.range,onChange:T=>{g(A=>({...A,range:Number(T.target.value)}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0",children:j3.map(T=>x.jsx("option",{value:T,children:Y3[T]},T))})]})]}):x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Bar color"}),x.jsx("input",{type:"color",value:u.color,onChange:T=>{const A=T.target.value;f(k=>ln(k)?k:{...k,color:A})},className:"border-accent/40 bg-background h-10 w-full rounded-md border p-1"})]})]}),ln(u)?x.jsxs("section",{className:"space-y-3",children:[x.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[x.jsxs("div",{children:[x.jsx("h3",{className:"text-accent text-lg font-semibold",children:"Series"}),x.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:["One chart uses one axis unit",m===null?".":`: ${TS(m)}.`]})]}),x.jsx("button",{type:"button",onClick:w,disabled:u.series.length>=up,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary disabled:text-textMuted rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-50",children:"Add series"})]}),x.jsx("div",{className:"space-y-3",children:u.series.map((T,A)=>{const k=cs(T.signalId),L=Fs(k,T.measure);return x.jsxs("article",{className:"border-accentSecondary/20 bg-accent/5 grid gap-3 rounded-xl border p-4 lg:grid-cols-[minmax(12rem,1.2fr)_minmax(11rem,1fr)_minmax(9rem,0.8fr)_3.5rem_auto]",children:[x.jsxs("label",{className:"space-y-1.5",children:[x.jsxs("span",{className:"text-textMuted text-xs",children:["Signal ",String(A+1)]}),x.jsx("select",{"aria-label":`Signal ${String(A+1)}`,value:T.signalId,onChange:D=>{y(A,D.target.value)},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-2 py-2 text-sm focus:ring-0",children:X3.map(([D,X])=>x.jsx("optgroup",{label:D,children:X.map(G=>x.jsx("option",{value:G.id,children:G.lab)DELIM" -R"DELIM(el},G.id))},D))})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Measurement"}),x.jsx("select",{"aria-label":`Measurement ${String(A+1)}`,value:T.measure,onChange:D=>{b(A,{...T,measure:D.target.value})},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-2 py-2 text-sm focus:ring-0",title:L.description,children:k.allowedMeasures.map(D=>x.jsx("option",{value:D,children:Fs(k,D).label},D))})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Display label"}),x.jsx("input",{"aria-label":`Display label ${String(A+1)}`,value:T.label??"",onChange:D=>{b(A,{...T,label:D.target.value||void 0})},placeholder:k.label,className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/50 focus:border-accent w-full rounded-md border px-2 py-2 text-sm focus:ring-0"})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Color"}),x.jsx("input",{"aria-label":`Series color ${String(A+1)}`,type:"color",value:T.color,onChange:D=>{b(A,{...T,color:D.target.value})},className:"border-accent/40 bg-background h-10 w-full rounded-md border p-1"})]}),x.jsx("button",{type:"button",onClick:()=>{g(D=>({...D,series:D.series.filter((X,G)=>G!==A)}))},disabled:u.series.length===1,"aria-label":`Remove series ${String(A+1)}`,className:"text-textMuted self-end rounded-md px-3 py-2 text-sm hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-30",children:"Remove"})]},T.id)})})]}):x.jsx("p",{className:"text-textMuted text-sm",children:"Shows the latest transaction-pool fee distribution, refreshed every five seconds. Each bar shows the virtual size of one fee-rate group, labeled by its minimum fee rate in sat/vB."}),d&&x.jsx("p",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-200",children:d}),x.jsxs("div",{className:"border-accentSecondary/20 flex justify-end gap-2 border-t pt-4",children:[x.jsx("button",{type:"button",onClick:a,className:"text-textMuted hover:text-accent rounded-md px-4 py-2 text-sm",children:"Cancel"}),x.jsx("button",{type:"submit",disabled:d!==null,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-40",children:i==="add"?"Add chart":"Save changes"})]})]})]})})}const eM=!0,gn="u-",tM="uplot",nM=gn+"hz",iM=gn+"vt",rM=gn+"title",sM=gn+"wrap",aM=gn+"under",lM=gn+"over",oM=gn+"axis",Ya=gn+"off",uM=gn+"select",cM=gn+"cursor-x",fM=gn+"cursor-y",dM=gn+"cursor-pt",hM=gn+"legend",mM=gn+"live",pM=gn+"inline",gM=gn+"series",vM=gn+"marker",i_=gn+"label",yM=gn+"value",zu="width",Tu="height",yu="top",r_="bottom",Xl="left",Vm="right",tg="#000",s_=tg+"0",Im="mousemove",a_="mousedown",Pm="mouseup",l_="mouseenter",o_="mouseleave",u_="dblclick",bM="resize",_M="scroll",c_="change",Pf="dppxchange",ng="--",po=typeof window<"u",dp=po?document:null,no=po?window:null,SM=po?navigator:null;let rt,xf;function hp(){let n=devicePixelRatio;rt!=n&&(rt=n,xf&&pp(c_,xf,hp),xf=matchMedia(`(min-resolution: ${rt-.001}dppx) and (max-resolution: ${rt+.001}dppx)`),Xa(c_,xf,hp),no.dispatchEvent(new CustomEvent(Pf)))}function Ci(n,i){if(i!=null){let a=n.classList;!a.contains(i)&&a.add(i)}}function mp(n,i){let a=n.classList;a.contains(i)&&a.remove(i)}function Et(n,i,a){n.style[i]=a+"px"}function vr(n,i,a,l){let u=dp.createElement(n);return i!=null&&Ci(u,i),a?.insertBefore(u,l),u}function Ji(n,i){return vr("div",n,i)}const f_=new WeakMap;function Lr(n,i,a,l,u){let f="translate("+i+"px,"+a+"px)",d=f_.get(n);f!=d&&(n.style.transform=f,f_.set(n,f),i<0||a<0||i>l||a>u?Ci(n,Ya):mp(n,Ya))}const d_=new WeakMap;function h_(n,i,a){let l=i+a,u=d_.get(n);l!=u&&(d_.set(n,l),n.style.background=i,n.style.borderColor=a)}const m_=new WeakMap;function p_(n,i,a,l){let u=i+""+a,f=m_.get(n);u!=f&&(m_.set(n,u),n.style.height=a+"px",n.style.width=i+"px",n.style.marginLeft=l?-i/2+"px":0,n.style.marginTop=l?-a/2+"px":0)}const ig={passive:!0},xM={...ig,capture:!0};function Xa(n,i,a,l){i.addEventListener(n,a,l?xM:ig)}function pp(n,i,a,l){i.removeEventListener(n,a,ig)}po&&hp();function yr(n,i,a,l){let u;a=a||0,l=l||i.length-1;let f=l<=2147483647;for(;l-a>1;)u=f?a+l>>1:Zi((a+l)/2),i[u]{let f=-1,d=-1;for(let m=l;m<=u;m++)if(n(a[m])){f=m;break}for(let m=u;m>=l;m--)if(n(a[m])){d=m;break}return[f,d]}}const NS=n=>n!=null,AS=n=>n!=null&&n>0,rd=OS(NS),wM=OS(AS);function zM(n,i,a,l=0,u=!1){let f=u?wM:rd,d=u?AS:NS;[i,a]=f(n,i,a);let m=n[i],p=n[i];if(i>-1)if(l==1)m=n[i],p=n[a];else if(l==-1)m=n[a],p=n[i];else for(let g=i;g<=a;g++){let b=n[g];d(b)&&(bp&&(p=b))}return[m??_t,p??-_t]}function sd(n,i,a,l){let u=y_(n),f=y_(i);n==i&&(u==-1?(n*=a,i/=a):(n/=a,i*=a));let d=a==10?fs:MS,m=u==1?Zi:Xi,p=f==1?Xi:Zi,g=m(d(mn(n))),b=p(d(mn(i))),y=lo(a,g),w=lo(a,b);return a==10&&(g<0&&(y=St(y,-g)),b<0&&(w=St(w,-b))),l||a==2?(n=y*u,i=w*f):(n=CS(n,y),i=ad(i,w)),[n,i]}function rg(n,i,a,l){let u=sd(n,i,a,l);return n==0&&(u[0]=0),i==0&&(u[1]=0),u}const sg=.1,g_={mode:3,pad:sg},ju={pad:0,soft:null,mode:0},TM={min:ju,max:ju};function Kf(n,i,a,l){return ld(a)?v_(n,i,a):(ju.pad=a,ju.soft=l?0:null,ju.mode=l?3:0,v_(n,i,TM))}function et(n,i){return n??i}function EM(n,i,a){for(i=et(i,0),a=et(a,n.length-1);i<=a;){if(n[i]!=null)return!0;i++}return!1}function v_(n,i,a){let l=a.min,u=a.max,f=et(l.pad,0),d=et(u.pad,0),m=et(l.hard,-_t),p=et(u.hard,_t),g=et(l.soft,_t),b=et(u.soft,-_t),y=et(l.mode,0),w=et(u.mode,0),O=i-n,T=fs(O),A=ai(mn(n),mn(i)),k=fs(A),L=mn(k-T);(O<1e-24||L>10)&&(O=0,(n==0||i==0)&&(O=1e-24,y==2&&g!=_t&&(f=0),w==2&&b!=-_t&&(d=0)));let D=O||A||1e3,X=fs(D),G=lo(10,Zi(X)),ee=D*(O==0?n==0?.1:1:f),V=St(CS(n-ee,G/10),24),ne=n>=g&&(y==1||y==3&&V<=g||y==2&&V>=g)?g:_t,ae=ai(m,V=ne?ne:br(ne,V)),ye=D*(O==0?i==0?.1:1:d),ue=St(ad(i+ye,G/10),24),J=i<=b&&(w==1||w==3&&ue>=b||w==2&&ue<=b)?b:-_t,we=br(p,ue>J&&i<=J?J:ai(J,ue));return ae==we&&ae==0&&(we=100),[ae,we]}const OM=new Intl.NumberFormat(po?SM.language:"en-US"),ag=n=>OM.format(n),$i=Math,kf=$i.PI,mn=$i.abs,Zi=$i.floor,dn=$i.round,Xi=$i.ceil,br=$i.min,ai=$i.max,lo=$i.pow,y_=$i.sign,fs=$i.log10,MS=$i.log2,NM=(n,i=1)=>$i.sinh(n)*i,Km=(n,i=1)=>$i.asinh(n/i),_t=1/0;function b_(n){return(fs((n^n>>31)-(n>>31))|0)+1}function gp(n,i,a){return br(ai(n,i),a)}function jS(n){return typeof n=="function"}function Qe(n){return jS(n)?n:()=>n}const AM=()=>{},kS=n=>n,RS=(n,i)=>i,MM=n=>null,__=n=>!0,S_=(n,i)=>n==i,jM=/\.\d*?(?=9{6,}|0{6,})/gm,tl=n=>{if(US(n)||ea.has(n))return n;const i=`${n}`,a=i.match(jM);if(a==null)return n;let l=a[0].length-1;if(i.indexOf("e-")!=-1){let[u,f]=i.split("e");return+`${tl(u)}e${f}`}return St(n,l)};function Ka(n,i){return tl(St(tl(n/i))*i)}function ad(n,i){return tl(Xi(tl(n/i))*i)}function CS(n,i){return tl(Zi(tl(n/i))*i)}function St(n,i=0){if(US(n))return n;let a=10**i,l=n*a*(1+Number.EPSILON);return dn(l)/a}const ea=new Map;function DS(n){return((""+n).split(".")[1]||"").length}function $u(n,i,a,l){let u=[],f=l.map(DS);for(let d=i;d=0?0:m)+(d>=f[g]?0:f[g]),w=n==10?b:St(b,y);u.push(w),ea.set(w,y)}}return u}const ku={},lg=[],oo=[null,null],Ys=Array.isArray,US=Number.isInteger,kM=n=>n===void 0;function x_(n){return typeof n=="string"}function ld(n){let i=!1;if(n!=null){let a=n.constructor;i=a==null||a==Object}return i}function RM(n){return n!=null&&typeof n=="object"}const CM=Object.getPrototypeOf(Uint8Array),ZS="__proto__";function uo(n,i=ld){let a;if(Ys(n)){let l=n.find(u=>u!=null);if(Ys(l)||i(l)){a=Array(n.length);for(let u=0;uf){for(u=d-1;u>=0&&n[u]==null;)n[u--]=null;for(u=d+1;ud-m)],u=l[0].length,f=new Map;for(let d=0;d"u"?n=>Promise.resolve().then(n):queueMicrotask;function BM(n){let i=n[0],a=i.length,l=Array(a);for(let f=0;fi[f]-i[d]);let u=[];for(let f=0;f=l&&n[u]==null;)u--;if(u<=l)return!0;const f=ai(1,Zi((u-l+1)/i));for(let d=n[l],m=l+f;m<=u;m+=f){const p=n[m];if(p!=null){if(p<=d)return!1;d=p}}return!0}const $S=["January","February","March","April","May","June","July","August","September","October","November","December"],LS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function HS(n){return n.slice(0,3)}const IM=LS.map(HS),PM=$S.map(HS),KM={MMMM:$S,MMM:PM,WWWW:LS,WWW:IM};function bu(n){return(n<10?"0":"")+n}function GM(n){return(n<10?"00":n<100?"0":"")+n}const YM={YYYY:n=>n.getFullYear(),YY:n=>(n.getFullYear()+"").slice(2),MMMM:(n,i)=>i.MMMM[n.getMonth()],MMM:(n,i)=>i.MMM[n.getMonth()],MM:n=>bu(n.getMonth()+1),M:n=>n.getMonth()+1,DD:n=>bu(n.getDate()),D:n=>n.getDate(),WWWW:(n,i)=>i.WWWW[n.getDay()],WWW:(n,i)=>i.WWW[n.getDay()],HH:n=>bu(n.getHours()),H:n=>n.getHours(),h:n=>{let i=n.getHours();return i==0?12:i>12?i-12:i},AA:n=>n.getHours()>=12?"PM":"AM",aa:n=>n.getHours()>=12?"pm":"am",a:n=>n.getHours()>=12?"p":"a",mm:n=>bu(n.getMinutes()),m:n=>n.getMinutes(),ss:n=>bu(n.getSeconds()),s:n=>n.getSeconds(),fff:n=>GM(n.getMilliseconds())};function og(n,i){i=i||KM;let a=[],l=/\{([a-z]+)\}|[^{]+/gi,u;for(;u=l.exec(n);)a.push(u[0][0]=="{"?YM[u[1]]:u[0]);return f=>{let d="";for(let m=0;mn%1==0,Gf=[1,2,2.5,5],JM=$u(10,-32,0,Gf),qS=$u(10,0,32,Gf),XM=qS.filter(BS),Ga=JM.concat(qS),ug=` -`,VS="{YYYY}",w_=ug+VS,IS="{M}/{D}",Eu=ug+IS,wf=Eu+"/{YY}",PS="{aa}",WM="{h}:{mm}",eo=WM+PS,z_=ug+eo,T_=":{ss}",lt=null;function KS(n){let i=n*1e3,a=i*60,l=a*60,u=l*24,f=u*30,d=u*365,p=(n==1?$u(10,0,3,Gf).filter(BS):$u(10,-3,0,Gf)).concat([i,i*5,i*10,i*15,i*30,a,a*5,a*10,a*15,a*30,l,l*2,l*3,l*4,l*6,l*8,l*12,u,u*2,u*3,u*4,u*5,u*6,u*7,u*8,u*9,u*10,u*15,f,f*2,f*3,f*4,f*6,d,d*2,d*5,d*10,d*25,d*50,d*100]);const g=[[d,VS,lt,lt,lt,lt,lt,lt,1],[u*28,"{MMM}",w_,lt,lt,lt,lt,lt,1],[u,IS,w_,lt,lt,lt,lt,lt,1],[l,"{h}"+PS,wf,lt,Eu,lt,lt,lt,1],[a,eo,wf,lt,Eu,lt,lt,lt,1],[i,T_,wf+" "+eo,lt,Eu+" "+eo,lt,z_,lt,1],[n,T_+".{fff}",wf+" "+eo,lt,Eu+" "+eo,lt,z_,lt,1]];function b(y){return(w,O,T,A,k,L)=>{let D=[],X=k>=d,G=k>=f&&k=u?u:k,ue=Zi(T)-Zi(V),J=ae+ue+ad(V-ae,ye);D.push(J);let we=y(J),he=we.getHours()+we.getMinutes()/a+we.getSeconds()/l,Oe=k/l,fe=w.axes[O]._space,Q=L/fe;for(;J=St(J+k,n==1?0:3),!(J>A);)if(Oe>1){let W=Zi(St(he+Oe,6))%24,Se=y(J).getHours()-W;Se>1&&(Se=-1),J-=Se*l,he=(he+Oe)%24;let Be=D[D.length-1];St((J-Be)/k,3)*Q>=.7&&D.push(J)}else D.push(J)}return D}}return[p,g,b]}const[e4,t4,n4]=KS(1),[i4,r4,s4]=KS(.001);$u(2,-53,53,[1]);function E_(n,i){return n.map(a=>a.map((l,u)=>u==0||u==8||l==null?l:i(u==1||a[8]==0?l:a[1]+l)))}function O_(n,i){return(a,l,u,f,d)=>{let m=i.find(T=>d>=T[0])||i[i.length-1],p,g,b,y,w,O;return l.map(T=>{let A=n(T),k=A.getFullYear(),L=A.getMonth(),D=A.getDate(),X=A.getHours(),G=A.getMinutes(),ee=A.getSeconds(),V=k!=p&&m[2]||L!=g&&m[3]||D!=b&&m[4]||X!=y&&m[5]||G!=w&&m[6]||ee!=O&&m[7]||m[1];return p=k,g=L,b=D,y=X,w=G,O=ee,V(A)})}}function a4(n,i){let a=og(i);return(l,u,f,d,m)=>u.map(p=>a(n(p)))}function Gm(n,i,a){return new Date(n,i,a)}function N_(n,i){return i(n)}const l4="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function A_(n,i){return(a,l,u,f)=>f==null?ng:i(n(l))}function o4(n,i){let a=n.series[i];return a.width?a.stroke(n,i):a.points.width?a.points.stroke(n,i):null}function u4(n,i){return n.series[i].fill(n,i)}const c4={show:!0,live:!0,isolate:!1,mount:AM,markers:{show:!0,width:2,stroke:o4,fill:u4,dash:"solid"},idx:null,idxs:null,values:[]};function f4(n,i){let a=n.cursor.points,l=Ji(),u=a.size(n,i);Et(l,zu,u),Et(l,Tu,u);let f=u/-2;Et(l,"marginLeft",f),Et(l,"marginTop",f);let d=a.width(n,i,u);return d&&Et(l,"borderWidth",d),l}function d4(n,i){let a=n.series[i].points;return a._fill||a._stroke}function h4(n,i){let a=n.series[i].points;return a._stroke||a._fill}function m4(n,i){return n.series[i].points.size}const Ym=[0,0];function p4(n,i,a){return Ym[0]=i,Ym[1]=a,Ym}function zf(n,i,a,l=!0){return u=>{u.button==0&&(!l||u.target==i)&&a(u)}}function Fm(n,i,a,l=!0){return u=>{(!l||u.target==i)&&a(u)}}const g4={show:!0,x:!0,y:!0,lock:!1,move:p4,points:{one:!1,show:f4,size:m4,width:0,stroke:h4,fill:d4},bind:{mousedown:zf,mouseup:zf,click:zf,dblclick:zf,mousemove:Fm,mouseleave:Fm,mouseenter:Fm},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(n,i)=>{i.stopPropagation(),i.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(n,i,a,l,u)=>l-u,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},GS={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},cg=an({},GS,{filter:RS}),YS=an({},cg,{size:10}),FS=an({},GS,{show:!1}),fg='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',QS="bold "+fg,JS=1.5,M_={show:!0,scale:"x",stroke:tg,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:QS,side:2,grid:cg,ticks:YS,border:FS,font:fg,lineGap:JS,rotate:0},v4="Value",y4="Time",j_={show:!0,scale:"x",auto:!1,sorted:1,min:_t,max:-_t,idxs:[]};function b4(n,i,a,l,u){return i.map(f=>f==null?"":ag(f))}function _4(n,i,a,l,u,f,d){let m=[],p=ea.get(u)||0;a=d?a:St(ad(a,u),p);for(let g=a;g<=l;g=St(g+u,p))m.push(Object.is(g,-0)?0:g);return m}function vp(n,i,a,l,u,f,d){const m=[],p=n.scales[n.axes[i].scale].log,g=p==10?fs:MS,b=Zi(g(a));u=lo(p,b),p==10&&(u=Ga[yr(u,Ga)]);let y=a,w=u*p;p==10&&(w=Ga[yr(w,Ga)]);do m.push(y),y=y+u,p==10&&!ea.has(y)&&(y=St(y,ea.get(u))),y>=w&&(u=y,w=u*p,p==10&&(w=Ga[yr(w,Ga)]));while(y<=l);return m}function S4(n,i,a,l,u,f,d){let p=n.scales[n.axes[i].scale].asinh,g=l>p?vp(n,i,ai(p,a),l,u):[p],b=l>=0&&a<=0?[0]:[];return(a<-p?vp(n,i,ai(p,-l),-a,u):[p]).reverse().map(w=>-w).concat(b,g)}const XS=/./,x4=/[12357]/,w4=/[125]/,k_=/1/,yp=(n,i,a,l)=>n.map((u,f)=>i==4&&u==0||f%l==0&&a.test(u.toExpo)DELIM" -R"DELIM(nential()[u<0?1:0])?u:null);function z4(n,i,a,l,u){let f=n.axes[a],d=f.scale,m=n.scales[d],p=n.valToPos,g=f._space,b=p(10,d),y=p(9,d)-b>=g?XS:p(7,d)-b>=g?x4:p(5,d)-b>=g?w4:k_;if(y==k_){let w=mn(p(1,d)-b);if(wu,D_={show:!0,auto:!0,sorted:0,gaps:WS,alpha:1,facets:[an({},C_,{scale:"x"}),an({},C_,{scale:"y"})]},U_={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:WS,alpha:1,points:{show:N4,filter:null},values:null,min:_t,max:-_t,idxs:[],path:null,clip:null};function A4(n,i,a,l,u){return a/10}const ex={time:eM,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},M4=an({},ex,{time:!1,ori:1}),Z_={};function tx(n,i){let a=Z_[n];return a||(a={key:n,plots:[],sub(l){a.plots.push(l)},unsub(l){a.plots=a.plots.filter(u=>u!=l)},pub(l,u,f,d,m,p,g){for(let b=0;b{let L=d.pxRound;const D=g.dir*(g.ori==0?1:-1),X=g.ori==0?go:vo;let G,ee;D==1?(G=a,ee=l):(G=l,ee=a);let V=L(y(m[G],g,A,O)),ne=L(w(p[G],b,k,T)),ae=L(y(m[ee],g,A,O)),ye=L(w(f==1?b.max:b.min,b,k,T)),ue=new Path2D(u);return X(ue,ae,ye),X(ue,V,ye),X(ue,V,ne),ue})}function od(n,i,a,l,u,f){let d=null;if(n.length>0){d=new Path2D;const m=i==0?fd:mg;let p=a;for(let y=0;yw[0]){let O=w[0]-p;O>0&&m(d,p,l,O,l+f),p=w[1]}}let g=a+u-p,b=10;g>0&&m(d,p,l-b/2,g,l+f+b)}return d}function k4(n,i,a){let l=n[n.length-1];l&&l[0]==i?l[1]=a:n.push([i,a])}function hg(n,i,a,l,u,f,d){let m=[],p=n.length;for(let g=u==1?a:l;g>=a&&g<=l;g+=u)if(i[g]===null){let y=g,w=g;if(u==1)for(;++g<=l&&i[g]===null;)w=g;else for(;--g>=a&&i[g]===null;)w=g;let O=f(n[y]),T=w==y?O:f(n[w]),A=y-u;O=d<=0&&A>=0&&A=0&&L>=0&&L=O&&m.push([O,T])}return m}function $_(n){return n==0?kS:n==1?dn:i=>Ka(i,n)}function nx(n){let i=n==0?ud:cd,a=n==0?(u,f,d,m,p,g)=>{u.arcTo(f,d,m,p,g)}:(u,f,d,m,p,g)=>{u.arcTo(d,f,p,m,g)},l=n==0?(u,f,d,m,p)=>{u.rect(f,d,m,p)}:(u,f,d,m,p)=>{u.rect(d,f,p,m)};return(u,f,d,m,p,g=0,b=0)=>{g==0&&b==0?l(u,f,d,m,p):(g=br(g,m/2,p/2),b=br(b,m/2,p/2),i(u,f+g,d),a(u,f+m,d,f+m,d+p,g),a(u,f+m,d+p,f,d+p,b),a(u,f,d+p,f,d,b),a(u,f,d,f+m,d,g),u.closePath())}}const ud=(n,i,a)=>{n.moveTo(i,a)},cd=(n,i,a)=>{n.moveTo(a,i)},go=(n,i,a)=>{n.lineTo(i,a)},vo=(n,i,a)=>{n.lineTo(a,i)},fd=nx(0),mg=nx(1),ix=(n,i,a,l,u,f)=>{n.arc(i,a,l,u,f)},rx=(n,i,a,l,u,f)=>{n.arc(a,i,l,u,f)},sx=(n,i,a,l,u,f,d)=>{n.bezierCurveTo(i,a,l,u,f,d)},ax=(n,i,a,l,u,f,d)=>{n.bezierCurveTo(a,i,u,l,d,f)};function lx(n){return(i,a,l,u,f)=>nl(i,a,(d,m,p,g,b,y,w,O,T,A,k)=>{let{pxRound:L,points:D}=d,X,G;g.ori==0?(X=ud,G=ix):(X=cd,G=rx);const ee=St(D.width*rt,3);let V=(D.size-D.width)/2*rt,ne=St(V*2,3),ae=new Path2D,ye=new Path2D,{left:ue,top:J,width:we,height:he}=i.bbox;fd(ye,ue-ne,J-ne,we+ne*2,he+ne*2);const Oe=fe=>{if(p[fe]!=null){let Q=L(y(m[fe],g,A,O)),W=L(w(p[fe],b,k,T));X(ae,Q+V,W),G(ae,Q,W,V,0,kf*2)}};if(f)f.forEach(Oe);else for(let fe=l;fe<=u;fe++)Oe(fe);return{stroke:ee>0?ae:null,fill:ae,clip:ye,flags:co|bp}})}function ox(n){return(i,a,l,u,f,d)=>{l!=u&&(f!=l&&d!=l&&n(i,a,l),f!=u&&d!=u&&n(i,a,u),n(i,a,d))}}const R4=ox(go),C4=ox(vo);function ux(n){const i=et(n?.alignGaps,0);return(a,l,u,f)=>nl(a,l,(d,m,p,g,b,y,w,O,T,A,k)=>{[u,f]=rd(p,u,f);let L=d.pxRound,D=he=>L(y(he,g,A,O)),X=he=>L(w(he,b,k,T)),G,ee;g.ori==0?(G=go,ee=R4):(G=vo,ee=C4);const V=g.dir*(g.ori==0?1:-1),ne={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:co},ae=ne.stroke;let ye=!1;if(f-u>=A*4){let he=be=>a.posToVal(be,g.key,!0),Oe=null,fe=null,Q,W,xe,Me=D(m[V==1?u:f]),Se=D(m[u]),Be=D(m[f]),Re=he(V==1?Se+1:Be-1);for(let be=V==1?u:f;be>=u&&be<=f;be+=V){let M=m[be],le=(V==1?MRe)?Me:D(M),re=p[be];le==Me?re!=null?(W=re,Oe==null?(G(ae,le,X(W)),Q=Oe=fe=W):Wfe&&(fe=W)):re===null&&(ye=!0):(Oe!=null&&ee(ae,Me,X(Oe),X(fe),X(Q),X(W)),re!=null?(W=re,G(ae,le,X(W)),Oe=fe=Q=W):(Oe=fe=null,re===null&&(ye=!0)),Me=le,Re=he(Me+V))}Oe!=null&&Oe!=fe&&xe!=Me&&ee(ae,Me,X(Oe),X(fe),X(Q),X(W))}else for(let he=V==1?u:f;he>=u&&he<=f;he+=V){let Oe=p[he];Oe===null?ye=!0:Oe!=null&&G(ae,D(m[he]),X(Oe))}let[J,we]=dg(a,l);if(d.fill!=null||J!=0){let he=ne.fill=new Path2D(ae),Oe=d.fillTo(a,l,d.min,d.max,J),fe=X(Oe),Q=D(m[u]),W=D(m[f]);V==-1&&([W,Q]=[Q,W]),G(he,W,fe),G(he,Q,fe)}if(!d.spanGaps){let he=[];ye&&he.push(...hg(m,p,u,f,V,D,i)),ne.gaps=he=d.gaps(a,l,u,f,he),ne.clip=od(he,g.ori,O,T,A,k)}return we!=0&&(ne.band=we==2?[ds(a,l,u,f,ae,-1),ds(a,l,u,f,ae,1)]:ds(a,l,u,f,ae,we)),ne})}function D4(n){const i=et(n.align,1),a=et(n.ascDesc,!1),l=et(n.alignGaps,0),u=et(n.extend,!1);return(f,d,m,p)=>nl(f,d,(g,b,y,w,O,T,A,k,L,D,X)=>{[m,p]=rd(y,m,p);let G=g.pxRound,{left:ee,width:V}=f.bbox,ne=Se=>G(T(Se,w,D,k)),ae=Se=>G(A(Se,O,X,L)),ye=w.ori==0?go:vo;const ue={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:co},J=ue.stroke,we=w.dir*(w.ori==0?1:-1);let he=ae(y[we==1?m:p]),Oe=ne(b[we==1?m:p]),fe=Oe,Q=Oe;u&&i==-1&&(Q=ee,ye(J,Q,he)),ye(J,Oe,he);for(let Se=we==1?m:p;Se>=m&&Se<=p;Se+=we){let Be=y[Se];if(Be==null)continue;let Re=ne(b[Se]),be=ae(Be);i==1?ye(J,Re,he):ye(J,fe,be),ye(J,Re,be),he=be,fe=Re}let W=fe;u&&i==1&&(W=ee+V,ye(J,W,he));let[xe,Me]=dg(f,d);if(g.fill!=null||xe!=0){let Se=ue.fill=new Path2D(J),Be=g.fillTo(f,d,g.min,g.max,xe),Re=ae(Be);ye(Se,W,Re),ye(Se,Q,Re)}if(!g.spanGaps){let Se=[];Se.push(...hg(b,y,m,p,we,ne,l));let Be=g.width*rt/2,Re=a||i==1?Be:-Be,be=a||i==-1?-Be:Be;Se.forEach(M=>{M[0]+=Re,M[1]+=be}),ue.gaps=Se=g.gaps(f,d,m,p,Se),ue.clip=od(Se,w.ori,k,L,D,X)}return Me!=0&&(ue.band=Me==2?[ds(f,d,m,p,J,-1),ds(f,d,m,p,J,1)]:ds(f,d,m,p,J,Me)),ue})}function L_(n,i,a,l,u,f,d=_t){if(n.length>1){let m=null;for(let p=0,g=1/0;p{}),{fill:y,stroke:w}=g;return(O,T,A,k)=>nl(O,T,(L,D,X,G,ee,V,ne,ae,ye,ue,J)=>{let we=L.pxRound,he=a,Oe=l*rt,fe=m*rt,Q=p*rt,W,xe;G.ori==0?[W,xe]=f(O,T):[xe,W]=f(O,T);const Me=G.dir*(G.ori==0?1:-1);let Se=G.ori==0?fd:mg,Be=G.ori==0?b:(me,nt,Zt,qr,Zn,oi,nr)=>{b(me,nt,Zt,Zn,qr,nr,oi)},Re=et(O.bands,lg).find(me=>me.series[0]==T),be=Re!=null?Re.dir:0,M=L.fillTo(O,T,L.min,L.max,be),F=we(ne(M,ee,J,ye)),le,re,$e,Ue=ue,Ae=we(L.width*rt),pe=!1,Ne=null,Bt=null,Li=null,bi=null;y!=null&)DELIM" -R"DELIM(&(Ae==0||w!=null)&&(pe=!0,Ne=y.values(O,T,A,k),Bt=new Map,new Set(Ne).forEach(me=>{me!=null&&Bt.set(me,new Path2D)}),Ae>0&&(Li=w.values(O,T,A,k),bi=new Map,new Set(Li).forEach(me=>{me!=null&&bi.set(me,new Path2D)})));let{x0:En,size:Ut}=g;if(En!=null&&Ut!=null){he=1,D=En.values(O,T,A,k),En.unit==2&&(D=D.map(Zt=>O.posToVal(ae+Zt*ue,G.key,!0)));let me=Ut.values(O,T,A,k);Ut.unit==2?re=me[0]*ue:re=V(me[0],G,ue,ae)-V(0,G,ue,ae),Ue=L_(D,X,V,G,ue,ae,Ue),$e=Ue-re+Oe}else Ue=L_(D,X,V,G,ue,ae,Ue),$e=Ue*d+Oe,re=Ue-$e;$e<1&&($e=0),Ae>=re/2&&(Ae=0),$e<5&&(we=kS);let tt=$e>0,vn=Ue-$e-(tt?Ae:0);re=we(gp(vn,Q,fe)),le=(he==0?re/2:he==Me?0:re)-he*Me*((he==0?Oe/2:0)+(tt?Ae/2:0));const Gt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Kn=pe?null:new Path2D;let li=null;if(Re!=null)li=O.data[Re.series[1]];else{let{y0:me,y1:nt}=g;me!=null&&nt!=null&&(X=nt.values(O,T,A,k),li=me.values(O,T,A,k))}let Hi=W*re,Ce=xe*re;for(let me=Me==1?A:k;me>=A&&me<=k;me+=Me){let nt=X[me];if(nt==null)continue;if(li!=null){let yn=li[me]??0;if(nt-yn==0)continue;F=ne(yn,ee,J,ye)}let Zt=G.distr!=2||g!=null?D[me]:me,qr=V(Zt,G,ue,ae),Zn=ne(et(nt,M),ee,J,ye),oi=we(qr-le),nr=we(ai(Zn,F)),Gn=we(br(Zn,F)),Yn=nr-Gn;if(nt!=null){let yn=nt<0?Ce:Hi,Fn=nt<0?Hi:Ce;pe?(Ae>0&&Li[me]!=null&&Se(bi.get(Li[me]),oi,Gn+Zi(Ae/2),re,ai(0,Yn-Ae),yn,Fn),Ne[me]!=null&&Se(Bt.get(Ne[me]),oi,Gn+Zi(Ae/2),re,ai(0,Yn-Ae),yn,Fn)):Se(Kn,oi,Gn+Zi(Ae/2),re,ai(0,Yn-Ae),yn,Fn),Be(O,T,me,oi-Ae/2,Gn,re+Ae,Yn)}}return Ae>0?Gt.stroke=pe?bi:Kn:pe||(Gt._fill=L.width==0?L._fill:L._stroke??L._fill,Gt.width=0),Gt.fill=pe?Bt:Kn,Gt})}function Z4(n,i){const a=et(i?.alignGaps,0);return(l,u,f,d)=>nl(l,u,(m,p,g,b,y,w,O,T,A,k,L)=>{[f,d]=rd(g,f,d);let D=m.pxRound,X=W=>D(w(W,b,k,T)),G=W=>D(O(W,y,L,A)),ee,V,ne;b.ori==0?(ee=ud,ne=go,V=sx):(ee=cd,ne=vo,V=ax);const ae=b.dir*(b.ori==0?1:-1);let ye=X(p[ae==1?f:d]),ue=ye,J=[],we=[];for(let W=ae==1?f:d;W>=f&&W<=d;W+=ae)if(g[W]!=null){let Me=p[W],Se=X(Me);J.push(ue=Se),we.push(G(g[W]))}const he={stroke:n(J,we,ee,ne,V,D),fill:null,clip:null,band:null,gaps:null,flags:co},Oe=he.stroke;let[fe,Q]=dg(l,u);if(m.fill!=null||fe!=0){let W=he.fill=new Path2D(Oe),xe=m.fillTo(l,u,m.min,m.max,fe),Me=G(xe);ne(W,ue,Me),ne(W,ye,Me)}if(!m.spanGaps){let W=[];W.push(...hg(p,g,f,d,ae,X,a)),he.gaps=W=m.gaps(l,u,f,d,W),he.clip=od(W,b.ori,T,A,k,L)}return Q!=0&&(he.band=Q==2?[ds(l,u,f,d,Oe,-1),ds(l,u,f,d,Oe,1)]:ds(l,u,f,d,Oe,Q)),he})}function $4(n){return Z4(L4,n)}function L4(n,i,a,l,u,f){const d=n.length;if(d<2)return null;const m=new Path2D;if(a(m,n[0],i[0]),d==2)l(m,n[1],i[1]);else{let p=Array(d),g=Array(d-1),b=Array(d-1),y=Array(d-1);for(let w=0;w0!=g[w]>0?p[w]=0:(p[w]=3*(y[w-1]+y[w])/((2*y[w]+y[w-1])/g[w-1]+(y[w]+2*y[w-1])/g[w]),isFinite(p[w])||(p[w]=0));p[d-1]=g[d-2];for(let w=0;w{on.pxRatio=rt}));const H4=ux(),B4=lx();function B_(n,i,a,l){return(l?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map((f,d)=>Sp(f,d,i,a))}function q4(n,i){return n.map((a,l)=>l==0?{}:an({},i,a))}function Sp(n,i,a,l){return an({},i==0?a:l,n)}function cx(n,i,a){return i==null?oo:[i,a]}const V4=cx;function I4(n,i,a){return i==null?oo:Kf(i,a,sg,!0)}function fx(n,i,a,l){return i==null?oo:sd(i,a,n.scales[l].log,!1)}const P4=fx;function dx(n,i,a,l){return i==null?oo:rg(i,a,n.scales[l].log,!1)}const K4=dx;function G4(n,i,a,l,u){let f=ai(b_(n),b_(i)),d=i-n,m=yr(u/l*d,a);do{let p=a[m],g=l*p/d;if(g>=u&&f+(p<5?ea.get(p):0)<=17)return[p,g]}while(++m(i=dn((a=+u)*rt))+"px"),[n,i,a]}function Y4(n){n.show&&[n.font,n.labelFont].forEach(i=>{let a=St(i[2]*rt,1);i[0]=i[0].replace(/[0-9.]+px/,a+"px"),i[1]=a})}function on(n,i,a){const l={mode:et(n.mode,1)},u=l.mode;function f(v,S,z,E){let R=S.valToPct(v);return E+z*(S.dir==-1?1-R:R)}function d(v,S,z,E){let R=S.valToPct(v);return E+z*(S.dir==-1?R:1-R)}function m(v,S,z,E){return S.ori==0?f(v,S,z,E):d(v,S,z,E)}l.valToPosH=f,l.valToPosV=d;let p=!1;l.status=0;const g=l.root=Ji(tM);if(n.id!=null&&(g.id=n.id),Ci(g,n.class),n.title){let v=Ji(rM,g);v.textContent=n.title}const b=vr("canvas"),y=l.ctx=b.getContext("2d"),w=Ji(sM,g);Xa("click",w,v=>{v.target===T&&(vt!=_s||xt!=Qr)&&ht.click(l,v)},!0);const O=l.under=Ji(aM,w);w.appendChild(b);const T=l.over=Ji(lM,w);n=uo(n);const A=+et(n.pxAlign,1),k=$_(A);(n.plugins||[]).forEach(v=>{v.opts&&(n=v.opts(l,n)||n)});const L=n.ms||.001,D=l.series=u==1?B_(n.series||[],j_,U_,!1):q4(n.series||[null],D_),X=l.axes=B_(n.axes||[],M_,R_,!0),G=l.scales={},ee=l.bands=n.bands||[];ee.forEach(v=>{v.fill=Qe(v.fill||null),v.dir=et(v.dir,-1)});const V=u==2?D[1].facets[0].scale:D[0].scale,ne={axes:dl,series:Iu},ae=(n.drawOrder||["axes","series"]).map(v=>ne[v]);function ye(v){const S=v.distr==3?z=>fs(z>0?z:v.clamp(l,z,v.min,v.max,v.key)):v.distr==4?z=>Km(z,v.asinh):v.distr==100?z=>v.fwd(z):z=>z;return z=>{let E=S(z),{_min:R,_max:H}=v,P=H-R;return(E-R)/P}}function ue(v){let S=G[v];if(S==null){let z=(n.scales||ku)[v]||ku;if(z.from!=null){ue(z.from);let E=an({},G[z.from],z,{key:v});E.valToPct=ye(E),G[v]=E}else{S=G[v]=an({},v==V?ex:M4,z),S.key=v;let E=S.time,R=S.range,H=Ys(R);if((v!=V||u==2&&!E)&&(H&&(R[0]==null||R[1]==null)&&(R={min:R[0]==null?g_:{mode:1,hard:R[0],soft:R[0]},max:R[1]==null?g_:{mode:1,hard:R[1],soft:R[1]}},H=!1),!H&&ld(R))){let P=R;R=(te,ie,ce)=>ie==null?oo:Kf(ie,ce,P)}S.range=Qe(R||(E?V4:v==V?S.distr==3?P4:S.distr==4?K4:cx:S.distr==3?fx:S.distr==4?dx:I4)),S.auto=Qe(H?!1:S.auto),S.clamp=Qe(S.clamp||A4),S._min=S._max=null,S.valToPct=ye(S)}}}ue("x"),ue("y"),u==1&&D.forEach(v=>{ue(v.scale)}),X.forEach(v=>{ue(v.scale)});for(let v in n.scales)ue(v);const J=G[V],we=J.distr;let he,Oe;J.ori==0?(Ci(g,nM),he=f,Oe=d):(Ci(g,iM),he=d,Oe=f);const fe={};for(let v in G){let S=G[v];(S.min!=null||S.max!=null)&&(fe[v]={min:S.min,max:S.max},S.min=S.max=null)}const Q=n.tzDate||(v=>new Date(dn(v/L))),W=n.fmtDate||og,xe=L==1?n4(Q):s4(Q),Me=O_(Q,E_(L==1?t4:r4,W)),Se=A_(Q,N_(l4,W)),Be=[],Re=l.legend=an({},c4,n.legend),be=l.cursor=an({},g4,{drag:{y:u==2}},n.cursor),M=Re.show,F=be.show,le=Re.markers;Re.idxs=Be,le.width=Qe(le.width),le.dash=Qe(le.dash),le.stroke=Qe(le.stroke),le.fill=Qe(le.fill);let re,$e,Ue,Ae=[],pe=[],Ne,Bt=!1,Li={};if(Re.live){const v=D[1]?D[1].values:null;Bt=v!=null,Ne=Bt?v(l,1,0):{_:0};for(let S in Ne)Li[S]=ng}if(M)if(re=vr("table",hM,g),Ue=vr("tbody",null,re),Re.mount(l,re),Bt){$e=vr("thead",null,re,Ue);let v=vr("tr",null,$e);vr("th",null,v);for(var bi in Ne)vr("th",i_,v).textContent=bi}else Ci(re,pM),Re.live&&Ci(re,mM);const En={show:!0},Ut={show:!1};function tt(v,S){if(S==0&&(Bt||!Re.live||u==2))return oo;let z=[],E=vr("tr",gM,Ue,Ue.childNodes[S]);Ci(E,v.class),v.show||Ci(E,Ya);let R=vr("th",null,E);if(le.show){let te=Ji(vM,R);if(S>0){let ie=le.width(l,S);ie&&(te.style.border=ie+"px "+le.dash(l,S)+" "+le.stroke(l,S)),te.style.background=le.fill(l,S)}}let H=Ji(i_,R);v.label instanceof HTMLElement?H.appendChild(v.label):H.textContent=v.label,S>0&&(le.show||(H.style.color=v.width>0?le.stroke(l,S):le.fill(l,S)),Gt("click",R,te=>{if(be._lock)return;Ft(te);let ie=D.indexOf(v);if((te.ctrlKey||te.metaKey)!=Re.isolate){let ce=D.some((de,ge)=>ge>0&&ge!=ie&&de.show);D.forEach((de,ge)=>{ge>0&&Ln(ge,ce?ge==ie?En:Ut:En,!0,$t.setSeries)})}else Ln(ie,{show:!v.show},!0,$t.setSeries)},!1),ps&&Gt(l_,R,te=>{be._lock||(Ft(te),Ln(D.indexOf(v),lr,!0,$t.setSeries))},!1));for(var P in Ne){let te=vr("td",yM,E);te.textContent="--",z.push(te)}return[E,z]}const vn=new Map;function Gt(v,S,z,E=!0){const R=vn.get(S)||{},H=be.bind[v](l,S,z,E);H&&(Xa(v,S,R[v]=H),vn.set(S,R))}function Kn(v,S,z){const E=vn.get(S)||{};for(let R in E)(v==null||R==v)&&(pp(R,S,E[R]),delete E[R]);v==null&&vn.delete(S)}let li=0,H)DELIM" -R"DELIM(i=0,Ce=0,me=0,nt=0,Zt=0,qr=nt,Zn=Zt,oi=Ce,nr=me,Gn=0,Yn=0,yn=0,Fn=0;l.bbox={};let ia=!1,il=!1,ms=!1,Yt=!1,rl=!1,Qn=!1;function sl(v,S,z){(z||v!=l.width||S!=l.height)&&ra(v,S),$n(!1),ms=!0,il=!0,Gr()}function ra(v,S){l.width=li=Ce=v,l.height=Hi=me=S,nt=Zt=0,md(),sa();let z=l.bbox;Gn=z.left=Ka(nt*rt,.5),Yn=z.top=Ka(Zt*rt,.5),yn=z.width=Ka(Ce*rt,.5),Fn=z.height=Ka(me*rt,.5)}const dd=3;function Vu(){let v=!1,S=0;for(;!v;){S++;let z=Pu(S),E=fl(S);v=S==dd||z&&E,v||(ra(l.width,l.height),il=!0)}}function hd({width:v,height:S}){sl(v,S)}l.setSize=hd;function md(){let v=!1,S=!1,z=!1,E=!1;X.forEach((R,H)=>{if(R.show&&R._show){let{side:P,_size:te}=R,ie=P%2,ce=R.label!=null?R.labelSize:0,de=te+ce;de>0&&(ie?(Ce-=de,P==3?(nt+=de,E=!0):z=!0):(me-=de,P==0?(Zt+=de,v=!0):S=!0))}}),xr[0]=v,xr[1]=z,xr[2]=S,xr[3]=E,Ce-=ci[1]+ci[3],nt+=ci[3],me-=ci[2]+ci[0],Zt+=ci[0]}function sa(){let v=nt+Ce,S=Zt+me,z=nt,E=Zt;function R(H,P){switch(H){case 1:return v+=P,v-P;case 2:return S+=P,S-P;case 3:return z-=P,z+P;case 0:return E-=P,E+P}}X.forEach((H,P)=>{if(H.show&&H._show){let te=H.side;H._pos=R(te,H._size),H.label!=null&&(H._lpos=R(te,H.labelSize))}})}if(be.dataIdx==null){let v=be.hover,S=v.skip=new Set(v.skip??[]);S.add(void 0);let z=v.prox=Qe(v.prox),E=v.bias??=0;be.dataIdx=(R,H,P,te)=>{if(H==0)return P;let ie=P,ce=z(R,H,P,te)??_t,de=ce>=0&&ce<_t,ge=J.ori==0?Ce:me,De=be.left,Ie=i[0],Je=i[H];if(S.has(Je[P])){ie=null;let qe=null,je=null,ze;if(E==0||E==-1)for(ze=P;qe==null&&ze-- >0;)S.has(Je[ze])||(qe=ze);if(E==0||E==1)for(ze=P;je==null&&ze++ce&&(ie=null);return ie}}const Ft=v=>{be.event=v};be.idxs=Be,be._lock=!1;let Tt=be.points;Tt.show=Qe(Tt.show),Tt.size=Qe(Tt.size),Tt.stroke=Qe(Tt.stroke),Tt.width=Qe(Tt.width),Tt.fill=Qe(Tt.fill);const Nt=l.focus=an({},n.focus||{alpha:.3},be.focus),ps=Nt.prox>=0,gs=ps&&Tt.one;let ui=[],ir=[],rr=[];function aa(v,S){let z=Tt.show(l,S);if(z instanceof HTMLElement)return Ci(z,dM),Ci(z,v.class),Lr(z,-10,-10,Ce,me),T.insertBefore(z,ui[S]),z}function Sr(v,S){if(u==1||S>0){let z=u==1&&G[v.scale].time,E=v.value;v.value=z?x_(E)?A_(Q,N_(E,W)):E||Se:E||E4,v.label=v.label||(z?y4:v4)}if(gs||S>0){v.width=v.width==null?1:v.width,v.paths=v.paths||H4||MM,v.fillTo=Qe(v.fillTo||j4),v.pxAlign=+et(v.pxAlign,A),v.pxRound=$_(v.pxAlign),v.stroke=Qe(v.stroke||null),v.fill=Qe(v.fill||null),v._stroke=v._fill=v._paths=v._focus=null;let z=O4(ai(1,v.width),1),E=v.points=an({},{size:z,width:ai(1,z*.2),stroke:v.stroke,space:z*2,paths:B4,_stroke:null,_fill:null},v.points);E.show=Qe(E.show),E.filter=Qe(E.filter),E.fill=Qe(E.fill),E.stroke=Qe(E.stroke),E.paths=Qe(E.paths),E.pxAlign=v.pxAlign}if(M){let z=tt(v,S);Ae.splice(S,0,z[0]),pe.splice(S,0,z[1]),Re.values.push(null)}if(F){Be.splice(S,0,null);let z=null;gs?S==0&&(z=aa(v,S)):S>0&&(z=aa(v,S)),ui.splice(S,0,z),ir.splice(S,0,0),rr.splice(S,0,0)}en("addSeries",S)}function al(v,S){S=S??D.length,v=u==1?Sp(v,S,j_,U_):Sp(v,S,{},D_),D.splice(S,0,v),Sr(D[S],S)}l.addSeries=al;function la(v){if(D.splice(v,1),M){Re.values.splice(v,1),pe.splice(v,1);let S=Ae.splice(v,1)[0];Kn(null,S.firstChild),S.remove()}F&&(Be.splice(v,1),ui.splice(v,1)[0].remove(),ir.splice(v,1),rr.splice(v,1)),en("delSeries",v)}l.delSeries=la;const xr=[!1,!1,!1,!1];function pd(v,S){if(v._show=v.show,v.show){let z=v.side%2,E=G[v.scale];E==null&&(v.scale=z?D[1].scale:V,E=G[v.scale]);let R=E.time;v.size=Qe(v.size),v.space=Qe(v.space),v.rotate=Qe(v.rotate),Ys(v.incrs)&&v.incrs.forEach(P=>{!ea.has(P)&&ea.set(P,DS(P))}),v.incrs=Qe(v.incrs||(E.distr==2?XM:R?L==1?e4:i4:Ga)),v.splits=Qe(v.splits||(R&&E.distr==1?xe:E.distr==3?vp:E.distr==4?S4:_4)),v.stroke=Qe(v.stroke),v.grid.stroke=Qe(v.grid.stroke),v.ticks.stroke=Qe(v.ticks.stroke),v.border.stroke=Qe(v.border.stroke);let H=v.values;v.values=Ys(H)&&!Ys(H[0])?Qe(H):R?Ys(H)?O_(Q,E_(H,W)):x_(H)?a4(Q,H):H||Me:H||b4,v.filter=Qe(v.filter||(E.distr>=3&&E.log==10?z4:E.distr==3&&E.log==2?T4:RS)),v.font=q_(v.font),v.labelFont=q_(v.labelFont),v._size=v.size(l,null,S,0),v._space=v._rotate=v._incrs=v._found=v._splits=v._values=null,v._size>0&&(xr[S]=!0,v._el=Ji(oM,w))}}function vs(v,S,z,E){let[R,H,P,te]=z,ie=S%2,ce=0;return ie==0&&(te||H)&&(ce=S==0&&!R||S==2&&!P?dn(M_.size/3):0),ie==1&&(R||P)&&(ce=S==1&&!H||S==3&&!te?dn(R_.size/2):0),ce}const ll=l.padding=(n.padding||[vs,vs,vs,vs]).map(v=>Qe(et(v,vs))),ci=l._padding=ll.map((v,S)=>v(l,S,xr,0));let un,Qt=null,Jt=null;const oa=u==1?D[0].idxs:null;let Jn=null,Vr=!1;function yo(v,S){if(i=v??[],l.data=l._data=i,u==2){un=0;for(let z=1;z=0,Qn=!0,Gr()}}l.setData=yo;function ol(){Vr=!0;let v,S;u==1&&(un>0?(Qt=oa[0]=0,Jt=oa[1]=un-1,v=i[0][Qt],S=i[0][Jt],we==2?(v=Qt,S=Jt):v==S&&(we==3?[v,S]=sd(v,v,J.log,!1):we==4?[v,S]=rg(v,v,J.log,!1):J.time?S=v+dn(86400/L):[v,S]=Kf(v,S,sg,!0))):(Qt=oa[0]=v=null,Jt=oa[1]=S=null)),sr(V,v,S)}let fi,At,bn,wr,ul,bo,_o,cl,Ir,cn;function ua(v,S,z,E,R,H){v??=s_,z??=lg,E??="butt",R??=s_,H??="round",v!=fi&&(y.strokeStyle=fi=v),R!=At&&(y.fillStyle=At=R),S!=bn&&(y.lineWidth=bn=S),H!=ul&&(y.lineJoin=ul=H),E!=bo&&(y.lineCap=bo=E),z!=wr&&y.setLineDash(wr=z)}function zr(v,S,z,E){S!=At&&(y.fillStyle=At=S),v!=_o&&(y.font=_o=v),z!=cl&&(y.textAlign=cl=z),E!=Ir&&(y.textBaseline=Ir=E)}function Tr(v,S,z,E,R=0){if(E.length>0&&v.auto(l,Vr)&&(S==null||S.min==null)){let H=et(Qt,0),P=et(Jt,E.length-1),te=z.min==null?zM(E,H,P,R,v.distr==3):[z.min,z.max];v.min=br(v.min,z.min=te[0]),v.max=ai(v.max,z.max=te[1])}}const ys={min:null,max:null};function bs(){for(let E in G){let R=G[E];fe[E]==null&&(R.min==null||fe[V]!=null&&R.auto(l,Vr))&&(fe[E]=ys)}for(let E in G){let R=G[E];fe[E]==null&&R.from!=null&&fe[R.from]!=null&&(fe[E]=ys)}fe[V]!=null&&$n(!0);let v={};for(let E in fe){let R=fe[E];if(R!=null){let H=v[E]=uo(G[E],RM);if(R.min!=null)an(H,R);else if(E!=V||u==2)if(un==0&&H.from==null){let P=H.range(l,null,null,E);H.min=P[0],H.max=P[1]}else H.min=_t,H.max=-_t}}if(un>0){D.forEach((E,R)=>{if(u==1){let H=E.scale,P=fe[H];if(P==null)return;let te=v[H];if(R==0){let ie=te.range(l,te.min,te.max,H);te.min=ie[0],te.max=ie[1],Qt=yr(te.min,i[0]),Jt=yr(te.max,i[0]),Jt-Qt>1&&(i[0][Qt]te.max&&Jt--),E.min=Jn[Qt],E.max=Jn[Jt]}else E.show&&E.auto&&Tr(te,P,E,i[R],E.sorted);E.idxs[0]=Qt,E.idxs[1]=Jt}else if(R>0&&E.show&&E.auto){let[H,P]=E.facets,te=H.scale,ie=P.scale,[ce,de]=i[R],ge=v[te],De=v[ie];ge!=null&&Tr(ge,fe[te],H,ce,H.sorted),De!=null&&Tr(De,fe[ie],P,de,P.sorted),E.min=P.min,E.max=P.max}});for(let E in v){let R=v[E],H=fe[E];if(R.from==null&&(H==null||H.min==null)){let P=R.range(l,R.min==_t?null:R.min,R.max==-_t?null:R.max,E);R.min=P[0],R.max=P[1]}}}for(let E in v){let R=v[E];if(R.from!=null){let H=v[R.from];if(H.min==null)R.min=R.max=null;else{let P=R.range(l,H.min,H.max,E);R.min=P[0],R.max=P[1]}}}let S={},z=!1;for(let E in v){let R=v[E],H=G[E];if(H.min!=R.min||H.max!=R.max){H.min=R.min,H.max=R.max;let P=H.distr;H._min=P==3?fs(H.min):P==4?Km(H.min,H.asinh):P==100?H.fwd(H.min):H.min,H._max=P==3?fs(H.max):P==4?Km(H.max,H.asinh):P==100?H.fwd(H.max):H.max,S[E]=z=!0}}if(z){D.forEach((E,R)=>{u==2?R>0&&S.y&&(E._paths=null):S[E.scale]&&(E._paths=null)});for(let E in S)ms=!0,en("setScale",E);F&&be.left>=0&&(Yt=Qn=!0)}for(let E in fe)fe[E]=null}function Wt(v){let S=gp(Qt-1,0,un-1),z=gp(Jt+1,0,un-1);for(;v[S]==null&&S>0;)S--;for(;v[z]==null&&z0){let v=D.some(S=>S._focus)&&cn!=Nt.alpha;v&&(y.globalAlpha=cn=Nt.alpha),D.forEach((S,z)=>{if(z>0&&S.show&&(So(z,!1),So(z,!0),S._paths==null)){let E=cn;cn!=S.a)DELIM" -R"DELIM(lpha&&(y.globalAlpha=cn=S.alpha);let R=u==2?[0,i[z][0].length-1]:Wt(i[z]);S._paths=S.paths(l,z,R[0],R[1]),cn!=E&&(y.globalAlpha=cn=E)}}),D.forEach((S,z)=>{if(z>0&&S.show){let E=cn;cn!=S.alpha&&(y.globalAlpha=cn=S.alpha),S._paths!=null&&xo(z,!1);{let R=S._paths!=null?S._paths.gaps:null,H=S.points.show(l,z,Qt,Jt,R),P=S.points.filter(l,z,H,R);(H||P)&&(S.points._paths=S.points.paths(l,z,Qt,Jt,P),xo(z,!0))}cn!=E&&(y.globalAlpha=cn=E),en("drawSeries",z)}}),v&&(y.globalAlpha=cn=1)}}function So(v,S){let z=S?D[v].points:D[v];z._stroke=z.stroke(l,v),z._fill=z.fill(l,v)}function xo(v,S){let z=S?D[v].points:D[v],{stroke:E,fill:R,clip:H,flags:P,_stroke:te=z._stroke,_fill:ie=z._fill,_width:ce=z.width}=z._paths;ce=St(ce*rt,3);let de=null,ge=ce%2/2;S&&ie==null&&(ie=ce>0?"#fff":te);let De=z.pxAlign==1&&ge>0;if(De&&y.translate(ge,ge),!S){let Ie=Gn-ce/2,Je=Yn-ce/2,qe=yn+ce,je=Fn+ce;de=new Path2D,de.rect(Ie,Je,qe,je)}S?wo(te,ce,z.dash,z.cap,ie,E,R,P,H):Pr(v,te,ce,z.dash,z.cap,ie,E,R,P,de,H),De&&y.translate(-ge,-ge)}function Pr(v,S,z,E,R,H,P,te,ie,ce,de){let ge=!1;ie!=0&&ee.forEach((De,Ie)=>{if(De.series[0]==v){let Je=D[De.series[1]],qe=i[De.series[1]],je=(Je._paths||ku).band;Ys(je)&&(je=De.dir==1?je[0]:je[1]);let ze,mt=null;Je.show&&je&&EM(qe,Qt,Jt)?(mt=De.fill(l,Ie)||H,ze=Je._paths.clip):je=null,wo(S,z,E,R,mt,P,te,ie,ce,de,ze,je),ge=!0}}),ge||wo(S,z,E,R,H,P,te,ie,ce,de)}const Kr=co|bp;function wo(v,S,z,E,R,H,P,te,ie,ce,de,ge){ua(v,S,z,E,R),(ie||ce||ge)&&(y.save(),ie&&y.clip(ie),ce&&y.clip(ce)),ge?(te&Kr)==Kr?(y.clip(ge),de&&y.clip(de),fa(R,P),ca(v,H,S)):te&bp?(fa(R,P),y.clip(ge),ca(v,H,S)):te&co&&(y.save(),y.clip(ge),de&&y.clip(de),fa(R,P),y.restore(),ca(v,H,S)):(fa(R,P),ca(v,H,S)),(ie||ce||ge)&&y.restore()}function ca(v,S,z){z>0&&(S instanceof Map?S.forEach((E,R)=>{y.strokeStyle=fi=R,y.stroke(E)}):S!=null&&v&&y.stroke(S))}function fa(v,S){S instanceof Map?S.forEach((z,E)=>{y.fillStyle=At=E,y.fill(z)}):S!=null&&v&&y.fill(S)}function gd(v,S,z,E){let R=X[v],H;if(E<=0)H=[0,0];else{let P=R._space=R.space(l,v,S,z,E),te=R._incrs=R.incrs(l,v,S,z,E,P);H=G4(S,z,te,E,P)}return R._found=H}function Ge(v,S,z,E,R,H,P,te,ie,ce){let de=P%2/2;A==1&&y.translate(de,de),ua(te,P,ie,ce,te),y.beginPath();let ge,De,Ie,Je,qe=R+(E==0||E==3?-H:H);z==0?(De=R,Je=qe):(ge=R,Ie=qe);for(let je=0;je{if(!z.show)return;let R=G[z.scale];if(R.min==null){z._show&&(S=!1,z._show=!1,$n(!1));return}else z._show||(S=!1,z._show=!0,$n(!1));let H=z.side,P=H%2,{min:te,max:ie}=R,[ce,de]=gd(E,te,ie,P==0?Ce:me);if(de==0)return;let ge=R.distr==2,De=z._splits=z.splits(l,E,te,ie,ce,de,ge),Ie=R.distr==2?De.map(ze=>Jn[ze]):De,Je=R.distr==2?Jn[De[1]]-Jn[De[0]]:ce,qe=z._values=z.values(l,z.filter(l,Ie,E,de,Je),E,de,Je);z._rotate=H==2?z.rotate(l,qe,E,de):0;let je=z._size;z._size=Xi(z.size(l,qe,E,v)),je!=null&&z._size!=je&&(S=!1)}),S}function fl(v){let S=!0;return ll.forEach((z,E)=>{let R=z(l,E,xr,v);R!=ci[E]&&(S=!1),ci[E]=R}),S}function dl(){for(let v=0;vJn[Nn]):Ie,qe=de.distr==2?Jn[Ie[1]]-Jn[Ie[0]]:ie,je=S.ticks,ze=S.border,mt=je.show?je.size:0,pt=dn(mt*rt),Mt=dn((S.alignTo==2?S._size-mt-S.gap:S.gap)*rt),st=S._rotate*-kf/180,yt=k(S._pos*rt),Hn=(pt+Mt)*te,Sn=yt+Hn;H=E==0?Sn:0,R=E==1?Sn:0;let Bn=S.font[0],Wn=S.align==1?Xl:S.align==2?Vm:st>0?Xl:st<0?Vm:E==0?"center":z==3?Vm:Xl,Ei=st||E==1?"middle":z==2?yu:r_;zr(Bn,P,Wn,Ei);let qn=S.font[1]*S.lineGap,ei=Ie.map(Nn=>k(m(Nn,de,ge,De))),Oi=S._values;for(let Nn=0;Nn{z>0&&(S._paths=null,v&&(u==1?(S.min=null,S.max=null):S.facets.forEach(E=>{E.min=null,E.max=null})))})}let _n=!1,hl=!1,da=[];function zo(){hl=!1;for(let v=0;v0&&queueMicrotask(zo)}l.batch=vd;function Xn(){if(ia&&(bs(),ia=!1),ms&&(Vu(),ms=!1),il){if(Et(O,Xl,nt),Et(O,yu,Zt),Et(O,zu,Ce),Et(O,Tu,me),Et(T,Xl,nt),Et(T,yu,Zt),Et(T,zu,Ce),Et(T,Tu,me),Et(w,zu,li),Et(w,Tu,Hi),b.width=dn(li*rt),b.height=dn(Hi*rt),X.forEach(({_el:v,_show:S,_size:z,_pos:E,side:R})=>{if(v!=null)if(S){let H=R===3||R===0?z:0,P=R%2==1;Et(v,P?"left":"top",E-H),Et(v,P?"width":"height",z),Et(v,P?"top":"left",P?Zt:nt),Et(v,P?"height":"width",P?me:Ce),mp(v,Ya)}else Ci(v,Ya)}),fi=At=bn=ul=bo=_o=cl=Ir=wr=null,cn=1,Sa(!0),nt!=qr||Zt!=Zn||Ce!=oi||me!=nr){$n(!1);let v=Ce/oi,S=me/nr;if(F&&!Yt&&be.left>=0){be.left*=v,be.top*=S,_i&&Lr(_i,dn(be.left),0,Ce,me),Yr&&Lr(Yr,0,dn(be.top),Ce,me);for(let z=0;z=0&&We.width>0){We.left*=v,We.width*=v,We.top*=S,We.height*=S;for(let z in xa)Et(xi,z,We[z])}qr=nt,Zn=Zt,oi=Ce,nr=me}en("setSize"),il=!1}li>0&&Hi>0&&(y.clearRect(0,0,b.width,b.height),en("drawClear"),ae.forEach(v=>v()),en("draw")),We.show&&rl&&(pa(We),rl=!1),F&&Yt&&(Bi(null,!0,!1),Yt=!1),Re.show&&Re.live&&Qn&&(ba(),Qn=!1),p||(p=!0,l.status=1,en("ready")),Vr=!1,_n=!1}l.redraw=(v,S)=>{ms=S||!1,v!==!1?sr(V,J.min,J.max):Gr()};function ha(v,S){let z=G[v];if(z.from==null){if(un==0){let E=z.range(l,S.min,S.max,v);S.min=E[0],S.max=E[1]}if(S.min>S.max){let E=S.min;S.min=S.max,S.max=E}if(un>1&&S.min!=null&&S.max!=null&&S.max-S.min<1e-16)return;v==V&&z.distr==2&&un>0&&(S.min=yr(S.min,i[0]),S.max=yr(S.max,i[0]),S.min==S.max&&S.max++),fe[v]=S,ia=!0,Gr()}}l.setScale=ha;let ml,ma,_i,Yr,To,Fr,_s,Qr,Eo,pl,vt,xt,Si=!1;const ht=be.drag;let qt=ht.x,Vt=ht.y;F&&(be.x&&(ml=Ji(cM,T)),be.y&&(ma=Ji(fM,T)),J.ori==0?(_i=ml,Yr=ma):(_i=ma,Yr=ml),vt=be.left,xt=be.top);const We=l.select=an({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),xi=We.show?Ji(uM,We.over?T:O):null;function pa(v,S){if(We.show){for(let z in v)We[z]=v[z],z in xa&&Et(xi,z,v[z]);S!==!1&&en("setSelect")}}l.setSelect=pa;function Oo(v){if(D[v].show)M&&mp(Ae[v],Ya);else if(M&&Ci(Ae[v],Ya),F){let z=gs?ui[0]:ui[v];z!=null&&Lr(z,-10,-10,Ce,me)}}function sr(v,S,z){ha(v,{min:S,max:z})}function Ln(v,S,z,E){S.focus!=null&&gl(v),S.show!=null&&D.forEach((R,H)=>{H>0&&(v==H||v==null)&&(R.show=S.show,Oo(H),u==2?(sr(R.facets[0].scale,null,null),sr(R.facets[1].scale,null,null)):sr(R.scale,null,null),Gr())}),z!==!1&&en("setSeries",v,S),E&&wa("setSeries",l,v,S)}l.setSeries=Ln;function ar(v,S){an(ee[v],S)}function No(v,S){v.fill=Qe(v.fill||null),v.dir=et(v.dir,-1),S=S??ee.length,ee.splice(S,0,v)}function ga(v){v==null?ee.length=0:ee.splice(v,1)}l.addBand=No,l.setBand=ar,l.delBand=ga;function Er(v,S){D[v].alpha=S,F&&ui[v]!=null&&(ui[v].style.opacity=S),M&&Ae[v]&&(Ae[v].style.opacity=S)}let wi,zi,Or;const lr={focus:!0};function gl(v){if(v!=Or){let S=v==null,z=Nt.alpha!=1;D.forEach((E,R)=>{if(u==1||R>0){let H=S||R==0||R==v;E._focus=S?null:H,z&&Er(R,H?1:Nt.alpha)}}),Or=v,z&&Gr()}}M)DELIM" -R"DELIM(&&ps&&Gt(o_,re,v=>{be._lock||(Ft(v),Or!=null&&Ln(null,lr,!0,$t.setSeries))});function Ti(v,S,z){let E=G[S];z&&(v=v/rt-(E.ori==1?Zt:nt));let R=Ce;E.ori==1&&(R=me,v=R-v),E.dir==-1&&(v=R-v);let H=E._min,P=E._max,te=v/R,ie=H+(P-H)*te,ce=E.distr;return ce==3?lo(10,ie):ce==4?NM(ie,E.asinh):ce==100?E.bwd(ie):ie}function On(v,S){let z=Ti(v,V,S);return yr(z,i[0],Qt,Jt)}l.valToIdx=v=>yr(v,i[0]),l.posToIdx=On,l.posToVal=Ti,l.valToPos=(v,S,z)=>G[S].ori==0?f(v,G[S],z?yn:Ce,z?Gn:0):d(v,G[S],z?Fn:me,z?Yn:0),l.setCursor=(v,S,z)=>{vt=v.left,xt=v.top,Bi(null,S,z)};function or(v,S){Et(xi,Xl,We.left=v),Et(xi,zu,We.width=S)}function va(v,S){Et(xi,yu,We.top=v),Et(xi,Tu,We.height=S)}let ur=J.ori==0?or:va,ya=J.ori==1?or:va;function Ao(){if(M&&Re.live)for(let v=u==2?1:0;v{Be[E]=z}):kM(v.idx)||Be.fill(v.idx),Re.idx=Be[0]),M&&Re.live){for(let z=0;z0||u==1&&!Bt)&&_a(z,Be[z]);Ao()}Qn=!1,S!==!1&&en("setLegend")}l.setLegend=ba;function _a(v,S){let z=D[v],E=v==0&&we==2?Jn:i[v],R;Bt?R=z.values(l,v,S)??Li:(R=z.value(l,S==null?null:E[S],v,S),R=R==null?Li:{_:R}),Re.values[v]=R}function Bi(v,S,z){Eo=vt,pl=xt,[vt,xt]=be.move(l,vt,xt),be.left=vt,be.top=xt,F&&(_i&&Lr(_i,dn(vt),0,Ce,me),Yr&&Lr(Yr,0,dn(xt),Ce,me));let E,R=Qt>Jt;wi=_t,zi=null;let H=J.ori==0?Ce:me,P=J.ori==1?Ce:me;if(vt<0||un==0||R){E=be.idx=null;for(let te=0;te0&&mt.show){let Hn=st==null?-10:st==E?ce:he(u==1?i[0][st]:i[ze][0][st],J,H,0),Sn=yt==null?-10:Oe(yt,u==1?G[mt.scale]:G[mt.facets[1].scale],P,0);if(ps&&yt!=null){let Bn=J.ori==1?vt:xt,Wn=mn(Nt.dist(l,ze,st,Sn,Bn));if(Wn=0?1:-1,Oi=qn>=0?1:-1;Oi==ei&&(Oi==1?Ei==1?yt>=qn:yt<=qn:Ei==1?yt<=qn:yt>=qn)&&(wi=Wn,zi=ze)}else wi=Wn,zi=ze}}if(Qn||gs){let Bn,Wn;J.ori==0?(Bn=Hn,Wn=Sn):(Bn=Sn,Wn=Hn);let Ei,qn,ei,Oi,qi,Nn,ti=!0,Jr=Tt.bbox;if(Jr!=null){ti=!1;let ut=Jr(l,ze);ei=ut.left,Oi=ut.top,Ei=ut.width,qn=ut.height}else ei=Bn,Oi=Wn,Ei=qn=Tt.size(l,ze);if(Nn=Tt.fill(l,ze),qi=Tt.stroke(l,ze),gs)ze==zi&&wi<=Nt.prox&&(de=ei,ge=Oi,De=Ei,Ie=qn,Je=ti,qe=Nn,je=qi);else{let ut=ui[ze];ut!=null&&(ir[ze]=ei,rr[ze]=Oi,p_(ut,Ei,qn,ti),h_(ut,Nn,qi),Lr(ut,Xi(ei),Xi(Oi),Ce,me))}}}}if(gs){let ze=Nt.prox,mt=Or==null?wi<=ze:wi>ze||zi!=Or;if(Qn||mt){let pt=ui[0];pt!=null&&(ir[0]=de,rr[0]=ge,p_(pt,De,Ie,Je),h_(pt,qe,je),Lr(pt,Xi(de),Xi(ge),Ce,me))}}}if(We.show&&Si)if(v!=null){let[te,ie]=$t.scales,[ce,de]=$t.match,[ge,De]=v.cursor.sync.scales,Ie=v.cursor.drag;if(qt=Ie._x,Vt=Ie._y,qt||Vt){let{left:Je,top:qe,width:je,height:ze}=v.select,mt=v.scales[ge].ori,pt=v.posToVal,Mt,st,yt,Hn,Sn,Bn=te!=null&&ce(te,ge),Wn=ie!=null&&de(ie,De);Bn&&qt?(mt==0?(Mt=Je,st=je):(Mt=qe,st=ze),yt=G[te],Hn=he(pt(Mt,ge),yt,H,0),Sn=he(pt(Mt+st,ge),yt,H,0),ur(br(Hn,Sn),mn(Sn-Hn))):ur(0,H),Wn&&Vt?(mt==1?(Mt=Je,st=je):(Mt=qe,st=ze),yt=G[ie],Hn=Oe(pt(Mt,De),yt,P,0),Sn=Oe(pt(Mt+st,De),yt,P,0),ya(br(Hn,Sn),mn(Sn-Hn))):ya(0,P)}else jo()}else{let te=mn(Eo-To),ie=mn(pl-Fr);if(J.ori==1){let De=te;te=ie,ie=De}qt=ht.x&&te>=ht.dist,Vt=ht.y&&ie>=ht.dist;let ce=ht.uni;ce!=null?qt&&Vt&&(qt=te>=ce,Vt=ie>=ce,!qt&&!Vt&&(ie>te?Vt=!0:qt=!0)):ht.x&&ht.y&&(qt||Vt)&&(qt=Vt=!0);let de,ge;qt&&(J.ori==0?(de=_s,ge=vt):(de=Qr,ge=xt),ur(br(de,ge),mn(ge-de)),Vt||ya(0,P)),Vt&&(J.ori==1?(de=_s,ge=vt):(de=Qr,ge=xt),ya(br(de,ge),mn(ge-de)),qt||ur(0,H)),!qt&&!Vt&&(ur(0,0),ya(0,0))}if(ht._x=qt,ht._y=Vt,v==null){if(z){if(tc!=null){let[te,ie]=$t.scales;$t.values[0]=te!=null?Ti(J.ori==0?vt:xt,te):null,$t.values[1]=ie!=null?Ti(J.ori==1?vt:xt,ie):null}wa(Im,l,vt,xt,Ce,me,E)}if(ps){let te=z&&$t.setSeries,ie=Nt.prox;Or==null?wi<=ie&&Ln(zi,lr,!0,te):wi>ie?Ln(null,lr,!0,te):zi!=Or&&Ln(zi,lr,!0,te)}}Qn&&(Re.idx=E,ba()),S!==!1&&en("setCursor")}let cr=null;Object.defineProperty(l,"rect",{get(){return cr==null&&Sa(!1),cr}});function Sa(v=!1){v?cr=null:(cr=T.getBoundingClientRect(),en("syncRect",cr))}function Ku(v,S,z,E,R,H,P){be._lock||Si&&v!=null&&v.movementX==0&&v.movementY==0||(Mo(v,S,z,E,R,H,P,!1,v!=null),v!=null?Bi(null,!0,!0):Bi(S,!0,!1))}function Mo(v,S,z,E,R,H,P,te,ie){if(cr==null&&Sa(!1),Ft(v),v!=null)z=v.clientX-cr.left,E=v.clientY-cr.top;else{if(z<0||E<0){vt=-10,xt=-10;return}let[ce,de]=$t.scales,ge=S.cursor.sync,[De,Ie]=ge.values,[Je,qe]=ge.scales,[je,ze]=$t.match,mt=S.axes[0].side%2==1,pt=J.ori==0?Ce:me,Mt=J.ori==1?Ce:me,st=mt?H:R,yt=mt?R:H,Hn=mt?E:z,Sn=mt?z:E;if(Je!=null?z=je(ce,Je)?m(De,G[ce],pt,0):-10:z=pt*(Hn/st),qe!=null?E=ze(de,qe)?m(Ie,G[de],Mt,0):-10:E=Mt*(Sn/yt),J.ori==1){let Bn=z;z=E,E=Bn}}ie&&(S==null||S.cursor.event.type==Im)&&((z<=1||z>=Ce-1)&&(z=Ka(z,Ce)),(E<=1||E>=me-1)&&(E=Ka(E,me))),te?(To=z,Fr=E,[_s,Qr]=be.move(l,z,E)):(vt=z,xt=E)}const xa={width:0,height:0,left:0,top:0};function jo(){pa(xa,!1)}let Gu,Yu,Fu,Qu;function ko(v,S,z,E,R,H,P){Si=!0,qt=Vt=ht._x=ht._y=!1,Mo(v,S,z,E,R,H,P,!0,!1),v!=null&&(Gt(Pm,dp,Ju,!1),wa(a_,l,_s,Qr,Ce,me,null));let{left:te,top:ie,width:ce,height:de}=We;Gu=te,Yu=ie,Fu=ce,Qu=de}function Ju(v,S,z,E,R,H,P){Si=ht._x=ht._y=!1,Mo(v,S,z,E,R,H,P,!1,!0);let{left:te,top:ie,width:ce,height:de}=We,ge=ce>0||de>0,De=Gu!=te||Yu!=ie||Fu!=ce||Qu!=de;if(ge&&De&&pa(We),ht.setScale&&ge&&De){let Ie=te,Je=ce,qe=ie,je=de;if(J.ori==1&&(Ie=ie,Je=de,qe=te,je=ce),qt&&sr(V,Ti(Ie,V),Ti(Ie+Je,V)),Vt)for(let ze in G){let mt=G[ze];ze!=V&&mt.from==null&&mt.min!=_t&&sr(ze,Ti(qe+je,ze),Ti(qe,ze))}jo()}else be.lock&&(be._lock=!be._lock,Bi(S,!0,v!=null));v!=null&&(Kn(Pm,dp),wa(Pm,l,vt,xt,Ce,me,null))}function yd(v,S,z,E,R,H,P){if(be._lock)return;Ft(v);let te=Si;if(Si){let ie=!0,ce=!0,de=10,ge,De;J.ori==0?(ge=qt,De=Vt):(ge=Vt,De=qt),ge&&De&&(ie=vt<=de||vt>=Ce-de,ce=xt<=de||xt>=me-de),ge&&ie&&(vt=vt<_s?0:Ce),De&&ce&&(xt=xt{let R=$t.match[2];z=R(l,S,z),z!=-1&&Ln(z,E,!0,!1)},F&&(Gt(a_,T,ko),Gt(Im,T,Ku),Gt(l_,T,v=>{Ft(v),Sa(!1)}),Gt(o_,T,yd),Gt(u_,T,Xu),_p.add(l),l.syncRect=Sa);const vl=l.hooks=n.hooks||{};function en(v,S,z){hl?da.push([v,S,z]):v in vl&&vl[v].forEach(E=>{E.call(null,l,S,z)})}(n.plugins||[]).forEach(v=>{for(let S in v.hooks)vl[S]=(vl[S]||[]).concat(v.hooks[S])});const ec=(v,S,z)=>z,$t=an({key:null,setSeries:!1,filters:{pub:__,sub:__},scales:[V,D[1]?D[1].scale:null],match:[S_,S_,ec],values:[null,null]},be.sync);$t.match.length==2&&$t.match.push(ec),be.sync=$t;const tc=$t.key,Ro=tx(tc);function wa(v,S,z,E,R,H,P){$t.filters.pub(v,S,z,E,R,H,P)&&Ro.pub(v,S,z,E,R,H,P)}Ro.sub(l);function bd(v,S,z,E,R,H,P){$t.filters.sub(v,S,z,E,R,H,P)&&Nr[v](null,S,z,E,R,H,P)}l.pub=bd;function _d(){Ro.unsub(l),_p.delete(l),vn.clear(),pp(Pf,no,Wu),g.remove(),re?.remove(),en("destroy")}l.destroy=_d;function Co(){en("init",n,i),yo(i||n.data,!1),fe[V]?ha(V,fe[V]):ol(),rl=We.show&&(We.width>0||We.height>0),Yt=Qn=!0,sl(n.width,n.height)}return D.forEach(Sr),X.forEach(pd),a?a instanceof HTMLElement?(a.appendChild(g),Co()):a(l,Co):Co(),l}on.assign=an;on.fmtNum=ag;on.rangeNum=Kf;on.rangeLog=sd;on.rangeAsinh=rg;on.orient=nl;on.pxRatio=rt;on.join=LM;on.fmtDate=og,on.tzDate=QM;on.sync=tx;{on.addGap=k4,on.clipGaps=od;let n=on.paths={points:lx};n.linear=ux,n.stepped=D4,n.bars=U4,n.spline=$4}const hx=(n,i,a,l,u)=>{if(!Number.isFi)DELIM" -R"DELIM(nite(a)||!Number.isFinite(l)||l<=a)return[];const f=[];if(Math.asinh(l)-Math.asinh(a)<1.5){const p=Number.isFinite(u)&&u>0?u:(l-a)/4,g=Math.ceil(a/p)*p;for(let b=0;b<100;b++){const y=Number((g+b*p).toPrecision(14));if(y>l)break;f.push({value:y,priority:y===0?0:1})}}else{const p=Math.ceil(Math.log10(Math.max(Math.abs(a),Math.abs(l))));for(let g=Math.min(-1,p-1);g<=p;g++)for(const b of[1,2,5]){const y=b*10**g;for(const w of[-y,y])Number.isFinite(w)&&w>=a&&w<=l&&f.push({value:w,priority:b===1?1:2})}a<=0&&l>=0&&f.push({value:0,priority:0})}f.sort((p,g)=>p.priority-g.priority||p.value-g.value);const d=[],m=[];for(const{value:p}of f){const g=n.valToPos(p,"y");Number.isFinite(g)&&m.every(b=>Math.abs(g-b)>=36)&&(d.push(p),m.push(g))}return d.sort((p,g)=>p-g),d};function mx(n,i){const a=Rt.indexOf(n.toLowerCase());return a===-1?n:i.getPropertyValue(`--chart-color-${String(a)}`).trim()||n}function F4(n){const i=n.filter(([,a])=>a>0).map(([a,l])=>({minimumRate:a,virtualSize:l}));return i.sort((a,l)=>a.minimumRate-l.minimumRate),i}const Q4=new Intl.NumberFormat(void 0,{maximumSignificantDigits:8}),J4=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function xp(n){return Q4.format(n)}function px(n){return`${J4.format(n)} vB`}function X4({snapshot:n,now:i,color:a,scale:l}){const u=se.useMemo(()=>F4(n?.data.histogram??[]),[n]),f=n!==null&&i-n.receivedAt>=Zu,d=n===null?"Waiting for transaction-pool fee data…":f?"Fee distribution is stale. Waiting for a fresh pool snapshot…":n.data.count===0?"The transaction pool is empty.":u.length===0?"No fee distribution is available for this pool snapshot.":null;return x.jsxs("div",{className:"space-y-3",children:[d?x.jsx("p",{role:"status",className:"text-textMuted flex min-h-72 items-center justify-center px-4 text-center text-sm",children:d}):x.jsxs(x.Fragment,{children:[x.jsx(W4,{bins:u,color:a,scale:l}),x.jsx("p",{className:"text-textMuted text-xs",children:"Each bar is a fee-rate group, labeled by its minimum rate. Bar height is virtual size, not transaction count. Groups are spaced evenly."}),x.jsxs("details",{className:"border-accentSecondary/20 rounded-md border text-xs",children:[x.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-3 py-2",children:["View ",pn(u.length)," fee-rate ",u.length===1?"group":"groups"]}),x.jsx("div",{className:"border-accentSecondary/20 max-h-56 overflow-auto border-t",children:x.jsxs("table",{className:"w-full text-left tabular-nums",children:[x.jsx("caption",{className:"sr-only",children:"Transaction-pool fee-rate groups"}),x.jsx("thead",{className:"bg-surface text-textMuted sticky top-0",children:x.jsxs("tr",{children:[x.jsx("th",{scope:"col",className:"px-3 py-2",children:"Minimum rate (sat/vB)"}),x.jsx("th",{scope:"col",className:"px-3 py-2 text-right",children:"Virtual size (vB)"})]})}),x.jsx("tbody",{className:"divide-accentSecondary/20 divide-y",children:u.map((m,p)=>x.jsxs("tr",{children:[x.jsx("td",{className:"px-3 py-2",children:xp(m.minimumRate)}),x.jsx("td",{className:"px-3 py-2 text-right",children:pn(m.virtualSize)})]},p))})]})})]})]}),n&&x.jsxs("p",{className:"text-textMuted text-xs",children:[f?"Last snapshot":"Snapshot"," ",Uu(n.receivedAt),!f&&` · ${pn(n.data.count)} transactions · ${px(n.data.virtual)}`]})]})}function W4({bins:n,color:i,scale:a}){const l=Rp(),u=se.useRef(null),f=se.useRef(null),d=se.useRef(n);return se.useLayoutEffect(()=>{d.current=n;const m=f.current;m&&(m.setData([n.map((p,g)=>g),n.map(p=>p.virtualSize)]),m.redraw(!1,!0))},[n]),se.useLayoutEffect(()=>{const m=u.current;if(!m)return;const p=getComputedStyle(m),g=mx(i,p),b=`12px ${p.fontFamily}`,y=[d.current.map((A,k)=>k),d.current.map(A=>A.virtualSize)],w={width:Math.max(240,m.clientWidth),height:280,padding:[12,12,0,0],cursor:{drag:{x:!1,y:!1}},legend:{show:!0,live:!0},scales:{x:{time:!1,range:()=>[-.5,d.current.length-.5]},y:{distr:a==="compressed"?4:1,asinh:1,range:(A,k,L)=>[0,Math.max(1,L*1.08)]}},axes:[{stroke:p.color,font:b,grid:{show:!1},ticks:{stroke:p.getPropertyValue("--chart-ticks").trim(),width:1},splits:A=>{const k=d.current,L=Math.max(1,Math.ceil(k.length/Math.max(1,Math.floor(A.width/80))));return k.map((D,X)=>X).filter(D=>D%L===0)},values:(A,k)=>k.map(L=>xp(d.current[L].minimumRate))},{size:76,stroke:p.color,font:b,grid:{stroke:p.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:p.getPropertyValue("--chart-ticks").trim(),width:1},values:(A,k)=>k.map(L=>pn(L)),...a==="compressed"?{splits:hx,filter:(A,k)=>k}:{}}],series:[{label:"Min rate",value:(A,k)=>{const L=k===null?void 0:d.current[k];return L?`${xp(L.minimumRate)} sat/vB`:"—"}},{label:"Virtual size",stroke:g,fill:`${g}90`,width:1,points:{show:!1},paths:on.paths.bars?.({size:[.85,48]}),value:(A,k)=>k===null?"—":px(k)}]},O=new on(w,y,m);f.current=O;const T=new ResizeObserver(A=>{const k=A[0]?.contentRect.width;k&&k>0&&O.setSize({width:Math.round(k),height:280})});return T.observe(m),()=>{T.disconnect(),O.destroy(),f.current=null}},[i,a,l]),x.jsxs("div",{role:"img","aria-label":"Transaction-pool fee distribution: virtual size in vbytes by minimum fee rate in satoshis per vbyte",children:[x.jsx("p",{className:"text-textMuted mb-2 text-xs",children:"Virtual size (vB)"}),x.jsx("div",{ref:u,className:"text-textMuted min-w-0 overflow-hidden"}),x.jsx("p",{className:"text-textMuted text-center text-xs",children:"Minimum fee rate per group (sat/vB)"})]})}function ej({data:n,series:i,height:a=280,emptyMessage:l="Waiting for live data…",valueSuffix:u="",zeroBased:f=!0,valueFormatter:d=rj,visualization:m="line",scale:p="linear",forceEmpty:g=!1}){const b=Rp(),y=se.useRef(null),w=se.useRef(null),O=se.useRef(!1),T=se.useRef(null),A=se.useMemo(()=>ij(n),[n]),k=se.useRef(A),L=!g&&n[0]?.length>0;return se.useLayoutEffect(()=>{k.current=A},[A]),se.useLayoutEffect(()=>{const D=y.current;if(!D)return;const X=getComputedStyle(D),G=`12px ${X.fontFamily}`,ee={width:Math.max(240,D.clientWidth),height:a,padding:[12,8,0,0],cursor:{drag:{x:!0,y:!1,setScale:!0},focus:{prox:24}},hooks:{setSelect:[ye=>{ye.select.width>0&&(O.current=!0)}]},legend:{show:!0,live:!0},scales:{x:{time:!0},y:{auto:!0,distr:p==="compressed"?4:1,asinh:1,...f?{range:(ye,ue,J)=>[Math.min(0,ue),J===0?1:J*1.08]}:{range:(ye,ue,J)=>{const we=J-ue,he=we===0?Math.max(1,Math.abs(J)*5e-4):we*.08;return[ue-he,J+he]}}}},axes:[{stroke:X.color,grid:{stroke:X.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:X.getPropertyValue("--chart-ticks").trim(),width:1},font:G},{size:72,stroke:X.color,grid:{stroke:X.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:X.getPropertyValue("--chart-ticks").trim(),width:1},font:G,values:(ye,ue)=>ue.map(J=>J===null?null:`${d(J)}${u}`),...p==="compressed"?{splits:hx,filter:(ye,ue)=>ue}:{}}],series:[{},...i.map((ye,ue)=>{const J=mx(ye.color,X),we=m==="step"?on.paths.stepped?.({align:1}):m==="bar"?tj(ue,i.length):void 0;return{label:ye.label,stroke:J,fill:m==="area"||m==="bar"?ye.fill??`${J}24`:ye.fill,width:ye.width??2,paths:we,points:{show:m==="line"?ye.points??!1:!1},value:(he,Oe)=>Oe===null?"—":`${d(Oe)}${u}`}})]},V=new on(ee,k.current,D),ne=T.current;ne&&V.setScale("x",ne),w.current=V;const ae=new ResizeObserver(ye=>{const ue=ye[0]?.contentRect.width;ue&&ue>0&&V.setSize({width:Math.round(ue),height:a})});return ae.observe(D),()=>{T.current=O.current&&V.scales.x.min!=null&&V.scales.x.max!=null?{min:V.scales.x.min,max:V.scales.x.max}:null,ae.disconnect(),V.destroy(),w.current=null}},[a,i,d,u,m,f,p,b]),se.useEffect(()=>{const D=w.current;if(!D)return;const X=!O.current;D.setData(A,X),X||D.redraw()},[A]),x.jsxs("div",{className:"relative min-w-0",children:[x.jsx("div",{ref:y,className:"text-textMuted min-w-0 overflow-hidden"}),!L&&x.jsx("div",{className:"bg-surface text-textMuted pointer-events-none absolute inset-0 z-10 flex items-center justify-center text-sm",children:l})]})}function tj(n,i){const a=Math.max(1,i);return on.paths.bars?.({size:[1,48/a,0],disp:{x0:{unit:1,values:l=>{const u=)DELIM" -R"DELIM(V_(l,a),f=-u.groupWidth/2+u.barWidth*n;return Array.from(l.data[0],d=>d+f)}},size:{unit:1,values:l=>[V_(l,a).barWidth]}}})}function V_(n,i){const a=nj(n.data[0]),l=Math.abs(n.posToVal(48,"x")-n.posToVal(0,"x")),u=Math.min(a*.72,l);return{groupWidth:u,barWidth:u/i}}function nj(n){let i=Number.POSITIVE_INFINITY,a;for(const l of n)if(Number.isFinite(l)){if(a!==void 0){const u=Math.abs(l-a);u>0&&u=2)return n;const a=Date.now()/1e3,l=i[0]??a,u=[l-1,l],f=n.slice(1).map(d=>{const m=d[0]??null;return[m,m]});return[u,...f]}function rj(n){return Math.abs(n)>=1e6?`${(n/1e6).toFixed(1)}m`:Math.abs(n)>=1e3?`${(n/1e3).toFixed(1)}k`:Math.abs(n)>=10?n.toFixed(0):Math.abs(n)>=1?n.toFixed(1):n.toFixed(2)}const sj={300:"5m",900:"15m",3600:"1h"},aj=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),lj=new Intl.NumberFormat(void 0,{maximumFractionDigits:2});function oj(n){return aj.format(n)}function uj(n){return lj.format(n)}function cj(n){return n==="height"||n==="occurrences"?oj:uj}function fj({metrics:n}){const i=ES(),[a,l]=se.useState(L3),[u,f]=se.useState(null),[d,m]=se.useState(!1);se.useEffect(()=>{H3(a)},[a]);function p(y){l(w=>u?.mode==="add"?w.length>=Wl?w:[...w,y]:w.map(O=>O.id===y.id?y:O)),f(null)}function g(y,w){l(O=>{const T=y+w;if(T<0||T>=O.length)return O;const A=[...O],k=A[y],L=A[T];return A[y]=L,A[T]=k,A})}function b(){if(!d){m(!0);return}l(jf()),m(!1)}return x.jsxs("section",{className:"space-y-4",children:[x.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Live telemetry"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Custom charts"}),x.jsxs("p",{className:"text-textMuted mt-1 text-sm",children:["Session data only · ",String(a.length)," of ",String(Wl)," charts"]})]}),x.jsxs("div",{className:"flex flex-wrap gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{m(!1),f({mode:"add",chart:SS()})},disabled:a.length>=Wl,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-40",children:"Add chart"}),x.jsx("button",{type:"button",onClick:b,onBlur:()=>{m(!1)},className:`rounded-md border px-3 py-2 text-sm font-medium ${d?"border-amber-400/60 text-amber-200":"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary"}`,children:d?"Confirm reset":"Reset defaults"})]})]}),a.length===0?x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border border-dashed px-6 py-16 text-center",children:[x.jsx("p",{className:"text-textPrimary font-medium",children:"No charts in this dashboard."}),x.jsx("p",{className:"text-textMuted mt-2 text-sm",children:"Add a custom chart or start from a template."})]}):x.jsx("div",{className:"grid gap-6 xl:grid-cols-2",children:a.map((y,w)=>x.jsx(dj,{chart:y,metrics:n,now:i,canMoveEarlier:w>0,canMoveLater:w{l(O=>O.map(T=>T.id===y.id?{...T,scale:T.scale==="compressed"?"linear":"compressed"}:T))},onDelete:()=>{l(O=>O.filter(T=>T.id!==y.id))},onDuplicate:()=>{l(O=>O.length>=Wl?O:[...O,$3(y)])},onEdit:()=>{f({mode:"edit",chart:y})},onMoveEarlier:()=>{g(w,-1)},onMoveLater:()=>{g(w,1)}},y.id))}),u&&x.jsx(W3,{chart:u.chart,mode:u.mode,onCancel:()=>{f(null)},onSave:p},`${u.mode}-${u.chart.id}`)]})}function dj({chart:n,metrics:i,now:a,canMoveEarlier:l,canMoveLater:u,canDuplicate:f,onDelete:d,onDuplicate:m,onEdit:p,onMoveEarlier:g,onMoveLater:b,onToggleScale:y}){const[w,O]=se.useState(null),[T,A]=se.useState(0),k=w??i,L=se.useMemo(()=>ln(n)?P3(k,n):null,[n,k]),D=se.useMemo(()=>ln(n)?n.series.map(ee=>({label:ee.label??cs(ee.signalId).label,color:ee.color})):[],[n]),X=cj(L?.unit??"vbytes"),G=`Waiting for ${D.length===1?D[0]?.label?.toLowerCase():"the selected signals"}…`;return x.jsxs("article",{className:"border-accent/30 bg-surface/80 min-w-0 overflow-hidden rounded-2xl border",children:[x.jsx("header",{className:"border-accentSecondary/20 space-y-3 border-b px-4 py-4 sm:px-5",children:x.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[x.jsxs("div",{className:"min-w-0",children:[x.jsx("h3",{className:"text-accent truncate text-lg font-semibold",title:n.title,children:n.title}),x.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:[ln(n)&&L?`${TS(L.unit)} · ${sj[n.range]} · ${n.visualization}`:"Virtual size by fee-rate group · latest snapshot",n.scale==="compressed"?" · compressed scale":"",w?" · paused":""]})]}),x.jsxs("div",{className:"flex flex-wrap justify-end gap-1 text-xs",children:[x.jsx("button",{type:"button","aria-label":`Compress peaks for ${n.title}`,"aria-pressed":n.scale==="compressed",title:"Use a log-like Y axis to compress large peaks. Zero, negative values, and original measurements are preserved.",onClick:y,className:`rounded-md border px-2 py-1.5 ${n.scale==="compressed"?"border-accent/40 bg-accentSecondary/20 text-accent":"border-accent/30 text-textMuted hover:text-accent hover:bg-accentSecondary/10"}`,children:"Compress peaks"}),x.jsx(Pa,{label:w?"Resume chart":"Pause chart",onClick:()=>{O(ee=>ee?null:ln(n)?i:{...i,now:a})},children:w?"Resume":"Pause"}),ln(n)&&x.jsx(Pa,{label:"Reset chart zoom",onClick:()=>{A(ee=>ee+1)},children:"Reset zoom"}),x.jsx(Pa,{label:"Edit chart",onClick:p,children:"Edit"}),x.jsx(Pa,{label:"Duplicate chart",onClick:m,disabled:!f,children:"Duplicate"}),x.jsx(Pa,{label:`Move ${n.title} earlier`,onClick:g,disabled:!l,children:"←"}),x.jsx(Pa,{label:`Move ${n.title} later`,onClick:b,disabled:!u,children:"→"}),x.jsx(Pa,{label:"Delete chart",onClick:d,danger:!0,children:"Delete"})]})]})}),x.jsx("div",{className:"min-w-0 p-3 sm:p-5",children:ln(n)&&L?x.jsx(ej,{data:L.data,series:D,visualization:n.visualization,scale:n.scale,zeroBased:G3(L.unit),valueFormatter:X,valueSuffix:K3(L.unit),forceEmpty:!L.hasObservedData,emptyMessage:G},T):!ln(n)&&x.jsx(X4,{snapshot:k.poolSnapshot,now:w?.now??a,color:n.color,scale:n.scale})}),n.scale==="compressed"&&x.jsx("p",{className:"text-textMuted px-5 pb-3 text-[11px]",children:"Log-like Y axis · peaks compressed · labels and hover values show original measurements."}),ln(n)&&n.series.some(ee=>ee.signalId==="event:10")&&x.jsx("p",{className:"text-textMuted px-5 pb-3 text-[11px]",children:"Archival includes compact-block recovery; rejected and duplicate submissions are excluded."}),L&&L.unobservedLabels.length>0&&L.hasObservedData&&x.jsxs("footer",{className:"border-accent/10 text-textMuted border-t px-5 py-2 text-[11px]",children:["Not observed this session: ",L.unobservedLabels.join(", ")]})]})}function Pa({label:n,children:i,onClick:a,disabled:l=!1,danger:u=!1}){return x.jsx("button",{type:"button","aria-label":n,onClick:a,disabled:l,className:`rounded-md px-2 py-1.5 disabled:cursor-not-allowed disabled:opacity-30 ${u?"text-textMuted hover:bg-red-500/10 hover:text-red-300":"text-textMuted hover:text-accent hover:bg-accentSecondary/10"}`,children:i})}const hj=[{event:0,label:"Header archived"},{event:3,label:"Block archived"},{event:5,label:"Block validated"},{event:6,label:"Block confirmed"},{event:13,label:"Block organized"},{event:14,label:"Block reorganized"}];function mj({adminStatus:n,endpoints:i,metrics:a,native:l,sync:u}){const f=O3(a,10),d=l.configuration,m=aS(d?.forks??[]),p=pj(n,l.status),g=[n.error?`Admin: ${n.error}`:null,l.status.error?`Native: ${l.status.error}`:null,l.transport==="none"&&l.restError?`Native REST: ${l.restError}`:null,a.invalidFrames>0?`${String(a.invalidFrames)} malformed admin frame${a.invalidFrames===1?"":"s"} ignored`:null,l.live.invalidFrames>0?`${String(l.live.invalidFrames)} malformed native frame${l.live.invalidFrames===1?"":"s"} ignored`:null,l.status.phase==="connected"&&l.transport==="none"?"Native: Connect)DELIM" -R"DELIM(ed, but no fresh valid state has been received":null].filter(b=>b!==null);return x.jsxs("div",{className:"space-y-6",children:[g.length>0&&x.jsxs("section",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3",children:[x.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Transport notice"}),x.jsx("ul",{className:"text-textMuted mt-1 space-y-1 text-xs",children:g.map(b=>x.jsx("li",{children:b},b))})]}),x.jsx(M3,{sync:u}),x.jsxs("dl",{"aria-label":"Node summary",className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-4",children:[x.jsx(Sf,{label:"Current top",value:l.top===null?"—":pn(l.top),detail:l.transport==="none"?"Waiting for native API":`${vj(u)} · via ${l.transport==="websocket"?"native WebSocket":"REST fallback"}`,emphasized:!0}),x.jsx(Sf,{label:"Current activity",value:f.label,detail:f.rate>0?`${qA(f.rate)} over the last 10 seconds`:"No lifecycle events in the last 10 seconds",numeric:!1}),x.jsx(Sf,{label:"Collection uptime",value:BA(a.now-a.sessionStartedAt),detail:`${pn(a.totalEvents)} events · ${pn(a.totalLogs)} logs`}),x.jsx(Sf,{label:"Connection",value:p.phase==="connected"?XA(i.adminUrl).replace(/\/$/u,""):"[disconnected]",detail:`${p.lastMessageAt?`Last frame ${Uu(p.lastMessageAt)}`:"Waiting for the first frame"} · ${String(p.reconnects)} reconnect${p.reconnects===1?"":"s"}`,numeric:!1})]}),x.jsx(fj,{metrics:a}),x.jsxs("section",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-2xl border",children:[x.jsxs("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Lifecycle heights"}),x.jsx("h2",{className:"text-accent mt-1 text-lg font-semibold",children:"Highest observed event values"})]}),x.jsx("div",{className:"bg-accentSecondary/10 grid gap-px sm:grid-cols-2 lg:grid-cols-3",children:hj.map(({event:b,label:y})=>{const w=a.signalMaximums[Ui(b)];return x.jsxs("div",{className:"bg-surface px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:y}),x.jsx("p",{className:"text-textPrimary mt-2 text-xl font-semibold tabular-nums",children:w===void 0?"—":pn(w)})]},b)})})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsxs("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Capabilities"}),x.jsx("h2",{className:"text-accent mt-1 text-lg font-semibold",children:"Native configuration"})]}),d?x.jsxs("div",{className:"space-y-4 p-5 text-sm",children:[x.jsxs(_u,{title:"Store configuration",children:[x.jsx(Qm,{items:[["Address index",d.store.address],["Client filters index",d.store.filter],["Silent payments index",d.store.silent!==null],["Turbo",d.store.turbo]]}),x.jsx(Tf,{items:[["Silent payments from",d.store.silent===null?"Not indexed":pn(d.store.silent)]]})]}),x.jsxs(_u,{title:"Node services",children:[x.jsx(Qm,{items:[["Blocks",d.node.blocks],["Limited",d.node.limited],["Witness",d.node.witness],["Filters",d.node.filters],["Privacy",d.node.privacy]]}),x.jsx(Tf,{items:[["Inputs pruned below",d.store.pruned>0?pn(d.store.pruned):"Not pruned"]]})]}),d.network&&x.jsxs(_u,{title:"Peer protocol",children:[x.jsx(Qm,{items:[["Relay",d.network.relay],["Compact",d.network.compact],["Address",d.network.address],["Witness tx",d.network.witness_tx],["Memory pool",d.network.memory_pool],["Not found",d.network.not_found],["Reject",d.network.reject],["Alert",d.network.alert]]}),x.jsx(Tf,{items:[["Protocol minimum",String(d.network.protocol_minimum)],["Protocol maximum",String(d.network.protocol_maximum)]]})]}),d.wallet&&x.jsx(_u,{title:"Wallet",children:x.jsx(Tf,{items:[["P2PKH version",String(d.wallet.p2kh),Ia(m,"p2kh",d.wallet.p2kh)],["P2SH version",String(d.wallet.p2sh),Ia(m,"p2sh",d.wallet.p2sh)],["WIF version",String(d.wallet.wif),Ia(m,"wif",d.wallet.wif)],["Witness prefix",d.wallet.witness,Ia(m,"witness",d.wallet.witness)],["Silent prefix",d.wallet.silent,Ia(m,"silent",d.wallet.silent)],["HD private",P_(d.wallet.hd_private),Ia(m,"hdPrivate",d.wallet.hd_private)],["HD public",P_(d.wallet.hd_public),Ia(m,"hdPublic",d.wallet.hd_public)]]})}),x.jsx(_u,{title:"Configured forks",children:x.jsx("div",{className:"flex flex-wrap gap-1.5",children:d.forks.map(b=>x.jsx("span",{className:"text-textPrimary bg-accentSecondary/15 rounded-full px-2 py-0.5 font-mono text-xs",children:b},b))})})]}):x.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:"Waiting for native configuration."})]})]}),x.jsx("section",{children:x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsx("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Recent events"})}),a.recentEvents.length===0?x.jsx(gj,{text:"No events observed yet."}):x.jsx("ul",{className:"divide-accentSecondary/20 divide-y",children:a.recentEvents.slice(0,6).map(b=>x.jsxs("li",{className:"flex items-center gap-3 px-5 py-3 text-xs",children:[x.jsx("time",{className:"text-textMuted w-24 shrink-0 font-mono",children:Uu(b.time)}),x.jsx("span",{className:"text-textPrimary min-w-0 flex-1 truncate font-mono",children:mo(b.event).name}),x.jsx("span",{className:"text-accent tabular-nums",children:sS(b.event,b.value)})]},b.id))})]})})]})}const I_={connected:0,connecting:1,reconnecting:2,idle:3};function pj(n,i){const a=I_[i.phase]>I_[n.phase]?i:n,l=Math.max(n.lastMessageAt??0,i.lastMessageAt??0);return{...a,reconnects:n.reconnects+i.reconnects,lastMessageAt:l>0?l:null}}function _u({title:n,children:i}){return x.jsxs("section",{className:"border-accentSecondary/20 space-y-2 border-t pt-3 first:border-t-0 first:pt-0",children:[x.jsx("h3",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:n}),i]})}function Qm({items:n}){const i=n.filter(([,a])=>a!==void 0);return x.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(([a,l])=>x.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs ${l?"border-emerald-500/50 bg-emerald-500/15 text-emerald-300":"text-textMuted border-slate-500/40"}`,children:a},a))})}function Tf({items:n}){const i=n.some(l=>l.length>2),a=i?"grid-cols-[10rem_max-content_auto]":"grid-cols-[10rem_max-content]";return x.jsx("dl",{className:`grid ${a} items-baseline gap-x-4 gap-y-1`,children:n.map(([l,u,f])=>x.jsxs(se.Fragment,{children:[x.jsx("dt",{className:"text-textMuted",children:l}),x.jsx("dd",{className:"text-textPrimary font-mono",children:u}),i&&x.jsx("dd",{className:"text-textMuted",children:f})]},l))})}function P_(n){return`0x${n.toString(16).padStart(8,"0")}`}function gj({text:n}){return x.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:n})}function vj(n){return n?n.diverged?"Candidate branch diverges":n.blocksRemaining===0?"At top candidate header":n.blocksRemaining<=td?`Near current, ${pn(n.blocksRemaining)} blocks remaining`:`${pn(n.blocksRemaining)} blocks remaining`:"Waiting for chain tops"}const yj=8e3;function bj({sync:n,browserNotificationsEnabled:i}){const a=se.useRef(null),[l,u]=se.useState(null),f=n?.blocksRemaining??null;if(se.useEffect(()=>{const m=Sj(f);if(!m)return;const p=a.current;if(a.current=m.state,!(p===null||p===m.state)&&(u(m),i)){const g=_j(m);Yz(g.title,{body:g.body,tag:"libbitcoin-sync-status"})}},[i,f]),se.useEffect(()=>{if(!l)return;const m=setTimeout(()=>{u(p=>p===l?null:p)},yj);return()=>{clearTimeout(m)}},[l]),!l)return null;const d=l.state==="near-current";return x.jsx("aside",{role:"status","aria-live":"polite","aria-atomic":"true",className:`fixed right-4 bottom-4 left-4 z-[60] rounded-xl border p-4 shadow-2xl shadow-black/50 sm:left-auto sm:w-96 ${d?"bg-noticeSuccess/95 border-emerald-400/35":"bg-noticeWarning/95)DELIM" -R"DELIM( border-amber-400/35"}`,children:x.jsxs("div",{className:"flex items-start gap-4",children:[x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx("p",{className:d?"font-semibold text-emerald-200":"font-semibold text-amber-200",children:d?"Node near current":"Node fell behind"}),x.jsx("p",{className:"text-noticeText/75 mt-1 text-sm",children:wp(l)})]}),x.jsx("button",{type:"button","aria-label":"Dismiss synchronization notification",onClick:()=>{u(null)},className:"text-noticeText/60 hover:text-noticeText text-lg leading-none",children:"×"})]})})}function _j(n){return n.state==="near-current"?{title:"Libbitcoin node near current",body:wp(n)}:{title:"Libbitcoin node fell behind",body:wp(n)}}function Sj(n){return n===null?null:{state:n<=td?"near-current":"behind",blocksBehind:n}}function wp(n){return n.state==="near-current"?`Confirmed top is within ${String(td)} blocks of the top candidate header.`:`Confirmed top is ${pn(n.blocksBehind)} blocks below the top candidate header.`}const gx='(function(){"use strict";function je(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function gt(e,t="|"){return e.map(n=>kt(n)).join(t)}function Me(e,t){return typeof t=="bigint"?t.toString():t}class vr{constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}}function Le(e){return new vr(e)}function br(e){return e==null}function Fe(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function yr(e,t){const n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r){const c=t._zod.def.shape[s];return r?r(c,s):c}):bt(e,s,r?r(o.value,s):o.value))}}function wr(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?vt(e,n,()=>t[n]):bt(e,n,r.value))}}function N(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function kr(e){return JSON.stringify(e)}function zr(e){return e.toLowerCase().trim().replace(/[^\\w\\s-]/g,"").replace(/[\\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const yt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function de(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Sr=Le(()=>{if(R.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Y(e){if(de(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(de(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function wt(e){return Y(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const $r=new Set(["string","number","symbol"]);function pe(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function K(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function kt(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Or(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const zt={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]},Er={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ir(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");const s={};return q(s,e,me(e,t)),K(e,N(n,{shape:s,checks:[]}))}function me(e,t){const n=x(e),r=[];for(const i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,i)?.enumerable)throw new Error(`Unrecognized key: "${String(i)}"`);t[i]&&r.push(i)}return r}function Tr(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 s=new Set(me(e,t)),o={};return q(o,e,Reflect.ownKeys(x(e)).filter(c=>!s.has(c))),K(e,N(n,{shape:o,checks:[]}))}function Pr(e,t){if(!Y(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=x(e);for(const s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return K(e,N(e._zod.def,{shape:St(e,t)}))}function St(e,t){const n={};return q(n,e,Reflect.ownKeys(x(e))),wr(n,t),n}function Zr(e,t){if(!Y(t))throw new Error("Invalid input to safeExtend: expected a plain object");return K(e,N(e._zod.def,{shape:St(e,t)}))}function Ar(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};q(n,e,Reflect.ownKeys(x(e))),q(n,t,Reflect.ownKeys(x(t)));const r=N(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return K(e,r)}function $t(e,t,n,r="partial"){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const c=n?new Set(me(t,n)):void 0,a={};return q(a,t,Reflect.ownKeys(x(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),K(t,N(t._zod.def,{shape:a,checks:[]}))}function Nr(e,t,n){const r=n?new Set(me(t,n)):void 0,i={};return q(i,t,Reflect.ownKeys(x(t)),(s,o)=>r&&!r.has(o)?s:new e({type:"nonoptional",innerType:s})),K(t,N(t._zod.def,{shape:i}))}function F(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function re(e){return typeof e=="string"?e:e?.message}function Ot(e){const t=[];for(const n of e??[]){const r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;const i=r.maximum??r.length??r.size;i>=0&&t.push([i,n])}return t}function Ce(e,t,n){var r;for(let i=t;ie;return t[Ur]=!0,t}var Tt;const Ke={value:void 0,enumerable:!1};let Pt="captureStackTrace"in Error?Error:null;function Jr(e){const t=Pt;if(t){const n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return Pt=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function f(e,t,n,r){const i={};function s(p){this.def=p,this.constr=h,this.traits=new Set}s.prototype=i;const o=n,c=o&&new WeakSet;function a(p,d){if(p._zod){if(p._zod.traits.has(e))return}else{Ke.value=new s(d);try{Object.defineProperty(p,"_zod",Ke)}finally{Ke.value=void 0}}if(p._zod.traits.add(e),t(p,d),c){const g=Object.getPrototypeOf(p),v=p._zod.constr.prototype;let b=g;for(;b&&b!==v;)b=Object.getPrototypeOf(b);const A=b??g;c.has(A)||(c.add(A),Lr(A,o))}const m=h.prototype;for(const g in m)Object.prototype.hasOwnProperty.call(m,g)&&(g in p||(p[g]=m[g].bind(p)))}const u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function h(p){const d=r?.Parent?Jr(l):this;a(d,p);const m=d._zod.deferred;if(m){for(const v of m)v();d._zod.deferred=void 0}const g=globalThis.__zod_globalConfig?.postProcessor;return g&&g(d),d}return Object.defineProperty(h,"init",{value:a}),Object.defineProperty(h,Symbol.hasInstance,{value:p=>r?.Parent&&p instanceof r.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(h,"name",{value:e}),h}class G extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Zt extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Tt=globalThis).__zod_globalConfig??(Tt.__zod_globalConfig={});const R=globalThis.__zod_globalConfig;function C(e){return e&&Object.assign(R,e),R}function Br(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Me,2)),e.message}function Vr(e){this._zod.message=e}const Wr={get:Br,set:Vr,enumerable:!0,configurable:!0},Je={value:void 0,enumerable:!1},At=new WeakSet([Object.prototype,Error.prototype]),qr=f("$ZodError",(e,t)=>{e.name="$ZodError",Je.value=t,Object.defineProperty(e,"issues",Je),Je.value=void 0,Object.defineProperty(e,"message",Wr);const n=Object.getPrototypeOf(e);At.has(n)||(At.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))});function Gr(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Hr(e,t=n=>n.message){const n={},r=[];for(const i of e.issues)i.path.length>0?Gr(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Yr(e,t=n=>n.message){const n={_errors:[]},r=(i,s=[])=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(c=>r({issues:c},[...s,...o.path]));else if(o.code==="invalid_key")r({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")r({issues:o.issues},[...s,...o.path]);else{const c=[...s,...o.path];if(c.length===0)n._errors.push(t(o));else{let a=n,u=0;for(;u{const t=(n,r,i,s)=>{const o=i?{...i,async:!1}:{async:!1},c=n._zod.run({value:r,issues:[]},o);if(c instanceof Promise)throw new G;if(c.issues.length){const a=new(s?.Err??e)(c.issues.map(u=>B(u,o,C())));throw yt(a,s?.callee??t),a}return c.value};return t},Ve=e=>{const t=async(n,r,i,s)=>{const o=i?{...i,async:!0}:{async:!0};let c=n._zod.run({value:r,issues:[]},o);if(c instanceof Promise&&(c=await c),c.issues.length){const a=new(s?.Err??e)(c.issues.map(u=>B(u,o,C())));throw yt(a,s?.callee??t),a}return c.value};return t},We=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 G;return s.issues.length?Nt(e,s.issues,i):{success:!0,data:s.value}};function Nt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(i=>B(i,n,C()))),t=void 0,n=void 0),r},set error(i){r=i,t=void 0,n=void 0}}}const qe=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?Nt(e,s.issues,i):{success:!0,data:s.value}},Xr=Symbol.for("zod.compile.invalid"),Qr=Symbol.for("zod.compile.fallback"),ei=((e,t,n)=>{const r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Xr)return!0;if(r.definite===!0&&n===void 0)return!1}return ti(e,t,n)});function ti(e,t,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun;let s;if(i?(r[Qr]=!0,s=i({value:t,issues:[]},r)):s=e._zod.run({value:t,issues:[]},r),s instanceof Promise)throw new G;return s.issues.length===0}const ni=async(e,t,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ri=e=>{const t=Be(e),n=(r,i,s,o)=>{const c=s?{...s,direction:"backward"}:{direction:"backward"};return t(r,i,c,ge(n,o))};return n},ii=e=>{const t=Be(e),n=(r,i,s,o)=>t(r,i,s,ge(n,o));return n},si=e=>{const t=Ve(e),n=async(r,i,s,o)=>{const c=s?{...s,direction:"backward"}:{direction:"backward"};return await t(r,i,c,ge(n,o))};return n},oi=e=>{const t=Ve(e),n=async(r,i,s,o)=>await t(r,i,s,ge(n,o));return n},ci=e=>(t,n,r)=>)DELIM" -R"DELIM({const i=r?{...r,direction:"backward"}:{direction:"backward"};return We(e)(t,n,i)},ai=e=>(t,n,r)=>We(e)(t,n,r),ui=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return qe(e)(t,n,i)},li=e=>async(t,n,r)=>qe(e)(t,n,r),fi=/^[cC][0-9a-z]{6,}$/,hi=/^[0-9a-z]+$/,di=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,pi=/^[0-9a-vA-V]{20}$/,mi=/^[A-Za-z0-9]{27}$/,gi=/^[a-zA-Z0-9_-]{21}$/;function _i(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const vi=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,bi=/^([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})$/,Rt=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)$/,yi=/^(?:[A-Za-z0-9_\'+\\-]+\\.)*[A-Za-z0-9_\'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,wi="^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$";function ki(){return new RegExp(wi,"u")}const zi=/^(?:(?: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])$/,Si=/^(([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}|:))$/,$i=/^((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])$/,Oi=/^(([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}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ei=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ii=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ti=/^https?$/,Pi=/^\\+[1-9]\\d{6,14}$/,jt="(?:(?:\\\\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])))";function Zi(e){return new RegExp(`^${e}$`)}const Ai=Zi(jt);function Ge(e){const t="(?:[01]\\\\d|2[0-3]):[0-5]\\\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\\\d`:`${t}:[0-5]\\\\d\\\\.\\\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\\\d(?:\\\\.\\\\d+)?`:`${t}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`}function Ni(e){return new RegExp(`^${Ge(e)}$`)}function Ri(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)");const n=`${Ge({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${Ge({precision:e.precision})}`:n;return new RegExp(`^${jt}T(?:${r})$`)}const ji=/^[\\s\\S]{0,}$/,Mi=/^-?\\d+$/,He=/^-?\\d+(?:\\.\\d+)?$/,Li=/^(?:true|false)$/i,Fi=/^[^A-Z]*$/,Ci=/^[^a-z]*$/,Z=f("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ye=e=>{const t=e.value;return!br(t)&&t.length!==void 0},_e={number:"number",bigint:"bigint",object:"date"},Mt=f("$ZodCheckLessThan",(e,t)=>{Z.init(e,t);const n=_e[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{Z.init(e,t);const n=_e[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:_e[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Di=f("$ZodCheckMultipleOf",(e,t)=>{Z.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):yr(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),xi=f("$ZodCheckNumberFormat",(e,t)=>{Z.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,s]=zt[t.format];e._zod.check=o=>{const c=o.value;if(n){if(!Number.isInteger(c)){o.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?o.issues.push({input:c,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}):o.issues.push({input:c,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});return}}cs&&o.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Ui=f("$ZodCheckMaxLength",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Ye),e._zod.check=r=>{const i=r.value,s=i.length;if((typeof i=="string"&&s>t.maximum?De(i):s)<=t.maximum)return;const c=xe(i);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ki=f("$ZodCheckMinLength",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Ye),e._zod.check=r=>{const i=r.value,s=i.length;if((typeof i=="string"&&s>=t.minimum&&s=t.minimum)return;const c=xe(i);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ji=f("$ZodCheckLengthEquals",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Ye),e._zod.check=r=>{const i=r.value,s=i.length,o=typeof i=="string"&&s>=t.length&&s<=t.length*2?De(i):s;if(o===t.length)return;const c=xe(i),a=o>t.length;r.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ve=f("$ZodCheckStringFormat",(e,t)=>{var n,r;Z.init(e,t),t.pattern?(n=e._zod).check??(n.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Bi=f("$ZodCheckRegex",(e,t)=>{ve.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})}}),Vi=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Fi),ve.init(e,t)}),Wi=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ci),ve.init(e,t)}),qi=f("$ZodCheckIncludes",(e,t)=>{Z.init(e,t);const n=pe(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),Gi=f("$ZodCheckStartsWith",(e,t)=>{Z.init(e,t);const n=new RegExp(`^${pe(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",f)DELIM" -R"DELIM(ormat:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Hi=f("$ZodCheckEndsWith",(e,t)=>{Z.init(e,t);const n=new RegExp(`.*${pe(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Yi=f("$ZodCheckOverwrite",(e,t)=>{Z.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Xi{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`\n`).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${n.join(`\n`)}\n};`)(...Object.values(this.closed))}}const Qi={major:4,minor:6,patch:7},k=f("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Qi;const r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(const s of i)for(const o of s._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(c,a,u)=>{if(c.memo)return c;let l=F(c),h;for(const p of a){if(p._zod.def.when){if(Rr(c)||!p._zod.def.when(c))continue}else if(l)continue;const d=c.issues.length,m=p._zod.check(c);if(m instanceof Promise&&u?.async===!1)throw new G;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await m,c.issues.length!==d&&(Ce(c.issues,d,e),l||(l=F(c,d)))});else{if(c.issues.length===d)continue;Ce(c.issues,d,e),l||(l=F(c,d))}}return h?h.then(()=>c):c},o=(c,a,u)=>{if(F(c))return c.aborted=!0,c;const l=s(a,i,u);if(l instanceof Promise){if(u.async===!1)throw new G;return l.then(h=>e._zod.parse(h,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){const l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(h=>o(h,c,a)):o(l,c,a)}const u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new G;return u.then(l=>s(l,i,a))}return s(u,i,a)}}},{get"~standard"(){return Et(this,"~standard",Ct(this))},set"~standard"(e){V(this,"~standard",e)}}),Ft=(e,t)=>e.issues.length?{issues:e.issues.map(n=>B(n,t,C()))}:{value:e.value};async function es(e,t){const n={async:!0};return Ft(await e._zod.run({value:t,issues:[]},n),n)}function Ct(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Ft(r,n)}catch{}return es(e,t)},vendor:"zod",version:1}}const Xe=f("$ZodString",(e,t)=>{k.init(e,t),e._zod.pattern=t.pattern??ji,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),z=f("$ZodStringFormat",(e,t)=>{ve.init(e,t),Xe.init(e,t)}),ts=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=bi),z.init(e,t)}),ns=f("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Rt(r))}else t.pattern??(t.pattern=Rt());z.init(e,t)}),rs=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=yi),z.init(e,t)}),Dt=1,be=2;function xt(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function is(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?xt(e)||be:ss(e,t)}function ss(e,t){if(!t.normalize&&t.protocol?.source===Ti.source&&!/^https?:\\/\\//i.test(e))return Dt;try{if(typeof URL<"u"){const n=URL;if(typeof n.parse=="function")return n.parse(e)??be}return new URL(e)}catch{return be}}const os=/[\\t\\n\\r]/g;function Ut(e){return e.replace(os,"")}function cs(e,t){return t.lastIndex=0,t.test(e.hostname)}function as(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const us=f("$ZodURL",(e,t)=>{z.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=is(r,t);if(i===Dt){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(i===be){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Ut(r);return}t.hostname&&!cs(i,t.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&&!as(i,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Ut(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ls=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ki()),z.init(e,t)}),fs=f("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?gi:_i(t.length)),z.init(e,t)}),hs=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=fi),z.init(e,t)}),ds=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=hi),z.init(e,t)}),ps=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=di),z.init(e,t)}),ms=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pi),z.init(e,t)}),gs=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=mi),z.init(e,t)}),_s=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ri(t)),z.init(e,t)}),vs=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ai),z.init(e,t)}),bs=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ni(t)),z.init(e,t)}),ys=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vi),z.init(e,t)}),ws=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=zi),z.init(e,t)}),ks=/^[0-9a-fA-F:.]+$/;function Kt(e){return ks.test(e)?xt(`http://[${e}]`):!1}const zs=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Si),z.init(e,t),e._zod.check=n=>{Kt(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Ss=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=$i),z.init(e,t)});function $s(e){const t=e.split("/");if(t.length!==2)return!1;const[n,r]=t;if(!r)return!1;const i=Number(r);return`${i}`!==r||i<0||i>128?!1:Kt(n)}const Os=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Oi),z.init(e,t),e._zod.check=n=>{$s(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Jt(e){if(e==="")return!0;if(/\\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Bt=/^[0-9a-zA-Z+/]*={0,2}$/,Es=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Bt),z.init(e,t),e._zod.check=n=>{Jt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Qe=/^[A-Za-z0-9_-]*$/;function Is(e){if(!Qe.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Jt(n)}const Ts=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qe),z.init(e,t),e._zod.check=n=>{Is(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Ps=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Pi),z.init(e,t)});function Zs(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const As=f("$ZodJWT",(e,t)=>{z.init(e,t),e._zod.check=n=>{Zs(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Vt=f("$ZodNumber",(e,t)=>{k.init(e,t),e._zod.pattern=He,e._zod.parse=(n,r)=>{if(t.coerce)DELIM" -R"DELIM()try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...s?{received:s}:{}}),n}}),Ns=f("$ZodNumberFormat",(e,t)=>{xi.init(e,t),Vt.init(e,t)}),Rs=f("$ZodBoolean",(e,t)=>{k.init(e,t),e._zod.pattern=Li,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),js=f("$ZodUnknown",(e,t)=>{k.init(e,t),e._zod.parse=n=>n}),Ms=f("$ZodNever",(e,t)=>{k.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ls(e,t){const n=Ot(e._zod.def.checks);if(!n.length)return;const r=Math.min(...n.map(s=>s[0])),i=e._zod.parse;e._zod.parse=(s,o)=>{const c=t(s.value);if(c>r&&!o?.skipChecks&&o?.direction!=="backward"){for(const[a,u]of Ot(e._zod.def.checks))if(c>a&&u._zod.def.when(s)){const l=s.issues.length;return u._zod.check(s),s.issues[l].continue=!1,Ce(s.issues,l,e),s}}return i(s,o)}}const Fs=e=>Array.isArray(e)?e.length:-1;function Wt(e,t,n){e.issues.length&&t.issues.push(...J(n,e.issues)),t.value[n]=e.value}const Cs=f("$ZodArray",(e,t)=>{k.init(e,t);const n=R.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=n?n.alloc(e,r,Array(s.length),i):Array(s.length);const o=[],c=i?.abortEarly;for(let a=0;aWt(h,r,a)));else if(Wt(l,r,a),c&&l.issues.length!==0&&F(l))break}return o.length?Promise.all(o).then(()=>r):r},Ls(e,Fs)});function ye(e,t,n,r,i,s){const o=n in r,c=s==="optional";if(!(!o&&c&&i==="optional")){if(e.issues.length){if(i!==void 0&&c&&!o)return;t.issues.push(...J(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(o||i==="defaulted"&&!c)&&(t.value[n]=void 0):t.value[n]=e.value}}const Ds=[];function qt(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Ds,i=r.length?[...t,...r]:t;for(const o of i)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(o)}": expected a Zod schema`);const s=Or(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Gt(e,t,n,r,i,s,o){const c=[],a=i.keySet,u=i.catchall._zod,l=u.def.type,h=u.optin,p=u.optout;let d=0;for(const m in t){if(o&&n.issues.length!==d){if(F(n,d))break;d=n.issues.length}if(a.has(m))continue;if(m==="__proto__"){l==="never"&&c.push(m);continue}if(l==="never"){c.push(m);continue}const g=u.run({value:t[m],issues:[]},r);g instanceof Promise?e.push(g.then(v=>ye(v,n,m,t,h,p))):ye(g,n,m,t,h,p)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const xs=f("$ZodObject",(e,t)=>{k.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){const u=()=>{const l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}const i=Le(()=>qt(t));y(e,"propValues",u=>{const l=u.def.shape,h={};for(const p in l){const d=l[p]._zod;if(d.values){Object.prototype.hasOwnProperty.call(h,p)||U(h,p,new Set);for(const m of d.values)h[p].add(m);d.optin!==void 0&&h[p].add(void 0)}}return h});const s=de,o=t.catchall;let c;const a=R.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=i.value);const h=u.value;if(!s(h))return u.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};const p=[],d=c.shape,m=l?.abortEarly;let g=u.issues.length;for(const v of c.allKeys){if(m&&u.issues.length!==g){if(F(u,g))break;g=u.issues.length}if(v==="__proto__")continue;const b=d[v],A=b._zod.optin,fe=b._zod.optout,he=b._zod.run({value:h[v],issues:[]},l);he instanceof Promise?p.push(he.then(I=>ye(I,u,v,h,A,fe))):ye(he,u,v,h,A,fe)}return o?Gt(p,h,u,l,i.value,e,m===!0):p.length?Promise.all(p).then(()=>u):u}}),Us=f("$ZodObjectJIT",(e,t)=>{xs.init(e,t);const n=e._zod.parse,r=Le(()=>qt(t)),i=R.memoizer,s=d=>{const m=r.value,g=m.symbolKeys,v=new Xi(["payload","ctx"],{shape:d,inst:e,memo:i,syms:g}),b=I=>`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`,A=(I,w)=>`\n let ${I}_ab = false;\n for (let i = 0; i < ${I}.issues.length; i++) {\n const iss = ${I}.issues[i];\n iss.path = iss.path ? [${w}, ...iss.path] : [${w}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${I}_ab = true;\n }\n if (${I}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;v.write("const input = payload.value;");const fe=Object.create(null);let he=0;for(const I of m.allKeys)fe[I]=`key_${he++}`;v.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const I of m.allKeys){if(I==="__proto__")continue;const w=fe[I],D=typeof I=="symbol"?`syms[${g.indexOf(I)}]`:kr(I),pt=`${D} in input`,gr=d[I],mt=gr?._zod?.optin,_r=mt!==void 0,Mu=gr?._zod?.optout==="optional";if(v.write(`const ${w} = ${b(D)};`),_r&&Mu){const Lu=mt==="optional"?`${w}_present`:`${w}.value !== undefined || ${w}_present`;v.write(`\n const ${w}_present = ${pt};\n if (!${w}.issues.length || ${w}_present) {\n if (${w}.issues.length) {${A(w,D)}\n }\n\n if (${Lu}) {\n newResult[${D}] = ${w}.value;\n }\n }\n\n `)}else _r?(v.write(`\n if (${w}.issues.length) {${A(w,D)}\n }\n `),mt==="defaulted"?v.write(`newResult[${D}] = ${w}.value;`):v.write(`\n if (${w}.value !== undefined || ${pt}) {\n newResult[${D}] = ${w}.value;\n }\n `)):v.write(`\n const ${w}_present = ${pt};\n if (${w}.issues.length) {${A(w,D)}\n }\n if (!${w}_present && !${w}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${D}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${w}_present) {\n newResult[${D}] = ${w}.value;\n }\n\n `)}return v.write("payload.value = newResult;"),v.write("return payload;"),v.compile()};let o;const c=de,a=!R.jitless,l=a&&Sr.value,h=t.catchall;let p;e._zod.parse=(d,m)=>{p??(p=r.value);const g=d.value;return c(g)?a&&l&&m?.async===!1&&m.jitless!==!0?(o||(o=s(t.shape)),d=o(d,m),h?Gt([],g,d,m,p,e,m?.abortEarly===!0):d):n(d,m):(d.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),d)}});function Ht(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const i=e.filter(s=>!F(s));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(o=>B(o,r,C())))}),t)}const Ks=f("$ZodUnion",(e,t)=>{k.init(e,t),y(e,"optin",r=>r.def.options.some(i=>i._zod.optin==="defaulted")?"defaulted":r.def.options.some(i=>i._zod.optin!==void 0)?"optional":void 0),y(e,"optout",r=>r.def.options.some(i=>i._zod.optout==="optional")?"optional":void 0),y(e,"values",r=>{if(r.def.options.every(i=>i._zod.values))return new Set(r.def.options.flatMap(i=>Array.from(i._zod.values)))}),y(e,"pattern",r=>{if(r.def.options.every(i=>i._zod.pattern)){const i=r.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>Fe(s.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.pa)DELIM" -R"DELIM(rse=(r,i)=>{if(n)return n(r,i);let s=!1;const o=[];for(const c of t.options){const a=c._zod.run({value:r.value,issues:[]},i);if(a instanceof Promise)o.push(a),s=!0;else{if(a.issues.length===0)return a;o.push(a)}}return s?Promise.all(o).then(c=>Ht(c,r,e,i)):Ht(o,r,e,i)}}),Js=f("$ZodIntersection",(e,t)=>{k.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,s=t.left._zod.run({value:i,issues:[]},r),o=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([a,u])=>Yt(n,a,u)):Yt(n,s,o)}});function et(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(Y(e)&&Y(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(const s of r){if(s==="__proto__")continue;const o=et(e[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.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{let h;if(u.code==="unrecognized_keys"&&!u.path?.length)i??(i=u),h=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){const p=String(u.path[0]);s.has(p)||s.set(p,u),h=[p]}else return!1;for(const p of h)r.has(p)||r.set(p,{}),r.get(p)[l]=!0;return!0};for(const u of t.issues)o(u,"l")||e.issues.push(u);for(const u of n.issues)o(u,"r")||e.issues.push(u);const c=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){const u=i?c.filter(l=>i.keys.includes(l)):[];u.length&&e.issues.push({...i,keys:u});for(const l of c)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}const a=et(t.value,n.value);if(!a.valid){if(F(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}const Bs=f("$ZodTuple",(e,t)=>{k.init(e,t);const n=t.items,r=R.memoizer;r?.attach(e),e._zod.parse=(i,s)=>{const o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=r?r.alloc(e,i,[],s):[];const c=[],a=Xt(n,"optin"),u=Xt(n,"optout");if(!t.rest){if(o.lengthn.length&&i.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:o,inst:e,origin:"array"})}const l=new Array(n.length),h=t.rest?s?.abortEarly:void 0;let p=!1;for(let d=0;d{l[d]=g})):(l[d]=m,h&&!p&&m.issues.length&&(p=F(m)))}if(t.rest&&!p){let d=n.length-1;const m=o.slice(n.length);let g=i.issues.length;for(const v of m){if(h&&i.issues.length!==g){if(F(i,g))break;g=i.issues.length}d++;const b=t.rest._zod.run({value:v,issues:[]},s);b instanceof Promise?c.push(b.then(A=>Qt(A,i,d))):Qt(b,i,d)}}return c.length?Promise.all(c).then(()=>en(l,i,n,o,u)):en(l,i,n,o,u)}});function Xt(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function Qt(e,t,n){e.issues.length&&t.issues.push(...J(n,e.issues)),t.value[n]=e.value}function en(e,t,n,r,i){for(let s=0;s=i&&n[s]._zod.optin==="optional"){t.value.length=s;break}if(o.issues.length){if(!c&&s>=i){t.value.length=s;break}t.issues.push(...J(s,o.issues))}t.value[s]=o.value}for(let s=t.value.length-1;s>=r.length&&(n[s]._zod.optout==="optional"&&t.value[s]===void 0);s--)t.value.length=s;return t}const Vs=f("$ZodRecord",(e,t)=>{k.init(e,t);const n=R.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const s=r.value;if(!Y(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const o=[],c=t.keyType._zod.values;if(c&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};const a=new Set;for(const l of c)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(a.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;const h=t.keyType._zod.run({value:l,issues:[]},i);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(h.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(m=>B(m,i,C())),input:l,path:[l],inst:e});continue}const p=h.value;if(p==="__proto__")continue;const d=t.valueType._zod.run({value:s[l],issues:[]},i);d instanceof Promise?o.push(d.then(m=>{m.issues.length&&r.issues.push(...J(l,m.issues)),r.value[p]=m.value})):(d.issues.length&&r.issues.push(...J(l,d.issues)),r.value[p]=d.value)}let u;for(const l in s)if(!a.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let a;for(const u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},i);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&He.test(u)&&l.issues.length){const m=t.keyType._zod.run({value:Number(u),issues:[]},i);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){t.mode==="loose"?r.value[u]=s[u]:c?(a=a??[],a.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>B(m,i,C())),input:u,path:[u],inst:e});continue}const p=l.value;if(p==="__proto__")continue;const d=t.valueType._zod.run({value:s[u],issues:[]},i);d instanceof Promise?o.push(d.then(m=>{m.issues.length&&r.issues.push(...J(u,m.issues)),r.value[p]=m.value})):(d.issues.length&&r.issues.push(...J(u,d.issues)),r.value[p]=d.value)}a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Ws=f("$ZodEnum",(e,t)=>{k.init(e,t);const n=je(t.entries),r=new Set(n);e._zod.values=r,y(e,"pattern",i=>{const s=je(i.def.entries).filter(o=>$r.has(typeof o));return new RegExp(s.length?`^(${s.map(o=>pe(o.toString())).join("|")})$`:"^[^\\\\s\\\\S]$")}),e._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:e}),i}}),qs=f("$ZodTransform",(e,t)=>{k.init(e,t),e._zod.optin="optional",R.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Zt(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(n.value=o,n));if(i instanceof Promise)throw new G;return n.value=i,n}});function tn(e,t){return e.value=t.issues.length?void 0:t.value,e}const nn=f("$ZodOptional",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",y(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),y(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Fe(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;const i=t.innerType._zod.run({value:n.value,issues:[]},r);return i instanceof Promise?i.then(s=>tn(n,s)):tn(n,i)}return t.innerType._zod.run(n,r)}}),Gs=f("$ZodExactOptional",(e,t)=>{nn.init(e,t),y(e,"values",n=>n.def.innerType._zod.values),y(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Hs=f("$ZodNullable",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin),y(e,"optout",n=>n.def.innerType._zod.optout),y(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^($)DELIM" -R"DELIM({Fe(r.source)}|null)$`):void 0}),y(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Ys=f("$ZodDefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>rn(s,t)):rn(i,t)}});function rn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Xs=f("$ZodPrefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Qs=f("$ZodNonOptional",(e,t)=>{k.init(e,t),y(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>sn(s,e)):sn(i,e)}});function sn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function on(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(i=>B(i,r,C()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const eo=f("$ZodCatch",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),y(e,"optout",n=>n.def.innerType._zod.optout),y(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run({value:n.value,issues:[]},r);return i instanceof Promise?i.then(s=>on(n,s,t,r)):on(n,i,t,r)}}),to=f("$ZodPipe",(e,t)=>{k.init(e,t),y(e,"values",n=>n.def.in._zod.values),y(e,"optin",n=>n.def.in._zod.optin),y(e,"optout",n=>n.def.out._zod.optout),y(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(o=>we(o,t.in,r)):we(s,t.in,r)}const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>we(s,t.out,r)):we(i,t.out,r)}});function we(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const no=f("$ZodReadonly",(e,t)=>{k.init(e,t),y(e,"propValues",n=>n.def.innerType._zod.propValues),y(e,"values",n=>n.def.innerType._zod.values),y(e,"optin",n=>n.def.innerType?._zod?.optin),y(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(cn):cn(i)}});function cn(e){return e.memo||(e.value=Object.freeze(e.value)),e}const ro=f("$ZodCustom",(e,t)=>{Z.init(e,t),k.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(s=>an(s,n,r,e));an(i,n,r,e)}});function an(e,t,n,r){if(!e){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(ie(i))}}class io extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const tt="~memo",un=[];function ln(e){return e!==null&&typeof e=="object"}function nt(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const fn=new WeakMap,se=0,ke=1,oe=2;function ze(e,t,n){const r=fn.get(e);if(r!==void 0)return r?oe:se;if(t.has(e))return oe;t.add(e);let i=se;const s=l=>{if(i!==oe&&l?._zod){const h=ze(l,t);h>i&&(i=h)}},o=(l,h)=>{let p=se;for(const d of Reflect.ownKeys(l)){const m=Object.getOwnPropertyDescriptor(l,d);if(!m.enumerable)continue;const g=m.get?ke:m.value?._zod?ze(m.value,t):se;g>p&&(p=g)}return p},c=l=>{l>i&&(i=l)},a=e._zod.def;switch(a.type){case"object":{const l=_t(a);c(l?o(l):ke),s(a.catchall);break}case"array":s(a.element);break;case"tuple":for(const l of a.items)s(l);s(a.rest);break;case"record":case"map":s(a.keyType),s(a.valueType);break;case"set":s(a.valueType);break;case"union":for(const l of a.options)s(l);break;case"intersection":s(a.left),s(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(a.innerType);break;case"pipe":s(a.in),s(a.out);break;case"function":s(a.input),s(a.output);break;case"lazy":{const l=a._cachedInner??void 0;c(l?ze(l,t):ke);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const l in a){const h=Object.getOwnPropertyDescriptor(a,l);if(!h||h.get)continue;const p=h.value;if(!(!p||typeof p!="object")){if(p._zod)s(p);else if(Array.isArray(p))for(const d of p)s(d)}}}return t.delete(e),so(e,i)}function so(e,t){return t!==ke&&fn.set(e,t===oe),t}function oo(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}let Se;const $e=[],co={alloc(e,t,n){const r=Se;if(!r)return n;Se=void 0;const i={value:n,issues:null};return r.set(t.value,i),$e.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const n=e._zod.parse,r=(i,s)=>{if(s.direction!=="backward"&&uo(s,i.value))throw new io;return n(i,s)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,i,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const o=e._zod.parse,c=(a,u)=>{if(n===void 0){const b=ze(e,new Set);if(b===se)return e._zod.parse=o,e._zod.run===c&&(e._zod.run=o),o(a,u);b===oe||r?n=!0:r=!0}const l=a.value;if(!ln(l))return o(a,u);let h=u[tt];h||(h={buckets:new WeakMap,backEdges:void 0},u[tt]=h);let p;i===u?p=s:(p=oo(h,e),i=u,s=p);const d=p.get(l);if(d)return a.value=d.value,d.issues?d.issues.length&&a.issues.push(...nt(d.issues)):(a.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(d.value)),a;Se=p;const m=$e.length,g=o(a,u);Se=void 0;const v=$e.length>m?$e.pop():void 0;return g instanceof Promise?g.then(b=>(v&&(v.issues=b.issues.length?nt(b.issues):un),b)):(v&&(v.issues=g.issues.length?nt(g.issues):un),g)};e._zod.parse=c,e._zod.run===o&&(e._zod.run=c)})}};function ao(){return co}function uo(e,t){const n=e[tt]?.backEdges;return n!==void 0&&ln(t)&&n.has(t)}const lo=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function i(s,o){return s==="number"&&typeof o=="number"&&!Number.isFinite(o)?String(o):r[s]??s}return s=>{switch(s.code){case"invalid_type":{const o=i(s.expected),c=Mr(s.input),a=i(c,s.input);return`Invalid input: expected ${o}, received ${a}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${kt(s.values[0])}`:`Invalid option: expected one of ${gt(s.values,"|")}`;case"too_big":{const o=s.exact?"exactly ":s.inclusive?"<=":"<",c=t(s.origin);return c?`Too big: expected ${s.origin??"value"} to have ${o}${s.maximum.toString()} ${c.unit??"elements"})DELIM" -R"DELIM(`:`Too big: expected ${s.origin??"value"} to be ${o}${s.maximum.toString()}`}case"too_small":{const o=s.exact?"exactly ":s.inclusive?">=":">",c=t(s.origin);return c?`Too small: expected ${s.origin} to have ${o}${s.minimum.toString()} ${c.unit}`:`Too small: expected ${s.origin} to be ${o}${s.minimum.toString()}`}case"invalid_format":{const o=s;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${n[o.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${gt(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(c=>`\'${c}\'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function fo(){return{localeError:lo()}}var hn;class ho{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function po(){return new ho}(hn=globalThis).__zod_globalRegistry??(hn.__zod_globalRegistry=po());const ce=globalThis.__zod_globalRegistry;function dn(e){return e.checks&&(e.checks=[...e.checks]),e}function mo(e,t){return new e(dn({type:"string",..._(t)}))}function go(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function _o(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function vo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function bo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function yo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function wo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function ko(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function zo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function So(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function $o(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function Oo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Eo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Io(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function To(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function Po(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Zo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Ao(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function No(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Ro(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function jo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Mo(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Lo(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function Fo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Co(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function Do(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function xo(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function Uo(e,t){return new e(dn({type:"number",checks:[],..._(t)}))}function Ko(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Jo(e,t){return new e({type:"boolean",..._(t)})}function Bo(e){return new e({type:"unknown"})}function Vo(e,t){return new e({type:"never",..._(t)})}function pn(e,t){return new Mt({check:"less_than",..._(t),value:e,inclusive:!1})}function rt(e,t){return new Mt({check:"less_than",..._(t),value:e,inclusive:!0})}function mn(e,t){return new Lt({check:"greater_than",..._(t),value:e,inclusive:!1})}function it(e,t){return new Lt({check:"greater_than",..._(t),value:e,inclusive:!0})}function gn(e,t){return new Di({check:"multiple_of",..._(t),value:e})}function _n(e,t){return new Ui({check:"max_length",..._(t),maximum:e})}function Oe(e,t){return new Ki({check:"min_length",..._(t),minimum:e})}function vn(e,t){return new Ji({check:"length_equals",..._(t),length:e})}function Wo(e,t){return new Bi({check:"string_format",format:"regex",..._(t),pattern:e})}function qo(e){return new Vi({check:"string_format",format:"lowercase",..._(e)})}function Go(e){return new Wi({check:"string_format",format:"uppercase",..._(e)})}function Ho(e,t){return new qi({check:"string_format",format:"includes",..._(t),includes:e})}function Yo(e,t){return new Gi({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Xo(e,t){return new Hi({check:"string_format",format:"ends_with",..._(t),suffix:e})}function X(e){return new Yi({check:"overwrite",tx:e})}function Qo(e){return X(t=>t.normalize(e))}function ec(){return X(e=>e.trim())}function tc(){return X(e=>e.toLowerCase())}function nc(){return X(e=>e.toUpperCase())}function rc(){return X(e=>zr(e))}function ic(e,t,n){return new e({type:"array",element:t,..._(n)})}function sc(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function oc(e,t){const n=cc(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(ie(i,r.value,n._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(ie(s))}},e(r.value,r)),t);return n}function cc(e,t){const n=new Z({check:"custom",..._(t)});return n._zod.check=e,n}function ae(e,...t){for(const n of t)for(const r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&U(e,r,n[r]);return e}function bn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ce,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Q(e,t,n,r,i){const s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(i);return Object.assign(n,s),!0}function O(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.sc)DELIM" -R"DELIM(hemaPath.includes(e)&&(s.cycle=n.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const c=e._zod.toJSONSchema?.();if(c)o.schema=c;else{const l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,l);else{const p=o.schema,d=t.processors[i.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);d(e,t,p,l)}const h=e._zod.parent;h&&(o.ref||(o.ref=h),O(h,t,l),t.seen.get(h).isParent=!0)}const a=t.metadataRegistry.get(e);return a&&ae(o.schema,a),t.io==="input"&&P(e)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function yn(e){return e.replace(/~/g,"~0").replace(/\\//g,"~1")}function wn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const o of e.seen.entries()){const c=e.metadataRegistry.get(o[0])?.id;if(c){const a=r.get(c);if(a&&a!==o[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,o[0])}}const i=o=>{const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(o[0])?.id,p=e.external.uri??(m=>m);if(h)return{ref:p(h)};const d=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=d,{defId:d,ref:`${p("__shared")}#/${c}/${yn(d)}`}}const a="#",u=`${a}/${c}/`;if(o[1]===n&&!o[1].schema.id)return{ref:a};const l=o[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+yn(l)}},s=o=>{if(o[1].schema.$ref)return;const c=o[1],{ref:a,defId:u}=i(o);c.def={...c.schema},u&&(c.defId=u);const l=c.schema;for(const h in l)delete l[h];l.$ref=a};if(e.cycles==="throw")for(const o of e.seen.entries()){const c=o[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/\n\nSet the \\`cycles\\` parameter to \\`"ref"\\` to resolve cyclical schemas with defs.`)}for(const o of e.seen.entries()){const c=o[1];if(t===o[0]){s(o);continue}if(e.external){const u=e.external.registry.get(o[0])?.id;if(t!==o[0]&&u){s(o);continue}}if(e.metadataRegistry.get(o[0])?.id){s(o);continue}if(c.cycle){s(o);continue}c.count>1&&e.reused==="ref"&&s(o)}e.external&&(e.sharedDefsExtractedFor=e.external)}function kn(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(const r of t){if(!r||typeof r!="object")return;kn(r);const i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;const s=r.type;for(const o of Array.isArray(s)?s:[s]){if(typeof o!="string")return;n.includes(o)||n.push(o)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const zn=new Set(["type","properties","required","additionalProperties"]),Sn=["oneOf","anyOf"];function $n(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function st(e){const t=[];for(const s of e){if(typeof s!="object"||s.type!=="object")return null;for(const o in s)if(!zn.has(o))return null;t.push(s)}const n={},r=new Set;for(const s of t){for(const o in s.properties){if(Object.prototype.hasOwnProperty.call(n,o))continue;const c=[];for(const u of t){const l=u.properties?.[o]??$n(u);l!=null&&(c.some(h=>JSON.stringify(h)===JSON.stringify(l))||c.push(l))}const a=c.length===1?c[0]:st(c)??{allOf:c};U(n,o,a)}for(const o of s.required??[])r.add(o)}const i={type:"object",properties:n};if(r.size&&(i.required=[...r]),t.every(s=>s.additionalProperties===!1))i.additionalProperties=!1;else{const s=[];for(const o of t){const c=$n(o);c&&!s.some(a=>JSON.stringify(a)===JSON.stringify(c))&&s.push(c)}s.length===1?i.additionalProperties=s[0]:s.length>1&&(i.additionalProperties={allOf:s})}return i}function ac(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const i of zn)if(i in e)return;const n=t.filter(i=>Sn.some(s=>Array.isArray(i[s])));let r=null;if(!n.length)r=st(t);else{const i=n[0],s=Sn.find(a=>Array.isArray(i[a]));if(Object.keys(i).length!==1)return;const o=t.filter(a=>a!==i),c=i[s].map(a=>st([...o,a]));if(c.some(a=>!a))return;r={[s]:c}}r&&(delete e.allOf,ae(e,r))}function On(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const a=e.seen.get(c);if(a.ref===null)return;const u=a.def??a.schema,l={...u},h=a.ref;if(a.ref=null,h){r(h);const d=e.seen.get(h),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):ae(u,m),ae(u,l),c._zod.parent===h)for(const v in u)v==="$ref"||v==="allOf"||v in l||delete u[v];if(m.$ref&&d.def)for(const v in u)v==="$ref"||v==="allOf"||v in d.def&&JSON.stringify(u[v])===JSON.stringify(d.def[v])&&delete u[v]}const p=c._zod.parent;if(p&&p!==h){r(p);const d=e.seen.get(p);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(const m in u)m==="$ref"||m==="allOf"||m in d.def&&JSON.stringify(u[m])===JSON.stringify(d.def[m])&&delete u[m]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const c of[...e.seen.entries()].reverse())r(c[0]);if(e.target!=="openapi-3.0")for(const c of e.seen.entries())kn(c[1].def??c[1].schema);for(const c of e.deferred)c();if(e.intersections.length){const c=new Map;for(const a of e.seen.values())for(const u of[a.schema,a.def]){const l=u?.allOf;if(!Array.isArray(l))continue;const h=c.get(l);h?h.push(u):c.set(l,[u])}for(const a of e.intersections)for(const u of c.get(a)??[])ac(u)}}const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(c)}ae(i,n.defId?n.schema:n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&i.id===s&&delete i.id;const o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const c of e.seen.entries()){const a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,U(o,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{const c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ee(t,"input",e.processors),output:Ee(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function P(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(r.type==="transform")return!0;if(r.type==="array")return P(r.element,n);if(r.type==="set")return P(r.valueType,n);if(r.type==="lazy")return P(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return P(r.innerType,n);if(r.type==="intersection")return P(r.left,n)||P(r.right,n);if(r.type==="record"||r.type==="map")return P(r.keyType,n)||P(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:P(r.in,n)||P(r.out,n);if(r.type==="object"){for(const i in r.shape)if(P(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(P(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(P(i,n))return!0;return!!(r.rest&&P(r.rest,n))}return!1}const uc=(e,t={})=>n=>{const r=bn({...n,processors:t});return O(e,r),wn(r,e),On(r,e)},Ee=(e,t,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=bn({...i??{},target:s,io:t,processors:n});return O(e,o)DELIM" -R"DELIM(),wn(o,e),On(o,e)},ee=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},te=(e,t,n)=>{(e[t]===void 0||n{ee(e,"minimum",t),te(e,"maximum",t)},In=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Tn=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Pn=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},Zn=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},An=(e,t)=>ee(e,"minimum",t.minimum),Nn=(e,t)=>te(e,"maximum",t.maximum),Rn=e=>(t,n)=>{Zn(t,n.format);const[r,i]=e[n.format];ee(t,"minimum",r),te(t,"maximum",i)},lc={greater_than:(e,t)=>ee(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>te(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>In(e,t.value),number_format:Rn(zt),bigint_format:Rn(Er),min_length:An,max_length:Nn,length_equals:(e,t)=>En(e,t.length),min_size:An,max_size:Nn,size_equals:(e,t)=>En(e,t.size),string_format:(e,t)=>{Zn(e,t.format),t.pattern&&Tn(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Pn(e,t.mime)};function j(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const s of r)lc[s._zod.def.check]?.(t,s._zod.def);const i=e._zod.bag;i.minimum!==void 0&&ee(t,"minimum",i.minimum),i.exclusiveMinimum!==void 0&&ee(t,"exclusiveMinimum",i.exclusiveMinimum),i.maximum!==void 0&&te(t,"maximum",i.maximum),i.exclusiveMaximum!==void 0&&te(t,"exclusiveMaximum",i.exclusiveMaximum),i.multipleOf!==void 0&&In(t,i.multipleOf),i.format!==void 0&&(t.format??(t.format=i.format),i.format.includes("int")&&(t.isInt=!0)),i.mime&&Pn(t,i.mime);for(const s of i.patterns??[])Tn(t,s);return t}const fc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hc=new Map([[Bt,Ei],[Qe,Ii]]),jn=e=>hc.get(e)??e,dc=(e,t,n,r)=>{const i=n;i.type="string";const{minimum:s,maximum:o,format:c,patterns:a,contentEncoding:u,laxFormat:l}=j(e);if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),c&&(i.format=fc[c]??c,i.format===""&&delete i.format,(c==="time"||l)&&delete i.format),u&&(i.contentEncoding=u),a&&a.size>0){const h=[...a].map(jn);h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},pc=(e,t,n,r)=>{const i=n,{minimum:s,maximum:o,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:l}=j(e);i.type=l?"integer":"number";const h=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),p=typeof a=="number"&&a<=(o??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(h?d?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof s=="number"&&(i.minimum=s),p?d?(i.maximum=a,i.exclusiveMaximum=!0):i.exclusiveMaximum=a:typeof o=="number"&&(i.maximum=o),c){const m=new Set;for(const b of c)Number.isFinite(b)&&b!==0?m.add(Math.abs(b)):Q(e,t,i,r,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);const[g,...v]=m;g!==void 0&&(i.multipleOf=g),v.length&&(i.allOf=[...i.allOf??[],...v.map(b=>({multipleOf:b}))])}},mc=(e,t,n,r)=>{n.type="boolean"},gc=(e,t,n,r)=>{n.not={}},_c=(e,t,n,r)=>{},vc=(e,t,n,r)=>{const i=e._zod.def,s=je(i.entries);if(s.length===0){n.not={};return}s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},bc=(e,t,n,r)=>{Q(e,t,n,r,"Custom types cannot be represented in JSON Schema")},yc=(e,t,n,r)=>{Q(e,t,n,r,"Transforms cannot be represented in JSON Schema")},wc=(e,t,n,r)=>{const i=n,s=e._zod.def,{minimum:o,maximum:c}=j(e);typeof o=="number"&&(i.minItems=o),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=O(s.element,t,{...r,path:[...r.path,"items"]})};function ue(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?ue(t.out):t.type==="catch"?ue(t.innerType):e._zod.optin}const kc=(e,t,n,r)=>{const i=n,s=e._zod.def,o=s.shape;if(Object.getOwnPropertySymbols(o).length&&Q(e,t,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(const u in o)U(i.properties,u,O(o[u],t,{...r,path:[...r.path,"properties",u]}));const a=[];for(const u of Object.keys(o)){const l=s.shape[u];(t.io==="input"?ue(l)===void 0:l._zod.optout===void 0)&&a.push(u)}a.length>0&&(i.required=a),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=O(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},zc=(e,t,n,r)=>{const i=e._zod.def,s=i.inclusive===!1,o=i.options.map((c,a)=>O(c,t,{...r,path:[...r.path,s?"oneOf":"anyOf",a]}));s?n.oneOf=o:n.anyOf=o},Sc=(e,t,n,r)=>{const i=e._zod.def,s=O(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=O(i.right,t,{...r,path:[...r.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(s)?s.allOf:[s],...c(o)?o.allOf:[o]];n.allOf=a,t.intersections.push(a)},$c=(e,t,n,r)=>{const i=n,s=e._zod.def;i.type="array";const o=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=s.items.map((g,v)=>O(g,t,{...r,path:[...r.path,o,v]})),u=s.rest?O(s.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;let l=s.items.length;for(;l>0;){const g=s.items[l-1];if(!(t.io==="input"?ue(g)!==void 0:g._zod.optout==="optional"))break;l--}const h=s.items.length,p=!s.rest;t.target==="draft-2020-12"?(i.prefixItems=a,p?i.items=!1:u&&(i.items=u),l>0&&(i.minItems=l),p&&(i.maxItems=h)):t.target==="openapi-3.0"?(i.items={anyOf:a},u&&i.items.anyOf.push(u),l>0&&(i.minItems=l),p&&(i.maxItems=h)):(i.items=a,p?i.additionalItems=!1:u&&(i.additionalItems=u),l>0&&(i.minItems=l),p&&(i.maxItems=h));const{minimum:d,maximum:m}=j(e);typeof d=="number"&&(i.minItems=d),typeof m=="number"&&(i.maxItems=m)};function ot(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);const m=e.get(t)?.def;if(!m)return t;const g=ot(e,m,n);return g===m?t:g}for(const m of["anyOf","oneOf"]){const g=t[m];if(!Array.isArray(g))continue;const v=g.map(b=>ot(e,b,n));v.some((b,A)=>b!==g[A])&&(t={...t,[m]:v})}const r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes("string")&&r.some(m=>m==="number"||m==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!i&&!s?.some(m=>typeof m=="number"))return t;const{minimum:o,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:h,id:p,...d}=t;return d.enum?d.enum=d.enum.map(m=>typeof m=="number"?String(m):m):typeof d.const=="number"&&(d.const=String(d.const)),i&&(d.type="string",s||(d.pattern=(r.includes("number")?He:Mi).source)),d}const ct=new WeakMap;function Oc(e){const t=new Map;for(const r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);const n=new Map;for(const r of ct.get(e)??[]){const i=e.seen.get(r),s=(i?.def??i?.schema)?.propertyNames;if(!s||s===!0||n.has(s))continue;const o=ot(t,s,new Set);o!==s&&n.set(s,o)}if(n.size)for(const r of e.seen.values())for(const i of[r.schema,r.def]){const s=i&&n.get(i.propertyNames);s&&(i.propertyNames=s)}}const Ec=(e,t,n,r)=>{const i=n,s=e._zod.def;i.type="object";const o=s.keyType,c=j(o).patterns;if(s.mode==="loose"&&c&&c.size>0){const l=O(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const h of c)U(i.patternProperties,jn(h).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){i.propertyNames=O(s.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=ct.get(t);l||(l=[],ct.set(t,l),t.deferred.push(()=>Oc(t))),l.push(e)}i.additionalProperties=O(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}const a=o._zod.values,u=t.io==="input"&&ue(s.valueType)!==void 0;if(a&&!s.partial&&!u){const l=[...a].filter(h=>typeof h=="string"||typeof h=="number");l.length>0&&(i.required=l.map(String))}},Ic=(e,t,n,r)=>{const i=e._zod.def,s)DELIM" -R"DELIM(=O(i.innerType,t,r),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Tc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType},at=Symbol();function Mn(e,t,n,r,i){let s=!1;const o=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(s=!0,null));return s?(Q(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),at):JSON.parse(o)}const Pc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType;const o=Mn(i.defaultValue,e,t,n,r);o!==at&&(n.default=o)},Zc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);if(s.ref=i.innerType,t.io!=="input")return;const o=Mn(i.defaultValue,e,t,n,r);o!==at&&(n._prefault=o)},Ac=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Q(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=o},Nc=(e,t,n,r)=>{const i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?s?i.out:i.in:i.out;O(o,t,r);const c=t.seen.get(e);c.ref=o},Rc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType,n.readOnly=!0},Ln=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType},Fn=new WeakSet([Object.prototype,Error.prototype]);function Ie(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}const M=f("ZodError",(e,t)=>{qr.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);Fn.has(n)||(Fn.add(n),Ie(n,"format",r=>i=>Yr(r,i)),Ie(n,"flatten",r=>i=>Hr(r,i)),Ie(n,"addIssue",r=>i=>{r.issues.push(i),r.message=JSON.stringify(r.issues,Me,2)}),Ie(n,"addIssues",r=>i=>{r.issues.push(...i),r.message=JSON.stringify(r.issues,Me,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),jc=Be(M),Mc=Ve(M),Lc=We(M),Fc=qe(M),Cc=ri(M),Dc=ii(M),xc=si(M),Uc=oi(M),Kc=ci(M),Jc=ai(M),Bc=ui(M),Vc=li(M);function Wc(){R.localeError||C(fo())}function le(){R.memoizer||C({memoizer:ao()})}const S=f("ZodType",(e,t)=>(Wc(),k.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(N(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return K(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Va(e,t))},superRefine(e,t){return this.check(Wa(e,t))},overwrite(e){return this.check(X(e))},optional(){return Vn(this)},exactOptional(){return Na(this)},nullable(){return qn(this)},nullish(){return Vn(qn(this))},nonoptional(e){return Ca(this,e)},array(){return Kn(this)},or(e){return Jn([this,e])},and(e){return Oa(this,e)},transform(e){return Hn(this,Aa(e))},default(e){return Ma(this,e)},prefault(e){return Fa(this,e)},catch(e){return xa(this,e)},pipe(e){return Hn(this,e)},readonly(){return Ja(this)},describe(e){const t=this.clone();return ce.add(t,{description:e}),t},meta(...e){if(e.length===0)return ce.get(this);const t=this.clone();return ce.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Et(this,"~standard",{...Ct(this),jsonSchema:{input:Ee(this,"input"),output:Ee(this,"output")}})},set"~standard"(e){V(this,"~standard",e)},parse:function e(t,n){return jc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Mc(this,t,n,{callee:e})},safeParse(e,t){return Lc(this,e,t)},async safeParseAsync(e,t){return Fc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){V(this,"spa",e)},validate(e,t){return ei(this,e,t)},validateAsync(e,t){return ni(this,e,t)},encode:function e(t,n){return Cc(this,t,n,{callee:e})},decode:function e(t,n){return Dc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await xc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Uc(this,t,n,{callee:e})},safeEncode(e,t){return Kc(this,e,t)},safeDecode(e,t){return Jc(this,e,t)},async safeEncodeAsync(e,t){return Bc(this,e,t)},async safeDecodeAsync(e,t){return Vc(this,e,t)},toJSONSchema(e){return uc(this,{})(e)},get description(){return ce.get(this)?.description},get _def(){return this._zod.def}}),Cn=f("_ZodString",(e,t)=>{Xe.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>dc(e,n,r)},It({format:e=>j(e).format??null,minLength:e=>j(e).minimum??null,maxLength:e=>j(e).maximum??null},{regex(...e){return this.check(Wo(...e))},includes(...e){return this.check(Ho(...e))},startsWith(...e){return this.check(Yo(...e))},endsWith(...e){return this.check(Xo(...e))},min(...e){return this.check(Oe(...e))},max(...e){return this.check(_n(...e))},length(...e){return this.check(vn(...e))},nonempty(...e){return this.check(Oe(1,...e))},lowercase(e){return this.check(qo(e))},uppercase(e){return this.check(Go(e))},trim(){return this.check(ec())},normalize(...e){return this.check(Qo(...e))},toLowerCase(){return this.check(tc())},toUpperCase(){return this.check(nc())},slugify(){return this.check(rc())}})),qc=f("ZodString",(e,t)=>{Xe.init(e,t),Cn.init(e,t)},{email(e){return this.check(go(Qc,e))},url(e){return this.check(ko(ta,e))},jwt(e){return this.check(Lo(ga,e))},emoji(e){return this.check(zo(na,e))},guid(e){return this.check(_o(ea,e))},uuid(e){return this.check(vo(Te,e))},uuidv4(e){return this.check(bo(Te,e))},uuidv6(e){return this.check(yo(Te,e))},uuidv7(e){return this.check(wo(Te,e))},nanoid(e){return this.check(So(ra,e))},cuid(e){return this.check($o(ia,e))},cuid2(e){return this.check(Oo(sa,e))},ulid(e){return this.check(Eo(oa,e))},base64(e){return this.check(Ro(da,e))},base64url(e){return this.check(jo(pa,e))},xid(e){return this.check(Io(ca,e))},ksuid(e){return this.check(To(aa,e))},ipv4(e){return this.check(Po(ua,e))},ipv6(e){return this.check(Zo(la,e))},cidrv4(e){return this.check(Ao(fa,e))},cidrv6(e){return this.check(No(ha,e))},e164(e){return this.check(Mo(ma,e))},datetime(e){return this.check(Fo(Gc,e))},date(e){return this.check(Co(Hc,e))},time(e){return this.check(Do(Yc,e))},duration(e){return this.check(xo(Xc,e))}});function H(e){return mo(qc,e)}const $=f("ZodStringFormat",(e,t)=>{z.init(e,t),Cn.init(e,t)}),Gc=f("ZodISODateTime",(e,t)=>{_s.init(e,t),$.init(e,t)}),Hc=f("ZodISODate",(e,t)=>{vs.init(e,t),$.init(e,t)}),Yc=f("ZodISOTime",(e,t)=>{bs.init(e,t),$.init(e,t)}),Xc=f("ZodISODuration",(e,t)=>{ys.init(e,t),$.init(e,t)}),Qc=f("ZodEmail",(e,t)=>{rs.init(e,t),$.init(e,t)}),ea=f("ZodGUID",(e,t)=>{ts.init(e,t),$.init(e,t)}),Te=f("ZodUUID",(e,t)=>{ns.init(e,t),$.init(e,t)}),ta=f("ZodURL",(e,t)=>{us.init(e,t),$.init(e,t)}),na=f("ZodEmoji",(e,t)=>{ls.init(e,t),$.init(e,t)}),ra=f("ZodNanoID",(e,t)=>{fs.init(e,t),$.init(e,t)}),ia=f("ZodCUID",(e,t)=>{hs.init(e,t),$.init(e,t)}),sa=f("ZodCUID2",(e,t)=>{ds.init(e,t),$.init(e,t)}),oa=f("ZodULID",(e,t)=>{ps.init(e,t),$.init(e,t)}),ca=f("ZodXID",(e,t)=>{ms.init(e,t),$.init(e,t)}),aa=f("ZodKSUID",(e,t)=>{gs.init(e,t),$.init(e,t)}),ua=f("ZodIPv4",(e,t)=>{ws.init(e,t),$.init(e,t)}),la=f("ZodIPv6",(e,t)=>{zs.init(e,t),$.init(e,t)}),fa=f("ZodCIDRv4",(e,t)=>{Ss.init(e,t),$.init(e,t)}),ha=f("ZodCIDRv6",(e,t)=>{Os.init(e,t),$.init(e,t)}),da=f("ZodBase64",(e,t)=>{Es.init(e,t),$.init(e,t)}),pa=f("ZodBase64URL",(e,t)=>{Ts.init(e,t),$.init(e,t)}),ma=f("ZodE164",(e,t)=>{Ps.init(e,t),$.init(e,t)}),ga=f("ZodJWT",(e,t)=>{As.init(e,t),$.init(e,t)}),Dn=f("ZodNumber",(e,t)=>{Vt.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>pc(e,n,r,i),e.isFinite=!0},It({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=j(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMax)DELIM" -R"DELIM(imum:n}=j(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=j(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>j(e).format??null},{gt(e,t){return this.check(mn(e,t))},gte(e,t){return this.check(it(e,t))},min(e,t){return this.check(it(e,t))},lt(e,t){return this.check(pn(e,t))},lte(e,t){return this.check(rt(e,t))},max(e,t){return this.check(rt(e,t))},int(e){return this.check(xn(e))},safe(e){return this.check(xn(e))},positive(e){return this.check(mn(0,e))},nonnegative(e){return this.check(it(0,e))},negative(e){return this.check(pn(0,e))},nonpositive(e){return this.check(rt(0,e))},multipleOf(e,t){return this.check(gn(e,t))},step(e,t){return this.check(gn(e,t))},finite(){return this}}));function E(e){return Uo(Dn,e)}const _a=f("ZodNumberFormat",(e,t)=>{Ns.init(e,t),Dn.init(e,t)});function xn(e){return Ko(_a,e)}const va=f("ZodBoolean",(e,t)=>{Rs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>mc(e,n,r)});function T(e){return Jo(va,e)}const ba=f("ZodUnknown",(e,t)=>{js.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>_c()});function Un(){return Bo(ba)}const ya=f("ZodNever",(e,t)=>{Ms.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>gc(e,n,r)});function wa(e){return Vo(ya,e)}const ka=f("ZodArray",(e,t)=>{le(),Cs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>wc(e,n,r,i),e.element=t.element},{min(e,t){return this.check(Oe(e,t))},nonempty(e){return this.check(Oe(1,e))},max(e,t){return this.check(_n(e,t))},length(e,t){return this.check(vn(e,t))},unwrap(){return this.element}});function Kn(e,t){return ic(ka,e,t)}const za=f("ZodObject",(e,t)=>{le(),Us.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>kc(e,n,r,i),xr(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Pa(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(N(this._zod.def,{catchall:e}))},passthrough(){return this.clone(N(this._zod.def,{catchall:Un()}))},loose(){return this.clone(N(this._zod.def,{catchall:Un()}))},strict(){return this.clone(N(this._zod.def,{catchall:wa()}))},strip(){return this.clone(N(this._zod.def,{catchall:void 0}))},extend(e){return Pr(this,e)},safeExtend(e){return Zr(this,e)},merge(e){return Ar(this,e)},pick(e){return Ir(this,e)},omit(e){return Tr(this,e)},partial(...e){return $t(lt,this,e[0])},exactPartial(...e){return $t(Wn,this,e[0],"exactPartial")},required(...e){return Nr(Gn,this,e[0])}});function L(e,t){const n={type:"object",shape:e??{},..._(t)};return new za(n)}const Sa=f("ZodUnion",(e,t)=>{Ks.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>zc(e,n,r,i),e.options=t.options});function Jn(e,t){return new Sa({type:"union",options:e,..._(t)})}const $a=f("ZodIntersection",(e,t)=>{Js.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Sc(e,n,r,i)});function Oa(e,t){return new $a({type:"intersection",left:e,right:t})}const Ea=f("ZodTuple",(e,t)=>{le(),Bs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>$c(e,n,r,i)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){const e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new lt({type:"optional",innerType:t}))})}});function Ia(e,t,n){const r=t instanceof k,i=r?n:t,s=r?t:null;return new Ea({type:"tuple",items:e,rest:s,..._(i)})}const Bn=f("ZodRecord",(e,t)=>{le(),Vs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ec(e,n,r,i),e.keyType=t.keyType,e.valueType=t.valueType});function Ta(e,t,n){return!t||!t._zod?new Bn({type:"record",keyType:H(),valueType:e,..._(t)}):new Bn({type:"record",keyType:e,valueType:t,..._(n)})}const ut=f("ZodEnum",(e,t)=>{Ws.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,i,s)=>vc(e,r,i),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const s={};for(const o of r)if(n.has(o))s[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new ut({...t,checks:[],..._(i),entries:s})},e.exclude=(r,i)=>{const s={...t.entries};for(const o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new ut({...t,checks:[],..._(i),entries:s})}});function Pa(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ut({type:"enum",entries:n,..._(t)})}const Za=f("ZodTransform",(e,t)=>{le(),qs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>yc(e,n,r,i),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Zt(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(ie(s,n.value,t));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=n.value),o.inst??(o.inst=e),n.issues.push(ie(o))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n)):(n.value=i,n)}});function Aa(e){return new Za({type:"transform",transform:e})}const lt=f("ZodOptional",(e,t)=>{nn.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ln(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Vn(e){return new lt({type:"optional",innerType:e})}const Wn=f("ZodExactOptional",(e,t)=>{Gs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ln(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Na(e){return new Wn({type:"optional",innerType:e})}const Ra=f("ZodNullable",(e,t)=>{Hs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ic(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function qn(e){return new Ra({type:"nullable",innerType:e})}const ja=f("ZodDefault",(e,t)=>{Ys.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Pc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ma(e,t){return new ja({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():wt(t)}})}const La=f("ZodPrefault",(e,t)=>{Xs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Zc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Fa(e,t){return new La({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():wt(t)}})}const Gn=f("ZodNonOptional",(e,t)=>{Qs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Tc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Ca(e,t){return new Gn({type:"nonoptional",innerType:e,..._(t)})}const Da=f("ZodCatch",(e,t)=>{eo.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ac(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xa(e,t){return new Da({type:"catch",innerType:e,catchValue:typeof t=="function"?t:Kr(t)})}const Ua=f("ZodPipe",(e,t)=>{to.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Nc(e,n,r,i),e.in=t.in,e.out=t.out});function Hn(e,t){return new Ua({type:"pipe",in:e,out:t})}const Ka=f("ZodReadonly",(e,t)=>{no.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Rc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Ja(e){return new Ka({type:"readonly",innerType:e})}const Ba=f("ZodCustom",(e,t)=>{ro.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>bc(e,n,r,i)});function Va(e,t={}){return sc(Ba,e,t)}function Wa(e,t){return oc(e,t)}const Pe=[{id:0,name:"application",label:"Application"},{id:1,name:"news",label:"News"},{id:2,name:"session",label:"Session"},{id:3,name:"protocol",label:"Protocol"},{id:4,name:"proxy",label:"Proxy"},{id:5,name:"remote",label:"Remote"},{id:6,name:"fault",label:"Fault"},{id:7,name:"quitting",label:"Quitting"},{id:8,name:"objects",label:"Objects"},{id:9,name:"verbose",label:"Verbose"}],ft=[{id:0,name:"header_archived",label:"Header archived",category:"headers",valueKind:"height"},{id:1,name:"header_organized",label:"Header organized",category:"headers",valueKind:"height"},{id:2,name:"header_reorganized",label:"Header reorganized",category:"headers",valueKind:"height"},{id:3,name:"block_archived",label:"Block archived",category:"blocks",valueKind:"height"},{id:4,name:"block_buffered",label:"Block buffered",category:"blocks",valueKind:"height"},{id:5,name:"block_validated",label:"Block validated",catego)DELIM" -R"DELIM(ry:"blocks",valueKind:"height"},{id:6,name:"block_confirmed",label:"Block confirmed",category:"blocks",valueKind:"height"},{id:7,name:"block_unconfirmable",label:"Block unconfirmable",category:"blocks",valueKind:"height"},{id:8,name:"validate_bypassed",label:"Validation bypassed",category:"blocks",valueKind:"height"},{id:9,name:"confirm_bypassed",label:"Confirmation bypassed",category:"blocks",valueKind:"height"},{id:10,name:"tx_archived",label:"Transaction archived",category:"transactions",valueKind:"fee-rate"},{id:11,name:"tx_validated",label:"Transaction validated",category:"transactions",valueKind:"count"},{id:12,name:"tx_invalidated",label:"Transaction invalidated",category:"transactions",valueKind:"count"},{id:13,name:"block_organized",label:"Block organized",category:"chain",valueKind:"height"},{id:14,name:"block_reorganized",label:"Block reorganized",category:"chain",valueKind:"height"},{id:15,name:"template_issued",label:"Mining template issued",category:"mining",valueKind:"count"},{id:16,name:"snapshot_secs",label:"Snapshot",category:"timing",valueKind:"seconds"},{id:17,name:"prune_msecs",label:"Prune",category:"timing",valueKind:"milliseconds"},{id:18,name:"reload_msecs",label:"Store reload",category:"timing",valueKind:"milliseconds"},{id:19,name:"block_usecs",label:"Serve block",category:"timing",valueKind:"microseconds"},{id:20,name:"ancestry_msecs",label:"Serve ancestry",category:"timing",valueKind:"milliseconds"},{id:21,name:"filter_msecs",label:"Serve filter",category:"timing",valueKind:"milliseconds"},{id:22,name:"filterhashes_msecs",label:"Serve filter hashes",category:"timing",valueKind:"milliseconds"},{id:23,name:"filterchecks_msecs",label:"Serve filter checkpoints",category:"timing",valueKind:"milliseconds"},{id:24,name:"ecdsa_secs",label:"ECDSA batch verification",category:"timing",valueKind:"seconds"},{id:25,name:"schnorr_secs",label:"Schnorr batch verification",category:"timing",valueKind:"seconds"},{id:26,name:"silent_secs",label:"Silent payment scan",category:"timing",valueKind:"seconds"},{id:27,name:"validate_usecs",label:"Block validation",category:"timing",valueKind:"microseconds"},{id:28,name:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],Yn=E().int().nonnegative().max(864e13),Xn=L({level:E().int().nonnegative(),time:Yn,message:H()}),Qn=L({event:E().int().nonnegative(),value:E().nonnegative(),time:Yn}),er=L({previous:E().nonnegative()});Jn([Xn,Qn,er]);const qa=2**Pe.length-1,tr=2**ft.length-1;function nr(e,t){return Number.isInteger(t)&&t>=0&&t{this.#u(r)},onHeartbeat:r=>{this.#u(r)},onBeforeStop:r=>{r.send("/v1/log/subscribe?filter=0"),r.send("/v1/event/subscribe?filter=0")},onMessage:r=>{const i=Ya(r);if(!i)return!1;if(rr(i)&&!nr(this.#e,i.level))return!0;for(const s of this.#t)s(i);return!0},onUnclaimed:r=>{for(const i of this.#i)i(r)}}}getStatus=()=>this.#c.getStatus();subscribeStatus=t=>this.#c.subscribeStatus(t);start(){this.#r??=this.#c.attach(this.#a)}stop(){this.#r?.(),this.#r=null}subscribeFrames(t){return this.#t.add(t),()=>{this.#t.delete(t)}}subscribeInvalidFrames(t){return this.#i.add(t),()=>{this.#i.delete(t)}}setFilters(t,n){this.#e!==t&&(this.#e=t,this.#c.send(`/v1/log/subscribe?filter=${String(t)}`)),this.#n!==n&&(this.#n=n,this.#c.send(`/v1/event/subscribe?filter=${String(n)}`))}#u(t){t.send(`/v1/log/subscribe?filter=${String(this.#e)}`),t.send(`/v1/event/subscribe?filter=${String(this.#n)}`)}}function tu(e){const t=e.trim();if(!t)throw new Error("Endpoint URL is required");const n=/^[a-z][a-z\\d+\\-.]*:\\/\\//iu.test(t)?t:`http://${t}`,r=new URL(n);if(r.protocol!=="http:"&&r.protocol!=="https:")throw new Error("Endpoint must use HTTP or HTTPS");return r.pathname=r.pathname.replace(/\\/+$/u,"")||"/",r.search="",r.hash="",r.toString().replace(/\\/$/u,"")}function nu(e){const t=new URL(tu(e));return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/",t.search="",t.hash="",t.toString()}const ru=L({store:L({address:T(),filter:T(),silent:E().int().nonnegative().nullable(),turbo:T(),pruned:E().int().nonnegative()}),node:L({network:H(),limited:T().optional(),blocks:T().optional(),witness:T().optional(),filters:T().optional(),privacy:T().optional()}),wallet:L({p2kh:E().int(),p2sh:E().int(),wif:E().int(),witness:H(),silent:H(),hd_private:E().int(),hd_public:E().int()}).optional(),network:L({relay:T(),alert:T(),reject:T(),compact:T(),address:T(),witness_tx:T(),memory_pool:T(),not_found:T(),protocol_maximum:E().int(),protocol_minimum:E().int()}).optional(),forks:Ta(H(),T()).transform(e=>Object.keys(e).filter(t=>e[t]))}),ir=H().regex(/^[0-9a-f]{64}$/u),iu=L({hash:ir,height:E().int().nonnegative(),timestamp:E().int().positive().max(4294967295)}),sr=L({hash:ir,height:E().int().nonnegative()}),su=L({confirmed:sr,candidate:sr}),Ae=E().int().nonnegative().max(Number.MAX_SAFE_INTEGER),ou=L({count:Ae,virtual:Ae,fee:Ae,histogram:Kn(Ia([E().nonnegative(),Ae]))}),cu="/v1/fees?format=json",au=5e3,uu=15e3;function lu(e){try{const t=JSON.parse(e),n=ru.safeParse(t);if(n.success)return{type:"configuration",payload:n.data};const r=iu.safeParse(t);if(r.success)return{type:"header",payload:r.data};const i=ou.safeParse(t);if(i.success)return{type:"fees",payload:i.data};const s=su.safeParse(t);return s.success?{type:"top",payload:s.data}:null}catch{return null}}function fu(e){return`/v1/block/height/${String(e)}/header?format=json&candidate=true`}const or=15e3,cr=3*or,ar={configuration:null,configurationReceivedAt:null,tops:null,topReceivedAt:null,branch:null,branchReceivedAt:null,fees:null,invalidFrames:0};class hu{#e=ar;#n=new Set;#t;#i;#c=null;#a=null;#r;#u=null;#s=null;#o=null;#p;#f=null;#h=null;constructor(t,n={}){this.#r=n.now??Date.now,this.#p=n.pollIntervalMs??or,this.#t=t,this.#i={heartbeatMs:this.#p,onOpen:r=>{this.#u=this.#r(),r.send("/v1/configuration?format=json"),r.send("/v1/top/subscribe?format=json"),this.#h=null,this.#g()},onHeartbeat:r=>{const i=this.#e.topReceivedAt??this.#u;if(i!==null&&this.#r()-i>=cr){try{r.close(4e3,"Native top response timed out")}catch{}return}r.send("/v1/top?format=json")},onBeforeStop:r=>{r.send("/v1/top/subscribe?format=json&stop=true")},onMessage:r=>{const i=lu(r);return i?(this.#d(i),!0):!1},onUnclaimed:()=>{this.#l({...this.#e,invalidFrames:this.#e.invalidFrames+1})}}}getStatus=()=>this.#t.getStatus();subscribeStatus=t=>this.#t.subscribeStatus(t);getState=()=>this.#e;subscribeState=t=>(this.#n.add(t),()=>{this.#n.delete(t)});start(){this.#f??=setInterval(()=>{this.#g()},au),this.#a??=this.#t.subscribeStatus(()=>{this.#t.getStatus().phase!=="connected"&&(this.#u=null,this.#h=null,this.#s=null,this.#o=null,this.#v())}),this.#c??=this.#t.attach(this.#i)}stop(){this.#f!==null&&clearInterval(this.#f),this.#f=null,this.#h=null,this.#a?.(),this.#a=null,this.#c?.(),this.#c=null}#d(t){const n=this.#r();if(t.type==="fees"){this.#h=null,this.#l({...this.#e,fees:{data:t.payload,receivedAt:n}});return}if(t.type==="top"){const{confirmed:r,candidate:i}=t.payload,s=i.height>r.height,o=s&&this.#e.branch?.height===r.height;s||(this.#s=null,this.#o=null),this.#l({...this.#e,tops:t.payload,topReceivedAt:n,)DELIM" -R"DELIM(branch:o?this.#e.branch:null,branchReceivedAt:o?this.#e.branchReceivedAt:null}),s&&this.#m(r.height,n);return}if(t.type==="header"){if(t.payload.height!==this.#s?.height)return;this.#s=null,this.#l({...this.#e,branch:t.payload,branchReceivedAt:n});return}this.#l({...this.#e,configuration:t.payload,configurationReceivedAt:n})}#m(t,n){this.#s!==null&&n-this.#s.requestedAtnew WebSocket(n))},this.#s=this.#e.retryMinimumMs}getStatus=()=>this.#n;subscribeStatus=t=>(this.#i.add(t),()=>{this.#i.delete(t)});attach(t){this.#r.push(t);const n=this.#t;return n?.readyState===1&&this.#n.phase==="connected"&&(t.onOpen?.(n),this.#h(n,t)),()=>{const r=this.#r.indexOf(t);if(r<0)return;this.#r.splice(r,1),this.#m(t);const i=this.#t;if(i?.readyState===1)try{t.onBeforeStop?.(i)}catch{}}}start(){this.#o||(this.#o=!0,this.#s=this.#e.retryMinimumMs,this.#p())}stop(){this.#o=!1,this.#v();const t=this.#t;if(this.#t=null,t)try{if(t.readyState===1)for(const n of[...this.#r])n.onBeforeStop?.(t);t.close()}catch{}this.#l(ur)}send(t){if(this.#t?.readyState!==1)return!1;try{return this.#t.send(t),!0}catch{return!1}}#p(){if(!this.#o||this.#t)return;const t=this.#n.reconnects>0;this.#l({...this.#n,phase:t?"reconnecting":"connecting",attempt:this.#n.attempt+1,error:null});let n;try{n=this.#e.webSocketFactory(this.#e.url),this.#t=n}catch(r){this.#l({...this.#n,error:mu(r)}),this.#f();return}this.#c=setTimeout(()=>{if(this.#t===n){this.#l({...this.#n,error:"Connection timed out"});try{n.close()}catch{this.#t=null,this.#f()}}},this.#e.connectTimeoutMs),n.addEventListener("open",()=>{if(!(this.#t!==n||!this.#o)){this.#d(),this.#s=this.#e.retryMinimumMs,this.#l({...this.#n,phase:"connected",connectedAt:this.#e.now(),error:null});for(const r of[...this.#r]){if(this.#t!==n)return;r.onOpen?.(n),this.#h(n,r)}}}),n.addEventListener("message",r=>{if(this.#t!==n||!this.#o)return;const i=pu(r.data);if(i===null)return;const s=this.#e.now();(this.#n.lastMessageAt===null||s-this.#n.lastMessageAt>=1e3)&&this.#l({...this.#n,lastMessageAt:s});const o=[...this.#r];if(!o.some(c=>c.onMessage(i)))for(const c of o)c.onUnclaimed?.(i)}),n.addEventListener("error",()=>{if(!(this.#t!==n||!this.#o)){this.#l({...this.#n,error:"WebSocket connection failed"});try{n.close()}catch{this.#t=null,this.#f()}}}),n.addEventListener("close",()=>{this.#t===n&&(this.#t=null,this.#d(),this.#g(),this.#o&&this.#f())})}#f(){if(!this.#o||this.#a)return;const t=1+(this.#e.random()*2-1)*this.#e.jitterRatio,n=Math.max(0,Math.round(this.#s*t));this.#s=Math.min(this.#s*2,this.#e.retryMaximumMs),this.#l({...this.#n,phase:"reconnecting",reconnects:this.#n.reconnects+1,connectedAt:null}),this.#a=setTimeout(()=>{this.#a=null,this.#p()},n)}#h(t,n){this.#m(n);const r=n.heartbeatMs??24e4;if(!n.onHeartbeat||r<=0)return;const i=setInterval(()=>{this.#t===t&&t.readyState===1&&n.onHeartbeat?.(t)},r);this.#u.set(n,i)}#d(){this.#c&&(clearTimeout(this.#c),this.#c=null)}#m(t){const n=this.#u.get(t);n!==void 0&&(clearInterval(n),this.#u.delete(t))}#g(){for(const t of this.#u.values())clearInterval(t);this.#u.clear()}#v(){this.#d(),this.#g(),this.#a&&(clearTimeout(this.#a),this.#a=null)}#l(t){this.#n=t;for(const n of this.#i)n()}}function pu(e){return typeof e=="string"?e:e instanceof ArrayBuffer?new TextDecoder().decode(e):null}function mu(e){return e instanceof Error?e.message:"Unable to create WebSocket"}const ne=["occurrence-rate","occurrence-count","cumulative-occurrences"],gu=["payload-latest","payload-maximum","payload-change-rate",...ne],_u=["payload-average","payload-latest","payload-minimum","payload-maximum",...ne],vu=["payload-sum","payload-cumulative","payload-latest","payload-average",...ne],lr=["payload-latest","payload-average","payload-minimum","payload-maximum"],fr=[{field:"count",id:"pool:count",label:"Pool transactions",payloadKind:"transactions",description:"Current confirmable transaction count in the pool."},{field:"virtual",id:"pool:vsize",label:"Pool virtual size",payloadKind:"vbytes",description:"Total virtual size of the current pool, in vbytes."},{field:"fee",id:"pool:total_fee",label:"Pool total fees",payloadKind:"satoshis",description:"Total fees of the current pool, in satoshis."}];function hr(e){return`event:${String(e)}`}function dr(e){return`log:${String(e)}`}const ht="native:top";function bu(e){switch(e){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";case"fee-rate":return"fee-rate";default:return"unknown"}}function yu(e){switch(e){case"height":return gu;case"duration":return _u;case"count":return vu;case"fee-rate":return[...lr,...ne];default:return ne}}function wu(e){switch(e){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function ku(e){const t=Ze(e),n=bu(t.valueKind);return{id:hr(e),source:"event",sourceId:e,name:t.name,label:t.label,category:t.category,payloadKind:n,allowedMeasures:yu(n),defaultMeasure:wu(n),description:e===10?"Newly archived transactions, including compact-block recovery. Occurrences measure archival, not all received transactions. Fee rate is normalized to sat/vB.":n==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${t.label} event with a ${n} payload.`}}const zu=[...fr.map(e=>({id:e.id,source:"pool",sourceId:e.field,name:e.field,label:e.label,category:"pool",payloadKind:e.payloadKind,allowedMeasures:lr,defaultMeasure:"payload-latest",description:e.description})),...ft.map(e=>ku(e.id)),...Pe.map(e=>({id:dr(e.id),source:"log",sourceId:e.id,name:e.name,label:`${e.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:ne,defaultMeasure:"occurrence-rate",description:`${e.label} log message volume. Message text is not interpreted as numeric data.`})),{id:ht,source:"native",sourceId:"top",name:"canonical_top",label:"Current top",category:"native",payloadKind:"height",allowedMeasures:["payload-latest","payload-maximum","payload-change-rate"],defaultMeasure:"payload-latest",description:"Canonical chain height reported by the native interface."}];new Map(zu.map(e=>[e.id,e]));function Su(e,t){return Ze(e).valueKind==="fee-rate"?t/1e3:Qa(e,t)??t}const $u=3600*1e3,Ou=1e3,Eu=1e3,Iu=1e3;class pr{constructor(t){this.capacity=t,this.#e=Array.from({length:t})}capacity;#e;#n=0;#t=0;#i=null;get size(){return this.#t}push(t){const n=this.#t===this.capacity;return this.#i=null,this.#e[this.#n]=t,this.#n=(this.#n+1)%this.capacity,this.#t=Math.min(this.#t+1,this.capacity),n}clear(){this.#i=null,this.#e.fill(void 0),this.#n=0,this.#t=0}newestFirst(){if(this.#i)return this.#i;const t=[];for(let n=0;nthis.#A;getRecentLogs=()=>this.#i.newestFirst();getRecentEvents=()=>this.#c.newestFirst();subscribe=t=>(this.#t.add(t),()=>{this.#t.delete(t)});start(){this.#k||(this.tick(),this.#k=setInterval(()=>{this.tick()},1e3))}stop(){this.#k&&(clearInterval(this.#k),this.#k=null),this.#_&&(clearTimeout(this.#_),this.#_=null)}ingest(t,n=this.#e()){const r=this.#b(n);this.#g+=1,rr(t)?this.#j(t,r):Ga(t)?this.#M(t,r):Ha(t)&&(this.#I+=1),this.#z()}recordInvalidFrame(){this.#T+=1,this.#z()}recordNativeTop(t,n=this.#e()){const r=this.#b(n),i=this.#f[ht];i?.value===t&&r-i.time<15e3||(this.#S(ht,r,t),this.#N(r),this.#z())}recordNativeFees(t,n=this.#e()){if(!Number.isFinite(n)||n=uu||this.#y!==null&&n<=this.#y.receivedAt)return;const r=this.#b(n);this.#y={data:t,receivedAt:n};for(const i of fr)this.#S(i.id,r,t[i.field]);this.#N(r),this.#z()}clearLogs(){this.#O+=this.#i.size,this.#i.clear(),this.flush()}clearEvents(){this.#c.clear(),this.flush()}reset(){this.#i.clear(),this.#c.clear(),this.#a.clear(),this.#r={},this.#u={},this.#s={},this.#o={},this.#p={},this.#f={},this.#h={},this.#d=this.#b(this.#e()),this.#g=0,this.#v=0,this.#l=0,this.#O=0,this.#E=0,this.#I=0,this.#T=0,this.#P=null,this.#Z=null,this.#y=null,this.#w=0,this.#$(this.#d),this.flush()}tick(){const t=this.#b(this.#e());this.#$(t),this.#N(t),this.#z()}flush(){this.#_&&(clearTimeout(this.#_),this.#_=null),this.#A=this.#R();for(const t of this.#t)t()}#j(t,n){this.#v+=1,this.#P=n,this.#w+=1,this.#i.push({...t,id:this.#w,receivedAt:n})&&(this.#l+=1),this.#S(dr(t.level),n,null)}#M(t,n){this.#E+=1,this.#Z=n,this.#w+=1,this.#c.push({...t,id:this.#w,receivedAt:n}),this.#S(hr(t.event),n,Su(t.event,t.value))}#b(t){return Number.isFinite(t)?(this.#m=Math.max(this.#m,t),this.#m):this.#m}#S(t,n,r){const i=this.#$(n);i.snapshot=null;const s=i.signals.get(t)??Tu();if(s.count+=1,Ne(this.#o,t,1),r!==null){s.samples+=1,s.sum+=r,s.minimum=s.minimum===null?r:Math.min(s.minimum,r),s.maximum=s.maximum===null?r:Math.max(s.maximum,r),(s.firstAt===null||n=s.lastAt)&&(s.last=r,s.lastAt=n),Ne(this.#p,t,r);const o=this.#f[t];(!o||n>=o.time)&&(this.#f[t]={value:r,time:n}),this.#h[t]=Math.max(this.#h[t]??r,r)}i.signals.set(t,s)}#$(t){const n=Math.floor(t/1e3)*1e3,r=this.#a.get(n);if(r)return r;const i={time:n,signals:new Map,snapshot:null};return this.#a.set(n,i),i}#N(t){const n=t-$u;for(const[r,i]of this.#a){if(r>=n)break;for(const[s,o]of i.signals)if(Ne(this.#r,s,o.count),Ne(this.#u,s,o.sum),o.last!==null&&o.lastAt!==null){const c=this.#s[s];(!c||o.lastAt>=c.time)&&(this.#s[s]={value:o.last,time:o.lastAt})}this.#a.delete(r)}}#z(){!this.#n||this.#_||(this.#_=setTimeout(()=>{this.#_=null,this.flush()},Ou))}#R(){const t=[...this.#a.values()].map(n=>(n.snapshot??={time:n.time,signals:Object.fromEntries([...n.signals].map(([r,i])=>[r,{...i}]))},n.snapshot));return{now:this.#b(this.#e()),sessionStartedAt:this.#d,totalFrames:this.#g,totalLogs:this.#v,evictedLogs:this.#l,clearedLogs:this.#O,totalEvents:this.#E,totalAcks:this.#I,invalidFrames:this.#T,buckets:t,priorSignalCounts:{...this.#r},priorSignalSums:{...this.#u},priorSignalLatest:mr(this.#s),signalTotals:{...this.#o},signalSums:{...this.#p},signalLatest:mr(this.#f),signalMaximums:{...this.#h},recentLogs:this.#i.newestFirst(),recentEvents:this.#c.newestFirst(),lastLogAt:this.#P,lastEventAt:this.#Z,poolSnapshot:this.#y}}}const Re=40;function Zu(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(o=>nr(t.filter,o.level)&&(!n||o.message.toLowerCase().includes(n)||Xa(o.level).name.includes(n))),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,s=Math.min(i,Math.max(0,r.length-Re));return{logs:r.slice(s,s+Re),retained:e.length,matched:r.length,offset:s}}function Au(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(o=>{const c=Ze(o.event);return(t.category==="all"||c.category===t.category)&&(!n||c.name.includes(n)||c.label.toLowerCase().includes(n)||String(o.value).includes(n))}),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,s=Math.min(i,Math.max(0,r.length-Re));return{events:r.slice(s,s+Re),retained:e.length,matched:r.length,offset:s}}function Nu(e,t){const{buckets:n,recentLogs:r,recentEvents:i,...s}=e,o=new Map(t?.buckets.map(c=>[c.time,c]));return{summary:s,reset:t===null,firstBucketTime:n[0]?.time??e.now,buckets:n.filter(c=>o.get(c.time)!==c),recentLogs:r===t?.recentLogs?null:r,recentEvents:i===t?.recentEvents?null:i}}class Ru{constructor(t,n=i=>new du({url:nu(i)}),r=Date.now){this.send=t,this.createSocket=n,this.#e=new Pu(r,!1)}send;createSocket;#e;#n=null;#t=null;#i=[];#c=null;#a=null;#r=0;#u=null;#s=null;#o=null;#p=[];handle(t){if(t.type==="stop"){this.#d(),this.#e.stop(),this.send({type:"stopped"});return}if(t.type==="configure"){if(t.generation=this.#r&&this.#f(t.generation);return}if(t.generation===this.#r)switch(t.type){case"pause-display":{t.stream==="logs"?this.#s=t.paused?this.#s??this.#e.getRecentLogs():null:this.#o=t.paused?this.#o??this.#e.getRecentEvents():null;break}case"poll-events":{this.send({type:"events",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Au(this.#o??this.#e.getRecentEvents(),t.query)});break}case"poll-logs":{this.send({type:"logs",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Zu(this.#s??this.#e.getRecentLogs(),t.query)});break}case"native-top":{this.#e.recordNativeTop(t.height,t.receivedAt);break}case"native-fees":{this.#e.recordNativeFees(t.fees,t.receivedAt);break}case"clear-logs":{this.#e.clearLogs(),this.#s!==null&&(this.#s=[]);break}case"clear-events":{this.#e.clearEvents(),this.#o!==null&&(this.#o=[]);break}case"poll":{if(!this.#n)return;this.#e.flush();const n=this.#e.getSnapshot();this.send({type:"snapshot",generation:this.#r,requestId:t.requestId,status:this.#n.getStatus(),update:Nu(n,this.#u)}),this.#u=n;break}}}#f(t){this.#r=t,this.#u=null,this.#s!==null&&(this.#s=[]),this.#o!==null&&(this.#o=[]),this.#e.reset()}#h(t,n,r){this.#d(),this.#c=t,this.#a=n;const i=this.createSocket(t),s=n===t?i:this.createSocket(n);this.#i=i===s?[i]:[i,s];const o=new eu(i,{logFilter:r}),c=new hu(s),a=()=>{this.send({type:"native",status:c.getStatus(),live:c.getState()})};this.#n=o,this.#t=c,this.#p=[o.subscribeFrames(u=>{this.#e.ingest(u)}),o.subscribeInvalidFrames(()=>{this.#e.recordInvalidFrame()}),c.subscribeStatus(a),c.subscribeState(a)],o.start(),c.start();for(const u of this.#i)u.start()}#d(){for(const t of this.#p)t();this.#p=[];for(const t of this.#i)t.stop();this.#n?.stop(),this.#t?.stop(),this.#i=[],this.#n=null,this.#t=null}}const dt=globalThis,ju=new Ru(e=>{dt.postMessage(e)});dt.addEventListener("message",e=>{ju.handle(e.data),e.data.type==="stop"&&dt.close()})})();\n',K_=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",gx],{type:"text/javascript;charset=utf-8"});function xj(n){let i;try{if(i=K_&&(self.URL||self.webkitURL).createObjectURL(K_),!i)throw"";const a=new Worker(i,{name:n?.name});return a.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(i)}),a}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(gx),{name:n?.name})}}const G_=100,vx=15e3,wj=3*vx,Su={configuration:null,configurationReceivedAt:null,tops:null,topReceivedAt:null,branch:null,branchReceivedAt:null,fees:null,invalidFrames:0};function zj(n,)DELIM" -R"DELIM(i){const a=new Map((i.reset?[]:n.buckets).filter(l=>l.time>=i.firstBucketTime).map(l=>[l.time,l]));for(const l of i.buckets)a.set(l.time,l);return{...i.summary,buckets:[...a.values()],recentLogs:Yf(i.reset?[]:n.recentLogs,i.recentLogs),recentEvents:Yf(i.reset?[]:n.recentEvents,i.recentEvents)}}function Yf(n,i){if(i===null)return n;const a=new Map(n.map(l=>[l.id,l]));return i.map(l=>a.get(l.id)??l)}const Hr={phase:"idle",attempt:0,reconnects:0,connectedAt:null,lastMessageAt:null,error:null};class Tj{constructor(i=()=>new xj){this.createWorker=i}createWorker;#e=null;#t=new Wb().getSnapshot();#n=Hr;#i=new Set;#s=new Set;#r=Hr;#l=Su;#f=new Set;#u=null;#o=null;#b=to;#a=0;#g=0;#c=null;#h=null;#_=null;#m=new Set;#S={logs:[],retained:0,matched:0,offset:0};#E={search:"",filter:to,offset:0};#x=0;#v=null;#w=null;#p=new Set;#A={events:[],retained:0,matched:0,offset:0};#M={search:"",category:"all",offset:0};#T=0;#d=null;#O=!1;#k=!1;getSnapshot=()=>this.#t;getStatus=()=>this.#n;getNativeStatus=()=>this.#r;getNativeLive=()=>this.#l;subscribeNative=i=>(this.#f.add(i),()=>{this.#f.delete(i)});getLogWindow=()=>this.#S;getEventWindow=()=>this.#A;subscribeEvents=i=>(this.#p.add(i),this.#j(),this.#U(),()=>{this.#p.delete(i),this.#p.size===0&&this.#N()});subscribeLogs=i=>(this.#m.add(i),this.#z(),this.#R(),()=>{this.#m.delete(i),this.#m.size===0&&this.#D()});subscribe=i=>(this.#i.add(i),()=>{this.#i.delete(i)});subscribeStatus=i=>(this.#s.add(i),()=>{this.#s.delete(i)});configure(i,a,l){i===this.#u&&a===this.#o&&l===this.#b||(this.#u!==null&&i!==this.#u&&(this.reset(),this.#L({...Hr,phase:"connecting"})),this.#o!==null&&a!==this.#o&&this.#$({...Hr,phase:"connecting"},Su),this.#u=i,this.#o=a,this.#b=l,this.#C())}start(){if(!(this.#e||this.#u===null||this.#o===null))try{const i=this.createWorker();this.#e=i,this.#S={logs:[],retained:0,matched:0,offset:0},this.#A={events:[],retained:0,matched:0,offset:0};for(const a of this.#m)a();for(const a of this.#p)a();this.#L({...Hr,phase:"connecting"}),this.#$({...Hr,phase:"connecting"},Su),i.onmessage=a=>{if(this.#e!==i)return;const l=a.data;if(l.type==="events"){if(l.requestId!==this.#d||(this.#d=null,l.generation!==this.#a))return;if(l.queryVersion!==this.#T){this.#j();return}this.#A={...l.window,events:Yf(this.#A.events,l.window.events)};for(const u of this.#p)u();return}if(l.type==="logs"){if(l.requestId!==this.#v||(this.#v=null,l.generation!==this.#a))return;if(l.queryVersion!==this.#x){this.#z();return}this.#S={...l.window,logs:Yf(this.#S.logs,l.window.logs)};for(const u of this.#m)u();return}if(l.type==="native"){this.#$(l.status,l.live);return}if(l.type==="snapshot"&&l.requestId===this.#c&&(this.#c=null,l.generation===this.#a)){this.#t=zj(this.#t,l.update),this.#L(l.status);for(const u of this.#i)u()}},i.onerror=()=>{this.#H("Telemetry worker failed. Reload the dashboard to reconnect.")},i.onmessageerror=()=>{this.#H("Unable to read telemetry worker data. Reload the dashboard to reconnect.")},this.#C(),this.#O&&this.#y({type:"pause-display",generation:this.#a,stream:"logs",paused:!0}),this.#k&&this.#y({type:"pause-display",generation:this.#a,stream:"events",paused:!0}),this.#Z(),this.getStatus().error===null&&(this.#h=setInterval(()=>{this.#Z()},1e3)),this.#R(),this.#U()}catch(i){this.#H(`Unable to start telemetry worker: ${i instanceof Error?i.message:String(i)}`)}}stop(){this.#B();const i=this.#e;if(this.#e=null,i){const a=setTimeout(()=>{i.terminate()},500),l=()=>{clearTimeout(a),i.terminate()};i.onmessage=u=>{u.data.type==="stopped"&&l()},i.onerror=l,i.onmessageerror=l;try{i.postMessage({type:"stop"})}catch{l()}}this.#L(Hr),this.#$(Hr,Su)}recordNativeTop(i,a=Date.now()){this.#y({type:"native-top",generation:this.#a,height:i,receivedAt:a})}recordNativeFees(i,a=Date.now()){this.#y({type:"native-fees",generation:this.#a,fees:i,receivedAt:a})}clearLogs(){this.#y({type:"clear-logs",generation:this.#a}),this.#x+=1,this.#z()}clearEvents(){this.#y({type:"clear-events",generation:this.#a}),this.#T+=1,this.#j()}setLogsPaused(i){i!==this.#O&&(this.#O=i,this.#D(),this.#y({type:"pause-display",generation:this.#a,stream:"logs",paused:i}),this.#x+=1,this.#z(),this.#R())}setEventsPaused(i){i!==this.#k&&(this.#k=i,this.#N(),this.#y({type:"pause-display",generation:this.#a,stream:"events",paused:i}),this.#T+=1,this.#j(),this.#U())}reset(){this.#a+=1,this.#c=null,this.#v=null,this.#d=null,this.#S={logs:[],retained:0,matched:0,offset:0},this.#A={events:[],retained:0,matched:0,offset:0},this.#t=new Wb().getSnapshot(),this.#y({type:"reset",generation:this.#a});for(const i of this.#i)i();for(const i of this.#m)i();for(const i of this.#p)i()}setLogQuery(i){JSON.stringify(i)!==JSON.stringify(this.#E)&&(this.#E=i,this.#x+=1,this.#z())}setEventQuery(i){JSON.stringify(i)!==JSON.stringify(this.#M)&&(this.#M=i,this.#T+=1,this.#j())}#U(){!this.#e||this.#p.size===0||this.#w||this.#k||(this.#w=setInterval(()=>{this.#j()},G_),this.#j())}#j(){this.#d!==null||!this.#e||this.#p.size===0||(this.#d=++this.#g,this.#y({type:"poll-events",generation:this.#a,requestId:this.#d,queryVersion:this.#T,query:this.#M}))}#N(){this.#w&&clearInterval(this.#w),this.#w=null,this.#d=null}#R(){!this.#e||this.#m.size===0||this.#_||this.#O||(this.#_=setInterval(()=>{this.#z()},G_),this.#z())}#z(){this.#v!==null||!this.#e||this.#m.size===0||(this.#v=++this.#g,this.#y({type:"poll-logs",generation:this.#a,requestId:this.#v,queryVersion:this.#x,query:this.#E}))}#D(){this.#_&&clearInterval(this.#_),this.#_=null,this.#v=null}#C(){this.#u!==null&&this.#o!==null&&this.#y({type:"configure",generation:this.#a,endpoint:this.#u,nativeEndpoint:this.#o,logFilter:this.#b})}#Z(){this.#c!==null||!this.#e||(this.#c=++this.#g,this.#y({type:"poll",generation:this.#a,requestId:this.#c}))}#y(i){try{this.#e?.postMessage(i)}catch{this.#H("Unable to communicate with telemetry worker. Reload the dashboard to reconnect.")}}#B(){this.#D(),this.#N(),this.#h&&clearInterval(this.#h),this.#h=null,this.#c=null}#H(i){this.#B(),this.#e?.terminate(),this.#e=null,this.#L({...Hr,error:i}),this.#$({...Hr,error:i},Su)}#$(i,a){this.#r=i,this.#l=a;for(const l of this.#f)l()}#L(i){if(JSON.stringify(i)!==JSON.stringify(this.#n)){this.#n=i;for(const a of this.#s)a()}}}const yx="libbitcoinAdminDashboardLogFilter";function bx(){try{return globalThis.localStorage}catch{return null}}function Ej(n=bx()){try{const i=n?.getItem(yx);if(!i)return to;const a=JSON.parse(i);return typeof a=="number"&&Number.isInteger(a)&&a>=0&&a<=Fp?a:to}catch{return to}}function Oj(n,i=bx()){try{i?.setItem(yx,String(n))}catch{}}const _x=se.createContext(void 0),Nj=n=>{const i=se.useContext(_x);if(!i)throw new Error("No QueryClient set, use QueryClientProvider to set one");return i},Aj=({client:n,children:i})=>(se.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),x.jsx(_x.Provider,{value:n,children:i})),Mj={setTimeout:(n,i)=>setTimeout(n,i),clearTimeout:n=>clearTimeout(n),setInterval:(n,i)=>setInterval(n,i),clearInterval:n=>clearInterval(n)};var jj=class{#e=Mj;#t=!1;setTimeoutProvider(n){this.#e=n}setTimeout(n,i){return this.#e.setTimeout(n,i)}clearTimeout(n){this.#e.clearTimeout(n)}setInterval(n,i){return this.#e.setInterval(n,i)}clearInterval(n){this.#e.clearInterval(n)}};const Qa=new jj;function kj(n){setTimeout(n,0)}const Rj=typeof window>"u"||"Deno"in globalThis;function vi(){}function Cj(n,i){return typeof n=="function"?n(i):n}function Sx(n){return typeof n=="number"&&n>=0&&n!==1/0}function xx(n,i){return Math.max(n+(i||0)-Date.now(),0)}function kt(n,i){return typeof n=="function"?n(i):n}function Y_(n,i){const{type:a="all",exact:l,fetchStatus:u,predicate:f,queryKey:d,stale:m}=n;if(d){if(l){if(i.queryHash!==pg(d,i.options))return!1}else if(!fo(i.queryKey,d))return!1}if(a!=="all"){const p=i.isActive();if(a==="active"&&!p||a==="inactive"&&p)return!1}return!(typeof m=="boolean"&&i.isStale()!==m||u&&u!==i.state.fetchStatus||f&&!f(i))}function F_(n,i){const{exact:a,status:l,predicate:u,mutationKey:f}=n;if(f){if(!i.options.mutationKey)return!1;if(a){if)DELIM" -R"DELIM((Lu(i.options.mutationKey)!==Lu(f))return!1}else if(!fo(i.options.mutationKey,f))return!1}return!(l&&i.state.status!==l||u&&!u(i))}function pg(n,i){return(i?.queryKeyHashFn||Lu)(n)}function Lu(n){return JSON.stringify(n,(i,a)=>zp(a)?Object.keys(a).sort().reduce((l,u)=>(l[u]=a[u],l),{}):a)}function fo(n,i){if(n===i)return!0;if(typeof n!=typeof i)return!1;if(n&&i&&typeof n=="object"&&typeof i=="object"){if(Array.isArray(n)&&Array.isArray(i)){if(i.length>n.length)return!1;for(let l=0;l500)return i;const l=Q_(n)&&Q_(i);if(!l&&!(zp(n)&&zp(i)))return i;const u=(l?n:Object.keys(n)).length,f=l?i:Object.keys(i),d=f.length,m=l?new Array(d):{};let p=0;for(let g=0;g{Qa.setTimeout(i,n)})}function Tp(n,i,a){return typeof a.structuralSharing=="function"?a.structuralSharing(n,i):a.structuralSharing!==!1?zx(n,i):i}function Uj(n,i,a=0){const l=[...n,i];return a&&l.length>a?l.slice(-a):l}function Zj(n,i,a=0){const l=[i,...n];return a&&l.length>a?l.slice(0,a):l}const gg=Symbol();function Tx(n,i){return!n.queryFn&&i?.initialPromise?()=>i.initialPromise:!n.queryFn||n.queryFn===gg?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function Ex(n,i){return typeof n=="function"?n(...i):!!n}const vg=Symbol();function $j(n,i,a,l){let u=!1,f;return Object.defineProperties(n,{[vg]:{value:l},signal:{enumerable:!0,get:()=>(f??=i(),u||(u=!0,f.aborted?a():f.addEventListener("abort",a,{once:!0})),f)}}),n}let Lj=()=>Rj;const yg=()=>Lj();var qu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Hj=class extends qu{#e;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#n=n,this.#t?.(),this.#t=n(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()})}setFocused(n){this.#e!==n&&(this.#e=n,this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(i=>{i(n)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}};const bg=new Hj,Bj=kj;function qj(){let n=[],i=0,a=m=>{m()},l=m=>{m()},u=Bj;const f=m=>{i?n.push(m):u(()=>{a(m)})},d=()=>{const m=n;n=[],m.length&&u(()=>{l(()=>{m.forEach(p=>{a(p)})})})};return{batch:m=>{let p;i++;try{p=m()}finally{i--,i||d()}return p},batchCalls:m=>(...p)=>{f(()=>{m(...p)})},schedule:f,setNotifyFunction:m=>{a=m},setBatchNotifyFunction:m=>{l=m},setScheduler:m=>{u=m}}}const Un=qj();var Vj=class extends qu{#e=!0;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n(!0),a=()=>n(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",a)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#n=n,this.#t?.(),this.#t=n(this.setOnline.bind(this))}setOnline(n){this.#e!==n&&(this.#e=n,this.listeners.forEach(i=>{i(n)}))}isOnline(){return this.#e}};const Ff=new Vj;function Ij(n){return Math.min(1e3*2**n,3e4)}function Ox(n){return(n??"online")==="online"?Ff.isOnline():!0}var Ep=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function Nx(n){let i=!1,a=0,l,u="pending",f,d;const m=new Promise((D,X)=>{f=D,d=X});m.catch(vi);const p=()=>u!=="pending",g=D=>{if(!p()){const X=new Ep(D);A(X),n.onCancel?.(X)}},b=()=>{i=!0},y=()=>{i=!1},w=()=>bg.isFocused()&&(n.networkMode==="always"||Ff.isOnline())&&n.canRun(),O=()=>Ox(n.networkMode)&&n.canRun(),T=D=>{p()||(l?.(),u="resolved",f(D))},A=D=>{p()||(l?.(),u="rejected",d(D))},k=D=>new Promise(X=>{l=G=>{(p()||D())&&X(G)},n.onPause?.()}).then(()=>{l=void 0,p()||n.onContinue?.()}),L=()=>{if(p())return;let D;const X=a===0?n.initialPromise:void 0;try{D=X??n.fn()}catch(G){D=Promise.reject(G)}Promise.resolve(D).then(T).catch(G=>{if(p())return;const ee=n.retry??(yg()?0:3),V=n.retryDelay??Ij,ne=typeof V=="function"?V(a,G):V,ae=ee===!0||typeof ee=="number"&&ap()||w()?void 0:k(w)).then(()=>{i?A(G):L()})})};return{promise:m,status:()=>u,cancel:g,continue:()=>(l?.(),m),cancelRetry:b,continueRetry:y,canStart:O,start:()=>(O()?L():k(O).then(L),m)}}var Ax=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Sx(this.gcTime)&&(this.#e=Qa.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(yg()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Qa.clearTimeout(this.#e),this.#e=void 0)}};function Pj(n){return{onFetch:(i,a)=>{const l=i.options,u=i.fetchOptions?.meta?.fetchMore?.direction,f=i.state.data?.pages||[],d=i.state.data?.pageParams||[];let m={pages:[],pageParams:[]},p=0;const g=async()=>{let b=!1;const y=i,w=A=>{$j(A,()=>i.signal,()=>b=!0,y[vg])},O=Tx(i.options,i.fetchOptions),T=async(A,k,L)=>{if(b)return Promise.reject(i.signal.reason);if(k==null&&A.pages.length)return Promise.resolve(A);const X=(()=>{const ne={client:i.client,queryKey:i.queryKey,pageParam:k,direction:L?"backward":"forward",meta:i.options.meta};return w(ne),ne})(),G=await O(X),{maxPages:ee}=i.options,V=L?Zj:Uj;return{pages:V(A.pages,G,ee),pageParams:V(A.pageParams,k,ee)}};if(u&&f.length){const A=u==="backward",k=A?Kj:X_,L={pages:f,pageParams:d};m=await T(L,k(l,L),A)}else{const A=n??f.length;do{const k=p===0?d[0]===void 0?l.initialPageParam:d[0]:X_(l,m);if(p>0&&k==null)break;m=await T(m,k),p++}while(pi.options.persister?.(g,{client:i.client,queryKey:i.queryKey,meta:i.options.meta,signal:i.signal},a):i.fetchFn=g}}}function X_(n,{pages:i,pageParams:a}){const l=i.length-1;return i.length>0?n.getNextPageParam(i[l],i,a[l],a):void 0}function Kj(n,{pages:i,pageParams:a}){return i.length>0?n.getPreviousPageParam?.(i[0],i,a[0],a):void 0}var Gj=class extends Ax{#e;#t;#n;#i;#s;#r;#l;#f;#u;constructor(n){super(),this.#u=!1,this.#f=n.defaultOptions,this.setOptions(n.options),this.observers=[],this.#s=n.client,this.#i=this.#s.getQueryCache(),this.queryKey=n.queryKey,this.queryHash=n.queryHash,this.#t=e1(this.options),this.state=n.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#r?.promise}setOptions(n){if(this.options={...this.#f,...n},n?._type&&(this.#e=n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=e1(this.options);i.data!==void 0&&(th)DELIM" -R"DELIM(is.setState(W_(i.data,i.dataUpdatedAt)),this.#t=i)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(n,i){const a=Tp(this.state.data,n,this.options);return this.#o({data:a,type:"success",dataUpdatedAt:i?.updatedAt,manual:i?.manual}),a}setState(n){this.#o({type:"setState",state:n})}cancel(n){const i=this.#r?.promise;return this.#r?.cancel(n),i?i.then(vi).catch(vi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(n=>kt(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===gg||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data===void 0?!1:this.getObserversCount()>0?this.observers.some(n=>kt(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!xx(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(n=>n.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(n=>n.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){const i=this.observers.indexOf(n);i!==-1&&(this.observers.splice(i,1),this.observers.length||(this.#r&&(this.#u||this.state.fetchStatus==="paused"&&this.state.status==="pending"?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(n,i){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&i?.cancelRefetch)this.cancel({silent:!0});else if(this.#r&&this.#l)return this.#r.continueRetry(),this.#l}if(n&&this.setOptions(n),!this.options.queryFn){const g=this.observers.find(b=>b.options.queryFn);g&&this.setOptions(g.options)}const a=new AbortController,l=g=>{Object.defineProperties(g,{[vg]:{value:a.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#u=!0,a.signal)}})},u=()=>{const g=Tx(this.options,i),y=(()=>{const w={client:this.#s,queryKey:this.queryKey,meta:this.meta};return l(w),w})();return this.#u=!1,this.options.persister?this.options.persister(g,y,this):g(y)},d=(()=>{const g={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:u};return l(g),g})();(this.#e==="infinite"?Pj(this.options.pages):this.options.behavior)?.onFetch(d,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==d.fetchOptions?.meta)&&this.#o({type:"fetch",meta:d.fetchOptions?.meta});const m=this.#r=Nx({initialPromise:i?.initialPromise,fn:d.fetchFn,onCancel:g=>{g instanceof Ep&&g.revert&&this.setState({...this.#n,fetchStatus:"idle"}),a.abort()},onFail:(g,b)=>{this.#o({type:"failed",failureCount:g,error:b})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}),p=(async()=>{try{const g=await m.promise;if(g===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(g),this.#i.config.onSuccess?.(g,this),this.#i.config.onSettled?.(g,this.state.error,this),g}catch(g){if(g instanceof Ep){if(g.silent){if(this.#r!==m&&this.#l)return this.#l;throw g}else if(g.revert){if(this.state.data===void 0)throw g;return this.state.data}}throw this.#o({type:"error",error:g}),this.#i.config.onError?.(g,this),this.#i.config.onSettled?.(this.state.data,g,this),g}finally{this.#r===m&&(this.#r=void 0,this.#l=void 0),this.scheduleGc()}})();return this.#l=p,m.start(),p}#o(n){const i=a=>{switch(n.type){case"failed":return{...a,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...Mx(a.data,this.options),fetchMeta:n.meta??null};case"success":const l={...a,...W_(n.data,n.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=n.manual?l:void 0,l;case"error":const u=n.error;return{...a,error:u,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...n.state}}};this.state=i(this.state),Un.batch(()=>{this.observers.slice().forEach(a=>{a.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:n})})}};function Mx(n,i){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ox(i.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function W_(n,i){return{data:n,dataUpdatedAt:i??Date.now(),error:null,isInvalidated:!1,status:"success"}}function e1(n){const i=typeof n.initialData=="function"?n.initialData():n.initialData,a=i!==void 0,l=a?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:i,dataUpdateCount:0,dataUpdatedAt:a?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var Yj=class extends qu{#e;#t=void 0;#n=void 0;#i=void 0;#s;#r;#l;#f;#u;#o;#b;#a;#g;#c=new Set;constructor(n,i){super(),this.options=i,this.#e=n,this.#l=null,this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),t1(this.#t,this.options)?this.#h():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Op(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Op(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#w(),this.#t.removeObserver(this)}setOptions(n){const i=this.options,a=this.#t;if(this.options=this.#e.defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof kt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#p(),this.#t.setOptions(this.options),i._defaulted&&!Jm(this.options,i)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const l=this.hasListeners();l&&n1(this.#t,a,this.options,i)&&this.#h(),this.updateResult(),l&&(this.#t!==a||kt(this.options.enabled,this.#t)!==kt(i.enabled,this.#t)||kt(this.options.staleTime,this.#t)!==kt(i.staleTime,this.#t))&&this.#m();const u=this.#S();l&&(this.#t!==a||kt(this.options.enabled,this.#t)!==kt(i.enabled,this.#t)||u!==this.#g)&&this.#E(u)}getOptimisticResult(n){const i=this.#e.getQueryCache().build(this.#e,n),a=this.createResult(i,n);return Jm(this.getCurrentResult(),a)||(this.#i=a,this.#r=this.options,this.#s=this.#t.state),a}getCurrentResult(){return this.#i}trackResult(n,i){return new Proxy(n,{get:(a,l)=>(this.trackProp(l),i?.(l),Reflect.get(a,l))})}trackProp(n){this.#c.add(n)}getCurrentQuery(){return this.#t}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const i=this.#e.defaultQueryOptions(n),a=this.#e.getQueryCache().build(this.#e,i);let l=()=>{},u;const f=new Promise(d=>{u=d,l=this.#e.getQueryCa)DELIM" -R"DELIM(che().subscribe(m=>{m.type==="updated"&&m.query.queryHash===a.queryHash&&a.state.data!==void 0&&(l(),d(this.createResult(a,i)))})});return Promise.race([a.fetch(i).then(()=>{const d=this.createResult(a,i);return u?.(d),d}).finally(()=>{l()}),f])}fetch(n){return this.#h({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#h(n){this.#p();let i=this.#t.fetch(this.options,n);return n?.throwOnError||(i=i.catch(vi)),i}#_(n){return!yg()&&kt(this.options.enabled,this.#t)!==!1&&Sx(n)}#m(){this.#v();const n=kt(this.options.staleTime,this.#t);if(this.#i.isStale||!this.#_(n))return;const i=xx(this.#i.dataUpdatedAt,n)+1;this.#b=Qa.setTimeout(()=>{this.#i.isStale||this.updateResult()},i)}#S(){return kt(this.options.refetchInterval,this.#t)??!1}#E(n){this.#w(),this.#g=n,!(this.#g===0||!this.#_(this.#g))&&(this.#a=Qa.setInterval(()=>{(this.options.refetchIntervalInBackground||bg.isFocused())&&this.#h()},this.#g))}#x(){this.#m(),this.#E(this.#S())}#v(){this.#b!==void 0&&(Qa.clearTimeout(this.#b),this.#b=void 0)}#w(){this.#a!==void 0&&(Qa.clearInterval(this.#a),this.#a=void 0)}createResult(n,i){const a=this.#t,l=this.options,u=this.#i,f=this.#s,d=this.#r,m=n!==a?n.state:this.#n,{state:p}=n;let g={...p},b=!1,y;if(i._optimisticResults){const ee=this.hasListeners(),V=!ee&&t1(n,i),ne=ee&&n1(n,a,i,l);(V||ne)&&(g={...g,...Mx(p.data,n.options)}),i._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:w,errorUpdatedAt:O,status:T}=g;y=g.data;let A=!1;if(i.placeholderData!==void 0&&y===void 0&&T==="pending"){let ee;u?.isPlaceholderData&&i.placeholderData===d?.placeholderData?(ee=u.data,A=!0):ee=typeof i.placeholderData=="function"?i.placeholderData(this.#o?.state.data,this.#o):i.placeholderData,ee!==void 0&&(T="success",y=Tp(u?.data,ee,i),b=!0)}if(i.select&&y!==void 0&&!A)if(u&&y===f?.data&&i.select===this.#f)y=this.#u;else try{this.#f=i.select,y=i.select(y),y=Tp(u?.data,y,i),this.#u=y,this.#l=null}catch(ee){this.#l=ee}else y===void 0&&(this.#l=null);this.#l&&(w=this.#l,y=this.#u,O=u?.error===w?u.errorUpdatedAt:Date.now(),T="error",b=!1);const k=g.fetchStatus==="fetching",L=T==="pending",D=T==="error",X=L&&k,G=y!==void 0;return{status:T,fetchStatus:g.fetchStatus,isPending:L,isSuccess:T==="success",isError:D,isInitialLoading:X,isLoading:X,data:y,dataUpdatedAt:g.dataUpdatedAt,error:w,errorUpdatedAt:O,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:g.dataUpdateCount>m.dataUpdateCount||g.errorUpdateCount>m.errorUpdateCount,isFetching:k,isRefetching:k&&!L,isLoadingError:D&&!G,isPaused:g.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:D&&G,isStale:_g(n,i),refetch:this.refetch,isEnabled:kt(i.enabled,n)!==!1}}updateResult(){const n=this.#i,i=this.createResult(this.#t,this.options);if(this.#s=this.#t.state,this.#r=this.options,this.#s.data!==void 0&&(this.#o=this.#t),Jm(i,n))return;this.#i=i;const l=(()=>{if(!n)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!this.#c.size||this.options.throwOnError&&this.#i.error!==n.error)return!0;for(const d of f??this.#c)if(this.#i[d]!==n[d])return!0;return!1})();Un.batch(()=>{l&&this.listeners.forEach(u=>{u(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#p(){const n=this.#e.getQueryCache().build(this.#e,this.options);if(n===this.#t)return;const i=this.#t;this.#t=n,this.#n=n.state,this.hasListeners()&&(i?.removeObserver(this),n.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}};function Fj(n,i){return kt(i.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&kt(i.retryOnMount,n)===!1)}function t1(n,i){return Fj(n,i)||n.state.data!==void 0&&Op(n,i,i.refetchOnMount)}function Op(n,i,a){if(kt(i.enabled,n)!==!1&&kt(i.staleTime,n)!=="static"){const l=kt(a,n);return l==="always"||l!==!1&&_g(n,i)}return!1}function n1(n,i,a,l){return(n!==i||kt(l.enabled,n)===!1)&&(!a.suspense||n.state.status!=="error")&&_g(n,a)}function _g(n,i){return kt(i.enabled,n)!==!1&&n.isStaleByTime(kt(i.staleTime,n))}var Qj=class extends Ax{#e;#t;#n;#i;constructor(n){super(),this.#e=n.client,this.mutationId=n.mutationId,this.#n=n.mutationCache,this.#t=[],this.state=n.state||Jj(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){this.#t.includes(n)||(this.#t.push(n),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){this.#t=this.#t.filter(i=>i!==n),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(n){const i=()=>{this.#s({type:"continue"})},a={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},l=this.#i=Nx({fn:()=>this.options.mutationFn?this.options.mutationFn(n,a):Promise.reject(new Error("No mutationFn found")),onFail:(d,m)=>{this.#s({type:"failed",failureCount:d,error:m})},onPause:()=>{this.#s({type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),u=this.state.status==="pending",f=!l.canStart();try{if(u)i();else{this.#s({type:"pending",variables:n,isPaused:f}),this.#n.config.onMutate&&await this.#n.config.onMutate(n,this,a);const m=await this.options.onMutate?.(n,a);m!==this.state.context&&this.#s({type:"pending",context:m,variables:n,isPaused:f})}this.state.isPaused&&l.canStart()&&i();const d=await l.start();return await this.#n.config.onSuccess?.(d,n,this.state.context,this,a),await this.options.onSuccess?.(d,n,this.state.context,a),await this.#n.config.onSettled?.(d,null,this.state.variables,this.state.context,this,a),await this.options.onSettled?.(d,null,n,this.state.context,a),this.#s({type:"success",data:d}),d}catch(d){try{await this.#n.config.onError?.(d,n,this.state.context,this,a)}catch(m){Promise.reject(m)}try{await this.options.onError?.(d,n,this.state.context,a)}catch(m){Promise.reject(m)}try{await this.#n.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,a)}catch(m){Promise.reject(m)}try{await this.options.onSettled?.(void 0,d,n,this.state.context,a)}catch(m){Promise.reject(m)}throw this.#s({type:"error",error:d}),d}finally{this.#i===l&&(this.#i=void 0),this.#n.runNext(this)}}#s(n){const i=a=>{switch(n.type){case"failed":return{...a,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...a,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:n.error,failureCount:a.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=i(this.state),Un.batch(()=>{this.#t.forEach(a=>{a.onMutationUpdate(n)}),this.#n.notify({mutation:this,type:"updated",action:n})})}};function Jj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Xj=class extends qu{#e;#t;#n;constructor(n={}){super(),this.config=n,this.#e=new Set,this.#t=new Map,this.#n=0}build(n,i,a){const l=new Qj({client:n,mutationCache:this,mutationId:++this.#n,options:n.defaultMutationOptions(i),state:a});return this.add(l),l}add(n){this.#e.add(n);const i=Ef(n);if(typeof i=="string"){const a=this.#t.get(i);a?a.push(n):this.#t.set(i,[n])}this.notify({type:"added",mutation:n})}remove(n){if)DELIM" -R"DELIM((this.#e.delete(n)){const i=Ef(n);if(typeof i=="string"){const a=this.#t.get(i);if(a)if(a.length>1){const l=a.indexOf(n);l!==-1&&a.splice(l,1)}else a[0]===n&&this.#t.delete(i)}}this.notify({type:"removed",mutation:n})}canRun(n){const i=Ef(n);if(typeof i=="string"){const a=this.#t.get(i)?.find(l=>l.state.status==="pending");return!a||a===n}else return!0}runNext(n){const i=Ef(n);return typeof i=="string"?this.#t.get(i)?.find(a=>a!==n&&a.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Un.batch(()=>{const n=this.getAll();this.#e.clear(),this.#t.clear(),n.forEach(i=>{this.notify({type:"removed",mutation:i})})})}getAll(){return Array.from(this.#e)}find(n){const i={exact:!0,...n};return this.getAll().find(a=>F_(i,a))}findAll(n={}){return this.getAll().filter(i=>F_(n,i))}notify(n){Un.batch(()=>{this.listeners.forEach(i=>{i(n)})})}resumePausedMutations(){const n=this.getAll().filter(i=>i.state.isPaused);return Un.batch(()=>Promise.all(n.map(i=>i.continue().catch(vi))))}};function Ef(n){return n.options.scope?.id}var Wj=class extends qu{#e;constructor(n={}){super(),this.config=n,this.#e=new Map}build(n,i,a){const l=i.queryKey,u=i.queryHash??pg(l,i);let f=this.get(u);return f||(f=new Gj({client:n,queryKey:l,queryHash:u,options:n.defaultQueryOptions(i),state:a,defaultOptions:n.getQueryDefaults(l)}),this.add(f)),f}add(n){this.#e.has(n.queryHash)||(this.#e.set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){this.#e.get(n.queryHash)===n&&(n.destroy(),this.#e.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){Un.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return this.#e.get(n)}getAll(){return[...this.#e.values()]}find(n){const i={exact:!0,...n};return this.getAll().find(a=>Y_(i,a))}findAll(n={}){const i=this.getAll();return Object.keys(n).length>0?i.filter(a=>Y_(n,a)):i}notify(n){Un.batch(()=>{this.listeners.forEach(i=>{i(n)})})}onFocus(){Un.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){Un.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},ek=class{#e;#t;#n;#i;#s;#r;#l;#f;constructor(n={}){this.#e=n.queryCache||new Wj,this.#t=n.mutationCache||new Xj,this.#n=n.defaultOptions||{},this.#i=new Map,this.#s=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#l=bg.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#f=Ff.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#l?.(),this.#l=void 0,this.#f?.(),this.#f=void 0)}isFetching(n){return this.#e.findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return this.#t.findAll({...n,status:"pending"}).length}getQueryData(n){const i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state.data}ensureQueryData(n){const i=this.defaultQueryOptions(n),a=this.#e.build(this,i),l=a.state.data;return l===void 0?this.fetchQuery(n):(n.revalidateIfStale&&a.isStaleByTime(kt(i.staleTime,a))&&this.prefetchQuery(i),Promise.resolve(l))}getQueriesData(n){return this.#e.findAll(n).map(({queryKey:i,state:a})=>[i,a.data])}setQueryData(n,i,a){const l=this.defaultQueryOptions({queryKey:n}),u=this.#e.get(l.queryHash)?.state.data,f=Cj(i,u);if(f!==void 0)return this.#e.build(this,l).setData(f,{...a,manual:!0})}setQueriesData(n,i,a){return Un.batch(()=>this.#e.findAll(n).map(({queryKey:l})=>[l,this.setQueryData(l,i,a)]))}getQueryState(n){const i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state}removeQueries(n){const i=this.#e;Un.batch(()=>{i.findAll(n).forEach(a=>{i.remove(a)})})}resetQueries(n,i){const a=this.#e;return Un.batch(()=>{const l=a.findAll(n),u=new Set(l);return l.forEach(f=>{f.reset()}),this.refetchQueries({type:"active",predicate:f=>u.has(f)},i)})}cancelQueries(n,i={}){const a={revert:!0,...i},l=Un.batch(()=>this.#e.findAll(n).map(u=>u.cancel(a)));return Promise.all(l).then(vi).catch(vi)}invalidateQueries(n,i={}){return Un.batch(()=>(this.#e.findAll(n).forEach(a=>{a.invalidate()}),n?.refetchType==="none"?Promise.resolve():this.refetchQueries({...n,type:n?.refetchType??n?.type??"active"},i)))}refetchQueries(n,i={}){const a={...i,cancelRefetch:i.cancelRefetch??!0},l=Un.batch(()=>this.#e.findAll(n).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let f=u.fetch(void 0,a);const d=u.state.fetchStatus==="paused";return(!a.throwOnError||d)&&(f=f.catch(vi)),d?Promise.resolve():f}));return Promise.all(l).then(vi)}async query(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const a=this.#e.build(this,i),l=a.isStaleByTime(kt(i.staleTime,a))?await a.fetch(i):a.state.data,u=i.select;return u?u(l):l}fetchQuery(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const a=this.#e.build(this,i);return a.isStaleByTime(kt(i.staleTime,a))?a.fetch(i):Promise.resolve(a.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(vi).catch(vi)}infiniteQuery(n){return n._type="infinite",this.query(n)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(vi).catch(vi)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return Ff.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(n){this.#n=n}setQueryDefaults(n,i){this.#i.set(Lu(n),{queryKey:n,defaultOptions:i})}getQueryDefaults(n){const i=[...this.#i.values()],a={};return i.forEach(l=>{fo(n,l.queryKey)&&Object.assign(a,l.defaultOptions)}),a}setMutationDefaults(n,i){this.#s.set(Lu(n),{mutationKey:n,defaultOptions:i})}getMutationDefaults(n){const i=[...this.#s.values()],a={};return i.forEach(l=>{fo(n,l.mutationKey)&&Object.assign(a,l.defaultOptions)}),a}defaultQueryOptions(n){if(n._defaulted)return n;const i={...this.#n.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return i.queryHash||(i.queryHash=pg(i.queryKey,i)),i.refetchOnReconnect===void 0&&(i.refetchOnReconnect=i.networkMode!=="always"),i.throwOnError===void 0&&(i.throwOnError=!!i.suspense),!i.networkMode&&i.persister&&(i.networkMode="offlineFirst"),i.queryFn===gg&&(i.enabled=!1),i}defaultMutationOptions(n){return n?._defaulted?n:{...this.#n.mutations,...n?.mutationKey&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const jx=se.createContext(!1),tk=()=>se.useContext(jx);jx.Provider;function nk(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}const ik=se.createContext(nk()),rk=()=>se.useContext(ik),sk=(n,i,a)=>{const l=a?.state.status==="error"&&typeof n.throwOnError=="function"?Ex(n.throwOnError,[a.state.error,a]):n.throwOnError;(n.suspense||l)&&(i.isReset()||(n.retryOnMount=!1))},ak=n=>{se.useEffect(()=>{n.clearReset()},[n])},lk=({result:n,errorResetBoundary:i,throwOnError:a,query:l,suspense:u})=>n.isError&&!i.isReset()&&!n.isFetching&&l&&(u&&n.data===void 0||Ex(a,[n.error,l])),ok=n=>{if(n.suspense){const a=u=>u==="static"?u:Math.max(u??1e3,1e3),l=n.staleTime;n.staleTime=typeof l=="function"?(...u)=>a(l(...u)):a(l),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},uk=(n,i)=>n?.suspense&&i.isPending,ck=(n,i,a)=>i.fetchOptimistic(n).catch(()=>{a.clearReset()});function fk(n,i,a){const l=tk(),u=rk(),f=Nj(),d=f.defaultQueryOptions(n),m=f.getQueryCache().get(d.queryHash),p=n.subscribed!==!1;d._optimisticResults=l?"isRestoring":p?"optimistic":void 0,ok(d),sk(d,u,m),ak(u);const[g]=se.useState(()=>new i(f,d)),b=g.getOptimisticResult(d);se.useEffect(()=>{g.setOptions(d)},[d,g]);const y=!l&&p;if(se.useSyncExternalStore(se.useCallback(w=>{const O=y?g.subscribe(Un.batchCalls(w)):vi;return g.updateResult(),O},[g,y]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),uk(d,b))throw ck(d,g,u);if(lk({result:b,errorResetBoundary:u,throwOnError:d.throwOnError,query:m,suspense:d.suspense}))throw b.error;return d.notifyOnChangeP)DELIM" -R"DELIM(rops?b:g.trackResult(b)}function i1(n,i){return fk(n,Yj)}function dk(n,i,a,l=to){const u=se.useSyncExternalStore(a.subscribeStatus,a.getStatus,a.getStatus);return se.useEffect(()=>{a.configure(n,i,l)},[n,i,a,l]),se.useEffect(()=>(a.start(),()=>{a.stop()}),[a]),u}function hk(n,i,a){const l=se.useMemo(()=>WA(n),[n]),u=se.useSyncExternalStore(i.subscribeNative,i.getNativeStatus,i.getNativeStatus),f=se.useSyncExternalStore(i.subscribeNative,i.getNativeLive,i.getNativeLive),d=kx(u,f,a),m=i1({queryKey:["native-snapshot",n],queryFn:({signal:w})=>l3(n,w),enabled:l&&!d,refetchInterval:vx,retry:!1}),p=mk(u,f,m.data??null,a),g=r1(u,f,null,a),b=i1({queryKey:["native-fees",n],queryFn:({signal:w})=>u3(n,w),enabled:l&&g===null,refetchInterval:a3,retry:!1}),y=r1(u,f,b.data??null,a);return se.useEffect(()=>{y!==null&&i.recordNativeFees(y.data,y.receivedAt)},[y,i]),se.useEffect(()=>{p.top!==null&&i.recordNativeTop(p.top,p.receivedAt??Date.now())},[i,p.receivedAt,p.top]),{status:u,live:f,...p,restError:m.error instanceof Error?m.error.message:null}}function kx(n,i,a){return n.phase==="connected"&&i.tops!==null&&i.topReceivedAt!==null&&i.configuration!==null&&i.configurationReceivedAt!==null&&Np(i.topReceivedAt,a)}function mk(n,i,a,l){return kx(n,i,l)&&i.tops!==null?{top:i.tops.confirmed.height,tops:i.tops,branch:i.branchReceivedAt!==null&&Np(i.branchReceivedAt,l)?i.branch:null,configuration:i.configuration,receivedAt:i.topReceivedAt,transport:"websocket"}:a&&Np(a.receivedAt,l)?{top:a.tops.confirmed.height,tops:a.tops,branch:a.branch,configuration:a.configuration,receivedAt:a.receivedAt,transport:"rest"}:{top:null,tops:null,branch:null,configuration:null,receivedAt:null,transport:"none"}}function r1(n,i,a,l){return n.phase==="connected"&&i.fees!==null&&l-i.fees.receivedAtnew Tj,[]),i=ES(),[a]=se.useState(e3),[l,u]=se.useState("overview"),[f,d]=se.useState(!1),[m,p]=se.useState(Ej),[g,b]=se.useState(!1),[y,w]=se.useState(!1),[O,T]=se.useState(Kz),A=se.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot),k=dk(a.adminUrl,a.nativeUrl,n,m),L=hk(a.nativeUrl,n,i),D=L.configuration?`${aS(L.configuration.forks)} ${L.configuration.node.network}`:" ",X=N3(L.tops,L.branch);function G(V){Gz(V),T(V)}function ee(V){Oj(V),p(V)}return x.jsxs("div",{className:"bg-background text-textPrimary min-h-screen",children:[x.jsx("header",{className:"border-accent/30 bg-surface/90 border-b backdrop-blur",children:x.jsx("div",{className:"mx-auto max-w-7xl px-4 py-4",children:x.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-4",children:[x.jsxs("div",{className:"order-1 flex flex-col",children:[x.jsx("button",{type:"button",onClick:()=>{u("overview")},className:"text-accent text-left text-lg font-semibold tracking-tight",children:"Libbitcoin Server"}),x.jsx("span",{className:"text-textMuted text-sm",children:D})]}),x.jsx("nav",{className:"text-textMuted order-3 flex w-full items-center gap-3 text-sm md:order-2 md:w-auto",children:pk.map(V=>x.jsxs("button",{type:"button",onClick:()=>{u(V.id)},className:`text-textMuted hover:text-accent rounded-md px-3 py-1 text-sm transition ${l===V.id?"bg-accentSecondary/20 text-accent":""}`,children:[V.label,V.id==="logs"&&A.totalLogs>0&&x.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:A.totalLogs>999?"999+":String(A.totalLogs)}),V.id==="events"&&A.totalEvents>0&&x.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:A.totalEvents>999?"999+":String(A.totalEvents)})]},V.id))}),x.jsx("div",{className:"order-2 ml-auto flex items-center gap-3 md:order-3",children:x.jsx("button",{type:"button",onClick:()=>{d(!0)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:"Settings"})})]})})}),x.jsxs("main",{className:"mx-auto min-h-[calc(100vh-4rem)] max-w-7xl min-w-0 space-y-6 px-4 py-8",children:[x.jsxs("header",{children:[x.jsx("p",{className:"text-accentSecondary text-sm tracking-wide uppercase",children:"Administration"}),x.jsx("h1",{className:"text-accent text-3xl font-semibold",children:"Admin Dashboard"})]}),l==="overview"&&x.jsx(mj,{adminStatus:k,endpoints:a,metrics:A,native:L,sync:X}),l==="logs"&&x.jsx(GA,{metrics:n,delivery:A,status:k,logFilter:m,paused:g,onLogFilterChange:ee,onPausedChange:V=>{n.setLogsPaused(V),b(V)},onClear:()=>{n.clearLogs()}}),l==="events"&&x.jsx(PA,{metrics:n,paused:y,onPausedChange:V=>{n.setEventsPaused(V),w(V)},onClear:()=>{n.clearEvents()}})]}),x.jsx(bj,{sync:X,browserNotificationsEnabled:O}),f&&x.jsx(Fz,{browserNotificationsEnabled:O,onClose:()=>{d(!1)},onBrowserNotificationsEnabledChange:G})]})}function vk({children:n}){const[i]=se.useState(()=>new ek({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:1}}}));return x.jsx(Aj,{client:i,children:n})}Lz();const Rx=document.querySelector("#root");if(!Rx)throw new Error("Root element not found");Zz.createRoot(Rx).render(x.jsx(Az.StrictMode,{children:x.jsx(vk,{children:x.jsx(gk,{})})})); +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of n.seen.entries()){const h=d[1];if(i===d[0]){f(d);continue}if(n.external){const g=n.external.registry.get(d[0])?.id;if(i!==d[0]&&g){f(d);continue}}if(n.metadataRegistry.get(d[0])?.id){f(d);continue}if(h.cycle){f(d);continue}h.count>1&&n.reused==="ref"&&f(d)}n.external&&(n.sharedDefsExtractedFor=n.external)}function G1(n){const i=n.anyOf;if(!Array.isArray(i)||i.length===0||n.type!==void 0)return;const a=[];for(const l of i){if(!l||typeof l!="object")return;G1(l);const u=Object.keys(l);if(u.length!==1||u[0]!=="type")return;const f=l.type;for(const d of Array.isArray(f)?f:[f]){if(typeof d!="string")return;a.includes(d)||a.push(d)}}delete n.anyOf,n.type=a.length===1?a[0]:a}const Y1=new Set(["type","properties","required","additionalProperties"]),Zb=["oneOf","anyOf"];function Lb(n){const i=n.additionalProperties;return i===void 0||i===!1||typeof i!="object"||i===null?null:Object.keys(i).length?i:null}function op(n){const i=[];for(const f of n){if(typeof f!="object"||f.type!=="object")return null;for(const d in f)if(!Y1.has(d))return null;i.push(f)}const a={},l=new Set;for(const f of i){for(const d in f.properties){if(Object.prototype.hasOwnProperty.call(a,d))continue;const h=[];for(const g of i){const b=g.properties?.[d]??Lb(g);b!=null&&(h.some(v=>JSON.stringify(v)===JSON.stringify(b))||h.push(b))}const p=h.length===1?h[0]:op(h)??{allOf:h};ta(a,d,p)}for(const d of f.required??[])l.add(d)}const u={type:"object",properties:a};if(l.size&&(u.required=[...l]),i.every(f=>f.additionalProperties===!1))u.additionalProperties=!1;else{const f=[];for(const d of i){const h=Lb(d);h&&!f.some(p=>JSON.stringify(p)===JSON.stringify(h))&&f.push(h)}f.length===1?u.additionalProperties=f[0]:f.length>1&&(u.additionalProperties={allOf:f})}return u}function KO(n){const i=n.allOf;if(!Array.isArray(i)||i.length<2)return;for(const u of Y1)if(u in n)return;const a=i.filter(u=>Zb.some(f=>Array.isArray(u[f])));let l=null;if(!a.length)l=op(i);else{const u=a[0],f=Zb.find(p=>Array.isArray(u[p]));if(Object.keys(u).length!==1)return;const d=i.filter(p=>p!==u),h=u[f].map(p=>op([...d,p]));if(h.some(p=>!p))return;l={[f]:h}}l&&(delete n.allOf,Au(n,l))}function F1(n,i){const a=n.seen.get(i);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=h=>{const p=n.seen.get(h);if(p.ref===null)return;const g=p.def??p.schema,b={...g},v=p.ref;if(p.ref=null,v){l(v);const T=n.seen.get(v),E=T.schema;if(E.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(E)):Au(g,E),Au(g,b),h._zod.parent===v)for(const k in g)k==="$ref"||k==="allOf"||k in b||delet)DELIM" +R"DELIM(e g[k];if(E.$ref&&T.def)for(const k in g)k==="$ref"||k==="allOf"||k in T.def&&JSON.stringify(g[k])===JSON.stringify(T.def[k])&&delete g[k]}const w=h._zod.parent;if(w&&w!==v){l(w);const T=n.seen.get(w);if(T?.schema.$ref&&(g.$ref=T.schema.$ref,T.def))for(const E in g)E==="$ref"||E==="allOf"||E in T.def&&JSON.stringify(g[E])===JSON.stringify(T.def[E])&&delete g[E]}n.override({zodSchema:h,jsonSchema:g,path:p.path??[]})};if(!n.external||n.sharedEmitDoneFor!==n.external){for(const h of[...n.seen.entries()].reverse())l(h[0]);if(n.target!=="openapi-3.0")for(const h of n.seen.entries())G1(h[1].def??h[1].schema);for(const h of n.deferred)h();if(n.intersections.length){const h=new Map;for(const p of n.seen.values())for(const g of[p.schema,p.def]){const b=g?.allOf;if(!Array.isArray(b))continue;const v=h.get(b);v?v.push(g):h.set(b,[g])}for(const p of n.intersections)for(const g of h.get(p)??[])KO(g)}}const u={};if(n.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?u.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?u.$schema="http://json-schema.org/draft-04/schema#":n.target,n.external?.uri){const h=n.external.registry.get(i)?.id;if(!h)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(h)}Au(u,a.defId?a.schema:a.def??a.schema);const f=n.metadataRegistry.get(i)?.id;f!==void 0&&u.id===f&&delete u.id;const d=n.external?.defs??{};if(!n.external||n.sharedEmitDoneFor!==n.external)for(const h of n.seen.entries()){const p=h[1];p.def&&p.defId&&(p.def.id===p.defId&&delete p.def.id,ta(d,p.defId,p.def))}n.external&&(n.sharedEmitDoneFor=n.external),n.external||Object.keys(d).length>0&&(n.target==="draft-2020-12"?u.$defs=d:u.definitions=d);try{const h=JSON.parse(JSON.stringify(u));return Object.defineProperty(h,"~standard",{value:{...i["~standard"],jsonSchema:{input:Bf(i,"input",n.processors),output:Bf(i,"output",n.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function ri(n,i){const a=i??{seen:new Set};if(a.seen.has(n))return!1;a.seen.add(n);const l=n._zod.def;if(l.type==="transform")return!0;if(l.type==="array")return ri(l.element,a);if(l.type==="set")return ri(l.valueType,a);if(l.type==="lazy")return ri(l.getter(),a);if(l.type==="promise"||l.type==="optional"||l.type==="nonoptional"||l.type==="nullable"||l.type==="readonly"||l.type==="default"||l.type==="prefault"||l.type==="catch")return ri(l.innerType,a);if(l.type==="intersection")return ri(l.left,a)||ri(l.right,a);if(l.type==="record"||l.type==="map")return ri(l.keyType,a)||ri(l.valueType,a);if(l.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:ri(l.in,a)||ri(l.out,a);if(l.type==="object"){for(const u in l.shape)if(ri(l.shape[u],a))return!0;return!1}if(l.type==="union"){for(const u of l.options)if(ri(u,a))return!0;return!1}if(l.type==="tuple"){for(const u of l.items)if(ri(u,a))return!0;return!!(l.rest&&ri(l.rest,a))}return!1}const GO=(n,i={})=>a=>{const l=P1({...a,processors:i});return Kt(n,l),K1(l,n),F1(l,n)},Bf=(n,i,a={})=>l=>{const{libraryOptions:u,target:f}=l??{},d=P1({...u??{},target:f,io:i,processors:a});return Kt(n,d),K1(d,n),F1(d,n)},ao=(n,i,a)=>{(n[i]===void 0||a>n[i])&&(n[i]=a)},lo=(n,i,a)=>{(n[i]===void 0||a{ao(n,"minimum",i),lo(n,"maximum",i)},Q1=(n,i)=>{n.multipleOf??(n.multipleOf=[]),n.multipleOf.includes(i)||n.multipleOf.push(i)},J1=(n,i)=>{n.patterns??(n.patterns=new Set),n.patterns.add(i)},X1=(n,i)=>{n.mime=n.mime?n.mime.filter(a=>i.includes(a)):[...i]},W1=(n,i)=>{n.format=i,i.includes("int")&&(n.isInt=!0)},Hb=(n,i)=>ao(n,"minimum",i.minimum),Bb=(n,i)=>lo(n,"maximum",i.maximum),qb=n=>(i,a)=>{W1(i,a.format);const[l,u]=n[a.format];ao(i,"minimum",l),lo(i,"maximum",u)},YO={greater_than:(n,i)=>ao(n,i.inclusive?"minimum":"exclusiveMinimum",i.value),less_than:(n,i)=>lo(n,i.inclusive?"maximum":"exclusiveMaximum",i.value),multiple_of:(n,i)=>Q1(n,i.value),number_format:qb(_1),bigint_format:qb(cE),min_length:Hb,max_length:Bb,length_equals:(n,i)=>$b(n,i.length),min_size:Hb,max_size:Bb,size_equals:(n,i)=>$b(n,i.size),string_format:(n,i)=>{W1(n,i.format),i.pattern&&J1(n,i.pattern),(i.format==="base64"||i.format==="base64url")&&(n.contentEncoding=i.format),(i.local||i.precision===-1)&&(n.laxFormat=!0)},mime_type:(n,i)=>X1(n,i.mime)};function Wi(n){const i={},a=n._zod.def,l=n._zod.traits.has("$ZodCheck")?[n,...a.checks??[]]:a.checks??[];for(const f of l)YO[f._zod.def.check]?.(i,f._zod.def);const u=n._zod.bag;u.minimum!==void 0&&ao(i,"minimum",u.minimum),u.exclusiveMinimum!==void 0&&ao(i,"exclusiveMinimum",u.exclusiveMinimum),u.maximum!==void 0&&lo(i,"maximum",u.maximum),u.exclusiveMaximum!==void 0&&lo(i,"exclusiveMaximum",u.exclusiveMaximum),u.multipleOf!==void 0&&Q1(i,u.multipleOf),u.format!==void 0&&(i.format??(i.format=u.format),u.format.includes("int")&&(i.isInt=!0)),u.mime&&X1(i,u.mime);for(const f of u.patterns??[])J1(i,f);return i}const FO={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},QO=new Map([[D1,fT],[Fp,dT]]),eS=n=>QO.get(n)??n,JO=(n,i,a,l)=>{const u=a;u.type="string";const{minimum:f,maximum:d,format:h,patterns:p,contentEncoding:g,laxFormat:b}=Wi(n);if(typeof f=="number"&&(u.minLength=f),typeof d=="number"&&(u.maxLength=d),h&&(u.format=FO[h]??h,u.format===""&&delete u.format,(h==="time"||b)&&delete u.format),g&&(u.contentEncoding=g),p&&p.size>0){const v=[...p].map(eS);v.length===1?u.pattern=v[0].source:v.length>1&&(u.allOf=[...v.map(w=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))])}},XO=(n,i,a,l)=>{const u=a,{minimum:f,maximum:d,multipleOf:h,exclusiveMaximum:p,exclusiveMinimum:g,isInt:b}=Wi(n);u.type=b?"integer":"number";const v=typeof g=="number"&&g>=(f??Number.NEGATIVE_INFINITY),w=typeof p=="number"&&p<=(d??Number.POSITIVE_INFINITY),T=i.target==="draft-04"||i.target==="openapi-3.0";if(v?T?(u.minimum=g,u.exclusiveMinimum=!0):u.exclusiveMinimum=g:typeof f=="number"&&(u.minimum=f),w?T?(u.maximum=p,u.exclusiveMaximum=!0):u.exclusiveMaximum=p:typeof d=="number"&&(u.maximum=d),h){const E=new Set;for(const L of h)Number.isFinite(L)&&L!==0?E.add(Math.abs(L)):Wr(n,i,u,l,`A multipleOf divisor of ${L} cannot be represented in JSON Schema`);const[A,...k]=E;A!==void 0&&(u.multipleOf=A),k.length&&(u.allOf=[...u.allOf??[],...k.map(L=>({multipleOf:L}))])}},WO=(n,i,a,l)=>{a.type="boolean"},eN=(n,i,a,l)=>{a.not={}},tN=(n,i,a,l)=>{},nN=(n,i,a,l)=>{const u=n._zod.def,f=np(u.entries);if(f.length===0){a.not={};return}f.every(d=>typeof d=="number")&&(a.type="number"),f.every(d=>typeof d=="string")&&(a.type="string"),a.enum=f},iN=(n,i,a,l)=>{const u=n._zod.def;if(u.values.length===0){a.not={};return}const f=[];for(const d of u.values)if(d===void 0){if(Wr(n,i,a,l,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof d=="bigint"){if(Wr(n,i,a,l,"BigInt literals cannot be represented in JSON Schema"))return;f.push(Number(d))}else f.push(d);if(f.length!==0)if(f.length===1){const d=f[0];a.type=d===null?"null":typeof d,i.target==="draft-04"||i.target==="openapi-3.0"?a.enum=[d]:a.const=d}else f.every(d=>typeof d=="number")&&(a.type="number"),f.every(d=>typeof d=="string")&&(a.type="string"),f.every(d=>typeof d=="boolean")&&(a.type="boolean"),f.every(d=>d===null)&&(a.type="null"),a.enum=f},sN=(n,i,a,l)=>{Wr(n,i,a,l,"Custom types cannot be represented in JSON Schema")},rN=(n,i,a,l)=>{Wr(n,i,a,l,"Transforms cannot be represented in JSON Schema")},aN=(n,i,a,l)=>{const u=a,f=n._zod.def,{minimum:d,maximum:h}=Wi(n);typeof d=="number"&&(u.minItems=d),typeof h=="number"&&(u.maxItems=h),u.type="array",u.items=Kt(f.element,i,{...l,path:[...l.path,"items"]})};function Uu(n){const i=n._zod.def;return i.type==="pipe"&&i.in._zod.traits.has("$ZodTransform")?Uu(i.out):i.type==="catch"?Uu(i.innerType):n._zod.optin}const lN=(n,i,a,l)=>{const u=a,f=n._zod.def,d=f.shape;if(Object.getOwnPropertySymbols(d).length&&Wr(n,i,u,l,"Symbol keys can)DELIM" +R"DELIM(not be represented in JSON Schema"))return;u.type="object",u.properties={};for(const g in d)ta(u.properties,g,Kt(d[g],i,{...l,path:[...l.path,"properties",g]}));const p=[];for(const g of Object.keys(d)){const b=f.shape[g];(i.io==="input"?Uu(b)===void 0:b._zod.optout===void 0)&&p.push(g)}p.length>0&&(u.required=p),f.catchall?._zod.def.type==="never"?u.additionalProperties=!1:f.catchall?f.catchall&&(u.additionalProperties=Kt(f.catchall,i,{...l,path:[...l.path,"additionalProperties"]})):i.io==="output"&&(u.additionalProperties=!1)},oN=(n,i,a,l)=>{const u=n._zod.def,f=u.inclusive===!1,d=u.options.map((h,p)=>Kt(h,i,{...l,path:[...l.path,f?"oneOf":"anyOf",p]}));f?a.oneOf=d:a.anyOf=d},uN=(n,i,a,l)=>{const u=n._zod.def,f=Kt(u.left,i,{...l,path:[...l.path,"allOf",0]}),d=Kt(u.right,i,{...l,path:[...l.path,"allOf",1]}),h=g=>"allOf"in g&&Object.keys(g).length===1,p=[...h(f)?f.allOf:[f],...h(d)?d.allOf:[d]];a.allOf=p,i.intersections.push(p)},cN=(n,i,a,l)=>{const u=a,f=n._zod.def;u.type="array";const d=i.target==="draft-2020-12"?"prefixItems":"items",h=i.target==="draft-2020-12"||i.target==="openapi-3.0"?"items":"additionalItems",p=f.items.map((A,k)=>Kt(A,i,{...l,path:[...l.path,d,k]})),g=f.rest?Kt(f.rest,i,{...l,path:[...l.path,h,...i.target==="openapi-3.0"?[f.items.length]:[]]}):null;let b=f.items.length;for(;b>0;){const A=f.items[b-1];if(!(i.io==="input"?Uu(A)!==void 0:A._zod.optout==="optional"))break;b--}const v=f.items.length,w=!f.rest;i.target==="draft-2020-12"?(u.prefixItems=p,w?u.items=!1:g&&(u.items=g),b>0&&(u.minItems=b),w&&(u.maxItems=v)):i.target==="openapi-3.0"?(u.items={anyOf:p},g&&u.items.anyOf.push(g),b>0&&(u.minItems=b),w&&(u.maxItems=v)):(u.items=p,w?u.additionalItems=!1:g&&(u.additionalItems=g),b>0&&(u.minItems=b),w&&(u.maxItems=v));const{minimum:T,maximum:E}=Wi(n);typeof T=="number"&&(u.minItems=T),typeof E=="number"&&(u.maxItems=E)};function up(n,i,a){if(i.$ref){if(a.has(i))return i;a.add(i);const E=n.get(i)?.def;if(!E)return i;const A=up(n,E,a);return A===E?i:A}for(const E of["anyOf","oneOf"]){const A=i[E];if(!Array.isArray(A))continue;const k=A.map(L=>up(n,L,a));k.some((L,U)=>L!==A[U])&&(i={...i,[E]:k})}const l=Array.isArray(i.type)?i.type:[i.type],u=!l.includes("string")&&l.some(E=>E==="number"||E==="integer"),f=i.enum??(i.const!==void 0?[i.const]:void 0);if(!u&&!f?.some(E=>typeof E=="number"))return i;const{minimum:d,maximum:h,exclusiveMinimum:p,exclusiveMaximum:g,multipleOf:b,format:v,id:w,...T}=i;return T.enum?T.enum=T.enum.map(E=>typeof E=="number"?String(E):E):typeof T.const=="number"&&(T.const=String(T.const)),u&&(T.type="string",f||(T.pattern=(l.includes("number")?Kp:_T).source)),T}const cp=new WeakMap;function fN(n){const i=new Map;for(const l of n.seen.values())l.def&&!i.has(l.schema)&&i.set(l.schema,l);const a=new Map;for(const l of cp.get(n)??[]){const u=n.seen.get(l),f=(u?.def??u?.schema)?.propertyNames;if(!f||f===!0||a.has(f))continue;const d=up(i,f,new Set);d!==f&&a.set(f,d)}if(a.size)for(const l of n.seen.values())for(const u of[l.schema,l.def]){const f=u&&a.get(u.propertyNames);f&&(u.propertyNames=f)}}const dN=(n,i,a,l)=>{const u=a,f=n._zod.def;u.type="object";const d=f.keyType,h=Wi(d).patterns;if(f.mode==="loose"&&h&&h.size>0){const b=Kt(f.valueType,i,{...l,path:[...l.path,"patternProperties","*"]});u.patternProperties={};for(const v of h)ta(u.patternProperties,eS(v).source,b)}else{if(i.target==="draft-07"||i.target==="draft-2020-12"){u.propertyNames=Kt(f.keyType,i,{...l,path:[...l.path,"propertyNames"]});let b=cp.get(i);b||(b=[],cp.set(i,b),i.deferred.push(()=>fN(i))),b.push(n)}u.additionalProperties=Kt(f.valueType,i,{...l,path:[...l.path,"additionalProperties"]})}const p=d._zod.values,g=i.io==="input"&&Uu(f.valueType)!==void 0;if(p&&!f.partial&&!g){const b=[...p].filter(v=>typeof v=="string"||typeof v=="number");b.length>0&&(u.required=b.map(String))}},hN=(n,i,a,l)=>{const u=n._zod.def,f=Kt(u.innerType,i,l),d=i.seen.get(n);i.target==="openapi-3.0"?(d.ref=u.innerType,a.nullable=!0):a.anyOf=[f,{type:"null"}]},mN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType},Qp=Symbol();function tS(n,i,a,l,u){let f=!1;const d=JSON.stringify(n,(h,p)=>typeof p!="bigint"?p:(f=!0,null));return f?(Wr(i,a,l,u,"BigInt defaults cannot be represented in JSON Schema"),Qp):JSON.parse(d)}const pN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType;const d=tS(u.defaultValue,n,i,a,l);d!==Qp&&(a.default=d)},gN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);if(f.ref=u.innerType,i.io!=="input")return;const d=tS(u.defaultValue,n,i,a,l);d!==Qp&&(a._prefault=d)},vN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType;let d;try{d=u.catchValue(void 0)}catch{Wr(n,i,a,l,"Dynamic catch values are not supported in JSON Schema");return}a.default=d},yN=(n,i,a,l)=>{const u=n._zod.def,f=u.in._zod.traits.has("$ZodTransform"),d=i.io==="input"?f?u.out:u.in:u.out;Kt(d,i,l);const h=i.seen.get(n);h.ref=d},bN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType,a.readOnly=!0},nS=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType},Ib=new WeakSet([Object.prototype,Error.prototype]);function bf(n,i,a){Object.defineProperty(n,i,{configurable:!0,enumerable:!1,get(){const l=a(this);return Object.defineProperty(this,i,{value:l,configurable:!0,writable:!0}),l},set(l){Object.defineProperty(this,i,{value:l,configurable:!0,writable:!0})}})}const _N=(n,i)=>{kE.init(n,i),n.name="ZodError";const a=Object.getPrototypeOf(n);Ib.has(a)||(Ib.add(a),bf(a,"format",l=>u=>DE(l,u)),bf(a,"flatten",l=>u=>CE(l,u)),bf(a,"addIssue",l=>u=>{l.issues.push(u),l.message=JSON.stringify(l.issues,ip,2)}),bf(a,"addIssues",l=>u=>{l.issues.push(...u),l.message=JSON.stringify(l.issues,ip,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},ts=F("ZodError",_N,void 0,{Parent:Error}),SN=qp(ts),xN=Ip(ts),wN=Vp(ts),zN=Pp(ts),EN=BE(ts),TN=qE(ts),ON=IE(ts),NN=VE(ts),AN=PE(ts),MN=KE(ts),jN=GE(ts),kN=YE(ts);function RN(){es.localeError||Bs(Q2())}function Iu(){es.memoizer||Bs({memoizer:G2()})}const Dt=F("ZodType",(n,i)=>(RN(),Nt.init(n,i),n.def=i,n.type=i.type,n),{check(...n){const i=this.def;return this.clone(Di(i,{checks:[...i.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return na(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(kA(n,i))},superRefine(n,i){return this.check(RA(n,i))},overwrite(n){return this.check(mo(n))},optional(){return Gb(this)},exactOptional(){return bA(this)},nullable(){return Yb(this)},nullish(){return Gb(Yb(this))},nonoptional(n){return EA(this,n)},array(){return nd(this)},or(n){return id([this,n])},and(n){return dA(this,n)},transform(n){return Fb(this,yA(n))},default(n){return xA(this,n)},prefault(n){return zA(this,n)},catch(n){return OA(this,n)},pipe(n){return Fb(this,n)},readonly(){return MA(this)},describe(n){const i=this.clone();return zu.add(i,{description:n}),i},meta(...n){if(n.length===0)return zu.get(this);const i=this.clone();return zu.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n,...i){return i.length===0?n(this):n(this,...i)},get"~standard"(){return x1(this,"~standard",{...M1(this),jsonSchema:{input:Bf(this,"input"),output:Bf(this,"output")}})},set"~standard"(n){Xr(this,"~standard",n)},parse:function n(i,a){return SN(this,i,a,{callee:n})},parseAsync:async function n(i,a){return await xN(this,i,a,{callee:n})},safeParse(n,i){return wN(this,n,i)},async safeParseAsync(n,i){return zN(this,n,i)},get spa(){return this?.safeParseAsync},set spa(n){Xr(this,"spa",n)},validate(n,i){return LE(this,n,i)},validateAsync(n,i){return HE(this,n,i)},encode:function n(i,a){return EN(t)DELIM" +R"DELIM(his,i,a,{callee:n})},decode:function n(i,a){return TN(this,i,a,{callee:n})},encodeAsync:async function n(i,a){return await ON(this,i,a,{callee:n})},decodeAsync:async function n(i,a){return await NN(this,i,a,{callee:n})},safeEncode(n,i){return AN(this,n,i)},safeDecode(n,i){return MN(this,n,i)},async safeEncodeAsync(n,i){return jN(this,n,i)},async safeDecodeAsync(n,i){return kN(this,n,i)},toJSONSchema(n){return GO(this,{})(n)},get description(){return zu.get(this)?.description},get _def(){return this._zod.def}}),iS=F("_ZodString",(n,i)=>{Yp.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>JO(n,a,l)},w1({format:n=>Wi(n).format??null,minLength:n=>Wi(n).minimum??null,maxLength:n=>Wi(n).maximum??null},{regex(...n){return this.check(jO(...n))},includes(...n){return this.check(CO(...n))},startsWith(...n){return this.check(DO(...n))},endsWith(...n){return this.check(UO(...n))},min(...n){return this.check(Hf(...n))},max(...n){return this.check(I1(...n))},length(...n){return this.check(V1(...n))},nonempty(...n){return this.check(Hf(1,...n))},lowercase(n){return this.check(kO(n))},uppercase(n){return this.check(RO(n))},trim(){return this.check(LO())},normalize(...n){return this.check(ZO(...n))},toLowerCase(){return this.check($O())},toUpperCase(){return this.check(HO())},slugify(){return this.check(BO())}})),CN=F("ZodString",(n,i)=>{Yp.init(n,i),iS.init(n,i)},{email(n){return this.check(eO($N,n))},url(n){return this.check(aO(BN,n))},jwt(n){return this.check(SO(nA,n))},emoji(n){return this.check(lO(qN,n))},guid(n){return this.check(tO(HN,n))},uuid(n){return this.check(nO(_f,n))},uuidv4(n){return this.check(iO(_f,n))},uuidv6(n){return this.check(sO(_f,n))},uuidv7(n){return this.check(rO(_f,n))},nanoid(n){return this.check(oO(IN,n))},cuid(n){return this.check(uO(VN,n))},cuid2(n){return this.check(cO(PN,n))},ulid(n){return this.check(fO(KN,n))},base64(n){return this.check(yO(WN,n))},base64url(n){return this.check(bO(eA,n))},xid(n){return this.check(dO(GN,n))},ksuid(n){return this.check(hO(YN,n))},ipv4(n){return this.check(mO(FN,n))},ipv6(n){return this.check(pO(QN,n))},cidrv4(n){return this.check(gO(JN,n))},cidrv6(n){return this.check(vO(XN,n))},e164(n){return this.check(_O(tA,n))},datetime(n){return this.check(xO(DN,n))},date(n){return this.check(wO(UN,n))},time(n){return this.check(zO(ZN,n))},duration(n){return this.check(EO(LN,n))}});function Pn(n){return W2(CN,n)}const Ht=F("ZodStringFormat",(n,i)=>{Ct.init(n,i),iS.init(n,i)}),DN=F("ZodISODateTime",(n,i)=>{t2.init(n,i),Ht.init(n,i)}),UN=F("ZodISODate",(n,i)=>{n2.init(n,i),Ht.init(n,i)}),ZN=F("ZodISOTime",(n,i)=>{i2.init(n,i),Ht.init(n,i)}),LN=F("ZodISODuration",(n,i)=>{s2.init(n,i),Ht.init(n,i)}),$N=F("ZodEmail",(n,i)=>{BT.init(n,i),Ht.init(n,i)}),HN=F("ZodGUID",(n,i)=>{$T.init(n,i),Ht.init(n,i)}),_f=F("ZodUUID",(n,i)=>{HT.init(n,i),Ht.init(n,i)}),BN=F("ZodURL",(n,i)=>{GT.init(n,i),Ht.init(n,i)}),qN=F("ZodEmoji",(n,i)=>{YT.init(n,i),Ht.init(n,i)}),IN=F("ZodNanoID",(n,i)=>{FT.init(n,i),Ht.init(n,i)}),VN=F("ZodCUID",(n,i)=>{QT.init(n,i),Ht.init(n,i)}),PN=F("ZodCUID2",(n,i)=>{JT.init(n,i),Ht.init(n,i)}),KN=F("ZodULID",(n,i)=>{XT.init(n,i),Ht.init(n,i)}),GN=F("ZodXID",(n,i)=>{WT.init(n,i),Ht.init(n,i)}),YN=F("ZodKSUID",(n,i)=>{e2.init(n,i),Ht.init(n,i)}),FN=F("ZodIPv4",(n,i)=>{r2.init(n,i),Ht.init(n,i)}),QN=F("ZodIPv6",(n,i)=>{l2.init(n,i),Ht.init(n,i)}),JN=F("ZodCIDRv4",(n,i)=>{o2.init(n,i),Ht.init(n,i)}),XN=F("ZodCIDRv6",(n,i)=>{c2.init(n,i),Ht.init(n,i)}),WN=F("ZodBase64",(n,i)=>{f2.init(n,i),Ht.init(n,i)}),eA=F("ZodBase64URL",(n,i)=>{h2.init(n,i),Ht.init(n,i)}),tA=F("ZodE164",(n,i)=>{m2.init(n,i),Ht.init(n,i)}),nA=F("ZodJWT",(n,i)=>{g2.init(n,i),Ht.init(n,i)}),sS=F("ZodNumber",(n,i)=>{U1.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>XO(n,a,l,u),n.isFinite=!0},w1({minValue:n=>{const{minimum:i,exclusiveMinimum:a}=Wi(n);return Math.max(i??Number.NEGATIVE_INFINITY,a??Number.NEGATIVE_INFINITY)},maxValue:n=>{const{maximum:i,exclusiveMaximum:a}=Wi(n);return Math.min(i??Number.POSITIVE_INFINITY,a??Number.POSITIVE_INFINITY)},isInt:n=>{const{isInt:i,multipleOf:a}=Wi(n);return!!i||!!a?.some(Number.isSafeInteger)},format:n=>Wi(n).format??null},{gt(n,i){return this.check(Cb(n,i))},gte(n,i){return this.check(Vm(n,i))},min(n,i){return this.check(Vm(n,i))},lt(n,i){return this.check(Rb(n,i))},lte(n,i){return this.check(Im(n,i))},max(n,i){return this.check(Im(n,i))},int(n){return this.check(Vb(n))},safe(n){return this.check(Vb(n))},positive(n){return this.check(Cb(0,n))},nonnegative(n){return this.check(Vm(0,n))},negative(n){return this.check(Rb(0,n))},nonpositive(n){return this.check(Im(0,n))},multipleOf(n,i){return this.check(Db(n,i))},step(n,i){return this.check(Db(n,i))},finite(){return this}}));function hn(n){return TO(sS,n)}const iA=F("ZodNumberFormat",(n,i)=>{v2.init(n,i),sS.init(n,i)});function Vb(n){return OO(iA,n)}const sA=F("ZodBoolean",(n,i)=>{y2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>WO(n,a,l)});function Dn(n){return NO(sA,n)}const rA=F("ZodUnknown",(n,i)=>{b2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>tN()});function Pb(){return AO(rA)}const aA=F("ZodNever",(n,i)=>{_2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>eN(n,a,l)});function lA(n){return MO(aA,n)}const oA=F("ZodArray",(n,i)=>{Iu(),w2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>aN(n,a,l,u),n.element=i.element},{min(n,i){return this.check(Hf(n,i))},nonempty(n){return this.check(Hf(1,n))},max(n,i){return this.check(I1(n,i))},length(n,i){return this.check(V1(n,i))},unwrap(){return this.element}});function nd(n,i){return qO(oA,n,i)}const uA=F("ZodObject",(n,i)=>{Iu(),T2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>lN(n,a,l,u),zE(n,"shape",a=>a._zod.def.shape,!1)},{keyof(){return Zu(Object.keys(this._zod.def.shape))},catchall(n){return this.clone(Di(this._zod.def,{catchall:n}))},passthrough(){return this.clone(Di(this._zod.def,{catchall:Pb()}))},loose(){return this.clone(Di(this._zod.def,{catchall:Pb()}))},strict(){return this.clone(Di(this._zod.def,{catchall:lA()}))},strip(){return this.clone(Di(this._zod.def,{catchall:void 0}))},extend(n){return hE(this,n)},safeExtend(n){return mE(this,n)},merge(n){return pE(this,n)},pick(n){return fE(this,n)},omit(n){return dE(this,n)},partial(...n){return db(Jp,this,n[0])},exactPartial(...n){return db(rS,this,n[0],"exactPartial")},required(...n){return gE(aS,this,n[0])}});function Vn(n,i){const a={type:"object",shape:n??{},...Ee(i)};return new uA(a)}const cA=F("ZodUnion",(n,i)=>{O2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>oN(n,a,l,u),n.options=i.options});function id(n,i){return new cA({type:"union",options:n,...Ee(i)})}const fA=F("ZodIntersection",(n,i)=>{N2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>uN(n,a,l,u)});function dA(n,i){return new fA({type:"intersection",left:n,right:i})}const hA=F("ZodTuple",(n,i)=>{Iu(),A2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>cN(n,a,l,u)},{rest(n){return this.clone({...this._zod.def,rest:n})},partial(){const n=this._zod.def;if(n.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...n,items:n.items.map(i=>new Jp({type:"optional",innerType:i}))})}});function mA(n,i,a){const l=i instanceof Nt,u=l?a:i,f=l?i:null;return new hA({type:"tuple",items:n,rest:f,...Ee(u)})}const Kb=F("ZodRecord",(n,i)=>{Iu(),M2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>dN(n,a,l,u),n.keyType=i.keyType,n.valueType=i.valueType});function pA(n,i,a){return!i||!i._zod?new Kb({type:"record",keyType:Pn(),valueType:n,...Ee(i)}):new Kb({type:"record",keyType:n,valueType:i,...Ee(a)})}const fp=F("ZodEnum",(n,i)=>{j2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(l,u,f)=>nN(n,l,u),n.enum=i.entries,n.options=[...n._zod.values];const a=new Set(Object.keys(i.entries));n.extract=(l,u)=>{const f={};for(const d of l)if(a.has(d))f[d]=i.entries[d];else throw new Error(`Key ${d} not found in enum`);return new fp({...i,checks:)DELIM" +R"DELIM([],...Ee(u),entries:f})},n.exclude=(l,u)=>{const f={...i.entries};for(const d of l)if(a.has(d))delete f[d];else throw new Error(`Key ${d} not found in enum`);return new fp({...i,checks:[],...Ee(u),entries:f})}});function Zu(n,i){const a=Array.isArray(n)?Object.fromEntries(n.map(l=>[l,l])):n;return new fp({type:"enum",entries:a,...Ee(i)})}const gA=F("ZodLiteral",(n,i)=>{k2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>iN(n,a,l,u),n.values=new Set(i.values),Object.defineProperty(n,"value",{get(){if(i.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return i.values[0]}})});function Mu(n,i){return new gA({type:"literal",values:Array.isArray(n)?n:[n],...Ee(i)})}const vA=F("ZodTransform",(n,i)=>{Iu(),R2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>rN(n,a,l,u),n._zod.parse=(a,l)=>{if(l.direction==="backward")throw new z1(n.constructor.name);a.addIssue=f=>{if(typeof f=="string")a.issues.push(Du(f,a.value,i));else{const d=f;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),"input"in d||(d.input=a.value),d.inst??(d.inst=n),a.issues.push(Du(d))}};const u=i.transform(a.value,a);return u instanceof Promise?u.then(f=>(a.value=f,a)):(a.value=u,a)}});function yA(n){return new vA({type:"transform",transform:n})}const Jp=F("ZodOptional",(n,i)=>{$1.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>nS(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function Gb(n){return new Jp({type:"optional",innerType:n})}const rS=F("ZodExactOptional",(n,i)=>{C2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>nS(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function bA(n){return new rS({type:"optional",innerType:n})}const _A=F("ZodNullable",(n,i)=>{D2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>hN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function Yb(n){return new _A({type:"nullable",innerType:n})}const SA=F("ZodDefault",(n,i)=>{U2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>pN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function xA(n,i){return new SA({type:"default",innerType:n,get defaultValue(){return typeof i=="function"?i():y1(i)}})}const wA=F("ZodPrefault",(n,i)=>{Z2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>gN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function zA(n,i){return new wA({type:"prefault",innerType:n,get defaultValue(){return typeof i=="function"?i():y1(i)}})}const aS=F("ZodNonOptional",(n,i)=>{L2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>mN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function EA(n,i){return new aS({type:"nonoptional",innerType:n,...Ee(i)})}const TA=F("ZodCatch",(n,i)=>{$2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>vN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function OA(n,i){return new TA({type:"catch",innerType:n,catchValue:typeof i=="function"?i:TE(i)})}const NA=F("ZodPipe",(n,i)=>{H2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>yN(n,a,l,u),n.in=i.in,n.out=i.out});function Fb(n,i){return new NA({type:"pipe",in:n,out:i})}const AA=F("ZodReadonly",(n,i)=>{B2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>bN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function MA(n){return new AA({type:"readonly",innerType:n})}const jA=F("ZodCustom",(n,i)=>{q2.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>sN(n,a,l,u)});function kA(n,i={}){return IO(jA,n,i)}function RA(n,i){return VO(n,i)}const sd=[{id:0,name:"application",label:"Application"},{id:1,name:"news",label:"News"},{id:2,name:"session",label:"Session"},{id:3,name:"protocol",label:"Protocol"},{id:4,name:"proxy",label:"Proxy",disabled:!0},{id:5,name:"remote",label:"Remote"},{id:6,name:"fault",label:"Fault"},{id:7,name:"quitting",label:"Quitting"},{id:9,name:"verbose",label:"Verbose",disabled:!0}],Lu=[{id:0,name:"header_archived",label:"Header archived",category:"headers",valueKind:"height"},{id:1,name:"header_organized",label:"Header organized",category:"headers",valueKind:"height"},{id:2,name:"header_reorganized",label:"Header reorganized",category:"headers",valueKind:"height"},{id:3,name:"block_archived",label:"Block archived",category:"blocks",valueKind:"height"},{id:4,name:"block_buffered",label:"Block buffered",category:"blocks",valueKind:"height"},{id:5,name:"block_validated",label:"Block validated",category:"blocks",valueKind:"height"},{id:6,name:"block_confirmed",label:"Block confirmed",category:"blocks",valueKind:"height"},{id:7,name:"block_unconfirmable",label:"Block unconfirmable",category:"blocks",valueKind:"height"},{id:8,name:"validate_bypassed",label:"Validation bypassed",category:"blocks",valueKind:"height"},{id:9,name:"confirm_bypassed",label:"Confirmation bypassed",category:"blocks",valueKind:"height"},{id:10,name:"tx_archived",label:"Transaction archived",category:"transactions",valueKind:"fee-rate"},{id:11,name:"tx_validated",label:"Transaction validated",category:"transactions",valueKind:"count"},{id:12,name:"tx_invalidated",label:"Transaction invalidated",category:"transactions",valueKind:"count"},{id:13,name:"block_organized",label:"Block organized",category:"chain",valueKind:"height"},{id:14,name:"block_reorganized",label:"Block reorganized",category:"chain",valueKind:"height"},{id:15,name:"template_issued",label:"Mining template issued",category:"mining",valueKind:"count"},{id:16,name:"snapshot_secs",label:"Snapshot",category:"timing",valueKind:"seconds"},{id:17,name:"prune_msecs",label:"Prune",category:"timing",valueKind:"milliseconds"},{id:18,name:"reload_msecs",label:"Store reload",category:"timing",valueKind:"milliseconds"},{id:19,name:"block_usecs",label:"Serve block",category:"timing",valueKind:"microseconds"},{id:20,name:"ancestry_msecs",label:"Serve ancestry",category:"timing",valueKind:"milliseconds"},{id:21,name:"filter_msecs",label:"Serve filter",category:"timing",valueKind:"milliseconds"},{id:22,name:"filterhashes_msecs",label:"Serve filter hashes",category:"timing",valueKind:"milliseconds"},{id:23,name:"filterchecks_msecs",label:"Serve filter checkpoints",category:"timing",valueKind:"milliseconds"},{id:24,name:"ecdsa_secs",label:"ECDSA batch verification",category:"timing",valueKind:"seconds"},{id:25,name:"schnorr_secs",label:"Schnorr batch verification",category:"timing",valueKind:"seconds"},{id:26,name:"silent_secs",label:"Silent payment scan",category:"timing",valueKind:"seconds"},{id:27,name:"validate_usecs",label:"Block validation",category:"timing",valueKind:"microseconds"},{id:28,name:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],lS=hn().int().nonnegative().max(864e13),CA=Vn({level:hn().int().nonnegative(),time:lS,message:Pn()}),DA=Vn({event:hn().int().nonnegative(),value:hn().nonnegative(),time:lS}),UA=Vn({previous:hn().nonnegative()});id([CA,DA,UA]);const qf=sd.reduce((n,i)=>i.disabled?n:n|1<=0&&i<31&&(n&qf&1<0?`${String(a)}d ${String(l)}h`:l>0?`${String(l)}h ${String(u)}m`:u>0?`${String(u)}m ${String(f)}s`:`${String(f)}s`}function uS(n,i){switch(po(n).valueKind){case"height":return`height ${pn(i)}`;case"seconds":return`${Qa(i)} s`;case"milliseconds":return`${Qa(i)} ms`;case"microseconds":return`${Qa(i)} µs`;case"count":return pn(i);case"fee-rate":return`${Qa(i/1e3,3)} sat/vB`;default:return String(i)}}function PA(n){return n>=100?`${Qa(n,0)}/s`:n>=10?`${Qa(n,1)}/s`:`${Qa(n,2)}/s`}const If=32,KA=[{value:"all",label:"All categories"},{value:"headers",label:"Headers"},{value:"blocks",label:"Blocks"},{value:"transactions",label:"Transactions"},{value:"chain",label:"Confirmed chain"},{value:"mining",label:"Mining"},{value:"timing",label:"Timing"}],GA={headers:"bg-violet-500/15 text-violet-300",blocks:"bg-accent/15 text-accent",transactions:"bg-sky-500/15 text-sky-300",chain:"bg-emerald-500/15 text-emerald-300",mining:"bg-amber-500/15 text-amber-300",timing:"bg-cyan-500/15 text-cyan-300"};function YA({metrics:n,paused:i,onPausedChange:a,onClear:l}){const[u,f]=le.useState(""),[d,h]=le.useState("all"),[p,g]=le.useState({offset:0,search:u,category:d}),b=p.search===u&&p.category===d?p.offset:0,v=le.useRef(null),w=le.useSyncExternalStore(n.subscribeEvents,n.getEventWindow,n.getEventWindow);return le.useEffect(()=>{n.setEventQuery({search:u,category:d,offset:b})},[n,u,d,b]),le.useEffect(()=>{v.current&&(v.current.scrollTop=0)},[u,d]),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Node lifecycle"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Live events"}),x.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"Heights are event payloads; timing values retain their source units."}),x.jsx("p",{className:"text-textMuted mt-1 text-xs",children:"Pause freezes this view; collection and charts continue."})]}),x.jsxs("div",{className:"flex gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{i&&(v.current&&(v.current.scrollTop=0),g({offset:0,search:u,category:d})),a(!i)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:i?"Resume display":"Pause display"}),x.jsx("button",{type:"button",onClick:l,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:"Clear"})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 flex flex-wrap gap-3 rounded-2xl border p-4",children:[x.jsxs("label",{className:"min-w-56 flex-1",children:[x.jsx("span",{className:"sr-only",children:"Search events"}),x.jsx("input",{type:"search",value:u,onChange:T=>{f(T.target.value)},placeholder:"Search event names or values…",className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),x.jsxs("label",{children:[x.jsx("span",{className:"sr-only",children:"Filter event category"}),x.jsx("select",{value:d,onChange:T=>{h(T.target.value)},className:"border-accent/40 bg-background text-textPrimary focus:border-accent rounded-md border px-3 py-2 text-sm focus:ring-0",children:KA.map(T=>x.jsx("option",{value:T.value,children:T.label},T.value))})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-xl border",children:[x.jsxs("div",{className:"border-accentSecondary/30 bg-accentSecondary/20 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[x.jsx("span",{children:i?"Display paused · collection continues":b>0?"Viewing older rows · collection continues":"Live stream · newest first"}),x.jsxs("span",{children:[String(w.matched)," matching · ",String(w.retained)," retained"]})]}),x.jsx("div",{ref:v,role:"region","aria-label":"Scrollable event history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:T=>{g({offset:Math.max(0,Math.floor(T.currentTarget.scrollTop/If)-8),search:u,category:d})},children:w.matched===0?x.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching events."}):x.jsx("ol",{"aria-label":"Received events",className:"relative min-w-[32rem]",style:{height:w.matched*If},children:w.events.map((T,E)=>x.jsx(FA,{event:T,index:w.offset+E,total:w.matched},T.id))})})]}),!i&&x.jsx("div",{className:"flex justify-end text-xs",children:x.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{v.current&&(v.current.scrollTop=0),g({offset:0,search:u,category:d})},children:"Jump to latest"})}),x.jsxs("details",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-4 py-3 text-sm",children:["Event contract (",String(Lu.length)," identifiers)"]}),x.jsx("div",{className:"border-accentSecondary/20 grid gap-2 border-t p-4 sm:grid-cols-2 lg:grid-cols-3",children:Lu.map(T=>x.jsxs("div",{className:"text-xs",children:[x.jsx("span",{className:"text-textMuted font-mono",children:String(T.id).padStart(2,"0")}),x.jsx("span",{className:"text-textPrimary ml-2",children:T.name})]},T.id))})]})]})}const FA=le.memo(function({event:i,index:a,total:l}){const u=po(i.event);return x.jsxs("li",{"aria-setsize":l,"aria-posinset":a+1,className:"border-accentSecondary/20 absolute inset-x-0 grid grid-cols-[8.5rem_10rem_minmax(0,1fr)] items-center gap-2 border-b px-4 text-xs",style:{top:a*If,height:If},children:[x.jsx("time",{dateTime:Xp(i.time),className:"text-textMuted font-mono tabular-nums",children:$u(i.time)}),x.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${GA[u.category]}`,children:u.name}),x.jsx("span",{className:"text-textPrimary font-mono tabular-nums",children:uS(i.event,i.value)})]})}),Vf=32,Qb={0:"bg-sky-500/15 text-sky-300",1:"bg-emerald-500/15 text-emerald-300",2:"bg-violet-500/15 text-violet-300",3:"bg-cyan-500/15 text-cyan-300",4:"bg-indigo-500/15 text-indigo-300",5:"bg-blue-500/15 text-blue-300",6:"bg-red-500/20 text-red-300",7:"bg-orange-500/20 text-orange-300",8:"bg-slate-500/20 text-slate-300",9:"bg-zinc-500/20 text-zinc-300"};function QA({metrics:n,delivery:i,status:a,logFilter:l,paused:u,onLogFilterChange:f,onPausedChange:d,onClear:h}){const[p,g]=le.useState(""),[b,v]=le.useState({offset:0,search:p,filter:l}),w=b.search===p&&b.filter===l?b.offset:0,[T,E]=le.useState(null),A=le.useRef(null),k=le.useSyncExternalStore(n.subscribeLogs,n.getLogWindow,n.getLogWindow);return le.useEffect(()=>{n.setLogQuery({search:p,filter:l,offset:w})},[n,p,l,w]),le.useEffect(()=>{A.current&&(A.current.scrollTop=0)},[p,l]),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Diagnostic stream"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Node logs"}),x.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"The newest 1,000 messages are retained in this browser session."})]}),x.jsxs("div",{className:"flex gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{u&&(A.current&&(A.current.scrollTop=0),v({offset:0,search:p,filter:l})),d(!u)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:u?"Resume display":"Pause display"}),x.jsx("button",{type:"button",onClick:h,className:"border-accent/40 text-accen)DELIM" +R"DELIM(t hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:"Clear"})]})]}),x.jsxs("fieldset",{className:"border-accent/30 bg-surface/80 space-y-3 rounded-2xl border p-4",children:[x.jsx("legend",{className:"text-textPrimary px-1 text-sm font-medium",children:"Requested log levels"}),x.jsx("p",{className:"text-textMuted text-xs",children:"Only checked levels are sent by the server. Pause freezes this view; collection and charts continue. Skipped log levels are not replayed."}),x.jsx("div",{className:"flex flex-wrap gap-x-5 gap-y-3",children:sd.map(L=>x.jsxs("label",{className:`text-textPrimary flex items-center gap-2 text-sm ${L.disabled?"opacity-50":""}`,children:[x.jsx("input",{type:"checkbox",checked:LA(l,L.id),disabled:L.disabled,onChange:()=>{f((l^1<{f(ZA)},className:"text-accent hover:underline",children:"Operational levels"}),x.jsx("button",{type:"button",onClick:()=>{f(qf)},className:"text-accent hover:underline",children:"All levels"}),x.jsx("button",{type:"button",onClick:()=>{f(0)},className:"text-accent hover:underline",children:"No levels"}),x.jsx("span",{className:"text-textMuted",children:"Selection is saved in this browser."})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 space-y-2 rounded-2xl border p-4 text-xs",children:[x.jsx("dl",{"aria-label":"Log delivery statistics",className:"flex flex-wrap gap-x-6 gap-y-2",children:[["Received logs",i.totalLogs],["Rolled out of history",i.evictedLogs],["Cleared from history",i.clearedLogs],["Invalid admin frames",i.invalidFrames],["Reconnects",a.reconnects]].map(([L,U])=>x.jsxs("div",{children:[x.jsx("dt",{className:"text-textMuted",children:L}),x.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:U.toLocaleString()})]},L))}),x.jsx("p",{className:"text-textMuted",children:"Live rows refresh every 100 ms and can skip intermediate messages on screen. Every valid log at a requested level is counted; older messages leave the 1,000-message history as new ones arrive. These counters continue while display is paused. Reconnects can leave gaps that the server does not replay."}),x.jsxs("p",{className:"text-textMuted",role:"status",children:["Admin connection: ",a.phase,a.error?` · ${a.error}`:""]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 flex flex-wrap gap-3 rounded-2xl border p-4",children:[x.jsxs("label",{className:"min-w-56 flex-1",children:[x.jsx("span",{className:"sr-only",children:"Search logs"}),x.jsx("input",{type:"search",value:p,onChange:L=>{g(L.target.value)},placeholder:"Search received messages…",className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),x.jsx("p",{className:"text-textMuted self-center text-xs",children:"Search filters received messages only."})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-xl border",children:[x.jsxs("div",{className:"border-accentSecondary/30 bg-accentSecondary/20 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[x.jsx("span",{children:u?"Display paused · collection continues":l===0?"Log delivery disabled":w>0?"Viewing older rows · collection continues":"Live stream · newest first"}),x.jsxs("span",{children:[String(k.matched)," matching · ",String(k.retained)," retained"]})]}),x.jsx("div",{ref:A,role:"region","aria-label":"Scrollable log history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:L=>{v({offset:Math.max(0,Math.floor(L.currentTarget.scrollTop/Vf)-8),search:p,filter:l})},children:k.matched===0?x.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching log messages."}):x.jsx("ol",{"aria-label":"Received logs",className:"relative",style:{height:k.matched*Vf},children:k.logs.map((L,U)=>x.jsx(JA,{log:L,index:k.offset+U,total:k.matched,onSelect:E},L.id))})})]}),x.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[x.jsx("p",{className:"text-textMuted",children:"Select a row to read its full message."}),!u&&x.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{A.current&&(A.current.scrollTop=0),v({offset:0,search:p,filter:l})},children:"Jump to latest"})]}),T&&x.jsx(XA,{log:T,onClose:()=>{E(null)}})]})}const JA=le.memo(function({log:i,index:a,total:l,onSelect:u}){return x.jsx("li",{"aria-setsize":l,"aria-posinset":a+1,className:"border-accentSecondary/20 absolute inset-x-0 border-b",style:{top:a*Vf,height:Vf},children:x.jsxs("button",{type:"button",onClick:()=>{u(i)},className:"hover:bg-accentSecondary/10 focus-visible:bg-accentSecondary/20 grid h-full w-full grid-cols-[5.5rem_4.5rem_minmax(0,1fr)] items-center gap-2 px-4 text-left text-xs sm:grid-cols-[7.5rem_7.5rem_minmax(0,1fr)]",children:[x.jsx("time",{dateTime:Xp(i.time),className:"text-textMuted font-mono tabular-nums",children:$u(i.time,!1)}),x.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${Qb[i.level]??Qb[8]}`,children:oS(i.level).name}),x.jsx("span",{className:"text-textPrimary min-w-0 truncate font-mono",children:i.message.replaceAll(` +`," ↵ ")})]})})});function XA({log:n,onClose:i}){const a=le.useRef(null);return le.useEffect(()=>{const l=a.current;return l?.showModal(),()=>{l?.close()}},[]),x.jsxs("dialog",{ref:a,onClose:i,"aria-labelledby":"log-detail-title",className:"border-accent/30 bg-surface/95 text-textPrimary fixed inset-0 m-auto max-h-[80vh] w-[min(60rem,90vw)] rounded-2xl border p-5 shadow-xl backdrop:bg-black/60",children:[x.jsxs("header",{className:"mb-4 flex items-center justify-between gap-4",children:[x.jsxs("h3",{id:"log-detail-title",className:"text-accent text-lg font-semibold",children:[oS(n.level).label," · ",Xp(n.time)??"Invalid time"]}),x.jsx("button",{type:"button",onClick:i,className:"text-accent rounded px-3 py-2",children:"Close"})]}),x.jsx("pre",{className:"text-sm break-words whitespace-pre-wrap",children:n.message})]})}const WA="Unknown",e3={bitcoin:{p2kh:{0:"mainnet (1)",111:"test networks (m, n)"},p2sh:{5:"mainnet (3)",196:"test networks (2)"},wif:{128:"mainnet (5, K, L)",239:"test networks (9, c)"},witness:{bc:"mainnet",tb:"testnet and signet",bcrt:"regtest"},silent:{sp:"mainnet",tsp:"testnet and signet",sprt:"regtest"},hdPrivate:{76066276:"mainnet (xprv)",77428856:"mainnet BIP49 (yprv)",78791436:"mainnet BIP84 (zprv)",70615956:"test networks (tprv)",71978536:"test networks BIP49 (uprv)",73341116:"test networks BIP84 (vprv)"},hdPublic:{76067358:"mainnet (xpub)",77429938:"mainnet BIP49 (ypub)",78792518:"mainnet BIP84 (zpub)",70617039:"test networks (tpub)",71979618:"test networks BIP49 (upub)",73342198:"test networks BIP84 (vpub)"}},litecoin:{p2kh:{48:"mainnet (L)",111:"test networks (m, n)"},p2sh:{5:"mainnet deprecated (3)",50:"mainnet (M)",58:"test networks (Q)",196:"test networks deprecated (2)"},wif:{176:"mainnet (6, T)",239:"test networks (9, c)"},witness:{ltc:"mainnet",tltc:"testnet",rltc:"regtest"},silent:{},hdPrivate:{76066276:"mainnet (xprv)",27106558:"mainnet (Ltpv)",28469138:"mainnet BIP49 (Mtpv)",70615956:"test networks (tprv)",70709117:"test networks (ttpv)"},hdPublic:{76067358:"mainnet (xpub)",27108450:"mainnet (Ltub)",28471030:"mainnet BIP49 (Mtub)",70617039:"test networks (tpub)",70711009:"test networks (ttub)"}}};function cS(n){return n.includes("ltc_scrypt_proof_of_work")?"litecoin":"bitcoin"}function Pa(n,i,a){return e3[n][i][String(a)]??WA}function dp(){return globalThis.window?.location.origin??"http://localhost"}function Pf(n){const i=n.trim();if(!i)throw new Error("Endpoint URL is required");const a=/^[a-z][a-z\d+\-.]*:\/\//iu.t)DELIM" +R"DELIM(est(i)?i:`http://${i}`,l=new URL(a);if(l.protocol!=="http:"&&l.protocol!=="https:")throw new Error("Endpoint must use HTTP or HTTPS");return l.pathname=l.pathname.replace(/\/+$/u,"")||"/",l.search="",l.hash="",l.toString().replace(/\/$/u,"")}function t3(n){const i=new URL(Pf(n));return i.protocol=i.protocol==="https:"?"wss:":"ws:",i.pathname="/",i.search="",i.hash="",i.toString()}function n3(n,i=dp()){return new URL(Pf(n)).origin===new URL(i).origin}function i3(){try{globalThis.localStorage.removeItem("libbitcoinAdminDashboardEndpoints")}catch{}return{adminUrl:Pf(dp()),nativeUrl:Pf(dp())}}const s3=Vn({store:Vn({address:Dn(),filter:Dn(),silent:hn().int().nonnegative().nullable(),turbo:Dn(),pruned:hn().int().nonnegative()}),node:Vn({network:Pn(),limited:Dn().optional(),blocks:Dn().optional(),witness:Dn().optional(),filters:Dn().optional(),privacy:Dn().optional()}),wallet:Vn({p2kh:hn().int(),p2sh:hn().int(),wif:hn().int(),witness:Pn(),silent:Pn(),hd_private:hn().int(),hd_public:hn().int()}).optional(),network:Vn({relay:Dn(),alert:Dn(),reject:Dn(),compact:Dn(),address:Dn(),witness_tx:Dn(),memory_pool:Dn(),not_found:Dn(),protocol_maximum:hn().int(),protocol_minimum:hn().int()}).optional(),forks:pA(Pn(),Dn()).transform(n=>Object.keys(n).filter(i=>n[i]))}),fS=Pn().regex(/^[0-9a-f]{64}$/u),r3=Vn({hash:fS,height:hn().int().nonnegative(),timestamp:hn().int().positive().max(4294967295)}),Jb=Vn({hash:fS,height:hn().int().nonnegative()}),a3=Vn({confirmed:Jb,candidate:Jb}),Sf=hn().int().nonnegative().max(Number.MAX_SAFE_INTEGER),l3=Vn({count:Sf,virtual:Sf,fee:Sf,histogram:nd(mA([hn().nonnegative(),Sf]))}),o3="/v1/fees?format=json",u3=5e3,Hu=15e3;function jf(n,i){return new URL(i,`${n.replace(/\/+$/u,"")}/`).toString()}async function kf(n,i){const a=await fetch(n,{headers:{Accept:"application/json"},signal:i});if(!a.ok)throw new Error(`Native API request failed with status ${String(a.status)}`);return await a.json()}async function c3(n,i){const[a,l]=await Promise.all([kf(jf(n,"/v1/configuration?format=json"),i),kf(jf(n,"/v1/top?format=json"),i)]),u=s3.parse(a),f=a3.parse(l),d=Date.now();let h=null;if(f.candidate.height>f.confirmed.height)try{const p=f3(f.confirmed.height),g=r3.parse(await kf(jf(n,p),i));g.height===f.confirmed.height&&(h=g)}catch{i?.throwIfAborted()}return{configuration:u,tops:f,branch:h,receivedAt:d}}function f3(n){return`/v1/block/height/${String(n)}/header?format=json&candidate=true`}async function d3(n,i){return{data:l3.parse(await kf(jf(n,o3),i)),receivedAt:Date.now()}}const h3=600,ia=n=>Lu.findIndex(i=>i.name===n),m3=ia("header_archived"),p3=ia("header_organized"),g3=ia("header_reorganized"),v3=ia("block_archived"),y3=ia("block_validated"),b3=ia("validate_bypassed"),_3=ia("block_organized"),S3=ia("block_reorganized"),x3=Uint8Array.from({length:256},(n,i)=>{let a=0;for(let l=i;l>0;l>>=1)a+=l&1;return a});class Xb{#e=new Uint8Array(0);add(i){const a=i>>3;if(a>=this.#e.length){const l=new Uint8Array(Math.max(a+1,this.#e.length*2,1024));l.set(this.#e),this.#e=l}this.#e[a]|=1<<(i&7)}clear(){this.#e=new Uint8Array(0)}count(i,a){let l=0,u=i;for(;u<=a&&(u&7)!==0;)l+=this.#t(u++)?1:0;for(;u+7<=a;)l+=x3[this.#e[u>>3]??0]??0,u+=8;for(;u<=a;)l+=this.#t(u++)?1:0;return l}#t(i){return((this.#e[i>>3]??0)&1<<(i&7))!==0}}class w3{#e=0;#t=new Xb;#n=new Xb;#i=0;#r=null;#s=null;record(i,a,l){if(i===m3)this.#e=Math.max(this.#e,a);else if(i===v3)this.#t.add(a);else if(i===y3||i===b3)this.#n.add(a);else if(i===p3)this.#r={height:a,receivedAt:l};else if(i===g3)this.#r={height:Math.max(0,a-1),receivedAt:l};else if(i===_3)this.#s={height:a,receivedAt:l};else if(i===S3)this.#s={height:Math.max(0,a-1),receivedAt:l};else return;this.#i=Math.max(this.#i,a)}reset(){this.#e=0,this.#t.clear(),this.#n.clear(),this.#i=0,this.#r=null,this.#s=null}snapshot(i=h3){const a=new Uint8Array(i),l=new Uint8Array(i),u=this.#i+1;for(let f=0;f({id:n.id,source:"pool",sourceId:n.field,name:n.field,label:n.label,category:"pool",payloadKind:n.payloadKind,allo)DELIM" +R"DELIM(wedMeasures:hS,defaultMeasure:"payload-latest",description:n.description})),...Lu.map(n=>pS(n.id)),...sd.filter(n=>!n.disabled).map(n=>({id:Gr(n.id),source:"log",sourceId:n.id,name:n.name,label:`${n.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:tl,defaultMeasure:"occurrence-rate",description:`${n.label} log message volume. Message text is not interpreted as numeric data.`})),{id:Kf,source:"native",sourceId:"top",name:"canonical_top",label:"Current top",category:"native",payloadKind:"height",allowedMeasures:["payload-latest","payload-maximum","payload-change-rate"],defaultMeasure:"payload-latest",description:"Canonical chain height reported by the native interface."}],Wp=j3,k3=new Map(Wp.map(n=>[n.id,n]));function cr(n){const i=k3.get(n);if(i)return i;const a=/^event:(\d+)$/u.exec(n);return a?pS(Number(a[1])):{id:n,source:"event",sourceId:-1,name:n,label:n,category:"unknown",payloadKind:"unknown",allowedMeasures:tl,defaultMeasure:"occurrence-rate",description:"Unknown signal; only occurrence measurements are available."}}function Fr(n,i){const a=dS[i];if(i.startsWith("occurrence")||i==="cumulative-occurrences")return a;const l=i==="payload-change-rate"?"height-per-second":n.payloadKind==="height"?"height":n.payloadKind==="duration"?"milliseconds":n.payloadKind==="fee-rate"?"sat-per-vbyte":n.payloadKind==="transactions"||n.payloadKind==="vbytes"||n.payloadKind==="satoshis"?n.payloadKind:"count";return{...a,unit:l}}function R3(n,i){return n.allowedMeasures.includes(i)}function C3(n,i){return po(n).valueKind==="fee-rate"?i/1e3:qA(n,i)??i}const D3=3600*1e3,U3=1e3,Z3=1e3,L3=1e3;class e_{constructor(i){this.capacity=i,this.#e=Array.from({length:i})}capacity;#e;#t=0;#n=0;#i=null;get size(){return this.#n}push(i){const a=this.#n===this.capacity;return this.#i=null,this.#e[this.#t]=i,this.#t=(this.#t+1)%this.capacity,this.#n=Math.min(this.#n+1,this.capacity),a}clear(){this.#i=null,this.#e.fill(void 0),this.#t=0,this.#n=0}newestFirst(){if(this.#i)return this.#i;const i=[];for(let a=0;athis.#O;getRecentLogs=()=>this.#i.newestFirst();getRecentEvents=()=>this.#r.newestFirst();subscribe=i=>(this.#n.add(i),()=>{this.#n.delete(i)});start(){this.#j||(this.tick(),this.#j=setInterval(()=>{this.tick()},1e3))}stop(){this.#j&&(clearInterval(this.#j),this.#j=null),this.#b&&(clearTimeout(this.#b),this.#b=null)}ingest(i,a=this.#e()){const l=this.#_(a);this.#p+=1,$A(i)?this.#U(i,l):HA(i)?this.#Z(i,l):BA(i)&&(this.#E+=1),this.#c()}recordInvalidFrame(){this.#g+=1,this.#c()}recordNativeTop(i,a=this.#e()){const l=this.#_(a),u=this.#m[Kf];u?.value===i&&l-u.time<15e3||(this.#k(Kf,l,i),this.#D(l),this.#c())}recordNativeFees(i,a=this.#e()){if(!Number.isFinite(a)||a=Hu||this.#T!==null&&a<=this.#T.receivedAt)return;const l=this.#_(a);this.#T={data:i,receivedAt:a};for(const u of mS)this.#k(u.id,l,i[u.field]);this.#D(l),this.#c()}clearLogs(){this.#z+=this.#i.size,this.#i.clear(),this.flush()}clearEvents(){this.#r.clear(),this.flush()}reset(){this.#i.clear(),this.#r.clear(),this.#s.clear(),this.#o=Number.NEGATIVE_INFINITY,this.#f={},this.#u={},this.#l={},this.#x={},this.#a={},this.#m={},this.#h={},this.#d=this.#_(this.#e()),this.#p=0,this.#w=0,this.#N=0,this.#z=0,this.#y=0,this.#E=0,this.#g=0,this.#A=null,this.#R=null,this.#T=null,this.#S=0,this.#M.reset(),this.#C(this.#d),this.flush()}resetSyncFill(){this.#M.reset()}tick(){const i=this.#_(this.#e());this.#C(i),this.#D(i),this.#c()}flush(){this.#b&&(clearTimeout(this.#b),this.#b=null),this.#O=this.#L();for(const i of this.#n)i()}#U(i,a){this.#w+=1,this.#A=a,this.#S+=1,this.#i.push({...i,id:this.#S,receivedAt:a})&&(this.#N+=1),this.#k(Gr(i.level),i.time,null)}#Z(i,a){this.#y+=1,this.#R=a,this.#S+=1,this.#r.push({...i,id:this.#S,receivedAt:a}),this.#M.record(i.event,i.value,a),this.#k(Ui(i.event),i.time,C3(i.event,i.value))}#_(i){return Number.isFinite(i)?(this.#v=Math.max(this.#v,i),this.#v):this.#v}#k(i,a,l){const u=this.#C(a);u.snapshot=null;const f=u.signals.get(i)??$3();if(f.count+=1,xf(this.#x,i,1),l!==null){f.samples+=1,f.sum+=l,f.minimum=f.minimum===null?l:Math.min(f.minimum,l),f.maximum=f.maximum===null?l:Math.max(f.maximum,l),(f.firstAt===null||a=f.lastAt)&&(f.last=l,f.lastAt=a),xf(this.#a,i,l);const d=this.#m[i];(!d||a>=d.time)&&(this.#m[i]={value:l,time:a}),this.#h[i]=Math.max(this.#h[i]??l,l)}u.signals.set(i,f)}#C(i){const a=Math.floor(i/1e3)*1e3,l=this.#s.get(a);if(l)return l;const u={time:a,signals:new Map,snapshot:null};if(this.#s.set(a,u),ad-h);this.#s.clear();for(const[d,h]of f)this.#s.set(d,h)}else this.#o=a;return u}#D(i){const a=i-D3;for(const[l,u]of this.#s){if(l>=a)break;for(const[f,d]of u.signals)if(xf(this.#f,f,d.count),xf(this.#u,f,d.sum),d.last!==null&&d.lastAt!==null){const h=this.#l[f];(!h||d.lastAt>=h.time)&&(this.#l[f]={value:d.last,time:d.lastAt})}this.#s.delete(l)}}#c(){!this.#t||this.#b||(this.#b=setTimeout(()=>{this.#b=null,this.flush()},U3))}#L(){const i=[...this.#s.values()].map(a=>(a.snapshot??={time:a.time,signals:Object.fromEntries([...a.signals].map(([l,u])=>[l,{...u}]))},a.snapshot));return{now:this.#_(this.#e()),sessionStartedAt:this.#d,totalFrames:this.#p,totalLogs:this.#w,evictedLogs:this.#N,clearedLogs:this.#z,totalEvents:this.#y,totalAcks:this.#E,invalidFrames:this.#g,buckets:i,priorSignalCounts:{...this.#f},priorSignalSums:{...this.#u},priorSignalLatest:t_(this.#l),signalTotals:{...this.#x},signalSums:{...this.#a},signalLatest:t_(this.#m),signalMaximums:{...this.#h},recentLogs:this.#i.newestFirst(),recentEvents:this.#r.newestFirst(),lastLogAt:this.#A,lastEventAt:this.#R,poolSnapshot:this.#T,syncFill:this.#M.snapshot()}}}function H3(n,i,a,l,u=n[0]?.time??a){const f=a-l*1e3,d=f<=u,h=d?Math.floor(u/1e3)*1e3:Math.ceil(f/1e3)*1e3,p=d?u:h,g=Math.floor(a/1e3)*1e3,v=n.filter(T=>T.time>=h&&T.time<=g).reduce((T,E)=>T+(E.signals[i]?.count??0),0),w=Math.max(0,(a-p)/1e3);return w>0?v/w:0}function B3(n,i){const a=d=>H3(n.buckets,Ui(d),n.now,i,n.sessionStartedAt),l=a(2)+a(14);if(l>0)return{label:"Reorganizing",rate:l};const f=[{label:"Confirming blocks",rate:a(6)},{label:"Validating blocks",rate:a(5)},{label:"Archiving blocks",rate:a(3)},{label:"Synchronizing headers",rate:Math.max(a(0),a(1))}].reduce((d,h)=>h.rate>d.rate?h:d);return f.rate>0?f:{label:"Idle",rate:0}}const rd=18,q3=600*1e3;function I3(n,i,a=null,l=null,u=null,f=Date.now()){if(n===null)return null;const d=i_(n.confirmed,a?.confirmed??null,l),h=i_(n.candidate,a?.candidate??null,l);return{confirmed:d,candidate:h,blocksRemaining:Math.max(0,h.height-d.height),progress:h.height===0?100:Math.min(100,d.height/h.height*100),diverged:P3(n.confirmed,n.candidate,i),fill:a,estimatedTop:V3(h.height,u,f)}}function V3(n,i,a){if(i===null)return n;const l=Math.max(0,a-i.timestamp*1e3);return Math.max(n,i.height+Math.ceil(l/q3))}function i_(n,i,a){return i===null||a===null||i.receivedAt<=a||i.height===n.height?n:{height:i.height}}function P3(n,i,a){return i.height({...a,id:i?ju("series"):a.id}))}:{...n,id:i?ju("chart"):n.id}}function Rf(){return[eg,yS,bS,ld,_S,SS,xS].map(n=>tg(n))}function X3(n){const i=wS.find(a=>a.id===n);return tg(i?.chart??eg,!0)}function ES(){return{id:ju("chart"),title:"Custom chart",visualization:"line",scale:"linear",range:900,series:[{id:ju("series"),signalId:Ui(3),measure:"occurrence-rate",color:Et[0]}]}}function W3(n){const i=" copy",a=`${n.title.slice(0,ad-i.length).trimEnd()}${i}`;return{...tg(n,!0),title:a}}function pp(n){if(!ln(n))return"vbytes";const i=new Set(n.series.map(a=>Fr(cr(a.signalId),a.measure).unit));return i.size===1?[...i][0]??null:null}function TS(n){const i=vS.safeParse(n);if(!i.success)return i.error.issues[0]?.message??"Invalid chart configuration";if(!ln(n))return null;for(const a of n.series){const l=cr(a.signalId);if(!R3(l,a.measure))return`${dS[a.measure].label} is not valid for ${l.label}.`;const u=Fr(l,a.measure);if(!u.chartTypes.includes(n.visualization))return`${u.label} cannot be displayed as a ${n.visualization} chart.`}return pp(n)===null?"All series on a chart must use compatible units.":null}function OS(n){const i=J3.safeParse(n);return!i.success||new Set(i.data.charts.map(a=>a.id)).size!==i.data.charts.length||i.data.charts.some(a=>ln(a)&&new Set(a.series.map(l=>l.id)).size!==a.series.length)?null:i.data.charts.every(a=>TS(a)===null)?i.data.charts:null}function NS(){try{return globalThis.window?.localStorage??null}catch{return null}}function eM(n=NS()){try{const i=n?.getItem(zS);return i?OS(JSON.parse(i))??Rf():Rf()}catch{return Rf()}}function tM(n,i=NS()){try{const a={version:1,charts:n};if(!OS(a))return;i?.setItem(zS,JSON.stringify(a))}catch{}}function ku(n,i){const a=Et.indexOf(n.toLowerCase());return a===-1?n:i.getPropertyValue(`--chart-color-${String(a)}`).trim()||n}function nM({sync:n}){const[i,a]=le.useState(null);if(n===null||!n.diverged&&n.blocksRemaining<=rd)return null;const l=Math.min(99.99,Math.max(0,n.progress)),u=`${l.toFixed(2)}%`;return x.jsxs("section",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-2xl border","aria-labelledby":"node-sync-progress-title",children:[x.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-3 px-5 pt-5",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Node synchronization"}),x.jsx("h2",{id:"node-sync-progress-title",className:"text-accent mt-1 text-lg font-semibold",children:n.diverged?"Candidate branch diverges":"Catching up to top candidate header"})]}),x.jsx("p",{className:"text-accent text-2xl font-semibold tabular-nums",children:u})]}),x.jsxs("div",{className:"px-5 pt-4",children:[x.jsx("div",{role:"progressbar","aria-label":"Node synchronization progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Number(l.toFixed(2)),"aria-valuetext":`${pn(n.blocksRemaining)} blocks remaining`,className:"bg-background border-accentSecondary/20 h-4 overflow-hidden rounded-full border",children:x.jsx(sM,{fill:n.fill,confirmed:n.confirmed.height,candidate:n.candidate.height,estimatedTop:n.estimatedTop,focus:i})}),x.jsx("div",{className:"text-textMuted mt-2 flex flex-wrap gap-4 text-[11px]",children:iM.map(f=>x.jsxs("span",{className:"flex cursor-default items-center gap-1.5",onMouseEnter:()=>{a(f.label)},onMouseLeave:()=>{a(null)},children:[x.jsx("span",{className:"inline-block h-2 w-3 rounded-sm",style:{background:`var(--chart-color-)DELIM" +R"DELIM(${String(f.color)}, ${Et[f.color]})`}}),f.label]},f.label))})]}),x.jsxs("dl",{className:"bg-accentSecondary/10 mt-5 grid gap-px text-sm sm:grid-cols-3",children:[x.jsx(Km,{label:"Top confirmed block",value:pn(n.confirmed.height),hash:n.confirmed.hash}),x.jsx(Km,{label:"Blocks remaining",value:pn(n.blocksRemaining)}),x.jsx(Km,{label:"Top candidate header",value:pn(n.candidate.height),hash:n.candidate.hash})]}),n.diverged&&x.jsx("p",{className:"bg-surface border-accentSecondary/20 border-t px-5 py-2 text-[11px] text-amber-300",children:"The candidate chain does not extend the confirmed top, so the confirmed chain is expected to reorganize."})]})}const iM=[{label:"Confirmed",color:2},{label:"Validated",color:1},{label:"Archived",color:0},{label:"Headers",color:3}];function sM({fill:n,confirmed:i,candidate:a,estimatedTop:l,focus:u}){const f=le.useRef(null),d=Xf();return le.useEffect(()=>{const h=f.current;if(!h)return;const p=()=>{const b=window.devicePixelRatio||1,v=Math.max(1,Math.round(h.clientWidth*b)),w=Math.max(1,Math.round(h.clientHeight*b));h.width!==v&&(h.width=v),h.height!==w&&(h.height=w);const T=h.getContext("2d");if(!T)return;const E=getComputedStyle(h),A=Q=>ku(Et[Q]??"",E),k=Math.max(a,n?.headers??0),L=Math.max(k,l),U=L>0?v/L:0;T.clearRect(0,0,v,w);const W=(Q,V)=>{if(!n||U===0)return;const ne=n.height+1;T.fillStyle=V;for(let ie=0;ie=v)break;T.fillRect(ae,0,se-ae,w)}},I=Q=>u===null||u===Q;I("Headers")&&(T.fillStyle=A(3),T.fillRect(0,0,Math.min(v,k*U),w)),n&&I("Archived")&&W(n.archived,A(0)),n&&I("Validated")&&W(n.validated,A(1)),I("Confirmed")&&(T.fillStyle=A(2),T.fillRect(0,0,Math.min(v,i*U),w))};p();const g=new ResizeObserver(p);return g.observe(h),()=>{g.disconnect()}},[n,i,a,l,u,d]),x.jsx("canvas",{ref:f,className:"block h-full w-full"})}function Km({label:n,value:i,hash:a}){return x.jsxs("div",{className:"bg-surface min-w-0 px-5 py-3",children:[x.jsx("dt",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:n}),x.jsx("dd",{className:"text-textPrimary mt-1 text-lg font-semibold tabular-nums",children:i}),a!==void 0&&x.jsx("dd",{className:"text-textMuted truncate font-mono text-[11px]",title:a,children:a})]})}function ng(n,i){return n.signals[i]}function a_(n,i,a,l){let u=l==="count"?n.priorSignalCounts[i]??0:n.priorSignalSums[i]??0;for(const f of n.buckets){if(f.time>=a)break;const d=ng(f,i);u+=l==="count"?d?.count??0:d?.sum??0}return u}function rM(n,i,a){let l=n.priorSignalLatest[i]??null;for(const u of n.buckets){if(u.time>=a)break;const f=ng(u,i);f?.last!==null&&f?.last!==void 0&&f.lastAt!==null&&(l={value:f.last,time:f.lastAt})}return l}function aM(n,i){const a=i<=n.sessionStartedAt?Math.floor(n.sessionStartedAt/1e3)*1e3:Math.ceil(i/1e3)*1e3,l=Math.floor(n.now/1e3)*1e3,u=new Map(n.buckets.map(d=>[d.time,d])),f=[];for(let d=a;d<=l;d+=1e3)f.push(u.get(d)??{time:d,signals:{}});return f}function lM(n,i,a){const l=Math.max(n.time,a),u=Math.min(i,n.time+1e3);return Math.max(0,(u-l)/1e3)}function oM(n,i,a,l){const u=cr(l.signalId);let f=l.measure==="cumulative-occurrences"?a_(n,l.signalId,a,"count"):l.measure==="payload-cumulative"?a_(n,l.signalId,a,"sum"):0,d=rM(n,l.signalId,a);return i.map(h=>{const p=ng(h,l.signalId);switch(l.measure){case"occurrence-count":return p?.count??0;case"occurrence-rate":{const g=lM(h,n.now,n.sessionStartedAt);return g>0?(p?.count??0)/g:0}case"cumulative-occurrences":return f+=p?.count??0,f;case"payload-sum":return p&&p.samples>0?p.sum:null;case"payload-cumulative":return f+=p?.sum??0,f;case"payload-average":return p&&p.samples>0?p.sum/p.samples:null;case"payload-minimum":return p?.minimum??null;case"payload-maximum":return p?.maximum??null;case"payload-latest":{if(p?.last!==null&&p?.last!==void 0&&p.lastAt!==null)return d={value:p.last,time:p.lastAt},p.last;if(u.source==="pool"){const g=Math.min(h.time+1e3,n.now);return d&&g-d.time0?(p.last-g.value)/b:null}}})}function uM(n,i){const a=n.now-i.range*1e3,l=aM(n,a),u=l[0]?.time??Math.floor(n.now/1e3)*1e3,f=i.series[0],d=Fr(cr(f.signalId),f.measure).unit,h=i.series.filter(p=>(n.signalTotals[p.signalId]??0)===0).map(p=>p.label??cr(p.signalId).label);return{data:[l.map(p=>p.time/1e3),...i.series.map(p=>oM(n,l,u,p))],unit:d,hasObservedData:h.length{const a=()=>{i(Date.now())},l=setInterval(a,1e3);return window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),()=>{clearInterval(l),window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a)}},[]),n}const dM={300:"5 minutes",900:"15 minutes",3600:"1 hour"},hM={line:"Line",step:"Step",area:"Area",bar:"Bar"};function mM(n){return ln(n)?{...n,series:n.series.map(i=>({...i}))}:{...n}}function pM(){const n=new Map;for(const i of Wp){const a=n.get(i.category)??[];a.push(i),n.set(i.category,a)}return[...n]}const gM=pM();function vM({chart:n,mode:i,onCancel:a,onSave:l}){const[u,f]=le.useState(()=>mM(n)),d=TS(u),h=pp(u);le.useEffect(()=>{function E(A){A.key==="Escape"&&a()}return globalThis.addEventListener("keydown",E),()=>{globalThis.removeEventListener("keydown",E)}},[a]);const p=le.useMemo(()=>new Set(mp.filter(E=>ln(u)&&u.series.every(A=>Fr(cr(A.signalId),A.measure).chartTypes.includes(E)))),[u]);function g(E){f(A=>ln(A)?E(A):A)}function b(E,A){g(k=>({...k,series:k.series.map((L,U)=>U===E?A:L)}))}function v(E,A){if(!ln(u))return;const k=u.series[E],L=cr(A);b(E,{...k,signalId:A,measure:L.defaultMeasure})}function w(){if(!ln(u)||u.series.length>=hp)return;const E=pp(u),A=Wp.find(U=>U.allowedMeasures.some(W=>E===null||Fr(U,W).unit===E));if(!A)return;const k=A.allowedMeasures.find(U=>E===null||Fr(A,U).unit===E)??A.defaultMeasure,L={id:`series-${Date.now().toString(36)}-${String(u.series.length+1)}`,signalId:A.id,measure:k,color:Et[u.series.length%Et.length]??Et[0]};g(U=>({...U,series:[...U.series,L]}))}function T(E){E.preventDefault(),!d&&l({...u,title:u.title.trim()})}return x.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:E=>{E.target===E.currentTarget&&a()},children:x.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"chart-editor-title",className:"border-accent/30 bg-surface/95 max-h-[92vh] w-full max-w-4xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/60",children:[x.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Dashboard builder"}),x.jsx("h2",{id:"chart-editor-title",className:"text-accent mt-1 text-xl font-semibold",children:i==="add"?"Add chart":"Edit chart"})]}),x.jsx("button",{type)DELIM" +R"DELIM(:"button",onClick:a,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close chart editor",children:"×"})]}),i==="add"&&x.jsxs("div",{className:"border-accentSecondary/20 border-b p-5",children:[x.jsx("p",{className:"text-accentSecondary mb-3 text-xs tracking-wide uppercase",children:"Start from a template"}),x.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-5",children:[wS.map(E=>x.jsxs("button",{type:"button",onClick:()=>{f(X3(E.id))},className:"border-accent/30 bg-background hover:border-accent rounded-md border p-3 text-left",children:[x.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:E.label}),x.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:E.description})]},E.id)),x.jsxs("button",{type:"button",onClick:()=>{f(ES())},className:"border-accent/30 bg-background hover:border-accent rounded-md border p-3 text-left",children:[x.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:"Custom"}),x.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:"Begin with one editable series."})]})]})]}),x.jsxs("form",{onSubmit:T,className:"space-y-6 p-5",children:[x.jsxs("div",{className:"grid gap-4 md:grid-cols-[minmax(0,1fr)_11rem_11rem]",children:[x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Chart title"}),x.jsx("input",{value:u.title,maxLength:ad,onChange:E=>{f(A=>({...A,title:E.target.value}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),ln(u)?x.jsxs(x.Fragment,{children:[x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Chart type"}),x.jsx("select",{value:u.visualization,onChange:E=>{g(A=>({...A,visualization:E.target.value}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0",children:mp.map(E=>x.jsx("option",{value:E,disabled:!p.has(E),children:hM[E]},E))})]}),x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Time range"}),x.jsx("select",{value:u.range,onChange:E=>{g(A=>({...A,range:Number(E.target.value)}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0",children:K3.map(E=>x.jsx("option",{value:E,children:dM[E]},E))})]})]}):x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Bar color"}),x.jsx("input",{type:"color",value:u.color,onChange:E=>{const A=E.target.value;f(k=>ln(k)?k:{...k,color:A})},className:"border-accent/40 bg-background h-10 w-full rounded-md border p-1"})]})]}),ln(u)?x.jsxs("section",{className:"space-y-3",children:[x.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[x.jsxs("div",{children:[x.jsx("h3",{className:"text-accent text-lg font-semibold",children:"Series"}),x.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:["One chart uses one axis unit",h===null?".":`: ${AS(h)}.`]})]}),x.jsx("button",{type:"button",onClick:w,disabled:u.series.length>=hp,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary disabled:text-textMuted rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-50",children:"Add series"})]}),x.jsx("div",{className:"space-y-3",children:u.series.map((E,A)=>{const k=cr(E.signalId),L=Fr(k,E.measure);return x.jsxs("article",{className:"border-accentSecondary/20 bg-accent/5 grid gap-3 rounded-xl border p-4 lg:grid-cols-[minmax(12rem,1.2fr)_minmax(11rem,1fr)_minmax(9rem,0.8fr)_3.5rem_auto]",children:[x.jsxs("label",{className:"space-y-1.5",children:[x.jsxs("span",{className:"text-textMuted text-xs",children:["Signal ",String(A+1)]}),x.jsx("select",{"aria-label":`Signal ${String(A+1)}`,value:E.signalId,onChange:U=>{v(A,U.target.value)},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-2 py-2 text-sm focus:ring-0",children:gM.map(([U,W])=>x.jsx("optgroup",{label:U,children:W.map(I=>x.jsx("option",{value:I.id,children:I.label},I.id))},U))})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Measurement"}),x.jsx("select",{"aria-label":`Measurement ${String(A+1)}`,value:E.measure,onChange:U=>{b(A,{...E,measure:U.target.value})},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-2 py-2 text-sm focus:ring-0",title:L.description,children:k.allowedMeasures.map(U=>x.jsx("option",{value:U,children:Fr(k,U).label},U))})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Display label"}),x.jsx("input",{"aria-label":`Display label ${String(A+1)}`,value:E.label??"",onChange:U=>{b(A,{...E,label:U.target.value||void 0})},placeholder:k.label,className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/50 focus:border-accent w-full rounded-md border px-2 py-2 text-sm focus:ring-0"})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Color"}),x.jsx("input",{"aria-label":`Series color ${String(A+1)}`,type:"color",value:E.color,onChange:U=>{b(A,{...E,color:U.target.value})},className:"border-accent/40 bg-background h-10 w-full rounded-md border p-1"})]}),x.jsx("button",{type:"button",onClick:()=>{g(U=>({...U,series:U.series.filter((W,I)=>I!==A)}))},disabled:u.series.length===1,"aria-label":`Remove series ${String(A+1)}`,className:"text-textMuted self-end rounded-md px-3 py-2 text-sm hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-30",children:"Remove"})]},E.id)})})]}):x.jsx("p",{className:"text-textMuted text-sm",children:"Shows the latest transaction-pool fee distribution, refreshed every five seconds. Each bar shows the virtual size of one fee-rate group, labeled by its minimum fee rate in sat/vB."}),d&&x.jsx("p",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-200",children:d}),x.jsxs("div",{className:"border-accentSecondary/20 flex justify-end gap-2 border-t pt-4",children:[x.jsx("button",{type:"button",onClick:a,className:"text-textMuted hover:text-accent rounded-md px-4 py-2 text-sm",children:"Cancel"}),x.jsx("button",{type:"submit",disabled:d!==null,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-40",children:i==="add"?"Add chart":"Save changes"})]})]})]})})}const yM=!0,gn="u-",bM="uplot",_M=gn+"hz",SM=gn+"vt",xM=gn+"title",wM=gn+"wrap",zM=gn+"under",EM=gn+"over",TM=gn+"axis",Fa=gn+"off",OM=gn+"select",NM=gn+"cursor-x",AM=gn+"cursor-y",MM=gn+"cursor-pt",jM=gn+"legend",kM=gn+"live",RM=gn+"inline",CM=gn+"series",DM=gn+"marker",l_=gn+"label",UM=gn+"value",Eu="width",Tu="height",bu="top",o_="bottom",Wl="left",Gm="right",ig="#000",u_=ig+"0",Ym="mousemove",c_="mousedown",Fm="mouseup",f_="mouseenter",d_="mouseleave",h_="dblclick",ZM="resize",LM="scroll",m_="change",Gf="dppxchange",sg="--",go=typeof window<"u",gp=go?document:null,io=go?window:null,$M=go?navigator:null;let st,zf;function vp(){let n=devicePixelRatio;st!=n&&(st=n,zf&&bp(m_,zf,vp),zf=matchMedia(`(min-resolution: ${st-.001}dppx) and (max-resolution: ${st+.001}dppx)`),Wa(m_,zf,vp),io.dispatchEvent(new CustomEvent(Gf)))}function Ci(n,i){if(i!=null){let a=n.classList;!a.contains(i)&&a.add(i)}}function yp(n,i){let a=n.classList;a.contains(i)&&a.remove(i)}function Ot(n,i,a){n.style[i]=a+"px"}function vs(n,i,a,l){let u=gp.createElement(n);return i!=null&&Ci(u,i),a?.insertBefore(u,l),u}function Ji(n,i){return vs("div",n,i)}const p_=new WeakMap;function)DELIM" +R"DELIM( $s(n,i,a,l,u){let f="translate("+i+"px,"+a+"px)",d=p_.get(n);f!=d&&(n.style.transform=f,p_.set(n,f),i<0||a<0||i>l||a>u?Ci(n,Fa):yp(n,Fa))}const g_=new WeakMap;function v_(n,i,a){let l=i+a,u=g_.get(n);l!=u&&(g_.set(n,l),n.style.background=i,n.style.borderColor=a)}const y_=new WeakMap;function b_(n,i,a,l){let u=i+""+a,f=y_.get(n);u!=f&&(y_.set(n,u),n.style.height=a+"px",n.style.width=i+"px",n.style.marginLeft=l?-i/2+"px":0,n.style.marginTop=l?-a/2+"px":0)}const rg={passive:!0},HM={...rg,capture:!0};function Wa(n,i,a,l){i.addEventListener(n,a,l?HM:rg)}function bp(n,i,a,l){i.removeEventListener(n,a,rg)}go&&vp();function ys(n,i,a,l){let u;a=a||0,l=l||i.length-1;let f=l<=2147483647;for(;l-a>1;)u=f?a+l>>1:Zi((a+l)/2),i[u]{let f=-1,d=-1;for(let h=l;h<=u;h++)if(n(a[h])){f=h;break}for(let h=u;h>=l;h--)if(n(a[h])){d=h;break}return[f,d]}}const kS=n=>n!=null,RS=n=>n!=null&&n>0,od=jS(kS),BM=jS(RS);function qM(n,i,a,l=0,u=!1){let f=u?BM:od,d=u?RS:kS;[i,a]=f(n,i,a);let h=n[i],p=n[i];if(i>-1)if(l==1)h=n[i],p=n[a];else if(l==-1)h=n[a],p=n[i];else for(let g=i;g<=a;g++){let b=n[g];d(b)&&(bp&&(p=b))}return[h??_t,p??-_t]}function ud(n,i,a,l){let u=x_(n),f=x_(i);n==i&&(u==-1?(n*=a,i/=a):(n/=a,i*=a));let d=a==10?fr:CS,h=u==1?Zi:Xi,p=f==1?Xi:Zi,g=h(d(mn(n))),b=p(d(mn(i))),v=oo(a,g),w=oo(a,b);return a==10&&(g<0&&(v=St(v,-g)),b<0&&(w=St(w,-b))),l||a==2?(n=v*u,i=w*f):(n=LS(n,v),i=cd(i,w)),[n,i]}function ag(n,i,a,l){let u=ud(n,i,a,l);return n==0&&(u[0]=0),i==0&&(u[1]=0),u}const lg=.1,__={mode:3,pad:lg},Ru={pad:0,soft:null,mode:0},IM={min:Ru,max:Ru};function Yf(n,i,a,l){return fd(a)?S_(n,i,a):(Ru.pad=a,Ru.soft=l?0:null,Ru.mode=l?3:0,S_(n,i,IM))}function et(n,i){return n??i}function VM(n,i,a){for(i=et(i,0),a=et(a,n.length-1);i<=a;){if(n[i]!=null)return!0;i++}return!1}function S_(n,i,a){let l=a.min,u=a.max,f=et(l.pad,0),d=et(u.pad,0),h=et(l.hard,-_t),p=et(u.hard,_t),g=et(l.soft,_t),b=et(u.soft,-_t),v=et(l.mode,0),w=et(u.mode,0),T=i-n,E=fr(T),A=ai(mn(n),mn(i)),k=fr(A),L=mn(k-E);(T<1e-24||L>10)&&(T=0,(n==0||i==0)&&(T=1e-24,v==2&&g!=_t&&(f=0),w==2&&b!=-_t&&(d=0)));let U=T||A||1e3,W=fr(U),I=oo(10,Zi(W)),Q=U*(T==0?n==0?.1:1:f),V=St(LS(n-Q,I/10),24),ne=n>=g&&(v==1||v==3&&V<=g||v==2&&V>=g)?g:_t,ie=ai(h,V=ne?ne:bs(ne,V)),Ae=U*(T==0?i==0?.1:1:d),ye=St(cd(i+Ae,I/10),24),Y=i<=b&&(w==1||w==3&&ye>=b||w==2&&ye<=b)?b:-_t,ae=bs(p,ye>Y&&i<=Y?Y:ai(Y,ye));return ie==ae&&ie==0&&(ae=100),[ie,ae]}const PM=new Intl.NumberFormat(go?$M.language:"en-US"),og=n=>PM.format(n),Li=Math,Cf=Li.PI,mn=Li.abs,Zi=Li.floor,dn=Li.round,Xi=Li.ceil,bs=Li.min,ai=Li.max,oo=Li.pow,x_=Li.sign,fr=Li.log10,CS=Li.log2,KM=(n,i=1)=>Li.sinh(n)*i,Qm=(n,i=1)=>Li.asinh(n/i),_t=1/0;function w_(n){return(fr((n^n>>31)-(n>>31))|0)+1}function _p(n,i,a){return bs(ai(n,i),a)}function DS(n){return typeof n=="function"}function Qe(n){return DS(n)?n:()=>n}const GM=()=>{},US=n=>n,ZS=(n,i)=>i,YM=n=>null,z_=n=>!0,E_=(n,i)=>n==i,FM=/\.\d*?(?=9{6,}|0{6,})/gm,nl=n=>{if(HS(n)||ea.has(n))return n;const i=`${n}`,a=i.match(FM);if(a==null)return n;let l=a[0].length-1;if(i.indexOf("e-")!=-1){let[u,f]=i.split("e");return+`${nl(u)}e${f}`}return St(n,l)};function Ga(n,i){return nl(St(nl(n/i))*i)}function cd(n,i){return nl(Xi(nl(n/i))*i)}function LS(n,i){return nl(Zi(nl(n/i))*i)}function St(n,i=0){if(HS(n))return n;let a=10**i,l=n*a*(1+Number.EPSILON);return dn(l)/a}const ea=new Map;function $S(n){return((""+n).split(".")[1]||"").length}function Bu(n,i,a,l){let u=[],f=l.map($S);for(let d=i;d=0?0:h)+(d>=f[g]?0:f[g]),w=n==10?b:St(b,v);u.push(w),ea.set(w,v)}}return u}const Cu={},ug=[],uo=[null,null],Yr=Array.isArray,HS=Number.isInteger,QM=n=>n===void 0;function T_(n){return typeof n=="string"}function fd(n){let i=!1;if(n!=null){let a=n.constructor;i=a==null||a==Object}return i}function JM(n){return n!=null&&typeof n=="object"}const XM=Object.getPrototypeOf(Uint8Array),BS="__proto__";function co(n,i=fd){let a;if(Yr(n)){let l=n.find(u=>u!=null);if(Yr(l)||i(l)){a=Array(n.length);for(let u=0;uf){for(u=d-1;u>=0&&n[u]==null;)n[u--]=null;for(u=d+1;ud-h)],u=l[0].length,f=new Map;for(let d=0;d"u"?n=>Promise.resolve().then(n):queueMicrotask;function r4(n){let i=n[0],a=i.length,l=Array(a);for(let f=0;fi[f]-i[d]);let u=[];for(let f=0;f=l&&n[u]==null;)u--;if(u<=l)return!0;const f=ai(1,Zi((u-l+1)/i));for(let d=n[l],h=l+f;h<=u;h+=f){const p=n[h];if(p!=null){if(p<=d)return!1;d=p}}return!0}const qS=["January","February","March","April","May","June","July","August","September","October","November","December"],IS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function VS(n){return n.slice(0,3)}const o4=IS.map(VS),u4=qS.map(VS),c4={MMMM:qS,MMM:u4,WWWW:IS,WWW:o4};function _u(n){return(n<10?"0":"")+n}function f4(n){return(n<10?"00":n<100?"0":"")+n}const d4={YYYY:n=>n.getFullYear(),YY:n=>(n.getFullYear()+"").slice(2),MMMM:(n,i)=>i.MMMM[n.getMonth()],MMM:(n,i)=>i.MMM[n.getMonth()],MM:n=>_u(n.getMonth()+1),M:n=>n.getMonth()+1,DD:n=>_u(n.getDate()),D:n=>n.getDate(),WWWW:(n,i)=>i.WWWW[n.getDay()],WWW:(n,i)=>i.WWW[n.getDay()],HH:n=>_u(n.getHours()),H:n=>n.getHours(),h:n=>{let i=n.getHours();return i==0?12:i>12?i-12:i},AA:n=>n.getHours()>=12?"PM":"AM",aa:n=>n.getHours()>=12?"pm":"am",a:n=>n.getHours()>=12?"p":"a",mm:n=>_u(n.getMinutes()),m:n=>n.getMinutes(),ss:n=>_u(n.getSeconds()),s:n=>n.getSeconds(),fff:n=>f4(n.getMilliseconds())};function cg(n,i){i=i||c4;let a=[],l=/\{([a-z]+)\}|[^{]+/gi,u;for(;u=l.exec(n);)a.push(u[0][0]=="{"?d4[u[1]]:u[0]);return f=>{let d="";for(let h=0;hn%1==0,Ff=[1,2,2.5,5],p4=Bu(10,-32,0,Ff),KS=Bu(10,0,32,Ff),g4=KS.filter(PS),Ya=p4.concat(KS),fg=` +`,GS="{YYYY}",O_=fg+GS,YS="{M}/{D}",Ou=fg+YS,Ef=Ou+"/{YY}",FS="{aa}",v4="{h}:{mm}",to=v4+FS,N_=fg+to,A_=":{ss}",lt=null;function QS(n){let i=n*1e3,a=i*60,l=a*60,u=l*24,f=u*30,d=u*365,p=(n==1?Bu(10,0,3,Ff).filter(PS):Bu(10,-3,0,Ff)).concat([i,i*5,i*10,i*15,i*30,a,a*5,a*10,a*15,a*30,l,l*2,l*3,l*4,l*6,l*8,l*12,u,u*2,u*3,u*4,u*5,u*6,u*7,u*8,u*9,u*10,u*15,f,f*2,f*3,f*4,f*6,d,d*2,d*5,d*10,d*25,d*50,d*100]);const g=[[d,GS,lt,lt,lt,lt,lt,lt,1],[u*28,"{MMM}",O_,lt,lt,lt,lt,lt,1],[u,YS,O_,lt,lt,lt,lt,lt,1],[l,"{h}"+FS,Ef,)DELIM" +R"DELIM(lt,Ou,lt,lt,lt,1],[a,to,Ef,lt,Ou,lt,lt,lt,1],[i,A_,Ef+" "+to,lt,Ou+" "+to,lt,N_,lt,1],[n,A_+".{fff}",Ef+" "+to,lt,Ou+" "+to,lt,N_,lt,1]];function b(v){return(w,T,E,A,k,L)=>{let U=[],W=k>=d,I=k>=f&&k=u?u:k,ye=Zi(E)-Zi(V),Y=ie+ye+cd(V-ie,Ae);U.push(Y);let ae=v(Y),se=ae.getHours()+ae.getMinutes()/a+ae.getSeconds()/l,ze=k/l,fe=w.axes[T]._space,X=L/fe;for(;Y=St(Y+k,n==1?0:3),!(Y>A);)if(ze>1){let ee=Zi(St(se+ze,6))%24,Se=v(Y).getHours()-ee;Se>1&&(Se=-1),Y-=Se*l,se=(se+ze)%24;let Be=U[U.length-1];St((Y-Be)/k,3)*X>=.7&&U.push(Y)}else U.push(Y)}return U}}return[p,g,b]}const[y4,b4,_4]=QS(1),[S4,x4,w4]=QS(.001);Bu(2,-53,53,[1]);function M_(n,i){return n.map(a=>a.map((l,u)=>u==0||u==8||l==null?l:i(u==1||a[8]==0?l:a[1]+l)))}function j_(n,i){return(a,l,u,f,d)=>{let h=i.find(E=>d>=E[0])||i[i.length-1],p,g,b,v,w,T;return l.map(E=>{let A=n(E),k=A.getFullYear(),L=A.getMonth(),U=A.getDate(),W=A.getHours(),I=A.getMinutes(),Q=A.getSeconds(),V=k!=p&&h[2]||L!=g&&h[3]||U!=b&&h[4]||W!=v&&h[5]||I!=w&&h[6]||Q!=T&&h[7]||h[1];return p=k,g=L,b=U,v=W,w=I,T=Q,V(A)})}}function z4(n,i){let a=cg(i);return(l,u,f,d,h)=>u.map(p=>a(n(p)))}function Jm(n,i,a){return new Date(n,i,a)}function k_(n,i){return i(n)}const E4="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function R_(n,i){return(a,l,u,f)=>f==null?sg:i(n(l))}function T4(n,i){let a=n.series[i];return a.width?a.stroke(n,i):a.points.width?a.points.stroke(n,i):null}function O4(n,i){return n.series[i].fill(n,i)}const N4={show:!0,live:!0,isolate:!1,mount:GM,markers:{show:!0,width:2,stroke:T4,fill:O4,dash:"solid"},idx:null,idxs:null,values:[]};function A4(n,i){let a=n.cursor.points,l=Ji(),u=a.size(n,i);Ot(l,Eu,u),Ot(l,Tu,u);let f=u/-2;Ot(l,"marginLeft",f),Ot(l,"marginTop",f);let d=a.width(n,i,u);return d&&Ot(l,"borderWidth",d),l}function M4(n,i){let a=n.series[i].points;return a._fill||a._stroke}function j4(n,i){let a=n.series[i].points;return a._stroke||a._fill}function k4(n,i){return n.series[i].points.size}const Xm=[0,0];function R4(n,i,a){return Xm[0]=i,Xm[1]=a,Xm}function Tf(n,i,a,l=!0){return u=>{u.button==0&&(!l||u.target==i)&&a(u)}}function Wm(n,i,a,l=!0){return u=>{(!l||u.target==i)&&a(u)}}const C4={show:!0,x:!0,y:!0,lock:!1,move:R4,points:{one:!1,show:A4,size:k4,width:0,stroke:j4,fill:M4},bind:{mousedown:Tf,mouseup:Tf,click:Tf,dblclick:Tf,mousemove:Wm,mouseleave:Wm,mouseenter:Wm},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(n,i)=>{i.stopPropagation(),i.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(n,i,a,l,u)=>l-u,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},JS={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},dg=an({},JS,{filter:ZS}),XS=an({},dg,{size:10}),WS=an({},JS,{show:!1}),hg='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',ex="bold "+hg,tx=1.5,C_={show:!0,scale:"x",stroke:ig,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:ex,side:2,grid:dg,ticks:XS,border:WS,font:hg,lineGap:tx,rotate:0},D4="Value",U4="Time",D_={show:!0,scale:"x",auto:!1,sorted:1,min:_t,max:-_t,idxs:[]};function Z4(n,i,a,l,u){return i.map(f=>f==null?"":og(f))}function L4(n,i,a,l,u,f,d){let h=[],p=ea.get(u)||0;a=d?a:St(cd(a,u),p);for(let g=a;g<=l;g=St(g+u,p))h.push(Object.is(g,-0)?0:g);return h}function Sp(n,i,a,l,u,f,d){const h=[],p=n.scales[n.axes[i].scale].log,g=p==10?fr:CS,b=Zi(g(a));u=oo(p,b),p==10&&(u=Ya[ys(u,Ya)]);let v=a,w=u*p;p==10&&(w=Ya[ys(w,Ya)]);do h.push(v),v=v+u,p==10&&!ea.has(v)&&(v=St(v,ea.get(u))),v>=w&&(u=v,w=u*p,p==10&&(w=Ya[ys(w,Ya)]));while(v<=l);return h}function $4(n,i,a,l,u,f,d){let p=n.scales[n.axes[i].scale].asinh,g=l>p?Sp(n,i,ai(p,a),l,u):[p],b=l>=0&&a<=0?[0]:[];return(a<-p?Sp(n,i,ai(p,-l),-a,u):[p]).reverse().map(w=>-w).concat(b,g)}const nx=/./,H4=/[12357]/,B4=/[125]/,U_=/1/,xp=(n,i,a,l)=>n.map((u,f)=>i==4&&u==0||f%l==0&&a.test(u.toExponential()[u<0?1:0])?u:null);function q4(n,i,a,l,u){let f=n.axes[a],d=f.scale,h=n.scales[d],p=n.valToPos,g=f._space,b=p(10,d),v=p(9,d)-b>=g?nx:p(7,d)-b>=g?H4:p(5,d)-b>=g?B4:U_;if(v==U_){let w=mn(p(1,d)-b);if(wu,$_={show:!0,auto:!0,sorted:0,gaps:ix,alpha:1,facets:[an({},L_,{scale:"x"}),an({},L_,{scale:"y"})]},H_={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:ix,alpha:1,points:{show:K4,filter:null},values:null,min:_t,max:-_t,idxs:[],path:null,clip:null};function G4(n,i,a,l,u){return a/10}const sx={time:yM,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},Y4=an({},sx,{time:!1,ori:1}),B_={};function rx(n,i){let a=B_[n];return a||(a={key:n,plots:[],sub(l){a.plots.push(l)},unsub(l){a.plots=a.plots.filter(u=>u!=l)},pub(l,u,f,d,h,p,g){for(let b=0;b{let L=d.pxRound;const U=g.dir*(g.ori==0?1:-1),W=g.ori==0?vo:yo;let I,Q;U==1?(I=a,Q=l):(I=l,Q=a);let V=L(v(h[I],g,A,T)),ne=L(w(p[I],b,k,E)),ie=L(v(h[Q],g,A,T)),Ae=L(w(f==1?b.max:b.min,b,k,E)),ye=new Path2D(u);return W(ye,ie,Ae),W(ye,V,Ae),W(ye,V,ne),ye})}function dd(n,i,a,l,u,f){let d=null;if(n.length>0){d=new Path2D;const h=i==0?pd:gg;let p=a;for(let v=0;vw[0]){let T=w[0]-p;T>0&&h(d,p,l,T,l+f),p=w[1]}}let g=a+u-p,b=10;g>0&&h(d,p,l-b/2,g,l+f+b)}return d}function Q4(n,i,a){let l=n[n.length-1];l&&l[0]==i?l[1]=a:n.push([i,a])}function pg(n,i,a,l,u,f,d){let h=[],p=n.length;for(let g=u==1?a:l;g>=a&&g<=l;g+=u)if(i[g]===null){let v=g,w=g;if(u==1)for(;++g<=l&&i[g]===null;)w=g;else for(;--g>=a&&i[g]===null;)w=g;let T=f(n[v]),E=w==v?T:f(n[w]),A=v-u;T=d<=0&&A>=0&&A=0&&L>=0&&L=T&&h.push([T,E])}return h}function q_(n){return n==0?US:n==1?dn:i=>Ga(i,n)}function ax(n){let i=n==0?hd:md,a=n==0?(u,f,d,h,p,g)=>{u.arcTo(f,d,h,p,g)}:(u,f,d,h,p,g)=>{u.arcTo(d,f,p,h,g)},l=n==0?(u,f,d,h,p)=>{u.rect(f,d,h,p)}:(u,f,d,h,p)=>{u.rect(d,f,p,h)};return(u,f,d,h,p,g=0,b=0)=>{g==0&&b==0?l(u,f,d,h,p):(g=bs(g,h/2,p/2),b=bs(b,h/2,p/2),i(u,f+g,d),a(u,f+h,d,f+h,d+p,g),a(u,f+h,d+p,f,d+p,b),a(u,f,d+p,f,d,b),a(u,f,d,)DELIM" +R"DELIM(f+h,d,g),u.closePath())}}const hd=(n,i,a)=>{n.moveTo(i,a)},md=(n,i,a)=>{n.moveTo(a,i)},vo=(n,i,a)=>{n.lineTo(i,a)},yo=(n,i,a)=>{n.lineTo(a,i)},pd=ax(0),gg=ax(1),lx=(n,i,a,l,u,f)=>{n.arc(i,a,l,u,f)},ox=(n,i,a,l,u,f)=>{n.arc(a,i,l,u,f)},ux=(n,i,a,l,u,f,d)=>{n.bezierCurveTo(i,a,l,u,f,d)},cx=(n,i,a,l,u,f,d)=>{n.bezierCurveTo(a,i,u,l,d,f)};function fx(n){return(i,a,l,u,f)=>il(i,a,(d,h,p,g,b,v,w,T,E,A,k)=>{let{pxRound:L,points:U}=d,W,I;g.ori==0?(W=hd,I=lx):(W=md,I=ox);const Q=St(U.width*st,3);let V=(U.size-U.width)/2*st,ne=St(V*2,3),ie=new Path2D,Ae=new Path2D,{left:ye,top:Y,width:ae,height:se}=i.bbox;pd(Ae,ye-ne,Y-ne,ae+ne*2,se+ne*2);const ze=fe=>{if(p[fe]!=null){let X=L(v(h[fe],g,A,T)),ee=L(w(p[fe],b,k,E));W(ie,X+V,ee),I(ie,X,ee,V,0,Cf*2)}};if(f)f.forEach(ze);else for(let fe=l;fe<=u;fe++)ze(fe);return{stroke:Q>0?ie:null,fill:ie,clip:Ae,flags:fo|wp}})}function dx(n){return(i,a,l,u,f,d)=>{l!=u&&(f!=l&&d!=l&&n(i,a,l),f!=u&&d!=u&&n(i,a,u),n(i,a,d))}}const J4=dx(vo),X4=dx(yo);function hx(n){const i=et(n?.alignGaps,0);return(a,l,u,f)=>il(a,l,(d,h,p,g,b,v,w,T,E,A,k)=>{[u,f]=od(p,u,f);let L=d.pxRound,U=se=>L(v(se,g,A,T)),W=se=>L(w(se,b,k,E)),I,Q;g.ori==0?(I=vo,Q=J4):(I=yo,Q=X4);const V=g.dir*(g.ori==0?1:-1),ne={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:fo},ie=ne.stroke;let Ae=!1;if(f-u>=A*4){let se=be=>a.posToVal(be,g.key,!0),ze=null,fe=null,X,ee,xe,Me=U(h[V==1?u:f]),Se=U(h[u]),Be=U(h[f]),Re=se(V==1?Se+1:Be-1);for(let be=V==1?u:f;be>=u&&be<=f;be+=V){let M=h[be],ue=(V==1?MRe)?Me:U(M),oe=p[be];ue==Me?oe!=null?(ee=oe,ze==null?(I(ie,ue,W(ee)),X=ze=fe=ee):eefe&&(fe=ee)):oe===null&&(Ae=!0):(ze!=null&&Q(ie,Me,W(ze),W(fe),W(X),W(ee)),oe!=null?(ee=oe,I(ie,ue,W(ee)),ze=fe=X=ee):(ze=fe=null,oe===null&&(Ae=!0)),Me=ue,Re=se(Me+V))}ze!=null&&ze!=fe&&xe!=Me&&Q(ie,Me,W(ze),W(fe),W(X),W(ee))}else for(let se=V==1?u:f;se>=u&&se<=f;se+=V){let ze=p[se];ze===null?Ae=!0:ze!=null&&I(ie,U(h[se]),W(ze))}let[Y,ae]=mg(a,l);if(d.fill!=null||Y!=0){let se=ne.fill=new Path2D(ie),ze=d.fillTo(a,l,d.min,d.max,Y),fe=W(ze),X=U(h[u]),ee=U(h[f]);V==-1&&([ee,X]=[X,ee]),I(se,ee,fe),I(se,X,fe)}if(!d.spanGaps){let se=[];Ae&&se.push(...pg(h,p,u,f,V,U,i)),ne.gaps=se=d.gaps(a,l,u,f,se),ne.clip=dd(se,g.ori,T,E,A,k)}return ae!=0&&(ne.band=ae==2?[dr(a,l,u,f,ie,-1),dr(a,l,u,f,ie,1)]:dr(a,l,u,f,ie,ae)),ne})}function W4(n){const i=et(n.align,1),a=et(n.ascDesc,!1),l=et(n.alignGaps,0),u=et(n.extend,!1);return(f,d,h,p)=>il(f,d,(g,b,v,w,T,E,A,k,L,U,W)=>{[h,p]=od(v,h,p);let I=g.pxRound,{left:Q,width:V}=f.bbox,ne=Se=>I(E(Se,w,U,k)),ie=Se=>I(A(Se,T,W,L)),Ae=w.ori==0?vo:yo;const ye={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:fo},Y=ye.stroke,ae=w.dir*(w.ori==0?1:-1);let se=ie(v[ae==1?h:p]),ze=ne(b[ae==1?h:p]),fe=ze,X=ze;u&&i==-1&&(X=Q,Ae(Y,X,se)),Ae(Y,ze,se);for(let Se=ae==1?h:p;Se>=h&&Se<=p;Se+=ae){let Be=v[Se];if(Be==null)continue;let Re=ne(b[Se]),be=ie(Be);i==1?Ae(Y,Re,se):Ae(Y,fe,be),Ae(Y,Re,be),se=be,fe=Re}let ee=fe;u&&i==1&&(ee=Q+V,Ae(Y,ee,se));let[xe,Me]=mg(f,d);if(g.fill!=null||xe!=0){let Se=ye.fill=new Path2D(Y),Be=g.fillTo(f,d,g.min,g.max,xe),Re=ie(Be);Ae(Se,ee,Re),Ae(Se,X,Re)}if(!g.spanGaps){let Se=[];Se.push(...pg(b,v,h,p,ae,ne,l));let Be=g.width*st/2,Re=a||i==1?Be:-Be,be=a||i==-1?-Be:Be;Se.forEach(M=>{M[0]+=Re,M[1]+=be}),ye.gaps=Se=g.gaps(f,d,h,p,Se),ye.clip=dd(Se,w.ori,k,L,U,W)}return Me!=0&&(ye.band=Me==2?[dr(f,d,h,p,Y,-1),dr(f,d,h,p,Y,1)]:dr(f,d,h,p,Y,Me)),ye})}function I_(n,i,a,l,u,f,d=_t){if(n.length>1){let h=null;for(let p=0,g=1/0;p{}),{fill:v,stroke:w}=g;return(T,E,A,k)=>il(T,E,(L,U,W,I,Q,V,ne,ie,Ae,ye,Y)=>{let ae=L.pxRound,se=a,ze=l*st,fe=h*st,X=p*st,ee,xe;I.ori==0?[ee,xe]=f(T,E):[xe,ee]=f(T,E);const Me=I.dir*(I.ori==0?1:-1);let Se=I.ori==0?pd:gg,Be=I.ori==0?b:(me,nt,Zt,qs,Zn,oi,ns)=>{b(me,nt,Zt,Zn,qs,ns,oi)},Re=et(T.bands,ug).find(me=>me.series[0]==E),be=Re!=null?Re.dir:0,M=L.fillTo(T,E,L.min,L.max,be),J=ae(ne(M,Q,Y,Ae)),ue,oe,Le,Ue=ye,Ne=ae(L.width*st),pe=!1,Oe=null,Bt=null,$i=null,bi=null;v!=null&&(Ne==0||w!=null)&&(pe=!0,Oe=v.values(T,E,A,k),Bt=new Map,new Set(Oe).forEach(me=>{me!=null&&Bt.set(me,new Path2D)}),Ne>0&&($i=w.values(T,E,A,k),bi=new Map,new Set($i).forEach(me=>{me!=null&&bi.set(me,new Path2D)})));let{x0:Tn,size:Ut}=g;if(Tn!=null&&Ut!=null){se=1,U=Tn.values(T,E,A,k),Tn.unit==2&&(U=U.map(Zt=>T.posToVal(ie+Zt*ye,I.key,!0)));let me=Ut.values(T,E,A,k);Ut.unit==2?oe=me[0]*ye:oe=V(me[0],I,ye,ie)-V(0,I,ye,ie),Ue=I_(U,W,V,I,ye,ie,Ue),Le=Ue-oe+ze}else Ue=I_(U,W,V,I,ye,ie,Ue),Le=Ue*d+ze,oe=Ue-Le;Le<1&&(Le=0),Ne>=oe/2&&(Ne=0),Le<5&&(ae=US);let tt=Le>0,vn=Ue-Le-(tt?Ne:0);oe=ae(_p(vn,X,fe)),ue=(se==0?oe/2:se==Me?0:oe)-se*Me*((se==0?ze/2:0)+(tt?Ne/2:0));const Gt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Kn=pe?null:new Path2D;let li=null;if(Re!=null)li=T.data[Re.series[1]];else{let{y0:me,y1:nt}=g;me!=null&&nt!=null&&(W=nt.values(T,E,A,k),li=me.values(T,E,A,k))}let Hi=ee*oe,Ce=xe*oe;for(let me=Me==1?A:k;me>=A&&me<=k;me+=Me){let nt=W[me];if(nt==null)continue;if(li!=null){let yn=li[me]??0;if(nt-yn==0)continue;J=ne(yn,Q,Y,Ae)}let Zt=I.distr!=2||g!=null?U[me]:me,qs=V(Zt,I,ye,ie),Zn=ne(et(nt,M),Q,Y,Ae),oi=ae(qs-ue),ns=ae(ai(Zn,J)),Gn=ae(bs(Zn,J)),Yn=ns-Gn;if(nt!=null){let yn=nt<0?Ce:Hi,Fn=nt<0?Hi:Ce;pe?(Ne>0&&$i[me]!=null&&Se(bi.get($i[me]),oi,Gn+Zi(Ne/2),oe,ai(0,Yn-Ne),yn,Fn),Oe[me]!=null&&Se(Bt.get(Oe[me]),oi,Gn+Zi(Ne/2),oe,ai(0,Yn-Ne),yn,Fn)):Se(Kn,oi,Gn+Zi(Ne/2),oe,ai(0,Yn-Ne),yn,Fn),Be(T,E,me,oi-Ne/2,Gn,oe+Ne,Yn)}}return Ne>0?Gt.stroke=pe?bi:Kn:pe||(Gt._fill=L.width==0?L._fill:L._stroke??L._fill,Gt.width=0),Gt.fill=pe?Bt:Kn,Gt})}function tj(n,i){const a=et(i?.alignGaps,0);return(l,u,f,d)=>il(l,u,(h,p,g,b,v,w,T,E,A,k,L)=>{[f,d]=od(g,f,d);let U=h.pxRound,W=ee=>U(w(ee,b,k,E)),I=ee=>U(T(ee,v,L,A)),Q,V,ne;b.ori==0?(Q=hd,ne=vo,V=ux):(Q=md,ne=yo,V=cx);const ie=b.dir*(b.ori==0?1:-1);let Ae=W(p[ie==1?f:d]),ye=Ae,Y=[],ae=[];for(let ee=ie==1?f:d;ee>=f&&ee<=d;ee+=ie)if(g[ee]!=null){let Me=p[ee],Se=W(Me);Y.push(ye=Se),ae.push(I(g[ee]))}const se={stroke:n(Y,ae,Q,ne,V,U),fill:null,clip:null,band:null,gaps:null,flags:fo},ze=se.stroke;let[fe,X]=mg(l,u);if(h.fill!=null||fe!=0){let ee=se.fill=new Path2D(ze),xe=h.fillTo(l,u,h.min,h.max,fe),Me=I(xe);ne(ee,ye,Me),ne(ee,Ae,Me)}if(!h.spanGaps){let ee=[];ee.push(...pg(p,g,f,d,ie,W,a)),se.gaps=ee=h.gaps(l,u,f,d,ee),se.clip=dd(ee,b.ori,E,A,k,L)}return X!=0&&(se.band=X==2?[dr(l,u,f,d,ze,-1),dr(l,u,f,d,ze,1)]:dr(l,u,f,d,ze,X)),se})}function nj(n){return tj(ij,n)}function ij(n,i,a,l,u,f){const d=n.length;if(d<2)return null;const h=new Path2D;if(a(h,n[0],i[0]),d==2)l(h,n[1],i[1]);else{let p=Array(d),g=Array(d-1),b=Array(d-1),v=Array(d-1);for(let w=0;w0!=g[w]>0?p[w]=0:(p[w]=3*(v[w-1]+v[w])/((2*v[w]+v[w-1])/g[w-1]+(v[w]+2*v[w-1])/g[w]),isFinite(p[w])||(p[w]=0));p[d-1]=g[d-2];for(let w=0;w{on.pxRatio=st}));const sj=hx(),rj=fx();function P_(n,i,a,l){return(l?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map((f,d)=>Ep(f,d,i,a))}function aj(n,i){return n.map((a,l)=>l==0?{}:an({},i,a))}function Ep(n,i,a,l){return an({},i==0?a:l,n)}function mx(n,i,a){return i==null?uo:[i,a]}const lj=mx;function oj(n,i,a){return i==null?uo:Yf(i,a,lg,!0)}function px(n,i,a,l){return i==null?uo:ud(i,a,n.scales[l].log,!1)}const uj=px;function gx(n,i,a,l){return i==null?uo:ag(i,a,n.scales[l].log,!1)}const cj=gx;function fj(n,i,a,l,u){let f=ai(w_(n),w_(i)),d=i-n,h=y)DELIM" +R"DELIM(s(u/l*d,a);do{let p=a[h],g=l*p/d;if(g>=u&&f+(p<5?ea.get(p):0)<=17)return[p,g]}while(++h(i=dn((a=+u)*st))+"px"),[n,i,a]}function dj(n){n.show&&[n.font,n.labelFont].forEach(i=>{let a=St(i[2]*st,1);i[0]=i[0].replace(/[0-9.]+px/,a+"px"),i[1]=a})}function on(n,i,a){const l={mode:et(n.mode,1)},u=l.mode;function f(y,S,z,O){let R=S.valToPct(y);return O+z*(S.dir==-1?1-R:R)}function d(y,S,z,O){let R=S.valToPct(y);return O+z*(S.dir==-1?R:1-R)}function h(y,S,z,O){return S.ori==0?f(y,S,z,O):d(y,S,z,O)}l.valToPosH=f,l.valToPosV=d;let p=!1;l.status=0;const g=l.root=Ji(bM);if(n.id!=null&&(g.id=n.id),Ci(g,n.class),n.title){let y=Ji(xM,g);y.textContent=n.title}const b=vs("canvas"),v=l.ctx=b.getContext("2d"),w=Ji(wM,g);Wa("click",w,y=>{y.target===E&&(vt!=_r||xt!=Qs)&&ht.click(l,y)},!0);const T=l.under=Ji(zM,w);w.appendChild(b);const E=l.over=Ji(EM,w);n=co(n);const A=+et(n.pxAlign,1),k=q_(A);(n.plugins||[]).forEach(y=>{y.opts&&(n=y.opts(l,n)||n)});const L=n.ms||.001,U=l.series=u==1?P_(n.series||[],D_,H_,!1):aj(n.series||[null],$_),W=l.axes=P_(n.axes||[],C_,Z_,!0),I=l.scales={},Q=l.bands=n.bands||[];Q.forEach(y=>{y.fill=Qe(y.fill||null),y.dir=et(y.dir,-1)});const V=u==2?U[1].facets[0].scale:U[0].scale,ne={axes:hl,series:Ku},ie=(n.drawOrder||["axes","series"]).map(y=>ne[y]);function Ae(y){const S=y.distr==3?z=>fr(z>0?z:y.clamp(l,z,y.min,y.max,y.key)):y.distr==4?z=>Qm(z,y.asinh):y.distr==100?z=>y.fwd(z):z=>z;return z=>{let O=S(z),{_min:R,_max:H}=y,K=H-R;return(O-R)/K}}function ye(y){let S=I[y];if(S==null){let z=(n.scales||Cu)[y]||Cu;if(z.from!=null){ye(z.from);let O=an({},I[z.from],z,{key:y});O.valToPct=Ae(O),I[y]=O}else{S=I[y]=an({},y==V?sx:Y4,z),S.key=y;let O=S.time,R=S.range,H=Yr(R);if((y!=V||u==2&&!O)&&(H&&(R[0]==null||R[1]==null)&&(R={min:R[0]==null?__:{mode:1,hard:R[0],soft:R[0]},max:R[1]==null?__:{mode:1,hard:R[1],soft:R[1]}},H=!1),!H&&fd(R))){let K=R;R=(te,re,de)=>re==null?uo:Yf(re,de,K)}S.range=Qe(R||(O?lj:y==V?S.distr==3?uj:S.distr==4?cj:mx:S.distr==3?px:S.distr==4?gx:oj)),S.auto=Qe(H?!1:S.auto),S.clamp=Qe(S.clamp||G4),S._min=S._max=null,S.valToPct=Ae(S)}}}ye("x"),ye("y"),u==1&&U.forEach(y=>{ye(y.scale)}),W.forEach(y=>{ye(y.scale)});for(let y in n.scales)ye(y);const Y=I[V],ae=Y.distr;let se,ze;Y.ori==0?(Ci(g,_M),se=f,ze=d):(Ci(g,SM),se=d,ze=f);const fe={};for(let y in I){let S=I[y];(S.min!=null||S.max!=null)&&(fe[y]={min:S.min,max:S.max},S.min=S.max=null)}const X=n.tzDate||(y=>new Date(dn(y/L))),ee=n.fmtDate||cg,xe=L==1?_4(X):w4(X),Me=j_(X,M_(L==1?b4:x4,ee)),Se=R_(X,k_(E4,ee)),Be=[],Re=l.legend=an({},N4,n.legend),be=l.cursor=an({},C4,{drag:{y:u==2}},n.cursor),M=Re.show,J=be.show,ue=Re.markers;Re.idxs=Be,ue.width=Qe(ue.width),ue.dash=Qe(ue.dash),ue.stroke=Qe(ue.stroke),ue.fill=Qe(ue.fill);let oe,Le,Ue,Ne=[],pe=[],Oe,Bt=!1,$i={};if(Re.live){const y=U[1]?U[1].values:null;Bt=y!=null,Oe=Bt?y(l,1,0):{_:0};for(let S in Oe)$i[S]=sg}if(M)if(oe=vs("table",jM,g),Ue=vs("tbody",null,oe),Re.mount(l,oe),Bt){Le=vs("thead",null,oe,Ue);let y=vs("tr",null,Le);vs("th",null,y);for(var bi in Oe)vs("th",l_,y).textContent=bi}else Ci(oe,RM),Re.live&&Ci(oe,kM);const Tn={show:!0},Ut={show:!1};function tt(y,S){if(S==0&&(Bt||!Re.live||u==2))return uo;let z=[],O=vs("tr",CM,Ue,Ue.childNodes[S]);Ci(O,y.class),y.show||Ci(O,Fa);let R=vs("th",null,O);if(ue.show){let te=Ji(DM,R);if(S>0){let re=ue.width(l,S);re&&(te.style.border=re+"px "+ue.dash(l,S)+" "+ue.stroke(l,S)),te.style.background=ue.fill(l,S)}}let H=Ji(l_,R);y.label instanceof HTMLElement?H.appendChild(y.label):H.textContent=y.label,S>0&&(ue.show||(H.style.color=y.width>0?ue.stroke(l,S):ue.fill(l,S)),Gt("click",R,te=>{if(be._lock)return;Ft(te);let re=U.indexOf(y);if((te.ctrlKey||te.metaKey)!=Re.isolate){let de=U.some((he,ge)=>ge>0&&ge!=re&&he.show);U.forEach((he,ge)=>{ge>0&&$n(ge,de?ge==re?Tn:Ut:Tn,!0,Lt.setSeries)})}else $n(re,{show:!y.show},!0,Lt.setSeries)},!1),pr&&Gt(f_,R,te=>{be._lock||(Ft(te),$n(U.indexOf(y),ls,!0,Lt.setSeries))},!1));for(var K in Oe){let te=vs("td",UM,O);te.textContent="--",z.push(te)}return[O,z]}const vn=new Map;function Gt(y,S,z,O=!0){const R=vn.get(S)||{},H=be.bind[y](l,S,z,O);H&&(Wa(y,S,R[y]=H),vn.set(S,R))}function Kn(y,S,z){const O=vn.get(S)||{};for(let R in O)(y==null||R==y)&&(bp(R,S,O[R]),delete O[R]);y==null&&vn.delete(S)}let li=0,Hi=0,Ce=0,me=0,nt=0,Zt=0,qs=nt,Zn=Zt,oi=Ce,ns=me,Gn=0,Yn=0,yn=0,Fn=0;l.bbox={};let sa=!1,sl=!1,mr=!1,Yt=!1,rl=!1,Qn=!1;function al(y,S,z){(z||y!=l.width||S!=l.height)&&ra(y,S),Ln(!1),mr=!0,sl=!0,Gs()}function ra(y,S){l.width=li=Ce=y,l.height=Hi=me=S,nt=Zt=0,yd(),aa();let z=l.bbox;Gn=z.left=Ga(nt*st,.5),Yn=z.top=Ga(Zt*st,.5),yn=z.width=Ga(Ce*st,.5),Fn=z.height=Ga(me*st,.5)}const gd=3;function Pu(){let y=!1,S=0;for(;!y;){S++;let z=Gu(S),O=dl(S);y=S==gd||z&&O,y||(ra(l.width,l.height),sl=!0)}}function vd({width:y,height:S}){al(y,S)}l.setSize=vd;function yd(){let y=!1,S=!1,z=!1,O=!1;W.forEach((R,H)=>{if(R.show&&R._show){let{side:K,_size:te}=R,re=K%2,de=R.label!=null?R.labelSize:0,he=te+de;he>0&&(re?(Ce-=he,K==3?(nt+=he,O=!0):z=!0):(me-=he,K==0?(Zt+=he,y=!0):S=!0))}}),xs[0]=y,xs[1]=z,xs[2]=S,xs[3]=O,Ce-=ci[1]+ci[3],nt+=ci[3],me-=ci[2]+ci[0],Zt+=ci[0]}function aa(){let y=nt+Ce,S=Zt+me,z=nt,O=Zt;function R(H,K){switch(H){case 1:return y+=K,y-K;case 2:return S+=K,S-K;case 3:return z-=K,z+K;case 0:return O-=K,O+K}}W.forEach((H,K)=>{if(H.show&&H._show){let te=H.side;H._pos=R(te,H._size),H.label!=null&&(H._lpos=R(te,H.labelSize))}})}if(be.dataIdx==null){let y=be.hover,S=y.skip=new Set(y.skip??[]);S.add(void 0);let z=y.prox=Qe(y.prox),O=y.bias??=0;be.dataIdx=(R,H,K,te)=>{if(H==0)return K;let re=K,de=z(R,H,K,te)??_t,he=de>=0&&de<_t,ge=Y.ori==0?Ce:me,De=be.left,Ve=i[0],Je=i[H];if(S.has(Je[K])){re=null;let qe=null,je=null,we;if(O==0||O==-1)for(we=K;qe==null&&we-- >0;)S.has(Je[we])||(qe=we);if(O==0||O==1)for(we=K;je==null&&we++de&&(re=null);return re}}const Ft=y=>{be.event=y};be.idxs=Be,be._lock=!1;let Tt=be.points;Tt.show=Qe(Tt.show),Tt.size=Qe(Tt.size),Tt.stroke=Qe(Tt.stroke),Tt.width=Qe(Tt.width),Tt.fill=Qe(Tt.fill);const At=l.focus=an({},n.focus||{alpha:.3},be.focus),pr=At.prox>=0,gr=pr&&Tt.one;let ui=[],is=[],ss=[];function la(y,S){let z=Tt.show(l,S);if(z instanceof HTMLElement)return Ci(z,MM),Ci(z,y.class),$s(z,-10,-10,Ce,me),E.insertBefore(z,ui[S]),z}function Ss(y,S){if(u==1||S>0){let z=u==1&&I[y.scale].time,O=y.value;y.value=z?T_(O)?R_(X,k_(O,ee)):O||Se:O||V4,y.label=y.label||(z?U4:D4)}if(gr||S>0){y.width=y.width==null?1:y.width,y.paths=y.paths||sj||YM,y.fillTo=Qe(y.fillTo||F4),y.pxAlign=+et(y.pxAlign,A),y.pxRound=q_(y.pxAlign),y.stroke=Qe(y.stroke||null),y.fill=Qe(y.fill||null),y._stroke=y._fill=y._paths=y._focus=null;let z=P4(ai(1,y.width),1),O=y.points=an({},{size:z,width:ai(1,z*.2),stroke:y.stroke,space:z*2,paths:rj,_stroke:null,_fill:null},y.points);O.show=Qe(O.show),O.filter=Qe(O.filter),O.fill=Qe(O.fill),O.stroke=Qe(O.stroke),O.paths=Qe(O.paths),O.pxAlign=y.pxAlign}if(M){let z=tt(y,S);Ne.splice(S,0,z[0]),pe.splice(S,0,z[1]),Re.values.push(null)}if(J){Be.splice(S,0,null);let z=null;gr?S==0&&(z=la(y,S)):S>0&&(z=la(y,S)),ui.splice(S,0,z),is.splice(S,0,0),ss.splice(S,0,0)}en("addSeries",S)}function ll(y,S){S=S??U.length,y=u==1?Ep(y,S,D_,H_):Ep(y,S,{},$_),U.splice(S,0,y),Ss(U[S],S)}l.addSeries=ll;function oa(y){if(U.splice(y,1),M){Re.values.splice(y,1),pe.splice(y,1);let S=Ne.splice(y,1)[0];Kn(null,S.firstChild),S.remove()}J&&(Be.splice(y,1),ui.splice(y,1)[0].remove(),is.splice(y,1),ss.splice(y,1)),en("delSeries",y)}l.delSeries=oa;const xs=[!1,!1,!1,!1];function bd(y,S){if(y._show=y.show,y.show){let z=y.side%2,O=I[y.scale];O==null&&(y.scale=z?U[1].scale:V,O=I[y.scale]);let R=O.time;y.size=Qe(y.size),y.space=Qe(y.space),y.rotate=Qe(y.r)DELIM" +R"DELIM(otate),Yr(y.incrs)&&y.incrs.forEach(K=>{!ea.has(K)&&ea.set(K,$S(K))}),y.incrs=Qe(y.incrs||(O.distr==2?g4:R?L==1?y4:S4:Ya)),y.splits=Qe(y.splits||(R&&O.distr==1?xe:O.distr==3?Sp:O.distr==4?$4:L4)),y.stroke=Qe(y.stroke),y.grid.stroke=Qe(y.grid.stroke),y.ticks.stroke=Qe(y.ticks.stroke),y.border.stroke=Qe(y.border.stroke);let H=y.values;y.values=Yr(H)&&!Yr(H[0])?Qe(H):R?Yr(H)?j_(X,M_(H,ee)):T_(H)?z4(X,H):H||Me:H||Z4,y.filter=Qe(y.filter||(O.distr>=3&&O.log==10?q4:O.distr==3&&O.log==2?I4:ZS)),y.font=K_(y.font),y.labelFont=K_(y.labelFont),y._size=y.size(l,null,S,0),y._space=y._rotate=y._incrs=y._found=y._splits=y._values=null,y._size>0&&(xs[S]=!0,y._el=Ji(TM,w))}}function vr(y,S,z,O){let[R,H,K,te]=z,re=S%2,de=0;return re==0&&(te||H)&&(de=S==0&&!R||S==2&&!K?dn(C_.size/3):0),re==1&&(R||K)&&(de=S==1&&!H||S==3&&!te?dn(Z_.size/2):0),de}const ol=l.padding=(n.padding||[vr,vr,vr,vr]).map(y=>Qe(et(y,vr))),ci=l._padding=ol.map((y,S)=>y(l,S,xs,0));let un,Qt=null,Jt=null;const ua=u==1?U[0].idxs:null;let Jn=null,Is=!1;function bo(y,S){if(i=y??[],l.data=l._data=i,u==2){un=0;for(let z=1;z=0,Qn=!0,Gs()}}l.setData=bo;function ul(){Is=!0;let y,S;u==1&&(un>0?(Qt=ua[0]=0,Jt=ua[1]=un-1,y=i[0][Qt],S=i[0][Jt],ae==2?(y=Qt,S=Jt):y==S&&(ae==3?[y,S]=ud(y,y,Y.log,!1):ae==4?[y,S]=ag(y,y,Y.log,!1):Y.time?S=y+dn(86400/L):[y,S]=Yf(y,S,lg,!0))):(Qt=ua[0]=y=null,Jt=ua[1]=S=null)),rs(V,y,S)}let fi,Mt,bn,ws,cl,_o,So,fl,Vs,cn;function ca(y,S,z,O,R,H){y??=u_,z??=ug,O??="butt",R??=u_,H??="round",y!=fi&&(v.strokeStyle=fi=y),R!=Mt&&(v.fillStyle=Mt=R),S!=bn&&(v.lineWidth=bn=S),H!=cl&&(v.lineJoin=cl=H),O!=_o&&(v.lineCap=_o=O),z!=ws&&v.setLineDash(ws=z)}function zs(y,S,z,O){S!=Mt&&(v.fillStyle=Mt=S),y!=So&&(v.font=So=y),z!=fl&&(v.textAlign=fl=z),O!=Vs&&(v.textBaseline=Vs=O)}function Es(y,S,z,O,R=0){if(O.length>0&&y.auto(l,Is)&&(S==null||S.min==null)){let H=et(Qt,0),K=et(Jt,O.length-1),te=z.min==null?qM(O,H,K,R,y.distr==3):[z.min,z.max];y.min=bs(y.min,z.min=te[0]),y.max=ai(y.max,z.max=te[1])}}const yr={min:null,max:null};function br(){for(let O in I){let R=I[O];fe[O]==null&&(R.min==null||fe[V]!=null&&R.auto(l,Is))&&(fe[O]=yr)}for(let O in I){let R=I[O];fe[O]==null&&R.from!=null&&fe[R.from]!=null&&(fe[O]=yr)}fe[V]!=null&&Ln(!0);let y={};for(let O in fe){let R=fe[O];if(R!=null){let H=y[O]=co(I[O],JM);if(R.min!=null)an(H,R);else if(O!=V||u==2)if(un==0&&H.from==null){let K=H.range(l,null,null,O);H.min=K[0],H.max=K[1]}else H.min=_t,H.max=-_t}}if(un>0){U.forEach((O,R)=>{if(u==1){let H=O.scale,K=fe[H];if(K==null)return;let te=y[H];if(R==0){let re=te.range(l,te.min,te.max,H);te.min=re[0],te.max=re[1],Qt=ys(te.min,i[0]),Jt=ys(te.max,i[0]),Jt-Qt>1&&(i[0][Qt]te.max&&Jt--),O.min=Jn[Qt],O.max=Jn[Jt]}else O.show&&O.auto&&Es(te,K,O,i[R],O.sorted);O.idxs[0]=Qt,O.idxs[1]=Jt}else if(R>0&&O.show&&O.auto){let[H,K]=O.facets,te=H.scale,re=K.scale,[de,he]=i[R],ge=y[te],De=y[re];ge!=null&&Es(ge,fe[te],H,de,H.sorted),De!=null&&Es(De,fe[re],K,he,K.sorted),O.min=K.min,O.max=K.max}});for(let O in y){let R=y[O],H=fe[O];if(R.from==null&&(H==null||H.min==null)){let K=R.range(l,R.min==_t?null:R.min,R.max==-_t?null:R.max,O);R.min=K[0],R.max=K[1]}}}for(let O in y){let R=y[O];if(R.from!=null){let H=y[R.from];if(H.min==null)R.min=R.max=null;else{let K=R.range(l,H.min,H.max,O);R.min=K[0],R.max=K[1]}}}let S={},z=!1;for(let O in y){let R=y[O],H=I[O];if(H.min!=R.min||H.max!=R.max){H.min=R.min,H.max=R.max;let K=H.distr;H._min=K==3?fr(H.min):K==4?Qm(H.min,H.asinh):K==100?H.fwd(H.min):H.min,H._max=K==3?fr(H.max):K==4?Qm(H.max,H.asinh):K==100?H.fwd(H.max):H.max,S[O]=z=!0}}if(z){U.forEach((O,R)=>{u==2?R>0&&S.y&&(O._paths=null):S[O.scale]&&(O._paths=null)});for(let O in S)mr=!0,en("setScale",O);J&&be.left>=0&&(Yt=Qn=!0)}for(let O in fe)fe[O]=null}function Wt(y){let S=_p(Qt-1,0,un-1),z=_p(Jt+1,0,un-1);for(;y[S]==null&&S>0;)S--;for(;y[z]==null&&z0){let y=U.some(S=>S._focus)&&cn!=At.alpha;y&&(v.globalAlpha=cn=At.alpha),U.forEach((S,z)=>{if(z>0&&S.show&&(xo(z,!1),xo(z,!0),S._paths==null)){let O=cn;cn!=S.alpha&&(v.globalAlpha=cn=S.alpha);let R=u==2?[0,i[z][0].length-1]:Wt(i[z]);S._paths=S.paths(l,z,R[0],R[1]),cn!=O&&(v.globalAlpha=cn=O)}}),U.forEach((S,z)=>{if(z>0&&S.show){let O=cn;cn!=S.alpha&&(v.globalAlpha=cn=S.alpha),S._paths!=null&&wo(z,!1);{let R=S._paths!=null?S._paths.gaps:null,H=S.points.show(l,z,Qt,Jt,R),K=S.points.filter(l,z,H,R);(H||K)&&(S.points._paths=S.points.paths(l,z,Qt,Jt,K),wo(z,!0))}cn!=O&&(v.globalAlpha=cn=O),en("drawSeries",z)}}),y&&(v.globalAlpha=cn=1)}}function xo(y,S){let z=S?U[y].points:U[y];z._stroke=z.stroke(l,y),z._fill=z.fill(l,y)}function wo(y,S){let z=S?U[y].points:U[y],{stroke:O,fill:R,clip:H,flags:K,_stroke:te=z._stroke,_fill:re=z._fill,_width:de=z.width}=z._paths;de=St(de*st,3);let he=null,ge=de%2/2;S&&re==null&&(re=de>0?"#fff":te);let De=z.pxAlign==1&&ge>0;if(De&&v.translate(ge,ge),!S){let Ve=Gn-de/2,Je=Yn-de/2,qe=yn+de,je=Fn+de;he=new Path2D,he.rect(Ve,Je,qe,je)}S?zo(te,de,z.dash,z.cap,re,O,R,K,H):Ps(y,te,de,z.dash,z.cap,re,O,R,K,he,H),De&&v.translate(-ge,-ge)}function Ps(y,S,z,O,R,H,K,te,re,de,he){let ge=!1;re!=0&&Q.forEach((De,Ve)=>{if(De.series[0]==y){let Je=U[De.series[1]],qe=i[De.series[1]],je=(Je._paths||Cu).band;Yr(je)&&(je=De.dir==1?je[0]:je[1]);let we,mt=null;Je.show&&je&&VM(qe,Qt,Jt)?(mt=De.fill(l,Ve)||H,we=Je._paths.clip):je=null,zo(S,z,O,R,mt,K,te,re,de,he,we,je),ge=!0}}),ge||zo(S,z,O,R,H,K,te,re,de,he)}const Ks=fo|wp;function zo(y,S,z,O,R,H,K,te,re,de,he,ge){ca(y,S,z,O,R),(re||de||ge)&&(v.save(),re&&v.clip(re),de&&v.clip(de)),ge?(te&Ks)==Ks?(v.clip(ge),he&&v.clip(he),da(R,K),fa(y,H,S)):te&wp?(da(R,K),v.clip(ge),fa(y,H,S)):te&fo&&(v.save(),v.clip(ge),he&&v.clip(he),da(R,K),v.restore(),fa(y,H,S)):(da(R,K),fa(y,H,S)),(re||de||ge)&&v.restore()}function fa(y,S,z){z>0&&(S instanceof Map?S.forEach((O,R)=>{v.strokeStyle=fi=R,v.stroke(O)}):S!=null&&y&&v.stroke(S))}function da(y,S){S instanceof Map?S.forEach((z,O)=>{v.fillStyle=Mt=O,v.fill(z)}):S!=null&&y&&v.fill(S)}function _d(y,S,z,O){let R=W[y],H;if(O<=0)H=[0,0];else{let K=R._space=R.space(l,y,S,z,O),te=R._incrs=R.incrs(l,y,S,z,O,K);H=fj(S,z,te,O,K)}return R._found=H}function Ge(y,S,z,O,R,H,K,te,re,de){let he=K%2/2;A==1&&v.translate(he,he),ca(te,K,re,de,te),v.beginPath();let ge,De,Ve,Je,qe=R+(O==0||O==3?-H:H);z==0?(De=R,Je=qe):(ge=R,Ve=qe);for(let je=0;je{if(!z.show)return;let R=I[z.scale];if(R.min==null){z._show&&(S=!1,z._show=!1,Ln(!1));return}else z._show||(S=!1,z._show=!0,Ln(!1));let H=z.side,K=H%2,{min:te,max:re}=R,[de,he]=_d(O,te,re,K==0?Ce:me);if(he==0)return;let ge=R.distr==2,De=z._splits=z.splits(l,O,te,re,de,he,ge),Ve=R.distr==2?De.map(we=>Jn[we]):De,Je=R.distr==2?Jn[De[1]]-Jn[De[0]]:de,qe=z._values=z.values(l,z.filter(l,Ve,O,he,Je),O,he,Je);z._rotate=H==2?z.rotate(l,qe,O,he):0;let je=z._size;z._size=Xi(z.size(l,qe,O,y)),je!=null&&z._size!=je&&(S=!1)}),S}function dl(y){let S=!0;return ol.forEach((z,O)=>{let R=z(l,O,xs,y);R!=ci[O]&&(S=!1),ci[O]=R}),S}function hl(){for(let y=0;yJn[Nn]):Ve,qe=he.distr==2?Jn[Ve[1]]-Jn[Ve[0])DELIM" +R"DELIM(]:re,je=S.ticks,we=S.border,mt=je.show?je.size:0,pt=dn(mt*st),jt=dn((S.alignTo==2?S._size-mt-S.gap:S.gap)*st),rt=S._rotate*-Cf/180,yt=k(S._pos*st),Hn=(pt+jt)*te,Sn=yt+Hn;H=O==0?Sn:0,R=O==1?Sn:0;let Bn=S.font[0],Wn=S.align==1?Wl:S.align==2?Gm:rt>0?Wl:rt<0?Gm:O==0?"center":z==3?Gm:Wl,Ti=rt||O==1?"middle":z==2?bu:o_;zs(Bn,K,Wn,Ti);let qn=S.font[1]*S.lineGap,ei=Ve.map(Nn=>k(h(Nn,he,ge,De))),Oi=S._values;for(let Nn=0;Nn{z>0&&(S._paths=null,y&&(u==1?(S.min=null,S.max=null):S.facets.forEach(O=>{O.min=null,O.max=null})))})}let _n=!1,ml=!1,ha=[];function Eo(){ml=!1;for(let y=0;y0&&queueMicrotask(Eo)}l.batch=Sd;function Xn(){if(sa&&(br(),sa=!1),mr&&(Pu(),mr=!1),sl){if(Ot(T,Wl,nt),Ot(T,bu,Zt),Ot(T,Eu,Ce),Ot(T,Tu,me),Ot(E,Wl,nt),Ot(E,bu,Zt),Ot(E,Eu,Ce),Ot(E,Tu,me),Ot(w,Eu,li),Ot(w,Tu,Hi),b.width=dn(li*st),b.height=dn(Hi*st),W.forEach(({_el:y,_show:S,_size:z,_pos:O,side:R})=>{if(y!=null)if(S){let H=R===3||R===0?z:0,K=R%2==1;Ot(y,K?"left":"top",O-H),Ot(y,K?"width":"height",z),Ot(y,K?"top":"left",K?Zt:nt),Ot(y,K?"height":"width",K?me:Ce),yp(y,Fa)}else Ci(y,Fa)}),fi=Mt=bn=cl=_o=So=fl=Vs=ws=null,cn=1,xa(!0),nt!=qs||Zt!=Zn||Ce!=oi||me!=ns){Ln(!1);let y=Ce/oi,S=me/ns;if(J&&!Yt&&be.left>=0){be.left*=y,be.top*=S,_i&&$s(_i,dn(be.left),0,Ce,me),Ys&&$s(Ys,0,dn(be.top),Ce,me);for(let z=0;z=0&&We.width>0){We.left*=y,We.width*=y,We.top*=S,We.height*=S;for(let z in wa)Ot(xi,z,We[z])}qs=nt,Zn=Zt,oi=Ce,ns=me}en("setSize"),sl=!1}li>0&&Hi>0&&(v.clearRect(0,0,b.width,b.height),en("drawClear"),ie.forEach(y=>y()),en("draw")),We.show&&rl&&(ga(We),rl=!1),J&&Yt&&(Bi(null,!0,!1),Yt=!1),Re.show&&Re.live&&Qn&&(_a(),Qn=!1),p||(p=!0,l.status=1,en("ready")),Is=!1,_n=!1}l.redraw=(y,S)=>{mr=S||!1,y!==!1?rs(V,Y.min,Y.max):Gs()};function ma(y,S){let z=I[y];if(z.from==null){if(un==0){let O=z.range(l,S.min,S.max,y);S.min=O[0],S.max=O[1]}if(S.min>S.max){let O=S.min;S.min=S.max,S.max=O}if(un>1&&S.min!=null&&S.max!=null&&S.max-S.min<1e-16)return;y==V&&z.distr==2&&un>0&&(S.min=ys(S.min,i[0]),S.max=ys(S.max,i[0]),S.min==S.max&&S.max++),fe[y]=S,sa=!0,Gs()}}l.setScale=ma;let pl,pa,_i,Ys,To,Fs,_r,Qs,Oo,gl,vt,xt,Si=!1;const ht=be.drag;let qt=ht.x,It=ht.y;J&&(be.x&&(pl=Ji(NM,E)),be.y&&(pa=Ji(AM,E)),Y.ori==0?(_i=pl,Ys=pa):(_i=pa,Ys=pl),vt=be.left,xt=be.top);const We=l.select=an({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),xi=We.show?Ji(OM,We.over?E:T):null;function ga(y,S){if(We.show){for(let z in y)We[z]=y[z],z in wa&&Ot(xi,z,y[z]);S!==!1&&en("setSelect")}}l.setSelect=ga;function No(y){if(U[y].show)M&&yp(Ne[y],Fa);else if(M&&Ci(Ne[y],Fa),J){let z=gr?ui[0]:ui[y];z!=null&&$s(z,-10,-10,Ce,me)}}function rs(y,S,z){ma(y,{min:S,max:z})}function $n(y,S,z,O){S.focus!=null&&vl(y),S.show!=null&&U.forEach((R,H)=>{H>0&&(y==H||y==null)&&(R.show=S.show,No(H),u==2?(rs(R.facets[0].scale,null,null),rs(R.facets[1].scale,null,null)):rs(R.scale,null,null),Gs())}),z!==!1&&en("setSeries",y,S),O&&za("setSeries",l,y,S)}l.setSeries=$n;function as(y,S){an(Q[y],S)}function Ao(y,S){y.fill=Qe(y.fill||null),y.dir=et(y.dir,-1),S=S??Q.length,Q.splice(S,0,y)}function va(y){y==null?Q.length=0:Q.splice(y,1)}l.addBand=Ao,l.setBand=as,l.delBand=va;function Ts(y,S){U[y].alpha=S,J&&ui[y]!=null&&(ui[y].style.opacity=S),M&&Ne[y]&&(Ne[y].style.opacity=S)}let wi,zi,Os;const ls={focus:!0};function vl(y){if(y!=Os){let S=y==null,z=At.alpha!=1;U.forEach((O,R)=>{if(u==1||R>0){let H=S||R==0||R==y;O._focus=S?null:H,z&&Ts(R,H?1:At.alpha)}}),Os=y,z&&Gs()}}M&&pr&&Gt(d_,oe,y=>{be._lock||(Ft(y),Os!=null&&$n(null,ls,!0,Lt.setSeries))});function Ei(y,S,z){let O=I[S];z&&(y=y/st-(O.ori==1?Zt:nt));let R=Ce;O.ori==1&&(R=me,y=R-y),O.dir==-1&&(y=R-y);let H=O._min,K=O._max,te=y/R,re=H+(K-H)*te,de=O.distr;return de==3?oo(10,re):de==4?KM(re,O.asinh):de==100?O.bwd(re):re}function On(y,S){let z=Ei(y,V,S);return ys(z,i[0],Qt,Jt)}l.valToIdx=y=>ys(y,i[0]),l.posToIdx=On,l.posToVal=Ei,l.valToPos=(y,S,z)=>I[S].ori==0?f(y,I[S],z?yn:Ce,z?Gn:0):d(y,I[S],z?Fn:me,z?Yn:0),l.setCursor=(y,S,z)=>{vt=y.left,xt=y.top,Bi(null,S,z)};function os(y,S){Ot(xi,Wl,We.left=y),Ot(xi,Eu,We.width=S)}function ya(y,S){Ot(xi,bu,We.top=y),Ot(xi,Tu,We.height=S)}let us=Y.ori==0?os:ya,ba=Y.ori==1?os:ya;function Mo(){if(M&&Re.live)for(let y=u==2?1:0;y{Be[O]=z}):QM(y.idx)||Be.fill(y.idx),Re.idx=Be[0]),M&&Re.live){for(let z=0;z0||u==1&&!Bt)&&Sa(z,Be[z]);Mo()}Qn=!1,S!==!1&&en("setLegend")}l.setLegend=_a;function Sa(y,S){let z=U[y],O=y==0&&ae==2?Jn:i[y],R;Bt?R=z.values(l,y,S)??$i:(R=z.value(l,S==null?null:O[S],y,S),R=R==null?$i:{_:R}),Re.values[y]=R}function Bi(y,S,z){Oo=vt,gl=xt,[vt,xt]=be.move(l,vt,xt),be.left=vt,be.top=xt,J&&(_i&&$s(_i,dn(vt),0,Ce,me),Ys&&$s(Ys,0,dn(xt),Ce,me));let O,R=Qt>Jt;wi=_t,zi=null;let H=Y.ori==0?Ce:me,K=Y.ori==1?Ce:me;if(vt<0||un==0||R){O=be.idx=null;for(let te=0;te0&&mt.show){let Hn=rt==null?-10:rt==O?de:se(u==1?i[0][rt]:i[we][0][rt],Y,H,0),Sn=yt==null?-10:ze(yt,u==1?I[mt.scale]:I[mt.facets[1].scale],K,0);if(pr&&yt!=null){let Bn=Y.ori==1?vt:xt,Wn=mn(At.dist(l,we,rt,Sn,Bn));if(Wn=0?1:-1,Oi=qn>=0?1:-1;Oi==ei&&(Oi==1?Ti==1?yt>=qn:yt<=qn:Ti==1?yt<=qn:yt>=qn)&&(wi=Wn,zi=we)}else wi=Wn,zi=we}}if(Qn||gr){let Bn,Wn;Y.ori==0?(Bn=Hn,Wn=Sn):(Bn=Sn,Wn=Hn);let Ti,qn,ei,Oi,qi,Nn,ti=!0,Js=Tt.bbox;if(Js!=null){ti=!1;let ut=Js(l,we);ei=ut.left,Oi=ut.top,Ti=ut.width,qn=ut.height}else ei=Bn,Oi=Wn,Ti=qn=Tt.size(l,we);if(Nn=Tt.fill(l,we),qi=Tt.stroke(l,we),gr)we==zi&&wi<=At.prox&&(he=ei,ge=Oi,De=Ti,Ve=qn,Je=ti,qe=Nn,je=qi);else{let ut=ui[we];ut!=null&&(is[we]=ei,ss[we]=Oi,b_(ut,Ti,qn,ti),v_(ut,Nn,qi),$s(ut,Xi(ei),Xi(Oi),Ce,me))}}}}if(gr){let we=At.prox,mt=Os==null?wi<=we:wi>we||zi!=Os;if(Qn||mt){let pt=ui[0];pt!=null&&(is[0]=he,ss[0]=ge,b_(pt,De,Ve,Je),v_(pt,qe,je),$s(pt,Xi(he),Xi(ge),Ce,me))}}}if(We.show&&Si)if(y!=null){let[te,re]=Lt.scales,[de,he]=Lt.match,[ge,De]=y.cursor.sync.scales,Ve=y.cursor.drag;if(qt=Ve._x,It=Ve._y,qt||It){let{left:Je,top:qe,width:je,height:we}=y.select,mt=y.scales[ge].ori,pt=y.posToVal,jt,rt,yt,Hn,Sn,Bn=te!=null&&de(te,ge),Wn=re!=null&&he(re,De);Bn&&qt?(mt==0?(jt=Je,rt=je):(jt=qe,rt=we),yt=I[te],Hn=se(pt(jt,ge),yt,H,0),Sn=se(pt(jt+rt,ge),yt,H,0),us(bs(Hn,Sn),mn(Sn-Hn))):us(0,H),Wn&&It?(mt==1?(jt=Je,rt=je):(jt=qe,rt=we),yt=I[re],Hn=ze(pt(jt,De),yt,K,0),Sn=ze(pt(jt+rt,De),yt,K,0),ba(bs(Hn,Sn),mn(Sn-Hn))):ba(0,K)}else ko()}else{let te=mn(Oo-To),re=mn(gl-Fs);if(Y.ori==1){let De=te;te=re,re=De}qt=ht.x&&te>=ht.dist,It=ht.y&&re>=ht.dist;let de=ht.uni;de!=)DELIM" +R"DELIM(null?qt&&It&&(qt=te>=de,It=re>=de,!qt&&!It&&(re>te?It=!0:qt=!0)):ht.x&&ht.y&&(qt||It)&&(qt=It=!0);let he,ge;qt&&(Y.ori==0?(he=_r,ge=vt):(he=Qs,ge=xt),us(bs(he,ge),mn(ge-he)),It||ba(0,K)),It&&(Y.ori==1?(he=_r,ge=vt):(he=Qs,ge=xt),ba(bs(he,ge),mn(ge-he)),qt||us(0,H)),!qt&&!It&&(us(0,0),ba(0,0))}if(ht._x=qt,ht._y=It,y==null){if(z){if(ic!=null){let[te,re]=Lt.scales;Lt.values[0]=te!=null?Ei(Y.ori==0?vt:xt,te):null,Lt.values[1]=re!=null?Ei(Y.ori==1?vt:xt,re):null}za(Ym,l,vt,xt,Ce,me,O)}if(pr){let te=z&&Lt.setSeries,re=At.prox;Os==null?wi<=re&&$n(zi,ls,!0,te):wi>re?$n(null,ls,!0,te):zi!=Os&&$n(zi,ls,!0,te)}}Qn&&(Re.idx=O,_a()),S!==!1&&en("setCursor")}let cs=null;Object.defineProperty(l,"rect",{get(){return cs==null&&xa(!1),cs}});function xa(y=!1){y?cs=null:(cs=E.getBoundingClientRect(),en("syncRect",cs))}function Yu(y,S,z,O,R,H,K){be._lock||Si&&y!=null&&y.movementX==0&&y.movementY==0||(jo(y,S,z,O,R,H,K,!1,y!=null),y!=null?Bi(null,!0,!0):Bi(S,!0,!1))}function jo(y,S,z,O,R,H,K,te,re){if(cs==null&&xa(!1),Ft(y),y!=null)z=y.clientX-cs.left,O=y.clientY-cs.top;else{if(z<0||O<0){vt=-10,xt=-10;return}let[de,he]=Lt.scales,ge=S.cursor.sync,[De,Ve]=ge.values,[Je,qe]=ge.scales,[je,we]=Lt.match,mt=S.axes[0].side%2==1,pt=Y.ori==0?Ce:me,jt=Y.ori==1?Ce:me,rt=mt?H:R,yt=mt?R:H,Hn=mt?O:z,Sn=mt?z:O;if(Je!=null?z=je(de,Je)?h(De,I[de],pt,0):-10:z=pt*(Hn/rt),qe!=null?O=we(he,qe)?h(Ve,I[he],jt,0):-10:O=jt*(Sn/yt),Y.ori==1){let Bn=z;z=O,O=Bn}}re&&(S==null||S.cursor.event.type==Ym)&&((z<=1||z>=Ce-1)&&(z=Ga(z,Ce)),(O<=1||O>=me-1)&&(O=Ga(O,me))),te?(To=z,Fs=O,[_r,Qs]=be.move(l,z,O)):(vt=z,xt=O)}const wa={width:0,height:0,left:0,top:0};function ko(){ga(wa,!1)}let Fu,Qu,Ju,Xu;function Ro(y,S,z,O,R,H,K){Si=!0,qt=It=ht._x=ht._y=!1,jo(y,S,z,O,R,H,K,!0,!1),y!=null&&(Gt(Fm,gp,Wu,!1),za(c_,l,_r,Qs,Ce,me,null));let{left:te,top:re,width:de,height:he}=We;Fu=te,Qu=re,Ju=de,Xu=he}function Wu(y,S,z,O,R,H,K){Si=ht._x=ht._y=!1,jo(y,S,z,O,R,H,K,!1,!0);let{left:te,top:re,width:de,height:he}=We,ge=de>0||he>0,De=Fu!=te||Qu!=re||Ju!=de||Xu!=he;if(ge&&De&&ga(We),ht.setScale&&ge&&De){let Ve=te,Je=de,qe=re,je=he;if(Y.ori==1&&(Ve=re,Je=he,qe=te,je=de),qt&&rs(V,Ei(Ve,V),Ei(Ve+Je,V)),It)for(let we in I){let mt=I[we];we!=V&&mt.from==null&&mt.min!=_t&&rs(we,Ei(qe+je,we),Ei(qe,we))}ko()}else be.lock&&(be._lock=!be._lock,Bi(S,!0,y!=null));y!=null&&(Kn(Fm,gp),za(Fm,l,vt,xt,Ce,me,null))}function xd(y,S,z,O,R,H,K){if(be._lock)return;Ft(y);let te=Si;if(Si){let re=!0,de=!0,he=10,ge,De;Y.ori==0?(ge=qt,De=It):(ge=It,De=qt),ge&&De&&(re=vt<=he||vt>=Ce-he,de=xt<=he||xt>=me-he),ge&&re&&(vt=vt<_r?0:Ce),De&&de&&(xt=xt{let R=Lt.match[2];z=R(l,S,z),z!=-1&&$n(z,O,!0,!1)},J&&(Gt(c_,E,Ro),Gt(Ym,E,Yu),Gt(f_,E,y=>{Ft(y),xa(!1)}),Gt(d_,E,xd),Gt(h_,E,ec),zp.add(l),l.syncRect=xa);const yl=l.hooks=n.hooks||{};function en(y,S,z){ml?ha.push([y,S,z]):y in yl&&yl[y].forEach(O=>{O.call(null,l,S,z)})}(n.plugins||[]).forEach(y=>{for(let S in y.hooks)yl[S]=(yl[S]||[]).concat(y.hooks[S])});const nc=(y,S,z)=>z,Lt=an({key:null,setSeries:!1,filters:{pub:z_,sub:z_},scales:[V,U[1]?U[1].scale:null],match:[E_,E_,nc],values:[null,null]},be.sync);Lt.match.length==2&&Lt.match.push(nc),be.sync=Lt;const ic=Lt.key,Co=rx(ic);function za(y,S,z,O,R,H,K){Lt.filters.pub(y,S,z,O,R,H,K)&&Co.pub(y,S,z,O,R,H,K)}Co.sub(l);function wd(y,S,z,O,R,H,K){Lt.filters.sub(y,S,z,O,R,H,K)&&Ns[y](null,S,z,O,R,H,K)}l.pub=wd;function zd(){Co.unsub(l),zp.delete(l),vn.clear(),bp(Gf,io,tc),g.remove(),oe?.remove(),en("destroy")}l.destroy=zd;function Do(){en("init",n,i),bo(i||n.data,!1),fe[V]?ma(V,fe[V]):ul(),rl=We.show&&(We.width>0||We.height>0),Yt=Qn=!0,al(n.width,n.height)}return U.forEach(Ss),W.forEach(bd),a?a instanceof HTMLElement?(a.appendChild(g),Do()):a(l,Do):Do(),l}on.assign=an;on.fmtNum=og;on.rangeNum=Yf;on.rangeLog=ud;on.rangeAsinh=ag;on.orient=il;on.pxRatio=st;on.join=i4;on.fmtDate=cg,on.tzDate=m4;on.sync=rx;{on.addGap=Q4,on.clipGaps=dd;let n=on.paths={points:fx};n.linear=hx,n.stepped=W4,n.bars=ej,n.spline=nj}const vx=(n,i,a,l,u)=>{if(!Number.isFinite(a)||!Number.isFinite(l)||l<=a)return[];const f=[];if(Math.asinh(l)-Math.asinh(a)<1.5){const p=Number.isFinite(u)&&u>0?u:(l-a)/4,g=Math.ceil(a/p)*p;for(let b=0;b<100;b++){const v=Number((g+b*p).toPrecision(14));if(v>l)break;f.push({value:v,priority:v===0?0:1})}}else{const p=Math.ceil(Math.log10(Math.max(Math.abs(a),Math.abs(l))));for(let g=Math.min(-1,p-1);g<=p;g++)for(const b of[1,2,5]){const v=b*10**g;for(const w of[-v,v])Number.isFinite(w)&&w>=a&&w<=l&&f.push({value:w,priority:b===1?1:2})}a<=0&&l>=0&&f.push({value:0,priority:0})}f.sort((p,g)=>p.priority-g.priority||p.value-g.value);const d=[],h=[];for(const{value:p}of f){const g=n.valToPos(p,"y");Number.isFinite(g)&&h.every(b=>Math.abs(g-b)>=36)&&(d.push(p),h.push(g))}return d.sort((p,g)=>p-g),d};function hj(n){const i=n.filter(([,a])=>a>0).map(([a,l])=>({minimumRate:a,virtualSize:l}));return i.sort((a,l)=>a.minimumRate-l.minimumRate),i}const mj=new Intl.NumberFormat(void 0,{maximumSignificantDigits:8}),pj=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Tp(n){return mj.format(n)}function yx(n){return`${pj.format(n)} vB`}function gj({snapshot:n,now:i,color:a,scale:l}){const u=le.useMemo(()=>hj(n?.data.histogram??[]),[n]),f=n!==null&&i-n.receivedAt>=Hu,d=n===null?"Waiting for transaction-pool fee data…":f?"Fee distribution is stale. Waiting for a fresh pool snapshot…":n.data.count===0?"The transaction pool is empty.":u.length===0?"No fee distribution is available for this pool snapshot.":null;return x.jsxs("div",{className:"space-y-3",children:[d?x.jsx("p",{role:"status",className:"text-textMuted flex min-h-72 items-center justify-center px-4 text-center text-sm",children:d}):x.jsxs(x.Fragment,{children:[x.jsx(vj,{bins:u,color:a,scale:l}),x.jsx("p",{className:"text-textMuted text-xs",children:"Each bar is a fee-rate group, labeled by its minimum rate. Bar height is virtual size, not transaction count. Groups are spaced evenly."}),x.jsxs("details",{className:"border-accentSecondary/20 rounded-md border text-xs",children:[x.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-3 py-2",children:["View ",pn(u.length)," fee-rate ",u.length===1?"group":"groups"]}),x.jsx("div",{className:"border-accentSecondary/20 max-h-56 overflow-auto border-t",children:x.jsxs("table",{className:"w-full text-left tabular-nums",children:[x.jsx("caption",{className:"sr-only",children:"Transaction-pool fee-rate groups"}),x.jsx("thead",{className:"bg-surface text-textMuted sticky top-0",children:x.jsxs("tr",{children:[x.jsx("th",{scope:"col",className:"px-3 py-2",children:"Minimum rate (sat/vB)"}),x.jsx("th",{scope:"col",className:"px-3 py-2 text-right",children:"Virtual size (vB)"})]})}),x.jsx("tbody",{className:"divide-accentSecondary/20 divide-y",children:u.map((h,p)=>x.jsxs("tr",{children:[x.jsx("td",{className:"px-3 py-2",children:Tp(h.minimumRate)}),x.jsx("td",{className:"px-3 py-2 text-right",children:pn(h.virtualSize)})]},p))})]})})]})]}),n&&x.jsxs("p",{className:"text-textMuted text-xs",children:[f?"Last snapshot":"Snapshot"," ",$u(n.receivedAt),!f&&` · ${pn(n.data.count)} transactions · ${yx(n.data.virtual)}`]})]})}function vj({bins:n,color:i,scale:a}){const l=Xf(),u=le.useRef(null),f=le.useRef(null),d=le.useRef(n);return le.useLayoutEffect(()=>{d.current=n;const h=f.current;h&&(h.setData([n.map((p,g)=>g),n.map(p=>p.virtualSize)]),h.redraw(!1,!0))},[n]),le.useLayoutEffect(()=>{const h=u.current;if(!h)return;const p=getComputedStyle(h),g=ku(i,p),b=`12px ${p.fontFamily}`,v=[d.current.map((A,k)=>k),d.current.map(A=>A.virtualSize)],w={width:Math.max(240,h.clientWidth),height:280,padding:[12,12,0,0],cursor:{drag:{x:!1,y:)DELIM" +R"DELIM(!1}},legend:{show:!0,live:!0},scales:{x:{time:!1,range:()=>[-.5,d.current.length-.5]},y:{distr:a==="compressed"?4:1,asinh:1,range:(A,k,L)=>[0,Math.max(1,L*1.08)]}},axes:[{stroke:p.color,font:b,grid:{show:!1},ticks:{stroke:p.getPropertyValue("--chart-ticks").trim(),width:1},splits:A=>{const k=d.current,L=Math.max(1,Math.ceil(k.length/Math.max(1,Math.floor(A.width/80))));return k.map((U,W)=>W).filter(U=>U%L===0)},values:(A,k)=>k.map(L=>Tp(d.current[L].minimumRate))},{size:76,stroke:p.color,font:b,grid:{stroke:p.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:p.getPropertyValue("--chart-ticks").trim(),width:1},values:(A,k)=>k.map(L=>pn(L)),...a==="compressed"?{splits:vx,filter:(A,k)=>k}:{}}],series:[{label:"Min rate",value:(A,k)=>{const L=k===null?void 0:d.current[k];return L?`${Tp(L.minimumRate)} sat/vB`:"—"}},{label:"Virtual size",stroke:g,fill:`${g}90`,width:1,points:{show:!1},paths:on.paths.bars?.({size:[.85,48]}),value:(A,k)=>k===null?"—":yx(k)}]},T=new on(w,v,h);f.current=T;const E=new ResizeObserver(A=>{const k=A[0]?.contentRect.width;k&&k>0&&T.setSize({width:Math.round(k),height:280})});return E.observe(h),()=>{E.disconnect(),T.destroy(),f.current=null}},[i,a,l]),x.jsxs("div",{role:"img","aria-label":"Transaction-pool fee distribution: virtual size in vbytes by minimum fee rate in satoshis per vbyte",children:[x.jsx("p",{className:"text-textMuted mb-2 text-xs",children:"Virtual size (vB)"}),x.jsx("div",{ref:u,className:"text-textMuted min-w-0 overflow-hidden"}),x.jsx("p",{className:"text-textMuted text-center text-xs",children:"Minimum fee rate per group (sat/vB)"})]})}function yj({data:n,series:i,height:a=280,emptyMessage:l="Waiting for live data…",valueSuffix:u="",zeroBased:f=!0,valueFormatter:d=wj,visualization:h="line",scale:p="linear",forceEmpty:g=!1}){const b=Xf(),v=le.useRef(null),w=le.useRef(null),T=le.useRef(!1),E=le.useRef(null),A=le.useRef(new Map),k=le.useMemo(()=>xj(n),[n]),L=le.useRef(k),U=!g&&n[0]?.length>0;return le.useLayoutEffect(()=>{L.current=k},[k]),le.useLayoutEffect(()=>{const W=v.current;if(!W)return;const I=getComputedStyle(W),Q=`12px ${I.fontFamily}`,V=[],ne={width:Math.max(240,W.clientWidth),height:a,padding:[12,8,0,0],cursor:{drag:{x:!0,y:!1,setScale:!0},focus:{prox:8}},hooks:{setSelect:[Y=>{Y.select.width>0&&(T.current=!0)}],setCursor:[Y=>bj(Y,V,d,u)],setSeries:[(Y,ae)=>{const se=ae===null?void 0:Y.series[ae];typeof se?.label=="string"&&A.current.set(se.label,se.show!==!1)}]},legend:{show:!0,live:!1},scales:{x:{time:!0},y:{auto:!0,distr:p==="compressed"?4:1,asinh:1,...f?{range:(Y,ae,se)=>ae===null||se===null?[0,1]:[Math.min(0,ae),se===0?1:se*1.08]}:{range:(Y,ae,se)=>{if(ae===null||se===null)return[0,1];const ze=se-ae,fe=ze===0?Math.max(1,Math.abs(se)*5e-4):ze*.08,X=ae-fe;return[ae>=0?Math.max(0,X):X,se+fe]}}}},axes:[{stroke:I.color,grid:{stroke:I.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:I.getPropertyValue("--chart-ticks").trim(),width:1},font:Q},{size:72,stroke:I.color,grid:{stroke:I.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:I.getPropertyValue("--chart-ticks").trim(),width:1},font:Q,values:(Y,ae)=>ae.map(se=>se===null?null:`${d(se)}${u}`),...p==="compressed"?{splits:vx,filter:(Y,ae)=>ae}:{}}],series:[{},...i.map((Y,ae)=>{const se=ku(Y.color,I),ze=h==="step"?on.paths.stepped?.({align:1}):h==="bar"?_j(ae,i.length):void 0;return{label:Y.label,show:A.current.get(Y.label)??!0,stroke:se,fill:h==="area"||h==="bar"?Y.fill??`${se}24`:Y.fill,width:Y.width??2,paths:ze,points:{show:h==="line"?Y.points??!1:!1}}})]},ie=new on(ne,L.current,W);ie.root.querySelectorAll(".u-legend .u-label").forEach(Y=>{const ae=i.find(se=>se.label===Y.textContent);ae&&(Y.style.color=ku(ae.color,I))});for(const Y of i){const ae=document.createElement("span");ae.className="pointer-events-none absolute z-20 hidden whitespace-nowrap text-xs font-semibold",ae.style.color=ku(Y.color,I),ie.over.appendChild(ae),V.push(ae)}const Ae=E.current;Ae&&ie.setScale("x",Ae),w.current=ie;const ye=new ResizeObserver(Y=>{const ae=Y[0]?.contentRect.width;ae&&ae>0&&ie.setSize({width:Math.round(ae),height:a})});return ye.observe(W),()=>{E.current=T.current&&ie.scales.x.min!=null&&ie.scales.x.max!=null?{min:ie.scales.x.min,max:ie.scales.x.max}:null,ye.disconnect(),ie.destroy(),w.current=null}},[a,i,d,u,h,f,p,b]),le.useEffect(()=>{const W=w.current;if(!W)return;const I=!T.current;W.setData(k,I),!I&&W.status===1&&W.redraw()},[k]),x.jsxs("div",{className:"relative min-w-0",children:[x.jsx("div",{ref:v,className:"text-textMuted min-w-0 overflow-hidden"}),!U&&x.jsx("div",{className:"bg-surface text-textMuted pointer-events-none absolute inset-0 z-10 flex items-center justify-center text-sm",children:l})]})}function bj(n,i,a,l){const{idx:u,left:f}=n.cursor,d=n.over.clientWidth;i.forEach((h,p)=>{const g=n.series[p+1],b=u==null?null:n.data[p+1]?.[u];if(f==null||f<0||g?.show===!1||b==null){h.classList.add("hidden");return}const v=f>d-96;h.textContent=`${a(b)}${l}`,h.style.left=`${String(v?f-8:f+8)}px`,h.style.top=`${String(n.valToPos(b,"y"))}px`,h.style.transform=`translate(${v?"-100%":"0"}, -100%)`,h.classList.remove("hidden")})}function _j(n,i){const a=Math.max(1,i);return on.paths.bars?.({size:[1,48/a,0],disp:{x0:{unit:1,values:l=>{const u=G_(l,a),f=-u.groupWidth/2+u.barWidth*n;return Array.from(l.data[0],d=>d+f)}},size:{unit:1,values:l=>[G_(l,a).barWidth]}}})}function G_(n,i){const a=Sj(n.data[0]),l=Math.abs(n.posToVal(48,"x")-n.posToVal(0,"x")),u=Math.min(a*.72,l);return{groupWidth:u,barWidth:u/i}}function Sj(n){let i=Number.POSITIVE_INFINITY,a;for(const l of n)if(Number.isFinite(l)){if(a!==void 0){const u=Math.abs(l-a);u>0&&u=2)return n;const a=Date.now()/1e3,l=i[0]??a,u=[l-1,l],f=n.slice(1).map(d=>{const h=d[0]??null;return[h,h]});return[u,...f]}function wj(n){return Math.abs(n)>=1e6?`${(n/1e6).toFixed(1)}m`:Math.abs(n)>=1e3?`${(n/1e3).toFixed(1)}k`:Math.abs(n)>=10?n.toFixed(0):Math.abs(n)>=1?n.toFixed(1):n.toFixed(2)}const zj={300:"5m",900:"15m",3600:"1h"},Ej=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),Tj=new Intl.NumberFormat(void 0,{maximumFractionDigits:2});function Oj(n){return Ej.format(n)}function Nj(n){return Tj.format(n)}function Aj(n){return n==="height"||n==="occurrences"?Oj:Nj}function Mj({metrics:n}){const i=MS(),[a,l]=le.useState(eM),[u,f]=le.useState(null),[d,h]=le.useState(!1);le.useEffect(()=>{tM(a)},[a]);function p(v){l(w=>u?.mode==="add"?w.length>=eo?w:[...w,v]:w.map(T=>T.id===v.id?v:T)),f(null)}function g(v,w){l(T=>{const E=v+w;if(E<0||E>=T.length)return T;const A=[...T],k=A[v],L=A[E];return A[v]=L,A[E]=k,A})}function b(){if(!d){h(!0);return}l(Rf()),h(!1)}return x.jsxs("section",{className:"space-y-4",children:[x.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Live telemetry"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Custom charts"}),x.jsxs("p",{className:"text-textMuted mt-1 text-sm",children:["Session data only · ",String(a.length)," of ",String(eo)," charts"]})]}),x.jsxs("div",{className:"flex flex-wrap gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{h(!1),f({mode:"add",chart:ES()})},disabled:a.length>=eo,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-40",children:"Add chart"}),x.jsx("button",{type:"button",onClick:b,onBlur:()=>{h(!1)},className:`rounded-md border px-3 py-2 text-sm font-medium ${d?"border-amber-400/60 text-amber-200":"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary"}`,children:d?"Confirm reset":"Reset defaults"})]})]}),a.length===0?x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border border-dashed px-6 py-16 text)DELIM" +R"DELIM(-center",children:[x.jsx("p",{className:"text-textPrimary font-medium",children:"No charts in this dashboard."}),x.jsx("p",{className:"text-textMuted mt-2 text-sm",children:"Add a custom chart or start from a template."})]}):x.jsx("div",{className:"grid gap-6 xl:grid-cols-2",children:a.map((v,w)=>x.jsx(jj,{chart:v,metrics:n,now:i,canMoveEarlier:w>0,canMoveLater:w{l(T=>T.map(E=>E.id===v.id?{...E,scale:E.scale==="compressed"?"linear":"compressed"}:E))},onDelete:()=>{l(T=>T.filter(E=>E.id!==v.id))},onDuplicate:()=>{l(T=>T.length>=eo?T:[...T,W3(v)])},onEdit:()=>{f({mode:"edit",chart:v})},onMoveEarlier:()=>{g(w,-1)},onMoveLater:()=>{g(w,1)}},v.id))}),u&&x.jsx(vM,{chart:u.chart,mode:u.mode,onCancel:()=>{f(null)},onSave:p},`${u.mode}-${u.chart.id}`)]})}function jj({chart:n,metrics:i,now:a,canMoveEarlier:l,canMoveLater:u,canDuplicate:f,onDelete:d,onDuplicate:h,onEdit:p,onMoveEarlier:g,onMoveLater:b,onToggleScale:v}){const[w,T]=le.useState(null),[E,A]=le.useState(0),k=w??i,L=le.useMemo(()=>ln(n)?uM(k,n):null,[n,k]),U=le.useMemo(()=>ln(n)?n.series.map(Q=>({label:Q.label??cr(Q.signalId).label,color:Q.color})):[],[n]),W=Aj(L?.unit??"vbytes"),I=`Waiting for ${U.length===1?U[0]?.label?.toLowerCase():"the selected signals"}…`;return x.jsxs("article",{className:"border-accent/30 bg-surface/80 min-w-0 overflow-hidden rounded-2xl border",children:[x.jsx("header",{className:"border-accentSecondary/20 space-y-3 border-b px-4 py-4 sm:px-5",children:x.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[x.jsxs("div",{className:"min-w-0",children:[x.jsx("h3",{className:"text-accent truncate text-lg font-semibold",title:n.title,children:n.title}),x.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:[ln(n)&&L?`${AS(L.unit)} · ${zj[n.range]} · ${n.visualization}`:"Virtual size by fee-rate group · latest snapshot",n.scale==="compressed"?" · log scale":"",w?" · paused":""]})]}),x.jsxs("div",{className:"flex flex-wrap justify-end gap-1 text-xs",children:[x.jsx("button",{type:"button","aria-label":`Log scale for ${n.title}`,"aria-pressed":n.scale==="compressed",title:"Toggle between a linear and a logarithmic (asinh) Y axis. Zero, negative values, and original measurements are preserved.",onClick:v,className:`rounded-md border px-2 py-1.5 ${n.scale==="compressed"?"border-accent/40 bg-accentSecondary/20 text-accent":"border-accent/30 text-textMuted hover:text-accent hover:bg-accentSecondary/10"}`,children:n.scale==="compressed"?"Log scale":"Linear scale"}),x.jsx(Ka,{label:w?"Resume chart":"Pause chart",onClick:()=>{T(Q=>Q?null:ln(n)?i:{...i,now:a})},children:w?"Resume":"Pause"}),ln(n)&&x.jsx(Ka,{label:"Reset chart zoom",onClick:()=>{A(Q=>Q+1)},children:"Reset zoom"}),x.jsx(Ka,{label:"Edit chart",onClick:p,children:"Edit"}),x.jsx(Ka,{label:"Duplicate chart",onClick:h,disabled:!f,children:"Duplicate"}),x.jsx(Ka,{label:`Move ${n.title} up`,onClick:g,disabled:!l,children:"↑"}),x.jsx(Ka,{label:`Move ${n.title} down`,onClick:b,disabled:!u,children:"↓"}),x.jsx(Ka,{label:"Delete chart",onClick:d,danger:!0,children:"Delete"})]})]})}),x.jsx("div",{className:"min-w-0 p-3 sm:p-5",children:ln(n)&&L?x.jsx(yj,{data:L.data,series:U,visualization:n.visualization,scale:n.scale,zeroBased:fM(L.unit),valueFormatter:W,valueSuffix:cM(L.unit),forceEmpty:!L.hasObservedData,emptyMessage:I},E):!ln(n)&&x.jsx(gj,{snapshot:k.poolSnapshot,now:w?.now??a,color:n.color,scale:n.scale})}),n.scale==="compressed"&&x.jsx("p",{className:"text-textMuted px-5 pb-3 text-[11px]",children:"Log Y axis · labels and hover values show original measurements."}),ln(n)&&n.series.some(Q=>Q.signalId==="event:10")&&x.jsx("p",{className:"text-textMuted px-5 pb-3 text-[11px]",children:"Archival includes compact-block recovery; rejected and duplicate submissions are excluded."}),L&&L.unobservedLabels.length>0&&L.hasObservedData&&x.jsxs("footer",{className:"border-accent/10 text-textMuted border-t px-5 py-2 text-[11px]",children:["Not observed this session: ",L.unobservedLabels.join(", ")]})]})}function Ka({label:n,children:i,onClick:a,disabled:l=!1,danger:u=!1}){return x.jsx("button",{type:"button","aria-label":n,onClick:a,disabled:l,className:`rounded-md px-2 py-1.5 disabled:cursor-not-allowed disabled:opacity-30 ${u?"text-textMuted hover:bg-red-500/10 hover:text-red-300":"text-textMuted hover:text-accent hover:bg-accentSecondary/10"}`,children:i})}const kj=[{event:0,label:"Header archived"},{event:3,label:"Block archived"},{event:5,label:"Block validated"},{event:6,label:"Block confirmed"},{event:13,label:"Block organized"},{event:14,label:"Block reorganized"}];function Rj({adminStatus:n,endpoints:i,metrics:a,native:l,sync:u}){const f=B3(a,10),d=l.configuration,h=cS(d?.forks??[]),p=Cj(n,l.status),g=i.adminUrl===i.nativeUrl,b=[n.error?`${g?"Connection":"Admin"}: ${n.error}`:null,l.status.error&&!g?`Native: ${l.status.error}`:null,l.transport==="none"&&l.restError?`Native REST: ${l.restError}`:null,a.invalidFrames>0?`${String(a.invalidFrames)} malformed admin frame${a.invalidFrames===1?"":"s"} ignored`:null,l.live.invalidFrames>0?`${String(l.live.invalidFrames)} malformed native frame${l.live.invalidFrames===1?"":"s"} ignored`:null,l.status.phase==="connected"&&l.transport==="none"?"Native: Connected, but no fresh valid state has been received":null].filter(v=>v!==null);return x.jsxs("div",{className:"space-y-6",children:[b.length>0&&x.jsxs("section",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3",children:[x.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Transport notice"}),x.jsx("ul",{className:"text-textMuted mt-1 space-y-1 text-xs",children:b.map(v=>x.jsx("li",{children:v},v))})]}),x.jsx(nM,{sync:u}),x.jsxs("dl",{"aria-label":"Node summary",className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-4",children:[x.jsx(wf,{label:"Current top",value:l.top===null?"—":pn(l.top),detail:l.transport==="none"?"Waiting for native API":`${Uj(u)} · via ${l.transport==="websocket"?"native WebSocket":"REST fallback"}`,emphasized:!0}),x.jsx(wf,{label:"Current activity",value:f.label,detail:f.rate>0?`${PA(f.rate)} over the last 10 seconds`:"No lifecycle events in the last 10 seconds",numeric:!1}),x.jsx(wf,{label:"Collection uptime",value:VA(a.now-a.sessionStartedAt),detail:`${pn(a.totalEvents)} events · ${pn(a.totalLogs)} logs`}),x.jsx(wf,{label:"Connection",value:p.phase==="connected"?t3(i.adminUrl).replace(/\/$/u,""):"[disconnected]",detail:`${p.lastMessageAt?`Last frame ${$u(p.lastMessageAt)}`:"Waiting for the first frame"} · ${String(p.reconnects)} reconnect${p.reconnects===1?"":"s"}`,numeric:!1})]}),x.jsx(Mj,{metrics:a}),x.jsxs("section",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-2xl border",children:[x.jsxs("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Lifecycle heights"}),x.jsx("h2",{className:"text-accent mt-1 text-lg font-semibold",children:"Highest observed event values"})]}),x.jsx("div",{className:"bg-accentSecondary/10 grid gap-px sm:grid-cols-2 lg:grid-cols-3",children:kj.map(({event:v,label:w})=>{const T=a.signalMaximums[Ui(v)];return x.jsxs("div",{className:"bg-surface px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:w}),x.jsx("p",{className:"text-textPrimary mt-2 text-xl font-semibold tabular-nums",children:T===void 0?"—":pn(T)})]},v)})})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsxs("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Capabilities"}),x.jsx("h2",{className:"text-accent mt-1 text-lg font-semibold",children:"Native configuration"})]}),d?x.jsxs(")DELIM" +R"DELIM(div",{className:"space-y-4 p-5 text-sm",children:[x.jsxs(Su,{title:"Store configuration",children:[x.jsx(ep,{items:[["Address index",d.store.address],["Client filters index",d.store.filter],["Silent payments index",d.store.silent!==null],["Turbo",d.store.turbo]]}),x.jsx(Of,{items:[["Silent payments from",d.store.silent===null?"Not indexed":pn(d.store.silent)]]})]}),x.jsxs(Su,{title:"Node services",children:[x.jsx(ep,{items:[["Blocks",d.node.blocks],["Limited",d.node.limited],["Witness",d.node.witness],["Filters",d.node.filters],["Privacy",d.node.privacy]]}),x.jsx(Of,{items:[["Inputs pruned below",d.store.pruned>0?pn(d.store.pruned):"Not pruned"]]})]}),d.network&&x.jsxs(Su,{title:"Peer protocol",children:[x.jsx(ep,{items:[["Relay",d.network.relay],["Compact",d.network.compact],["Address",d.network.address],["Witness tx",d.network.witness_tx],["Memory pool",d.network.memory_pool],["Not found",d.network.not_found],["Reject",d.network.reject],["Alert",d.network.alert]]}),x.jsx(Of,{items:[["Protocol minimum",String(d.network.protocol_minimum)],["Protocol maximum",String(d.network.protocol_maximum)]]})]}),d.wallet&&x.jsx(Su,{title:"Wallet",children:x.jsx(Of,{items:[["P2PKH version",String(d.wallet.p2kh),Pa(h,"p2kh",d.wallet.p2kh)],["P2SH version",String(d.wallet.p2sh),Pa(h,"p2sh",d.wallet.p2sh)],["WIF version",String(d.wallet.wif),Pa(h,"wif",d.wallet.wif)],["Witness prefix",d.wallet.witness,Pa(h,"witness",d.wallet.witness)],["Silent prefix",d.wallet.silent,Pa(h,"silent",d.wallet.silent)],["HD private",F_(d.wallet.hd_private),Pa(h,"hdPrivate",d.wallet.hd_private)],["HD public",F_(d.wallet.hd_public),Pa(h,"hdPublic",d.wallet.hd_public)]]})}),x.jsx(Su,{title:"Configured forks",children:x.jsx("div",{className:"flex flex-wrap gap-1.5",children:d.forks.map(v=>x.jsx("span",{className:"text-textPrimary bg-accentSecondary/15 rounded-full px-2 py-0.5 font-mono text-xs",children:v},v))})})]}):x.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:"Waiting for native configuration."})]})]}),x.jsx("section",{children:x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsx("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Recent events"})}),a.recentEvents.length===0?x.jsx(Dj,{text:"No events observed yet."}):x.jsx("ul",{className:"divide-accentSecondary/20 divide-y",children:a.recentEvents.slice(0,6).map(v=>x.jsxs("li",{className:"flex items-center gap-3 px-5 py-3 text-xs",children:[x.jsx("time",{className:"text-textMuted w-24 shrink-0 font-mono",children:$u(v.time)}),x.jsx("span",{className:"text-textPrimary min-w-0 flex-1 truncate font-mono",children:po(v.event).name}),x.jsx("span",{className:"text-accent tabular-nums",children:uS(v.event,v.value)})]},v.id))})]})})]})}const Y_={connected:0,connecting:1,reconnecting:2,idle:3};function Cj(n,i){const a=Y_[i.phase]>Y_[n.phase]?i:n,l=Math.max(n.lastMessageAt??0,i.lastMessageAt??0);return{...a,reconnects:n.reconnects+i.reconnects,lastMessageAt:l>0?l:null}}function Su({title:n,children:i}){return x.jsxs("section",{className:"border-accentSecondary/20 space-y-2 border-t pt-3 first:border-t-0 first:pt-0",children:[x.jsx("h3",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:n}),i]})}function ep({items:n}){const i=n.filter(([,a])=>a!==void 0);return x.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(([a,l])=>x.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs ${l?"border-emerald-500/50 bg-emerald-500/15 text-emerald-300":"text-textMuted border-slate-500/40"}`,children:a},a))})}function Of({items:n}){const i=n.some(l=>l.length>2),a=i?"grid-cols-[10rem_max-content_auto]":"grid-cols-[10rem_max-content]";return x.jsx("dl",{className:`grid ${a} items-baseline gap-x-4 gap-y-1`,children:n.map(([l,u,f])=>x.jsxs(le.Fragment,{children:[x.jsx("dt",{className:"text-textMuted",children:l}),x.jsx("dd",{className:"text-textPrimary font-mono",children:u}),i&&x.jsx("dd",{className:"text-textMuted",children:f})]},l))})}function F_(n){return`0x${n.toString(16).padStart(8,"0")}`}function Dj({text:n}){return x.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:n})}function Uj(n){return n?n.diverged?"Candidate branch diverges":n.blocksRemaining===0?"At top candidate header":n.blocksRemaining<=rd?`Near current, ${pn(n.blocksRemaining)} blocks remaining`:`${pn(n.blocksRemaining)} blocks remaining`:"Waiting for chain tops"}const Zj=8e3;function Lj({sync:n,browserNotificationsEnabled:i}){const a=le.useRef(null),[l,u]=le.useState(null),d=n!==null&&n.candidate.height===0?null:n?.blocksRemaining??null;if(le.useEffect(()=>{const p=Hj(d);if(!p)return;const g=a.current;if(a.current=p.state,!(g===null||g===p.state)&&(u(p),i)){const b=$j(p);Jz(b.title,{body:b.body,tag:"libbitcoin-sync-status"})}},[i,d]),le.useEffect(()=>{if(!l)return;const p=setTimeout(()=>{u(g=>g===l?null:g)},Zj);return()=>{clearTimeout(p)}},[l]),!l)return null;const h=l.state==="near-current";return x.jsx("aside",{role:"status","aria-live":"polite","aria-atomic":"true",className:`fixed right-4 bottom-4 left-4 z-[60] rounded-xl border p-4 shadow-2xl shadow-black/50 sm:left-auto sm:w-96 ${h?"bg-noticeSuccess/95 border-emerald-400/35":"bg-noticeWarning/95 border-amber-400/35"}`,children:x.jsxs("div",{className:"flex items-start gap-4",children:[x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx("p",{className:h?"font-semibold text-emerald-200":"font-semibold text-amber-200",children:h?"Node near current":"Node fell behind"}),x.jsx("p",{className:"text-noticeText/75 mt-1 text-sm",children:Op(l)})]}),x.jsx("button",{type:"button","aria-label":"Dismiss synchronization notification",onClick:()=>{u(null)},className:"text-noticeText/60 hover:text-noticeText text-lg leading-none",children:"×"})]})})}function $j(n){return n.state==="near-current"?{title:"Libbitcoin node near current",body:Op(n)}:{title:"Libbitcoin node fell behind",body:Op(n)}}function Hj(n){return n===null?null:{state:n<=rd?"near-current":"behind",blocksBehind:n}}function Op(n){return n.state==="near-current"?`Confirmed top is within ${String(rd)} blocks of the top candidate header.`:`Confirmed top is ${pn(n.blocksBehind)} blocks below the top candidate header.`}const bx='(function(){"use strict";function je(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function vt(e,t="|"){return e.map(n=>St(n)).join(t)}function Le(e,t){return typeof t=="bigint"?t.toString():t}class wr{constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}}function Fe(e){return new wr(e)}function kr(e){return e==null}function Ce(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function zr(e,t){const n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r){const c=t._zod.def.shape[s];return r?r(c,s):c}):wt(e,s,r?r(o.value,s):o.value))}}function Sr(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?yt(e,n,()=>t[n]):wt(e,n,r.value))}}function N(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}f)DELIM" +R"DELIM(unction $r(e){return JSON.stringify(e)}function Or(e){return e.toLowerCase().trim().replace(/[^\\w\\s-]/g,"").replace(/[\\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const kt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function pe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Er=Fe(()=>{if(R.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function X(e){if(pe(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(pe(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function zt(e){return X(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Ir=new Set(["string","number","symbol"]);function me(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function K(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function St(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Tr(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const $t={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]},Ar={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Zr(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");const s={};return G(s,e,ge(e,t)),K(e,N(n,{shape:s,checks:[]}))}function ge(e,t){const n=x(e),r=[];for(const i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,i)?.enumerable)throw new Error(`Unrecognized key: "${String(i)}"`);t[i]&&r.push(i)}return r}function Pr(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 s=new Set(ge(e,t)),o={};return G(o,e,Reflect.ownKeys(x(e)).filter(c=>!s.has(c))),K(e,N(n,{shape:o,checks:[]}))}function Nr(e,t){if(!X(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=x(e);for(const s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return K(e,N(e._zod.def,{shape:Ot(e,t)}))}function Ot(e,t){const n={};return G(n,e,Reflect.ownKeys(x(e))),Sr(n,t),n}function Rr(e,t){if(!X(t))throw new Error("Invalid input to safeExtend: expected a plain object");return K(e,N(e._zod.def,{shape:Ot(e,t)}))}function Mr(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};G(n,e,Reflect.ownKeys(x(e))),G(n,t,Reflect.ownKeys(x(t)));const r=N(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return K(e,r)}function Et(e,t,n,r="partial"){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const c=n?new Set(ge(t,n)):void 0,a={};return G(a,t,Reflect.ownKeys(x(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),K(t,N(t._zod.def,{shape:a,checks:[]}))}function jr(e,t,n){const r=n?new Set(ge(t,n)):void 0,i={};return G(i,t,Reflect.ownKeys(x(t)),(s,o)=>r&&!r.has(o)?s:new e({type:"nonoptional",innerType:s})),K(t,N(t._zod.def,{shape:i}))}function F(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ie(e){return typeof e=="string"?e:e?.message}function It(e){const t=[];for(const n of e??[]){const r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;const i=r.maximum??r.length??r.size;i>=0&&t.push([i,n])}return t}function De(e,t,n){var r;for(let i=t;ie;return t[Jr]=!0,t}var Zt;const Be={value:void 0,enumerable:!1};let Pt="captureStackTrace"in Error?Error:null;function Wr(e){const t=Pt;if(t){const n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return Pt=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function f(e,t,n,r){const i={};function s(p){this.def=p,this.constr=h,this.traits=new Set}s.prototype=i;const o=n,c=o&&new WeakSet;f)DELIM" +R"DELIM(unction a(p,d){if(p._zod){if(p._zod.traits.has(e))return}else{Be.value=new s(d);try{Object.defineProperty(p,"_zod",Be)}finally{Be.value=void 0}}if(p._zod.traits.add(e),t(p,d),c){const g=Object.getPrototypeOf(p),v=p._zod.constr.prototype;let b=g;for(;b&&b!==v;)b=Object.getPrototypeOf(b);const P=b??g;c.has(P)||(c.add(P),Dr(P,o))}const m=h.prototype;for(const g in m)Object.prototype.hasOwnProperty.call(m,g)&&(g in p||(p[g]=m[g].bind(p)))}const u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function h(p){const d=r?.Parent?Wr(l):this;a(d,p);const m=d._zod.deferred;if(m){for(const v of m)v();d._zod.deferred=void 0}const g=globalThis.__zod_globalConfig?.postProcessor;return g&&g(d),d}return Object.defineProperty(h,"init",{value:a}),Object.defineProperty(h,Symbol.hasInstance,{value:p=>r?.Parent&&p instanceof r.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(h,"name",{value:e}),h}class H extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Nt extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Zt=globalThis).__zod_globalConfig??(Zt.__zod_globalConfig={});const R=globalThis.__zod_globalConfig;function C(e){return e&&Object.assign(R,e),R}function qr(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Le,2)),e.message}function Gr(e){this._zod.message=e}const Hr={get:qr,set:Gr,enumerable:!0,configurable:!0},Je={value:void 0,enumerable:!1},Rt=new WeakSet([Object.prototype,Error.prototype]),Yr=f("$ZodError",(e,t)=>{e.name="$ZodError",Je.value=t,Object.defineProperty(e,"issues",Je),Je.value=void 0,Object.defineProperty(e,"message",Hr);const n=Object.getPrototypeOf(e);Rt.has(n)||(Rt.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))});function Xr(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Qr(e,t=n=>n.message){const n={},r=[];for(const i of e.issues)i.path.length>0?Xr(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ei(e,t=n=>n.message){const n={_errors:[]},r=(i,s=[])=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(c=>r({issues:c},[...s,...o.path]));else if(o.code==="invalid_key")r({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")r({issues:o.issues},[...s,...o.path]);else{const c=[...s,...o.path];if(c.length===0)n._errors.push(t(o));else{let a=n,u=0;for(;u{const t=(n,r,i,s)=>{const o=i?{...i,async:!1}:{async:!1},c=n._zod.run({value:r,issues:[]},o);if(c instanceof Promise)throw new H;if(c.issues.length){const a=new(s?.Err??e)(c.issues.map(u=>J(u,o,C())));throw kt(a,s?.callee??t),a}return c.value};return t},We=e=>{const t=async(n,r,i,s)=>{const o=i?{...i,async:!0}:{async:!0};let c=n._zod.run({value:r,issues:[]},o);if(c instanceof Promise&&(c=await c),c.issues.length){const a=new(s?.Err??e)(c.issues.map(u=>J(u,o,C())));throw kt(a,s?.callee??t),a}return c.value};return t},qe=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 H;return s.issues.length?Mt(e,s.issues,i):{success:!0,data:s.value}};function Mt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(i=>J(i,n,C()))),t=void 0,n=void 0),r},set error(i){r=i,t=void 0,n=void 0}}}const Ge=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?Mt(e,s.issues,i):{success:!0,data:s.value}},ti=Symbol.for("zod.compile.invalid"),ni=Symbol.for("zod.compile.fallback"),ri=((e,t,n)=>{const r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==ti)return!0;if(r.definite===!0&&n===void 0)return!1}return ii(e,t,n)});function ii(e,t,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun;let s;if(i?(r[ni]=!0,s=i({value:t,issues:[]},r)):s=e._zod.run({value:t,issues:[]},r),s instanceof Promise)throw new H;return s.issues.length===0}const si=async(e,t,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},oi=e=>{const t=Ve(e),n=(r,i,s,o)=>{const c=s?{...s,direction:"backward"}:{direction:"backward"};return t(r,i,c,_e(n,o))};return n},ci=e=>{const t=Ve(e),n=(r,i,s,o)=>t(r,i,s,_e(n,o));return n},ai=e=>{const t=We(e),n=async(r,i,s,o)=>{const c=s?{...s,direction:"backward"}:{direction:"backward"};return await t(r,i,c,_e(n,o))};return n},ui=e=>{const t=We(e),n=async(r,i,s,o)=>await t(r,i,s,_e(n,o));return n},li=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return qe(e)(t,n,i)},fi=e=>(t,n,r)=>qe(e)(t,n,r),hi=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Ge(e)(t,n,i)},di=e=>async(t,n,r)=>Ge(e)(t,n,r),pi=/^[cC][0-9a-z]{6,}$/,mi=/^[0-9a-z]+$/,gi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,_i=/^[0-9a-vA-V]{20}$/,vi=/^[A-Za-z0-9]{27}$/,bi=/^[a-zA-Z0-9_-]{21}$/;function yi(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const wi=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,ki=/^([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})$/,jt=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)$/,zi=/^(?:[A-Za-z0-9_\'+\\-]+\\.)*[A-Za-z0-9_\'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,Si="^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$";function $i(){return new RegExp(Si,"u")}const Oi=/^(?:(?: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])$/,Ei=/^(([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}|:))$/,Ii=/^((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])$/,Ti=/^(([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}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ai=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zi=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Pi=/^https?$/,Ni=/^\\+[1-9]\\d{6,14}$/,Lt="(?:(?:\\\\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]\)DELIM" +R"DELIM(\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))";function Ri(e){return new RegExp(`^${e}$`)}const Mi=Ri(Lt);function He(e){const t="(?:[01]\\\\d|2[0-3]):[0-5]\\\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\\\d`:`${t}:[0-5]\\\\d\\\\.\\\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\\\d(?:\\\\.\\\\d+)?`:`${t}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`}function ji(e){return new RegExp(`^${He(e)}$`)}function Li(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)");const n=`${He({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${He({precision:e.precision})}`:n;return new RegExp(`^${Lt}T(?:${r})$`)}const Fi=/^[\\s\\S]{0,}$/,Ci=/^-?\\d+$/,Ye=/^-?\\d+(?:\\.\\d+)?$/,Di=/^(?:true|false)$/i,xi=/^[^A-Z]*$/,Ui=/^[^a-z]*$/,Z=f("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Xe=e=>{const t=e.value;return!kr(t)&&t.length!==void 0},ve={number:"number",bigint:"bigint",object:"date"},Ft=f("$ZodCheckLessThan",(e,t)=>{Z.init(e,t);const n=ve[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{Z.init(e,t);const n=ve[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:ve[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ki=f("$ZodCheckMultipleOf",(e,t)=>{Z.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):zr(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Bi=f("$ZodCheckNumberFormat",(e,t)=>{Z.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,s]=$t[t.format];e._zod.check=o=>{const c=o.value;if(n){if(!Number.isInteger(c)){o.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?o.issues.push({input:c,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}):o.issues.push({input:c,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});return}}cs&&o.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Ji=f("$ZodCheckMaxLength",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Xe),e._zod.check=r=>{const i=r.value,s=i.length;if((typeof i=="string"&&s>t.maximum?xe(i):s)<=t.maximum)return;const c=Ue(i);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Vi=f("$ZodCheckMinLength",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Xe),e._zod.check=r=>{const i=r.value,s=i.length;if((typeof i=="string"&&s>=t.minimum&&s=t.minimum)return;const c=Ue(i);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Wi=f("$ZodCheckLengthEquals",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Xe),e._zod.check=r=>{const i=r.value,s=i.length,o=typeof i=="string"&&s>=t.length&&s<=t.length*2?xe(i):s;if(o===t.length)return;const c=Ue(i),a=o>t.length;r.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),be=f("$ZodCheckStringFormat",(e,t)=>{var n,r;Z.init(e,t),t.pattern?(n=e._zod).check??(n.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),qi=f("$ZodCheckRegex",(e,t)=>{be.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})}}),Gi=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xi),be.init(e,t)}),Hi=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ui),be.init(e,t)}),Yi=f("$ZodCheckIncludes",(e,t)=>{Z.init(e,t);const n=me(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),Xi=f("$ZodCheckStartsWith",(e,t)=>{Z.init(e,t);const n=new RegExp(`^${me(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Qi=f("$ZodCheckEndsWith",(e,t)=>{Z.init(e,t);const n=new RegExp(`.*${me(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),es=f("$ZodCheckOverwrite",(e,t)=>{Z.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class ts{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`\n`).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${n.join(`\n`)}\n};`)(...Object.values(this.closed))}}const ns={major:4,minor:6,patch:7},k=f("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ns;const r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(const s of i)for(const o of s._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(c,a,u)=>{if(c.memo)return c;let l=F(c),h;for(const p of a){if(p._zod.def.when){if(Lr(c)||!p._zod.def.when(c))continue}else if(l)continue;const d=c.issues.length,m=p._zod.check(c);if(m instanceof Promise&&u?.async===!1)throw new H;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await m,c.issues.length!==d&&(De(c.issues,d,e),l||(l=F(c,d)))});else{if(c.issues.length===d)continue;De(c.issues,d,e),l||(l=F(c,d))}}return h?h.then(()=>c):c},o=(c,a,u)=>{if(F(c))return c.aborted=!0,c;const l=s(a,i,u);if(l instanceof Promise){if(u.async===!1)throw new H;return l.then(h=>e._zod.parse(h,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){const l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(h=>o(h,c,a)):o(l,c,a)}const u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new H;return u.then(l=>s(l,i,a))}return s(u,i,a)}}},{get"~standard"(){return Tt(this,"~standard",xt(this))},set"~standard"(e){V(this,"~standard",e)}}),Dt=(e,t)=>e.issues.length?{issues:e.issues.map(n=>J(n,t,C()))}:{value:e.value};async function rs(e,t){co)DELIM" +R"DELIM(nst n={async:!0};return Dt(await e._zod.run({value:t,issues:[]},n),n)}function xt(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Dt(r,n)}catch{}return rs(e,t)},vendor:"zod",version:1}}const Qe=f("$ZodString",(e,t)=>{k.init(e,t),e._zod.pattern=t.pattern??Fi,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),z=f("$ZodStringFormat",(e,t)=>{be.init(e,t),Qe.init(e,t)}),is=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ki),z.init(e,t)}),ss=f("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=jt(r))}else t.pattern??(t.pattern=jt());z.init(e,t)}),os=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zi),z.init(e,t)}),Ut=1,ye=2;function Kt(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function cs(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Kt(e)||ye:as(e,t)}function as(e,t){if(!t.normalize&&t.protocol?.source===Pi.source&&!/^https?:\\/\\//i.test(e))return Ut;try{if(typeof URL<"u"){const n=URL;if(typeof n.parse=="function")return n.parse(e)??ye}return new URL(e)}catch{return ye}}const us=/[\\t\\n\\r]/g;function Bt(e){return e.replace(us,"")}function ls(e,t){return t.lastIndex=0,t.test(e.hostname)}function fs(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const hs=f("$ZodURL",(e,t)=>{z.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=cs(r,t);if(i===Ut){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(i===ye){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Bt(r);return}t.hostname&&!ls(i,t.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&&!fs(i,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Bt(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ds=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=$i()),z.init(e,t)}),ps=f("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?bi:yi(t.length)),z.init(e,t)}),ms=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=pi),z.init(e,t)}),gs=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=mi),z.init(e,t)}),_s=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=gi),z.init(e,t)}),vs=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=_i),z.init(e,t)}),bs=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=vi),z.init(e,t)}),ys=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Li(t)),z.init(e,t)}),ws=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Mi),z.init(e,t)}),ks=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ji(t)),z.init(e,t)}),zs=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=wi),z.init(e,t)}),Ss=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Oi),z.init(e,t)}),$s=/^[0-9a-fA-F:.]+$/;function Jt(e){return $s.test(e)?Kt(`http://[${e}]`):!1}const Os=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ei),z.init(e,t),e._zod.check=n=>{Jt(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Es=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ii),z.init(e,t)});function Is(e){const t=e.split("/");if(t.length!==2)return!1;const[n,r]=t;if(!r)return!1;const i=Number(r);return`${i}`!==r||i<0||i>128?!1:Jt(n)}const Ts=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ti),z.init(e,t),e._zod.check=n=>{Is(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Vt(e){if(e==="")return!0;if(/\\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Wt=/^[0-9a-zA-Z+/]*={0,2}$/,As=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Wt),z.init(e,t),e._zod.check=n=>{Vt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),et=/^[A-Za-z0-9_-]*$/;function Zs(e){if(!et.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Vt(n)}const Ps=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=et),z.init(e,t),e._zod.check=n=>{Zs(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Ns=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ni),z.init(e,t)});function Rs(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const Ms=f("$ZodJWT",(e,t)=>{z.init(e,t),e._zod.check=n=>{Rs(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),qt=f("$ZodNumber",(e,t)=>{k.init(e,t),e._zod.pattern=Ye,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...s?{received:s}:{}}),n}}),js=f("$ZodNumberFormat",(e,t)=>{Bi.init(e,t),qt.init(e,t)}),Ls=f("$ZodBoolean",(e,t)=>{k.init(e,t),e._zod.pattern=Di,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),Fs=f("$ZodUnknown",(e,t)=>{k.init(e,t),e._zod.parse=n=>n}),Cs=f("$ZodNever",(e,t)=>{k.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ds(e,t){const n=It(e._zod.def.checks);if(!n.length)return;const r=Math.min(...n.map(s=>s[0])),i=e._zod.parse;e._zod.parse=(s,o)=>{const c=t(s.value);if(c>r&&!o?.skipChecks&&o?.direction!=="backward"){for(const[a,u]of It(e._zod.def.checks))if(c>a&&u._zod.def.when(s)){const l=s.issues.length;return u._zod.check(s),s.issues[l].continue=!1,De(s.issues,l,e),s}}return i(s,o)}}const xs=e=>Array.isArray(e)?e.length:-1;function Gt(e,t,n){e.issues.length&&t.issues.push(...B(n,e.issues)),t.value[n]=e.value}const Us=f("$ZodArray",(e,t)=>{k.init(e,t);const n=R.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=n?n.alloc(e,r,Array(s.length),i):Array(s.length);const o=[],c=i?.abortEarly;for(let a=0;aGt(h,r,a)));else if(Gt(l,r,a),c&&l.issues.length!==0&&F(l))break}return o.length?Promise.all(o).then(()=>r):r},Ds(e,xs)});function we(e,t,n,r,i,s){const o=n in r,c=s==="optional";if(!(!o&&c&&i==="optional")){if(e.issues.length){if(i!==void 0&&c&&!o)return;t.issues.push(...B(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(o||i==="defaulted"&&!c)&&(t.value[n]=void 0):t.value[n]=e.value}}const Ks=[];function Ht(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Ks,i=r.length?[...t,...r]:t;for(const o of i)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(o)}": expected a Zod schema`);const s=Tr(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Yt(e)DELIM" +R"DELIM(,t,n,r,i,s,o){const c=[],a=i.keySet,u=i.catchall._zod,l=u.def.type,h=u.optin,p=u.optout;let d=0;for(const m in t){if(o&&n.issues.length!==d){if(F(n,d))break;d=n.issues.length}if(a.has(m))continue;if(m==="__proto__"){l==="never"&&c.push(m);continue}if(l==="never"){c.push(m);continue}const g=u.run({value:t[m],issues:[]},r);g instanceof Promise?e.push(g.then(v=>we(v,n,m,t,h,p))):we(g,n,m,t,h,p)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const Bs=f("$ZodObject",(e,t)=>{k.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){const u=()=>{const l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}const i=Fe(()=>Ht(t));y(e,"propValues",u=>{const l=u.def.shape,h={};for(const p in l){const d=l[p]._zod;if(d.values){Object.prototype.hasOwnProperty.call(h,p)||U(h,p,new Set);for(const m of d.values)h[p].add(m);d.optin!==void 0&&h[p].add(void 0)}}return h});const s=pe,o=t.catchall;let c;const a=R.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=i.value);const h=u.value;if(!s(h))return u.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};const p=[],d=c.shape,m=l?.abortEarly;let g=u.issues.length;for(const v of c.allKeys){if(m&&u.issues.length!==g){if(F(u,g))break;g=u.issues.length}if(v==="__proto__")continue;const b=d[v],P=b._zod.optin,he=b._zod.optout,de=b._zod.run({value:h[v],issues:[]},l);de instanceof Promise?p.push(de.then(I=>we(I,u,v,h,P,he))):we(de,u,v,h,P,he)}return o?Yt(p,h,u,l,i.value,e,m===!0):p.length?Promise.all(p).then(()=>u):u}}),Js=f("$ZodObjectJIT",(e,t)=>{Bs.init(e,t);const n=e._zod.parse,r=Fe(()=>Ht(t)),i=R.memoizer,s=d=>{const m=r.value,g=m.symbolKeys,v=new ts(["payload","ctx"],{shape:d,inst:e,memo:i,syms:g}),b=I=>`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`,P=(I,w)=>`\n let ${I}_ab = false;\n for (let i = 0; i < ${I}.issues.length; i++) {\n const iss = ${I}.issues[i];\n iss.path = iss.path ? [${w}, ...iss.path] : [${w}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${I}_ab = true;\n }\n if (${I}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;v.write("const input = payload.value;");const he=Object.create(null);let de=0;for(const I of m.allKeys)he[I]=`key_${de++}`;v.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const I of m.allKeys){if(I==="__proto__")continue;const w=he[I],D=typeof I=="symbol"?`syms[${g.indexOf(I)}]`:$r(I),gt=`${D} in input`,br=d[I],_t=br?._zod?.optin,yr=_t!==void 0,Hu=br?._zod?.optout==="optional";if(v.write(`const ${w} = ${b(D)};`),yr&&Hu){const Yu=_t==="optional"?`${w}_present`:`${w}.value !== undefined || ${w}_present`;v.write(`\n const ${w}_present = ${gt};\n if (!${w}.issues.length || ${w}_present) {\n if (${w}.issues.length) {${P(w,D)}\n }\n\n if (${Yu}) {\n newResult[${D}] = ${w}.value;\n }\n }\n\n `)}else yr?(v.write(`\n if (${w}.issues.length) {${P(w,D)}\n }\n `),_t==="defaulted"?v.write(`newResult[${D}] = ${w}.value;`):v.write(`\n if (${w}.value !== undefined || ${gt}) {\n newResult[${D}] = ${w}.value;\n }\n `)):v.write(`\n const ${w}_present = ${gt};\n if (${w}.issues.length) {${P(w,D)}\n }\n if (!${w}_present && !${w}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${D}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${w}_present) {\n newResult[${D}] = ${w}.value;\n }\n\n `)}return v.write("payload.value = newResult;"),v.write("return payload;"),v.compile()};let o;const c=pe,a=!R.jitless,l=a&&Er.value,h=t.catchall;let p;e._zod.parse=(d,m)=>{p??(p=r.value);const g=d.value;return c(g)?a&&l&&m?.async===!1&&m.jitless!==!0?(o||(o=s(t.shape)),d=o(d,m),h?Yt([],g,d,m,p,e,m?.abortEarly===!0):d):n(d,m):(d.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),d)}});function Xt(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const i=e.filter(s=>!F(s));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(o=>J(o,r,C())))}),t)}const Vs=f("$ZodUnion",(e,t)=>{k.init(e,t),y(e,"optin",r=>r.def.options.some(i=>i._zod.optin==="defaulted")?"defaulted":r.def.options.some(i=>i._zod.optin!==void 0)?"optional":void 0),y(e,"optout",r=>r.def.options.some(i=>i._zod.optout==="optional")?"optional":void 0),y(e,"values",r=>{if(r.def.options.every(i=>i._zod.values))return new Set(r.def.options.flatMap(i=>Array.from(i._zod.values)))}),y(e,"pattern",r=>{if(r.def.options.every(i=>i._zod.pattern)){const i=r.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>Ce(s.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let s=!1;const o=[];for(const c of t.options){const a=c._zod.run({value:r.value,issues:[]},i);if(a instanceof Promise)o.push(a),s=!0;else{if(a.issues.length===0)return a;o.push(a)}}return s?Promise.all(o).then(c=>Xt(c,r,e,i)):Xt(o,r,e,i)}}),Ws=f("$ZodIntersection",(e,t)=>{k.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,s=t.left._zod.run({value:i,issues:[]},r),o=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([a,u])=>Qt(n,a,u)):Qt(n,s,o)}});function tt(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(X(e)&&X(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(const s of r){if(s==="__proto__")continue;const o=tt(e[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.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{let h;if(u.code==="unrecognized_keys"&&!u.path?.length)i??(i=u),h=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){const p=String(u.path[0]);s.has(p)||s.set(p,u),h=[p]}else return!1;for(const p of h)r.has(p)||r.set(p,{}),r.get(p)[l]=!0;return!0};for(const u of t.issues)o(u,"l")||e.issues.push(u);for(const u of n.issues)o(u,"r")||e.issues.push(u);const c=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){const u=i?c.filter(l=>i.keys.includes(l)):[];u.length&&e.issues.push({...i,keys:u});for(const l of c)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}const a=tt(t.value,n.value);if(!a.valid){if(F(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}const qs=f("$ZodTuple",(e,t)=>{k.init(e,t);const n=t.items,r=R.memoizer;r?.attach(e),e._zod.parse=(i,s)=>{const o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=r?r.alloc(e,i,[],s):[];const c=[],a=en(n,"optin"),u=en(n,"optout");if(!t.rest){if(o.lengthn.length&&i.issues.push({code:"too_big",maximum:n.length,inclusive:!0)DELIM" +R"DELIM(,input:o,inst:e,origin:"array"})}const l=new Array(n.length),h=t.rest?s?.abortEarly:void 0;let p=!1;for(let d=0;d{l[d]=g})):(l[d]=m,h&&!p&&m.issues.length&&(p=F(m)))}if(t.rest&&!p){let d=n.length-1;const m=o.slice(n.length);let g=i.issues.length;for(const v of m){if(h&&i.issues.length!==g){if(F(i,g))break;g=i.issues.length}d++;const b=t.rest._zod.run({value:v,issues:[]},s);b instanceof Promise?c.push(b.then(P=>tn(P,i,d))):tn(b,i,d)}}return c.length?Promise.all(c).then(()=>nn(l,i,n,o,u)):nn(l,i,n,o,u)}});function en(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function tn(e,t,n){e.issues.length&&t.issues.push(...B(n,e.issues)),t.value[n]=e.value}function nn(e,t,n,r,i){for(let s=0;s=i&&n[s]._zod.optin==="optional"){t.value.length=s;break}if(o.issues.length){if(!c&&s>=i){t.value.length=s;break}t.issues.push(...B(s,o.issues))}t.value[s]=o.value}for(let s=t.value.length-1;s>=r.length&&(n[s]._zod.optout==="optional"&&t.value[s]===void 0);s--)t.value.length=s;return t}const Gs=f("$ZodRecord",(e,t)=>{k.init(e,t);const n=R.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const s=r.value;if(!X(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const o=[],c=t.keyType._zod.values;if(c&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};const a=new Set;for(const l of c)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(a.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;const h=t.keyType._zod.run({value:l,issues:[]},i);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(h.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(m=>J(m,i,C())),input:l,path:[l],inst:e});continue}const p=h.value;if(p==="__proto__")continue;const d=t.valueType._zod.run({value:s[l],issues:[]},i);d instanceof Promise?o.push(d.then(m=>{m.issues.length&&r.issues.push(...B(l,m.issues)),r.value[p]=m.value})):(d.issues.length&&r.issues.push(...B(l,d.issues)),r.value[p]=d.value)}let u;for(const l in s)if(!a.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let a;for(const u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},i);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Ye.test(u)&&l.issues.length){const m=t.keyType._zod.run({value:Number(u),issues:[]},i);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){t.mode==="loose"?r.value[u]=s[u]:c?(a=a??[],a.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>J(m,i,C())),input:u,path:[u],inst:e});continue}const p=l.value;if(p==="__proto__")continue;const d=t.valueType._zod.run({value:s[u],issues:[]},i);d instanceof Promise?o.push(d.then(m=>{m.issues.length&&r.issues.push(...B(u,m.issues)),r.value[p]=m.value})):(d.issues.length&&r.issues.push(...B(u,d.issues)),r.value[p]=d.value)}a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Hs=f("$ZodEnum",(e,t)=>{k.init(e,t);const n=je(t.entries),r=new Set(n);e._zod.values=r,y(e,"pattern",i=>{const s=je(i.def.entries).filter(o=>Ir.has(typeof o));return new RegExp(s.length?`^(${s.map(o=>me(o.toString())).join("|")})$`:"^[^\\\\s\\\\S]$")}),e._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:e}),i}}),Ys=f("$ZodTransform",(e,t)=>{k.init(e,t),e._zod.optin="optional",R.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Nt(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(n.value=o,n));if(i instanceof Promise)throw new H;return n.value=i,n}});function rn(e,t){return e.value=t.issues.length?void 0:t.value,e}const sn=f("$ZodOptional",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",y(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),y(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ce(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;const i=t.innerType._zod.run({value:n.value,issues:[]},r);return i instanceof Promise?i.then(s=>rn(n,s)):rn(n,i)}return t.innerType._zod.run(n,r)}}),Xs=f("$ZodExactOptional",(e,t)=>{sn.init(e,t),y(e,"values",n=>n.def.innerType._zod.values),y(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Qs=f("$ZodNullable",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin),y(e,"optout",n=>n.def.innerType._zod.optout),y(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ce(r.source)}|null)$`):void 0}),y(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),eo=f("$ZodDefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>on(s,t)):on(i,t)}});function on(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const to=f("$ZodPrefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),no=f("$ZodNonOptional",(e,t)=>{k.init(e,t),y(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>cn(s,e)):cn(i,e)}});function cn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function an(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(i=>J(i,r,C()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const ro=f("$ZodCatch",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),y(e,"optout",n=>n.def.innerType._zod.optout),y(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run({value:n.value,issues:[]},r);return i instanceof Promise?i.then(s=>an(n,s,t,r)):an(n,i,t,r)}}),io=f("$ZodPipe",(e,t)=>{k.init(e,t),y(e,"values",n=>n.def.in._zod.values),y(e,"optin",n=>n.def.in._zod.optin),y(e,"optout",n=>n.def.out._zod.optout),y(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(o=>ke(o,t.in,r)):ke(s,t.in,r)}const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>ke(s,t.out,r)):ke(i,t.out,r)}});function ke(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const so=f("$ZodReadonly",(e,t)=>{k.init(e,t),y(e,"propValues",n=>n.def.innerType._zod.propValues),y(e,"values",n=>n.def.innerType._zod.values),y(e,"optin",n=>n.def.innerType?._zod?.optin),y(e,"optout",n=>n.def.innerType?._zod?.)DELIM" +R"DELIM(optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(un):un(i)}});function un(e){return e.memo||(e.value=Object.freeze(e.value)),e}const oo=f("$ZodCustom",(e,t)=>{Z.init(e,t),k.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(s=>ln(s,n,r,e));ln(i,n,r,e)}});function ln(e,t,n,r){if(!e){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(se(i))}}class co extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const nt="~memo",fn=[];function hn(e){return e!==null&&typeof e=="object"}function rt(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const dn=new WeakMap,oe=0,ze=1,ce=2;function Se(e,t,n){const r=dn.get(e);if(r!==void 0)return r?ce:oe;if(t.has(e))return ce;t.add(e);let i=oe;const s=l=>{if(i!==ce&&l?._zod){const h=Se(l,t);h>i&&(i=h)}},o=(l,h)=>{let p=oe;for(const d of Reflect.ownKeys(l)){const m=Object.getOwnPropertyDescriptor(l,d);if(!m.enumerable)continue;const g=m.get?ze:m.value?._zod?Se(m.value,t):oe;g>p&&(p=g)}return p},c=l=>{l>i&&(i=l)},a=e._zod.def;switch(a.type){case"object":{const l=bt(a);c(l?o(l):ze),s(a.catchall);break}case"array":s(a.element);break;case"tuple":for(const l of a.items)s(l);s(a.rest);break;case"record":case"map":s(a.keyType),s(a.valueType);break;case"set":s(a.valueType);break;case"union":for(const l of a.options)s(l);break;case"intersection":s(a.left),s(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(a.innerType);break;case"pipe":s(a.in),s(a.out);break;case"function":s(a.input),s(a.output);break;case"lazy":{const l=a._cachedInner??void 0;c(l?Se(l,t):ze);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const l in a){const h=Object.getOwnPropertyDescriptor(a,l);if(!h||h.get)continue;const p=h.value;if(!(!p||typeof p!="object")){if(p._zod)s(p);else if(Array.isArray(p))for(const d of p)s(d)}}}return t.delete(e),ao(e,i)}function ao(e,t){return t!==ze&&dn.set(e,t===ce),t}function uo(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}let $e;const Oe=[],lo={alloc(e,t,n){const r=$e;if(!r)return n;$e=void 0;const i={value:n,issues:null};return r.set(t.value,i),Oe.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const n=e._zod.parse,r=(i,s)=>{if(s.direction!=="backward"&&ho(s,i.value))throw new co;return n(i,s)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,i,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const o=e._zod.parse,c=(a,u)=>{if(n===void 0){const b=Se(e,new Set);if(b===oe)return e._zod.parse=o,e._zod.run===c&&(e._zod.run=o),o(a,u);b===ce||r?n=!0:r=!0}const l=a.value;if(!hn(l))return o(a,u);let h=u[nt];h||(h={buckets:new WeakMap,backEdges:void 0},u[nt]=h);let p;i===u?p=s:(p=uo(h,e),i=u,s=p);const d=p.get(l);if(d)return a.value=d.value,d.issues?d.issues.length&&a.issues.push(...rt(d.issues)):(a.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(d.value)),a;$e=p;const m=Oe.length,g=o(a,u);$e=void 0;const v=Oe.length>m?Oe.pop():void 0;return g instanceof Promise?g.then(b=>(v&&(v.issues=b.issues.length?rt(b.issues):fn),b)):(v&&(v.issues=g.issues.length?rt(g.issues):fn),g)};e._zod.parse=c,e._zod.run===o&&(e._zod.run=c)})}};function fo(){return lo}function ho(e,t){const n=e[nt]?.backEdges;return n!==void 0&&hn(t)&&n.has(t)}const po=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function i(s,o){return s==="number"&&typeof o=="number"&&!Number.isFinite(o)?String(o):r[s]??s}return s=>{switch(s.code){case"invalid_type":{const o=i(s.expected),c=Cr(s.input),a=i(c,s.input);return`Invalid input: expected ${o}, received ${a}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${St(s.values[0])}`:`Invalid option: expected one of ${vt(s.values,"|")}`;case"too_big":{const o=s.exact?"exactly ":s.inclusive?"<=":"<",c=t(s.origin);return c?`Too big: expected ${s.origin??"value"} to have ${o}${s.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${o}${s.maximum.toString()}`}case"too_small":{const o=s.exact?"exactly ":s.inclusive?">=":">",c=t(s.origin);return c?`Too small: expected ${s.origin} to have ${o}${s.minimum.toString()} ${c.unit}`:`Too small: expected ${s.origin} to be ${o}${s.minimum.toString()}`}case"invalid_format":{const o=s;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${n[o.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${vt(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(c=>`\'${c}\'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function mo(){return{localeError:po()}}var pn;class go{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function _o(){return new go}(pn=globalThis).__zod_globalRegistry??(pn.__zod_globalRegistry=_o());const ae=globalThis.__zod_globalRegistry;function mn(e){return e.checks&&(e.checks=[...e.checks]),e}function vo(e,t){return new e(mn({type:"string",..._(t)}))}function bo(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function yo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function wo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function ko(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function zo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function So(e,t){)DELIM" +R"DELIM(return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function $o(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function Oo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function Eo(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function Io(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function To(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Ao(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Zo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function Po(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function No(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Ro(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Mo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function jo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Lo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Fo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Co(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Do(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function xo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Uo(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function Ko(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function Bo(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function Jo(e,t){return new e(mn({type:"number",checks:[],..._(t)}))}function Vo(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Wo(e,t){return new e({type:"boolean",..._(t)})}function qo(e){return new e({type:"unknown"})}function Go(e,t){return new e({type:"never",..._(t)})}function gn(e,t){return new Ft({check:"less_than",..._(t),value:e,inclusive:!1})}function it(e,t){return new Ft({check:"less_than",..._(t),value:e,inclusive:!0})}function _n(e,t){return new Ct({check:"greater_than",..._(t),value:e,inclusive:!1})}function st(e,t){return new Ct({check:"greater_than",..._(t),value:e,inclusive:!0})}function vn(e,t){return new Ki({check:"multiple_of",..._(t),value:e})}function bn(e,t){return new Ji({check:"max_length",..._(t),maximum:e})}function Ee(e,t){return new Vi({check:"min_length",..._(t),minimum:e})}function yn(e,t){return new Wi({check:"length_equals",..._(t),length:e})}function Ho(e,t){return new qi({check:"string_format",format:"regex",..._(t),pattern:e})}function Yo(e){return new Gi({check:"string_format",format:"lowercase",..._(e)})}function Xo(e){return new Hi({check:"string_format",format:"uppercase",..._(e)})}function Qo(e,t){return new Yi({check:"string_format",format:"includes",..._(t),includes:e})}function ec(e,t){return new Xi({check:"string_format",format:"starts_with",..._(t),prefix:e})}function tc(e,t){return new Qi({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Q(e){return new es({check:"overwrite",tx:e})}function nc(e){return Q(t=>t.normalize(e))}function rc(){return Q(e=>e.trim())}function ic(){return Q(e=>e.toLowerCase())}function sc(){return Q(e=>e.toUpperCase())}function oc(){return Q(e=>Or(e))}function cc(e,t,n){return new e({type:"array",element:t,..._(n)})}function ac(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function uc(e,t){const n=lc(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(se(i,r.value,n._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(se(s))}},e(r.value,r)),t);return n}function lc(e,t){const n=new Z({check:"custom",..._(t)});return n._zod.check=e,n}function ue(e,...t){for(const n of t)for(const r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&U(e,r,n[r]);return e}function wn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ae,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function ee(e,t,n,r,i){const s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(i);return Object.assign(n,s),!0}function O(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const c=e._zod.toJSONSchema?.();if(c)o.schema=c;else{const l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,l);else{const p=o.schema,d=t.processors[i.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);d(e,t,p,l)}const h=e._zod.parent;h&&(o.ref||(o.ref=h),O(h,t,l),t.seen.get(h).isParent=!0)}const a=t.metadataRegistry.get(e);return a&&ue(o.schema,a),t.io==="input"&&A(e)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function kn(e){return e.replace(/~/g,"~0").replace(/\\//g,"~1")}function zn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const o of e.seen.entries()){const c=e.metadataRegistry.get(o[0])?.id;if(c){const a=r.get(c);if(a&&a!==o[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,o[0])}}const i=o=>{const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(o[0])?.id,p=e.external.uri??(m=>m);if(h)return{ref:p(h)};const d=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=d,{defId:d,ref:`${p("__shared")}#/${c}/${kn(d)}`}}const a="#",u=`${a}/${c}/`;if(o[1]===n&&!o[1].schema.id)return{ref:a};const l=o[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+kn(l)}},s=o=>{if(o[1].schema.$ref)return;const c=o[1],{ref:a,defId:u}=i(o);c.def={...c.schema},u&&(c.defId=u);const l=c.schema;for(const h in l)delete l[h];l.$ref=a};if(e.cycles==="throw")for(const o of e.seen.entries()){const c=o[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/\n\nSet the \\`cycles\\` parameter to \\`"ref"\\` to resolve cyclical schemas with defs.`)}for(const o of e.seen.entries()){const c=o[1];if(t===o[0]){s(o);continue}if(e.external){const u=e.external.registry.get(o[0])?.id;if(t!==o[0]&&u){s(o);continue}}if(e.metadataRegistry.get(o[0])?.id){s(o);continue}if(c.cycle){s(o);continue}c.count>1&&e.reused==="ref"&&s(o)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Sn(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(c)DELIM" +R"DELIM(onst r of t){if(!r||typeof r!="object")return;Sn(r);const i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;const s=r.type;for(const o of Array.isArray(s)?s:[s]){if(typeof o!="string")return;n.includes(o)||n.push(o)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const $n=new Set(["type","properties","required","additionalProperties"]),On=["oneOf","anyOf"];function En(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function ot(e){const t=[];for(const s of e){if(typeof s!="object"||s.type!=="object")return null;for(const o in s)if(!$n.has(o))return null;t.push(s)}const n={},r=new Set;for(const s of t){for(const o in s.properties){if(Object.prototype.hasOwnProperty.call(n,o))continue;const c=[];for(const u of t){const l=u.properties?.[o]??En(u);l!=null&&(c.some(h=>JSON.stringify(h)===JSON.stringify(l))||c.push(l))}const a=c.length===1?c[0]:ot(c)??{allOf:c};U(n,o,a)}for(const o of s.required??[])r.add(o)}const i={type:"object",properties:n};if(r.size&&(i.required=[...r]),t.every(s=>s.additionalProperties===!1))i.additionalProperties=!1;else{const s=[];for(const o of t){const c=En(o);c&&!s.some(a=>JSON.stringify(a)===JSON.stringify(c))&&s.push(c)}s.length===1?i.additionalProperties=s[0]:s.length>1&&(i.additionalProperties={allOf:s})}return i}function fc(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const i of $n)if(i in e)return;const n=t.filter(i=>On.some(s=>Array.isArray(i[s])));let r=null;if(!n.length)r=ot(t);else{const i=n[0],s=On.find(a=>Array.isArray(i[a]));if(Object.keys(i).length!==1)return;const o=t.filter(a=>a!==i),c=i[s].map(a=>ot([...o,a]));if(c.some(a=>!a))return;r={[s]:c}}r&&(delete e.allOf,ue(e,r))}function In(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const a=e.seen.get(c);if(a.ref===null)return;const u=a.def??a.schema,l={...u},h=a.ref;if(a.ref=null,h){r(h);const d=e.seen.get(h),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):ue(u,m),ue(u,l),c._zod.parent===h)for(const v in u)v==="$ref"||v==="allOf"||v in l||delete u[v];if(m.$ref&&d.def)for(const v in u)v==="$ref"||v==="allOf"||v in d.def&&JSON.stringify(u[v])===JSON.stringify(d.def[v])&&delete u[v]}const p=c._zod.parent;if(p&&p!==h){r(p);const d=e.seen.get(p);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(const m in u)m==="$ref"||m==="allOf"||m in d.def&&JSON.stringify(u[m])===JSON.stringify(d.def[m])&&delete u[m]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const c of[...e.seen.entries()].reverse())r(c[0]);if(e.target!=="openapi-3.0")for(const c of e.seen.entries())Sn(c[1].def??c[1].schema);for(const c of e.deferred)c();if(e.intersections.length){const c=new Map;for(const a of e.seen.values())for(const u of[a.schema,a.def]){const l=u?.allOf;if(!Array.isArray(l))continue;const h=c.get(l);h?h.push(u):c.set(l,[u])}for(const a of e.intersections)for(const u of c.get(a)??[])fc(u)}}const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(c)}ue(i,n.defId?n.schema:n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&i.id===s&&delete i.id;const o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const c of e.seen.entries()){const a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,U(o,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{const c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ie(t,"input",e.processors),output:Ie(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function A(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(r.type==="transform")return!0;if(r.type==="array")return A(r.element,n);if(r.type==="set")return A(r.valueType,n);if(r.type==="lazy")return A(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return A(r.innerType,n);if(r.type==="intersection")return A(r.left,n)||A(r.right,n);if(r.type==="record"||r.type==="map")return A(r.keyType,n)||A(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:A(r.in,n)||A(r.out,n);if(r.type==="object"){for(const i in r.shape)if(A(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(A(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(A(i,n))return!0;return!!(r.rest&&A(r.rest,n))}return!1}const hc=(e,t={})=>n=>{const r=wn({...n,processors:t});return O(e,r),zn(r,e),In(r,e)},Ie=(e,t,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=wn({...i??{},target:s,io:t,processors:n});return O(e,o),zn(o,e),In(o,e)},te=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},ne=(e,t,n)=>{(e[t]===void 0||n{te(e,"minimum",t),ne(e,"maximum",t)},An=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Zn=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Pn=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},Nn=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Rn=(e,t)=>te(e,"minimum",t.minimum),Mn=(e,t)=>ne(e,"maximum",t.maximum),jn=e=>(t,n)=>{Nn(t,n.format);const[r,i]=e[n.format];te(t,"minimum",r),ne(t,"maximum",i)},dc={greater_than:(e,t)=>te(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ne(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>An(e,t.value),number_format:jn($t),bigint_format:jn(Ar),min_length:Rn,max_length:Mn,length_equals:(e,t)=>Tn(e,t.length),min_size:Rn,max_size:Mn,size_equals:(e,t)=>Tn(e,t.size),string_format:(e,t)=>{Nn(e,t.format),t.pattern&&Zn(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Pn(e,t.mime)};function M(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const s of r)dc[s._zod.def.check]?.(t,s._zod.def);const i=e._zod.bag;i.minimum!==void 0&&te(t,"minimum",i.minimum),i.exclusiveMinimum!==void 0&&te(t,"exclusiveMinimum",i.exclusiveMinimum),i.maximum!==void 0&&ne(t,"maximum",i.maximum),i.exclusiveMaximum!==void 0&&ne(t,"exclusiveMaximum",i.exclusiveMaximum),i.multipleOf!==void 0&&An(t,i.multipleOf),i.format!==void 0&&(t.format??(t.format=i.format),i.format.includes("int")&&(t.isInt=!0)),i.mime&&Pn(t,i.mime);for(const s of i.patterns??[])Zn(t,s);return t}const pc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mc=new Map([[Wt,Ai],[et,Zi]]),Ln=e=>mc.get(e)??e,gc=(e,t,n,r)=>{const i=n;i.type="string";const{minimum:s,maximum:o,format:c,patterns:a,contentEncoding:u,laxFormat:l}=M(e);if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),c&&(i.format=pc[c]??c,i.format===""&&delete i.format,(c==="time"||l)&&delete i.format),u&&(i.contentEncoding=u),a&&a.size>0){const h=[...a].map(Ln);h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},_c=(e,t,n,r)=>{const i=n,{minimum:s,maximum:o,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:l}=M(e);i.type=l?"integer":"number";const h=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY))DELIM" +R"DELIM(,p=typeof a=="number"&&a<=(o??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(h?d?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof s=="number"&&(i.minimum=s),p?d?(i.maximum=a,i.exclusiveMaximum=!0):i.exclusiveMaximum=a:typeof o=="number"&&(i.maximum=o),c){const m=new Set;for(const b of c)Number.isFinite(b)&&b!==0?m.add(Math.abs(b)):ee(e,t,i,r,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);const[g,...v]=m;g!==void 0&&(i.multipleOf=g),v.length&&(i.allOf=[...i.allOf??[],...v.map(b=>({multipleOf:b}))])}},vc=(e,t,n,r)=>{n.type="boolean"},bc=(e,t,n,r)=>{n.not={}},yc=(e,t,n,r)=>{},wc=(e,t,n,r)=>{const i=e._zod.def,s=je(i.entries);if(s.length===0){n.not={};return}s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},kc=(e,t,n,r)=>{ee(e,t,n,r,"Custom types cannot be represented in JSON Schema")},zc=(e,t,n,r)=>{ee(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Sc=(e,t,n,r)=>{const i=n,s=e._zod.def,{minimum:o,maximum:c}=M(e);typeof o=="number"&&(i.minItems=o),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=O(s.element,t,{...r,path:[...r.path,"items"]})};function le(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?le(t.out):t.type==="catch"?le(t.innerType):e._zod.optin}const $c=(e,t,n,r)=>{const i=n,s=e._zod.def,o=s.shape;if(Object.getOwnPropertySymbols(o).length&&ee(e,t,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(const u in o)U(i.properties,u,O(o[u],t,{...r,path:[...r.path,"properties",u]}));const a=[];for(const u of Object.keys(o)){const l=s.shape[u];(t.io==="input"?le(l)===void 0:l._zod.optout===void 0)&&a.push(u)}a.length>0&&(i.required=a),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=O(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Oc=(e,t,n,r)=>{const i=e._zod.def,s=i.inclusive===!1,o=i.options.map((c,a)=>O(c,t,{...r,path:[...r.path,s?"oneOf":"anyOf",a]}));s?n.oneOf=o:n.anyOf=o},Ec=(e,t,n,r)=>{const i=e._zod.def,s=O(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=O(i.right,t,{...r,path:[...r.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(s)?s.allOf:[s],...c(o)?o.allOf:[o]];n.allOf=a,t.intersections.push(a)},Ic=(e,t,n,r)=>{const i=n,s=e._zod.def;i.type="array";const o=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=s.items.map((g,v)=>O(g,t,{...r,path:[...r.path,o,v]})),u=s.rest?O(s.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;let l=s.items.length;for(;l>0;){const g=s.items[l-1];if(!(t.io==="input"?le(g)!==void 0:g._zod.optout==="optional"))break;l--}const h=s.items.length,p=!s.rest;t.target==="draft-2020-12"?(i.prefixItems=a,p?i.items=!1:u&&(i.items=u),l>0&&(i.minItems=l),p&&(i.maxItems=h)):t.target==="openapi-3.0"?(i.items={anyOf:a},u&&i.items.anyOf.push(u),l>0&&(i.minItems=l),p&&(i.maxItems=h)):(i.items=a,p?i.additionalItems=!1:u&&(i.additionalItems=u),l>0&&(i.minItems=l),p&&(i.maxItems=h));const{minimum:d,maximum:m}=M(e);typeof d=="number"&&(i.minItems=d),typeof m=="number"&&(i.maxItems=m)};function ct(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);const m=e.get(t)?.def;if(!m)return t;const g=ct(e,m,n);return g===m?t:g}for(const m of["anyOf","oneOf"]){const g=t[m];if(!Array.isArray(g))continue;const v=g.map(b=>ct(e,b,n));v.some((b,P)=>b!==g[P])&&(t={...t,[m]:v})}const r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes("string")&&r.some(m=>m==="number"||m==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!i&&!s?.some(m=>typeof m=="number"))return t;const{minimum:o,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:h,id:p,...d}=t;return d.enum?d.enum=d.enum.map(m=>typeof m=="number"?String(m):m):typeof d.const=="number"&&(d.const=String(d.const)),i&&(d.type="string",s||(d.pattern=(r.includes("number")?Ye:Ci).source)),d}const at=new WeakMap;function Tc(e){const t=new Map;for(const r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);const n=new Map;for(const r of at.get(e)??[]){const i=e.seen.get(r),s=(i?.def??i?.schema)?.propertyNames;if(!s||s===!0||n.has(s))continue;const o=ct(t,s,new Set);o!==s&&n.set(s,o)}if(n.size)for(const r of e.seen.values())for(const i of[r.schema,r.def]){const s=i&&n.get(i.propertyNames);s&&(i.propertyNames=s)}}const Ac=(e,t,n,r)=>{const i=n,s=e._zod.def;i.type="object";const o=s.keyType,c=M(o).patterns;if(s.mode==="loose"&&c&&c.size>0){const l=O(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const h of c)U(i.patternProperties,Ln(h).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){i.propertyNames=O(s.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=at.get(t);l||(l=[],at.set(t,l),t.deferred.push(()=>Tc(t))),l.push(e)}i.additionalProperties=O(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}const a=o._zod.values,u=t.io==="input"&&le(s.valueType)!==void 0;if(a&&!s.partial&&!u){const l=[...a].filter(h=>typeof h=="string"||typeof h=="number");l.length>0&&(i.required=l.map(String))}},Zc=(e,t,n,r)=>{const i=e._zod.def,s=O(i.innerType,t,r),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Pc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType},ut=Symbol();function Fn(e,t,n,r,i){let s=!1;const o=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(s=!0,null));return s?(ee(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),ut):JSON.parse(o)}const Nc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType;const o=Fn(i.defaultValue,e,t,n,r);o!==ut&&(n.default=o)},Rc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);if(s.ref=i.innerType,t.io!=="input")return;const o=Fn(i.defaultValue,e,t,n,r);o!==ut&&(n._prefault=o)},Mc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{ee(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=o},jc=(e,t,n,r)=>{const i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?s?i.out:i.in:i.out;O(o,t,r);const c=t.seen.get(e);c.ref=o},Lc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType,n.readOnly=!0},Cn=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType},Dn=new WeakSet([Object.prototype,Error.prototype]);function Te(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}const j=f("ZodError",(e,t)=>{Yr.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);Dn.has(n)||(Dn.add(n),Te(n,"format",r=>i=>ei(r,i)),Te(n,"flatten",r=>i=>Qr(r,i)),Te(n,"addIssue",r=>i=>{r.issues.push(i),r.message=JSON.stringify(r.issues,Le,2)}),Te(n,"addIssues",r=>i=>{r.issues.push(...i),r.message=JSON.stringify(r.issues,Le,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Fc=Ve(j),Cc=We(j),Dc=qe(j),xc=Ge(j),Uc=oi(j),Kc=ci(j),Bc=ai(j),Jc=ui(j),Vc=li(j),Wc=fi(j),qc=hi(j),Gc=di(j);function Hc(){R.localeError||C(mo())}function fe(){R.memoizer||C({memoizer:fo()})}const S=f("ZodType",(e,t)=>(Hc(),k.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(N(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return K(this,e,t)},brand(){return this},register(e,t)DELIM" +R"DELIM(){return e.add(this,t),this},refine(e,t){return this.check(Ga(e,t))},superRefine(e,t){return this.check(Ha(e,t))},overwrite(e){return this.check(Q(e))},optional(){return qn(this)},exactOptional(){return ja(this)},nullable(){return Hn(this)},nullish(){return qn(Hn(this))},nonoptional(e){return Ua(this,e)},array(){return Jn(this)},or(e){return Vn([this,e])},and(e){return Ta(this,e)},transform(e){return Xn(this,Ma(e))},default(e){return Ca(this,e)},prefault(e){return xa(this,e)},catch(e){return Ba(this,e)},pipe(e){return Xn(this,e)},readonly(){return Wa(this)},describe(e){const t=this.clone();return ae.add(t,{description:e}),t},meta(...e){if(e.length===0)return ae.get(this);const t=this.clone();return ae.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Tt(this,"~standard",{...xt(this),jsonSchema:{input:Ie(this,"input"),output:Ie(this,"output")}})},set"~standard"(e){V(this,"~standard",e)},parse:function e(t,n){return Fc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Cc(this,t,n,{callee:e})},safeParse(e,t){return Dc(this,e,t)},async safeParseAsync(e,t){return xc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){V(this,"spa",e)},validate(e,t){return ri(this,e,t)},validateAsync(e,t){return si(this,e,t)},encode:function e(t,n){return Uc(this,t,n,{callee:e})},decode:function e(t,n){return Kc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Bc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Jc(this,t,n,{callee:e})},safeEncode(e,t){return Vc(this,e,t)},safeDecode(e,t){return Wc(this,e,t)},async safeEncodeAsync(e,t){return qc(this,e,t)},async safeDecodeAsync(e,t){return Gc(this,e,t)},toJSONSchema(e){return hc(this,{})(e)},get description(){return ae.get(this)?.description},get _def(){return this._zod.def}}),xn=f("_ZodString",(e,t)=>{Qe.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>gc(e,n,r)},At({format:e=>M(e).format??null,minLength:e=>M(e).minimum??null,maxLength:e=>M(e).maximum??null},{regex(...e){return this.check(Ho(...e))},includes(...e){return this.check(Qo(...e))},startsWith(...e){return this.check(ec(...e))},endsWith(...e){return this.check(tc(...e))},min(...e){return this.check(Ee(...e))},max(...e){return this.check(bn(...e))},length(...e){return this.check(yn(...e))},nonempty(...e){return this.check(Ee(1,...e))},lowercase(e){return this.check(Yo(e))},uppercase(e){return this.check(Xo(e))},trim(){return this.check(rc())},normalize(...e){return this.check(nc(...e))},toLowerCase(){return this.check(ic())},toUpperCase(){return this.check(sc())},slugify(){return this.check(oc())}})),Yc=f("ZodString",(e,t)=>{Qe.init(e,t),xn.init(e,t)},{email(e){return this.check(bo(na,e))},url(e){return this.check($o(ia,e))},jwt(e){return this.check(Do(ba,e))},emoji(e){return this.check(Oo(sa,e))},guid(e){return this.check(yo(ra,e))},uuid(e){return this.check(wo(Ae,e))},uuidv4(e){return this.check(ko(Ae,e))},uuidv6(e){return this.check(zo(Ae,e))},uuidv7(e){return this.check(So(Ae,e))},nanoid(e){return this.check(Eo(oa,e))},cuid(e){return this.check(Io(ca,e))},cuid2(e){return this.check(To(aa,e))},ulid(e){return this.check(Ao(ua,e))},base64(e){return this.check(Lo(ga,e))},base64url(e){return this.check(Fo(_a,e))},xid(e){return this.check(Zo(la,e))},ksuid(e){return this.check(Po(fa,e))},ipv4(e){return this.check(No(ha,e))},ipv6(e){return this.check(Ro(da,e))},cidrv4(e){return this.check(Mo(pa,e))},cidrv6(e){return this.check(jo(ma,e))},e164(e){return this.check(Co(va,e))},datetime(e){return this.check(xo(Xc,e))},date(e){return this.check(Uo(Qc,e))},time(e){return this.check(Ko(ea,e))},duration(e){return this.check(Bo(ta,e))}});function Y(e){return vo(Yc,e)}const $=f("ZodStringFormat",(e,t)=>{z.init(e,t),xn.init(e,t)}),Xc=f("ZodISODateTime",(e,t)=>{ys.init(e,t),$.init(e,t)}),Qc=f("ZodISODate",(e,t)=>{ws.init(e,t),$.init(e,t)}),ea=f("ZodISOTime",(e,t)=>{ks.init(e,t),$.init(e,t)}),ta=f("ZodISODuration",(e,t)=>{zs.init(e,t),$.init(e,t)}),na=f("ZodEmail",(e,t)=>{os.init(e,t),$.init(e,t)}),ra=f("ZodGUID",(e,t)=>{is.init(e,t),$.init(e,t)}),Ae=f("ZodUUID",(e,t)=>{ss.init(e,t),$.init(e,t)}),ia=f("ZodURL",(e,t)=>{hs.init(e,t),$.init(e,t)}),sa=f("ZodEmoji",(e,t)=>{ds.init(e,t),$.init(e,t)}),oa=f("ZodNanoID",(e,t)=>{ps.init(e,t),$.init(e,t)}),ca=f("ZodCUID",(e,t)=>{ms.init(e,t),$.init(e,t)}),aa=f("ZodCUID2",(e,t)=>{gs.init(e,t),$.init(e,t)}),ua=f("ZodULID",(e,t)=>{_s.init(e,t),$.init(e,t)}),la=f("ZodXID",(e,t)=>{vs.init(e,t),$.init(e,t)}),fa=f("ZodKSUID",(e,t)=>{bs.init(e,t),$.init(e,t)}),ha=f("ZodIPv4",(e,t)=>{Ss.init(e,t),$.init(e,t)}),da=f("ZodIPv6",(e,t)=>{Os.init(e,t),$.init(e,t)}),pa=f("ZodCIDRv4",(e,t)=>{Es.init(e,t),$.init(e,t)}),ma=f("ZodCIDRv6",(e,t)=>{Ts.init(e,t),$.init(e,t)}),ga=f("ZodBase64",(e,t)=>{As.init(e,t),$.init(e,t)}),_a=f("ZodBase64URL",(e,t)=>{Ps.init(e,t),$.init(e,t)}),va=f("ZodE164",(e,t)=>{Ns.init(e,t),$.init(e,t)}),ba=f("ZodJWT",(e,t)=>{Ms.init(e,t),$.init(e,t)}),Un=f("ZodNumber",(e,t)=>{qt.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>_c(e,n,r,i),e.isFinite=!0},At({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=M(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=M(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=M(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>M(e).format??null},{gt(e,t){return this.check(_n(e,t))},gte(e,t){return this.check(st(e,t))},min(e,t){return this.check(st(e,t))},lt(e,t){return this.check(gn(e,t))},lte(e,t){return this.check(it(e,t))},max(e,t){return this.check(it(e,t))},int(e){return this.check(Kn(e))},safe(e){return this.check(Kn(e))},positive(e){return this.check(_n(0,e))},nonnegative(e){return this.check(st(0,e))},negative(e){return this.check(gn(0,e))},nonpositive(e){return this.check(it(0,e))},multipleOf(e,t){return this.check(vn(e,t))},step(e,t){return this.check(vn(e,t))},finite(){return this}}));function E(e){return Jo(Un,e)}const ya=f("ZodNumberFormat",(e,t)=>{js.init(e,t),Un.init(e,t)});function Kn(e){return Vo(ya,e)}const wa=f("ZodBoolean",(e,t)=>{Ls.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>vc(e,n,r)});function T(e){return Wo(wa,e)}const ka=f("ZodUnknown",(e,t)=>{Fs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>yc()});function Bn(){return qo(ka)}const za=f("ZodNever",(e,t)=>{Cs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>bc(e,n,r)});function Sa(e){return Go(za,e)}const $a=f("ZodArray",(e,t)=>{fe(),Us.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Sc(e,n,r,i),e.element=t.element},{min(e,t){return this.check(Ee(e,t))},nonempty(e){return this.check(Ee(1,e))},max(e,t){return this.check(bn(e,t))},length(e,t){return this.check(yn(e,t))},unwrap(){return this.element}});function Jn(e,t){return cc($a,e,t)}const Oa=f("ZodObject",(e,t)=>{fe(),Js.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>$c(e,n,r,i),Br(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Na(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(N(this._zod.def,{catchall:e}))},passthrough(){return this.clone(N(this._zod.def,{catchall:Bn()}))},loose(){return this.clone(N(this._zod.def,{catchall:Bn()}))},strict(){return this.clone(N(this._zod.def,{catchall:Sa()}))},strip(){return this.clone(N(this._zod.def,{catchall:void 0}))},extend(e){return Nr(this,e)},safeExtend(e){return Rr(this,e)},merge(e){return Mr(this,e)},pick(e){return Zr(this,e)},omit(e){return Pr(this,e)},partial(...e){return Et(ft,this,e[0])},exactPartial(...e){return Et(Gn,this,e[0],"exactPartial")},required(...e){return jr(Yn,this,e[0])}});function L(e,t){const n={type:"object",shape:e??{},..._(t)};return new Oa(n)}const Ea=f("ZodUnion",(e,t)=>{Vs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Oc(e,n,r,i),e.options=t.options});function Vn(e,)DELIM" +R"DELIM(t){return new Ea({type:"union",options:e,..._(t)})}const Ia=f("ZodIntersection",(e,t)=>{Ws.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ec(e,n,r,i)});function Ta(e,t){return new Ia({type:"intersection",left:e,right:t})}const Aa=f("ZodTuple",(e,t)=>{fe(),qs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ic(e,n,r,i)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){const e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new ft({type:"optional",innerType:t}))})}});function Za(e,t,n){const r=t instanceof k,i=r?n:t,s=r?t:null;return new Aa({type:"tuple",items:e,rest:s,..._(i)})}const Wn=f("ZodRecord",(e,t)=>{fe(),Gs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ac(e,n,r,i),e.keyType=t.keyType,e.valueType=t.valueType});function Pa(e,t,n){return!t||!t._zod?new Wn({type:"record",keyType:Y(),valueType:e,..._(t)}):new Wn({type:"record",keyType:e,valueType:t,..._(n)})}const lt=f("ZodEnum",(e,t)=>{Hs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,i,s)=>wc(e,r,i),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const s={};for(const o of r)if(n.has(o))s[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new lt({...t,checks:[],..._(i),entries:s})},e.exclude=(r,i)=>{const s={...t.entries};for(const o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new lt({...t,checks:[],..._(i),entries:s})}});function Na(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new lt({type:"enum",entries:n,..._(t)})}const Ra=f("ZodTransform",(e,t)=>{fe(),Ys.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>zc(e,n,r,i),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Nt(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(se(s,n.value,t));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=n.value),o.inst??(o.inst=e),n.issues.push(se(o))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n)):(n.value=i,n)}});function Ma(e){return new Ra({type:"transform",transform:e})}const ft=f("ZodOptional",(e,t)=>{sn.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Cn(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function qn(e){return new ft({type:"optional",innerType:e})}const Gn=f("ZodExactOptional",(e,t)=>{Xs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Cn(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function ja(e){return new Gn({type:"optional",innerType:e})}const La=f("ZodNullable",(e,t)=>{Qs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Zc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Hn(e){return new La({type:"nullable",innerType:e})}const Fa=f("ZodDefault",(e,t)=>{eo.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Nc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ca(e,t){return new Fa({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():zt(t)}})}const Da=f("ZodPrefault",(e,t)=>{to.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Rc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function xa(e,t){return new Da({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():zt(t)}})}const Yn=f("ZodNonOptional",(e,t)=>{no.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Pc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Ua(e,t){return new Yn({type:"nonoptional",innerType:e,..._(t)})}const Ka=f("ZodCatch",(e,t)=>{ro.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Mc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ba(e,t){return new Ka({type:"catch",innerType:e,catchValue:typeof t=="function"?t:Vr(t)})}const Ja=f("ZodPipe",(e,t)=>{io.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>jc(e,n,r,i),e.in=t.in,e.out=t.out});function Xn(e,t){return new Ja({type:"pipe",in:e,out:t})}const Va=f("ZodReadonly",(e,t)=>{so.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Lc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Wa(e){return new Va({type:"readonly",innerType:e})}const qa=f("ZodCustom",(e,t)=>{oo.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>kc(e,n,r,i)});function Ga(e,t={}){return ac(qa,e,t)}function Ha(e,t){return uc(e,t)}const ht=[{id:0,name:"application",label:"Application"},{id:1,name:"news",label:"News"},{id:2,name:"session",label:"Session"},{id:3,name:"protocol",label:"Protocol"},{id:4,name:"proxy",label:"Proxy",disabled:!0},{id:5,name:"remote",label:"Remote"},{id:6,name:"fault",label:"Fault"},{id:7,name:"quitting",label:"Quitting"},{id:9,name:"verbose",label:"Verbose",disabled:!0}],Ze=[{id:0,name:"header_archived",label:"Header archived",category:"headers",valueKind:"height"},{id:1,name:"header_organized",label:"Header organized",category:"headers",valueKind:"height"},{id:2,name:"header_reorganized",label:"Header reorganized",category:"headers",valueKind:"height"},{id:3,name:"block_archived",label:"Block archived",category:"blocks",valueKind:"height"},{id:4,name:"block_buffered",label:"Block buffered",category:"blocks",valueKind:"height"},{id:5,name:"block_validated",label:"Block validated",category:"blocks",valueKind:"height"},{id:6,name:"block_confirmed",label:"Block confirmed",category:"blocks",valueKind:"height"},{id:7,name:"block_unconfirmable",label:"Block unconfirmable",category:"blocks",valueKind:"height"},{id:8,name:"validate_bypassed",label:"Validation bypassed",category:"blocks",valueKind:"height"},{id:9,name:"confirm_bypassed",label:"Confirmation bypassed",category:"blocks",valueKind:"height"},{id:10,name:"tx_archived",label:"Transaction archived",category:"transactions",valueKind:"fee-rate"},{id:11,name:"tx_validated",label:"Transaction validated",category:"transactions",valueKind:"count"},{id:12,name:"tx_invalidated",label:"Transaction invalidated",category:"transactions",valueKind:"count"},{id:13,name:"block_organized",label:"Block organized",category:"chain",valueKind:"height"},{id:14,name:"block_reorganized",label:"Block reorganized",category:"chain",valueKind:"height"},{id:15,name:"template_issued",label:"Mining template issued",category:"mining",valueKind:"count"},{id:16,name:"snapshot_secs",label:"Snapshot",category:"timing",valueKind:"seconds"},{id:17,name:"prune_msecs",label:"Prune",category:"timing",valueKind:"milliseconds"},{id:18,name:"reload_msecs",label:"Store reload",category:"timing",valueKind:"milliseconds"},{id:19,name:"block_usecs",label:"Serve block",category:"timing",valueKind:"microseconds"},{id:20,name:"ancestry_msecs",label:"Serve ancestry",category:"timing",valueKind:"milliseconds"},{id:21,name:"filter_msecs",label:"Serve filter",category:"timing",valueKind:"milliseconds"},{id:22,name:"filterhashes_msecs",label:"Serve filter hashes",category:"timing",valueKind:"milliseconds"},{id:23,name:"filterchecks_msecs",label:"Serve filter checkpoints",category:"timing",valueKind:"milliseconds"},{id:24,name:"ecdsa_secs",label:"ECDSA batch verification",category:"timing",valueKind:"seconds"},{id:25,name:"schnorr_secs",label:"Schnorr batch verification",category:"timing",valueKind:"seconds"},{id:26,name:"silent_secs",label:"Silent payment scan",category:"timing",valueKind:"seconds"},{id:27,name:"validate_usecs",label:"Block validation",category:"timing",valueKind:"microseconds"},{id:28,name:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],Qn=E().int().nonnegative().max(864e13),er=L({level:E().int().nonnegative(),time:Qn,message:Y()}),tr=L({event:E().int().nonnegative(),value:E().nonnegative(),time:Qn}),nr=L({previous:E().nonnegative()});Vn([er,tr,nr]);const Ya=ht.reduce((e,t)=>t.disabled?e:e|1<=0&&t<31&&(e&Ya&1<{this.#u(r)},onHeartbeat:r=>{this.#u(r)},onBeforeStop:r=>{r.send("/v1/log/subscribe?filter=0"),r.send("/v1/event/subscribe?filter=0")},onMessage:r=>{const i=tu(r);if(!i)return!1;if(sr(i)&&!ir(this.#e,i.level))return!0;for(const s of this.#t)s(i);return!0},onUnclaimed:r=>{for(const i of this.#r)i(r)}}}getStatus=()=>this.#s.getStatus();subscribeStatus=t=>this.#s.subscribeStatus(t);start(){this.#o??=this.#s.attach(this.#i)}stop(){this.#o?.(),this.#o=null}subscribeFrames(t){return this.#t.add(t),()=>{this.#t.delete(t)}}subscribeInvalidFrames(t){return this.#r.add(t),()=>{this.#r.delete(t)}}setFilters(t,n){this.#e!==t&&(this.#e=t,this.#s.send(`/v1/log/subscribe?filter=${String(t)}`)),this.#n!==n&&(this.#n=n,this.#s.send(`/v1/event/subscribe?filter=${String(n)}`))}#u(t){t.send(`/v1/log/subscribe?filter=${String(this.#e)}`),t.send(`/v1/event/subscribe?filter=${String(this.#n)}`)}}function su(e){const t=e.trim();if(!t)throw new Error("Endpoint URL is required");const n=/^[a-z][a-z\\d+\\-.]*:\\/\\//iu.test(t)?t:`http://${t}`,r=new URL(n);if(r.protocol!=="http:"&&r.protocol!=="https:")throw new Error("Endpoint must use HTTP or HTTPS");return r.pathname=r.pathname.replace(/\\/+$/u,"")||"/",r.search="",r.hash="",r.toString().replace(/\\/$/u,"")}function ou(e){const t=new URL(su(e));return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/",t.search="",t.hash="",t.toString()}const cu=L({store:L({address:T(),filter:T(),silent:E().int().nonnegative().nullable(),turbo:T(),pruned:E().int().nonnegative()}),node:L({network:Y(),limited:T().optional(),blocks:T().optional(),witness:T().optional(),filters:T().optional(),privacy:T().optional()}),wallet:L({p2kh:E().int(),p2sh:E().int(),wif:E().int(),witness:Y(),silent:Y(),hd_private:E().int(),hd_public:E().int()}).optional(),network:L({relay:T(),alert:T(),reject:T(),compact:T(),address:T(),witness_tx:T(),memory_pool:T(),not_found:T(),protocol_maximum:E().int(),protocol_minimum:E().int()}).optional(),forks:Pa(Y(),T()).transform(e=>Object.keys(e).filter(t=>e[t]))}),or=Y().regex(/^[0-9a-f]{64}$/u),au=L({hash:or,height:E().int().nonnegative(),timestamp:E().int().positive().max(4294967295)}),cr=L({hash:or,height:E().int().nonnegative()}),uu=L({confirmed:cr,candidate:cr}),Ne=E().int().nonnegative().max(Number.MAX_SAFE_INTEGER),lu=L({count:Ne,virtual:Ne,fee:Ne,histogram:Jn(Za([E().nonnegative(),Ne]))}),fu="/v1/fees?format=json",hu=5e3,du=15e3;function pu(e){try{const t=JSON.parse(e),n=cu.safeParse(t);if(n.success)return{type:"configuration",payload:n.data};const r=au.safeParse(t);if(r.success)return{type:"header",payload:r.data};const i=lu.safeParse(t);if(i.success)return{type:"fees",payload:i.data};const s=uu.safeParse(t);return s.success?{type:"top",payload:s.data}:null}catch{return null}}function ar(e){return`/v1/block/height/${String(e)}/header?format=json&candidate=true`}const ur=15e3,dt=3*ur,lr={configuration:null,configurationReceivedAt:null,tops:null,topReceivedAt:null,branch:null,branchReceivedAt:null,tip:null,fees:null,invalidFrames:0};class mu{#e=lr;#n=new Set;#t;#r;#s=null;#i=null;#o;#u=null;#a=null;#c=null;#l=null;#h=null;#p;#d=null;#f=null;constructor(t,n={}){this.#o=n.now??Date.now,this.#p=n.pollIntervalMs??ur,this.#t=t,this.#r={heartbeatMs:this.#p,onOpen:r=>{this.#u=this.#o(),r.send("/v1/configuration?format=json"),r.send("/v1/top/subscribe?format=json"),this.#f=null,this.#y()},onHeartbeat:r=>{const i=this.#e.topReceivedAt??this.#u;if(i!==null&&this.#o()-i>=dt){try{r.close(4e3,"Native top response timed out")}catch{}return}r.send("/v1/top?format=json")},onBeforeStop:r=>{r.send("/v1/top/subscribe?format=json&stop=true")},onMessage:r=>{const i=pu(r);return i?(this.#_(i),!0):!1},onUnclaimed:()=>{this.#g({...this.#e,invalidFrames:this.#e.invalidFrames+1})}}}getStatus=()=>this.#t.getStatus();subscribeStatus=t=>this.#t.subscribeStatus(t);getState=()=>this.#e;subscribeState=t=>(this.#n.add(t),()=>{this.#n.delete(t)});start(){this.#d??=setInterval(()=>{this.#y()},hu),this.#i??=this.#t.subscribeStatus(()=>{this.#t.getStatus().phase!=="connected"&&(this.#u=null,this.#f=null,this.#a=null,this.#c=null,this.#l=null,this.#h=null,this.#k())}),this.#s??=this.#t.attach(this.#r)}stop(){this.#d!==null&&clearInterval(this.#d),this.#d=null,this.#f=null,this.#i?.(),this.#i=null,this.#s?.(),this.#s=null}#_(t){const n=this.#o();if(t.type==="fees"){this.#f=null,this.#g({...this.#e,fees:{data:t.payload,receivedAt:n}});return}if(t.type==="top"){const{confirmed:r,candidate:i}=t.payload,s=i.height>r.height,o=s&&this.#e.branch?.height===r.height;s||(this.#a=null,this.#c=null),this.#g({...this.#e,tops:t.payload,topReceivedAt:n,branch:o?this.#e.branch:null,branchReceivedAt:o?this.#e.branchReceivedAt:null}),this.#m(i.height,n),s&&this.#b(r.height,n);return}if(t.type==="header"){if(t.payload.height===this.#l?.height){this.#l=null,this.#g({...this.#e,tip:t.payload});return}if(t.payload.height!==this.#a?.height)return;this.#a=null,this.#g({...this.#e,branch:t.payload,branchReceivedAt:n});return}this.#g({...this.#e,configuration:t.payload,configurationReceivedAt:n})}#b(t,n){this.#a!==null&&n-this.#a.requestedAtnew WebSocket(n))},this.#a=this.#e.retryMinimumMs}getStatus=()=>this.#n;subscribeStatus=t=>(this.#r.add(t),()=>{this.#r.delete(t)});attach(t){this.#o.push(t);const n=this.#t;return n?.readyState===1&&this.#n.phase==="connected"&&(t.onOpen?.(n),this.#p(n,t)),()=>{const r=this.#o.indexOf(t);if(r<0)return;this.#o.splice(r,1),this.#f(t);const i=this.#t;if(i?.readyState===1)try{t.onBeforeStop?.(i)}catch{}}}start(){this.#c||(this.#c=!0,this.#a=this.#e.retryMinimumMs,this.#l())}stop(){this.#c=!1,this.#b();const t=this.#t;if(this.#t=null,t)try{if(t.readyState===1)for(const n of[...this.#o])n.onBeforeStop?.(t);t.close()}catch{}this.#m(fr)}send(t){if(this.#t?.readyState!==1)return!1;try{return this.#t.send(t),!0}catch{return!1}}#l(){if(!this.#c||this.#t)return;const t=this.#n.reconnects>0;this.#m({...this.#n,phase:t?"reconnecting":"connecting",attempt:this.#n.attempt+1,error:null});let n;try{n=this.#e.webSocketFactory(this.#e.url),thi)DELIM" +R"DELIM(s.#t=n}catch(r){this.#m({...this.#n,error:vu(r)}),this.#h();return}this.#s=setTimeout(()=>{if(this.#t===n){this.#m({...this.#n,error:"Connection timed out"});try{n.close()}catch{this.#t=null,this.#h()}}},this.#e.connectTimeoutMs),n.addEventListener("open",()=>{if(!(this.#t!==n||!this.#c)){this.#d(),this.#a=this.#e.retryMinimumMs,this.#m({...this.#n,phase:"connected",connectedAt:this.#e.now(),error:null});for(const r of[...this.#o]){if(this.#t!==n)return;r.onOpen?.(n),this.#p(n,r)}}}),n.addEventListener("message",r=>{if(this.#t!==n||!this.#c)return;const i=_u(r.data);if(i===null)return;const s=this.#e.now();(this.#n.lastMessageAt===null||s-this.#n.lastMessageAt>=1e3)&&this.#m({...this.#n,lastMessageAt:s});const o=[...this.#o];if(!o.some(c=>c.onMessage(i)))for(const c of o)c.onUnclaimed?.(i)}),n.addEventListener("error",()=>{if(!(this.#t!==n||!this.#c)){this.#m({...this.#n,error:"WebSocket connection failed"});try{n.close()}catch{this.#t=null,this.#h()}}}),n.addEventListener("close",()=>{this.#t===n&&(this.#t=null,this.#d(),this.#_(),this.#c&&this.#h())})}#h(){if(!this.#c||this.#i)return;const t=1+(this.#e.random()*2-1)*this.#e.jitterRatio,n=Math.max(0,Math.round(this.#a*t));this.#a=Math.min(this.#a*2,this.#e.retryMaximumMs),this.#m({...this.#n,phase:"reconnecting",reconnects:this.#n.reconnects+1,connectedAt:null}),this.#i=setTimeout(()=>{this.#i=null,this.#l()},n)}#p(t,n){this.#f(n);const r=n.heartbeatMs??24e4;if(!n.onHeartbeat||r<=0)return;const i=setInterval(()=>{this.#t===t&&t.readyState===1&&n.onHeartbeat?.(t)},r);this.#u.set(n,i)}#d(){this.#s&&(clearTimeout(this.#s),this.#s=null)}#f(t){const n=this.#u.get(t);n!==void 0&&(clearInterval(n),this.#u.delete(t))}#_(){for(const t of this.#u.values())clearInterval(t);this.#u.clear()}#b(){this.#d(),this.#_(),this.#i&&(clearTimeout(this.#i),this.#i=null)}#m(t){this.#n=t;for(const n of this.#r)n()}}function _u(e){return typeof e=="string"?e:e instanceof ArrayBuffer?new TextDecoder().decode(e):null}function vu(e){return e instanceof Error?e.message:"Unable to create WebSocket"}const bu=600,q=e=>Ze.findIndex(t=>t.name===e),yu=q("header_archived"),wu=q("header_organized"),ku=q("header_reorganized"),zu=q("block_archived"),Su=q("block_validated"),$u=q("validate_bypassed"),Ou=q("block_organized"),Eu=q("block_reorganized"),Iu=Uint8Array.from({length:256},(e,t)=>{let n=0;for(let r=t;r>0;r>>=1)n+=r&1;return n});class hr{#e=new Uint8Array(0);add(t){const n=t>>3;if(n>=this.#e.length){const r=new Uint8Array(Math.max(n+1,this.#e.length*2,1024));r.set(this.#e),this.#e=r}this.#e[n]|=1<<(t&7)}clear(){this.#e=new Uint8Array(0)}count(t,n){let r=0,i=t;for(;i<=n&&(i&7)!==0;)r+=this.#n(i++)?1:0;for(;i+7<=n;)r+=Iu[this.#e[i>>3]??0]??0,i+=8;for(;i<=n;)r+=this.#n(i++)?1:0;return r}#n(t){return((this.#e[t>>3]??0)&1<<(t&7))!==0}}class Tu{#e=0;#n=new hr;#t=new hr;#r=0;#s=null;#i=null;record(t,n,r){if(t===yu)this.#e=Math.max(this.#e,n);else if(t===zu)this.#n.add(n);else if(t===Su||t===$u)this.#t.add(n);else if(t===wu)this.#s={height:n,receivedAt:r};else if(t===ku)this.#s={height:Math.max(0,n-1),receivedAt:r};else if(t===Ou)this.#i={height:n,receivedAt:r};else if(t===Eu)this.#i={height:Math.max(0,n-1),receivedAt:r};else return;this.#r=Math.max(this.#r,n)}reset(){this.#e=0,this.#n.clear(),this.#t.clear(),this.#r=0,this.#s=null,this.#i=null}snapshot(t=bu){const n=new Uint8Array(t),r=new Uint8Array(t),i=this.#r+1;for(let s=0;s({id:e.id,source:"pool",sourceId:e.field,name:e.field,label:e.label,category:"pool",payloadKind:e.payloadKind,allowedMeasures:dr,defaultMeasure:"payload-latest",description:e.description})),...Ze.map(e=>ju(e.id)),...ht.filter(e=>!e.disabled).map(e=>({id:gr(e.id),source:"log",sourceId:e.id,name:e.name,label:`${e.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:re,defaultMeasure:"occurrence-rate",description:`${e.label} log message volume. Message text is not interpreted as numeric data.`})),{id:pt,source:"native",sourceId:"top",name:"canonical_top",label:"Current top",category:"native",payloadKind:"height",allowedMeasures:["payload-latest","payload-maximum","payload-change-rate"],defaultMeasure:"payload-latest",description:"Canonical chain height reported by the native interface."}];new Map(Lu.map(e=>[e.id,e]));function Fu(e,t){return Pe(e).valueKind==="fee-rate"?t/1e3:ru(e,t)??t}const Cu=3600*1e3,Du=1e3,xu=1e3,Uu=1e3;class _r{constructor(t){this.capacity=t,this.#e=Array.from({length:t})}capacity;#e;#n=0;#t=0;#r=null;get size(){return this.#t}push(t){const n=this.#t===this.capacity;return this.#r=null,this.#e[this.#n]=t,this.#n=(this.#n+1)%this.capacity,this.#t=Math.min(this.#t+1,this.capacity),n}clear(){this.#r=null,this.#e.fill(void 0),this.#n=0,this.#t=0}newestFirst(){if(this.#r)return this.#r;const t=[];for(let n=0;nthis.#R;getRecentLogs=()=>this.#r.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=t=>(this.#t.add(t),()=>{this.#t.delete(t)});start(){this.#$||(this.tick(),this.#$=setInterval(()=>{this.tick()},1e3))}stop(){this.#$&&(clearInterval(this.#$),this.#$=null),this.#v&&(clearT)DELIM" +R"DELIM(imeout(this.#v),this.#v=null)}ingest(t,n=this.#e()){const r=this.#w(n);this.#b+=1,sr(t)?this.#L(t,r):Qa(t)?this.#F(t,r):eu(t)&&(this.#A+=1),this.#O()}recordInvalidFrame(){this.#Z+=1,this.#O()}recordNativeTop(t,n=this.#e()){const r=this.#w(n),i=this.#p[pt];i?.value===t&&r-i.time<15e3||(this.#I(pt,r,t),this.#M(r),this.#O())}recordNativeFees(t,n=this.#e()){if(!Number.isFinite(n)||n=du||this.#z!==null&&n<=this.#z.receivedAt)return;const r=this.#w(n);this.#z={data:t,receivedAt:n};for(const i of pr)this.#I(i.id,r,t[i.field]);this.#M(r),this.#O()}clearLogs(){this.#k+=this.#r.size,this.#r.clear(),this.flush()}clearEvents(){this.#s.clear(),this.flush()}reset(){this.#r.clear(),this.#s.clear(),this.#i.clear(),this.#o=Number.NEGATIVE_INFINITY,this.#u={},this.#a={},this.#c={},this.#l={},this.#h={},this.#p={},this.#d={},this.#f=this.#w(this.#e()),this.#b=0,this.#m=0,this.#y=0,this.#k=0,this.#g=0,this.#A=0,this.#Z=0,this.#P=null,this.#N=null,this.#z=null,this.#S=0,this.#E.reset(),this.#T(this.#f),this.flush()}resetSyncFill(){this.#E.reset()}tick(){const t=this.#w(this.#e());this.#T(t),this.#M(t),this.#O()}flush(){this.#v&&(clearTimeout(this.#v),this.#v=null),this.#R=this.#j();for(const t of this.#t)t()}#L(t,n){this.#m+=1,this.#P=n,this.#S+=1,this.#r.push({...t,id:this.#S,receivedAt:n})&&(this.#y+=1),this.#I(gr(t.level),t.time,null)}#F(t,n){this.#g+=1,this.#N=n,this.#S+=1,this.#s.push({...t,id:this.#S,receivedAt:n}),this.#E.record(t.event,t.value,n),this.#I(mr(t.event),t.time,Fu(t.event,t.value))}#w(t){return Number.isFinite(t)?(this.#_=Math.max(this.#_,t),this.#_):this.#_}#I(t,n,r){const i=this.#T(n);i.snapshot=null;const s=i.signals.get(t)??Ku();if(s.count+=1,Re(this.#l,t,1),r!==null){s.samples+=1,s.sum+=r,s.minimum=s.minimum===null?r:Math.min(s.minimum,r),s.maximum=s.maximum===null?r:Math.max(s.maximum,r),(s.firstAt===null||n=s.lastAt)&&(s.last=r,s.lastAt=n),Re(this.#h,t,r);const o=this.#p[t];(!o||n>=o.time)&&(this.#p[t]={value:r,time:n}),this.#d[t]=Math.max(this.#d[t]??r,r)}i.signals.set(t,s)}#T(t){const n=Math.floor(t/1e3)*1e3,r=this.#i.get(n);if(r)return r;const i={time:n,signals:new Map,snapshot:null};if(this.#i.set(n,i),no-c);this.#i.clear();for(const[o,c]of s)this.#i.set(o,c)}else this.#o=n;return i}#M(t){const n=t-Cu;for(const[r,i]of this.#i){if(r>=n)break;for(const[s,o]of i.signals)if(Re(this.#u,s,o.count),Re(this.#a,s,o.sum),o.last!==null&&o.lastAt!==null){const c=this.#c[s];(!c||o.lastAt>=c.time)&&(this.#c[s]={value:o.last,time:o.lastAt})}this.#i.delete(r)}}#O(){!this.#n||this.#v||(this.#v=setTimeout(()=>{this.#v=null,this.flush()},Du))}#j(){const t=[...this.#i.values()].map(n=>(n.snapshot??={time:n.time,signals:Object.fromEntries([...n.signals].map(([r,i])=>[r,{...i}]))},n.snapshot));return{now:this.#w(this.#e()),sessionStartedAt:this.#f,totalFrames:this.#b,totalLogs:this.#m,evictedLogs:this.#y,clearedLogs:this.#k,totalEvents:this.#g,totalAcks:this.#A,invalidFrames:this.#Z,buckets:t,priorSignalCounts:{...this.#u},priorSignalSums:{...this.#a},priorSignalLatest:vr(this.#c),signalTotals:{...this.#l},signalSums:{...this.#h},signalLatest:vr(this.#p),signalMaximums:{...this.#d},recentLogs:this.#r.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#P,lastEventAt:this.#N,poolSnapshot:this.#z,syncFill:this.#E.snapshot()}}}const Me=40;function Ju(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(o=>ir(t.filter,o.level)&&(!n||o.message.toLowerCase().includes(n)||nu(o.level).name.includes(n))),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,s=Math.min(i,Math.max(0,r.length-Me));return{logs:r.slice(s,s+Me),retained:e.length,matched:r.length,offset:s}}function Vu(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(o=>{const c=Pe(o.event);return(t.category==="all"||c.category===t.category)&&(!n||c.name.includes(n)||c.label.toLowerCase().includes(n)||String(o.value).includes(n))}),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,s=Math.min(i,Math.max(0,r.length-Me));return{events:r.slice(s,s+Me),retained:e.length,matched:r.length,offset:s}}function Wu(e,t){const{buckets:n,recentLogs:r,recentEvents:i,...s}=e,o=new Map(t?.buckets.map(c=>[c.time,c]));return{summary:s,reset:t===null,firstBucketTime:n[0]?.time??e.now,buckets:n.filter(c=>o.get(c.time)!==c),recentLogs:r===t?.recentLogs?null:r,recentEvents:i===t?.recentEvents?null:i}}class qu{constructor(t,n=i=>new gu({url:ou(i)}),r=Date.now){this.send=t,this.createSocket=n,this.#e=new Bu(r,!1)}send;createSocket;#e;#n=null;#t=null;#r=[];#s=null;#i=null;#o=0;#u=null;#a=null;#c=null;#l=[];handle(t){if(t.type==="stop"){this.#d(),this.#e.stop(),this.send({type:"stopped"});return}if(t.type==="configure"){if(t.generation=this.#o&&this.#h(t.generation);return}if(t.generation===this.#o)switch(t.type){case"pause-display":{t.stream==="logs"?this.#a=t.paused?this.#a??this.#e.getRecentLogs():null:this.#c=t.paused?this.#c??this.#e.getRecentEvents():null;break}case"poll-events":{this.send({type:"events",generation:this.#o,requestId:t.requestId,queryVersion:t.queryVersion,window:Vu(this.#c??this.#e.getRecentEvents(),t.query)});break}case"poll-logs":{this.send({type:"logs",generation:this.#o,requestId:t.requestId,queryVersion:t.queryVersion,window:Ju(this.#a??this.#e.getRecentLogs(),t.query)});break}case"native-top":{this.#e.recordNativeTop(t.height,t.receivedAt);break}case"native-fees":{this.#e.recordNativeFees(t.fees,t.receivedAt);break}case"clear-logs":{this.#e.clearLogs(),this.#a!==null&&(this.#a=[]);break}case"clear-events":{this.#e.clearEvents(),this.#c!==null&&(this.#c=[]);break}case"poll":{if(!this.#n)return;this.#e.flush();const n=this.#e.getSnapshot();this.send({type:"snapshot",generation:this.#o,requestId:t.requestId,status:this.#n.getStatus(),update:Wu(n,this.#u)}),this.#u=n;break}}}#h(t){this.#o=t,this.#u=null,this.#a!==null&&(this.#a=[]),this.#c!==null&&(this.#c=[]),this.#e.reset()}#p(t,n,r){this.#d(),this.#s=t,this.#i=n;const i=this.createSocket(t),s=n===t?i:this.createSocket(n);this.#r=i===s?[i]:[i,s];const o=new iu(i,{logFilter:r}),c=new mu(s),a=()=>{this.send({type:"native",status:c.getStatus(),live:c.getState()})};this.#n=o,this.#t=c;let u=!1;this.#l=[o.subscribeStatus(()=>{const l=o.getStatus().phase==="connected";l&&!u&&this.#e.resetSyncFill(),u=l}),o.subscribeFrames(l=>{this.#e.ingest(l)}),o.subscribeInvalidFrames(()=>{this.#e.recordInvalidFrame()}),c.subscribeStatus(a),c.subscribeState(a)],o.start(),c.start();for(const l of this.#r)l.start()}#d(){for(const t of this.#l)t();this.#l=[];for(const t of this.#r)t.stop();this.#n?.stop(),this.#t?.stop(),this.#r=[],this.#n=null,this.#t=null}}const mt=globalThis,Gu=new qu(e=>{mt.postMessage(e)});mt.addEventListener("message",e=>{Gu.handle(e.data),e.data.type==="stop"&&mt.close()})})();\n',Q_=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",bx],{type:"text/javascript;charset=utf-8"});function Bj(n){let i;try{if(i=Q_&&(self.URL||self.webkitURL).createObjectURL(Q_),!i)throw"";const a=new Worker(i,{name:n?.name});return a.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(i)}),a}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(bx),{name:n?.name})}}const J_=100,_x=15e3,qj=3*_x,xu={configuration:null,configurationReceivedAt:null,tops:null,topReceivedAt:null,branch:null,branchReceivedAt:null,tip:null,fees:null,invalidFrames:0};function Ij(n,i){const a=new Map((i.reset?[]:n.buckets).filter(l=>l.time>=i.firstBucketTime).map(l=>[l.time,l]));for(const l of i.buckets)a.set(l.time,l);return{...i.summary,buckets:[...a.val)DELIM" +R"DELIM(ues()],recentLogs:Qf(i.reset?[]:n.recentLogs,i.recentLogs),recentEvents:Qf(i.reset?[]:n.recentEvents,i.recentEvents)}}function Qf(n,i){if(i===null)return n;const a=new Map(n.map(l=>[l.id,l]));return i.map(l=>a.get(l.id)??l)}const Hs={phase:"idle",attempt:0,reconnects:0,connectedAt:null,lastMessageAt:null,error:null};class Vj{constructor(i=()=>new Bj){this.createWorker=i}createWorker;#e=null;#t=new n_().getSnapshot();#n=Hs;#i=new Set;#r=new Set;#s=Hs;#o=xu;#f=new Set;#u=null;#l=null;#x=no;#a=0;#m=0;#h=null;#d=null;#v=null;#p=new Set;#w={logs:[],retained:0,matched:0,offset:0};#N={search:"",filter:no,offset:0};#z=0;#y=null;#E=null;#g=new Set;#A={events:[],retained:0,matched:0,offset:0};#R={search:"",category:"all",offset:0};#T=0;#S=null;#M=!1;#b=!1;getSnapshot=()=>this.#t;getStatus=()=>this.#n;getNativeStatus=()=>this.#s;getNativeLive=()=>this.#o;subscribeNative=i=>(this.#f.add(i),()=>{this.#f.delete(i)});getLogWindow=()=>this.#w;getEventWindow=()=>this.#A;subscribeEvents=i=>(this.#g.add(i),this.#O(),this.#j(),()=>{this.#g.delete(i),this.#g.size===0&&this.#U()});subscribeLogs=i=>(this.#p.add(i),this.#_(),this.#Z(),()=>{this.#p.delete(i),this.#p.size===0&&this.#k()});subscribe=i=>(this.#i.add(i),()=>{this.#i.delete(i)});subscribeStatus=i=>(this.#r.add(i),()=>{this.#r.delete(i)});configure(i,a,l){i===this.#u&&a===this.#l&&l===this.#x||(this.#u!==null&&i!==this.#u&&(this.reset(),this.#H({...Hs,phase:"connecting"})),this.#l!==null&&a!==this.#l&&this.#$({...Hs,phase:"connecting"},xu),this.#u=i,this.#l=a,this.#x=l,this.#C())}start(){if(!(this.#e||this.#u===null||this.#l===null))try{const i=this.createWorker();this.#e=i,this.#w={logs:[],retained:0,matched:0,offset:0},this.#A={events:[],retained:0,matched:0,offset:0};for(const a of this.#p)a();for(const a of this.#g)a();this.#H({...Hs,phase:"connecting"}),this.#$({...Hs,phase:"connecting"},xu),i.onmessage=a=>{if(this.#e!==i)return;const l=a.data;if(l.type==="events"){if(l.requestId!==this.#S||(this.#S=null,l.generation!==this.#a))return;if(l.queryVersion!==this.#T){this.#O();return}this.#A={...l.window,events:Qf(this.#A.events,l.window.events)};for(const u of this.#g)u();return}if(l.type==="logs"){if(l.requestId!==this.#y||(this.#y=null,l.generation!==this.#a))return;if(l.queryVersion!==this.#z){this.#_();return}this.#w={...l.window,logs:Qf(this.#w.logs,l.window.logs)};for(const u of this.#p)u();return}if(l.type==="native"){this.#$(l.status,l.live);return}if(l.type==="snapshot"&&l.requestId===this.#h&&(this.#h=null,l.generation===this.#a)){this.#t=Ij(this.#t,l.update),this.#H(l.status);for(const u of this.#i)u()}},i.onerror=()=>{this.#B("Telemetry worker failed. Reload the dashboard to reconnect.")},i.onmessageerror=()=>{this.#B("Unable to read telemetry worker data. Reload the dashboard to reconnect.")},this.#C(),this.#M&&this.#c({type:"pause-display",generation:this.#a,stream:"logs",paused:!0}),this.#b&&this.#c({type:"pause-display",generation:this.#a,stream:"events",paused:!0}),this.#D(),this.getStatus().error===null&&(this.#d=setInterval(()=>{this.#D()},1e3)),this.#Z(),this.#j()}catch(i){this.#B(`Unable to start telemetry worker: ${i instanceof Error?i.message:String(i)}`)}}stop(){this.#L();const i=this.#e;if(this.#e=null,i){const a=setTimeout(()=>{i.terminate()},500),l=()=>{clearTimeout(a),i.terminate()};i.onmessage=u=>{u.data.type==="stopped"&&l()},i.onerror=l,i.onmessageerror=l;try{i.postMessage({type:"stop"})}catch{l()}}this.#H(Hs),this.#$(Hs,xu)}recordNativeTop(i,a=Date.now()){this.#c({type:"native-top",generation:this.#a,height:i,receivedAt:a})}recordNativeFees(i,a=Date.now()){this.#c({type:"native-fees",generation:this.#a,fees:i,receivedAt:a})}clearLogs(){this.#c({type:"clear-logs",generation:this.#a}),this.#z+=1,this.#_()}clearEvents(){this.#c({type:"clear-events",generation:this.#a}),this.#T+=1,this.#O()}setLogsPaused(i){i!==this.#M&&(this.#M=i,this.#k(),this.#c({type:"pause-display",generation:this.#a,stream:"logs",paused:i}),this.#z+=1,this.#_(),this.#Z())}setEventsPaused(i){i!==this.#b&&(this.#b=i,this.#U(),this.#c({type:"pause-display",generation:this.#a,stream:"events",paused:i}),this.#T+=1,this.#O(),this.#j())}reset(){this.#a+=1,this.#h=null,this.#y=null,this.#S=null,this.#w={logs:[],retained:0,matched:0,offset:0},this.#A={events:[],retained:0,matched:0,offset:0},this.#t=new n_().getSnapshot(),this.#c({type:"reset",generation:this.#a});for(const i of this.#i)i();for(const i of this.#p)i();for(const i of this.#g)i()}setLogQuery(i){JSON.stringify(i)!==JSON.stringify(this.#N)&&(this.#N=i,this.#z+=1,this.#_())}setEventQuery(i){JSON.stringify(i)!==JSON.stringify(this.#R)&&(this.#R=i,this.#T+=1,this.#O())}#j(){!this.#e||this.#g.size===0||this.#E||this.#b||(this.#E=setInterval(()=>{this.#O()},J_),this.#O())}#O(){this.#S!==null||!this.#e||this.#g.size===0||(this.#S=++this.#m,this.#c({type:"poll-events",generation:this.#a,requestId:this.#S,queryVersion:this.#T,query:this.#R}))}#U(){this.#E&&clearInterval(this.#E),this.#E=null,this.#S=null}#Z(){!this.#e||this.#p.size===0||this.#v||this.#M||(this.#v=setInterval(()=>{this.#_()},J_),this.#_())}#_(){this.#y!==null||!this.#e||this.#p.size===0||(this.#y=++this.#m,this.#c({type:"poll-logs",generation:this.#a,requestId:this.#y,queryVersion:this.#z,query:this.#N}))}#k(){this.#v&&clearInterval(this.#v),this.#v=null,this.#y=null}#C(){this.#u!==null&&this.#l!==null&&this.#c({type:"configure",generation:this.#a,endpoint:this.#u,nativeEndpoint:this.#l,logFilter:this.#x})}#D(){this.#h!==null||!this.#e||(this.#h=++this.#m,this.#c({type:"poll",generation:this.#a,requestId:this.#h}))}#c(i){try{this.#e?.postMessage(i)}catch{this.#B("Unable to communicate with telemetry worker. Reload the dashboard to reconnect.")}}#L(){this.#k(),this.#U(),this.#d&&clearInterval(this.#d),this.#d=null,this.#h=null}#B(i){this.#L(),this.#e?.terminate(),this.#e=null,this.#H({...Hs,error:i}),this.#$({...Hs,error:i},xu)}#$(i,a){this.#s=i,this.#o=a;for(const l of this.#f)l()}#H(i){if(JSON.stringify(i)!==JSON.stringify(this.#n)){this.#n=i;for(const a of this.#r)a()}}}const Sx="libbitcoinAdminDashboardLogFilter";function xx(){try{return globalThis.localStorage}catch{return null}}function Pj(n=xx()){try{const i=n?.getItem(Sx);if(!i)return no;const a=JSON.parse(i);return typeof a=="number"&&Number.isInteger(a)&&a>=0?a&qf:no}catch{return no}}function Kj(n,i=xx()){try{i?.setItem(Sx,String(n))}catch{}}const wx=le.createContext(void 0),Gj=n=>{const i=le.useContext(wx);if(!i)throw new Error("No QueryClient set, use QueryClientProvider to set one");return i},Yj=({client:n,children:i})=>(le.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),x.jsx(wx.Provider,{value:n,children:i})),Fj={setTimeout:(n,i)=>setTimeout(n,i),clearTimeout:n=>clearTimeout(n),setInterval:(n,i)=>setInterval(n,i),clearInterval:n=>clearInterval(n)};var Qj=class{#e=Fj;#t=!1;setTimeoutProvider(n){this.#e=n}setTimeout(n,i){return this.#e.setTimeout(n,i)}clearTimeout(n){this.#e.clearTimeout(n)}setInterval(n,i){return this.#e.setInterval(n,i)}clearInterval(n){this.#e.clearInterval(n)}};const Ja=new Qj;function Jj(n){setTimeout(n,0)}const Xj=typeof window>"u"||"Deno"in globalThis;function vi(){}function Wj(n,i){return typeof n=="function"?n(i):n}function zx(n){return typeof n=="number"&&n>=0&&n!==1/0}function Ex(n,i){return Math.max(n+(i||0)-Date.now(),0)}function Rt(n,i){return typeof n=="function"?n(i):n}function X_(n,i){const{type:a="all",exact:l,fetchStatus:u,predicate:f,queryKey:d,stale:h}=n;if(d){if(l){if(i.queryHash!==vg(d,i.options))return!1}else if(!ho(i.queryKey,d))return!1}if(a!=="all"){const p=i.isActive();if(a==="active"&&!p||a==="inactive"&&p)return!1}return!(typeof h=="boolean"&&i.isStale()!==h||u&&u!==i.state.fetchStatus||f&&!f(i))}function W_(n,i){const{exact:a,status:l,predicate:u,mutationKey:f}=n;if(f){if(!i.options.mutationKey)return!1;if(a){if(qu(i.options.mutationKey)!==qu(f))return!1}else if(!ho(i.options.mutationKey,f))return!1}return!(l&&i.state.status!==l||u&&!u(i))}function vg(n,i){return(i?.queryKeyHashFn||qu)(n)})DELIM" +R"DELIM(function qu(n){return JSON.stringify(n,(i,a)=>Np(a)?Object.keys(a).sort().reduce((l,u)=>(l[u]=a[u],l),{}):a)}function ho(n,i){if(n===i)return!0;if(typeof n!=typeof i)return!1;if(n&&i&&typeof n=="object"&&typeof i=="object"){if(Array.isArray(n)&&Array.isArray(i)){if(i.length>n.length)return!1;for(let l=0;l500)return i;const l=e1(n)&&e1(i);if(!l&&!(Np(n)&&Np(i)))return i;const u=(l?n:Object.keys(n)).length,f=l?i:Object.keys(i),d=f.length,h=l?new Array(d):{};let p=0;for(let g=0;g{Ja.setTimeout(i,n)})}function Ap(n,i,a){return typeof a.structuralSharing=="function"?a.structuralSharing(n,i):a.structuralSharing!==!1?Ox(n,i):i}function tk(n,i,a=0){const l=[...n,i];return a&&l.length>a?l.slice(-a):l}function nk(n,i,a=0){const l=[i,...n];return a&&l.length>a?l.slice(0,a):l}const yg=Symbol();function Nx(n,i){return!n.queryFn&&i?.initialPromise?()=>i.initialPromise:!n.queryFn||n.queryFn===yg?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function Ax(n,i){return typeof n=="function"?n(...i):!!n}const bg=Symbol();function ik(n,i,a,l){let u=!1,f;return Object.defineProperties(n,{[bg]:{value:l},signal:{enumerable:!0,get:()=>(f??=i(),u||(u=!0,f.aborted?a():f.addEventListener("abort",a,{once:!0})),f)}}),n}let sk=()=>Xj;const _g=()=>sk();var Vu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},rk=class extends Vu{#e;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#n=n,this.#t?.(),this.#t=n(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()})}setFocused(n){this.#e!==n&&(this.#e=n,this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(i=>{i(n)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}};const Sg=new rk,ak=Jj;function lk(){let n=[],i=0,a=h=>{h()},l=h=>{h()},u=ak;const f=h=>{i?n.push(h):u(()=>{a(h)})},d=()=>{const h=n;n=[],h.length&&u(()=>{l(()=>{h.forEach(p=>{a(p)})})})};return{batch:h=>{let p;i++;try{p=h()}finally{i--,i||d()}return p},batchCalls:h=>(...p)=>{f(()=>{h(...p)})},schedule:f,setNotifyFunction:h=>{a=h},setBatchNotifyFunction:h=>{l=h},setScheduler:h=>{u=h}}}const Un=lk();var ok=class extends Vu{#e=!0;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n(!0),a=()=>n(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",a)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#n=n,this.#t?.(),this.#t=n(this.setOnline.bind(this))}setOnline(n){this.#e!==n&&(this.#e=n,this.listeners.forEach(i=>{i(n)}))}isOnline(){return this.#e}};const Jf=new ok;function uk(n){return Math.min(1e3*2**n,3e4)}function Mx(n){return(n??"online")==="online"?Jf.isOnline():!0}var Mp=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function jx(n){let i=!1,a=0,l,u="pending",f,d;const h=new Promise((U,W)=>{f=U,d=W});h.catch(vi);const p=()=>u!=="pending",g=U=>{if(!p()){const W=new Mp(U);A(W),n.onCancel?.(W)}},b=()=>{i=!0},v=()=>{i=!1},w=()=>Sg.isFocused()&&(n.networkMode==="always"||Jf.isOnline())&&n.canRun(),T=()=>Mx(n.networkMode)&&n.canRun(),E=U=>{p()||(l?.(),u="resolved",f(U))},A=U=>{p()||(l?.(),u="rejected",d(U))},k=U=>new Promise(W=>{l=I=>{(p()||U())&&W(I)},n.onPause?.()}).then(()=>{l=void 0,p()||n.onContinue?.()}),L=()=>{if(p())return;let U;const W=a===0?n.initialPromise:void 0;try{U=W??n.fn()}catch(I){U=Promise.reject(I)}Promise.resolve(U).then(E).catch(I=>{if(p())return;const Q=n.retry??(_g()?0:3),V=n.retryDelay??uk,ne=typeof V=="function"?V(a,I):V,ie=Q===!0||typeof Q=="number"&&ap()||w()?void 0:k(w)).then(()=>{i?A(I):L()})})};return{promise:h,status:()=>u,cancel:g,continue:()=>(l?.(),h),cancelRetry:b,continueRetry:v,canStart:T,start:()=>(T()?L():k(T).then(L),h)}}var kx=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zx(this.gcTime)&&(this.#e=Ja.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(_g()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Ja.clearTimeout(this.#e),this.#e=void 0)}};function ck(n){return{onFetch:(i,a)=>{const l=i.options,u=i.fetchOptions?.meta?.fetchMore?.direction,f=i.state.data?.pages||[],d=i.state.data?.pageParams||[];let h={pages:[],pageParams:[]},p=0;const g=async()=>{let b=!1;const v=i,w=A=>{ik(A,()=>i.signal,()=>b=!0,v[bg])},T=Nx(i.options,i.fetchOptions),E=async(A,k,L)=>{if(b)return Promise.reject(i.signal.reason);if(k==null&&A.pages.length)return Promise.resolve(A);const W=(()=>{const ne={client:i.client,queryKey:i.queryKey,pageParam:k,direction:L?"backward":"forward",meta:i.options.meta};return w(ne),ne})(),I=await T(W),{maxPages:Q}=i.options,V=L?nk:tk;return{pages:V(A.pages,I,Q),pageParams:V(A.pageParams,k,Q)}};if(u&&f.length){const A=u==="backward",k=A?fk:n1,L={pages:f,pageParams:d};h=await E(L,k(l,L),A)}else{const A=n??f.length;do{const k=p===0?d[0]===void 0?l.initialPageParam:d[0]:n1(l,h);if(p>0&&k==null)break;h=await E(h,k),p++}while(pi.options.persister?.(g,{client:i.client,queryKey:i.queryKey,meta:i.options.meta,signal:i.signal},a):i.fetchFn=g}}}function n1(n,{pages:i,pageParams:a}){const l=i.length-1;return i.length>0?n.getNextPageParam(i[l],i,a[l],a):void 0}function fk(n,{pages:i,pageParams:a}){return i.length>0?n.getPreviousPageParam?.(i[0],i,a[0],a):void 0}var dk=class extends kx{#e;#t;#n;#i;#r;#s;#o;#f;#u;constructor(n){super(),this.#u=!1,this.#f=n.defaultOptions,this.setOptions(n.options),this.observers=[],this.#r=n.client,this.#i=this.#r.getQueryCache(),this.queryKey=n.queryKey,this.queryHash=n.queryHash,this.#t=s1(this.options),this.state=n.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#s?.promise}setOptions(n){if(this.options={...this.#f,...n},n?._type&&(this.#e=n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=s1(this.options);i.data!==void 0&&(this.setState(i1(i.data,i.dataUpdatedAt)),this.#t=i)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(n,i){const a=Ap(this.state.data,n,t)DELIM" +R"DELIM(his.options);return this.#l({data:a,type:"success",dataUpdatedAt:i?.updatedAt,manual:i?.manual}),a}setState(n){this.#l({type:"setState",state:n})}cancel(n){const i=this.#s?.promise;return this.#s?.cancel(n),i?i.then(vi).catch(vi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(n=>Rt(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yg||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data===void 0?!1:this.getObserversCount()>0?this.observers.some(n=>Rt(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!Ex(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(n=>n.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(n=>n.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){const i=this.observers.indexOf(n);i!==-1&&(this.observers.splice(i,1),this.observers.length||(this.#s&&(this.#u||this.state.fetchStatus==="paused"&&this.state.status==="pending"?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(n,i){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&i?.cancelRefetch)this.cancel({silent:!0});else if(this.#s&&this.#o)return this.#s.continueRetry(),this.#o}if(n&&this.setOptions(n),!this.options.queryFn){const g=this.observers.find(b=>b.options.queryFn);g&&this.setOptions(g.options)}const a=new AbortController,l=g=>{Object.defineProperties(g,{[bg]:{value:a.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#u=!0,a.signal)}})},u=()=>{const g=Nx(this.options,i),v=(()=>{const w={client:this.#r,queryKey:this.queryKey,meta:this.meta};return l(w),w})();return this.#u=!1,this.options.persister?this.options.persister(g,v,this):g(v)},d=(()=>{const g={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:u};return l(g),g})();(this.#e==="infinite"?ck(this.options.pages):this.options.behavior)?.onFetch(d,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==d.fetchOptions?.meta)&&this.#l({type:"fetch",meta:d.fetchOptions?.meta});const h=this.#s=jx({initialPromise:i?.initialPromise,fn:d.fetchFn,onCancel:g=>{g instanceof Mp&&g.revert&&this.setState({...this.#n,fetchStatus:"idle"}),a.abort()},onFail:(g,b)=>{this.#l({type:"failed",failureCount:g,error:b})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}),p=(async()=>{try{const g=await h.promise;if(g===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(g),this.#i.config.onSuccess?.(g,this),this.#i.config.onSettled?.(g,this.state.error,this),g}catch(g){if(g instanceof Mp){if(g.silent){if(this.#s!==h&&this.#o)return this.#o;throw g}else if(g.revert){if(this.state.data===void 0)throw g;return this.state.data}}throw this.#l({type:"error",error:g}),this.#i.config.onError?.(g,this),this.#i.config.onSettled?.(this.state.data,g,this),g}finally{this.#s===h&&(this.#s=void 0,this.#o=void 0),this.scheduleGc()}})();return this.#o=p,h.start(),p}#l(n){const i=a=>{switch(n.type){case"failed":return{...a,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...Rx(a.data,this.options),fetchMeta:n.meta??null};case"success":const l={...a,...i1(n.data,n.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=n.manual?l:void 0,l;case"error":const u=n.error;return{...a,error:u,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...n.state}}};this.state=i(this.state),Un.batch(()=>{this.observers.slice().forEach(a=>{a.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:n})})}};function Rx(n,i){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Mx(i.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function i1(n,i){return{data:n,dataUpdatedAt:i??Date.now(),error:null,isInvalidated:!1,status:"success"}}function s1(n){const i=typeof n.initialData=="function"?n.initialData():n.initialData,a=i!==void 0,l=a?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:i,dataUpdateCount:0,dataUpdatedAt:a?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var hk=class extends Vu{#e;#t=void 0;#n=void 0;#i=void 0;#r;#s;#o;#f;#u;#l;#x;#a;#m;#h=new Set;constructor(n,i){super(),this.options=i,this.#e=n,this.#o=null,this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),r1(this.#t,this.options)?this.#d():this.updateResult(),this.#z())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return jp(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return jp(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#E(),this.#t.removeObserver(this)}setOptions(n){const i=this.options,a=this.#t;if(this.options=this.#e.defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#g(),this.#t.setOptions(this.options),i._defaulted&&!tp(this.options,i)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const l=this.hasListeners();l&&a1(this.#t,a,this.options,i)&&this.#d(),this.updateResult(),l&&(this.#t!==a||Rt(this.options.enabled,this.#t)!==Rt(i.enabled,this.#t)||Rt(this.options.staleTime,this.#t)!==Rt(i.staleTime,this.#t))&&this.#p();const u=this.#w();l&&(this.#t!==a||Rt(this.options.enabled,this.#t)!==Rt(i.enabled,this.#t)||u!==this.#m)&&this.#N(u)}getOptimisticResult(n){const i=this.#e.getQueryCache().build(this.#e,n),a=this.createResult(i,n);return tp(this.getCurrentResult(),a)||(this.#i=a,this.#s=this.options,this.#r=this.#t.state),a}getCurrentResult(){return this.#i}trackResult(n,i){return new Proxy(n,{get:(a,l)=>(this.trackProp(l),i?.(l),Reflect.get(a,l))})}trackProp(n){this.#h.add(n)}getCurrentQuery(){return this.#t}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const i=this.#e.defaultQueryOptions(n),a=this.#e.getQueryCache().build(this.#e,i);let l=()=>{},u;const f=new Promise(d=>{u=d,l=this.#e.getQueryCache().subscribe(h=>{h.type==="updated"&&h.query.queryHash===a.queryHash&&a.state.data!==void 0&&(l(),d(this.createResult(a,i)))})});return Promise.race([a.fetch(i).then(()=>{const d=this.cre)DELIM" +R"DELIM(ateResult(a,i);return u?.(d),d}).finally(()=>{l()}),f])}fetch(n){return this.#d({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#d(n){this.#g();let i=this.#t.fetch(this.options,n);return n?.throwOnError||(i=i.catch(vi)),i}#v(n){return!_g()&&Rt(this.options.enabled,this.#t)!==!1&&zx(n)}#p(){this.#y();const n=Rt(this.options.staleTime,this.#t);if(this.#i.isStale||!this.#v(n))return;const i=Ex(this.#i.dataUpdatedAt,n)+1;this.#x=Ja.setTimeout(()=>{this.#i.isStale||this.updateResult()},i)}#w(){return Rt(this.options.refetchInterval,this.#t)??!1}#N(n){this.#E(),this.#m=n,!(this.#m===0||!this.#v(this.#m))&&(this.#a=Ja.setInterval(()=>{(this.options.refetchIntervalInBackground||Sg.isFocused())&&this.#d()},this.#m))}#z(){this.#p(),this.#N(this.#w())}#y(){this.#x!==void 0&&(Ja.clearTimeout(this.#x),this.#x=void 0)}#E(){this.#a!==void 0&&(Ja.clearInterval(this.#a),this.#a=void 0)}createResult(n,i){const a=this.#t,l=this.options,u=this.#i,f=this.#r,d=this.#s,h=n!==a?n.state:this.#n,{state:p}=n;let g={...p},b=!1,v;if(i._optimisticResults){const Q=this.hasListeners(),V=!Q&&r1(n,i),ne=Q&&a1(n,a,i,l);(V||ne)&&(g={...g,...Rx(p.data,n.options)}),i._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:w,errorUpdatedAt:T,status:E}=g;v=g.data;let A=!1;if(i.placeholderData!==void 0&&v===void 0&&E==="pending"){let Q;u?.isPlaceholderData&&i.placeholderData===d?.placeholderData?(Q=u.data,A=!0):Q=typeof i.placeholderData=="function"?i.placeholderData(this.#l?.state.data,this.#l):i.placeholderData,Q!==void 0&&(E="success",v=Ap(u?.data,Q,i),b=!0)}if(i.select&&v!==void 0&&!A)if(u&&v===f?.data&&i.select===this.#f)v=this.#u;else try{this.#f=i.select,v=i.select(v),v=Ap(u?.data,v,i),this.#u=v,this.#o=null}catch(Q){this.#o=Q}else v===void 0&&(this.#o=null);this.#o&&(w=this.#o,v=this.#u,T=u?.error===w?u.errorUpdatedAt:Date.now(),E="error",b=!1);const k=g.fetchStatus==="fetching",L=E==="pending",U=E==="error",W=L&&k,I=v!==void 0;return{status:E,fetchStatus:g.fetchStatus,isPending:L,isSuccess:E==="success",isError:U,isInitialLoading:W,isLoading:W,data:v,dataUpdatedAt:g.dataUpdatedAt,error:w,errorUpdatedAt:T,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:k,isRefetching:k&&!L,isLoadingError:U&&!I,isPaused:g.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:U&&I,isStale:xg(n,i),refetch:this.refetch,isEnabled:Rt(i.enabled,n)!==!1}}updateResult(){const n=this.#i,i=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#s=this.options,this.#r.data!==void 0&&(this.#l=this.#t),tp(i,n))return;this.#i=i;const l=(()=>{if(!n)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!this.#h.size||this.options.throwOnError&&this.#i.error!==n.error)return!0;for(const d of f??this.#h)if(this.#i[d]!==n[d])return!0;return!1})();Un.batch(()=>{l&&this.listeners.forEach(u=>{u(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#g(){const n=this.#e.getQueryCache().build(this.#e,this.options);if(n===this.#t)return;const i=this.#t;this.#t=n,this.#n=n.state,this.hasListeners()&&(i?.removeObserver(this),n.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#z()}};function mk(n,i){return Rt(i.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&Rt(i.retryOnMount,n)===!1)}function r1(n,i){return mk(n,i)||n.state.data!==void 0&&jp(n,i,i.refetchOnMount)}function jp(n,i,a){if(Rt(i.enabled,n)!==!1&&Rt(i.staleTime,n)!=="static"){const l=Rt(a,n);return l==="always"||l!==!1&&xg(n,i)}return!1}function a1(n,i,a,l){return(n!==i||Rt(l.enabled,n)===!1)&&(!a.suspense||n.state.status!=="error")&&xg(n,a)}function xg(n,i){return Rt(i.enabled,n)!==!1&&n.isStaleByTime(Rt(i.staleTime,n))}var pk=class extends kx{#e;#t;#n;#i;constructor(n){super(),this.#e=n.client,this.mutationId=n.mutationId,this.#n=n.mutationCache,this.#t=[],this.state=n.state||gk(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){this.#t.includes(n)||(this.#t.push(n),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){this.#t=this.#t.filter(i=>i!==n),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(n){const i=()=>{this.#r({type:"continue"})},a={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},l=this.#i=jx({fn:()=>this.options.mutationFn?this.options.mutationFn(n,a):Promise.reject(new Error("No mutationFn found")),onFail:(d,h)=>{this.#r({type:"failed",failureCount:d,error:h})},onPause:()=>{this.#r({type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),u=this.state.status==="pending",f=!l.canStart();try{if(u)i();else{this.#r({type:"pending",variables:n,isPaused:f}),this.#n.config.onMutate&&await this.#n.config.onMutate(n,this,a);const h=await this.options.onMutate?.(n,a);h!==this.state.context&&this.#r({type:"pending",context:h,variables:n,isPaused:f})}this.state.isPaused&&l.canStart()&&i();const d=await l.start();return await this.#n.config.onSuccess?.(d,n,this.state.context,this,a),await this.options.onSuccess?.(d,n,this.state.context,a),await this.#n.config.onSettled?.(d,null,this.state.variables,this.state.context,this,a),await this.options.onSettled?.(d,null,n,this.state.context,a),this.#r({type:"success",data:d}),d}catch(d){try{await this.#n.config.onError?.(d,n,this.state.context,this,a)}catch(h){Promise.reject(h)}try{await this.options.onError?.(d,n,this.state.context,a)}catch(h){Promise.reject(h)}try{await this.#n.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,a)}catch(h){Promise.reject(h)}try{await this.options.onSettled?.(void 0,d,n,this.state.context,a)}catch(h){Promise.reject(h)}throw this.#r({type:"error",error:d}),d}finally{this.#i===l&&(this.#i=void 0),this.#n.runNext(this)}}#r(n){const i=a=>{switch(n.type){case"failed":return{...a,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...a,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:n.error,failureCount:a.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=i(this.state),Un.batch(()=>{this.#t.forEach(a=>{a.onMutationUpdate(n)}),this.#n.notify({mutation:this,type:"updated",action:n})})}};function gk(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var vk=class extends Vu{#e;#t;#n;constructor(n={}){super(),this.config=n,this.#e=new Set,this.#t=new Map,this.#n=0}build(n,i,a){const l=new pk({client:n,mutationCache:this,mutationId:++this.#n,options:n.defaultMutationOptions(i),state:a});return this.add(l),l}add(n){this.#e.add(n);const i=Nf(n);if(typeof i=="string"){const a=this.#t.get(i);a?a.push(n):this.#t.set(i,[n])}this.notify({type:"added",mutation:n})}remove(n){if(this.#e.delete(n)){const i=Nf(n);if(typeof i=="string"){const a=this.#t.get(i);if(a)if(a.length>1){const l=a.indexOf(n);l!==-1&&a.splice(l,1)}else a[0]===n&&this.#t.delete(i)}}this.notify({type:"remo)DELIM" +R"DELIM(ved",mutation:n})}canRun(n){const i=Nf(n);if(typeof i=="string"){const a=this.#t.get(i)?.find(l=>l.state.status==="pending");return!a||a===n}else return!0}runNext(n){const i=Nf(n);return typeof i=="string"?this.#t.get(i)?.find(a=>a!==n&&a.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Un.batch(()=>{const n=this.getAll();this.#e.clear(),this.#t.clear(),n.forEach(i=>{this.notify({type:"removed",mutation:i})})})}getAll(){return Array.from(this.#e)}find(n){const i={exact:!0,...n};return this.getAll().find(a=>W_(i,a))}findAll(n={}){return this.getAll().filter(i=>W_(n,i))}notify(n){Un.batch(()=>{this.listeners.forEach(i=>{i(n)})})}resumePausedMutations(){const n=this.getAll().filter(i=>i.state.isPaused);return Un.batch(()=>Promise.all(n.map(i=>i.continue().catch(vi))))}};function Nf(n){return n.options.scope?.id}var yk=class extends Vu{#e;constructor(n={}){super(),this.config=n,this.#e=new Map}build(n,i,a){const l=i.queryKey,u=i.queryHash??vg(l,i);let f=this.get(u);return f||(f=new dk({client:n,queryKey:l,queryHash:u,options:n.defaultQueryOptions(i),state:a,defaultOptions:n.getQueryDefaults(l)}),this.add(f)),f}add(n){this.#e.has(n.queryHash)||(this.#e.set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){this.#e.get(n.queryHash)===n&&(n.destroy(),this.#e.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){Un.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return this.#e.get(n)}getAll(){return[...this.#e.values()]}find(n){const i={exact:!0,...n};return this.getAll().find(a=>X_(i,a))}findAll(n={}){const i=this.getAll();return Object.keys(n).length>0?i.filter(a=>X_(n,a)):i}notify(n){Un.batch(()=>{this.listeners.forEach(i=>{i(n)})})}onFocus(){Un.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){Un.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},bk=class{#e;#t;#n;#i;#r;#s;#o;#f;constructor(n={}){this.#e=n.queryCache||new yk,this.#t=n.mutationCache||new vk,this.#n=n.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#o=Sg.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#f=Jf.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#o?.(),this.#o=void 0,this.#f?.(),this.#f=void 0)}isFetching(n){return this.#e.findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return this.#t.findAll({...n,status:"pending"}).length}getQueryData(n){const i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state.data}ensureQueryData(n){const i=this.defaultQueryOptions(n),a=this.#e.build(this,i),l=a.state.data;return l===void 0?this.fetchQuery(n):(n.revalidateIfStale&&a.isStaleByTime(Rt(i.staleTime,a))&&this.prefetchQuery(i),Promise.resolve(l))}getQueriesData(n){return this.#e.findAll(n).map(({queryKey:i,state:a})=>[i,a.data])}setQueryData(n,i,a){const l=this.defaultQueryOptions({queryKey:n}),u=this.#e.get(l.queryHash)?.state.data,f=Wj(i,u);if(f!==void 0)return this.#e.build(this,l).setData(f,{...a,manual:!0})}setQueriesData(n,i,a){return Un.batch(()=>this.#e.findAll(n).map(({queryKey:l})=>[l,this.setQueryData(l,i,a)]))}getQueryState(n){const i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state}removeQueries(n){const i=this.#e;Un.batch(()=>{i.findAll(n).forEach(a=>{i.remove(a)})})}resetQueries(n,i){const a=this.#e;return Un.batch(()=>{const l=a.findAll(n),u=new Set(l);return l.forEach(f=>{f.reset()}),this.refetchQueries({type:"active",predicate:f=>u.has(f)},i)})}cancelQueries(n,i={}){const a={revert:!0,...i},l=Un.batch(()=>this.#e.findAll(n).map(u=>u.cancel(a)));return Promise.all(l).then(vi).catch(vi)}invalidateQueries(n,i={}){return Un.batch(()=>(this.#e.findAll(n).forEach(a=>{a.invalidate()}),n?.refetchType==="none"?Promise.resolve():this.refetchQueries({...n,type:n?.refetchType??n?.type??"active"},i)))}refetchQueries(n,i={}){const a={...i,cancelRefetch:i.cancelRefetch??!0},l=Un.batch(()=>this.#e.findAll(n).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let f=u.fetch(void 0,a);const d=u.state.fetchStatus==="paused";return(!a.throwOnError||d)&&(f=f.catch(vi)),d?Promise.resolve():f}));return Promise.all(l).then(vi)}async query(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const a=this.#e.build(this,i),l=a.isStaleByTime(Rt(i.staleTime,a))?await a.fetch(i):a.state.data,u=i.select;return u?u(l):l}fetchQuery(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const a=this.#e.build(this,i);return a.isStaleByTime(Rt(i.staleTime,a))?a.fetch(i):Promise.resolve(a.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(vi).catch(vi)}infiniteQuery(n){return n._type="infinite",this.query(n)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(vi).catch(vi)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return Jf.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(n){this.#n=n}setQueryDefaults(n,i){this.#i.set(qu(n),{queryKey:n,defaultOptions:i})}getQueryDefaults(n){const i=[...this.#i.values()],a={};return i.forEach(l=>{ho(n,l.queryKey)&&Object.assign(a,l.defaultOptions)}),a}setMutationDefaults(n,i){this.#r.set(qu(n),{mutationKey:n,defaultOptions:i})}getMutationDefaults(n){const i=[...this.#r.values()],a={};return i.forEach(l=>{ho(n,l.mutationKey)&&Object.assign(a,l.defaultOptions)}),a}defaultQueryOptions(n){if(n._defaulted)return n;const i={...this.#n.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return i.queryHash||(i.queryHash=vg(i.queryKey,i)),i.refetchOnReconnect===void 0&&(i.refetchOnReconnect=i.networkMode!=="always"),i.throwOnError===void 0&&(i.throwOnError=!!i.suspense),!i.networkMode&&i.persister&&(i.networkMode="offlineFirst"),i.queryFn===yg&&(i.enabled=!1),i}defaultMutationOptions(n){return n?._defaulted?n:{...this.#n.mutations,...n?.mutationKey&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const Cx=le.createContext(!1),_k=()=>le.useContext(Cx);Cx.Provider;function Sk(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}const xk=le.createContext(Sk()),wk=()=>le.useContext(xk),zk=(n,i,a)=>{const l=a?.state.status==="error"&&typeof n.throwOnError=="function"?Ax(n.throwOnError,[a.state.error,a]):n.throwOnError;(n.suspense||l)&&(i.isReset()||(n.retryOnMount=!1))},Ek=n=>{le.useEffect(()=>{n.clearReset()},[n])},Tk=({result:n,errorResetBoundary:i,throwOnError:a,query:l,suspense:u})=>n.isError&&!i.isReset()&&!n.isFetching&&l&&(u&&n.data===void 0||Ax(a,[n.error,l])),Ok=n=>{if(n.suspense){const a=u=>u==="static"?u:Math.max(u??1e3,1e3),l=n.staleTime;n.staleTime=typeof l=="function"?(...u)=>a(l(...u)):a(l),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},Nk=(n,i)=>n?.suspense&&i.isPending,Ak=(n,i,a)=>i.fetchOptimistic(n).catch(()=>{a.clearReset()});function Mk(n,i,a){const l=_k(),u=wk(),f=Gj(),d=f.defaultQueryOptions(n),h=f.getQueryCache().get(d.queryHash),p=n.subscribed!==!1;d._optimisticResults=l?"isRestoring":p?"optimistic":void 0,Ok(d),zk(d,u,h),Ek(u);const[g]=le.useState(()=>new i(f,d)),b=g.getOptimisticResult(d);le.useEffect(()=>{g.setOptions(d)},[d,g]);const v=!l&&p;if(le.useSyncExternalStore(le.useCallback(w=>{const T=v?g.subscribe(Un.batchCalls(w)):vi;return g.updateResult(),T},[g,v]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),Nk(d,b))throw Ak(d,g,u);if(Tk({result:b,errorResetBoundary:u,throwOnError:d.throwOnError,query:h,suspense:d.suspense}))throw b.error;return d.notifyOnChangeProps?b:g.trackResult(b)}function l1(n,i){return Mk(n,hk)}function jk(n,i,a,l=no){const u=le.useSyncExternalStore(a.subscribeStatus,a.getStatus,a.getStatus);return le.useEffect(()=>{a.configure(n,i,l)})DELIM" +R"DELIM(,[n,i,a,l]),le.useEffect(()=>(a.start(),()=>{a.stop()}),[a]),u}function kk(n,i,a){const l=le.useMemo(()=>n3(n),[n]),u=le.useSyncExternalStore(i.subscribeNative,i.getNativeStatus,i.getNativeStatus),f=le.useSyncExternalStore(i.subscribeNative,i.getNativeLive,i.getNativeLive),d=Dx(u,f,a),h=l1({queryKey:["native-snapshot",n],queryFn:({signal:w})=>c3(n,w),enabled:l&&!d,refetchInterval:_x,retry:!1}),p=Rk(u,f,h.data??null,a),g=o1(u,f,null,a),b=l1({queryKey:["native-fees",n],queryFn:({signal:w})=>d3(n,w),enabled:l&&g===null,refetchInterval:u3,retry:!1}),v=o1(u,f,b.data??null,a);return le.useEffect(()=>{v!==null&&i.recordNativeFees(v.data,v.receivedAt)},[v,i]),le.useEffect(()=>{p.top!==null&&i.recordNativeTop(p.top,p.receivedAt??Date.now())},[i,p.receivedAt,p.top]),{status:u,live:f,...p,restError:h.error instanceof Error?h.error.message:null}}function Dx(n,i,a){return n.phase==="connected"&&i.tops!==null&&i.topReceivedAt!==null&&i.configuration!==null&&i.configurationReceivedAt!==null&&kp(i.topReceivedAt,a)}function Rk(n,i,a,l){return Dx(n,i,l)&&i.tops!==null?{top:i.tops.confirmed.height,tops:i.tops,branch:i.branchReceivedAt!==null&&kp(i.branchReceivedAt,l)?i.branch:null,tip:i.tip,configuration:i.configuration,receivedAt:i.topReceivedAt,transport:"websocket"}:a&&kp(a.receivedAt,l)?{top:a.tops.confirmed.height,tops:a.tops,branch:a.branch,tip:null,configuration:a.configuration,receivedAt:a.receivedAt,transport:"rest"}:{top:null,tops:null,branch:null,tip:null,configuration:null,receivedAt:null,transport:"none"}}function o1(n,i,a,l){return n.phase==="connected"&&i.fees!==null&&l-i.fees.receivedAtnew Vj,[]),i=MS(),[a]=le.useState(i3),[l,u]=le.useState("overview"),[f,d]=le.useState(!1),[h,p]=le.useState(Pj),[g,b]=le.useState(!1),[v,w]=le.useState(!1),[T,E]=le.useState(Fz),A=le.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot),k=jk(a.adminUrl,a.nativeUrl,n,h),L=kk(a.nativeUrl,n,i),U=L.configuration?`${cS(L.configuration.forks)} ${L.configuration.node.network}`:" ",W=I3(L.tops,L.branch,A.syncFill,L.receivedAt,L.tip,i);function I(V){Qz(V),E(V)}function Q(V){Kj(V),p(V)}return x.jsxs("div",{className:"bg-background text-textPrimary min-h-screen",children:[x.jsx("header",{className:"border-accent/30 bg-surface/90 border-b backdrop-blur",children:x.jsx("div",{className:"mx-auto max-w-7xl px-4 py-4",children:x.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-4",children:[x.jsxs("div",{className:"order-1 flex flex-col",children:[x.jsx("button",{type:"button",onClick:()=>{u("overview")},className:"text-accent text-left text-lg font-semibold tracking-tight",children:"Libbitcoin Server"}),x.jsx("span",{className:"text-textMuted text-sm",children:U})]}),x.jsx("nav",{className:"text-textMuted order-3 flex w-full items-center gap-3 text-sm md:order-2 md:w-auto",children:Ck.map(V=>x.jsxs("button",{type:"button",onClick:()=>{u(V.id)},className:`text-textMuted hover:text-accent rounded-md px-3 py-1 text-sm transition ${l===V.id?"bg-accentSecondary/20 text-accent":""}`,children:[V.label,V.id==="logs"&&A.totalLogs>0&&x.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:A.totalLogs>999?"999+":String(A.totalLogs)}),V.id==="events"&&A.totalEvents>0&&x.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:A.totalEvents>999?"999+":String(A.totalEvents)})]},V.id))}),x.jsx("div",{className:"order-2 ml-auto flex items-center gap-3 md:order-3",children:x.jsx("button",{type:"button",onClick:()=>{d(!0)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:"Settings"})})]})})}),x.jsxs("main",{className:"mx-auto min-h-[calc(100vh-4rem)] max-w-7xl min-w-0 space-y-6 px-4 py-8",children:[x.jsxs("header",{children:[x.jsx("p",{className:"text-accentSecondary text-sm tracking-wide uppercase",children:"Administration"}),x.jsx("h1",{className:"text-accent text-3xl font-semibold",children:"Admin Dashboard"})]}),l==="overview"&&x.jsx(Rj,{adminStatus:k,endpoints:a,metrics:A,native:L,sync:W}),l==="logs"&&x.jsx(QA,{metrics:n,delivery:A,status:k,logFilter:h,paused:g,onLogFilterChange:Q,onPausedChange:V=>{n.setLogsPaused(V),b(V)},onClear:()=>{n.clearLogs()}}),l==="events"&&x.jsx(YA,{metrics:n,paused:v,onPausedChange:V=>{n.setEventsPaused(V),w(V)},onClear:()=>{n.clearEvents()}})]}),x.jsx(Lj,{sync:W,browserNotificationsEnabled:T}),f&&x.jsx(Xz,{browserNotificationsEnabled:T,onClose:()=>{d(!1)},onBrowserNotificationsEnabledChange:I})]})}function Uk({children:n}){const[i]=le.useState(()=>new bk({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:1}}}));return x.jsx(Yj,{client:i,children:n})}qz();(window.location.pathname!=="/"||window.location.search||window.location.hash)&&window.history.replaceState(null,"","/");const Ux=document.querySelector("#root");if(!Ux)throw new Error("Root element not found");Hz.createRoot(Ux).render(x.jsx(kz.StrictMode,{children:x.jsx(Uk,{children:x.jsx(Dk,{})})})); )DELIM" ) diff --git a/web/admin_dashboard/src/app/app.tsx b/web/admin_dashboard/src/app/app.tsx index 1e7d7826..a0584548 100644 --- a/web/admin_dashboard/src/app/app.tsx +++ b/web/admin_dashboard/src/app/app.tsx @@ -51,7 +51,14 @@ export function App() { const network = native.configuration ? `${coinOf(native.configuration.forks)} ${native.configuration.node.network}` : ' '; - const sync = chainSync(native.tops, native.branch); + const sync = chainSync( + native.tops, + native.branch, + snapshot.syncFill, + native.receivedAt, + native.tip, + now + ); function updateBrowserNotifications(enabled: boolean) { saveBrowserNotificationsEnabled(enabled); diff --git a/web/admin_dashboard/src/components/log-view.tsx b/web/admin_dashboard/src/components/log-view.tsx index 57fa78f9..0cc4f26b 100644 --- a/web/admin_dashboard/src/components/log-view.tsx +++ b/web/admin_dashboard/src/components/log-view.tsx @@ -109,14 +109,18 @@ export function LogView({

{LOG_LEVELS.map((item) => ( -
@@ -55,12 +86,12 @@ export function NodeSyncProgress({ sync }: NodeSyncProgressProps) { value={formatInteger(sync.confirmed.height)} hash={sync.confirmed.hash} /> + -
{sync.diverged && (

@@ -72,6 +103,95 @@ export function NodeSyncProgress({ sync }: NodeSyncProgressProps) { ); } +const FILL_LAYERS = [ + { label: 'Confirmed', color: 2 }, + { label: 'Validated', color: 1 }, + { label: 'Archived', color: 0 }, + { label: 'Headers', color: 3 }, +] as const; + +type FillLayer = (typeof FILL_LAYERS)[number]['label']; + +// Headers and confirmed are contiguous, so each is solid to its frontier. +// Archived and validated heights arrive out of order, so each bin with any +// reported height is filled. Layers are opaque, each drawn over those it +// implies. A focused layer is drawn alone. +function FillBar({ + fill, + confirmed, + candidate, + estimatedTop, + focus, +}: { + fill: SyncFill | null; + confirmed: number; + candidate: number; + estimatedTop: number; + focus: FillLayer | null; +}) { + const canvasReference = useRef(null); + const activeTheme = useTheme(); + + useEffect(() => { + const canvas = canvasReference.current; + if (!canvas) return; + + const draw = () => { + const ratio = window.devicePixelRatio || 1; + const width = Math.max(1, Math.round(canvas.clientWidth * ratio)); + const height = Math.max(1, Math.round(canvas.clientHeight * ratio)); + if (canvas.width !== width) canvas.width = width; + if (canvas.height !== height) canvas.height = height; + const context = canvas.getContext('2d'); + if (!context) return; + + const style = getComputedStyle(canvas); + const color = (index: number) => chartColor(CHART_COLORS[index] ?? '', style); + const headers = Math.max(candidate, fill?.headers ?? 0); + const top = Math.max(headers, estimatedTop); + const scale = top > 0 ? width / top : 0; + context.clearRect(0, 0, width, height); + + const shade = (bins: Uint8Array, color: string) => { + if (!fill || scale === 0) return; + const span = fill.height + 1; + context.fillStyle = color; + for (let bin = 0; bin < bins.length; bin++) { + const value = bins[bin] ?? 0; + if (value === 0) continue; + const first = Math.floor((bin * span) / bins.length); + const last = Math.floor(((bin + 1) * span) / bins.length); + const left = first * scale; + const right = Math.max(left + 1, Math.min(width, last * scale)); + if (left >= width) break; + context.fillRect(left, 0, right - left, height); + } + }; + + const shown = (layer: FillLayer) => focus === null || focus === layer; + if (shown('Headers')) { + context.fillStyle = color(3); + context.fillRect(0, 0, Math.min(width, headers * scale), height); + } + if (fill && shown('Archived')) shade(fill.archived, color(0)); + if (fill && shown('Validated')) shade(fill.validated, color(1)); + if (shown('Confirmed')) { + context.fillStyle = color(2); + context.fillRect(0, 0, Math.min(width, confirmed * scale), height); + } + }; + + draw(); + const observer = new ResizeObserver(draw); + observer.observe(canvas); + return () => { + observer.disconnect(); + }; + }, [fill, confirmed, candidate, estimatedTop, focus, activeTheme]); + + return ; +} + function SyncValue({ label, value, hash }: { label: string; value: string; hash?: string }) { return (

diff --git a/web/admin_dashboard/src/components/overview.tsx b/web/admin_dashboard/src/components/overview.tsx index 5eed36aa..3aec8e2e 100644 --- a/web/admin_dashboard/src/components/overview.tsx +++ b/web/admin_dashboard/src/components/overview.tsx @@ -39,9 +39,11 @@ export function Overview({ adminStatus, endpoints, metrics, native, sync }: Over const configuration = native.configuration; const coin = coinOf(configuration?.forks ?? []); const connection = combineStatus(adminStatus, native.status); + // Admin and native share one socket when their endpoints match. + const shared = endpoints.adminUrl === endpoints.nativeUrl; const warnings = [ - adminStatus.error ? `Admin: ${adminStatus.error}` : null, - native.status.error ? `Native: ${native.status.error}` : null, + adminStatus.error ? `${shared ? 'Connection' : 'Admin'}: ${adminStatus.error}` : null, + native.status.error && !shared ? `Native: ${native.status.error}` : null, native.transport === 'none' && native.restError ? `Native REST: ${native.restError}` : null, metrics.invalidFrames > 0 ? `${String(metrics.invalidFrames)} malformed admin frame${metrics.invalidFrames === 1 ? '' : 's'} ignored` diff --git a/web/admin_dashboard/src/components/sync-status-notifier.tsx b/web/admin_dashboard/src/components/sync-status-notifier.tsx index eae560c4..77d72f60 100644 --- a/web/admin_dashboard/src/components/sync-status-notifier.tsx +++ b/web/admin_dashboard/src/components/sync-status-notifier.tsx @@ -20,7 +20,8 @@ const NOTICE_DURATION_MS = 8_000; export function SyncStatusNotifier({ sync, browserNotificationsEnabled }: SyncStatusNotifierProps) { const previousStateReference = useRef(null); const [notice, setNotice] = useState(null); - const blocksRemaining = sync?.blocksRemaining ?? null; + const atGenesis = sync !== null && sync.candidate.height === 0; + const blocksRemaining = atGenesis ? null : (sync?.blocksRemaining ?? null); useEffect(() => { const next = currentSyncState(blocksRemaining); diff --git a/web/admin_dashboard/src/components/telemetry-dashboard.tsx b/web/admin_dashboard/src/components/telemetry-dashboard.tsx index b75b7cd7..8f50baa7 100644 --- a/web/admin_dashboard/src/components/telemetry-dashboard.tsx +++ b/web/admin_dashboard/src/components/telemetry-dashboard.tsx @@ -252,16 +252,16 @@ function TelemetryChartCard({ {isTimeSeriesChart(chart) && selected ? `${unitLabel(selected.unit)} · ${rangeLabels[chart.range]} · ${chart.visualization}` : 'Virtual size by fee-rate group · latest snapshot'} - {chart.scale === 'compressed' ? ' · compressed scale' : ''} + {chart.scale === 'compressed' ? ' · log scale' : ''} {pausedSnapshot ? ' · paused' : ''}

- ← + ↑ - → + ↓ Delete @@ -344,7 +344,7 @@ function TelemetryChartCard({
{chart.scale === 'compressed' && (

- Log-like Y axis · peaks compressed · labels and hover values show original measurements. + Log Y axis · labels and hover values show original measurements.

)} {isTimeSeriesChart(chart) && chart.series.some((item) => item.signalId === 'event:10') && ( diff --git a/web/admin_dashboard/src/components/time-series-chart.tsx b/web/admin_dashboard/src/components/time-series-chart.tsx index d156a0cf..06d518bd 100644 --- a/web/admin_dashboard/src/components/time-series-chart.tsx +++ b/web/admin_dashboard/src/components/time-series-chart.tsx @@ -44,6 +44,7 @@ export function TimeSeriesChart({ const chartReference = useRef(null); const isZoomedReference = useRef(false); const zoomReference = useRef<{ min: number; max: number } | null>(null); + const visibilityReference = useRef(new Map()); const normalizedData = useMemo(() => ensureTwoPoints(data), [data]); const latestDataReference = useRef(normalizedData); const hasData = !forceEmpty && data[0]?.length > 0; @@ -58,13 +59,14 @@ export function TimeSeriesChart({ const theme = getComputedStyle(container); const axisFont = `12px ${theme.fontFamily}`; + const labels: HTMLSpanElement[] = []; const options: uPlot.Options = { width: Math.max(240, container.clientWidth), height, padding: [12, 8, 0, 0], cursor: { drag: { x: true, y: false, setScale: true }, - focus: { prox: 24 }, + focus: { prox: 8 }, }, hooks: { setSelect: [ @@ -72,10 +74,19 @@ export function TimeSeriesChart({ if (chart.select.width > 0) isZoomedReference.current = true; }, ], + setCursor: [(chart) => placeValueLabels(chart, labels, valueFormatter, valueSuffix)], + setSeries: [ + (chart, index) => { + const item = index === null ? undefined : chart.series[index]; + if (typeof item?.label === 'string') { + visibilityReference.current.set(item.label, item.show !== false); + } + }, + ], }, legend: { show: true, - live: true, + live: false, }, scales: { x: { time: true }, @@ -88,17 +99,19 @@ export function TimeSeriesChart({ asinh: 1, ...(zeroBased ? { - range: (_self: uPlot, minimum: number, maximum: number) => [ - Math.min(0, minimum), - maximum === 0 ? 1 : maximum * 1.08, - ], + range: (_self: uPlot, minimum: number | null, maximum: number | null) => + minimum === null || maximum === null + ? [0, 1] + : [Math.min(0, minimum), maximum === 0 ? 1 : maximum * 1.08], } : { - range: (_self: uPlot, minimum: number, maximum: number) => { + range: (_self: uPlot, minimum: number | null, maximum: number | null) => { + if (minimum === null || maximum === null) return [0, 1]; const span = maximum - minimum; const padding = span === 0 ? Math.max(1, Math.abs(maximum) * 0.0005) : span * 0.08; - return [minimum - padding, maximum + padding]; + const floor = minimum - padding; + return [minimum >= 0 ? Math.max(0, floor) : floor, maximum + padding]; }, }), }, @@ -140,6 +153,7 @@ export function TimeSeriesChart({ : undefined; return { label: item.label, + show: visibilityReference.current.get(item.label) ?? true, stroke: color, fill: visualization === 'area' || visualization === 'bar' @@ -148,14 +162,24 @@ export function TimeSeriesChart({ width: item.width ?? 2, paths, points: { show: visualization === 'line' ? (item.points ?? false) : false }, - value: (_self: uPlot, value: number | null) => - value === null ? '—' : `${valueFormatter(value)}${valueSuffix}`, }; }), ], }; const chart = new uPlot(options, latestDataReference.current, container); + chart.root.querySelectorAll('.u-legend .u-label').forEach((label) => { + const item = series.find((candidate) => candidate.label === label.textContent); + if (item) label.style.color = chartColor(item.color, theme); + }); + for (const item of series) { + const label = document.createElement('span'); + label.className = + 'pointer-events-none absolute z-20 hidden whitespace-nowrap text-xs font-semibold'; + label.style.color = chartColor(item.color, theme); + chart.over.appendChild(label); + labels.push(label); + } const zoom = zoomReference.current; if (zoom) chart.setScale('x', zoom); chartReference.current = chart; @@ -182,7 +206,7 @@ export function TimeSeriesChart({ const shouldResetScales = !isZoomedReference.current; chart.setData(normalizedData, shouldResetScales); - if (!shouldResetScales) chart.redraw(); + if (!shouldResetScales && chart.status === 1) chart.redraw(); }, [normalizedData]); return ( @@ -197,6 +221,31 @@ export function TimeSeriesChart({ ); } +function placeValueLabels( + chart: uPlot, + labels: readonly HTMLSpanElement[], + formatter: (value: number) => string, + suffix: string +) { + const { idx, left } = chart.cursor; + const width = chart.over.clientWidth; + labels.forEach((label, index) => { + const series = chart.series[index + 1]; + const value = idx == null ? null : chart.data[index + 1]?.[idx]; + if (left == null || left < 0 || series?.show === false || value == null) { + label.classList.add('hidden'); + return; + } + + const flip = left > width - 96; + label.textContent = `${formatter(value)}${suffix}`; + label.style.left = `${String(flip ? left - 8 : left + 8)}px`; + label.style.top = `${String(chart.valToPos(value, 'y'))}px`; + label.style.transform = `translate(${flip ? '-100%' : '0'}, -100%)`; + label.classList.remove('hidden'); + }); +} + function groupedBarPaths(seriesIndex: number, seriesCount: number) { const count = Math.max(1, seriesCount); diff --git a/web/admin_dashboard/src/index.css b/web/admin_dashboard/src/index.css index 7361e499..478446f7 100644 --- a/web/admin_dashboard/src/index.css +++ b/web/admin_dashboard/src/index.css @@ -26,6 +26,11 @@ body { .uplot .u-legend .u-series { padding: 0.2rem 0.45rem; + opacity: 1 !important; +} + +.uplot .u-legend .u-marker { + display: none; } .uplot .u-select { diff --git a/web/admin_dashboard/src/lib/admin-contract.ts b/web/admin_dashboard/src/lib/admin-contract.ts index 2713f8b2..535b72f4 100644 --- a/web/admin_dashboard/src/lib/admin-contract.ts +++ b/web/admin_dashboard/src/lib/admin-contract.ts @@ -1,17 +1,24 @@ import { z } from 'zod'; -export const LOG_LEVELS = [ +interface LogLevel { + id: number; + name: string; + label: string; + disabled?: boolean; +} + +// Disabled levels are shown but never requested from the server. +export const LOG_LEVELS: readonly LogLevel[] = [ { id: 0, name: 'application', label: 'Application' }, { id: 1, name: 'news', label: 'News' }, { id: 2, name: 'session', label: 'Session' }, { id: 3, name: 'protocol', label: 'Protocol' }, - { id: 4, name: 'proxy', label: 'Proxy' }, + { id: 4, name: 'proxy', label: 'Proxy', disabled: true }, { id: 5, name: 'remote', label: 'Remote' }, { id: 6, name: 'fault', label: 'Fault' }, { id: 7, name: 'quitting', label: 'Quitting' }, - { id: 8, name: 'objects', label: 'Objects' }, - { id: 9, name: 'verbose', label: 'Verbose' }, -] as const; + { id: 9, name: 'verbose', label: 'Verbose', disabled: true }, +]; export type EventCategory = 'headers' | 'blocks' | 'transactions' | 'chain' | 'mining' | 'timing'; export type EventValueKind = @@ -255,8 +262,11 @@ export type AdminEventFrame = z.infer; export type AdminAckFrame = z.infer; export type AdminFrame = z.infer; -export const ALL_LOG_FILTER = 2 ** LOG_LEVELS.length - 1; -export const DEFAULT_LOG_FILTER = ALL_LOG_FILTER; +export const ALL_LOG_FILTER = LOG_LEVELS.reduce( + (filter, level) => (level.disabled ? filter : filter | (1 << level.id)), + 0 +); +export const DEFAULT_LOG_FILTER = 2 ** 0 + 2 ** 1 + 2 ** 2 + 2 ** 5 + 2 ** 6; export const OPERATIONAL_LOG_FILTER = 2 ** 0 + 2 ** 1 + 2 ** 2 + 2 ** 6 + 2 ** 7; export const ALL_EVENT_FILTER = 2 ** EVENT_DEFINITIONS.length - 1; @@ -264,8 +274,8 @@ export function includesLogLevel(filter: number, level: number): boolean { return ( Number.isInteger(level) && level >= 0 && - level < LOG_LEVELS.length && - (filter & (1 << level)) !== 0 + level < 31 && + (filter & ALL_LOG_FILTER & (1 << level)) !== 0 ); } diff --git a/web/admin_dashboard/src/lib/chart-config.ts b/web/admin_dashboard/src/lib/chart-config.ts index edc3e05d..4445e9d1 100644 --- a/web/admin_dashboard/src/lib/chart-config.ts +++ b/web/admin_dashboard/src/lib/chart-config.ts @@ -102,9 +102,9 @@ export interface ChartTemplate { const syncPipeline: ChartDefinition = { id: 'default-sync-pipeline', title: 'Sync pipeline', - visualization: 'line', - scale: 'linear', - range: 900, + visualization: 'area', + scale: 'compressed', + range: 300, series: [ series('sync-header', eventSignalId(0), 'occurrence-rate', CHART_COLORS[3]), series('sync-archive', eventSignalId(3), 'occurrence-rate', CHART_COLORS[0]), diff --git a/web/admin_dashboard/src/lib/live-metrics.ts b/web/admin_dashboard/src/lib/live-metrics.ts index df86c9ad..96a8d3cd 100644 --- a/web/admin_dashboard/src/lib/live-metrics.ts +++ b/web/admin_dashboard/src/lib/live-metrics.ts @@ -7,6 +7,7 @@ import { isAdminLogFrame, } from './admin-contract'; import { POOL_STALE_AFTER_MS, type NativeFees, type NativeFeesSnapshot } from './native-contract'; +import { SyncFillTracker, type SyncFill } from './sync-fill'; import { NATIVE_TOP_SIGNAL_ID, POOL_SIGNALS, @@ -86,6 +87,7 @@ export interface MetricsSnapshot { lastLogAt: number | null; lastEventAt: number | null; poolSnapshot: NativeFeesSnapshot | null; + syncFill: SyncFill; } interface MutableSignalBucket { @@ -187,6 +189,7 @@ export class LiveMetricsStore { #logs = new RingBuffer(RECENT_LOG_LIMIT); #events = new RingBuffer(RECENT_EVENT_LIMIT); #buckets = new Map(); + #lastBucketTime = Number.NEGATIVE_INFINITY; #priorSignalCounts: Partial> = {}; #priorSignalSums: Partial> = {}; #priorSignalLatest: Partial> = {}; @@ -207,6 +210,7 @@ export class LiveMetricsStore { #lastEventAt: number | null = null; #poolSnapshot: MetricsSnapshot['poolSnapshot'] = null; #sequence = 0; + #syncFill = new SyncFillTracker(); #publishTimer: ReturnType | null = null; #clockTimer: ReturnType | null = null; #snapshot: MetricsSnapshot; @@ -312,6 +316,7 @@ export class LiveMetricsStore { this.#logs.clear(); this.#events.clear(); this.#buckets.clear(); + this.#lastBucketTime = Number.NEGATIVE_INFINITY; this.#priorSignalCounts = {}; this.#priorSignalSums = {}; this.#priorSignalLatest = {}; @@ -331,10 +336,15 @@ export class LiveMetricsStore { this.#lastEventAt = null; this.#poolSnapshot = null; this.#sequence = 0; + this.#syncFill.reset(); this.#ensureBucket(this.#sessionStartedAt); this.flush(); } + resetSyncFill(): void { + this.#syncFill.reset(); + } + tick(): void { const now = this.#collectionTime(this.#now()); this.#ensureBucket(now); @@ -356,7 +366,7 @@ export class LiveMetricsStore { this.#lastLogAt = receivedAt; this.#sequence += 1; if (this.#logs.push({ ...frame, id: this.#sequence, receivedAt })) this.#evictedLogs += 1; - this.#recordSignal(logSignalId(frame.level), receivedAt, null); + this.#recordSignal(logSignalId(frame.level), frame.time, null); } #ingestEvent(frame: AdminEventFrame, receivedAt: number): void { @@ -364,9 +374,10 @@ export class LiveMetricsStore { this.#lastEventAt = receivedAt; this.#sequence += 1; this.#events.push({ ...frame, id: this.#sequence, receivedAt }); + this.#syncFill.record(frame.event, frame.value, receivedAt); this.#recordSignal( eventSignalId(frame.event), - receivedAt, + frame.time, normalizeEventPayload(frame.event, frame.value) ); } @@ -412,6 +423,13 @@ export class LiveMetricsStore { if (existing) return existing; const bucket: MutableBucket = { time: bucketTime, signals: new Map(), snapshot: null }; this.#buckets.set(bucketTime, bucket); + if (bucketTime < this.#lastBucketTime) { + const ordered = [...this.#buckets].sort(([left], [right]) => left - right); + this.#buckets.clear(); + for (const [time, value] of ordered) this.#buckets.set(time, value); + } else { + this.#lastBucketTime = bucketTime; + } return bucket; } @@ -442,8 +460,8 @@ export class LiveMetricsStore { } #createSnapshot(): MetricsSnapshot { - // Collection time is monotonic, so insertion order is chronological. Reuse - // immutable closed buckets instead of cloning an hour of history each update. + // Buckets are kept in chronological order. Reuse immutable closed buckets + // instead of cloning an hour of history each update. const buckets = [...this.#buckets.values()].map((bucket) => { bucket.snapshot ??= { time: bucket.time, @@ -476,6 +494,7 @@ export class LiveMetricsStore { lastLogAt: this.#lastLogAt, lastEventAt: this.#lastEventAt, poolSnapshot: this.#poolSnapshot, + syncFill: this.#syncFill.snapshot(), }; } } diff --git a/web/admin_dashboard/src/lib/log-settings.ts b/web/admin_dashboard/src/lib/log-settings.ts index 92580d37..0d3f9555 100644 --- a/web/admin_dashboard/src/lib/log-settings.ts +++ b/web/admin_dashboard/src/lib/log-settings.ts @@ -15,11 +15,8 @@ export function loadLogFilter(storage: Storage | null = browserStorage()): numbe const saved = storage?.getItem(STORAGE_KEY); if (!saved) return DEFAULT_LOG_FILTER; const filter: unknown = JSON.parse(saved) as unknown; - return typeof filter === 'number' && - Number.isInteger(filter) && - filter >= 0 && - filter <= ALL_LOG_FILTER - ? filter + return typeof filter === 'number' && Number.isInteger(filter) && filter >= 0 + ? filter & ALL_LOG_FILTER : DEFAULT_LOG_FILTER; } catch { return DEFAULT_LOG_FILTER; diff --git a/web/admin_dashboard/src/lib/native-client.ts b/web/admin_dashboard/src/lib/native-client.ts index 9971ad5b..1eebac91 100644 --- a/web/admin_dashboard/src/lib/native-client.ts +++ b/web/admin_dashboard/src/lib/native-client.ts @@ -22,6 +22,7 @@ export interface NativeLiveState { topReceivedAt: number | null; branch: NativeHeader | null; branchReceivedAt: number | null; + tip: NativeHeader | null; fees: NativeFeesSnapshot | null; invalidFrames: number; } @@ -41,6 +42,7 @@ export const INITIAL_LIVE_STATE: NativeLiveState = { topReceivedAt: null, branch: null, branchReceivedAt: null, + tip: null, fees: null, invalidFrames: 0, }; @@ -56,6 +58,8 @@ export class NativeClient { #connectedAt: number | null = null; #headerRequest: { height: number; requestedAt: number } | null = null; #lastHeaderRequestedAt: number | null = null; + #tipRequest: { height: number; requestedAt: number } | null = null; + #lastTipRequestedAt: number | null = null; #pollIntervalMs: number; #poolTimer: ReturnType | null = null; #poolRequestedAt: number | null = null; @@ -124,6 +128,8 @@ export class NativeClient { this.#poolRequestedAt = null; this.#headerRequest = null; this.#lastHeaderRequestedAt = null; + this.#tipRequest = null; + this.#lastTipRequestedAt = null; this.#invalidateLiveState(); } }); @@ -162,10 +168,16 @@ export class NativeClient { branch: retained ? this.#state.branch : null, branchReceivedAt: retained ? this.#state.branchReceivedAt : null, }); + this.#requestTip(candidate.height, receivedAt); if (branching) this.#requestBranch(confirmed.height, receivedAt); return; } if (frame.type === 'header') { + if (frame.payload.height === this.#tipRequest?.height) { + this.#tipRequest = null; + this.#setState({ ...this.#state, tip: frame.payload }); + return; + } if (frame.payload.height !== this.#headerRequest?.height) return; this.#headerRequest = null; this.#setState({ @@ -200,6 +212,18 @@ export class NativeClient { if (!this.#socket.send(nativeBranchPath(height))) this.#headerRequest = null; } + // The candidate top header, sampled at the polling cadence. + #requestTip(height: number, now: number): void { + if (this.#tipRequest !== null && now - this.#tipRequest.requestedAt < NATIVE_STATE_STALE_AFTER_MS) + return; + if (this.#lastTipRequestedAt !== null && now - this.#lastTipRequestedAt < this.#pollIntervalMs) + return; + + this.#tipRequest = { height, requestedAt: now }; + this.#lastTipRequestedAt = now; + if (!this.#socket.send(nativeBranchPath(height))) this.#tipRequest = null; + } + #requestPool(): void { const now = this.#now(); // Avoid piling up snapshot queries; retry an unanswered request after 30 seconds. @@ -215,6 +239,7 @@ export class NativeClient { this.#state.topReceivedAt === null && this.#state.branch === null && this.#state.branchReceivedAt === null && + this.#state.tip === null && this.#state.fees === null ) { return; diff --git a/web/admin_dashboard/src/lib/signal-catalog.ts b/web/admin_dashboard/src/lib/signal-catalog.ts index d2d84353..16cd8037 100644 --- a/web/admin_dashboard/src/lib/signal-catalog.ts +++ b/web/admin_dashboard/src/lib/signal-catalog.ts @@ -304,7 +304,7 @@ const declaredSignals: SignalDefinition[] = [ description: signal.description, })), ...EVENT_DEFINITIONS.map((definition) => createEventSignal(definition.id)), - ...LOG_LEVELS.map((level) => ({ + ...LOG_LEVELS.filter((level) => !level.disabled).map((level) => ({ id: logSignalId(level.id), source: 'log' as const, sourceId: level.id, diff --git a/web/admin_dashboard/src/lib/sync-fill.ts b/web/admin_dashboard/src/lib/sync-fill.ts new file mode 100644 index 00000000..d38b3483 --- /dev/null +++ b/web/admin_dashboard/src/lib/sync-fill.ts @@ -0,0 +1,131 @@ +import { EVENT_DEFINITIONS } from './admin-contract'; + +export const SYNC_FILL_BINS = 600; + +export interface SyncFrontier { + height: number; + receivedAt: number; +} + +export interface SyncFill { + height: number; + headers: number; + archived: Uint8Array; + validated: Uint8Array; + candidate: SyncFrontier | null; + confirmed: SyncFrontier | null; +} + +const eventId = (name: string) => EVENT_DEFINITIONS.findIndex((event) => event.name === name); +const HEADER_ARCHIVED = eventId('header_archived'); +const HEADER_ORGANIZED = eventId('header_organized'); +const HEADER_REORGANIZED = eventId('header_reorganized'); +const BLOCK_ARCHIVED = eventId('block_archived'); +const BLOCK_VALIDATED = eventId('block_validated'); +const VALIDATE_BYPASSED = eventId('validate_bypassed'); +const BLOCK_ORGANIZED = eventId('block_organized'); +const BLOCK_REORGANIZED = eventId('block_reorganized'); + +const BIT_COUNTS = Uint8Array.from({ length: 256 }, (_, value) => { + let count = 0; + for (let bits = value; bits > 0; bits >>= 1) count += bits & 1; + return count; +}); + +class HeightSet { + #bits = new Uint8Array(0); + + add(height: number): void { + const index = height >> 3; + if (index >= this.#bits.length) { + const grown = new Uint8Array(Math.max(index + 1, this.#bits.length * 2, 1_024)); + grown.set(this.#bits); + this.#bits = grown; + } + this.#bits[index] |= 1 << (height & 7); + } + + clear(): void { + this.#bits = new Uint8Array(0); + } + + count(first: number, last: number): number { + let total = 0; + let height = first; + while (height <= last && (height & 7) !== 0) total += this.#has(height++) ? 1 : 0; + while (height + 7 <= last) { + total += BIT_COUNTS[this.#bits[height >> 3] ?? 0] ?? 0; + height += 8; + } + while (height <= last) total += this.#has(height++) ? 1 : 0; + return total; + } + + #has(height: number): boolean { + return ((this.#bits[height >> 3] ?? 0) & (1 << (height & 7))) !== 0; + } +} + +// Heights reported by block archive and validation events, which arrive out +// of order, with the header, candidate and confirmed frontiers as last reported. +export class SyncFillTracker { + #headers = 0; + #archived = new HeightSet(); + #validated = new HeightSet(); + #height = 0; + #candidate: SyncFrontier | null = null; + #confirmed: SyncFrontier | null = null; + + record(event: number, height: number, receivedAt: number): void { + if (event === HEADER_ARCHIVED) { + this.#headers = Math.max(this.#headers, height); + } else if (event === BLOCK_ARCHIVED) { + this.#archived.add(height); + } else if (event === BLOCK_VALIDATED || event === VALIDATE_BYPASSED) { + this.#validated.add(height); + } else if (event === HEADER_ORGANIZED) { + this.#candidate = { height, receivedAt }; + } else if (event === HEADER_REORGANIZED) { + this.#candidate = { height: Math.max(0, height - 1), receivedAt }; + } else if (event === BLOCK_ORGANIZED) { + this.#confirmed = { height, receivedAt }; + } else if (event === BLOCK_REORGANIZED) { + this.#confirmed = { height: Math.max(0, height - 1), receivedAt }; + } else { + return; + } + this.#height = Math.max(this.#height, height); + } + + reset(): void { + this.#headers = 0; + this.#archived.clear(); + this.#validated.clear(); + this.#height = 0; + this.#candidate = null; + this.#confirmed = null; + } + + // Each bin holds the filled fraction of its height interval, scaled to 255. + snapshot(bins = SYNC_FILL_BINS): SyncFill { + const archived = new Uint8Array(bins); + const validated = new Uint8Array(bins); + const span = this.#height + 1; + for (let bin = 0; bin < bins; bin++) { + const first = Math.floor((bin * span) / bins); + const last = Math.floor(((bin + 1) * span) / bins) - 1; + if (last < first) continue; + const size = last - first + 1; + archived[bin] = Math.round((this.#archived.count(first, last) * 255) / size); + validated[bin] = Math.round((this.#validated.count(first, last) * 255) / size); + } + return { + height: this.#height, + headers: this.#headers, + archived, + validated, + candidate: this.#candidate, + confirmed: this.#confirmed, + }; + } +} diff --git a/web/admin_dashboard/src/lib/sync-status.ts b/web/admin_dashboard/src/lib/sync-status.ts index b41c80e7..72a01655 100644 --- a/web/admin_dashboard/src/lib/sync-status.ts +++ b/web/admin_dashboard/src/lib/sync-status.ts @@ -1,30 +1,62 @@ import type { NativeHeader, NativeTop, NativeTops } from './native-contract'; +import type { SyncFill, SyncFrontier } from './sync-fill'; export const SYNC_PROGRESS_HIDE_THRESHOLD_BLOCKS = 18; +const EXPECTED_BLOCK_INTERVAL_MS = 10 * 60 * 1_000; + +export interface SyncTop { + height: number; + hash?: string; +} export interface ChainSync { - confirmed: NativeTop; - candidate: NativeTop; + confirmed: SyncTop; + candidate: SyncTop; blocksRemaining: number; progress: number; diverged: boolean; + fill: SyncFill | null; + estimatedTop: number; } // The branch header is the candidate header at the confirmed height, if known. -export function chainSync(tops: NativeTops | null, branch: NativeHeader | null): ChainSync | null { +// Frontier events received after the tops advance them between requests. The +// tip header (candidate top) projects the network top from its timestamp. +export function chainSync( + tops: NativeTops | null, + branch: NativeHeader | null, + fill: SyncFill | null = null, + receivedAt: number | null = null, + tip: NativeHeader | null = null, + now = Date.now() +): ChainSync | null { if (tops === null) return null; - const { confirmed, candidate } = tops; + const confirmed = advance(tops.confirmed, fill?.confirmed ?? null, receivedAt); + const candidate = advance(tops.candidate, fill?.candidate ?? null, receivedAt); return { confirmed, candidate, blocksRemaining: Math.max(0, candidate.height - confirmed.height), progress: candidate.height === 0 ? 100 : Math.min(100, (confirmed.height / candidate.height) * 100), - diverged: isDiverged(confirmed, candidate, branch), + diverged: isDiverged(tops.confirmed, tops.candidate, branch), + fill, + estimatedTop: estimateTop(candidate.height, tip, now), }; } +function estimateTop(candidate: number, tip: NativeHeader | null, now: number): number { + if (tip === null) return candidate; + const elapsed = Math.max(0, now - tip.timestamp * 1_000); + return Math.max(candidate, tip.height + Math.ceil(elapsed / EXPECTED_BLOCK_INTERVAL_MS)); +} + +function advance(top: NativeTop, event: SyncFrontier | null, receivedAt: number | null): SyncTop { + if (event === null || receivedAt === null || event.receivedAt <= receivedAt) return top; + return event.height === top.height ? top : { height: event.height }; +} + function isDiverged(confirmed: NativeTop, candidate: NativeTop, branch: NativeHeader | null) { if (candidate.height < confirmed.height) return true; if (candidate.height === confirmed.height) return candidate.hash !== confirmed.hash; diff --git a/web/admin_dashboard/src/lib/telemetry-worker-runtime.ts b/web/admin_dashboard/src/lib/telemetry-worker-runtime.ts index b26ed710..2885705b 100644 --- a/web/admin_dashboard/src/lib/telemetry-worker-runtime.ts +++ b/web/admin_dashboard/src/lib/telemetry-worker-runtime.ts @@ -168,7 +168,13 @@ export class TelemetryWorkerRuntime { }; this.#client = client; this.#native = native; + let connected = false; this.#unsubscribers = [ + client.subscribeStatus(() => { + const current = client.getStatus().phase === 'connected'; + if (current && !connected) this.#metrics.resetSyncFill(); + connected = current; + }), client.subscribeFrames((frame) => { this.#metrics.ingest(frame); }), diff --git a/web/admin_dashboard/src/lib/use-telemetry.ts b/web/admin_dashboard/src/lib/use-telemetry.ts index 4977e70b..d3a424da 100644 --- a/web/admin_dashboard/src/lib/use-telemetry.ts +++ b/web/admin_dashboard/src/lib/use-telemetry.ts @@ -24,6 +24,7 @@ export interface NativeTelemetry { top: number | null; tops: NativeLiveState['tops']; branch: NativeLiveState['branch']; + tip: NativeLiveState['tip']; configuration: NativeLiveState['configuration']; receivedAt: number | null; transport: 'websocket' | 'rest' | 'none'; @@ -32,7 +33,7 @@ export interface NativeTelemetry { type NativeTelemetrySelection = Pick< NativeTelemetry, - 'top' | 'tops' | 'branch' | 'configuration' | 'receivedAt' | 'transport' + 'top' | 'tops' | 'branch' | 'tip' | 'configuration' | 'receivedAt' | 'transport' >; export function useAdminTelemetry( @@ -161,6 +162,7 @@ export function selectNativeTelemetrySource( live.branchReceivedAt !== null && isNativeStateFresh(live.branchReceivedAt, now) ? live.branch : null, + tip: live.tip, configuration: live.configuration, receivedAt: live.topReceivedAt, transport: 'websocket', @@ -172,6 +174,7 @@ export function selectNativeTelemetrySource( top: rest.tops.confirmed.height, tops: rest.tops, branch: rest.branch, + tip: null, configuration: rest.configuration, receivedAt: rest.receivedAt, transport: 'rest', @@ -182,6 +185,7 @@ export function selectNativeTelemetrySource( top: null, tops: null, branch: null, + tip: null, configuration: null, receivedAt: null, transport: 'none', diff --git a/web/admin_dashboard/src/main.tsx b/web/admin_dashboard/src/main.tsx index e41b3778..bbaff5d7 100644 --- a/web/admin_dashboard/src/main.tsx +++ b/web/admin_dashboard/src/main.tsx @@ -7,6 +7,10 @@ import { initializeTheme } from '@/lib/theme'; initializeTheme(); +// The site is a single page, so any other address is shown as the root. +if (window.location.pathname !== '/' || window.location.search || window.location.hash) + window.history.replaceState(null, '', '/'); + const rootElement = document.querySelector('#root'); if (!rootElement) { throw new Error('Root element not found');