From 630696efa09070616672ef2e66618d9a30524437 Mon Sep 17 00:00:00 2001 From: BOB450 Date: Sat, 10 Oct 2026 23:59:47 -0600 Subject: [PATCH 1/2] Add a Compress peaks toggle on each chart, saved with the chart layout. It applies a log-like Y axis so spikes do not flatten ordinary activity. --- console/embedded/admin_css.cpp | 8 +- console/embedded/admin_ecma.cpp | 212 ++++++++++++++++---------------- 2 files changed, 110 insertions(+), 110 deletions(-) diff --git a/console/embedded/admin_css.cpp b/console/embedded/admin_css.cpp index 361e9b05..8d292236 100644 --- a/console/embedded/admin_css.cpp +++ b/console/embedded/admin_css.cpp @@ -25,10 +25,10 @@ namespace server { DEFINE_EMBEDDED_PAGE(admin_pages, char, css, R"DELIM(.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:inline))) 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-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--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-amber-950:oklch(27.9% .077 45.635);--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-emerald-950:oklch(26.2% .051 172.552);--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;--color-white:#fff;--spacing:.25rem;--container-xl:36rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--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);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--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;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}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}::-w)DELIM" R"DELIM(ebkit-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' 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}.static{position:static}.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-40{z-index:40}.z-50{z-index:50}.z-\[60\]{z-index:60}.order-3{order:3}.col-span-2{grid-column:span 2/span 2}.float-right{float:right}.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-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mr)DELIM" -R"DELIM(-auto{margin-right:auto}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.h-2{height:calc(var(--spacing) * 2)}.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-\[80vh\]{max-height:80vh}.max-h-\[92vh\]{max-height:92vh}.max-h-\[calc\(100vh-2rem\)\]{max-height:calc(100vh - 2rem)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-32{min-height:calc(var(--spacing) * 32)}.min-h-screen{min-height:100vh}.w-2{width:calc(var(--spacing) * 2)}.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-\[96rem\]{max-width:96rem}.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-2{grid-template-columns:repeat(2,minmax(0,1fr))}.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)}.flex-wrap{flex-wrap:wrap}.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-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)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-5{column-gap:calc(var(--spacing) * 5)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.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-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white) 5%,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:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-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:#ffa0221a}.border-accent\/15{border-color:#ffa02226}.border-accent\/20{border-color:#ffa02233}.border-accent\/25{border-color:#ffa02240}.border-accent\/30{border-color:#ffa0224d}.border-accent\/35{border-color:#ffa02259}.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-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500) 40%,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\/40{border-color:#00bb7f66}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/40{border-color:color-mix(in oklab,var(--color-emerald-500) 40%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500) 40%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,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)}}.border-textMuted\/25{border-color:#cfcfcf40}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.bg-accent{background-color:#ffa022}.bg-accent\/15{background-color:#ffa02226}.bg-amber-400{background-color:var(--color-amber-400)}.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-amber-950\/95{background-color:#461901f2}@supports (color:color-mix(in)DELIM" -R"DELIM( lab,red,red)){.bg-amber-950\/95{background-color:color-mix(in oklab,var(--color-amber-950) 95%,transparent)}}.bg-background{background-color:#272822}.bg-background\/35{background-color:#27282259}.bg-background\/50{background-color:#27282280}.bg-background\/60{background-color:#27282299}.bg-background\/70{background-color:#272822b3}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-black\/75{background-color:#000000bf}@supports (color:color-mix(in lab,red,red)){.bg-black\/75{background-color:color-mix(in oklab,var(--color-black) 75%,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-current{background-color:currentColor}.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-400{background-color:var(--color-emerald-400)}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,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-emerald-950\/95{background-color:#002c22f2}@supports (color:color-mix(in lab,red,red)){.bg-emerald-950\/95{background-color:color-mix(in oklab,var(--color-emerald-950) 95%,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-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500) 10%,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\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,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\/10{background-color:#62748e1a}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/10{background-color:color-mix(in oklab,var(--color-slate-500) 10%,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{background-color:#1f211c}.bg-surface\/50{background-color:#1f211c80}.bg-surface\/60{background-color:#1f211c99}.bg-surface\/70{background-color:#1f211cb3}.bg-surface\/95{background-color:#1f211cf2}.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-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white) 5%,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)}.text-center{text-align:center}.text-left{text-align:left}.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-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--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-7{--tw-leading:calc(var(--spacing) * 7);line-height:calc(var(--spacing) * 7)}.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-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-\[0\.16em\]{--tw-tracking:.16em;letter-spacing:.16em}.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}.break-all{word-break:break-all}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:#ffa022}.text-accentSecondary{color:#c85637}.text-amber-200{color:var(--color-amber-200)}.text-amber-300{color:var(--color-amber-300)}.text-background{color:#272822}.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-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:#cfcfcf}.text-textPrimary{color:#ededed}.text-violet-300{color:var(--color-violet-300)}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.text-white\/75{color:#ffffffbf}@supports (color:color-mix(in lab,red,red)){.text-white\/75{color:color-mix(in oklab,var(--color-white) 75%,transparent)}}.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-sha)DELIM" -R"DELIM(dow),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:#cfcfcf80}.placeholder\:text-textMuted\/60::placeholder{color:#cfcfcf99}.backdrop\:bg-black\/70::backdrop{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.backdrop\:bg-black\/70::backdrop{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.even\:border-l:nth-child(2n){border-left-style:var(--tw-border-style);border-left-width:1px}@media(hover:hover){.hover\:border-accent:hover{border-color:#ffa022}.hover\:border-accent\/60:hover{border-color:#ffa02299}.hover\:border-accentSecondary:hover{border-color:#c85637}.hover\:bg-accent\/10:hover{background-color:#ffa0221a}.hover\:bg-accent\/90:hover{background-color:#ffa022e6}.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\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.hover\:text-accent:hover{color:#ffa022}.hover\:text-accentSecondary:hover{color:#c85637}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-textPrimary:hover{color:#ededed}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:border-accent:focus{border-color:#ffa022}.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:#ffa022}.focus-visible\:bg-white\/10:focus-visible{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.focus-visible\:bg-white\/10:focus-visible{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-textMuted:disabled{color:#cfcfcf}.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\:order-none{order:0}.sm\:w-96{width:calc(var(--spacing) * 96)}.sm\:w-auto{width:auto}.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)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}}@media(min-width:48rem){.md\:grid-cols-\[minmax\(0\,1fr\)_11rem_11rem\]{grid-template-columns:minmax(0,1fr) 11rem 11rem}}@media(min-width:64rem){.lg\:flex{display:flex}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.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-\[1fr_1\.15fr_1fr_1fr\]{grid-template-columns:1fr 1.15fr 1fr 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}.lg\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.lg\:first\:border-l-0:first-child{border-left-style:var(--tw-border-style);border-left-width:0}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-\[1\.1fr_0\.9fr\]{grid-template-columns:1.1fr .9fr}}.\[\&\:nth-child\(n\+3\)\]\:border-t:nth-child(n+3){border-top-style:var(--tw-border-style);border-top-width:1px}@media(min-width:64rem){.lg\:\[\&\:nth-child\(n\+3\)\]\:border-t-0:nth-child(n+3){border-top-style:var(--tw-border-style);border-top-width:0}}}:root{color-scheme:dark;font-synthesis:none;text-rendering:optimizelegibility}body{min-width:calc(var(--spacing) * 80);font-family:var(--font-sans);color:#ededed;background-color:#272822;margin:0;overflow-x:hidden}button,input,select{font:inherit}::selection{color:#272822;background-color:#ffa022}*{scrollbar-color:#c85637 #1f211c;scrollbar-width:thin}.uplot{color:#cfcfcf;font-family:ui-sans-serif,system-ui,sans-serif}.uplot .u-legend{margin-bottom:.75rem;font-size:.75rem}.uplot .u-legend .u-series{padding:.2rem .45rem}.uplot .u-select{background:#ffa0221f;border:1px solid #ffa02259}@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-numeri)DELIM" -R"DELIM(c-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} +R"DELIM(-auto{margin-right:auto}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.h-2{height:calc(var(--spacing) * 2)}.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-\[80vh\]{max-height:80vh}.max-h-\[92vh\]{max-height:92vh}.max-h-\[calc\(100vh-2rem\)\]{max-height:calc(100vh - 2rem)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-32{min-height:calc(var(--spacing) * 32)}.min-h-screen{min-height:100vh}.w-2{width:calc(var(--spacing) * 2)}.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-\[96rem\]{max-width:96rem}.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-2{grid-template-columns:repeat(2,minmax(0,1fr))}.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)}.flex-wrap{flex-wrap:wrap}.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-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)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-5{column-gap:calc(var(--spacing) * 5)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.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-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white) 5%,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:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-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:#ffa0221a}.border-accent\/15{border-color:#ffa02226}.border-accent\/20{border-color:#ffa02233}.border-accent\/25{border-color:#ffa02240}.border-accent\/30{border-color:#ffa0224d}.border-accent\/35{border-color:#ffa02259}.border-accent\/40{border-color:#ffa02266}.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-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500) 40%,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\/40{border-color:#00bb7f66}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/40{border-color:color-mix(in oklab,var(--color-emerald-500) 40%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500) 40%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,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)}}.border-textMuted\/25{border-color:#cfcfcf40}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.bg-accent{background-color:#ffa022}.bg-accent\/10{background-color:#ffa0221a}.bg-accent\/15{background-color:#ffa02226}.bg-amber-400{background-color:var(--color-amber-400)}.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%,tran)DELIM" +R"DELIM(sparent)}}.bg-amber-950\/95{background-color:#461901f2}@supports (color:color-mix(in lab,red,red)){.bg-amber-950\/95{background-color:color-mix(in oklab,var(--color-amber-950) 95%,transparent)}}.bg-background{background-color:#272822}.bg-background\/35{background-color:#27282259}.bg-background\/50{background-color:#27282280}.bg-background\/60{background-color:#27282299}.bg-background\/70{background-color:#272822b3}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-black\/75{background-color:#000000bf}@supports (color:color-mix(in lab,red,red)){.bg-black\/75{background-color:color-mix(in oklab,var(--color-black) 75%,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-current{background-color:currentColor}.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-400{background-color:var(--color-emerald-400)}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,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-emerald-950\/95{background-color:#002c22f2}@supports (color:color-mix(in lab,red,red)){.bg-emerald-950\/95{background-color:color-mix(in oklab,var(--color-emerald-950) 95%,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-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500) 10%,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\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,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\/10{background-color:#62748e1a}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/10{background-color:color-mix(in oklab,var(--color-slate-500) 10%,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{background-color:#1f211c}.bg-surface\/50{background-color:#1f211c80}.bg-surface\/60{background-color:#1f211c99}.bg-surface\/70{background-color:#1f211cb3}.bg-surface\/95{background-color:#1f211cf2}.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-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white) 5%,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)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-left{text-align:left}.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-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--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-7{--tw-leading:calc(var(--spacing) * 7);line-height:calc(var(--spacing) * 7)}.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-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-\[0\.16em\]{--tw-tracking:.16em;letter-spacing:.16em}.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}.break-all{word-break:break-all}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:#ffa022}.text-accentSecondary{color:#c85637}.text-amber-200{color:var(--color-amber-200)}.text-amber-300{color:var(--color-amber-300)}.text-background{color:#272822}.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-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:#cfcfcf}.text-textPrimary{color:#ededed}.text-violet-300{color:var(--color-violet-300)}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.text-white\/75{color:#ffffffbf}@supports (color:color-mix(in lab,red,red)){.text-white\/75{color:color-mix(in oklab,var(--color-white) 75%,transparent)}}.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-sh)DELIM" +R"DELIM(adow-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:#cfcfcf80}.placeholder\:text-textMuted\/60::placeholder{color:#cfcfcf99}.backdrop\:bg-black\/70::backdrop{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.backdrop\:bg-black\/70::backdrop{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.even\:border-l:nth-child(2n){border-left-style:var(--tw-border-style);border-left-width:1px}@media(hover:hover){.hover\:border-accent:hover{border-color:#ffa022}.hover\:border-accent\/60:hover{border-color:#ffa02299}.hover\:border-accentSecondary:hover{border-color:#c85637}.hover\:bg-accent\/10:hover{background-color:#ffa0221a}.hover\:bg-accent\/90:hover{background-color:#ffa022e6}.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\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.hover\:text-accent:hover{color:#ffa022}.hover\:text-accentSecondary:hover{color:#c85637}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-textPrimary:hover{color:#ededed}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:border-accent:focus{border-color:#ffa022}.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:#ffa022}.focus-visible\:bg-white\/10:focus-visible{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.focus-visible\:bg-white\/10:focus-visible{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-textMuted:disabled{color:#cfcfcf}.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\:order-none{order:0}.sm\:w-96{width:calc(var(--spacing) * 96)}.sm\:w-auto{width:auto}.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)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}}@media(min-width:48rem){.md\:grid-cols-\[minmax\(0\,1fr\)_11rem_11rem\]{grid-template-columns:minmax(0,1fr) 11rem 11rem}}@media(min-width:64rem){.lg\:flex{display:flex}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.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-\[1fr_1\.15fr_1fr_1fr\]{grid-template-columns:1fr 1.15fr 1fr 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}.lg\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.lg\:first\:border-l-0:first-child{border-left-style:var(--tw-border-style);border-left-width:0}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-\[1\.1fr_0\.9fr\]{grid-template-columns:1.1fr .9fr}}.\[\&\:nth-child\(n\+3\)\]\:border-t:nth-child(n+3){border-top-style:var(--tw-border-style);border-top-width:1px}@media(min-width:64rem){.lg\:\[\&\:nth-child\(n\+3\)\]\:border-t-0:nth-child(n+3){border-top-style:var(--tw-border-style);border-top-width:0}}}:root{color-scheme:dark;font-synthesis:none;text-rendering:optimizelegibility}body{min-width:calc(var(--spacing) * 80);font-family:var(--font-sans);color:#ededed;background-color:#272822;margin:0;overflow-x:hidden}button,input,select{font:inherit}::selection{color:#272822;background-color:#ffa022}*{scrollbar-color:#c85637 #1f211c;scrollbar-width:thin}.uplot{color:#cfcfcf;font-family:ui-sans-serif,system-ui,sans-serif}.uplot .u-legend{margin-bottom:.75rem;font-size:.75rem}.uplot .u-legend .u-series{padding:.2rem .45rem}.uplot .u-select{background:#ffa0221f;border:1px solid #ffa02259}@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}@)DELIM" +R"DELIM(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} )DELIM" ) diff --git a/console/embedded/admin_ecma.cpp b/console/embedded/admin_ecma.cpp index 58e22501..1b879121 100644 --- a/console/embedded/admin_ecma.cpp +++ b/console/embedded/admin_ecma.cpp @@ -23,146 +23,146 @@ namespace server { // Simple test ecma script for embedded page. DEFINE_EMBEDDED_PAGE(admin_pages, char, ecma, -R"DELIM((function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const d of o)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&r(f)}).observe(document,{childList:!0,subtree:!0});function s(o){const d={};return o.integrity&&(d.integrity=o.integrity),o.referrerPolicy&&(d.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?d.credentials="include":o.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(o){if(o.ep)return;o.ep=!0;const d=s(o);fetch(o.href,d)}})();function m0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Vd={exports:{}},Su={};var zv;function O_(){if(zv)return Su;zv=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(r,o,d){var f=null;if(d!==void 0&&(f=""+d),o.key!==void 0&&(f=""+o.key),"key"in o){d={};for(var m in o)m!=="key"&&(d[m]=o[m])}else d=o;return o=d.ref,{$$typeof:n,type:r,key:f,ref:o!==void 0?o:null,props:d}}return Su.Fragment=i,Su.jsx=s,Su.jsxs=s,Su}var Ev;function M_(){return Ev||(Ev=1,Vd.exports=O_()),Vd.exports}var _=M_(),Gd={exports:{}},Ce={};var Tv;function j_(){if(Tv)return Ce;Tv=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),z=Symbol.iterator;function T(N){return N===null||typeof N!="object"?null:(N=z&&N[z]||N["@@iterator"],typeof N=="function"?N:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,Q={};function B(N,L,V){this.props=N,this.context=L,this.refs=Q,this.updater=V||j}B.prototype.isReactComponent={},B.prototype.setState=function(N,L){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,L,"setState")},B.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function Y(){}Y.prototype=B.prototype;function J(N,L,V){this.props=N,this.context=L,this.refs=Q,this.updater=V||j}var q=J.prototype=new Y;q.constructor=J,C(q,B.prototype),q.isPureReactComponent=!0;var ee=Array.isArray;function ne(){}var F={H:null,A:null,T:null,S:null},ue=Object.prototype.hasOwnProperty;function Ne(N,L,V){var le=V.ref;return{$$typeof:n,type:N,key:L,ref:le!==void 0?le:null,props:V}}function we(N,L){return Ne(N.type,L,N.props)}function ie(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function be(N){var L={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(V){return L[V]})}var ce=/\/+/g;function ze(N,L){return typeof N=="object"&&N!==null&&N.key!=null?be(""+N.key):L.toString(36)}function he(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(ne,ne):(N.status="pending",N.then(function(L){N.status==="pending"&&(N.status="fulfilled",N.value=L)},function(L){N.status==="pending"&&(N.status="rejected",N.reason=L)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function U(N,L,V,le,xe){var ge=typeof N;(ge==="undefined"||ge==="boolean")&&(N=null);var ve=!1;if(N===null)ve=!0;else switch(ge){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(N.$$typeof){case n:case i:ve=!0;break;case w:return ve=N._init,U(ve(N._payload),L,V,le,xe)}}if(ve)return xe=xe(N),ve=le===""?"."+ze(N,0):le,ee(xe)?(V="",ve!=null&&(V=ve.replace(ce,"$&/")+"/"),U(xe,L,V,"",function(nt){return nt})):xe!=null&&(ie(xe)&&(xe=we(xe,V+(xe.key==null||N&&N.key===xe.key?"":(""+xe.key).replace(ce,"$&/")+"/")+ve)),L.push(xe)),1;ve=0;var mt=le===""?".":le+":";if(ee(N))for(var Ve=0;Ve>>1,_e=U[Oe];if(0>>1;Oeo(V,pe))le<_e&&0>o(xe,V)?(U[Oe]=xe,U[le]=pe,Oe=le):(U[Oe]=V,U[L]=pe,Oe=L);else if(le<_e&&0>o(xe,pe))U[Oe]=xe,U[le]=pe,Oe=le;else break e}}return G}function o(U,G){var pe=U.sortIndex-G.sortIndex;return pe!==0?pe:U.id-G.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var f=Date,m=f.now();n.unstable_now=function(){return f.now()-m}}var g=[],v=[],w=1,S=null,z=3,T=!1,j=!1,C=!1,Q=!1,B=typeof setTimeout=="function"?setTimeout:null,Y=typeof clearTimeout=="function"?clearTimeout:null,J=typeof setImmediate<"u"?setImmediate:null;function q(U){for(var G=s(v);G!==null;){if(G.callback===null)r(v);else if(G.startTime<=U)r(v),G.sortIndex=G.expirationTime,i(g,G);else break;G=s(v)}}function ee(U){if(C=!1,q(U),!j)if(s(g)!==null)j=!0,ne||(ne=!0,be());else{var G=s(v);G!==null&&he(ee,G.startTime-U)}}var ne=!1,F=-1,ue=5,Ne=-1;function we(){return Q?!0:!(n.unstable_now()-NeU&&we());){var Oe=S.callback;if(typeof Oe=="function"){S.callback=null,z=S.priorityLevel;var _e=Oe(S.expirationTime<=U);if(U=n.unstable_now(),typeof _e=="function"){S.callback=_e,q(U),G=!0;break t}S===s(g)&&r(g),q(U)}else r(g);S=s(g)}if(S!==null)G=!0;else{var N=s(v);N!==null&&he(ee,N.startTime-U),G=!1}}break e}finally{S=null,z=pe,T=!1}G=void 0}}finally{G?be():ne=!1}}}var be;if(typeof J=="function")be=function(){J(ie)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,ze=ce.port2;ce.port1.onmessage=ie,be=function(){ze.postMessage(null)}}else be=function(){B(ie,0)};function he(U,G){F=B(function(){U(n.unstable_now())},G)}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(U){U.callback=null},n.unstable_forceFrameRate=function(U){0>U||125Oe?(U.sortIndex=pe,i(v,U),s(g)===null&&U===s(v)&&(C?(Y(F),F=-1):C=!0,he(ee,pe-Oe))):(U.sortIndex=_e,i(g,U),j||T||(j=!0,ne||(ne=!0,be()))),U},n.unstable_shouldYield=we,n.unstable_wrapCallback=function(U){var G=z;return function(){var pe=z;z=G;try{return U.apply(this,arguments)}finally{z=pe}}}})(Kd)),Kd}var Ov;function C_(){return Ov||(Ov=1,Qd.exports=R_()),Qd.exports}var Jd={exports:{}},On={};var Mv;function D_(){if(Mv)return On;Mv=1;var n=Ch();function i(g){var v="https://react.dev/errors/"+g;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Jd.exports=D_(),Jd.exports}var kv;function Z_(){if(kv)return xu;kv=1;var n=C_(),i=Ch(),s=U_();function r(e){var t="https://react.dev/errors/"+e;if(1_e||(e.current=Oe[_e],Oe[_e]=null,_e--)}function V(e,t){_e++,Oe[_e]=e.current,e.current=t}var le=N(null),xe=N(null),ge=N(null),ve=N(null);function mt(e,t){switch(V(ge,t),V(xe,e),V(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Kg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Kg(t),e=Jg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}L(le),V(le,e)}function Ve(){L(le),L(xe),L(ge)}function nt(e){e.memoizedState!==null&&V(ve,e);var t=le.current,a=Jg(t,e.type);t!==a&&(V(xe,e),V(le,a))}function Mn(e){xe.current===e&&(L(le),L(xe)),ve.current===e&&(L(ve),vu._currentValue=pe)}var ei,jn;function xn(e){if(ei===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);ei=t&&t[1]||"",jn=-1{for(const d of u)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&r(f)}).observe(document,{childList:!0,subtree:!0});function l(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(u){if(u.ep)return;u.ep=!0;const d=l(u);fetch(u.href,d)}})();function m0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Gd={exports:{}},xo={};var zv;function O_(){if(zv)return xo;zv=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function l(r,u,d){var f=null;if(d!==void 0&&(f=""+d),u.key!==void 0&&(f=""+u.key),"key"in u){d={};for(var p in u)p!=="key"&&(d[p]=u[p])}else d=u;return u=d.ref,{$$typeof:n,type:r,key:f,ref:u!==void 0?u:null,props:d}}return xo.Fragment=i,xo.jsx=l,xo.jsxs=l,xo}var Ev;function M_(){return Ev||(Ev=1,Gd.exports=O_()),Gd.exports}var _=M_(),Yd={exports:{}},Ce={};var Tv;function j_(){if(Tv)return Ce;Tv=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),z=Symbol.iterator;function T(N){return N===null||typeof N!="object"?null:(N=z&&N[z]||N["@@iterator"],typeof N=="function"?N:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,V={};function H(N,$,Y){this.props=N,this.context=$,this.refs=V,this.updater=Y||j}H.prototype.isReactComponent={},H.prototype.setState=function(N,$){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,$,"setState")},H.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function G(){}G.prototype=H.prototype;function W(N,$,Y){this.props=N,this.context=$,this.refs=V,this.updater=Y||j}var B=W.prototype=new G;B.constructor=W,L(B,H.prototype),B.isPureReactComponent=!0;var ne=Array.isArray;function ee(){}var K={H:null,A:null,T:null,S:null},le=Object.prototype.hasOwnProperty;function ze(N,$,Y){var se=Y.ref;return{$$typeof:n,type:N,key:$,ref:se!==void 0?se:null,props:Y}}function ve(N,$){return ze(N.type,$,N.props)}function ie(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function _e(N){var $={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(Y){return $[Y]})}var ce=/\/+/g;function Ee(N,$){return typeof N=="object"&&N!==null&&N.key!=null?_e(""+N.key):$.toString(36)}function he(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(ee,ee):(N.status="pending",N.then(function($){N.status==="pending"&&(N.status="fulfilled",N.value=$)},function($){N.status==="pending"&&(N.status="rejected",N.reason=$)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function D(N,$,Y,se,we){var ge=typeof N;(ge==="undefined"||ge==="boolean")&&(N=null);var ye=!1;if(N===null)ye=!0;else switch(ge){case"bigint":case"string":case"number":ye=!0;break;case"object":switch(N.$$typeof){case n:case i:ye=!0;break;case w:return ye=N._init,D(ye(N._payload),$,Y,se,we)}}if(ye)return we=we(N),ye=se===""?"."+Ee(N,0):se,ne(we)?(Y="",ye!=null&&(Y=ye.replace(ce,"$&/")+"/"),D(we,$,Y,"",function(nt){return nt})):we!=null&&(ie(we)&&(we=ve(we,Y+(we.key==null||N&&N.key===we.key?"":(""+we.key).replace(ce,"$&/")+"/")+ye)),$.push(we)),1;ye=0;var mt=se===""?".":se+":";if(ne(N))for(var Ve=0;Ve>>1,Se=D[Oe];if(0>>1;Oeu(Y,pe))seu(we,Y)?(D[Oe]=we,D[se]=pe,Oe=se):(D[Oe]=Y,D[$]=pe,Oe=$);else if(seu(we,pe))D[Oe]=we,D[se]=pe,Oe=se;else break e}}return Q}function u(D,Q){var pe=D.sortIndex-Q.sortIndex;return pe!==0?pe:D.id-Q.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var m=[],v=[],w=1,S=null,z=3,T=!1,j=!1,L=!1,V=!1,H=typeof setTimeout=="function"?setTimeout:null,G=typeof clearTimeout=="function"?clearTimeout:null,W=typeof setImmediate<"u"?setImmediate:null;function B(D){for(var Q=l(v);Q!==null;){if(Q.callback===null)r(v);else if(Q.startTime<=D)r(v),Q.sortIndex=Q.expirationTime,i(m,Q);else break;Q=l(v)}}function ne(D){if(L=!1,B(D),!j)if(l(m)!==null)j=!0,ee||(ee=!0,_e());else{var Q=l(v);Q!==null&&he(ne,Q.startTime-D)}}var ee=!1,K=-1,le=5,ze=-1;function ve(){return V?!0:!(n.unstable_now()-zeD&&ve());){var Oe=S.callback;if(typeof Oe=="function"){S.callback=null,z=S.priorityLevel;var Se=Oe(S.expirationTime<=D);if(D=n.unstable_now(),typeof Se=="function"){S.callback=Se,B(D),Q=!0;break t}S===l(m)&&r(m),B(D)}else r(m);S=l(m)}if(S!==null)Q=!0;else{var N=l(v);N!==null&&he(ne,N.startTime-D),Q=!1}}break e}finally{S=null,z=pe,T=!1}Q=void 0}}finally{Q?_e():ee=!1}}}var _e;if(typeof W=="function")_e=function(){W(ie)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,Ee=ce.port2;ce.port1.onmessage=ie,_e=function(){Ee.postMessage(null)}}else _e=function(){H(ie,0)};function he(D,Q){K=H(function(){D(n.unstable_now())},Q)}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(D){D.callback=null},n.unstable_forceFrameRate=function(D){0>D||125Oe?(D.sortIndex=pe,i(v,D),l(m)===null&&D===l(v)&&(L?(G(K),K=-1):L=!0,he(ne,pe-Oe))):(D.sortIndex=Se,i(m,D),j||T||(j=!0,ee||(ee=!0,_e()))),D},n.unstable_shouldYield=ve,n.unstable_wrapCallback=function(D){var Q=z;return function(){var pe=z;z=Q;try{return D.apply(this,arguments)}finally{z=pe}}}})(Fd)),Fd}var Ov;function C_(){return Ov||(Ov=1,Kd.exports=R_()),Kd.exports}var Jd={exports:{}},On={};var Mv;function D_(){if(Mv)return On;Mv=1;var n=Dh();function i(m){var v="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Jd.exports=D_(),Jd.exports}var kv;function Z_(){if(kv)return wo;kv=1;var n=C_(),i=Dh(),l=U_();function r(e){var t="https://react.dev/errors/"+e;if(1Se||(e.current=Oe[Se],Oe[Se]=null,Se--)}function Y(e,t){Se++,Oe[Se]=e.current,e.current=t}var se=N(null),we=N(null),ge=N(null),ye=N(null);function mt(e,t){switch(Y(ge,t),Y(we,e),Y(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Kg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Kg(t),e=Fg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}$(se),Y(se,e)}function Ve(){$(se),$(we),$(ge)}function nt(e){e.memoizedState!==null&&Y(ye,e);var t=se.current,a=Fg(t,e.type);t!==a&&(Y(we,e),Y(se,a))}function Mn(e){we.current===e&&($(se),$(we)),ye.current===e&&($(ye),yo._currentValue=pe)}var ei,jn;function xn(e){if(ei===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);ei=t&&t[1]||"",jn=-1)":-1u||A[l]!==Z[u]){var K=` -`+A[l].replace(" at new "," at ");return e.displayName&&K.includes("")&&(K=K.replace("",e.displayName)),K}while(1<=l&&0<=u);break}}}finally{Yi=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?xn(a):""}function jl(e,t){switch(e.tag){case 26:case 27:case 5:return xn(e.type);case 16:return xn("Lazy");case 13:return e.child!==t&&t!==null?xn("Suspense Fallback"):xn("Suspense");case 19:return xn("SuspenseList");case 0:case 15:return Qi(e.type,!1);case 11:return Qi(e.type.render,!1);case 1:return Qi(e.type,!0);case 31:return xn("Activity");default:return""}}function kl(e){try{var t="",a=null;do t+=jl(e,a),a=e,e=e.return;while(e);return t}catch(l){return` -Error generating stack: `+l.message+` -`+l.stack}}var ji=Object.prototype.hasOwnProperty,Xt=n.unstable_scheduleCallback,Ki=n.unstable_cancelCallback,ki=n.unstable_shouldYield,oa=n.unstable_requestPaint,Ee=n.unstable_now,fe=n.unstable_getCurrentPriorityLevel,it=n.unstable_ImmediatePriority,Mt=n.unstable_UserBlockingPriority,Ri=n.unstable_NormalPriority,ca=n.unstable_LowPriority,ti=n.unstable_IdlePriority,fa=n.log,kn=n.unstable_setDisableYieldValue,nn=null,ut=null;function Vt(e){if(typeof fa=="function"&&kn(e),ut&&typeof ut.setStrictMode=="function")try{ut.setStrictMode(nn,e)}catch{}}var cn=Math.clz32?Math.clz32:da,gs=Math.log,qa=Math.LN2;function da(e){return e>>>=0,e===0?32:31-(gs(e)/qa|0)|0}var ha=256,fn=262144,Ba=4194304;function Ji(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 655)DELIM" -R"DELIM(36:case 131072:return e&261888;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 vs(e,t,a){var l=e.pendingLanes;if(l===0)return 0;var u=0,c=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~c,l!==0?u=Ji(l):(h&=b,h!==0?u=Ji(h):a||(a=b&~e,a!==0&&(u=Ji(a))))):(b=l&~c,b!==0?u=Ji(b):h!==0?u=Ji(h):a||(a=l&~e,a!==0&&(u=Ji(a)))),u===0?0:t!==0&&t!==u&&(t&c)===0&&(c=u&-u,a=t&-t,c>=a||c===32&&(a&4194048)!==0)?t:u}function Rl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Kc(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Bu(){var e=Ba;return Ba<<=1,(Ba&62914560)===0&&(Ba=4194304),e}function wr(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function ni(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function an(e,t,a,l,u,c){var h=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var b=e.entanglements,A=e.expirationTimes,Z=e.hiddenUpdates;for(a=h&~a;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Jc=/[\n"\\]/g;function Cn(e){return e.replace(Jc,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ws(e,t,a,l,u,c,h,b){e.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.type=h:e.removeAttribute("type"),t!=null?h==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Rn(t)):e.value!==""+Rn(t)&&(e.value=""+Rn(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?zs(e,h,Rn(t)):a!=null?zs(e,h,Rn(a)):l!=null&&e.removeAttribute("value"),u==null&&c!=null&&(e.defaultChecked=!!c),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Rn(b):e.removeAttribute("name")}function Yu(e,t,a,l,u,c,h,b){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||a!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){Ss(e);return}a=a!=null?""+Rn(a):"",t=t!=null?""+Rn(t):a,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),Ss(e)}function zs(e,t,a){t==="number"&&xs(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Ii(e,t,a,l){if(e=e.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ns=!1;if(En)try{var Fa={};Object.defineProperty(Fa,"passive",{get:function(){Ns=!0}}),window.addEventListener("test",Fa,Fa),window.removeEventListener("test",Fa,Fa)}catch{Ns=!1}var Un=null,Wi=null,Ll=null;function Rr(){if(Ll)return Ll;var e,t=Wi,a=t.length,l,u="value"in Un?Un.value:Un.textContent,c=u.length;for(e=0;e=Wa),qr=" ",_a=!1;function Vl(e,t){switch(e){case"keyup":return no.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lt(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Sa=!1;function kt(e,t){switch(e){case"compositionend":return Lt(t);case"keypress":return t.which!==32?null:(_a=!0,qr);case"textInput":return e=t.data,e===qr&&_a?null:e;default:return null}}function io(e,t){if(Sa)return e==="compositionend"||!Os&&Vl(e,t)?(e=Rr(),Ll=Wi=Un=null,Sa=!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=t)return{node:a,offset:t-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Me(a)}}function ot(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ot(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _t(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=xs(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=xs(e.document)}return t}function Rt(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 et=En&&"documentMode"in document&&11>=document.documentMode,lt=null,hn=null,Ht=null,Tn=!1;function Yn(e,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Tn||lt==null||lt!==xs(l)||(l=lt,"selectionStart"in l&&Rt(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Ht&&De(Ht,l)||(Ht=l,l=Jo(hn,"onSelect"),0>=h,u-=h,na=1<<32-cn(t)+u|a<Ze?(qe=ye,ye=null):qe=ye.sibling;var Je=$(k,ye,D[Ze],I);if(Je===null){ye===null&&(ye=qe);break}e&&ye&&Je.alternate===null&&t(k,ye),M=c(Je,M,Ze),Ke===null?Te=Je:Ke.sibling=Je,Ke=Je,ye=qe}if(Ze===D.length)return a(k,ye),Ge&&za(k,Ze),T)DELIM" -R"DELIM(e;if(ye===null){for(;ZeZe?(qe=ye,ye=null):qe=ye.sibling;var xl=$(k,ye,Je.value,I);if(xl===null){ye===null&&(ye=qe);break}e&&ye&&xl.alternate===null&&t(k,ye),M=c(xl,M,Ze),Ke===null?Te=xl:Ke.sibling=xl,Ke=xl,ye=qe}if(Je.done)return a(k,ye),Ge&&za(k,Ze),Te;if(ye===null){for(;!Je.done;Ze++,Je=D.next())Je=W(k,Je.value,I),Je!==null&&(M=c(Je,M,Ze),Ke===null?Te=Je:Ke.sibling=Je,Ke=Je);return Ge&&za(k,Ze),Te}for(ye=l(ye);!Je.done;Ze++,Je=D.next())Je=H(ye,k,Ze,Je.value,I),Je!==null&&(e&&Je.alternate!==null&&ye.delete(Je.key===null?Ze:Je.key),M=c(Je,M,Ze),Ke===null?Te=Je:Ke.sibling=Je,Ke=Je);return e&&ye.forEach(function(N_){return t(k,N_)}),Ge&&za(k,Ze),Te}function dt(k,M,D,I){if(typeof D=="object"&&D!==null&&D.type===C&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case T:e:{for(var Te=D.key;M!==null;){if(M.key===Te){if(Te=D.type,Te===C){if(M.tag===7){a(k,M.sibling),I=u(M,D.props.children),I.return=k,k=I;break e}}else if(M.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===ue&&Il(Te)===M.type){a(k,M.sibling),I=u(M,D.props),Jr(I,D),I.return=k,k=I;break e}a(k,M);break}else t(k,M);M=M.sibling}D.type===C?(I=Ql(D.props.children,k.mode,I,D.key),I.return=k,k=I):(I=co(D.type,D.key,D.props,null,k.mode,I),Jr(I,D),I.return=k,k=I)}return h(k);case j:e:{for(Te=D.key;M!==null;){if(M.key===Te)if(M.tag===4&&M.stateNode.containerInfo===D.containerInfo&&M.stateNode.implementation===D.implementation){a(k,M.sibling),I=u(M,D.children||[]),I.return=k,k=I;break e}else{a(k,M);break}else t(k,M);M=M.sibling}I=rf(D,k.mode,I),I.return=k,k=I}return h(k);case ue:return D=Il(D),dt(k,M,D,I)}if(he(D))return me(k,M,D,I);if(be(D)){if(Te=be(D),typeof Te!="function")throw Error(r(150));return D=Te.call(D),je(k,M,D,I)}if(typeof D.then=="function")return dt(k,M,yo(D),I);if(D.$$typeof===J)return dt(k,M,mo(k,D),I);bo(k,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,M!==null&&M.tag===6?(a(k,M.sibling),I=u(M,D),I.return=k,k=I):(a(k,M),I=sf(D,k.mode,I),I.return=k,k=I),h(k)):a(k,M)}return function(k,M,D,I){try{Kr=0;var Te=dt(k,M,D,I);return Ls=null,Te}catch(ye){if(ye===$s||ye===go)throw ye;var Ke=li(29,ye,null,k.mode);return Ke.lanes=I,Ke.return=k,Ke}}}var Wl=$m(!0),Lm=$m(!1),ll=!1;function bf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _f(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 sl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function rl(e,t,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Ie&2)!==0){var u=l.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),l.pending=t,t=oo(e),xm(e,null,a),t}return uo(e,l,t,a),oo(e)}function Fr(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,ma(e,a)}}function Sf(e,t){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var u=null,c=null;if(a=a.firstBaseUpdate,a!==null){do{var h={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};c===null?u=c=h:c=c.next=h,a=a.next}while(a!==null);c===null?u=c=t:c=c.next=t}else u=c=t;a={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:c,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var xf=!1;function Xr(){if(xf){var e=Zs;if(e!==null)throw e}}function Ir(e,t,a,l){xf=!1;var u=e.updateQueue;ll=!1;var c=u.firstBaseUpdate,h=u.lastBaseUpdate,b=u.shared.pending;if(b!==null){u.shared.pending=null;var A=b,Z=A.next;A.next=null,h===null?c=Z:h.next=Z,h=A;var K=e.alternate;K!==null&&(K=K.updateQueue,b=K.lastBaseUpdate,b!==h&&(b===null?K.firstBaseUpdate=Z:b.next=Z,K.lastBaseUpdate=A))}if(c!==null){var W=u.baseState;h=0,K=Z=A=null,b=c;do{var $=b.lane&-536870913,H=$!==b.lane;if(H?(He&$)===$:(l&$)===$){$!==0&&$===Us&&(xf=!0),K!==null&&(K=K.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var me=e,je=b;$=t;var dt=a;switch(je.tag){case 1:if(me=je.payload,typeof me=="function"){W=me.call(dt,W,$);break e}W=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=je.payload,$=typeof me=="function"?me.call(dt,W,$):me,$==null)break e;W=S({},W,$);break e;case 2:ll=!0}}$=b.callback,$!==null&&(e.flags|=64,H&&(e.flags|=8192),H=u.callbacks,H===null?u.callbacks=[$]:H.push($))}else H={lane:$,tag:b.tag,payload:b.payload,callback:b.callback,next:null},K===null?(Z=K=H,A=W):K=K.next=H,h|=$;if(b=b.next,b===null){if(b=u.shared.pending,b===null)break;H=b,b=H.next,H.next=null,u.lastBaseUpdate=H,u.shared.pending=null}}while(!0);K===null&&(A=W),u.baseState=A,u.firstBaseUpdate=Z,u.lastBaseUpdate=K,c===null&&(u.shared.lanes=0),dl|=h,e.lanes=h,e.memoizedState=W}}function Hm(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function qm(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;ec?c:8;var h=U.T,b={};U.T=b,qf(e,!1,t,a);try{var A=u(),Z=U.S;if(Z!==null&&Z(b,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var K=v1(A,l);eu(e,t,K,ci(e))}else eu(e,t,l,ci(e))}catch(W){eu(e,t,{then:function(){},status:"rejected",reason:W},ci())}finally{G.p=c,h!==null&&b.types!==null&&(h.types=b.types),U.T=h}}function w1(){}function Lf(e,t,a,l){if(e.tag!==5)throw Error(r(476));var u=bp(e).queue;yp(e,u,t,pe,a===null?w1:function(){return _p(e),a(l)})}function bp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:pe,baseState:pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:pe},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function _p(e){var t=bp(e);t.next===null&&(t=e.alternate.memoizedState),eu(e,t.next.queue,{},ci())}function Hf(){return gn(vu)}function Sp(){return Bt().memoizedState}function xp(){return Bt().memoizedState}function z1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=ci();e=sl(a);var l=rl(t,e,a);l!==null&&(In(l,t,a),Fr(l,t,a)),t={cache:pf()},e.payload=t;return}t=t.return}}function E1(e,t,a){var l=ci();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Oo(e)?zp(t,a):(a=af(e,t,a,l),a!==null&&(In(a,e,l),Ep(a,t,l)))}function wp(e,t,a){var l=ci();eu(e,t,a,l)}function eu(e,t,a,l){var u={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Oo(e))zp(t,u);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var h=t.lastRenderedState,b=c(h,a);if(u.hasEagerState=!0,u.eagerState=b,Re(b,h))return uo(e,t,u,0),pt===null&&ro(),!1}catch{}if(a=af(e,t,u,l),a!==null)return In(a,e,l),Ep(a,t,l),!0}return!1}function qf(e,t,a,l){if(l={lane:2,revertLane:bd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Oo(e)){if(t)throw Error(r(479))}else t=af(e,a,l,2),t!==null&&In(t,e,2)}function Oo(e){var t=e.alternate;return e===Ue||t!==null&&t===Ue}function zp(e,t){qs=xo=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Ep(e,t,a){if((a&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,ma(e,a)}}var tu={readContext:gn,use:Eo,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};tu.useEffectEvent=Ct;var Tp={readContext:gn,use:Eo,useCallback:function(e,t){return $n().memoizedState=[e,t===void 0?null:t],e},useContext:gn,useEffect:op,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Ao(4194308,4,hp.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Ao(4194308,4,e,t)},useInsertionEffect:function(e,t){Ao(4,2,e,t)},useMemo:function(e,t){var a=$n();t=t===void 0?null:t;var l=e();if(es){Vt(!0);try{e()}finally{Vt(!1)}}return a.memoizedState=[l,t],l},useReducer:function(e,t,a){var l=$n();if(a!==void 0){var u=a(t);if(es){Vt(!0);try{a(t)}finally{Vt(!1)}}}else u=t;return l.memoizedState=l.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},l.queue=e,e=e.dispatch=E1.bind(null,Ue,e),[l.memoizedState,e]},useRef:function(e){var t=$n();return e={current:e},t.memoizedState=e},useState:function(e){e=Cf(e);var t=e.queue,a=wp.bind(null,Ue,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Zf,useDeferredValue:function(e,t){var a=$n();return $f(a,e,t)},useTransition:function(){var e=Cf(!1);return e=yp.bind(null,Ue,e.queue,!0,!1),$n().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var l=Ue,u=$n();if(Ge){if(a===void 0)throw Error(r(407));a=a()}else{if(a=t(),pt===null)throw Error(r(349));(He&127)!==0||Km(l,t,a)}u.memoizedState=a;var c={value:a,getSnapshot:t};return u.queue=c,op(Fm.bind(null,l,c,e),[e]),l.flags|=2048,Vs(9,{destroy:void 0},Jm.bind(null,l,c,a,t),null),a},useId:function(){var e=$n(),t=pt.identifierPrefix;if(Ge){var a=ia,l=na;a=(l&~(1<<32-cn(l)-1)).toString(32)+a,t="_"+t+"R_"+a,a=wo++,0<\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof l.is=="string"?h.createElement("select",{is:l.is}):h.createElement("select"),l.multiple?c.multiple=!0:l.size&&(c.size=l.size);break;default:c=typeof l.is=="string"?h.createElement(u,{is:l.is}):h.createElement(u)}}c[It]=t,c[zn]=l;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(yn(c,u,l),u){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Ma(t)}}return xt(t),td(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Ma(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(r(166));if(e=ge.current,Cs(t)){if(e=t.stateNode,a=t.memoizedProps,l=null,u=pn,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}e[It]=t,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Yg(e.nodeValue,a)),e||il(t,!0)}else e=Fo(e).createTextNode(l),e[It]=t,t.stateNode=e}return xt(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(l=Cs(t),a!==null){if(e===null){if(!l)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[It]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;xt(t),e=!1}else a=ff(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(ri(t),t):(ri(t),null);if((t.flags&128)!==0)throw Error(r(558))}return xt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Cs(t),l!==null&&l.dehydrated!==null){if(e===null){if(!u)throw Error(r(318));if(u=t.memoizedState,u)DELIM" -R"DELIM(=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[It]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;xt(t),u=!1}else u=ff(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(ri(t),t):(ri(t),null)}return ri(t),(t.flags&128)!==0?(t.lanes=a,t):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=t.child,u=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(u=l.alternate.memoizedState.cachePool.pool),c=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(c=l.memoizedState.cachePool.pool),c!==u&&(l.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Co(t,t.updateQueue),xt(t),null);case 4:return Ve(),e===null&&wd(t.stateNode.containerInfo),xt(t),null;case 10:return Ta(t.type),xt(t),null;case 19:if(L(qt),l=t.memoizedState,l===null)return xt(t),null;if(u=(t.flags&128)!==0,c=l.rendering,c===null)if(u)iu(l,!1);else{if(Dt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=So(e),c!==null){for(t.flags|=128,iu(l,!1),e=c.updateQueue,t.updateQueue=e,Co(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)wm(a,e),a=a.sibling;return V(qt,qt.current&1|2),Ge&&za(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&Ee()>Lo&&(t.flags|=128,u=!0,iu(l,!1),t.lanes=4194304)}else{if(!u)if(e=So(c),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Co(t,e),iu(l,!0),l.tail===null&&l.tailMode==="hidden"&&!c.alternate&&!Ge)return xt(t),null}else 2*Ee()-l.renderingStartTime>Lo&&a!==536870912&&(t.flags|=128,u=!0,iu(l,!1),t.lanes=4194304);l.isBackwards?(c.sibling=t.child,t.child=c):(e=l.last,e!==null?e.sibling=c:t.child=c,l.last=c)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Ee(),e.sibling=null,a=qt.current,V(qt,u?a&1|2:a&1),Ge&&za(t,l.treeForkCount),e):(xt(t),null);case 22:case 23:return ri(t),zf(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(xt(t),t.subtreeFlags&6&&(t.flags|=8192)):xt(t),a=t.updateQueue,a!==null&&Co(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),e!==null&&L(Xl),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ta(Yt),xt(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function M1(e,t){switch(of(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ta(Yt),Ve(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Mn(t),null;case 31:if(t.memoizedState!==null){if(ri(t),t.alternate===null)throw Error(r(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ri(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return L(qt),null;case 4:return Ve(),null;case 10:return Ta(t.type),null;case 22:case 23:return ri(t),zf(),e!==null&&L(Xl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ta(Yt),null;case 25:return null;default:return null}}function Xp(e,t){switch(of(t),t.tag){case 3:Ta(Yt),Ve();break;case 26:case 27:case 5:Mn(t);break;case 4:Ve();break;case 31:t.memoizedState!==null&&ri(t);break;case 13:ri(t);break;case 19:L(qt);break;case 10:Ta(t.type);break;case 22:case 23:ri(t),zf(),e!==null&&L(Xl);break;case 24:Ta(Yt)}}function au(e,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var u=l.next;a=u;do{if((a.tag&e)===e){l=void 0;var c=a.create,h=a.inst;l=c(),h.destroy=l}a=a.next}while(a!==u)}}catch(b){rt(t,t.return,b)}}function cl(e,t,a){try{var l=t.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var c=u.next;l=c;do{if((l.tag&e)===e){var h=l.inst,b=h.destroy;if(b!==void 0){h.destroy=void 0,u=t;var A=a,Z=b;try{Z()}catch(K){rt(u,A,K)}}}l=l.next}while(l!==c)}}catch(K){rt(t,t.return,K)}}function Ip(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{qm(t,a)}catch(l){rt(e,e.return,l)}}}function Pp(e,t,a){a.props=ts(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){rt(e,t,l)}}function lu(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(u){rt(e,t,u)}}function aa(e,t){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(u){rt(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){rt(e,t,u)}else a.current=null}function Wp(e){var t=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(u){rt(e,e.return,u)}}function nd(e,t,a){try{var l=e.stateNode;P1(l,e.type,a,t),l[zn]=t}catch(u){rt(e,e.return,u)}}function eg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&vl(e.type)||e.tag===4}function id(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||eg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&vl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ad(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Dn));else if(l!==4&&(l===27&&vl(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(ad(e,t,a),e=e.sibling;e!==null;)ad(e,t,a),e=e.sibling}function Do(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(l!==4&&(l===27&&vl(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Do(e,t,a),e=e.sibling;e!==null;)Do(e,t,a),e=e.sibling}function tg(e){var t=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);yn(t,l,a),t[It]=e,t[zn]=a}catch(c){rt(e,e.return,c)}}var ja=!1,Jt=!1,ld=!1,ng=typeof WeakSet=="function"?WeakSet:Set,un=null;function j1(e,t){if(e=e.containerInfo,Td=nc,e=_t(e),Rt(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var u=l.anchorOffset,c=l.focusNode;l=l.focusOffset;try{a.nodeType,c.nodeType}catch{a=null;break e}var h=0,b=-1,A=-1,Z=0,K=0,W=e,$=null;t:for(;;){for(var H;W!==a||u!==0&&W.nodeType!==3||(b=h+u),W!==c||l!==0&&W.nodeType!==3||(A=h+l),W.nodeType===3&&(h+=W.nodeValue.length),(H=W.firstChild)!==null;)$=W,W=H;for(;;){if(W===e)break t;if($===a&&++Z===u&&(b=h),$===c&&++K===l&&(A=h),(H=W.nextSibling)!==null)break;W=$,$=W.parentNode}W=H}a=b===-1||A===-1?null:{start:b,end:A}}else a=null}a=a||{start:0,end:0}}else a=null;for(Ad={focusedElem:e,selectionRange:a},nc=!1,un=t;un!==null;)if(t=un,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,un=e;else for(;un!==null;){switch(t=un,c=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a title"))),yn(c,l,a),c[It]=e,$t(c),l=c;break e;case"link":var h=uv("link","href",u).get(l+(a.href||""));if(h){for(var b=0;bdt&&(h=dt,dt=je,je=h);var k=Se(b,je),M=Se(b,dt);if(k&&M&&(H.rangeCount!==1||H.anchorNode!==k.node||H.anchorOffset!==k.offset||H.focusNode!==M.node||H.focusOffset!==M.offset)){var D=W.createRange();D.setStart(k.node,k.offset),H.removeAllRanges(),je>dt?(H.addRange(D),H.extend(M.node,M.offset)):(D.setEnd(M.node,M.offset),H.addRange(D))}}}}for(W=[],H=b;H=H.parentNode;)H.nodeType===1&&W.push({element:H,left:H.scrollLeft,top:H.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;ba?32:a,U.T=null,a=dd,dd=null;var c=ml,h=Ua;if(Pt=0,Js=ml=null,Ua=0,(Ie&6)!==0)throw Error(r(331));var b=Ie;if(Ie|=4,hg(c.current),cg(c,c.current,h,a),Ie=b,fu(0,!1),ut&&typeof ut.onPostCommitFiberRoot=="function")try{ut.onPostCommitFiberRoot(nn,c)}catch{}return!0}finally{G.p=u,U.T=l,jg(e,t)}}function Rg(e,t,a){t=_i(a,t),t=Yf(e.stateNode,t,2),e=rl(e,t,2),e!==null&&(ni(e,2),la(e))}function rt(e,t,a){if(e.tag===3)Rg(e,e,a);else for(;t!==null;){if(t.tag===3){Rg(t,e,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(hl===null||!hl.has(l))){e=_i(a,e),a=Cp(2),l=rl(t,a,2),l!==null&&(Dp(a,l,t,e),ni(l,2),la(l));break}}t=t.return}}function gd(e,t,a){var l=e.pingCache;if(l===null){l=e.pingCache=new C1;var u=new Set;l.set(t,u)}else u=l.get(t),u===void 0&&(u=new Set,l.set(t,u));u.has(a)||(ud=!0,u.add(a),e=L1.bind(null,e,t,a),t.then(e,e))}function L1(e,t,a){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,pt===e&&(He&a)===a&&(Dt===4||Dt===3&&(He&62914560)===He&&300>Ee()-$o?(Ie&2)===0&&Fs(e,0):od|=a,Ks===He&&(Ks=0)),la(e)}function Cg(e,t){t===0&&(t=Bu()),e=Yl(e,t),e!==null&&(ni(e,t),la(e))}function H1(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Cg(e,a)}function q1(e,t){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(t),Cg(e,a)}function B1(e,t){return Xt(e,t)}var Yo=null,Is=null,vd=!1,Qo=!1,yd=!1,gl=0;function la(e){e!==Is&&e.next===null&&(Is===null?Yo=Is=e:Is=Is.next=e),Qo=!0,vd||(vd=!0,G1())}function fu(e,t){if(!yd&&Qo){yd=!0;do for(var a=!1,l=Yo;l!==null;){if(e!==0){var u=l.pendingLanes;if(u===0)var c=0;else{var h=l.suspendedLanes,b=l.pingedLanes;c=(1<<31-cn(42|e)+1)-1,c&=u&~(h&~b),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(a=!0,$g(l,c))}else c=He,c=vs(l,l===pt?c:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(c&3)===0||Rl(l,c)||(a=!0,$g(l,c));l=l.next}while(a);yd=!1}}function V1(){Dg()}function Dg(){Qo=vd=!1;var e=0;gl!==0&&e_()&&(e=gl);for(var t=Ee(),a=null,l=Yo;l!==null;){var u=l.next,c=Ug(l,t);c===0?(l.next=null,a===null?Yo=u:a.next=u,u===null&&(Is=a)):(a=l,(e!==0||(c&3)!==0)&&(Qo=!0)),l=u}Pt!==0&&Pt!==5||fu(e),gl!==0&&(gl=0)}function Ug(e,t){for(var a=e.suspendedLanes,l=e.pingedLanes,u=e.expirationTimes,c=e.pendingLanes&-62914561;0b)break;var K=A.transferSize,W=A.initiatorType;K&&Qg(W)&&(A=A.responseEnd,h+=K*(A"u"?null:document;function av(e,t,a){var l=Ps;if(l&&typeof t=="string"&&t){var u=Cn(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),iv.has(u)||(iv.add(u),e={rel:e,crossOrigin:a,href:t},l.querySelector(u)===null&&(t=l.createElement("link"),yn(t,"link",e),$t(t),l.head.appendChild(t)))}}function o_(e){Za.D(e),av("dns-prefetch",e,null)}function c_(e,t){Za.C(e,t),av("preconnect",e,t)}function f_(e,t,a){Za.L(e,t,a);var l=Ps;if(l&&e&&t){var u='link[rel="preload"][as="'+Cn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+Cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+Cn(a.imageSizes)+'"]')):u+='[href="'+Cn(e)+'"]';var c=u;switch(t){case"style":c=Ws(e);break;case"script":c=er(e)}Ti.has(c)||(e=S({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Ti.set(c,e),l.querySelector(u)!==null||t==="style"&&l.querySelector(pu(c))||t==="script"&&l.querySelector(gu(c))||(t=l.createElement("link"),yn(t,"link",e),$t(t),l.head.appendChild(t)))}}function d_(e,t){Za.m(e,t);var a=Ps;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Cn(l)+'"][href="'+Cn(e)+'"]',c=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=er(e)}if(!Ti.has(c)&&(e=S({rel:"modulepreload",href:e},t),Ti.set(c,e),a.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(gu(c)))return}l=a.createElement("link"),yn(l,"link",e),$t(l),a.head.appendChild(l)}}}function h_(e,t,a){Za.S(e,t,a);var l=Ps;if(l&&e){var u=gi(l).hoistableStyles,c=Ws(e);t=t||"default";var h=u.get(c);if(!h){var b={loading:0,preload:null};if(h=l.querySelector(pu(c)))b.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Ti.get(c))&&Cd(e,a);var A=h=l.createElement("link");$t(A),yn(A,"link",e),A._p=new Promise(function(Z,K){A.onload=Z,A.onerror=K}),A.addEventListener("load",function(){b.loading|=1}),A.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Io(h,t,l)}h={type:"stylesheet",instance:h,count:1,state:b},u.set(c,h)}}}function m_(e,t){Za.X(e,t);var a=Ps;if(a&&e){var l=gi(a).hoistableScripts,u=er(e),c=l.get(u);c||(c=a.querySelector(gu(u)),c||(e=S({src:e,async:!0},t),(t=Ti.get(u))&&Dd(e,t),c=a.createElement("script"),$t(c),yn(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(u,c))}}function p_(e,t){Za.M(e,t);var a=Ps;if(a&&e){var l=gi(a).hoistableScripts,u=er(e),c=l.get(u);c||(c=a.querySelector(gu(u)),c||(e=S({s)DELIM" -R"DELIM(rc:e,async:!0,type:"module"},t),(t=Ti.get(u))&&Dd(e,t),c=a.createElement("script"),$t(c),yn(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(u,c))}}function lv(e,t,a,l){var u=(u=ge.current)?Xo(u):null;if(!u)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Ws(a.href),a=gi(u).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Ws(a.href);var c=gi(u).hoistableStyles,h=c.get(e);if(h||(u=u.ownerDocument||u,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,h),(c=u.querySelector(pu(e)))&&!c._p&&(h.instance=c,h.state.loading=5),Ti.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Ti.set(e,a),c||g_(u,e,a,h.state))),t&&l===null)throw Error(r(528,""));return h}if(t&&l!==null)throw Error(r(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=er(a),a=gi(u).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Ws(e){return'href="'+Cn(e)+'"'}function pu(e){return'link[rel="stylesheet"]['+e+"]"}function sv(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function g_(e,t,a,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),yn(t,"link",a),$t(t),e.head.appendChild(t))}function er(e){return'[src="'+Cn(e)+'"]'}function gu(e){return"script[async]"+e}function rv(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+Cn(a.href)+'"]');if(l)return t.instance=l,$t(l),l;var u=S({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),$t(l),yn(l,"style",u),Io(l,a.precedence,e),t.instance=l;case"stylesheet":u=Ws(a.href);var c=e.querySelector(pu(u));if(c)return t.state.loading|=4,t.instance=c,$t(c),c;l=sv(a),(u=Ti.get(u))&&Cd(l,u),c=(e.ownerDocument||e).createElement("link"),$t(c);var h=c;return h._p=new Promise(function(b,A){h.onload=b,h.onerror=A}),yn(c,"link",l),t.state.loading|=4,Io(c,a.precedence,e),t.instance=c;case"script":return c=er(a.src),(u=e.querySelector(gu(c)))?(t.instance=u,$t(u),u):(l=a,(u=Ti.get(c))&&(l=S({},a),Dd(l,u)),e=e.ownerDocument||e,u=e.createElement("script"),$t(u),yn(u,"link",l),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Io(l,a.precedence,e));return t.instance}function Io(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,c=u,h=0;h title"):null)}function v_(e,t,a){if(a===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 cv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function y_(e,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Ws(l.href),c=t.querySelector(pu(u));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Wo.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=c,$t(c);return}c=t.ownerDocument||t,l=sv(l),(u=Ti.get(u))&&Cd(l,u),c=c.createElement("link"),$t(c);var h=c;h._p=new Promise(function(b,A){h.onload=b,h.onerror=A}),yn(c,"link",l),a.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Wo.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Ud=0;function b_(e,t){return e.stylesheets&&e.count===0&&tc(e,e.stylesheets),0Ud?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function Wo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ec=null;function tc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ec=new Map,t.forEach(__,e),ec=null,Wo.call(e))}function __(e,t){if(!(t.state.loading&4)){var a=ec.get(e);if(a)var l=a.get(null);else{a=new Map,ec.set(e,a);for(var u=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(),Yd.exports=Z_(),Yd.exports}var L_=$_();const H_=m0(L_),p0="libbitcoinAdminDashboardBrowserNotifications";function g0(){try{return globalThis.window?.localStorage??null}catch{return null}}function Dh(){const n=globalThis.Notification;return typeof n=="function"?n:null}function v0(){return Dh()?.permission??"unsupported"}async function q_(){const n=Dh();return n?n.permission!=="default"?n.permission:n.requestPermission():"unsupported"}function B_(n=g0()){try{return v0()==="granted"&&n?.getItem(p0)==="true"}catch{return!1}}function V_(n,i=g0()){try{i?.setItem(p0,String(n))}catch{}}function G_(n,i){const s=Dh();if(!s||s.permission!=="granted")return!1;try{return new s(n,i),!0}catch{return!1}}const Uh="libbitcoinAdminDashboardEndpoints";function Zh(){try{return globalThis.window?.localStorage??null}catch{return null}}function Y_(){return globalThis.window?.location.origin??"http://localhost"}function ua(n){const i=n.trim();if(!i)throw new Error("Endpoint URL is required");const s=/^[a-z][a-z\d+\-.]*:\/\//iu.test(i)?i:`http://${i}`,r=new URL(s);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 Q_(n){const i=new URL(ua(n));return i.protocol=i.protocol==="https:"?"wss:":"ws:",i.pathname="/",i.search="",i.hash="",i.toString()}function K_(n,i=Y_()){return new URL(ua(n)).origin===new URL(i).origin}function y0(){return{adminUrl:ua("http://172.20.208.1:8080"),nativeUrl:ua("http://172.20.208.1:80")}}function J_(n=Zh()){const i=y0();try{const s=n?.getItem(Uh);if(!s)return i;const r=JSON.parse(s);if(!r||typeof r!="object"||Array.isArray(r))return i;const o=r;return{adminUrl:typeof o.adminUrl=="string"?ua(o.adminUrl):i.adminUrl,nativeUrl:typeof o.nativeUrl=="string"?ua(o.nativeUrl):i.nativeUrl}}catch{return i}}function F_(n,i=Zh()){const s={adminUrl:ua(n.adminUrl),nativeUrl:ua(n.nativeUrl)};try{i?.setItem(Uh,JSON.stringify(s))}catch{}}function X_(n=Zh()){try{n?.removeItem(Uh)}catch{}}function I_({configuration:n,browserNotificationsEnabled:i,onClose:s,onBrowserNotificationsEnabledChange:r,onReset:o,onSave:d}){const[f,m]=se.useState(n.adminUrl),[g,v]=se.useState(n.nativeUrl),[w,S]=se.useState(null),[z,T]=se.useState(v0),[j,C]=se.useState(!1),[Q,B]=se.useState(null),Y=i&&z==="granted";async function J(){if(Y){r(!1);return}C(!0),B(null);try{const ee=await q_();T(ee),ee==="granted"?r(!0):ee==="denied"&&B("Permission was denied. It can be changed in your browser settings.")}catch{B("The browser could not enable notifications.")}finally{C(!1)}}function q(ee){ee.preventDefault();try{d({adminUrl:ua(f),nativeUrl:ua(g)})}catch(ne){S(ne instanceof Error?ne.message:"Invalid endpoint configuration")}}return _.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:ee=>{ee.target===ee.currentTarget&&s()},children:_.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"endpoint-settings-title",className:"border-accent/30 bg-surface max-h-[calc(100vh-2rem)] w-full max-w-xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/50",children:[_.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Runtime configuration"}),_.jsx("h2",{id:"endpoint-settings-title",className:"mt-1 text-xl font-semibold",children:"Node endpoints"})]}),_.jsx("button",{type:"button",onClick:s,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close endpoint settings",children:"×"})]}),_.jsxs("form",{onSubmit:q,className:"space-y-5 p-5",children:[_.jsxs("label",{className:"block space-y-2",children:[_.jsx("span",{className:"text-textPrimary text-sm font-medium",children:"Admin endpoint"}),_.jsx("input",{value:f,onChange:ee=>{m(ee.target.value)},className:"border-accent/30 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 font-mono text-sm focus:ring-0",placeholder:"http://node-host:admin-port",autoComplete:"url"})]}),_.jsxs("label",{className:"block space-y-2",children:[_.jsx("span",{className:"text-textPrimary text-sm font-medium",children:"Native endpoint"}),_.jsx("input",{value:g,onChange:ee=>{v(ee.target.value)},className:"border-accent/30 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 font-mono text-sm focus:ring-0",placeholder:"http://node-host:native-port",autoComplete:"url"})]}),_.jsxs("div",{className:"border-accent/20 bg-background/35 space-y-3 rounded-xl border p-4",children:[_.jsxs("div",{children:[_.jsx("h3",{className:"text-textPrimary text-sm font-medium",children:"Browser notifications"}),_.jsx("p",{id:"browser-notifications-help",className:"text-textMuted mt-1 text-xs",children:W_(z,Y,j)})]}),_.jsx("button",{type:"button","aria-describedby":"browser-notifications-help",disabled:j||z==="unsupported"||z==="denied",onClick:()=>{J()},className:"border-accent/30 text-textMuted hover:border-accent hover:text-accent rounded-lg border px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:P_(z,Y,j)}),Q&&_.jsx("p",{className:"text-sm text-red-300",role:"alert",children:Q})]}),w&&_.jsx("p",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-300",children:w}),_.jsxs("div",{className:"flex flex-wrap justify-between gap-3 pt-2",children:[_.jsx("button",{type:"button",onClick:o,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-4 py-2 text-sm",children:"Reset defaults"}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:s,className:"text-textMuted hover:text-textPrimary rounded-lg px-4 py-2 text-sm",children:"Cancel"}),_.jsx("button",{type:"submit",className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold",children:"Save endpoints"})]})]})]})]})})}function P_(n,i,s){return s?"Req)DELIM" -R"DELIM(uesting permission…":n==="unsupported"?"Notifications unavailable":n==="denied"?"Blocked by browser":i?"Disable notifications":"Enable notifications"}function W_(n,i,s){return s?"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."}var Cv;function P(n,i,s){function r(m,g){if(m._zod||Object.defineProperty(m,"_zod",{value:{def:g,constr:f,traits:new Set},enumerable:!1}),m._zod.traits.has(n))return;m._zod.traits.add(n),i(m,g);const v=f.prototype,w=Object.keys(v);for(let S=0;Ss?.Parent&&m instanceof s.Parent?!0:m?._zod?.traits?.has(n)}),Object.defineProperty(f,"name",{value:n}),f}class ur extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class b0 extends Error{constructor(i){super(`Encountered unidirectional transform during encode: ${i}`),this.name="ZodEncodeError"}}(Cv=globalThis).__zod_globalConfig??(Cv.__zod_globalConfig={});const $h=globalThis.__zod_globalConfig;function fs(n){return $h}function _0(n){const i=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,o])=>i.indexOf(+r)===-1).map(([r,o])=>o)}function uh(n,i){return typeof i=="bigint"?i.toString():i}function Lh(n){return{get value(){{const i=n();return Object.defineProperty(this,"value",{value:i}),i}}}}function Hh(n){return n==null}function qh(n){const i=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;return n.slice(i,s)}function eS(n,i){const s=n/i,r=Math.round(s),o=Number.EPSILON*Math.max(Math.abs(s),1);return Math.abs(s-r){};function Sc(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const nS=Lh(()=>{if($h.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function Ru(n){if(Sc(n)===!1)return!1;const i=n.constructor;if(i===void 0||typeof i!="function")return!0;const s=i.prototype;return!(Sc(s)===!1||Object.prototype.hasOwnProperty.call(s,"isPrototypeOf")===!1)}function x0(n){return Ru(n)?{...n}:Array.isArray(n)?[...n]:n instanceof Map?new Map(n):n instanceof Set?new Set(n):n}const iS=new Set(["string","number","symbol"]);function dr(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ol(n,i,s){const r=new n._zod.constr(i??n._zod.def);return(!i||s?.parent)&&(r._zod.parent=n),r}function Ae(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 aS(n){return Object.keys(n).filter(i=>n[i]._zod.optin==="optional"&&n[i]._zod.optout==="optional")}const lS={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function sS(n,i){const s=n._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const d=Nl(n._zod.def,{get shape(){const f={};for(const m in i){if(!(m in s.shape))throw new Error(`Unrecognized key: "${m}"`);i[m]&&(f[m]=s.shape[m])}return ms(this,"shape",f),f},checks:[]});return Ol(n,d)}function rS(n,i){const s=n._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const d=Nl(n._zod.def,{get shape(){const f={...n._zod.def.shape};for(const m in i){if(!(m in s.shape))throw new Error(`Unrecognized key: "${m}"`);i[m]&&delete f[m]}return ms(this,"shape",f),f},checks:[]});return Ol(n,d)}function uS(n,i){if(!Ru(i))throw new Error("Invalid input to extend: expected a plain object");const s=n._zod.def.checks;if(s&&s.length>0){const d=n._zod.def.shape;for(const f in i)if(Object.getOwnPropertyDescriptor(d,f)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Nl(n._zod.def,{get shape(){const d={...n._zod.def.shape,...i};return ms(this,"shape",d),d}});return Ol(n,o)}function oS(n,i){if(!Ru(i))throw new Error("Invalid input to safeExtend: expected a plain object");const s=Nl(n._zod.def,{get shape(){const r={...n._zod.def.shape,...i};return ms(this,"shape",r),r}});return Ol(n,s)}function cS(n,i){if(n._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const s=Nl(n._zod.def,{get shape(){const r={...n._zod.def.shape,...i._zod.def.shape};return ms(this,"shape",r),r},get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return Ol(n,s)}function fS(n,i,s){const o=i._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const f=Nl(i._zod.def,{get shape(){const m=i._zod.def.shape,g={...m};if(s)for(const v in s){if(!(v in m))throw new Error(`Unrecognized key: "${v}"`);s[v]&&(g[v]=n?new n({type:"optional",innerType:m[v]}):m[v])}else for(const v in m)g[v]=n?new n({type:"optional",innerType:m[v]}):m[v];return ms(this,"shape",g),g},checks:[]});return Ol(i,f)}function dS(n,i,s){const r=Nl(i._zod.def,{get shape(){const o=i._zod.def.shape,d={...o};if(s)for(const f in s){if(!(f in d))throw new Error(`Unrecognized key: "${f}"`);s[f]&&(d[f]=new n({type:"nonoptional",innerType:o[f]}))}else for(const f in o)d[f]=new n({type:"nonoptional",innerType:o[f]});return ms(this,"shape",d),d}});return Ol(i,r)}function rr(n,i=0){if(n.aborted===!0)return!0;for(let s=i;s{var r;return(r=s).path??(r.path=[]),s.path.unshift(n),s})}function oc(n){return typeof n=="string"?n:n?.message}function ds(n,i,s){const r=n.message?n.message:oc(n.inst?._zod.def?.error?.(n))??oc(i?.error?.(n))??oc(s.customError?.(n))??oc(s.localeError?.(n))??"Invalid input",{inst:o,continue:d,input:f,...m}=n;return m.path??(m.path=[]),m.message=r,i?.reportInput&&(m.input=f),m}function Bh(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function Cu(...n){const[i,s,r]=n;return typeof i=="string"?{message:i,code:"custom",input:s,inst:r}:{...i}}const z0=(n,i)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:i,enumerable:!1}),n.message=JSON.stringify(i,uh,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerab)DELIM" -R"DELIM(le:!1})},E0=P("$ZodError",z0),T0=P("$ZodError",z0,{Parent:Error});function mS(n,i=s=>s.message){const s={},r=[];for(const o of n.issues)o.path.length>0?(s[o.path[0]]=s[o.path[0]]||[],s[o.path[0]].push(i(o))):r.push(i(o));return{formErrors:r,fieldErrors:s}}function pS(n,i=s=>s.message){const s={_errors:[]},r=(o,d=[])=>{for(const f of o.issues)if(f.code==="invalid_union"&&f.errors.length)f.errors.map(m=>r({issues:m},[...d,...f.path]));else if(f.code==="invalid_key")r({issues:f.issues},[...d,...f.path]);else if(f.code==="invalid_element")r({issues:f.issues},[...d,...f.path]);else{const m=[...d,...f.path];if(m.length===0)s._errors.push(i(f));else{let g=s,v=0;for(;v(i,s,r,o)=>{const d=r?{...r,async:!1}:{async:!1},f=i._zod.run({value:s,issues:[]},d);if(f instanceof Promise)throw new ur;if(f.issues.length){const m=new(o?.Err??n)(f.issues.map(g=>ds(g,d,fs())));throw S0(m,o?.callee),m}return f.value},Gh=n=>async(i,s,r,o)=>{const d=r?{...r,async:!0}:{async:!0};let f=i._zod.run({value:s,issues:[]},d);if(f instanceof Promise&&(f=await f),f.issues.length){const m=new(o?.Err??n)(f.issues.map(g=>ds(g,d,fs())));throw S0(m,o?.callee),m}return f.value},Dc=n=>(i,s,r)=>{const o=r?{...r,async:!1}:{async:!1},d=i._zod.run({value:s,issues:[]},o);if(d instanceof Promise)throw new ur;return d.issues.length?{success:!1,error:new(n??E0)(d.issues.map(f=>ds(f,o,fs())))}:{success:!0,data:d.value}},gS=Dc(T0),Uc=n=>async(i,s,r)=>{const o=r?{...r,async:!0}:{async:!0};let d=i._zod.run({value:s,issues:[]},o);return d instanceof Promise&&(d=await d),d.issues.length?{success:!1,error:new n(d.issues.map(f=>ds(f,o,fs())))}:{success:!0,data:d.value}},vS=Uc(T0),yS=n=>(i,s,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Vh(n)(i,s,o)},bS=n=>(i,s,r)=>Vh(n)(i,s,r),_S=n=>async(i,s,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Gh(n)(i,s,o)},SS=n=>async(i,s,r)=>Gh(n)(i,s,r),xS=n=>(i,s,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Dc(n)(i,s,o)},wS=n=>(i,s,r)=>Dc(n)(i,s,r),zS=n=>async(i,s,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Uc(n)(i,s,o)},ES=n=>async(i,s,r)=>Uc(n)(i,s,r),TS=/^[cC][0-9a-z]{6,}$/,AS=/^[0-9a-z]+$/,NS=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,OS=/^[0-9a-vA-V]{20}$/,MS=/^[A-Za-z0-9]{27}$/,jS=/^[a-zA-Z0-9_-]{21}$/,kS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,RS=/^([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})$/,Zv=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)$/,CS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,DS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function US(){return new RegExp(DS,"u")}const ZS=/^(?:(?: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])$/,$S=/^(([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}|:))$/,LS=/^((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])$/,HS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,A0=/^[A-Za-z0-9_-]*$/,BS=/^https?$/,VS=/^\+[1-9]\d{6,14}$/,N0="(?:(?:\\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])))",GS=new RegExp(`^${N0}$`);function O0(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}}`:`${i}(?::[0-5]\\d(?:\\.\\d+)?)?`}function YS(n){return new RegExp(`^${O0(n)}$`)}function QS(n){const i=O0({precision:n.precision}),s=["Z"];n.local&&s.push(""),n.offset&&s.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${i}(?:${s.join("|")})`;return new RegExp(`^${N0}T(?:${r})$`)}const KS=n=>{const i=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${i}$`)},JS=/^-?\d+$/,FS=/^-?\d+(?:\.\d+)?$/,XS=/^(?:true|false)$/i,IS=/^[^A-Z]*$/,PS=/^[^a-z]*$/,Wn=P("$ZodCheck",(n,i)=>{var s;n._zod??(n._zod={}),n._zod.def=i,(s=n._zod).onattach??(s.onattach=[])}),M0={number:"number",bigint:"bigint",object:"date"},j0=P("$ZodCheckLessThan",(n,i)=>{Wn.init(n,i);const s=M0[typeof i.value];n._zod.onattach.push(r=>{const o=r._zod.bag,d=(i.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;i.value{(i.inclusive?r.value<=i.value:r.value{Wn.init(n,i);const s=M0[typeof i.value];n._zod.onattach.push(r=>{const o=r._zod.bag,d=(i.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;i.value>d&&(i.inclusive?o.minimum=i.value:o.exclusiveMinimum=i.value)}),n._zod.check=r=>{(i.inclusive?r.value>=i.value:r.value>i.value)||r.issues.push({origin:s,code:"too_small",minimum:typeof i.value=="object"?i.value.getTime():i.value,input:r.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),WS=P("$ZodCheckMultipleOf",(n,i)=>{Wn.init(n,i),n._zod.onattach.push(s=>{var r;(r=s._zod.bag).multipleOf??(r.multipleOf=i.value)}),n._zod.check=s=>{if(typeof s.value!=typeof i.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof s.value=="bigint"?s.value%i.value===BigInt(0):eS(s.value,i.value)===0)||s.issues.push({origin:typeof s.value,code:"not_multiple_of",divisor:i.value,input:s.value,inst:n,continue:!i.abort})}}),ex=P("$ZodCheckNumberFormat",(n,i)=>{Wn.init(n,i),i.format=i.format||"float64";const s=i.format?.includes("int"),r=s?"int":"number",[o,d]=lS[i.format];n._zod.onattach.push(f=>{const m=f._zod.bag;m.format=i.format,m.minimum=o,m.maximum=d,s&&(m.pattern=JS)}),n._zod.check=f=>{const m=f.value;if(s){if(!Number.isInteger(m)){f.issues.push({expected:r,format:i.format,code:"invalid_type",continue:!1,input:m,inst:n});return}if(!Number.isSafeInteger(m)){m>0?f.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!i.abort}):f.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!i.abort});return}}md&&f.issues.push({origin:"number",input:m,code:"too_big",maximum:d,inclusive:!0,inst:n,continue:!i.abort})}}),tx=P("$ZodCheckMaxLength",(n,i)=>{var s;Wn.init(n,i),(s=n._zod.def).when??(s.when=r=>{const o=r.value;return!Hh(o)&&o.length!==void 0}),n._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;i.maximum{const o=r.value;if(o.length<=i.maximum)return;const f=Bh(o);r.issues.push({origin:f,code:"too_big",maximum:i.maximum)DELIM" -R"DELIM(,inclusive:!0,input:o,inst:n,continue:!i.abort})}}),nx=P("$ZodCheckMinLength",(n,i)=>{var s;Wn.init(n,i),(s=n._zod.def).when??(s.when=r=>{const o=r.value;return!Hh(o)&&o.length!==void 0}),n._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;i.minimum>o&&(r._zod.bag.minimum=i.minimum)}),n._zod.check=r=>{const o=r.value;if(o.length>=i.minimum)return;const f=Bh(o);r.issues.push({origin:f,code:"too_small",minimum:i.minimum,inclusive:!0,input:o,inst:n,continue:!i.abort})}}),ix=P("$ZodCheckLengthEquals",(n,i)=>{var s;Wn.init(n,i),(s=n._zod.def).when??(s.when=r=>{const o=r.value;return!Hh(o)&&o.length!==void 0}),n._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=i.length,o.maximum=i.length,o.length=i.length}),n._zod.check=r=>{const o=r.value,d=o.length;if(d===i.length)return;const f=Bh(o),m=d>i.length;r.issues.push({origin:f,...m?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!i.abort})}}),Zc=P("$ZodCheckStringFormat",(n,i)=>{var s,r;Wn.init(n,i),n._zod.onattach.push(o=>{const d=o._zod.bag;d.format=i.format,i.pattern&&(d.patterns??(d.patterns=new Set),d.patterns.add(i.pattern))}),i.pattern?(s=n._zod).check??(s.check=o=>{i.pattern.lastIndex=0,!i.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:i.format,input:o.value,...i.pattern?{pattern:i.pattern.toString()}:{},inst:n,continue:!i.abort})}):(r=n._zod).check??(r.check=()=>{})}),ax=P("$ZodCheckRegex",(n,i)=>{Zc.init(n,i),n._zod.check=s=>{i.pattern.lastIndex=0,!i.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:"regex",input:s.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),lx=P("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=IS),Zc.init(n,i)}),sx=P("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=PS),Zc.init(n,i)}),rx=P("$ZodCheckIncludes",(n,i)=>{Wn.init(n,i);const s=dr(i.includes),r=new RegExp(typeof i.position=="number"?`^.{${i.position}}${s}`:s);i.pattern=r,n._zod.onattach.push(o=>{const d=o._zod.bag;d.patterns??(d.patterns=new Set),d.patterns.add(r)}),n._zod.check=o=>{o.value.includes(i.includes,i.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:i.includes,input:o.value,inst:n,continue:!i.abort})}}),ux=P("$ZodCheckStartsWith",(n,i)=>{Wn.init(n,i);const s=new RegExp(`^${dr(i.prefix)}.*`);i.pattern??(i.pattern=s),n._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(s)}),n._zod.check=r=>{r.value.startsWith(i.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:r.value,inst:n,continue:!i.abort})}}),ox=P("$ZodCheckEndsWith",(n,i)=>{Wn.init(n,i);const s=new RegExp(`.*${dr(i.suffix)}$`);i.pattern??(i.pattern=s),n._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(s)}),n._zod.check=r=>{r.value.endsWith(i.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:r.value,inst:n,continue:!i.abort})}}),cx=P("$ZodCheckOverwrite",(n,i)=>{Wn.init(n,i),n._zod.check=s=>{s.value=i.tx(s.value)}});class fx{constructor(i=[]){this.content=[],this.indent=0,this&&(this.args=i)}indented(i){this.indent+=1,i(this),this.indent-=1}write(i){if(typeof i=="function"){i(this,{execution:"sync"}),i(this,{execution:"async"});return}const r=i.split(` -`).filter(f=>f),o=Math.min(...r.map(f=>f.length-f.trimStart().length)),d=r.map(f=>f.slice(o)).map(f=>" ".repeat(this.indent*2)+f);for(const f of d)this.content.push(f)}compile(){const i=Function,s=this?.args,o=[...(this?.content??[""]).map(d=>` ${d}`)];return new i(...s,o.join(` -`))}}const dx={major:4,minor:4,patch:3},Ut=P("$ZodType",(n,i)=>{var s;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=dx;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const o of r)for(const d of o._zod.onattach)d(n);if(r.length===0)(s=n._zod).deferred??(s.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{const o=(f,m,g)=>{let v=rr(f),w;for(const S of m){if(S._zod.def.when){if(hS(f)||!S._zod.def.when(f))continue}else if(v)continue;const z=f.issues.length,T=S._zod.check(f);if(T instanceof Promise&&g?.async===!1)throw new ur;if(w||T instanceof Promise)w=(w??Promise.resolve()).then(async()=>{await T,f.issues.length!==z&&(v||(v=rr(f,z)))});else{if(f.issues.length===z)continue;v||(v=rr(f,z))}}return w?w.then(()=>f):f},d=(f,m,g)=>{if(rr(f))return f.aborted=!0,f;const v=o(m,r,g);if(v instanceof Promise){if(g.async===!1)throw new ur;return v.then(w=>n._zod.parse(w,g))}return n._zod.parse(v,g)};n._zod.run=(f,m)=>{if(m.skipChecks)return n._zod.parse(f,m);if(m.direction==="backward"){const v=n._zod.parse({value:f.value,issues:[]},{...m,skipChecks:!0});return v instanceof Promise?v.then(w=>d(w,f,m)):d(v,f,m)}const g=n._zod.parse(f,m);if(g instanceof Promise){if(m.async===!1)throw new ur;return g.then(v=>o(v,r,m))}return o(g,r,m)}}ht(n,"~standard",()=>({validate:o=>{try{const d=gS(n,o);return d.success?{value:d.data}:{issues:d.error?.issues}}catch{return vS(n,o).then(f=>f.success?{value:f.data}:{issues:f.error?.issues})}},vendor:"zod",version:1}))}),Yh=P("$ZodString",(n,i)=>{Ut.init(n,i),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??KS(n._zod.bag),n._zod.parse=(s,r)=>{if(i.coerce)try{s.value=String(s.value)}catch{}return typeof s.value=="string"||s.issues.push({expected:"string",code:"invalid_type",input:s.value,inst:n}),s}}),Tt=P("$ZodStringFormat",(n,i)=>{Zc.init(n,i),Yh.init(n,i)}),hx=P("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=RS),Tt.init(n,i)}),mx=P("$ZodUUID",(n,i)=>{if(i.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(r===void 0)throw new Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=Zv(r))}else i.pattern??(i.pattern=Zv());Tt.init(n,i)}),px=P("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=CS),Tt.init(n,i)}),gx=P("$ZodURL",(n,i)=>{Tt.init(n,i),n._zod.check=s=>{try{const r=s.value.trim();if(!i.normalize&&i.protocol?.source===BS.source&&!/^https?:\/\//i.test(r)){s.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:s.value,inst:n,continue:!i.abort});return}const o=new URL(r);i.hostname&&(i.hostname.lastIndex=0,i.hostname.test(o.hostname)||s.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:s.value,inst:n,continue:!i.abort})),i.protocol&&(i.protocol.lastIndex=0,i.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||s.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:s.value,inst:n,continue:!i.abort})),i.normalize?s.value=o.href:s.value=r;return}catch{s.issues.push({code:"invalid_format",format:"url",input:s.value,inst:n,continue:!i.abort})}}}),vx=P("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=US()),Tt.init(n,i)}),yx=P("$ZodNanoID",(n,i)=>{i.pattern??(i.pattern=jS),Tt.init(n,i)}),bx=P("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=TS),Tt.init(n,i)}),_x=P("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=AS),Tt.init(n,i)}),Sx=P("$ZodULID",(n,i)=>{i.pattern??(i.pattern=NS),Tt.init(n,i)}),xx=P("$ZodXID",(n,i)=>{i.pattern??(i.pattern=OS),Tt.init(n,i)}),wx=P("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=MS),Tt.init(n,i)}),zx=P("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=QS(i)),Tt.init(n,i)}),Ex=P("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=GS),Tt.init(n,i)}),Tx=P("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=YS(i)),Tt.init(n,i)}),Ax=P("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=kS),Tt.init(n,i)}),Nx=P("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=ZS),Tt.init(n,i),n._zod.bag.format="ipv4"}),Ox=P("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=$S),Tt.init(n,i),n._zod.bag.format="ipv6",n._zod.check=s=>{try{new URL(`http://[${s.value}]`)}catch{s.issues.push({code:"invalid_format",format:"ipv6",input:s.value,inst:n,continue:!i.abort})}}}),Mx=P("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=LS)DELIM" -R"DELIM(),Tt.init(n,i)}),jx=P("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=HS),Tt.init(n,i),n._zod.check=s=>{const r=s.value.split("/");try{if(r.length!==2)throw new Error;const[o,d]=r;if(!d)throw new Error;const f=Number(d);if(`${f}`!==d)throw new Error;if(f<0||f>128)throw new Error;new URL(`http://[${o}]`)}catch{s.issues.push({code:"invalid_format",format:"cidrv6",input:s.value,inst:n,continue:!i.abort})}}});function R0(n){if(n==="")return!0;if(/\s/.test(n)||n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const kx=P("$ZodBase64",(n,i)=>{i.pattern??(i.pattern=qS),Tt.init(n,i),n._zod.bag.contentEncoding="base64",n._zod.check=s=>{R0(s.value)||s.issues.push({code:"invalid_format",format:"base64",input:s.value,inst:n,continue:!i.abort})}});function Rx(n){if(!A0.test(n))return!1;const i=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),s=i.padEnd(Math.ceil(i.length/4)*4,"=");return R0(s)}const Cx=P("$ZodBase64URL",(n,i)=>{i.pattern??(i.pattern=A0),Tt.init(n,i),n._zod.bag.contentEncoding="base64url",n._zod.check=s=>{Rx(s.value)||s.issues.push({code:"invalid_format",format:"base64url",input:s.value,inst:n,continue:!i.abort})}}),Dx=P("$ZodE164",(n,i)=>{i.pattern??(i.pattern=VS),Tt.init(n,i)});function Ux(n,i=null){try{const s=n.split(".");if(s.length!==3)return!1;const[r]=s;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||i&&(!("alg"in o)||o.alg!==i))}catch{return!1}}const Zx=P("$ZodJWT",(n,i)=>{Tt.init(n,i),n._zod.check=s=>{Ux(s.value,i.alg)||s.issues.push({code:"invalid_format",format:"jwt",input:s.value,inst:n,continue:!i.abort})}}),C0=P("$ZodNumber",(n,i)=>{Ut.init(n,i),n._zod.pattern=n._zod.bag.pattern??FS,n._zod.parse=(s,r)=>{if(i.coerce)try{s.value=Number(s.value)}catch{}const o=s.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return s;const d=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return s.issues.push({expected:"number",code:"invalid_type",input:o,inst:n,...d?{received:d}:{}}),s}}),$x=P("$ZodNumberFormat",(n,i)=>{ex.init(n,i),C0.init(n,i)}),Lx=P("$ZodBoolean",(n,i)=>{Ut.init(n,i),n._zod.pattern=XS,n._zod.parse=(s,r)=>{if(i.coerce)try{s.value=!!s.value}catch{}const o=s.value;return typeof o=="boolean"||s.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:n}),s}}),Hx=P("$ZodUnknown",(n,i)=>{Ut.init(n,i),n._zod.parse=s=>s}),qx=P("$ZodNever",(n,i)=>{Ut.init(n,i),n._zod.parse=(s,r)=>(s.issues.push({expected:"never",code:"invalid_type",input:s.value,inst:n}),s)});function $v(n,i,s){n.issues.length&&i.issues.push(...w0(s,n.issues)),i.value[s]=n.value}const Bx=P("$ZodArray",(n,i)=>{Ut.init(n,i),n._zod.parse=(s,r)=>{const o=s.value;if(!Array.isArray(o))return s.issues.push({expected:"array",code:"invalid_type",input:o,inst:n}),s;s.value=Array(o.length);const d=[];for(let f=0;f$v(v,s,f))):$v(g,s,f)}return d.length?Promise.all(d).then(()=>s):s}});function xc(n,i,s,r,o,d){const f=s in r;if(n.issues.length){if(o&&d&&!f)return;i.issues.push(...w0(s,n.issues))}if(!f&&!o){n.issues.length||i.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[s]});return}n.value===void 0?f&&(i.value[s]=void 0):i.value[s]=n.value}function D0(n){const i=Object.keys(n.shape);for(const r of i)if(!n.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const s=aS(n.shape);return{...n,keys:i,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(s)}}function U0(n,i,s,r,o,d){const f=[],m=o.keySet,g=o.catchall._zod,v=g.def.type,w=g.optin==="optional",S=g.optout==="optional";for(const z in i){if(z==="__proto__"||m.has(z))continue;if(v==="never"){f.push(z);continue}const T=g.run({value:i[z],issues:[]},r);T instanceof Promise?n.push(T.then(j=>xc(j,s,z,i,w,S))):xc(T,s,z,i,w,S)}return f.length&&s.issues.push({code:"unrecognized_keys",keys:f,input:i,inst:d}),n.length?Promise.all(n).then(()=>s):s}const Vx=P("$ZodObject",(n,i)=>{if(Ut.init(n,i),!Object.getOwnPropertyDescriptor(i,"shape")?.get){const m=i.shape;Object.defineProperty(i,"shape",{get:()=>{const g={...m};return Object.defineProperty(i,"shape",{value:g}),g}})}const r=Lh(()=>D0(i));ht(n._zod,"propValues",()=>{const m=i.shape,g={};for(const v in m){const w=m[v]._zod;if(w.values){g[v]??(g[v]=new Set);for(const S of w.values)g[v].add(S)}}return g});const o=Sc,d=i.catchall;let f;n._zod.parse=(m,g)=>{f??(f=r.value);const v=m.value;if(!o(v))return m.issues.push({expected:"object",code:"invalid_type",input:v,inst:n}),m;m.value={};const w=[],S=f.shape;for(const z of f.keys){const T=S[z],j=T._zod.optin==="optional",C=T._zod.optout==="optional",Q=T._zod.run({value:v[z],issues:[]},g);Q instanceof Promise?w.push(Q.then(B=>xc(B,m,z,v,j,C))):xc(Q,m,z,v,j,C)}return d?U0(w,v,m,g,r.value,n):w.length?Promise.all(w).then(()=>m):m}}),Gx=P("$ZodObjectJIT",(n,i)=>{Vx.init(n,i);const s=n._zod.parse,r=Lh(()=>D0(i)),o=z=>{const T=new fx(["shape","payload","ctx"]),j=r.value,C=J=>{const q=Uv(J);return`shape[${q}]._zod.run({ value: input[${q}], issues: [] }, ctx)`};T.write("const input = payload.value;");const Q=Object.create(null);let B=0;for(const J of j.keys)Q[J]=`key_${B++}`;T.write("const newResult = {};");for(const J of j.keys){const q=Q[J],ee=Uv(J),ne=z[J],F=ne?._zod?.optin==="optional",ue=ne?._zod?.optout==="optional";T.write(`const ${q} = ${C(J)};`),F&&ue?T.write(` - if (${q}.issues.length) { - if (${ee} in input) { - payload.issues = payload.issues.concat(${q}.issues.map(iss => ({ +`+ei+e+jn}var Yi=!1;function Qi(e,t){if(!e||Yi)return"";Yi=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(q){var Z=q}Reflect.construct(e,[],P)}else{try{P.call()}catch(q){Z=q}e.call(P.prototype)}}else{try{throw Error()}catch(q){Z=q}(P=e())&&typeof P.catch=="function"&&P.catch(function(){})}}catch(q){if(q&&Z&&typeof q.stack=="string")return[q.stack,Z.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=s.DetermineComponentFrameRoot(),h=c[0],b=c[1];if(h&&b){var A=h.split(` +`),U=b.split(` +`);for(o=s=0;so||A[s]!==U[o]){var F=` +`+A[s].replace(" at new "," at ");return e.displayName&&F.includes("")&&(F=F.replace("",e.displayName)),F}while(1<=s&&0<=o);break}}}finally{Yi=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?xn(a):""}function jl(e,t){switch(e.tag){case 26:case 27:case 5:return xn(e.type);case 16:return xn("Lazy");case 13:return e.child!==t&&t!==null?xn("Suspense Fallback"):xn("Suspense");case 19:return xn("SuspenseList");case 0:case 15:return Qi(e.type,!1);case 11:return Qi(e.type.render,!1);case 1:return Qi(e.type,!0);case 31:return xn("Activity");default:return""}}function kl(e){try{var t="",a=null;do t+=jl(e,a),a=e,e=e.return;while(e);return t}catch(s){return` +Error generating stack: `+s.message+` +`+s.stack}}var ji=Object.prototype.hasOwnProperty,Xt=n.unstable_scheduleCallback,Ki=n.unstable_cancelCallback,ki=n.unstable_shouldYield,ua=n.unstable_requestPaint,Te=n.unstable_now,fe=n.unstable_getCurrentPriorityLevel,it=n.unstable_ImmediatePriority,Mt=n.unstable_UserBlockingPriority,Ri=n.unstable_NormalPriority,ca=n.unstable_LowPriority,ti=n.unstable_IdlePriority,fa=n.log,kn=n.unstable_setDisableYieldValue,nn=null,ot=null;function Vt(e){if(typeof fa=="function"&&kn(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(nn,e)}catch{}}var cn=Math.clz32?Math.clz32:da,gs=Math.log,qa=Math.LN2;function da(e){return e>>>=0,e===0?32:31-(gs(e)/qa|0)|0}var ha=256,fn=262144,Ba=4194304;function Fi(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 655)DELIM" +R"DELIM(36:case 131072:return e&261888;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 vs(e,t,a){var s=e.pendingLanes;if(s===0)return 0;var o=0,c=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var b=s&134217727;return b!==0?(s=b&~c,s!==0?o=Fi(s):(h&=b,h!==0?o=Fi(h):a||(a=b&~e,a!==0&&(o=Fi(a))))):(b=s&~c,b!==0?o=Fi(b):h!==0?o=Fi(h):a||(a=s&~e,a!==0&&(o=Fi(a)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,a=t&-t,c>=a||c===32&&(a&4194048)!==0)?t:o}function Rl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Fc(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Vo(){var e=Ba;return Ba<<=1,(Ba&62914560)===0&&(Ba=4194304),e}function wr(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function ni(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function an(e,t,a,s,o,c){var h=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var b=e.entanglements,A=e.expirationTimes,U=e.hiddenUpdates;for(a=h&~a;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Jc=/[\n"\\]/g;function Cn(e){return e.replace(Jc,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ws(e,t,a,s,o,c,h,b){e.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.type=h:e.removeAttribute("type"),t!=null?h==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Rn(t)):e.value!==""+Rn(t)&&(e.value=""+Rn(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?zs(e,h,Rn(t)):a!=null?zs(e,h,Rn(a)):s!=null&&e.removeAttribute("value"),o==null&&c!=null&&(e.defaultChecked=!!c),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Rn(b):e.removeAttribute("name")}function Qo(e,t,a,s,o,c,h,b){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||a!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){Ss(e);return}a=a!=null?""+Rn(a):"",t=t!=null?""+Rn(t):a,b||t===e.value||(e.value=t),e.defaultValue=t}s=s??o,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=b?e.checked:!!s,e.defaultChecked=!!s,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),Ss(e)}function zs(e,t,a){t==="number"&&xs(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Ii(e,t,a,s){if(e=e.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ns=!1;if(En)try{var Ja={};Object.defineProperty(Ja,"passive",{get:function(){Ns=!0}}),window.addEventListener("test",Ja,Ja),window.removeEventListener("test",Ja,Ja)}catch{Ns=!1}var Un=null,Wi=null,Ll=null;function Rr(){if(Ll)return Ll;var e,t=Wi,a=t.length,s,o="value"in Un?Un.value:Un.textContent,c=o.length;for(e=0;e=Wa),qr=" ",_a=!1;function Vl(e,t){switch(e){case"keyup":return iu.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lt(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Sa=!1;function kt(e,t){switch(e){case"compositionend":return Lt(t);case"keypress":return t.which!==32?null:(_a=!0,qr);case"textInput":return e=t.data,e===qr&&_a?null:e;default:return null}}function au(e,t){if(Sa)return e==="compositionend"||!Os&&Vl(e,t)?(e=Rr(),Ll=Wi=Un=null,Sa=!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=t)return{node:a,offset:t-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Me(a)}}function ut(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ut(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _t(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=xs(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=xs(e.document)}return t}function Rt(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 et=En&&"documentMode"in document&&11>=document.documentMode,lt=null,hn=null,Ht=null,Tn=!1;function Yn(e,t,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Tn||lt==null||lt!==xs(s)||(s=lt,"selectionStart"in s&&Rt(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}),Ht&&De(Ht,s)||(Ht=s,s=Fu(hn,"onSelect"),0>=h,o-=h,na=1<<32-cn(t)+o|a<Ze?(qe=be,be=null):qe=be.sibling;var Fe=Z(k,be,C[Ze],X);if(Fe===null){be===null&&(be=qe);break}e&&be&&Fe.alternate===null&&t(k,be),M=c(Fe,M,Ze),Ke===null?Ae=Fe:Ke.sibling=Fe,Ke=Fe,be=qe}if(Ze===C.length)return a(k,be),Ge&&za(k,Ze),A)DELIM" +R"DELIM(e;if(be===null){for(;ZeZe?(qe=be,be=null):qe=be.sibling;var xl=Z(k,be,Fe.value,X);if(xl===null){be===null&&(be=qe);break}e&&be&&xl.alternate===null&&t(k,be),M=c(xl,M,Ze),Ke===null?Ae=xl:Ke.sibling=xl,Ke=xl,be=qe}if(Fe.done)return a(k,be),Ge&&za(k,Ze),Ae;if(be===null){for(;!Fe.done;Ze++,Fe=C.next())Fe=P(k,Fe.value,X),Fe!==null&&(M=c(Fe,M,Ze),Ke===null?Ae=Fe:Ke.sibling=Fe,Ke=Fe);return Ge&&za(k,Ze),Ae}for(be=s(be);!Fe.done;Ze++,Fe=C.next())Fe=q(be,k,Ze,Fe.value,X),Fe!==null&&(e&&Fe.alternate!==null&&be.delete(Fe.key===null?Ze:Fe.key),M=c(Fe,M,Ze),Ke===null?Ae=Fe:Ke.sibling=Fe,Ke=Fe);return e&&be.forEach(function(N_){return t(k,N_)}),Ge&&za(k,Ze),Ae}function dt(k,M,C,X){if(typeof C=="object"&&C!==null&&C.type===L&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case T:e:{for(var Ae=C.key;M!==null;){if(M.key===Ae){if(Ae=C.type,Ae===L){if(M.tag===7){a(k,M.sibling),X=o(M,C.props.children),X.return=k,k=X;break e}}else if(M.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===le&&Il(Ae)===M.type){a(k,M.sibling),X=o(M,C.props),Fr(X,C),X.return=k,k=X;break e}a(k,M);break}else t(k,M);M=M.sibling}C.type===L?(X=Ql(C.props.children,k.mode,X,C.key),X.return=k,k=X):(X=fu(C.type,C.key,C.props,null,k.mode,X),Fr(X,C),X.return=k,k=X)}return h(k);case j:e:{for(Ae=C.key;M!==null;){if(M.key===Ae)if(M.tag===4&&M.stateNode.containerInfo===C.containerInfo&&M.stateNode.implementation===C.implementation){a(k,M.sibling),X=o(M,C.children||[]),X.return=k,k=X;break e}else{a(k,M);break}else t(k,M);M=M.sibling}X=of(C,k.mode,X),X.return=k,k=X}return h(k);case le:return C=Il(C),dt(k,M,C,X)}if(he(C))return me(k,M,C,X);if(_e(C)){if(Ae=_e(C),typeof Ae!="function")throw Error(r(150));return C=Ae.call(C),je(k,M,C,X)}if(typeof C.then=="function")return dt(k,M,yu(C),X);if(C.$$typeof===W)return dt(k,M,mu(k,C),X);bu(k,C)}return typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint"?(C=""+C,M!==null&&M.tag===6?(a(k,M.sibling),X=o(M,C),X.return=k,k=X):(a(k,M),X=rf(C,k.mode,X),X.return=k,k=X),h(k)):a(k,M)}return function(k,M,C,X){try{Kr=0;var Ae=dt(k,M,C,X);return Ls=null,Ae}catch(be){if(be===$s||be===gu)throw be;var Ke=li(29,be,null,k.mode);return Ke.lanes=X,Ke.return=k,Ke}}}var Wl=$m(!0),Lm=$m(!1),ll=!1;function _f(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sf(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 sl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function rl(e,t,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ie&2)!==0){var o=s.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),s.pending=t,t=cu(e),xm(e,null,a),t}return uu(e,s,t,a),cu(e)}function Jr(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,ma(e,a)}}function xf(e,t){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var o=null,c=null;if(a=a.firstBaseUpdate,a!==null){do{var h={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};c===null?o=c=h:c=c.next=h,a=a.next}while(a!==null);c===null?o=c=t:c=c.next=t}else o=c=t;a={baseState:s.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var wf=!1;function Xr(){if(wf){var e=Zs;if(e!==null)throw e}}function Ir(e,t,a,s){wf=!1;var o=e.updateQueue;ll=!1;var c=o.firstBaseUpdate,h=o.lastBaseUpdate,b=o.shared.pending;if(b!==null){o.shared.pending=null;var A=b,U=A.next;A.next=null,h===null?c=U:h.next=U,h=A;var F=e.alternate;F!==null&&(F=F.updateQueue,b=F.lastBaseUpdate,b!==h&&(b===null?F.firstBaseUpdate=U:b.next=U,F.lastBaseUpdate=A))}if(c!==null){var P=o.baseState;h=0,F=U=A=null,b=c;do{var Z=b.lane&-536870913,q=Z!==b.lane;if(q?(He&Z)===Z:(s&Z)===Z){Z!==0&&Z===Us&&(wf=!0),F!==null&&(F=F.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var me=e,je=b;Z=t;var dt=a;switch(je.tag){case 1:if(me=je.payload,typeof me=="function"){P=me.call(dt,P,Z);break e}P=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=je.payload,Z=typeof me=="function"?me.call(dt,P,Z):me,Z==null)break e;P=S({},P,Z);break e;case 2:ll=!0}}Z=b.callback,Z!==null&&(e.flags|=64,q&&(e.flags|=8192),q=o.callbacks,q===null?o.callbacks=[Z]:q.push(Z))}else q={lane:Z,tag:b.tag,payload:b.payload,callback:b.callback,next:null},F===null?(U=F=q,A=P):F=F.next=q,h|=Z;if(b=b.next,b===null){if(b=o.shared.pending,b===null)break;q=b,b=q.next,q.next=null,o.lastBaseUpdate=q,o.shared.pending=null}}while(!0);F===null&&(A=P),o.baseState=A,o.firstBaseUpdate=U,o.lastBaseUpdate=F,c===null&&(o.shared.lanes=0),dl|=h,e.lanes=h,e.memoizedState=P}}function Hm(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function qm(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;ec?c:8;var h=D.T,b={};D.T=b,Bf(e,!1,t,a);try{var A=o(),U=D.S;if(U!==null&&U(b,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var F=v1(A,s);eo(e,t,F,ci(e))}else eo(e,t,s,ci(e))}catch(P){eo(e,t,{then:function(){},status:"rejected",reason:P},ci())}finally{Q.p=c,h!==null&&b.types!==null&&(h.types=b.types),D.T=h}}function w1(){}function Hf(e,t,a,s){if(e.tag!==5)throw Error(r(476));var o=bp(e).queue;yp(e,o,t,pe,a===null?w1:function(){return _p(e),a(s)})}function bp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:pe,baseState:pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:pe},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function _p(e){var t=bp(e);t.next===null&&(t=e.alternate.memoizedState),eo(e,t.next.queue,{},ci())}function qf(){return gn(yo)}function Sp(){return Bt().memoizedState}function xp(){return Bt().memoizedState}function z1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=ci();e=sl(a);var s=rl(t,e,a);s!==null&&(In(s,t,a),Jr(s,t,a)),t={cache:gf()},e.payload=t;return}t=t.return}}function E1(e,t,a){var s=ci();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ou(e)?zp(t,a):(a=lf(e,t,a,s),a!==null&&(In(a,e,s),Ep(a,t,s)))}function wp(e,t,a){var s=ci();eo(e,t,a,s)}function eo(e,t,a,s){var o={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ou(e))zp(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,b=c(h,a);if(o.hasEagerState=!0,o.eagerState=b,Re(b,h))return uu(e,t,o,0),pt===null&&ou(),!1}catch{}if(a=lf(e,t,o,s),a!==null)return In(a,e,s),Ep(a,t,s),!0}return!1}function Bf(e,t,a,s){if(s={lane:2,revertLane:_d(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Ou(e)){if(t)throw Error(r(479))}else t=lf(e,a,s,2),t!==null&&In(t,e,2)}function Ou(e){var t=e.alternate;return e===Ue||t!==null&&t===Ue}function zp(e,t){qs=xu=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Ep(e,t,a){if((a&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,ma(e,a)}}var to={readContext:gn,use:Eu,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};to.useEffectEvent=Ct;var Tp={readContext:gn,use:Eu,useCallback:function(e,t){return $n().memoizedState=[e,t===void 0?null:t],e},useContext:gn,useEffect:up,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Au(4194308,4,hp.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Au(4194308,4,e,t)},useInsertionEffect:function(e,t){Au(4,2,e,t)},useMemo:function(e,t){var a=$n();t=t===void 0?null:t;var s=e();if(es){Vt(!0);try{e()}finally{Vt(!1)}}return a.memoizedState=[s,t],s},useReducer:function(e,t,a){var s=$n();if(a!==void 0){var o=a(t);if(es){Vt(!0);try{a(t)}finally{Vt(!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=E1.bind(null,Ue,e),[s.memoizedState,e]},useRef:function(e){var t=$n();return e={current:e},t.memoizedState=e},useState:function(e){e=Df(e);var t=e.queue,a=wp.bind(null,Ue,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:$f,useDeferredValue:function(e,t){var a=$n();return Lf(a,e,t)},useTransition:function(){var e=Df(!1);return e=yp.bind(null,Ue,e.queue,!0,!1),$n().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var s=Ue,o=$n();if(Ge){if(a===void 0)throw Error(r(407));a=a()}else{if(a=t(),pt===null)throw Error(r(349));(He&127)!==0||Km(s,t,a)}o.memoizedState=a;var c={value:a,getSnapshot:t};return o.queue=c,up(Jm.bind(null,s,c,e),[e]),s.flags|=2048,Vs(9,{destroy:void 0},Fm.bind(null,s,c,a,t),null),a},useId:function(){var e=$n(),t=pt.identifierPrefix;if(Ge){var a=ia,s=na;a=(s&~(1<<32-cn(s)-1)).toString(32)+a,t="_"+t+"R_"+a,a=wu++,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[It]=t,c[zn]=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(yn(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&&Ma(t)}}return xt(t),nd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Ma(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(r(166));if(e=ge.current,Cs(t)){if(e=t.stateNode,a=t.memoizedProps,s=null,o=pn,o!==null)switch(o.tag){case 27:case 5:s=o.memoizedProps}e[It]=t,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||Yg(e.nodeValue,a)),e||il(t,!0)}else e=Ju(e).createTextNode(s),e[It]=t,t.stateNode=e}return xt(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(s=Cs(t),a!==null){if(e===null){if(!s)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[It]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;xt(t),e=!1}else a=df(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(ri(t),t):(ri(t),null);if((t.flags&128)!==0)throw Error(r(558))}return xt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Cs(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(r(318));if(o=t.memoizedState,o)DELIM" +R"DELIM(=o!==null?o.dehydrated:null,!o)throw Error(r(317));o[It]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;xt(t),o=!1}else o=df(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(ri(t),t):(ri(t),null)}return ri(t),(t.flags&128)!==0?(t.lanes=a,t):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(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)),a!==e&&a&&(t.child.flags|=8192),Cu(t,t.updateQueue),xt(t),null);case 4:return Ve(),e===null&&zd(t.stateNode.containerInfo),xt(t),null;case 10:return Ta(t.type),xt(t),null;case 19:if($(qt),s=t.memoizedState,s===null)return xt(t),null;if(o=(t.flags&128)!==0,c=s.rendering,c===null)if(o)io(s,!1);else{if(Dt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=Su(e),c!==null){for(t.flags|=128,io(s,!1),e=c.updateQueue,t.updateQueue=e,Cu(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)wm(a,e),a=a.sibling;return Y(qt,qt.current&1|2),Ge&&za(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Te()>Lu&&(t.flags|=128,o=!0,io(s,!1),t.lanes=4194304)}else{if(!o)if(e=Su(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Cu(t,e),io(s,!0),s.tail===null&&s.tailMode==="hidden"&&!c.alternate&&!Ge)return xt(t),null}else 2*Te()-s.renderingStartTime>Lu&&a!==536870912&&(t.flags|=128,o=!0,io(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)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Te(),e.sibling=null,a=qt.current,Y(qt,o?a&1|2:a&1),Ge&&za(t,s.treeForkCount),e):(xt(t),null);case 22:case 23:return ri(t),Ef(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(a&536870912)!==0&&(t.flags&128)===0&&(xt(t),t.subtreeFlags&6&&(t.flags|=8192)):xt(t),a=t.updateQueue,a!==null&&Cu(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==a&&(t.flags|=2048),e!==null&&$(Xl),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ta(Yt),xt(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function M1(e,t){switch(cf(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ta(Yt),Ve(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Mn(t),null;case 31:if(t.memoizedState!==null){if(ri(t),t.alternate===null)throw Error(r(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ri(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $(qt),null;case 4:return Ve(),null;case 10:return Ta(t.type),null;case 22:case 23:return ri(t),Ef(),e!==null&&$(Xl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ta(Yt),null;case 25:return null;default:return null}}function Xp(e,t){switch(cf(t),t.tag){case 3:Ta(Yt),Ve();break;case 26:case 27:case 5:Mn(t);break;case 4:Ve();break;case 31:t.memoizedState!==null&&ri(t);break;case 13:ri(t);break;case 19:$(qt);break;case 10:Ta(t.type);break;case 22:case 23:ri(t),Ef(),e!==null&&$(Xl);break;case 24:Ta(Yt)}}function ao(e,t){try{var a=t.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var o=s.next;a=o;do{if((a.tag&e)===e){s=void 0;var c=a.create,h=a.inst;s=c(),h.destroy=s}a=a.next}while(a!==o)}}catch(b){rt(t,t.return,b)}}function cl(e,t,a){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,b=h.destroy;if(b!==void 0){h.destroy=void 0,o=t;var A=a,U=b;try{U()}catch(F){rt(o,A,F)}}}s=s.next}while(s!==c)}}catch(F){rt(t,t.return,F)}}function Ip(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{qm(t,a)}catch(s){rt(e,e.return,s)}}}function Pp(e,t,a){a.props=ts(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){rt(e,t,s)}}function lo(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof a=="function"?e.refCleanup=a(s):a.current=s}}catch(o){rt(e,t,o)}}function aa(e,t){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(o){rt(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){rt(e,t,o)}else a.current=null}function Wp(e){var t=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(o){rt(e,e.return,o)}}function id(e,t,a){try{var s=e.stateNode;P1(s,e.type,a,t),s[zn]=t}catch(o){rt(e,e.return,o)}}function eg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&vl(e.type)||e.tag===4}function ad(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||eg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&vl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ld(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Dn));else if(s!==4&&(s===27&&vl(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(ld(e,t,a),e=e.sibling;e!==null;)ld(e,t,a),e=e.sibling}function Du(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(s!==4&&(s===27&&vl(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Du(e,t,a),e=e.sibling;e!==null;)Du(e,t,a),e=e.sibling}function tg(e){var t=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);yn(t,s,a),t[It]=e,t[zn]=a}catch(c){rt(e,e.return,c)}}var ja=!1,Ft=!1,sd=!1,ng=typeof WeakSet=="function"?WeakSet:Set,on=null;function j1(e,t){if(e=e.containerInfo,Ad=nc,e=_t(e),Rt(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var o=s.anchorOffset,c=s.focusNode;s=s.focusOffset;try{a.nodeType,c.nodeType}catch{a=null;break e}var h=0,b=-1,A=-1,U=0,F=0,P=e,Z=null;t:for(;;){for(var q;P!==a||o!==0&&P.nodeType!==3||(b=h+o),P!==c||s!==0&&P.nodeType!==3||(A=h+s),P.nodeType===3&&(h+=P.nodeValue.length),(q=P.firstChild)!==null;)Z=P,P=q;for(;;){if(P===e)break t;if(Z===a&&++U===o&&(b=h),Z===c&&++F===s&&(A=h),(q=P.nextSibling)!==null)break;P=Z,Z=P.parentNode}P=q}a=b===-1||A===-1?null:{start:b,end:A}}else a=null}a=a||{start:0,end:0}}else a=null;for(Nd={focusedElem:e,selectionRange:a},nc=!1,on=t;on!==null;)if(t=on,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,on=e;else for(;on!==null;){switch(t=on,c=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a title"))),yn(c,s,a),c[It]=e,$t(c),s=c;break e;case"link":var h=ov("link","href",o).get(s+(a.href||""));if(h){for(var b=0;bdt&&(h=dt,dt=je,je=h);var k=xe(b,je),M=xe(b,dt);if(k&&M&&(q.rangeCount!==1||q.anchorNode!==k.node||q.anchorOffset!==k.offset||q.focusNode!==M.node||q.focusOffset!==M.offset)){var C=P.createRange();C.setStart(k.node,k.offset),q.removeAllRanges(),je>dt?(q.addRange(C),q.extend(M.node,M.offset)):(C.setEnd(M.node,M.offset),q.addRange(C))}}}}for(P=[],q=b;q=q.parentNode;)q.nodeType===1&&P.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;ba?32:a,D.T=null,a=hd,hd=null;var c=ml,h=Ua;if(Pt=0,Fs=ml=null,Ua=0,(Ie&6)!==0)throw Error(r(331));var b=Ie;if(Ie|=4,hg(c.current),cg(c,c.current,h,a),Ie=b,fo(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(nn,c)}catch{}return!0}finally{Q.p=o,D.T=s,jg(e,t)}}function Rg(e,t,a){t=_i(a,t),t=Qf(e.stateNode,t,2),e=rl(e,t,2),e!==null&&(ni(e,2),la(e))}function rt(e,t,a){if(e.tag===3)Rg(e,e,a);else for(;t!==null;){if(t.tag===3){Rg(t,e,a);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(hl===null||!hl.has(s))){e=_i(a,e),a=Cp(2),s=rl(t,a,2),s!==null&&(Dp(a,s,t,e),ni(s,2),la(s));break}}t=t.return}}function vd(e,t,a){var s=e.pingCache;if(s===null){s=e.pingCache=new C1;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(a)||(ud=!0,o.add(a),e=L1.bind(null,e,t,a),t.then(e,e))}function L1(e,t,a){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,pt===e&&(He&a)===a&&(Dt===4||Dt===3&&(He&62914560)===He&&300>Te()-$u?(Ie&2)===0&&Js(e,0):cd|=a,Ks===He&&(Ks=0)),la(e)}function Cg(e,t){t===0&&(t=Vo()),e=Yl(e,t),e!==null&&(ni(e,t),la(e))}function H1(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Cg(e,a)}function q1(e,t){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,o=e.memoizedState;o!==null&&(a=o.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(r(314))}s!==null&&s.delete(t),Cg(e,a)}function B1(e,t){return Xt(e,t)}var Yu=null,Is=null,yd=!1,Qu=!1,bd=!1,gl=0;function la(e){e!==Is&&e.next===null&&(Is===null?Yu=Is=e:Is=Is.next=e),Qu=!0,yd||(yd=!0,G1())}function fo(e,t){if(!bd&&Qu){bd=!0;do for(var a=!1,s=Yu;s!==null;){if(e!==0){var o=s.pendingLanes;if(o===0)var c=0;else{var h=s.suspendedLanes,b=s.pingedLanes;c=(1<<31-cn(42|e)+1)-1,c&=o&~(h&~b),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(a=!0,$g(s,c))}else c=He,c=vs(s,s===pt?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(c&3)===0||Rl(s,c)||(a=!0,$g(s,c));s=s.next}while(a);bd=!1}}function V1(){Dg()}function Dg(){Qu=yd=!1;var e=0;gl!==0&&e_()&&(e=gl);for(var t=Te(),a=null,s=Yu;s!==null;){var o=s.next,c=Ug(s,t);c===0?(s.next=null,a===null?Yu=o:a.next=o,o===null&&(Is=a)):(a=s,(e!==0||(c&3)!==0)&&(Qu=!0)),s=o}Pt!==0&&Pt!==5||fo(e),gl!==0&&(gl=0)}function Ug(e,t){for(var a=e.suspendedLanes,s=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0b)break;var F=A.transferSize,P=A.initiatorType;F&&Qg(P)&&(A=A.responseEnd,h+=F*(A"u"?null:document;function av(e,t,a){var s=Ps;if(s&&typeof t=="string"&&t){var o=Cn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),iv.has(o)||(iv.add(o),e={rel:e,crossOrigin:a,href:t},s.querySelector(o)===null&&(t=s.createElement("link"),yn(t,"link",e),$t(t),s.head.appendChild(t)))}}function u_(e){Za.D(e),av("dns-prefetch",e,null)}function c_(e,t){Za.C(e,t),av("preconnect",e,t)}function f_(e,t,a){Za.L(e,t,a);var s=Ps;if(s&&e&&t){var o='link[rel="preload"][as="'+Cn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Cn(a.imageSizes)+'"]')):o+='[href="'+Cn(e)+'"]';var c=o;switch(t){case"style":c=Ws(e);break;case"script":c=er(e)}Ti.has(c)||(e=S({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Ti.set(c,e),s.querySelector(o)!==null||t==="style"&&s.querySelector(go(c))||t==="script"&&s.querySelector(vo(c))||(t=s.createElement("link"),yn(t,"link",e),$t(t),s.head.appendChild(t)))}}function d_(e,t){Za.m(e,t);var a=Ps;if(a&&e){var s=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Cn(s)+'"][href="'+Cn(e)+'"]',c=o;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=er(e)}if(!Ti.has(c)&&(e=S({rel:"modulepreload",href:e},t),Ti.set(c,e),a.querySelector(o)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(vo(c)))return}s=a.createElement("link"),yn(s,"link",e),$t(s),a.head.appendChild(s)}}}function h_(e,t,a){Za.S(e,t,a);var s=Ps;if(s&&e){var o=gi(s).hoistableStyles,c=Ws(e);t=t||"default";var h=o.get(c);if(!h){var b={loading:0,preload:null};if(h=s.querySelector(go(c)))b.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Ti.get(c))&&Dd(e,a);var A=h=s.createElement("link");$t(A),yn(A,"link",e),A._p=new Promise(function(U,F){A.onload=U,A.onerror=F}),A.addEventListener("load",function(){b.loading|=1}),A.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Iu(h,t,s)}h={type:"stylesheet",instance:h,count:1,state:b},o.set(c,h)}}}function m_(e,t){Za.X(e,t);var a=Ps;if(a&&e){var s=gi(a).hoistableScripts,o=er(e),c=s.get(o);c||(c=a.querySelector(vo(o)),c||(e=S({src:e,async:!0},t),(t=Ti.get(o))&&Ud(e,t),c=a.createElement("script"),$t(c),yn(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function p_(e,t){Za.M(e,t);var a=Ps;if(a&&e){var s=gi(a).hoistableScripts,o=er(e),c=s.get(o);c||(c=a.querySelector(vo(o)),c||(e=S({s)DELIM" +R"DELIM(rc:e,async:!0,type:"module"},t),(t=Ti.get(o))&&Ud(e,t),c=a.createElement("script"),$t(c),yn(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function lv(e,t,a,s){var o=(o=ge.current)?Xu(o):null;if(!o)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Ws(a.href),a=gi(o).hoistableStyles,s=a.get(t),s||(s={type:"style",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Ws(a.href);var c=gi(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(go(e)))&&!c._p&&(h.instance=c,h.state.loading=5),Ti.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Ti.set(e,a),c||g_(o,e,a,h.state))),t&&s===null)throw Error(r(528,""));return h}if(t&&s!==null)throw Error(r(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=er(a),a=gi(o).hoistableScripts,s=a.get(t),s||(s={type:"script",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Ws(e){return'href="'+Cn(e)+'"'}function go(e){return'link[rel="stylesheet"]['+e+"]"}function sv(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function g_(e,t,a,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),yn(t,"link",a),$t(t),e.head.appendChild(t))}function er(e){return'[src="'+Cn(e)+'"]'}function vo(e){return"script[async]"+e}function rv(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Cn(a.href)+'"]');if(s)return t.instance=s,$t(s),s;var o=S({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),$t(s),yn(s,"style",o),Iu(s,a.precedence,e),t.instance=s;case"stylesheet":o=Ws(a.href);var c=e.querySelector(go(o));if(c)return t.state.loading|=4,t.instance=c,$t(c),c;s=sv(a),(o=Ti.get(o))&&Dd(s,o),c=(e.ownerDocument||e).createElement("link"),$t(c);var h=c;return h._p=new Promise(function(b,A){h.onload=b,h.onerror=A}),yn(c,"link",s),t.state.loading|=4,Iu(c,a.precedence,e),t.instance=c;case"script":return c=er(a.src),(o=e.querySelector(vo(c)))?(t.instance=o,$t(o),o):(s=a,(o=Ti.get(c))&&(s=S({},a),Ud(s,o)),e=e.ownerDocument||e,o=e.createElement("script"),$t(o),yn(o,"link",s),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,Iu(s,a.precedence,e));return t.instance}function Iu(e,t,a){for(var s=a.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 v_(e,t,a){if(a===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 cv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function y_(e,t,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=Ws(s.href),c=t.querySelector(go(o));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Wu.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=c,$t(c);return}c=t.ownerDocument||t,s=sv(s),(o=Ti.get(o))&&Dd(s,o),c=c.createElement("link"),$t(c);var h=c;h._p=new Promise(function(b,A){h.onload=b,h.onerror=A}),yn(c,"link",s),a.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Wu.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Zd=0;function b_(e,t){return e.stylesheets&&e.count===0&&tc(e,e.stylesheets),0Zd?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(o)}}:null}function Wu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ec=null;function tc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ec=new Map,t.forEach(__,e),ec=null,Wu.call(e))}function __(e,t){if(!(t.state.loading&4)){var a=ec.get(e);if(a)var s=a.get(null);else{a=new Map,ec.set(e,a);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(),Qd.exports=Z_(),Qd.exports}var L_=$_();const H_=m0(L_),p0="libbitcoinAdminDashboardBrowserNotifications";function g0(){try{return globalThis.window?.localStorage??null}catch{return null}}function Uh(){const n=globalThis.Notification;return typeof n=="function"?n:null}function v0(){return Uh()?.permission??"unsupported"}async function q_(){const n=Uh();return n?n.permission!=="default"?n.permission:n.requestPermission():"unsupported"}function B_(n=g0()){try{return v0()==="granted"&&n?.getItem(p0)==="true"}catch{return!1}}function V_(n,i=g0()){try{i?.setItem(p0,String(n))}catch{}}function G_(n,i){const l=Uh();if(!l||l.permission!=="granted")return!1;try{return new l(n,i),!0}catch{return!1}}const Zh="libbitcoinAdminDashboardEndpoints";function $h(){try{return globalThis.window?.localStorage??null}catch{return null}}function Y_(){return globalThis.window?.location.origin??"http://localhost"}function oa(n){const i=n.trim();if(!i)throw new Error("Endpoint URL is required");const l=/^[a-z][a-z\d+\-.]*:\/\//iu.test(i)?i:`http://${i}`,r=new URL(l);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 Q_(n){const i=new URL(oa(n));return i.protocol=i.protocol==="https:"?"wss:":"ws:",i.pathname="/",i.search="",i.hash="",i.toString()}function K_(n,i=Y_()){return new URL(oa(n)).origin===new URL(i).origin}function y0(){return{adminUrl:oa("http://172.20.208.1:8080"),nativeUrl:oa("http://172.20.208.1:80")}}function F_(n=$h()){const i=y0();try{const l=n?.getItem(Zh);if(!l)return i;const r=JSON.parse(l);if(!r||typeof r!="object"||Array.isArray(r))return i;const u=r;return{adminUrl:typeof u.adminUrl=="string"?oa(u.adminUrl):i.adminUrl,nativeUrl:typeof u.nativeUrl=="string"?oa(u.nativeUrl):i.nativeUrl}}catch{return i}}function J_(n,i=$h()){const l={adminUrl:oa(n.adminUrl),nativeUrl:oa(n.nativeUrl)};try{i?.setItem(Zh,JSON.stringify(l))}catch{}}function X_(n=$h()){try{n?.removeItem(Zh)}catch{}}function I_({configuration:n,browserNotificationsEnabled:i,onClose:l,onBrowserNotificationsEnabledChange:r,onReset:u,onSave:d}){const[f,p]=re.useState(n.adminUrl),[m,v]=re.useState(n.nativeUrl),[w,S]=re.useState(null),[z,T]=re.useState(v0),[j,L]=re.useState(!1),[V,H]=re.useState(null),G=i&&z==="granted";async function W(){if(G){r(!1);return}L(!0),H(null);try{const ne=await q_();T(ne),ne==="granted"?r(!0):ne==="denied"&&H("Permission was denied. It can be changed in your browser settings.")}catch{H("The browser could not enable notifications.")}finally{L(!1)}}function B(ne){ne.preventDefault();try{d({adminUrl:oa(f),nativeUrl:oa(m)})}catch(ee){S(ee instanceof Error?ee.message:"Invalid endpoint configuration")}}return _.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:ne=>{ne.target===ne.currentTarget&&l()},children:_.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"endpoint-settings-title",className:"border-accent/30 bg-surface max-h-[calc(100vh-2rem)] w-full max-w-xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/50",children:[_.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Runtime configuration"}),_.jsx("h2",{id:"endpoint-settings-title",className:"mt-1 text-xl font-semibold",children:"Node endpoints"})]}),_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close endpoint settings",children:"×"})]}),_.jsxs("form",{onSubmit:B,className:"space-y-5 p-5",children:[_.jsxs("label",{className:"block space-y-2",children:[_.jsx("span",{className:"text-textPrimary text-sm font-medium",children:"Admin endpoint"}),_.jsx("input",{value:f,onChange:ne=>{p(ne.target.value)},className:"border-accent/30 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 font-mono text-sm focus:ring-0",placeholder:"http://node-host:admin-port",autoComplete:"url"})]}),_.jsxs("label",{className:"block space-y-2",children:[_.jsx("span",{className:"text-textPrimary text-sm font-medium",children:"Native endpoint"}),_.jsx("input",{value:m,onChange:ne=>{v(ne.target.value)},className:"border-accent/30 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 font-mono text-sm focus:ring-0",placeholder:"http://node-host:native-port",autoComplete:"url"})]}),_.jsxs("div",{className:"border-accent/20 bg-background/35 space-y-3 rounded-xl border p-4",children:[_.jsxs("div",{children:[_.jsx("h3",{className:"text-textPrimary text-sm font-medium",children:"Browser notifications"}),_.jsx("p",{id:"browser-notifications-help",className:"text-textMuted mt-1 text-xs",children:W_(z,G,j)})]}),_.jsx("button",{type:"button","aria-describedby":"browser-notifications-help",disabled:j||z==="unsupported"||z==="denied",onClick:()=>{W()},className:"border-accent/30 text-textMuted hover:border-accent hover:text-accent rounded-lg border px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:P_(z,G,j)}),V&&_.jsx("p",{className:"text-sm text-red-300",role:"alert",children:V})]}),w&&_.jsx("p",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-300",children:w}),_.jsxs("div",{className:"flex flex-wrap justify-between gap-3 pt-2",children:[_.jsx("button",{type:"button",onClick:u,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-4 py-2 text-sm",children:"Reset defaults"}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-textPrimary rounded-lg px-4 py-2 text-sm",children:"Cancel"}),_.jsx("button",{type:"submit",className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold",children:"Save endpoints"})]})]})]})]})})}function P_(n,i,l){return l?"Req)DELIM" +R"DELIM(uesting permission…":n==="unsupported"?"Notifications unavailable":n==="denied"?"Blocked by browser":i?"Disable notifications":"Enable notifications"}function W_(n,i,l){return l?"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."}var Cv;function I(n,i,l){function r(p,m){if(p._zod||Object.defineProperty(p,"_zod",{value:{def:m,constr:f,traits:new Set},enumerable:!1}),p._zod.traits.has(n))return;p._zod.traits.add(n),i(p,m);const v=f.prototype,w=Object.keys(v);for(let S=0;Sl?.Parent&&p instanceof l.Parent?!0:p?._zod?.traits?.has(n)}),Object.defineProperty(f,"name",{value:n}),f}class or extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class b0 extends Error{constructor(i){super(`Encountered unidirectional transform during encode: ${i}`),this.name="ZodEncodeError"}}(Cv=globalThis).__zod_globalConfig??(Cv.__zod_globalConfig={});const Lh=globalThis.__zod_globalConfig;function fs(n){return Lh}function _0(n){const i=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,u])=>i.indexOf(+r)===-1).map(([r,u])=>u)}function uh(n,i){return typeof i=="bigint"?i.toString():i}function Hh(n){return{get value(){{const i=n();return Object.defineProperty(this,"value",{value:i}),i}}}}function qh(n){return n==null}function Bh(n){const i=n.startsWith("^")?1:0,l=n.endsWith("$")?n.length-1:n.length;return n.slice(i,l)}function eS(n,i){const l=n/i,r=Math.round(l),u=Number.EPSILON*Math.max(Math.abs(l),1);return Math.abs(l-r){};function Sc(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const nS=Hh(()=>{if(Lh.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function Co(n){if(Sc(n)===!1)return!1;const i=n.constructor;if(i===void 0||typeof i!="function")return!0;const l=i.prototype;return!(Sc(l)===!1||Object.prototype.hasOwnProperty.call(l,"isPrototypeOf")===!1)}function x0(n){return Co(n)?{...n}:Array.isArray(n)?[...n]:n instanceof Map?new Map(n):n instanceof Set?new Set(n):n}const iS=new Set(["string","number","symbol"]);function dr(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ol(n,i,l){const r=new n._zod.constr(i??n._zod.def);return(!i||l?.parent)&&(r._zod.parent=n),r}function Ne(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 aS(n){return Object.keys(n).filter(i=>n[i]._zod.optin==="optional"&&n[i]._zod.optout==="optional")}const lS={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function sS(n,i){const l=n._zod.def,r=l.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const d=Nl(n._zod.def,{get shape(){const f={};for(const p in i){if(!(p in l.shape))throw new Error(`Unrecognized key: "${p}"`);i[p]&&(f[p]=l.shape[p])}return ms(this,"shape",f),f},checks:[]});return Ol(n,d)}function rS(n,i){const l=n._zod.def,r=l.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const d=Nl(n._zod.def,{get shape(){const f={...n._zod.def.shape};for(const p in i){if(!(p in l.shape))throw new Error(`Unrecognized key: "${p}"`);i[p]&&delete f[p]}return ms(this,"shape",f),f},checks:[]});return Ol(n,d)}function oS(n,i){if(!Co(i))throw new Error("Invalid input to extend: expected a plain object");const l=n._zod.def.checks;if(l&&l.length>0){const d=n._zod.def.shape;for(const f in i)if(Object.getOwnPropertyDescriptor(d,f)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const u=Nl(n._zod.def,{get shape(){const d={...n._zod.def.shape,...i};return ms(this,"shape",d),d}});return Ol(n,u)}function uS(n,i){if(!Co(i))throw new Error("Invalid input to safeExtend: expected a plain object");const l=Nl(n._zod.def,{get shape(){const r={...n._zod.def.shape,...i};return ms(this,"shape",r),r}});return Ol(n,l)}function cS(n,i){if(n._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const l=Nl(n._zod.def,{get shape(){const r={...n._zod.def.shape,...i._zod.def.shape};return ms(this,"shape",r),r},get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return Ol(n,l)}function fS(n,i,l){const u=i._zod.def.checks;if(u&&u.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const f=Nl(i._zod.def,{get shape(){const p=i._zod.def.shape,m={...p};if(l)for(const v in l){if(!(v in p))throw new Error(`Unrecognized key: "${v}"`);l[v]&&(m[v]=n?new n({type:"optional",innerType:p[v]}):p[v])}else for(const v in p)m[v]=n?new n({type:"optional",innerType:p[v]}):p[v];return ms(this,"shape",m),m},checks:[]});return Ol(i,f)}function dS(n,i,l){const r=Nl(i._zod.def,{get shape(){const u=i._zod.def.shape,d={...u};if(l)for(const f in l){if(!(f in d))throw new Error(`Unrecognized key: "${f}"`);l[f]&&(d[f]=new n({type:"nonoptional",innerType:u[f]}))}else for(const f in u)d[f]=new n({type:"nonoptional",innerType:u[f]});return ms(this,"shape",d),d}});return Ol(i,r)}function rr(n,i=0){if(n.aborted===!0)return!0;for(let l=i;l{var r;return(r=l).path??(r.path=[]),l.path.unshift(n),l})}function uc(n){return typeof n=="string"?n:n?.message}function ds(n,i,l){const r=n.message?n.message:uc(n.inst?._zod.def?.error?.(n))??uc(i?.error?.(n))??uc(l.customError?.(n))??uc(l.localeError?.(n))??"Invalid input",{inst:u,continue:d,input:f,...p}=n;return p.path??(p.path=[]),p.message=r,i?.reportInput&&(p.input=f),p}function Vh(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function Do(...n){const[i,l,r]=n;return typeof i=="string"?{message:i,code:"custom",input:l,inst:r}:{...i}}const z0=(n,i)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:i,enumerable:!1}),n.message=JSON.stringify(i,uh,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerab)DELIM" +R"DELIM(le:!1})},E0=I("$ZodError",z0),T0=I("$ZodError",z0,{Parent:Error});function mS(n,i=l=>l.message){const l={},r=[];for(const u of n.issues)u.path.length>0?(l[u.path[0]]=l[u.path[0]]||[],l[u.path[0]].push(i(u))):r.push(i(u));return{formErrors:r,fieldErrors:l}}function pS(n,i=l=>l.message){const l={_errors:[]},r=(u,d=[])=>{for(const f of u.issues)if(f.code==="invalid_union"&&f.errors.length)f.errors.map(p=>r({issues:p},[...d,...f.path]));else if(f.code==="invalid_key")r({issues:f.issues},[...d,...f.path]);else if(f.code==="invalid_element")r({issues:f.issues},[...d,...f.path]);else{const p=[...d,...f.path];if(p.length===0)l._errors.push(i(f));else{let m=l,v=0;for(;v(i,l,r,u)=>{const d=r?{...r,async:!1}:{async:!1},f=i._zod.run({value:l,issues:[]},d);if(f instanceof Promise)throw new or;if(f.issues.length){const p=new(u?.Err??n)(f.issues.map(m=>ds(m,d,fs())));throw S0(p,u?.callee),p}return f.value},Yh=n=>async(i,l,r,u)=>{const d=r?{...r,async:!0}:{async:!0};let f=i._zod.run({value:l,issues:[]},d);if(f instanceof Promise&&(f=await f),f.issues.length){const p=new(u?.Err??n)(f.issues.map(m=>ds(m,d,fs())));throw S0(p,u?.callee),p}return f.value},Uc=n=>(i,l,r)=>{const u=r?{...r,async:!1}:{async:!1},d=i._zod.run({value:l,issues:[]},u);if(d instanceof Promise)throw new or;return d.issues.length?{success:!1,error:new(n??E0)(d.issues.map(f=>ds(f,u,fs())))}:{success:!0,data:d.value}},gS=Uc(T0),Zc=n=>async(i,l,r)=>{const u=r?{...r,async:!0}:{async:!0};let d=i._zod.run({value:l,issues:[]},u);return d instanceof Promise&&(d=await d),d.issues.length?{success:!1,error:new n(d.issues.map(f=>ds(f,u,fs())))}:{success:!0,data:d.value}},vS=Zc(T0),yS=n=>(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Gh(n)(i,l,u)},bS=n=>(i,l,r)=>Gh(n)(i,l,r),_S=n=>async(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Yh(n)(i,l,u)},SS=n=>async(i,l,r)=>Yh(n)(i,l,r),xS=n=>(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Uc(n)(i,l,u)},wS=n=>(i,l,r)=>Uc(n)(i,l,r),zS=n=>async(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Zc(n)(i,l,u)},ES=n=>async(i,l,r)=>Zc(n)(i,l,r),TS=/^[cC][0-9a-z]{6,}$/,AS=/^[0-9a-z]+$/,NS=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,OS=/^[0-9a-vA-V]{20}$/,MS=/^[A-Za-z0-9]{27}$/,jS=/^[a-zA-Z0-9_-]{21}$/,kS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,RS=/^([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})$/,Zv=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)$/,CS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,DS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function US(){return new RegExp(DS,"u")}const ZS=/^(?:(?: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])$/,$S=/^(([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}|:))$/,LS=/^((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])$/,HS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,A0=/^[A-Za-z0-9_-]*$/,BS=/^https?$/,VS=/^\+[1-9]\d{6,14}$/,N0="(?:(?:\\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])))",GS=new RegExp(`^${N0}$`);function O0(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}}`:`${i}(?::[0-5]\\d(?:\\.\\d+)?)?`}function YS(n){return new RegExp(`^${O0(n)}$`)}function QS(n){const i=O0({precision:n.precision}),l=["Z"];n.local&&l.push(""),n.offset&&l.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${i}(?:${l.join("|")})`;return new RegExp(`^${N0}T(?:${r})$`)}const KS=n=>{const i=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${i}$`)},FS=/^-?\d+$/,JS=/^-?\d+(?:\.\d+)?$/,XS=/^(?:true|false)$/i,IS=/^[^A-Z]*$/,PS=/^[^a-z]*$/,Wn=I("$ZodCheck",(n,i)=>{var l;n._zod??(n._zod={}),n._zod.def=i,(l=n._zod).onattach??(l.onattach=[])}),M0={number:"number",bigint:"bigint",object:"date"},j0=I("$ZodCheckLessThan",(n,i)=>{Wn.init(n,i);const l=M0[typeof i.value];n._zod.onattach.push(r=>{const u=r._zod.bag,d=(i.inclusive?u.maximum:u.exclusiveMaximum)??Number.POSITIVE_INFINITY;i.value{(i.inclusive?r.value<=i.value:r.value{Wn.init(n,i);const l=M0[typeof i.value];n._zod.onattach.push(r=>{const u=r._zod.bag,d=(i.inclusive?u.minimum:u.exclusiveMinimum)??Number.NEGATIVE_INFINITY;i.value>d&&(i.inclusive?u.minimum=i.value:u.exclusiveMinimum=i.value)}),n._zod.check=r=>{(i.inclusive?r.value>=i.value:r.value>i.value)||r.issues.push({origin:l,code:"too_small",minimum:typeof i.value=="object"?i.value.getTime():i.value,input:r.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),WS=I("$ZodCheckMultipleOf",(n,i)=>{Wn.init(n,i),n._zod.onattach.push(l=>{var r;(r=l._zod.bag).multipleOf??(r.multipleOf=i.value)}),n._zod.check=l=>{if(typeof l.value!=typeof i.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof l.value=="bigint"?l.value%i.value===BigInt(0):eS(l.value,i.value)===0)||l.issues.push({origin:typeof l.value,code:"not_multiple_of",divisor:i.value,input:l.value,inst:n,continue:!i.abort})}}),ex=I("$ZodCheckNumberFormat",(n,i)=>{Wn.init(n,i),i.format=i.format||"float64";const l=i.format?.includes("int"),r=l?"int":"number",[u,d]=lS[i.format];n._zod.onattach.push(f=>{const p=f._zod.bag;p.format=i.format,p.minimum=u,p.maximum=d,l&&(p.pattern=FS)}),n._zod.check=f=>{const p=f.value;if(l){if(!Number.isInteger(p)){f.issues.push({expected:r,format:i.format,code:"invalid_type",continue:!1,input:p,inst:n});return}if(!Number.isSafeInteger(p)){p>0?f.issues.push({input:p,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!i.abort}):f.issues.push({input:p,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!i.abort});return}}pd&&f.issues.push({origin:"number",input:p,code:"too_big",maximum:d,inclusive:!0,inst:n,continue:!i.abort})}}),tx=I("$ZodCheckMaxLength",(n,i)=>{var l;Wn.init(n,i),(l=n._zod.def).when??(l.when=r=>{const u=r.value;return!qh(u)&&u.length!==void 0}),n._zod.onattach.push(r=>{const u=r._zod.bag.maximum??Number.POSITIVE_INFINITY;i.maximum{const u=r.value;if(u.length<=i.maximum)return;const f=Vh(u);r.issues.push({origin:f,code:"too_big",maximum:i.maximum)DELIM" +R"DELIM(,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),nx=I("$ZodCheckMinLength",(n,i)=>{var l;Wn.init(n,i),(l=n._zod.def).when??(l.when=r=>{const u=r.value;return!qh(u)&&u.length!==void 0}),n._zod.onattach.push(r=>{const u=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;i.minimum>u&&(r._zod.bag.minimum=i.minimum)}),n._zod.check=r=>{const u=r.value;if(u.length>=i.minimum)return;const f=Vh(u);r.issues.push({origin:f,code:"too_small",minimum:i.minimum,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),ix=I("$ZodCheckLengthEquals",(n,i)=>{var l;Wn.init(n,i),(l=n._zod.def).when??(l.when=r=>{const u=r.value;return!qh(u)&&u.length!==void 0}),n._zod.onattach.push(r=>{const u=r._zod.bag;u.minimum=i.length,u.maximum=i.length,u.length=i.length}),n._zod.check=r=>{const u=r.value,d=u.length;if(d===i.length)return;const f=Vh(u),p=d>i.length;r.issues.push({origin:f,...p?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!i.abort})}}),$c=I("$ZodCheckStringFormat",(n,i)=>{var l,r;Wn.init(n,i),n._zod.onattach.push(u=>{const d=u._zod.bag;d.format=i.format,i.pattern&&(d.patterns??(d.patterns=new Set),d.patterns.add(i.pattern))}),i.pattern?(l=n._zod).check??(l.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})}):(r=n._zod).check??(r.check=()=>{})}),ax=I("$ZodCheckRegex",(n,i)=>{$c.init(n,i),n._zod.check=l=>{i.pattern.lastIndex=0,!i.pattern.test(l.value)&&l.issues.push({origin:"string",code:"invalid_format",format:"regex",input:l.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),lx=I("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=IS),$c.init(n,i)}),sx=I("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=PS),$c.init(n,i)}),rx=I("$ZodCheckIncludes",(n,i)=>{Wn.init(n,i);const l=dr(i.includes),r=new RegExp(typeof i.position=="number"?`^.{${i.position}}${l}`:l);i.pattern=r,n._zod.onattach.push(u=>{const d=u._zod.bag;d.patterns??(d.patterns=new Set),d.patterns.add(r)}),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})}}),ox=I("$ZodCheckStartsWith",(n,i)=>{Wn.init(n,i);const l=new RegExp(`^${dr(i.prefix)}.*`);i.pattern??(i.pattern=l),n._zod.onattach.push(r=>{const u=r._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(l)}),n._zod.check=r=>{r.value.startsWith(i.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:r.value,inst:n,continue:!i.abort})}}),ux=I("$ZodCheckEndsWith",(n,i)=>{Wn.init(n,i);const l=new RegExp(`.*${dr(i.suffix)}$`);i.pattern??(i.pattern=l),n._zod.onattach.push(r=>{const u=r._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(l)}),n._zod.check=r=>{r.value.endsWith(i.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:r.value,inst:n,continue:!i.abort})}}),cx=I("$ZodCheckOverwrite",(n,i)=>{Wn.init(n,i),n._zod.check=l=>{l.value=i.tx(l.value)}});class fx{constructor(i=[]){this.content=[],this.indent=0,this&&(this.args=i)}indented(i){this.indent+=1,i(this),this.indent-=1}write(i){if(typeof i=="function"){i(this,{execution:"sync"}),i(this,{execution:"async"});return}const r=i.split(` +`).filter(f=>f),u=Math.min(...r.map(f=>f.length-f.trimStart().length)),d=r.map(f=>f.slice(u)).map(f=>" ".repeat(this.indent*2)+f);for(const f of d)this.content.push(f)}compile(){const i=Function,l=this?.args,u=[...(this?.content??[""]).map(d=>` ${d}`)];return new i(...l,u.join(` +`))}}const dx={major:4,minor:4,patch:3},Ut=I("$ZodType",(n,i)=>{var l;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=dx;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const u of r)for(const d of u._zod.onattach)d(n);if(r.length===0)(l=n._zod).deferred??(l.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{const u=(f,p,m)=>{let v=rr(f),w;for(const S of p){if(S._zod.def.when){if(hS(f)||!S._zod.def.when(f))continue}else if(v)continue;const z=f.issues.length,T=S._zod.check(f);if(T instanceof Promise&&m?.async===!1)throw new or;if(w||T instanceof Promise)w=(w??Promise.resolve()).then(async()=>{await T,f.issues.length!==z&&(v||(v=rr(f,z)))});else{if(f.issues.length===z)continue;v||(v=rr(f,z))}}return w?w.then(()=>f):f},d=(f,p,m)=>{if(rr(f))return f.aborted=!0,f;const v=u(p,r,m);if(v instanceof Promise){if(m.async===!1)throw new or;return v.then(w=>n._zod.parse(w,m))}return n._zod.parse(v,m)};n._zod.run=(f,p)=>{if(p.skipChecks)return n._zod.parse(f,p);if(p.direction==="backward"){const v=n._zod.parse({value:f.value,issues:[]},{...p,skipChecks:!0});return v instanceof Promise?v.then(w=>d(w,f,p)):d(v,f,p)}const m=n._zod.parse(f,p);if(m instanceof Promise){if(p.async===!1)throw new or;return m.then(v=>u(v,r,p))}return u(m,r,p)}}ht(n,"~standard",()=>({validate:u=>{try{const d=gS(n,u);return d.success?{value:d.data}:{issues:d.error?.issues}}catch{return vS(n,u).then(f=>f.success?{value:f.data}:{issues:f.error?.issues})}},vendor:"zod",version:1}))}),Qh=I("$ZodString",(n,i)=>{Ut.init(n,i),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??KS(n._zod.bag),n._zod.parse=(l,r)=>{if(i.coerce)try{l.value=String(l.value)}catch{}return typeof l.value=="string"||l.issues.push({expected:"string",code:"invalid_type",input:l.value,inst:n}),l}}),Tt=I("$ZodStringFormat",(n,i)=>{$c.init(n,i),Qh.init(n,i)}),hx=I("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=RS),Tt.init(n,i)}),mx=I("$ZodUUID",(n,i)=>{if(i.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(r===void 0)throw new Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=Zv(r))}else i.pattern??(i.pattern=Zv());Tt.init(n,i)}),px=I("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=CS),Tt.init(n,i)}),gx=I("$ZodURL",(n,i)=>{Tt.init(n,i),n._zod.check=l=>{try{const r=l.value.trim();if(!i.normalize&&i.protocol?.source===BS.source&&!/^https?:\/\//i.test(r)){l.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:l.value,inst:n,continue:!i.abort});return}const u=new URL(r);i.hostname&&(i.hostname.lastIndex=0,i.hostname.test(u.hostname)||l.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:l.value,inst:n,continue:!i.abort})),i.protocol&&(i.protocol.lastIndex=0,i.protocol.test(u.protocol.endsWith(":")?u.protocol.slice(0,-1):u.protocol)||l.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:l.value,inst:n,continue:!i.abort})),i.normalize?l.value=u.href:l.value=r;return}catch{l.issues.push({code:"invalid_format",format:"url",input:l.value,inst:n,continue:!i.abort})}}}),vx=I("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=US()),Tt.init(n,i)}),yx=I("$ZodNanoID",(n,i)=>{i.pattern??(i.pattern=jS),Tt.init(n,i)}),bx=I("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=TS),Tt.init(n,i)}),_x=I("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=AS),Tt.init(n,i)}),Sx=I("$ZodULID",(n,i)=>{i.pattern??(i.pattern=NS),Tt.init(n,i)}),xx=I("$ZodXID",(n,i)=>{i.pattern??(i.pattern=OS),Tt.init(n,i)}),wx=I("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=MS),Tt.init(n,i)}),zx=I("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=QS(i)),Tt.init(n,i)}),Ex=I("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=GS),Tt.init(n,i)}),Tx=I("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=YS(i)),Tt.init(n,i)}),Ax=I("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=kS),Tt.init(n,i)}),Nx=I("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=ZS),Tt.init(n,i),n._zod.bag.format="ipv4"}),Ox=I("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=$S),Tt.init(n,i),n._zod.bag.format="ipv6",n._zod.check=l=>{try{new URL(`http://[${l.value}]`)}catch{l.issues.push({code:"invalid_format",format:"ipv6",input:l.value,inst:n,continue:!i.abort})}}}),Mx=I("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=LS)DELIM" +R"DELIM(),Tt.init(n,i)}),jx=I("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=HS),Tt.init(n,i),n._zod.check=l=>{const r=l.value.split("/");try{if(r.length!==2)throw new Error;const[u,d]=r;if(!d)throw new Error;const f=Number(d);if(`${f}`!==d)throw new Error;if(f<0||f>128)throw new Error;new URL(`http://[${u}]`)}catch{l.issues.push({code:"invalid_format",format:"cidrv6",input:l.value,inst:n,continue:!i.abort})}}});function R0(n){if(n==="")return!0;if(/\s/.test(n)||n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const kx=I("$ZodBase64",(n,i)=>{i.pattern??(i.pattern=qS),Tt.init(n,i),n._zod.bag.contentEncoding="base64",n._zod.check=l=>{R0(l.value)||l.issues.push({code:"invalid_format",format:"base64",input:l.value,inst:n,continue:!i.abort})}});function Rx(n){if(!A0.test(n))return!1;const i=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),l=i.padEnd(Math.ceil(i.length/4)*4,"=");return R0(l)}const Cx=I("$ZodBase64URL",(n,i)=>{i.pattern??(i.pattern=A0),Tt.init(n,i),n._zod.bag.contentEncoding="base64url",n._zod.check=l=>{Rx(l.value)||l.issues.push({code:"invalid_format",format:"base64url",input:l.value,inst:n,continue:!i.abort})}}),Dx=I("$ZodE164",(n,i)=>{i.pattern??(i.pattern=VS),Tt.init(n,i)});function Ux(n,i=null){try{const l=n.split(".");if(l.length!==3)return!1;const[r]=l;if(!r)return!1;const u=JSON.parse(atob(r));return!("typ"in u&&u?.typ!=="JWT"||!u.alg||i&&(!("alg"in u)||u.alg!==i))}catch{return!1}}const Zx=I("$ZodJWT",(n,i)=>{Tt.init(n,i),n._zod.check=l=>{Ux(l.value,i.alg)||l.issues.push({code:"invalid_format",format:"jwt",input:l.value,inst:n,continue:!i.abort})}}),C0=I("$ZodNumber",(n,i)=>{Ut.init(n,i),n._zod.pattern=n._zod.bag.pattern??JS,n._zod.parse=(l,r)=>{if(i.coerce)try{l.value=Number(l.value)}catch{}const u=l.value;if(typeof u=="number"&&!Number.isNaN(u)&&Number.isFinite(u))return l;const d=typeof u=="number"?Number.isNaN(u)?"NaN":Number.isFinite(u)?void 0:"Infinity":void 0;return l.issues.push({expected:"number",code:"invalid_type",input:u,inst:n,...d?{received:d}:{}}),l}}),$x=I("$ZodNumberFormat",(n,i)=>{ex.init(n,i),C0.init(n,i)}),Lx=I("$ZodBoolean",(n,i)=>{Ut.init(n,i),n._zod.pattern=XS,n._zod.parse=(l,r)=>{if(i.coerce)try{l.value=!!l.value}catch{}const u=l.value;return typeof u=="boolean"||l.issues.push({expected:"boolean",code:"invalid_type",input:u,inst:n}),l}}),Hx=I("$ZodUnknown",(n,i)=>{Ut.init(n,i),n._zod.parse=l=>l}),qx=I("$ZodNever",(n,i)=>{Ut.init(n,i),n._zod.parse=(l,r)=>(l.issues.push({expected:"never",code:"invalid_type",input:l.value,inst:n}),l)});function $v(n,i,l){n.issues.length&&i.issues.push(...w0(l,n.issues)),i.value[l]=n.value}const Bx=I("$ZodArray",(n,i)=>{Ut.init(n,i),n._zod.parse=(l,r)=>{const u=l.value;if(!Array.isArray(u))return l.issues.push({expected:"array",code:"invalid_type",input:u,inst:n}),l;l.value=Array(u.length);const d=[];for(let f=0;f$v(v,l,f))):$v(m,l,f)}return d.length?Promise.all(d).then(()=>l):l}});function xc(n,i,l,r,u,d){const f=l in r;if(n.issues.length){if(u&&d&&!f)return;i.issues.push(...w0(l,n.issues))}if(!f&&!u){n.issues.length||i.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[l]});return}n.value===void 0?f&&(i.value[l]=void 0):i.value[l]=n.value}function D0(n){const i=Object.keys(n.shape);for(const r of i)if(!n.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const l=aS(n.shape);return{...n,keys:i,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(l)}}function U0(n,i,l,r,u,d){const f=[],p=u.keySet,m=u.catchall._zod,v=m.def.type,w=m.optin==="optional",S=m.optout==="optional";for(const z in i){if(z==="__proto__"||p.has(z))continue;if(v==="never"){f.push(z);continue}const T=m.run({value:i[z],issues:[]},r);T instanceof Promise?n.push(T.then(j=>xc(j,l,z,i,w,S))):xc(T,l,z,i,w,S)}return f.length&&l.issues.push({code:"unrecognized_keys",keys:f,input:i,inst:d}),n.length?Promise.all(n).then(()=>l):l}const Vx=I("$ZodObject",(n,i)=>{if(Ut.init(n,i),!Object.getOwnPropertyDescriptor(i,"shape")?.get){const p=i.shape;Object.defineProperty(i,"shape",{get:()=>{const m={...p};return Object.defineProperty(i,"shape",{value:m}),m}})}const r=Hh(()=>D0(i));ht(n._zod,"propValues",()=>{const p=i.shape,m={};for(const v in p){const w=p[v]._zod;if(w.values){m[v]??(m[v]=new Set);for(const S of w.values)m[v].add(S)}}return m});const u=Sc,d=i.catchall;let f;n._zod.parse=(p,m)=>{f??(f=r.value);const v=p.value;if(!u(v))return p.issues.push({expected:"object",code:"invalid_type",input:v,inst:n}),p;p.value={};const w=[],S=f.shape;for(const z of f.keys){const T=S[z],j=T._zod.optin==="optional",L=T._zod.optout==="optional",V=T._zod.run({value:v[z],issues:[]},m);V instanceof Promise?w.push(V.then(H=>xc(H,p,z,v,j,L))):xc(V,p,z,v,j,L)}return d?U0(w,v,p,m,r.value,n):w.length?Promise.all(w).then(()=>p):p}}),Gx=I("$ZodObjectJIT",(n,i)=>{Vx.init(n,i);const l=n._zod.parse,r=Hh(()=>D0(i)),u=z=>{const T=new fx(["shape","payload","ctx"]),j=r.value,L=W=>{const B=Uv(W);return`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`};T.write("const input = payload.value;");const V=Object.create(null);let H=0;for(const W of j.keys)V[W]=`key_${H++}`;T.write("const newResult = {};");for(const W of j.keys){const B=V[W],ne=Uv(W),ee=z[W],K=ee?._zod?.optin==="optional",le=ee?._zod?.optout==="optional";T.write(`const ${B} = ${L(W)};`),K&&le?T.write(` + if (${B}.issues.length) { + if (${ne} in input) { + payload.issues = payload.issues.concat(${B}.issues.map(iss => ({ ...iss, - path: iss.path ? [${ee}, ...iss.path] : [${ee}] + path: iss.path ? [${ne}, ...iss.path] : [${ne}] }))); } } - if (${q}.value === undefined) { - if (${ee} in input) { - newResult[${ee}] = undefined; + if (${B}.value === undefined) { + if (${ne} in input) { + newResult[${ne}] = undefined; } } else { - newResult[${ee}] = ${q}.value; + newResult[${ne}] = ${B}.value; } - `):F?T.write(` - if (${q}.issues.length) { - payload.issues = payload.issues.concat(${q}.issues.map(iss => ({ + `):K?T.write(` + if (${B}.issues.length) { + payload.issues = payload.issues.concat(${B}.issues.map(iss => ({ ...iss, - path: iss.path ? [${ee}, ...iss.path] : [${ee}] + path: iss.path ? [${ne}, ...iss.path] : [${ne}] }))); } - if (${q}.value === undefined) { - if (${ee} in input) { - newResult[${ee}] = undefined; + if (${B}.value === undefined) { + if (${ne} in input) { + newResult[${ne}] = undefined; } } else { - newResult[${ee}] = ${q}.value; + newResult[${ne}] = ${B}.value; } `):T.write(` - const ${q}_present = ${ee} in input; - if (${q}.issues.length) { - payload.issues = payload.issues.concat(${q}.issues.map(iss => ({ + const ${B}_present = ${ne} in input; + if (${B}.issues.length) { + payload.issues = payload.issues.concat(${B}.issues.map(iss => ({ ...iss, - path: iss.path ? [${ee}, ...iss.path] : [${ee}] + path: iss.path ? [${ne}, ...iss.path] : [${ne}] }))); } - if (!${q}_present && !${q}.issues.length) { + if (!${B}_present && !${B}.issues.length) { payload.issues.push({ code: "invalid_type", expected: "nonoptional", input: undefined, - path: [${ee}] + path: [${ne}] }); } - if (${q}_present) { - if (${q}.value === undefined) { - newResult[${ee}] = undefined; + if (${B}_present) { + if (${B}.value === undefined) { + newResult[${ne}] = undefined; } else { - newResult[${ee}] = ${q}.value; + newResult[${ne}] = ${B}.value; } } - `)}T.write("payload.value = newResult;"),T.write("return payload;");const Y=T.compile();return(J,q)=>Y(z,J,q)};let d;const f=Sc,m=!$h.jitless,v=m&&nS.value,w=i.catchall;let S;n._zod.parse=(z,T)=>{S??(S=r.value);const j=z.value;return f(j)?m&&v&&T?.async===!1&&T.jitless!==!0?(d||(d=o(i.shape)),z=d(z,T),w?U0([],j,z,T,S,n):z):s(z,T):(z.issues.push({expected:"object",code:"invalid_type",input:j,inst:n}),z)}});function Lv(n,i,s,r){for(const d of n)if(d.issues.length===0)return i.value=d.value,i;const o=n.filter(d=>!rr(d));return o.length===1?(i.value=o[0].value,o[0]):(i.issues.push({code:"invalid_union",input:i.value,inst:s,errors:n.map(d=>d.issues.map(f=>ds(f,r,fs())))}),i)}const Yx=P("$ZodUnion",(n,i)=>{Ut.init(n,i),ht(n._zod,"optin",()=>i.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ht(n._zod,"optout",()=>i.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ht)DELIM" -R"DELIM((n._zod,"values",()=>{if(i.options.every(r=>r._zod.values))return new Set(i.options.flatMap(r=>Array.from(r._zod.values)))}),ht(n._zod,"pattern",()=>{if(i.options.every(r=>r._zod.pattern)){const r=i.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>qh(o.source)).join("|")})$`)}});const s=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(r,o)=>{if(s)return s(r,o);let d=!1;const f=[];for(const m of i.options){const g=m._zod.run({value:r.value,issues:[]},o);if(g instanceof Promise)f.push(g),d=!0;else{if(g.issues.length===0)return g;f.push(g)}}return d?Promise.all(f).then(m=>Lv(m,r,n,o)):Lv(f,r,n,o)}}),Qx=P("$ZodIntersection",(n,i)=>{Ut.init(n,i),n._zod.parse=(s,r)=>{const o=s.value,d=i.left._zod.run({value:o,issues:[]},r),f=i.right._zod.run({value:o,issues:[]},r);return d instanceof Promise||f instanceof Promise?Promise.all([d,f]).then(([g,v])=>Hv(s,g,v)):Hv(s,d,f)}});function oh(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(Ru(n)&&Ru(i)){const s=Object.keys(i),r=Object.keys(n).filter(d=>s.indexOf(d)!==-1),o={...n,...i};for(const d of r){const f=oh(n[d],i[d]);if(!f.valid)return{valid:!1,mergeErrorPath:[d,...f.mergeErrorPath]};o[d]=f.data}return{valid:!0,data:o}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};const s=[];for(let r=0;rm.l&&m.r).map(([m])=>m);if(d.length&&o&&n.issues.push({...o,keys:d}),rr(n))return n;const f=oh(i.value,s.value);if(!f.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(f.mergeErrorPath)}`);return n.value=f.data,n}const Kx=P("$ZodEnum",(n,i)=>{Ut.init(n,i);const s=_0(i.entries),r=new Set(s);n._zod.values=r,n._zod.pattern=new RegExp(`^(${s.filter(o=>iS.has(typeof o)).map(o=>typeof o=="string"?dr(o):o.toString()).join("|")})$`),n._zod.parse=(o,d)=>{const f=o.value;return r.has(f)||o.issues.push({code:"invalid_value",values:s,input:f,inst:n}),o}}),Jx=P("$ZodLiteral",(n,i)=>{if(Ut.init(n,i),i.values.length===0)throw new Error("Cannot create literal schema with no valid values");const s=new Set(i.values);n._zod.values=s,n._zod.pattern=new RegExp(`^(${i.values.map(r=>typeof r=="string"?dr(r):r?dr(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,o)=>{const d=r.value;return s.has(d)||r.issues.push({code:"invalid_value",values:i.values,input:d,inst:n}),r}}),Fx=P("$ZodTransform",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",n._zod.parse=(s,r)=>{if(r.direction==="backward")throw new b0(n.constructor.name);const o=i.transform(s.value,s);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(f=>(s.value=f,s.fallback=!0,s));if(o instanceof Promise)throw new ur;return s.value=o,s.fallback=!0,s}});function qv(n,i){return i===void 0&&(n.issues.length||n.fallback)?{issues:[],value:void 0}:n}const Z0=P("$ZodOptional",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",n._zod.optout="optional",ht(n._zod,"values",()=>i.innerType._zod.values?new Set([...i.innerType._zod.values,void 0]):void 0),ht(n._zod,"pattern",()=>{const s=i.innerType._zod.pattern;return s?new RegExp(`^(${qh(s.source)})?$`):void 0}),n._zod.parse=(s,r)=>{if(i.innerType._zod.optin==="optional"){const o=s.value,d=i.innerType._zod.run(s,r);return d instanceof Promise?d.then(f=>qv(f,o)):qv(d,o)}return s.value===void 0?s:i.innerType._zod.run(s,r)}}),Xx=P("$ZodExactOptional",(n,i)=>{Z0.init(n,i),ht(n._zod,"values",()=>i.innerType._zod.values),ht(n._zod,"pattern",()=>i.innerType._zod.pattern),n._zod.parse=(s,r)=>i.innerType._zod.run(s,r)}),Ix=P("$ZodNullable",(n,i)=>{Ut.init(n,i),ht(n._zod,"optin",()=>i.innerType._zod.optin),ht(n._zod,"optout",()=>i.innerType._zod.optout),ht(n._zod,"pattern",()=>{const s=i.innerType._zod.pattern;return s?new RegExp(`^(${qh(s.source)}|null)$`):void 0}),ht(n._zod,"values",()=>i.innerType._zod.values?new Set([...i.innerType._zod.values,null]):void 0),n._zod.parse=(s,r)=>s.value===null?s:i.innerType._zod.run(s,r)}),Px=P("$ZodDefault",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(s,r)=>{if(r.direction==="backward")return i.innerType._zod.run(s,r);if(s.value===void 0)return s.value=i.defaultValue,s;const o=i.innerType._zod.run(s,r);return o instanceof Promise?o.then(d=>Bv(d,i)):Bv(o,i)}});function Bv(n,i){return n.value===void 0&&(n.value=i.defaultValue),n}const Wx=P("$ZodPrefault",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(s,r)=>(r.direction==="backward"||s.value===void 0&&(s.value=i.defaultValue),i.innerType._zod.run(s,r))}),ew=P("$ZodNonOptional",(n,i)=>{Ut.init(n,i),ht(n._zod,"values",()=>{const s=i.innerType._zod.values;return s?new Set([...s].filter(r=>r!==void 0)):void 0}),n._zod.parse=(s,r)=>{const o=i.innerType._zod.run(s,r);return o instanceof Promise?o.then(d=>Vv(d,n)):Vv(o,n)}});function Vv(n,i){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:i}),n}const tw=P("$ZodCatch",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"optout",()=>i.innerType._zod.optout),ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(s,r)=>{if(r.direction==="backward")return i.innerType._zod.run(s,r);const o=i.innerType._zod.run(s,r);return o instanceof Promise?o.then(d=>(s.value=d.value,d.issues.length&&(s.value=i.catchValue({...s,error:{issues:d.issues.map(f=>ds(f,r,fs()))},input:s.value}),s.issues=[],s.fallback=!0),s)):(s.value=o.value,o.issues.length&&(s.value=i.catchValue({...s,error:{issues:o.issues.map(d=>ds(d,r,fs()))},input:s.value}),s.issues=[],s.fallback=!0),s)}}),nw=P("$ZodPipe",(n,i)=>{Ut.init(n,i),ht(n._zod,"values",()=>i.in._zod.values),ht(n._zod,"optin",()=>i.in._zod.optin),ht(n._zod,"optout",()=>i.out._zod.optout),ht(n._zod,"propValues",()=>i.in._zod.propValues),n._zod.parse=(s,r)=>{if(r.direction==="backward"){const d=i.out._zod.run(s,r);return d instanceof Promise?d.then(f=>cc(f,i.in,r)):cc(d,i.in,r)}const o=i.in._zod.run(s,r);return o instanceof Promise?o.then(d=>cc(d,i.out,r)):cc(o,i.out,r)}});function cc(n,i,s){return n.issues.length?(n.aborted=!0,n):i._zod.run({value:n.value,issues:n.issues,fallback:n.fallback},s)}const iw=P("$ZodReadonly",(n,i)=>{Ut.init(n,i),ht(n._zod,"propValues",()=>i.innerType._zod.propValues),ht(n._zod,"values",()=>i.innerType._zod.values),ht(n._zod,"optin",()=>i.innerType?._zod?.optin),ht(n._zod,"optout",()=>i.innerType?._zod?.optout),n._zod.parse=(s,r)=>{if(r.direction==="backward")return i.innerType._zod.run(s,r);const o=i.innerType._zod.run(s,r);return o instanceof Promise?o.then(Gv):Gv(o)}});function Gv(n){return n.value=Object.freeze(n.value),n}const aw=P("$ZodCustom",(n,i)=>{Wn.init(n,i),Ut.init(n,i),n._zod.parse=(s,r)=>s,n._zod.check=s=>{const r=s.value,o=i.fn(r);if(o instanceof Promise)return o.then(d=>Yv(d,s,r,n));Yv(o,s,r,n)}});function Yv(n,i,s,r){if(!n){const o={code:"custom",input:s,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),i.issues.push(Cu(o))}}var Qv;class lw{constructor(){this._map=new WeakMap,this._idmap=new Map}add(i,...s){const r=s[0];return this._map.set(i,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,i),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(i){const s=this._map.get(i);return s&&typeof s=="object"&&"id"in s&&this._idmap.delete(s.id),this._map.delete(i),this}get(i){const s=i._zod)DELIM" -R"DELIM(.parent;if(s){const r={...this.get(s)??{}};delete r.id;const o={...r,...this._map.get(i)};return Object.keys(o).length?o:void 0}return this._map.get(i)}has(i){return this._map.has(i)}}function sw(){return new lw}(Qv=globalThis).__zod_globalRegistry??(Qv.__zod_globalRegistry=sw());const Tu=globalThis.__zod_globalRegistry;function rw(n,i){return new n({type:"string",...Ae(i)})}function uw(n,i){return new n({type:"string",format:"email",check:"string_format",abort:!1,...Ae(i)})}function Kv(n,i){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...Ae(i)})}function ow(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...Ae(i)})}function cw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ae(i)})}function fw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ae(i)})}function dw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ae(i)})}function hw(n,i){return new n({type:"string",format:"url",check:"string_format",abort:!1,...Ae(i)})}function mw(n,i){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...Ae(i)})}function pw(n,i){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ae(i)})}function gw(n,i){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...Ae(i)})}function vw(n,i){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ae(i)})}function yw(n,i){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...Ae(i)})}function bw(n,i){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...Ae(i)})}function _w(n,i){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ae(i)})}function Sw(n,i){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ae(i)})}function xw(n,i){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ae(i)})}function ww(n,i){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ae(i)})}function zw(n,i){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ae(i)})}function Ew(n,i){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...Ae(i)})}function Tw(n,i){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...Ae(i)})}function Aw(n,i){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...Ae(i)})}function Nw(n,i){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...Ae(i)})}function Ow(n,i){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ae(i)})}function Mw(n,i){return new n({type:"string",format:"date",check:"string_format",...Ae(i)})}function jw(n,i){return new n({type:"string",format:"time",check:"string_format",precision:null,...Ae(i)})}function kw(n,i){return new n({type:"string",format:"duration",check:"string_format",...Ae(i)})}function Rw(n,i){return new n({type:"number",checks:[],...Ae(i)})}function Cw(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...Ae(i)})}function Dw(n,i){return new n({type:"boolean",...Ae(i)})}function Uw(n){return new n({type:"unknown"})}function Zw(n,i){return new n({type:"never",...Ae(i)})}function Jv(n,i){return new j0({check:"less_than",...Ae(i),value:n,inclusive:!1})}function Fd(n,i){return new j0({check:"less_than",...Ae(i),value:n,inclusive:!0})}function Fv(n,i){return new k0({check:"greater_than",...Ae(i),value:n,inclusive:!1})}function Xd(n,i){return new k0({check:"greater_than",...Ae(i),value:n,inclusive:!0})}function Xv(n,i){return new WS({check:"multiple_of",...Ae(i),value:n})}function $0(n,i){return new tx({check:"max_length",...Ae(i),maximum:n})}function wc(n,i){return new nx({check:"min_length",...Ae(i),minimum:n})}function L0(n,i){return new ix({check:"length_equals",...Ae(i),length:n})}function $w(n,i){return new ax({check:"string_format",format:"regex",...Ae(i),pattern:n})}function Lw(n){return new lx({check:"string_format",format:"lowercase",...Ae(n)})}function Hw(n){return new sx({check:"string_format",format:"uppercase",...Ae(n)})}function qw(n,i){return new rx({check:"string_format",format:"includes",...Ae(i),includes:n})}function Bw(n,i){return new ux({check:"string_format",format:"starts_with",...Ae(i),prefix:n})}function Vw(n,i){return new ox({check:"string_format",format:"ends_with",...Ae(i),suffix:n})}function yr(n){return new cx({check:"overwrite",tx:n})}function Gw(n){return yr(i=>i.normalize(n))}function Yw(){return yr(n=>n.trim())}function Qw(){return yr(n=>n.toLowerCase())}function Kw(){return yr(n=>n.toUpperCase())}function Jw(){return yr(n=>tS(n))}function Fw(n,i,s){return new n({type:"array",element:i,...Ae(s)})}function Xw(n,i,s){return new n({type:"custom",check:"custom",fn:i,...Ae(s)})}function Iw(n,i){const s=Pw(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Cu(o,r.value,s._zod.def));else{const d=o;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=r.value),d.inst??(d.inst=s),d.continue??(d.continue=!s._zod.def.abort),r.issues.push(Cu(d))}},n(r.value,r)),i);return s}function Pw(n,i){const s=new Wn({check:"custom",...Ae(i)});return s._zod.check=n,s}function H0(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??Tu,target:i,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0}}function Sn(n,i,s={path:[],schemaPath:[]}){var r;const o=n._zod.def,d=i.seen.get(n);if(d)return d.count++,s.schemaPath.includes(n)&&(d.cycle=s.path),d.schema;const f={schema:{},count:1,cycle:void 0,path:s.path};i.seen.set(n,f);const m=n._zod.toJSONSchema?.();if(m)f.schema=m;else{const w={...s,schemaPath:[...s.schemaPath,n],path:s.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(i,f.schema,w);else{const z=f.schema,T=i.processors[o.type];if(!T)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);T(n,i,z,w)}const S=n._zod.parent;S&&(f.ref||(f.ref=S),Sn(S,i,w),i.seen.get(S).isParent=!0)}const g=i.metadataRegistry.get(n);return g&&Object.assign(f.schema,g),i.io==="input"&&Ln(n)&&(delete f.schema.examples,delete f.schema.default),i.io==="input"&&"_prefault"in f.schema&&((r=f.schema).default??(r.default=f.schema._prefault)),delete f.schema._prefault,i.seen.get(n).schema}function q0(n,i){const s=n.seen.get(i);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const f of n.seen.entries()){const m=n.metadataRegistry.get(f[0])?.id;if(m){const g=r.get(m);if(g&&g!==f[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(m,f[0])}}const o=f=>{const m=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const S=n.external.registry.get(f[0])?.id,z=n.external.uri??(j=>j);if(S)return{ref:z(S)};const T=f[1].defId??f[1].schema.id??`schema${n.counter++}`;return f[1].defId=T,{defId:T,ref:`${z("__shared")}#/${m}/${T}`}}if(f[1]===s)return{ref:"#"};const v=`#/${m}/`,w=f[1].schema.id??`__schema${n.counter++}`;return{defId:w,ref:v+w}},d=f=>{if(f[1].schema.$ref)return;const m=f[1],{ref:g,defId:v}=o(f);m.def={...m.schema},v&&(m.defId=v);const w=m.schema;for(const S in w)delete w[S];w.$ref=g};if(n.cycles==="throw")for(const f of n.seen.entries()){const m=f[1];if(m.cycle)throw new Error(`Cycle detected: #/${m.cycle?.join("/")}/ + `)}T.write("payload.value = newResult;"),T.write("return payload;");const G=T.compile();return(W,B)=>G(z,W,B)};let d;const f=Sc,p=!Lh.jitless,v=p&&nS.value,w=i.catchall;let S;n._zod.parse=(z,T)=>{S??(S=r.value);const j=z.value;return f(j)?p&&v&&T?.async===!1&&T.jitless!==!0?(d||(d=u(i.shape)),z=d(z,T),w?U0([],j,z,T,S,n):z):l(z,T):(z.issues.push({expected:"object",code:"invalid_type",input:j,inst:n}),z)}});function Lv(n,i,l,r){for(const d of n)if(d.issues.length===0)return i.value=d.value,i;const u=n.filter(d=>!rr(d));return u.length===1?(i.value=u[0].value,u[0]):(i.issues.push({code:"invalid_union",input:i.value,inst:l,errors:n.map(d=>d.issues.map(f=>ds(f,r,fs())))}),i)}const Yx=I("$ZodUnion",(n,i)=>{Ut.init(n,i),ht(n._zod,"optin",()=>i.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ht(n._zod,"optout",()=>i.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ht)DELIM" +R"DELIM((n._zod,"values",()=>{if(i.options.every(r=>r._zod.values))return new Set(i.options.flatMap(r=>Array.from(r._zod.values)))}),ht(n._zod,"pattern",()=>{if(i.options.every(r=>r._zod.pattern)){const r=i.options.map(u=>u._zod.pattern);return new RegExp(`^(${r.map(u=>Bh(u.source)).join("|")})$`)}});const l=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(r,u)=>{if(l)return l(r,u);let d=!1;const f=[];for(const p of i.options){const m=p._zod.run({value:r.value,issues:[]},u);if(m instanceof Promise)f.push(m),d=!0;else{if(m.issues.length===0)return m;f.push(m)}}return d?Promise.all(f).then(p=>Lv(p,r,n,u)):Lv(f,r,n,u)}}),Qx=I("$ZodIntersection",(n,i)=>{Ut.init(n,i),n._zod.parse=(l,r)=>{const u=l.value,d=i.left._zod.run({value:u,issues:[]},r),f=i.right._zod.run({value:u,issues:[]},r);return d instanceof Promise||f instanceof Promise?Promise.all([d,f]).then(([m,v])=>Hv(l,m,v)):Hv(l,d,f)}});function ch(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(Co(n)&&Co(i)){const l=Object.keys(i),r=Object.keys(n).filter(d=>l.indexOf(d)!==-1),u={...n,...i};for(const d of r){const f=ch(n[d],i[d]);if(!f.valid)return{valid:!1,mergeErrorPath:[d,...f.mergeErrorPath]};u[d]=f.data}return{valid:!0,data:u}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};const l=[];for(let r=0;rp.l&&p.r).map(([p])=>p);if(d.length&&u&&n.issues.push({...u,keys:d}),rr(n))return n;const f=ch(i.value,l.value);if(!f.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(f.mergeErrorPath)}`);return n.value=f.data,n}const Kx=I("$ZodEnum",(n,i)=>{Ut.init(n,i);const l=_0(i.entries),r=new Set(l);n._zod.values=r,n._zod.pattern=new RegExp(`^(${l.filter(u=>iS.has(typeof u)).map(u=>typeof u=="string"?dr(u):u.toString()).join("|")})$`),n._zod.parse=(u,d)=>{const f=u.value;return r.has(f)||u.issues.push({code:"invalid_value",values:l,input:f,inst:n}),u}}),Fx=I("$ZodLiteral",(n,i)=>{if(Ut.init(n,i),i.values.length===0)throw new Error("Cannot create literal schema with no valid values");const l=new Set(i.values);n._zod.values=l,n._zod.pattern=new RegExp(`^(${i.values.map(r=>typeof r=="string"?dr(r):r?dr(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,u)=>{const d=r.value;return l.has(d)||r.issues.push({code:"invalid_value",values:i.values,input:d,inst:n}),r}}),Jx=I("$ZodTransform",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",n._zod.parse=(l,r)=>{if(r.direction==="backward")throw new b0(n.constructor.name);const u=i.transform(l.value,l);if(r.async)return(u instanceof Promise?u:Promise.resolve(u)).then(f=>(l.value=f,l.fallback=!0,l));if(u instanceof Promise)throw new or;return l.value=u,l.fallback=!0,l}});function qv(n,i){return i===void 0&&(n.issues.length||n.fallback)?{issues:[],value:void 0}:n}const Z0=I("$ZodOptional",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",n._zod.optout="optional",ht(n._zod,"values",()=>i.innerType._zod.values?new Set([...i.innerType._zod.values,void 0]):void 0),ht(n._zod,"pattern",()=>{const l=i.innerType._zod.pattern;return l?new RegExp(`^(${Bh(l.source)})?$`):void 0}),n._zod.parse=(l,r)=>{if(i.innerType._zod.optin==="optional"){const u=l.value,d=i.innerType._zod.run(l,r);return d instanceof Promise?d.then(f=>qv(f,u)):qv(d,u)}return l.value===void 0?l:i.innerType._zod.run(l,r)}}),Xx=I("$ZodExactOptional",(n,i)=>{Z0.init(n,i),ht(n._zod,"values",()=>i.innerType._zod.values),ht(n._zod,"pattern",()=>i.innerType._zod.pattern),n._zod.parse=(l,r)=>i.innerType._zod.run(l,r)}),Ix=I("$ZodNullable",(n,i)=>{Ut.init(n,i),ht(n._zod,"optin",()=>i.innerType._zod.optin),ht(n._zod,"optout",()=>i.innerType._zod.optout),ht(n._zod,"pattern",()=>{const l=i.innerType._zod.pattern;return l?new RegExp(`^(${Bh(l.source)}|null)$`):void 0}),ht(n._zod,"values",()=>i.innerType._zod.values?new Set([...i.innerType._zod.values,null]):void 0),n._zod.parse=(l,r)=>l.value===null?l:i.innerType._zod.run(l,r)}),Px=I("$ZodDefault",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(l,r)=>{if(r.direction==="backward")return i.innerType._zod.run(l,r);if(l.value===void 0)return l.value=i.defaultValue,l;const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(d=>Bv(d,i)):Bv(u,i)}});function Bv(n,i){return n.value===void 0&&(n.value=i.defaultValue),n}const Wx=I("$ZodPrefault",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(l,r)=>(r.direction==="backward"||l.value===void 0&&(l.value=i.defaultValue),i.innerType._zod.run(l,r))}),ew=I("$ZodNonOptional",(n,i)=>{Ut.init(n,i),ht(n._zod,"values",()=>{const l=i.innerType._zod.values;return l?new Set([...l].filter(r=>r!==void 0)):void 0}),n._zod.parse=(l,r)=>{const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(d=>Vv(d,n)):Vv(u,n)}});function Vv(n,i){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:i}),n}const tw=I("$ZodCatch",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"optout",()=>i.innerType._zod.optout),ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(l,r)=>{if(r.direction==="backward")return i.innerType._zod.run(l,r);const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(d=>(l.value=d.value,d.issues.length&&(l.value=i.catchValue({...l,error:{issues:d.issues.map(f=>ds(f,r,fs()))},input:l.value}),l.issues=[],l.fallback=!0),l)):(l.value=u.value,u.issues.length&&(l.value=i.catchValue({...l,error:{issues:u.issues.map(d=>ds(d,r,fs()))},input:l.value}),l.issues=[],l.fallback=!0),l)}}),nw=I("$ZodPipe",(n,i)=>{Ut.init(n,i),ht(n._zod,"values",()=>i.in._zod.values),ht(n._zod,"optin",()=>i.in._zod.optin),ht(n._zod,"optout",()=>i.out._zod.optout),ht(n._zod,"propValues",()=>i.in._zod.propValues),n._zod.parse=(l,r)=>{if(r.direction==="backward"){const d=i.out._zod.run(l,r);return d instanceof Promise?d.then(f=>cc(f,i.in,r)):cc(d,i.in,r)}const u=i.in._zod.run(l,r);return u instanceof Promise?u.then(d=>cc(d,i.out,r)):cc(u,i.out,r)}});function cc(n,i,l){return n.issues.length?(n.aborted=!0,n):i._zod.run({value:n.value,issues:n.issues,fallback:n.fallback},l)}const iw=I("$ZodReadonly",(n,i)=>{Ut.init(n,i),ht(n._zod,"propValues",()=>i.innerType._zod.propValues),ht(n._zod,"values",()=>i.innerType._zod.values),ht(n._zod,"optin",()=>i.innerType?._zod?.optin),ht(n._zod,"optout",()=>i.innerType?._zod?.optout),n._zod.parse=(l,r)=>{if(r.direction==="backward")return i.innerType._zod.run(l,r);const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(Gv):Gv(u)}});function Gv(n){return n.value=Object.freeze(n.value),n}const aw=I("$ZodCustom",(n,i)=>{Wn.init(n,i),Ut.init(n,i),n._zod.parse=(l,r)=>l,n._zod.check=l=>{const r=l.value,u=i.fn(r);if(u instanceof Promise)return u.then(d=>Yv(d,l,r,n));Yv(u,l,r,n)}});function Yv(n,i,l,r){if(!n){const u={code:"custom",input:l,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(u.params=r._zod.def.params),i.issues.push(Do(u))}}var Qv;class lw{constructor(){this._map=new WeakMap,this._idmap=new Map}add(i,...l){const r=l[0];return this._map.set(i,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,i),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(i){const l=this._map.get(i);return l&&typeof l=="object"&&"id"in l&&this._idmap.delete(l.id),this._map.delete(i),this}get(i){const l=i._zod)DELIM" +R"DELIM(.parent;if(l){const r={...this.get(l)??{}};delete r.id;const u={...r,...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 sw(){return new lw}(Qv=globalThis).__zod_globalRegistry??(Qv.__zod_globalRegistry=sw());const Ao=globalThis.__zod_globalRegistry;function rw(n,i){return new n({type:"string",...Ne(i)})}function ow(n,i){return new n({type:"string",format:"email",check:"string_format",abort:!1,...Ne(i)})}function Kv(n,i){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...Ne(i)})}function uw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...Ne(i)})}function cw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ne(i)})}function fw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ne(i)})}function dw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ne(i)})}function hw(n,i){return new n({type:"string",format:"url",check:"string_format",abort:!1,...Ne(i)})}function mw(n,i){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...Ne(i)})}function pw(n,i){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ne(i)})}function gw(n,i){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...Ne(i)})}function vw(n,i){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ne(i)})}function yw(n,i){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...Ne(i)})}function bw(n,i){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...Ne(i)})}function _w(n,i){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ne(i)})}function Sw(n,i){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ne(i)})}function xw(n,i){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ne(i)})}function ww(n,i){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ne(i)})}function zw(n,i){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ne(i)})}function Ew(n,i){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...Ne(i)})}function Tw(n,i){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...Ne(i)})}function Aw(n,i){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...Ne(i)})}function Nw(n,i){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...Ne(i)})}function Ow(n,i){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ne(i)})}function Mw(n,i){return new n({type:"string",format:"date",check:"string_format",...Ne(i)})}function jw(n,i){return new n({type:"string",format:"time",check:"string_format",precision:null,...Ne(i)})}function kw(n,i){return new n({type:"string",format:"duration",check:"string_format",...Ne(i)})}function Rw(n,i){return new n({type:"number",checks:[],...Ne(i)})}function Cw(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...Ne(i)})}function Dw(n,i){return new n({type:"boolean",...Ne(i)})}function Uw(n){return new n({type:"unknown"})}function Zw(n,i){return new n({type:"never",...Ne(i)})}function Fv(n,i){return new j0({check:"less_than",...Ne(i),value:n,inclusive:!1})}function Xd(n,i){return new j0({check:"less_than",...Ne(i),value:n,inclusive:!0})}function Jv(n,i){return new k0({check:"greater_than",...Ne(i),value:n,inclusive:!1})}function Id(n,i){return new k0({check:"greater_than",...Ne(i),value:n,inclusive:!0})}function Xv(n,i){return new WS({check:"multiple_of",...Ne(i),value:n})}function $0(n,i){return new tx({check:"max_length",...Ne(i),maximum:n})}function wc(n,i){return new nx({check:"min_length",...Ne(i),minimum:n})}function L0(n,i){return new ix({check:"length_equals",...Ne(i),length:n})}function $w(n,i){return new ax({check:"string_format",format:"regex",...Ne(i),pattern:n})}function Lw(n){return new lx({check:"string_format",format:"lowercase",...Ne(n)})}function Hw(n){return new sx({check:"string_format",format:"uppercase",...Ne(n)})}function qw(n,i){return new rx({check:"string_format",format:"includes",...Ne(i),includes:n})}function Bw(n,i){return new ox({check:"string_format",format:"starts_with",...Ne(i),prefix:n})}function Vw(n,i){return new ux({check:"string_format",format:"ends_with",...Ne(i),suffix:n})}function yr(n){return new cx({check:"overwrite",tx:n})}function Gw(n){return yr(i=>i.normalize(n))}function Yw(){return yr(n=>n.trim())}function Qw(){return yr(n=>n.toLowerCase())}function Kw(){return yr(n=>n.toUpperCase())}function Fw(){return yr(n=>tS(n))}function Jw(n,i,l){return new n({type:"array",element:i,...Ne(l)})}function Xw(n,i,l){return new n({type:"custom",check:"custom",fn:i,...Ne(l)})}function Iw(n,i){const l=Pw(r=>(r.addIssue=u=>{if(typeof u=="string")r.issues.push(Do(u,r.value,l._zod.def));else{const d=u;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=r.value),d.inst??(d.inst=l),d.continue??(d.continue=!l._zod.def.abort),r.issues.push(Do(d))}},n(r.value,r)),i);return l}function Pw(n,i){const l=new Wn({check:"custom",...Ne(i)});return l._zod.check=n,l}function H0(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??Ao,target:i,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0}}function Sn(n,i,l={path:[],schemaPath:[]}){var r;const u=n._zod.def,d=i.seen.get(n);if(d)return d.count++,l.schemaPath.includes(n)&&(d.cycle=l.path),d.schema;const f={schema:{},count:1,cycle:void 0,path:l.path};i.seen.set(n,f);const p=n._zod.toJSONSchema?.();if(p)f.schema=p;else{const w={...l,schemaPath:[...l.schemaPath,n],path:l.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(i,f.schema,w);else{const z=f.schema,T=i.processors[u.type];if(!T)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${u.type}`);T(n,i,z,w)}const S=n._zod.parent;S&&(f.ref||(f.ref=S),Sn(S,i,w),i.seen.get(S).isParent=!0)}const m=i.metadataRegistry.get(n);return m&&Object.assign(f.schema,m),i.io==="input"&&Ln(n)&&(delete f.schema.examples,delete f.schema.default),i.io==="input"&&"_prefault"in f.schema&&((r=f.schema).default??(r.default=f.schema._prefault)),delete f.schema._prefault,i.seen.get(n).schema}function q0(n,i){const l=n.seen.get(i);if(!l)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const f of n.seen.entries()){const p=n.metadataRegistry.get(f[0])?.id;if(p){const m=r.get(p);if(m&&m!==f[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,f[0])}}const u=f=>{const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const S=n.external.registry.get(f[0])?.id,z=n.external.uri??(j=>j);if(S)return{ref:z(S)};const T=f[1].defId??f[1].schema.id??`schema${n.counter++}`;return f[1].defId=T,{defId:T,ref:`${z("__shared")}#/${p}/${T}`}}if(f[1]===l)return{ref:"#"};const v=`#/${p}/`,w=f[1].schema.id??`__schema${n.counter++}`;return{defId:w,ref:v+w}},d=f=>{if(f[1].schema.$ref)return;const p=f[1],{ref:m,defId:v}=u(f);p.def={...p.schema},v&&(p.defId=v);const w=p.schema;for(const S in w)delete w[S];w.$ref=m};if(n.cycles==="throw")for(const f of n.seen.entries()){const p=f[1];if(p.cycle)throw new Error(`Cycle detected: #/${p.cycle?.join("/")}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of n.seen.entries()){const m=f[1];if(i===f[0]){d(f);continue}if(n.external){const v=n.external.registry.get(f[0])?.id;if(i!=)DELIM" -R"DELIM(=f[0]&&v){d(f);continue}}if(n.metadataRegistry.get(f[0])?.id){d(f);continue}if(m.cycle){d(f);continue}if(m.count>1&&n.reused==="ref"){d(f);continue}}}function B0(n,i){const s=n.seen.get(i);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=m=>{const g=n.seen.get(m);if(g.ref===null)return;const v=g.def??g.schema,w={...v},S=g.ref;if(g.ref=null,S){r(S);const T=n.seen.get(S),j=T.schema;if(j.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(v.allOf=v.allOf??[],v.allOf.push(j)):Object.assign(v,j),Object.assign(v,w),m._zod.parent===S)for(const Q in v)Q==="$ref"||Q==="allOf"||Q in w||delete v[Q];if(j.$ref&&T.def)for(const Q in v)Q==="$ref"||Q==="allOf"||Q in T.def&&JSON.stringify(v[Q])===JSON.stringify(T.def[Q])&&delete v[Q]}const z=m._zod.parent;if(z&&z!==S){r(z);const T=n.seen.get(z);if(T?.schema.$ref&&(v.$ref=T.schema.$ref,T.def))for(const j in v)j==="$ref"||j==="allOf"||j in T.def&&JSON.stringify(v[j])===JSON.stringify(T.def[j])&&delete v[j]}n.override({zodSchema:m,jsonSchema:v,path:g.path??[]})};for(const m of[...n.seen.entries()].reverse())r(m[0]);const o={};if(n.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?o.$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");o.$id=n.external.uri(m)}Object.assign(o,s.def??s.schema);const d=n.metadataRegistry.get(i)?.id;d!==void 0&&o.id===d&&delete o.id;const f=n.external?.defs??{};for(const m of n.seen.entries()){const g=m[1];g.def&&g.defId&&(g.def.id===g.defId&&delete g.def.id,f[g.defId]=g.def)}n.external||Object.keys(f).length>0&&(n.target==="draft-2020-12"?o.$defs=f:o.definitions=f);try{const m=JSON.parse(JSON.stringify(o));return Object.defineProperty(m,"~standard",{value:{...i["~standard"],jsonSchema:{input:zc(i,"input",n.processors),output:zc(i,"output",n.processors)}},enumerable:!1,writable:!1}),m}catch{throw new Error("Error converting schema to JSON.")}}function Ln(n,i){const s=i??{seen:new Set};if(s.seen.has(n))return!1;s.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ln(r.element,s);if(r.type==="set")return Ln(r.valueType,s);if(r.type==="lazy")return Ln(r.getter(),s);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ln(r.innerType,s);if(r.type==="intersection")return Ln(r.left,s)||Ln(r.right,s);if(r.type==="record"||r.type==="map")return Ln(r.keyType,s)||Ln(r.valueType,s);if(r.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:Ln(r.in,s)||Ln(r.out,s);if(r.type==="object"){for(const o in r.shape)if(Ln(r.shape[o],s))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ln(o,s))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ln(o,s))return!0;return!!(r.rest&&Ln(r.rest,s))}return!1}const Ww=(n,i={})=>s=>{const r=H0({...s,processors:i});return Sn(n,r),q0(r,n),B0(r,n)},zc=(n,i,s={})=>r=>{const{libraryOptions:o,target:d}=r??{},f=H0({...o??{},target:d,io:i,processors:s});return Sn(n,f),q0(f,n),B0(f,n)},ez={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tz=(n,i,s,r)=>{const o=s;o.type="string";const{minimum:d,maximum:f,format:m,patterns:g,contentEncoding:v}=n._zod.bag;if(typeof d=="number"&&(o.minLength=d),typeof f=="number"&&(o.maxLength=f),m&&(o.format=ez[m]??m,o.format===""&&delete o.format,m==="time"&&delete o.format),v&&(o.contentEncoding=v),g&&g.size>0){const w=[...g];w.length===1?o.pattern=w[0].source:w.length>1&&(o.allOf=[...w.map(S=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:S.source}))])}},nz=(n,i,s,r)=>{const o=s,{minimum:d,maximum:f,format:m,multipleOf:g,exclusiveMaximum:v,exclusiveMinimum:w}=n._zod.bag;typeof m=="string"&&m.includes("int")?o.type="integer":o.type="number";const S=typeof w=="number"&&w>=(d??Number.NEGATIVE_INFINITY),z=typeof v=="number"&&v<=(f??Number.POSITIVE_INFINITY),T=i.target==="draft-04"||i.target==="openapi-3.0";S?T?(o.minimum=w,o.exclusiveMinimum=!0):o.exclusiveMinimum=w:typeof d=="number"&&(o.minimum=d),z?T?(o.maximum=v,o.exclusiveMaximum=!0):o.exclusiveMaximum=v:typeof f=="number"&&(o.maximum=f),typeof g=="number"&&(o.multipleOf=g)},iz=(n,i,s,r)=>{s.type="boolean"},az=(n,i,s,r)=>{s.not={}},lz=(n,i,s,r)=>{},sz=(n,i,s,r)=>{const o=n._zod.def,d=_0(o.entries);d.every(f=>typeof f=="number")&&(s.type="number"),d.every(f=>typeof f=="string")&&(s.type="string"),s.enum=d},rz=(n,i,s,r)=>{const o=n._zod.def,d=[];for(const f of o.values)if(f===void 0){if(i.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof f=="bigint"){if(i.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");d.push(Number(f))}else d.push(f);if(d.length!==0)if(d.length===1){const f=d[0];s.type=f===null?"null":typeof f,i.target==="draft-04"||i.target==="openapi-3.0"?s.enum=[f]:s.const=f}else d.every(f=>typeof f=="number")&&(s.type="number"),d.every(f=>typeof f=="string")&&(s.type="string"),d.every(f=>typeof f=="boolean")&&(s.type="boolean"),d.every(f=>f===null)&&(s.type="null"),s.enum=d},uz=(n,i,s,r)=>{if(i.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},oz=(n,i,s,r)=>{if(i.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},cz=(n,i,s,r)=>{const o=s,d=n._zod.def,{minimum:f,maximum:m}=n._zod.bag;typeof f=="number"&&(o.minItems=f),typeof m=="number"&&(o.maxItems=m),o.type="array",o.items=Sn(d.element,i,{...r,path:[...r.path,"items"]})},fz=(n,i,s,r)=>{const o=s,d=n._zod.def;o.type="object",o.properties={};const f=d.shape;for(const v in f)o.properties[v]=Sn(f[v],i,{...r,path:[...r.path,"properties",v]});const m=new Set(Object.keys(f)),g=new Set([...m].filter(v=>{const w=d.shape[v]._zod;return i.io==="input"?w.optin===void 0:w.optout===void 0}));g.size>0&&(o.required=Array.from(g)),d.catchall?._zod.def.type==="never"?o.additionalProperties=!1:d.catchall?d.catchall&&(o.additionalProperties=Sn(d.catchall,i,{...r,path:[...r.path,"additionalProperties"]})):i.io==="output"&&(o.additionalProperties=!1)},dz=(n,i,s,r)=>{const o=n._zod.def,d=o.inclusive===!1,f=o.options.map((m,g)=>Sn(m,i,{...r,path:[...r.path,d?"oneOf":"anyOf",g]}));d?s.oneOf=f:s.anyOf=f},hz=(n,i,s,r)=>{const o=n._zod.def,d=Sn(o.left,i,{...r,path:[...r.path,"allOf",0]}),f=Sn(o.right,i,{...r,path:[...r.path,"allOf",1]}),m=v=>"allOf"in v&&Object.keys(v).length===1,g=[...m(d)?d.allOf:[d],...m(f)?f.allOf:[f]];s.allOf=g},mz=(n,i,s,r)=>{const o=n._zod.def,d=Sn(o.innerType,i,r),f=i.seen.get(n);i.target==="openapi-3.0"?(f.ref=o.innerType,s.nullable=!0):s.anyOf=[d,{type:"null"}]},pz=(n,i,s,r)=>{const o=n._zod.def;Sn(o.innerType,i,r);const d=i.seen.get(n);d.ref=o.innerType},gz=(n,i,s,r)=>{const o=n._zod.def;Sn(o.innerType,i,r);const d=i.seen.get(n);d.ref=o.innerType,s.default=JSON.parse(JSON.stringify(o.defaultValue))},vz=(n,i,s,r)=>{const o=n._zod.def;Sn(o.innerType,i,r);const d=i.seen.get(n);d.ref=o.innerType,i.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},yz=(n,i,s,r)=>{const o=n._zod.def;Sn(o.innerType,i,r);const d=i.seen.get(n);d.ref=o.innerType;let f;try{f=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=f},bz=(n,i,s,r)=>{const o=n._zod.def,d=o.in._zod.traits.has("$ZodTransform"),f=i.io==="input"?d?o.out:o.in:o.out;Sn(f,i,r);const m=i.seen.get(n);m.ref=f},_z=(n,i,s,r)=>{const o=n._zod.def;Sn(o.innerType,i,r);const d=i.seen.get(n);d.ref=o.innerType,s.readOnly=!0},V0=(n,i,s,r)=>{const o=n._zod.def;Sn(o.innerType,i,r);const d=i.seen.get(n);d.ref=o.innerType},Sz=P("ZodISODateTime",(n,i)=>{zx.init(n,i),Ot.init(n,i)});fu)DELIM" -R"DELIM(nction xz(n){return Ow(Sz,n)}const wz=P("ZodISODate",(n,i)=>{Ex.init(n,i),Ot.init(n,i)});function zz(n){return Mw(wz,n)}const Ez=P("ZodISOTime",(n,i)=>{Tx.init(n,i),Ot.init(n,i)});function Tz(n){return jw(Ez,n)}const Az=P("ZodISODuration",(n,i)=>{Ax.init(n,i),Ot.init(n,i)});function Nz(n){return kw(Az,n)}const Oz=(n,i)=>{E0.init(n,i),n.name="ZodError",Object.defineProperties(n,{format:{value:s=>pS(n,s)},flatten:{value:s=>mS(n,s)},addIssue:{value:s=>{n.issues.push(s),n.message=JSON.stringify(n.issues,uh,2)}},addIssues:{value:s=>{n.issues.push(...s),n.message=JSON.stringify(n.issues,uh,2)}},isEmpty:{get(){return n.issues.length===0}}})},Mi=P("ZodError",Oz,{Parent:Error}),Mz=Vh(Mi),jz=Gh(Mi),kz=Dc(Mi),Rz=Uc(Mi),Cz=yS(Mi),Dz=bS(Mi),Uz=_S(Mi),Zz=SS(Mi),$z=xS(Mi),Lz=wS(Mi),Hz=zS(Mi),qz=ES(Mi),Iv=new WeakMap;function $u(n,i,s){const r=Object.getPrototypeOf(n);let o=Iv.get(r);if(o||(o=new Set,Iv.set(r,o)),!o.has(i)){o.add(i);for(const d in s){const f=s[d];Object.defineProperty(r,d,{configurable:!0,enumerable:!1,get(){const m=f.bind(this);return Object.defineProperty(this,d,{configurable:!0,writable:!0,enumerable:!0,value:m}),m},set(m){Object.defineProperty(this,d,{configurable:!0,writable:!0,enumerable:!0,value:m})}})}}}const Zt=P("ZodType",(n,i)=>(Ut.init(n,i),Object.assign(n["~standard"],{jsonSchema:{input:zc(n,"input"),output:zc(n,"output")}}),n.toJSONSchema=Ww(n,{}),n.def=i,n.type=i.type,Object.defineProperty(n,"_def",{value:i}),n.parse=(s,r)=>Mz(n,s,r,{callee:n.parse}),n.safeParse=(s,r)=>kz(n,s,r),n.parseAsync=async(s,r)=>jz(n,s,r,{callee:n.parseAsync}),n.safeParseAsync=async(s,r)=>Rz(n,s,r),n.spa=n.safeParseAsync,n.encode=(s,r)=>Cz(n,s,r),n.decode=(s,r)=>Dz(n,s,r),n.encodeAsync=async(s,r)=>Uz(n,s,r),n.decodeAsync=async(s,r)=>Zz(n,s,r),n.safeEncode=(s,r)=>$z(n,s,r),n.safeDecode=(s,r)=>Lz(n,s,r),n.safeEncodeAsync=async(s,r)=>Hz(n,s,r),n.safeDecodeAsync=async(s,r)=>qz(n,s,r),$u(n,"ZodType",{check(...s){const r=this.def;return this.clone(Nl(r,{checks:[...r.checks??[],...s.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...s){return this.check(...s)},clone(s,r){return Ol(this,s,r)},brand(){return this},register(s,r){return s.add(this,r),this},refine(s,r){return this.check(R2(s,r))},superRefine(s,r){return this.check(C2(s,r))},overwrite(s){return this.check(yr(s))},optional(){return ty(this)},exactOptional(){return _2(this)},nullable(){return ny(this)},nullish(){return ty(ny(this))},nonoptional(s){return T2(this,s)},array(){return Qh(this)},or(s){return Kh([this,s])},and(s){return p2(this,s)},transform(s){return iy(this,y2(s))},default(s){return w2(this,s)},prefault(s){return E2(this,s)},catch(s){return N2(this,s)},pipe(s){return iy(this,s)},readonly(){return j2(this)},describe(s){const r=this.clone();return Tu.add(r,{description:s}),r},meta(...s){if(s.length===0)return Tu.get(this);const r=this.clone();return Tu.add(r,s[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(s){return s(this)}}),Object.defineProperty(n,"description",{get(){return Tu.get(n)?.description},configurable:!0}),n)),G0=P("_ZodString",(n,i)=>{Yh.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,o,d)=>tz(n,r,o);const s=n._zod.bag;n.format=s.format??null,n.minLength=s.minimum??null,n.maxLength=s.maximum??null,$u(n,"_ZodString",{regex(...r){return this.check($w(...r))},includes(...r){return this.check(qw(...r))},startsWith(...r){return this.check(Bw(...r))},endsWith(...r){return this.check(Vw(...r))},min(...r){return this.check(wc(...r))},max(...r){return this.check($0(...r))},length(...r){return this.check(L0(...r))},nonempty(...r){return this.check(wc(1,...r))},lowercase(r){return this.check(Lw(r))},uppercase(r){return this.check(Hw(r))},trim(){return this.check(Yw())},normalize(...r){return this.check(Gw(...r))},toLowerCase(){return this.check(Qw())},toUpperCase(){return this.check(Kw())},slugify(){return this.check(Jw())}})}),Bz=P("ZodString",(n,i)=>{Yh.init(n,i),G0.init(n,i),n.email=s=>n.check(uw(Vz,s)),n.url=s=>n.check(hw(Gz,s)),n.jwt=s=>n.check(Nw(l2,s)),n.emoji=s=>n.check(mw(Yz,s)),n.guid=s=>n.check(Kv(Pv,s)),n.uuid=s=>n.check(ow(fc,s)),n.uuidv4=s=>n.check(cw(fc,s)),n.uuidv6=s=>n.check(fw(fc,s)),n.uuidv7=s=>n.check(dw(fc,s)),n.nanoid=s=>n.check(pw(Qz,s)),n.guid=s=>n.check(Kv(Pv,s)),n.cuid=s=>n.check(gw(Kz,s)),n.cuid2=s=>n.check(vw(Jz,s)),n.ulid=s=>n.check(yw(Fz,s)),n.base64=s=>n.check(Ew(n2,s)),n.base64url=s=>n.check(Tw(i2,s)),n.xid=s=>n.check(bw(Xz,s)),n.ksuid=s=>n.check(_w(Iz,s)),n.ipv4=s=>n.check(Sw(Pz,s)),n.ipv6=s=>n.check(xw(Wz,s)),n.cidrv4=s=>n.check(ww(e2,s)),n.cidrv6=s=>n.check(zw(t2,s)),n.e164=s=>n.check(Aw(a2,s)),n.datetime=s=>n.check(xz(s)),n.date=s=>n.check(zz(s)),n.time=s=>n.check(Tz(s)),n.duration=s=>n.check(Nz(s))});function us(n){return rw(Bz,n)}const Ot=P("ZodStringFormat",(n,i)=>{Tt.init(n,i),G0.init(n,i)}),Vz=P("ZodEmail",(n,i)=>{px.init(n,i),Ot.init(n,i)}),Pv=P("ZodGUID",(n,i)=>{hx.init(n,i),Ot.init(n,i)}),fc=P("ZodUUID",(n,i)=>{mx.init(n,i),Ot.init(n,i)}),Gz=P("ZodURL",(n,i)=>{gx.init(n,i),Ot.init(n,i)}),Yz=P("ZodEmoji",(n,i)=>{vx.init(n,i),Ot.init(n,i)}),Qz=P("ZodNanoID",(n,i)=>{yx.init(n,i),Ot.init(n,i)}),Kz=P("ZodCUID",(n,i)=>{bx.init(n,i),Ot.init(n,i)}),Jz=P("ZodCUID2",(n,i)=>{_x.init(n,i),Ot.init(n,i)}),Fz=P("ZodULID",(n,i)=>{Sx.init(n,i),Ot.init(n,i)}),Xz=P("ZodXID",(n,i)=>{xx.init(n,i),Ot.init(n,i)}),Iz=P("ZodKSUID",(n,i)=>{wx.init(n,i),Ot.init(n,i)}),Pz=P("ZodIPv4",(n,i)=>{Nx.init(n,i),Ot.init(n,i)}),Wz=P("ZodIPv6",(n,i)=>{Ox.init(n,i),Ot.init(n,i)}),e2=P("ZodCIDRv4",(n,i)=>{Mx.init(n,i),Ot.init(n,i)}),t2=P("ZodCIDRv6",(n,i)=>{jx.init(n,i),Ot.init(n,i)}),n2=P("ZodBase64",(n,i)=>{kx.init(n,i),Ot.init(n,i)}),i2=P("ZodBase64URL",(n,i)=>{Cx.init(n,i),Ot.init(n,i)}),a2=P("ZodE164",(n,i)=>{Dx.init(n,i),Ot.init(n,i)}),l2=P("ZodJWT",(n,i)=>{Zx.init(n,i),Ot.init(n,i)}),Y0=P("ZodNumber",(n,i)=>{C0.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,o,d)=>nz(n,r,o),$u(n,"ZodNumber",{gt(r,o){return this.check(Fv(r,o))},gte(r,o){return this.check(Xd(r,o))},min(r,o){return this.check(Xd(r,o))},lt(r,o){return this.check(Jv(r,o))},lte(r,o){return this.check(Fd(r,o))},max(r,o){return this.check(Fd(r,o))},int(r){return this.check(Wv(r))},safe(r){return this.check(Wv(r))},positive(r){return this.check(Fv(0,r))},nonnegative(r){return this.check(Xd(0,r))},negative(r){return this.check(Jv(0,r))},nonpositive(r){return this.check(Fd(0,r))},multipleOf(r,o){return this.check(Xv(r,o))},step(r,o){return this.check(Xv(r,o))},finite(){return this}});const s=n._zod.bag;n.minValue=Math.max(s.minimum??Number.NEGATIVE_INFINITY,s.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(s.maximum??Number.POSITIVE_INFINITY,s.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(s.format??"").includes("int")||Number.isSafeInteger(s.multipleOf??.5),n.isFinite=!0,n.format=s.format??null});function ra(n){return Rw(Y0,n)}const s2=P("ZodNumberFormat",(n,i)=>{$x.init(n,i),Y0.init(n,i)});function Wv(n){return Cw(s2,n)}const r2=P("ZodBoolean",(n,i)=>{Lx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>iz(n,s,r)});function nr(n){return Dw(r2,n)}const u2=P("ZodUnknown",(n,i)=>{Hx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>lz()});function ey(){return Uw(u2)}const o2=P("ZodNever",(n,i)=>{qx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>az(n,s,r)});function c2(n){return Zw(o2,n)}const f2=P("ZodArray",(n,i)=>{Bx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>cz(n,s,r,o),n.element=i.element,$u(n,"ZodArray",{min(s,r){return this.check(wc(s,r))},nonempty(s){return this.check(wc(1,s))},max(s,r){return this.check($0(s,r))},length(s,r){return this.check(L0(s,r))},unwrap(){return this.element}})});function Qh(n,i){return Fw(f2,n,i)}const d2=P("ZodObject",(n,i)=>{Gx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>fz(n,s,r,o),ht(n,"shape",()=>i.shape),$u(n,"ZodObject",{keyof(){return Jh(Object.keys(this._zod.def.shape))},catch)DELIM" -R"DELIM(all(s){return this.clone({...this._zod.def,catchall:s})},passthrough(){return this.clone({...this._zod.def,catchall:ey()})},loose(){return this.clone({...this._zod.def,catchall:ey()})},strict(){return this.clone({...this._zod.def,catchall:c2()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(s){return uS(this,s)},safeExtend(s){return oS(this,s)},merge(s){return cS(this,s)},pick(s){return sS(this,s)},omit(s){return rS(this,s)},partial(...s){return fS(Q0,this,s[0])},required(...s){return dS(K0,this,s[0])}})});function Ml(n,i){const s={type:"object",shape:n??{},...Ae(i)};return new d2(s)}const h2=P("ZodUnion",(n,i)=>{Yx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>dz(n,s,r,o),n.options=i.options});function Kh(n,i){return new h2({type:"union",options:n,...Ae(i)})}const m2=P("ZodIntersection",(n,i)=>{Qx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>hz(n,s,r,o)});function p2(n,i){return new m2({type:"intersection",left:n,right:i})}const ch=P("ZodEnum",(n,i)=>{Kx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,o,d)=>sz(n,r,o),n.enum=i.entries,n.options=Object.values(i.entries);const s=new Set(Object.keys(i.entries));n.extract=(r,o)=>{const d={};for(const f of r)if(s.has(f))d[f]=i.entries[f];else throw new Error(`Key ${f} not found in enum`);return new ch({...i,checks:[],...Ae(o),entries:d})},n.exclude=(r,o)=>{const d={...i.entries};for(const f of r)if(s.has(f))delete d[f];else throw new Error(`Key ${f} not found in enum`);return new ch({...i,checks:[],...Ae(o),entries:d})}});function Jh(n,i){const s=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new ch({type:"enum",entries:s,...Ae(i)})}const g2=P("ZodLiteral",(n,i)=>{Jx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>rz(n,s,r),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 yc(n,i){return new g2({type:"literal",values:Array.isArray(n)?n:[n],...Ae(i)})}const v2=P("ZodTransform",(n,i)=>{Fx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>oz(n,s),n._zod.parse=(s,r)=>{if(r.direction==="backward")throw new b0(n.constructor.name);s.addIssue=d=>{if(typeof d=="string")s.issues.push(Cu(d,s.value,i));else{const f=d;f.fatal&&(f.continue=!1),f.code??(f.code="custom"),f.input??(f.input=s.value),f.inst??(f.inst=n),s.issues.push(Cu(f))}};const o=i.transform(s.value,s);return o instanceof Promise?o.then(d=>(s.value=d,s.fallback=!0,s)):(s.value=o,s.fallback=!0,s)}});function y2(n){return new v2({type:"transform",transform:n})}const Q0=P("ZodOptional",(n,i)=>{Z0.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>V0(n,s,r,o),n.unwrap=()=>n._zod.def.innerType});function ty(n){return new Q0({type:"optional",innerType:n})}const b2=P("ZodExactOptional",(n,i)=>{Xx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>V0(n,s,r,o),n.unwrap=()=>n._zod.def.innerType});function _2(n){return new b2({type:"optional",innerType:n})}const S2=P("ZodNullable",(n,i)=>{Ix.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>mz(n,s,r,o),n.unwrap=()=>n._zod.def.innerType});function ny(n){return new S2({type:"nullable",innerType:n})}const x2=P("ZodDefault",(n,i)=>{Px.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>gz(n,s,r,o),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function w2(n,i){return new x2({type:"default",innerType:n,get defaultValue(){return typeof i=="function"?i():x0(i)}})}const z2=P("ZodPrefault",(n,i)=>{Wx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>vz(n,s,r,o),n.unwrap=()=>n._zod.def.innerType});function E2(n,i){return new z2({type:"prefault",innerType:n,get defaultValue(){return typeof i=="function"?i():x0(i)}})}const K0=P("ZodNonOptional",(n,i)=>{ew.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>pz(n,s,r,o),n.unwrap=()=>n._zod.def.innerType});function T2(n,i){return new K0({type:"nonoptional",innerType:n,...Ae(i)})}const A2=P("ZodCatch",(n,i)=>{tw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>yz(n,s,r,o),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function N2(n,i){return new A2({type:"catch",innerType:n,catchValue:typeof i=="function"?i:()=>i})}const O2=P("ZodPipe",(n,i)=>{nw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>bz(n,s,r,o),n.in=i.in,n.out=i.out});function iy(n,i){return new O2({type:"pipe",in:n,out:i})}const M2=P("ZodReadonly",(n,i)=>{iw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>_z(n,s,r,o),n.unwrap=()=>n._zod.def.innerType});function j2(n){return new M2({type:"readonly",innerType:n})}const k2=P("ZodCustom",(n,i)=>{aw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(s,r,o)=>uz(n,s)});function R2(n,i={}){return Xw(k2,n,i)}function C2(n,i){return Iw(n,i)}const Lu=[{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"}],Ec=[{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:"count"},{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:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],D2=Ml({level:ra().int().nonnegative(),time:ra().int().nonnegative(),message:us()}),U2=Ml({event:ra().int().nonnegative(),value:ra().nonn)DELIM" -R"DELIM(egative(),time:ra().int().nonnegative()}),Z2=Ml({previous:ra().nonnegative()});Kh([D2,U2,Z2]);const Fh=2**Lu.length-1,or=Fh,$2=2**0+2**1+2**2+2**6+2**7;function L2(n,i){return Number.isInteger(i)&&i>=0&&i0?`${String(s)}d ${String(r)}h`:r>0?`${String(r)}h ${String(o)}m`:o>0?`${String(o)}m ${String(d)}s`:`${String(d)}s`}function F0(n,i){switch(Hu(n).valueKind){case"height":return`height ${Hn(i)}`;case"seconds":return`${cr(i)} s`;case"milliseconds":return`${cr(i)} ms`;case"microseconds":return`${cr(i)} µs`;case"count":return Hn(i);default:return String(i)}}function Q2(n){return n>=100?`${cr(n,0)}/s`:n>=10?`${cr(n,1)}/s`:`${cr(n,2)}/s`}function K2(n){try{const i=new URL(n),s=i.pathname==="/"?"":i.pathname.replace(/\/$/u,"");return`${i.host}${s}`}catch{return n}}const Tc=32,J2=[{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"}],F2={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 X2({metrics:n,paused:i,onPausedChange:s,onClear:r}){const[o,d]=se.useState(""),[f,m]=se.useState("all"),[g,v]=se.useState({offset:0,search:o,category:f}),w=g.search===o&&g.category===f?g.offset:0,S=se.useRef(null),z=se.useSyncExternalStore(n.subscribeEvents,n.getEventWindow,n.getEventWindow);return se.useEffect(()=>{n.setEventQuery({search:o,category:f,offset:w})},[n,o,f,w]),se.useEffect(()=>{S.current&&(S.current.scrollTop=0)},[o,f]),_.jsxs("section",{className:"space-y-4",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Node lifecycle"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Live events"}),_.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"Heights are event payloads; timing values retain their source units."}),_.jsx("p",{className:"text-textMuted mt-1 text-xs",children:"Pause freezes this view; collection and charts continue."})]}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{i&&(S.current&&(S.current.scrollTop=0),v({offset:0,search:o,category:f})),s(!i)},className:"border-accent/35 text-accent hover:bg-accent/10 rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:i?"Resume display":"Pause display"}),_.jsx("button",{type:"button",onClick:r,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Clear"})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 flex flex-wrap gap-3 rounded-xl border p-4",children:[_.jsxs("label",{className:"min-w-56 flex-1",children:[_.jsx("span",{className:"sr-only",children:"Search events"}),_.jsx("input",{type:"search",value:o,onChange:T=>{d(T.target.value)},placeholder:"Search event names or values…",className:"border-accent/25 bg-background/70 text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{children:[_.jsx("span",{className:"sr-only",children:"Filter event category"}),_.jsx("select",{value:f,onChange:T=>{m(T.target.value)},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent rounded-lg border px-3 py-2 text-sm focus:ring-0",children:J2.map(T=>_.jsx("option",{value:T.value,children:T.label},T.value))})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 overflow-hidden rounded-xl border",children:[_.jsxs("div",{className:"border-accent/15 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[_.jsx("span",{children:i?"Display paused · collection continues":"Live stream · newest first"}),_.jsxs("span",{children:[String(z.matched)," matching · ",String(z.retained)," retained"]})]}),_.jsx("div",{ref:S,role:"region","aria-label":"Scrollable event history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:T=>{v({offset:Math.max(0,Math.floor(T.currentTarget.scrollTop/Tc)-8),search:o,category:f})},children:z.matched===0?_.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching events."}):_.jsx("ol",{"aria-label":"Received events",className:"relative min-w-[32rem]",style:{height:z.matched*Tc},children:z.events.map((T,j)=>_.jsx(I2,{event:T,index:z.offset+j,total:z.matched},T.id))})})]}),_.jsxs("details",{className:"border-accent/20 bg-surface/50 rounded-xl border",children:[_.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-4 py-3 text-sm",children:["Event contract (",String(Ec.length)," identifiers)"]}),_.jsx("div",{className:"grid gap-2 border-t border-white/5 p-4 sm:grid-cols-2 lg:grid-cols-3",children:Ec.map(T=>_.jsxs("div",{className:"text-xs",children:[_.jsx("span",{className:"text-textMuted font-mono",children:String(T.id).padStart(2,"0")}),_.jsx("span",{className:"text-textPrimary ml-2",children:T.name})]},T.id))})]})]})}const I2=se.memo(function({event:i,index:s,total:r}){const o=Hu(i.event);return _.jsxs("li",{"aria-setsize":r,"aria-posinset":s+1,className:"absolute inset-x-0 grid grid-cols-[8.5rem_10rem_minmax(0,1fr)] items-center gap-2 border-b border-white/5 px-4 text-xs",style:{top:s*Tc,height:Tc},children:[_.jsx("time",{dateTime:new Date(i.time).toISOString(),className:"text-textMuted font-mono tabular-nums",children:Mu(i.time)}),_.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${F2[o.category]}`,children:o.name}),_.jsx("span",{className:"text-textPrimary font-mono tabular-nums",children:F0(i.event,i.value)})]})}),Ac=32,ay={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 P2({metrics:n,delivery:i,status:s,logFilter:r,paused:o,onLogFilterChange:d,onPausedChange:f,onClear:m}){const[g,v]=se.useState(""),[w,S]=se.useState({offset:0,search:g,filter:r}),z=w.search===g&&w.filter===r?w.offset:0,[T,j]=se.useState(null),C=se.useRef(null),Q=se.useSyncExternalStore(n.subscribeLogs,n.getLogWindow,n.getLogWindow);return se.useEffect(()=>{n.setLogQuery({search:g,filter:r,offset:z})},[n,g,r,z]),se.useEffect(()=>{C.current&&(C.current.scrollTop=0)},[g,r]))DELIM" -R"DELIM(,_.jsxs("section",{className:"space-y-4",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Diagnostic stream"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Node logs"}),_.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"The newest 1,000 messages are retained in this browser session."})]}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{o&&(C.current&&(C.current.scrollTop=0),S({offset:0,search:g,filter:r})),f(!o)},className:"border-accent/35 text-accent hover:bg-accent/10 rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:o?"Resume display":"Pause display"}),_.jsx("button",{type:"button",onClick:m,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Clear"})]})]}),_.jsxs("fieldset",{className:"border-accent/20 bg-surface/70 space-y-3 rounded-xl border p-4",children:[_.jsx("legend",{className:"text-textPrimary px-1 text-sm font-medium",children:"Requested log levels"}),_.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."}),_.jsx("div",{className:"flex flex-wrap gap-x-5 gap-y-3",children:Lu.map(B=>_.jsxs("label",{className:"text-textPrimary flex items-center gap-2 text-sm",children:[_.jsx("input",{type:"checkbox",checked:L2(r,B.id),onChange:()=>{d(r^1<{d($2)},className:"text-accent hover:underline",children:"Operational levels"}),_.jsx("button",{type:"button",onClick:()=>{d(Fh)},className:"text-accent hover:underline",children:"All levels"}),_.jsx("button",{type:"button",onClick:()=>{d(0)},className:"text-accent hover:underline",children:"No levels"}),_.jsx("span",{className:"text-textMuted",children:"Selection is saved in this browser."})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 space-y-2 rounded-xl border p-4 text-xs",children:[_.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",s.reconnects]].map(([B,Y])=>_.jsxs("div",{children:[_.jsx("dt",{className:"text-textMuted",children:B}),_.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:Y.toLocaleString()})]},B))}),_.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."}),_.jsxs("p",{className:"text-textMuted",role:"status",children:["Admin connection: ",s.phase,s.error?` · ${s.error}`:""]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 flex flex-wrap gap-3 rounded-xl border p-4",children:[_.jsxs("label",{className:"min-w-56 flex-1",children:[_.jsx("span",{className:"sr-only",children:"Search logs"}),_.jsx("input",{type:"search",value:g,onChange:B=>{v(B.target.value)},placeholder:"Search received messages…",className:"border-accent/25 bg-background/70 text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsx("p",{className:"text-textMuted self-center text-xs",children:"Search filters received messages only."})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 overflow-hidden rounded-xl border",children:[_.jsxs("div",{className:"border-accent/15 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[_.jsx("span",{children:o?"Display paused · collection continues":r===0?"Log delivery disabled":z>0?"Viewing older rows · collection continues":"Live stream · newest first"}),_.jsxs("span",{children:[String(Q.matched)," matching · ",String(Q.retained)," retained"]})]}),_.jsx("div",{ref:C,role:"region","aria-label":"Scrollable log history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:B=>{S({offset:Math.max(0,Math.floor(B.currentTarget.scrollTop/Ac)-8),search:g,filter:r})},children:Q.matched===0?_.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching log messages."}):_.jsx("ol",{"aria-label":"Received logs",className:"relative",style:{height:Q.matched*Ac},children:Q.logs.map((B,Y)=>_.jsx(W2,{log:B,index:Q.offset+Y,total:Q.matched,onSelect:j},B.id))})})]}),_.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[_.jsx("p",{className:"text-textMuted",children:"Select a row to read its full message."}),!o&&_.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{C.current&&(C.current.scrollTop=0),S({offset:0,search:g,filter:r})},children:"Jump to latest"})]}),T&&_.jsx(eE,{log:T,onClose:()=>{j(null)}})]})}const W2=se.memo(function({log:i,index:s,total:r,onSelect:o}){return _.jsx("li",{"aria-setsize":r,"aria-posinset":s+1,className:"absolute inset-x-0 border-b border-white/5",style:{top:s*Ac,height:Ac},children:_.jsxs("button",{type:"button",onClick:()=>{o(i)},className:"grid h-full w-full grid-cols-[5.5rem_4.5rem_minmax(0,1fr)] items-center gap-2 px-4 text-left text-xs hover:bg-white/5 focus-visible:bg-white/10 sm:grid-cols-[7.5rem_7.5rem_minmax(0,1fr)]",children:[_.jsx("time",{dateTime:new Date(i.time).toISOString(),className:"text-textMuted font-mono tabular-nums",children:Mu(i.time,!1)}),_.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${ay[i.level]??ay[8]}`,children:J0(i.level).name}),_.jsx("span",{className:"text-textPrimary min-w-0 truncate font-mono",children:i.message.replaceAll(` -`," ↵ ")})]})})});function eE({log:n,onClose:i}){const s=se.useRef(null);return se.useEffect(()=>{const r=s.current;return r?.showModal(),()=>{r?.close()}},[]),_.jsxs("dialog",{ref:s,onClose:i,"aria-labelledby":"log-detail-title",className:"border-accent/30 bg-surface text-textPrimary fixed inset-0 m-auto max-h-[80vh] w-[min(60rem,90vw)] rounded-xl border p-5 shadow-xl backdrop:bg-black/70",children:[_.jsxs("header",{className:"mb-4 flex items-center justify-between gap-4",children:[_.jsxs("h3",{id:"log-detail-title",className:"font-semibold",children:[J0(n.level).label," · ",new Date(n.time).toISOString()]}),_.jsx("button",{type:"button",onClick:i,className:"text-accent rounded px-3 py-2",children:"Close"})]}),_.jsx("pre",{className:"text-sm break-words whitespace-pre-wrap",children:n.message})]})}const Id=["line","area","bar"],ly=["line","step","area"],tE=["line","step","area"],X0={"occurrence-count":{id:"occurrence-count",label:"Occurrences per bucket",description:"Number of frames observed in each one-second bucket.",unit:"occurrences",chartTypes:Id},"occurrence-rate":{id:"occurrence-rate",label:"Occurrence rate",description:"Frames observed per second.",unit:"occurrences-per-second",chartTypes:Id},"cumulative-occurrences":{id:"cumulative-occurrences",label:"Cumulative occurrences",description:"Running number of frames observed during this browser session.",unit:"occurrences",chartTypes:ly},"payload-latest":{id:"payload-latest",label:"Latest value",description:"Most recently observed payload value.",unit:"count",chartTypes:tE},"payload-average":{id:"payload-average",label:"Average value",description:"Average payload value within each on)DELIM" -R"DELIM(e-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:ly},"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:Id}},br=["occurrence-rate","occurrence-count","cumulative-occurrences"],nE=["payload-latest","payload-maximum","payload-change-rate",...br],iE=["payload-average","payload-latest","payload-minimum","payload-maximum",...br],aE=["payload-sum","payload-cumulative","payload-latest","payload-average",...br];function Oi(n){return`event:${String(n)}`}function wl(n){return`log:${String(n)}`}const Nc="native:top";function lE(n){switch(n){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";default:return"unknown"}}function sE(n){switch(n){case"height":return nE;case"duration":return iE;case"count":return aE;default:return br}}function rE(n){switch(n){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function I0(n){const i=Hu(n),s=lE(i.valueKind);return{id:Oi(n),source:"event",sourceId:n,name:i.name,label:i.label,category:i.category,payloadKind:s,allowedMeasures:sE(s),defaultMeasure:rE(s),description:s==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${i.label} event with a ${s} payload.`}}const uE=[...Ec.map(n=>I0(n.id)),...Lu.map(n=>({id:wl(n.id),source:"log",sourceId:n.id,name:n.name,label:`${n.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:br,defaultMeasure:"occurrence-rate",description:`${n.label} log message volume. Message text is not interpreted as numeric data.`})),{id:Nc,source:"native",sourceId:"top",name:"canonical_top",label:"Canonical 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."}],Xh=uE,oE=new Map(Xh.map(n=>[n.id,n]));function $a(n){const i=oE.get(n);if(i)return i;const s=/^event:(\d+)$/u.exec(n);return s?I0(Number(s[1])):{id:n,source:"event",sourceId:-1,name:n,label:n,category:"unknown",payloadKind:"unknown",allowedMeasures:br,defaultMeasure:"occurrence-rate",description:"Unknown signal; only occurrence measurements are available."}}function El(n,i){const s=X0[i];if(i.startsWith("occurrence")||i==="cumulative-occurrences")return s;const r=i==="payload-change-rate"?"height-per-second":n.payloadKind==="height"?"height":n.payloadKind==="duration"?"milliseconds":"count";return{...s,unit:r}}function cE(n,i){return n.allowedMeasures.includes(i)}function fE(n,i){return V2(n,i)??i}const dE=3600*1e3,hE=1e3,mE=1e3,pE=1e3;class sy{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 s=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),s}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 s=0;sthis.#M;getRecentLogs=()=>this.#i.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=i=>(this.#n.add(i),()=>{this.#n.delete(i)});start(){this.#S||(this.tick(),this.#S=setInterval(()=>{this.tick()},1e3))}stop(){this.#S&&(clearInterval(this.#S),this.#S=null),this.#_&&(clearTimeout(this.#_),this.#_=null)}ingest(i,s=this.#e()){const r=this.#O(s);this.#f+=1,H2(i)?this.#D(i,r):q2(i)?this.#N(i,r):B2(i)&&(this.#E+=1),this.#k()}recordInvalidFrame(){this.#z+=1,this.#k()}recordNativeTop(i,s=this.#e()){const r=this.#O(s),o=this.#c[Nc];o?.value===i&&r-o.time<15e3||(this.#C(Nc,r,i),this.#v(r),this.#k())}clearLogs(){this.#g+=this.#i.size,this.#i.clear(),this.flush()}clearEvents(){this.#s.clear(),this.flush()}reset(){this.#i.clear(),this.#s.clear(),this.#a.clear(),this.#r={},this.#l={},this.#o={},this.#u={},this.#m={},this.#c={},this.#d={},this.#h=this.#O(this.#e()),this.#f=0,this.#y=0,this.#x=0,this.#g=0,this.#w=0,this.#E=0,this.#z=0,this.#b=null,this.#T=null,this.#A=0,this.#j(this.#h),this.flush()}tick(){const i=this.#O(this.#e());this.#j(i),this.#v(i),this.#k()}flush(){this.#_&&(clearTimeout(this.#_),this.#_=null),this.#M=this.#R();for(const i of this.#n)i()}#D(i,s){this.#y+=1,this.#b=s,this.#A+=1,this.#i.push({...i,id:this.#A,receivedAt:s})&&(this.#x+=1),this.#C(wl(i.level),s,null)}#N(i,s){this.#w+=1,this.#T=s,this.#A+=1,this.#s.push({...i,id:this.#A,receivedAt:s}),this.#C(Oi(i.event),s,fE(i.event,i.value))}#O(i){return Number.isFinite(i)?(this.#p=Math.max(this.#p,i),this.#p):this.#p}#C(i,s,r){const o=this.#j(s);o.snapshot=null;const d=o.signals.get(i)??gE();if(d.count+=1,dc(this.#u,i,1),r!==null){d.samples+=1,d.sum+=r,d.minimum=d.minimum===null?r:Math.min(d.minimum,r),d.maximum=d.maximum===null?r:Math.max(d.maximum,r),(d.firstAt===null||s=d.lastAt)&&(d.last=r,d.lastAt=s),dc(this.#m,i,r);const f=this.#c[i];(!f||s>=f.time)&&(this.#c[i]={value:r,time:s}),this.#d[i]=Math.max(this.#d[i]??r,r)}o.signals.set(i,d)}#j(i){const s=Math.floor(i/1e3)*1e3,r=this.#a.get(s);if(r)return r;const o={time:s,signals:new Map,snapshot:null};return this.#a.set(s,o),o}#v(i){const s=i-dE;for(const[r,o]of this.#a){if(r>=s)break;for(const[d,f]of o.signals)if(dc(this.#r,d,f.count),dc(this.#l,d,f.sum),f.last!==null&&f.lastAt!==null){const m=this.#o[d];(!m||f.lastAt>=m.time)&&(this.#o[d]={value:f.last,time:f.lastAt})}this.#a.delete(r)}}#k(){!this.#t||this.#_||(this.#_=setTimeout(()=>{this.#_=null,this.flush()},hE))}#R(){const i=[...this.#a.values()].map(s=>(s.snapshot??={time:s.time,signals:Object.fromEntries([...s.signals].map(([r,o])=>[r,{...o}]))},s.snapshot));return{now:this.#O(this.#e()),sessionStartedAt:this.#h,totalFrames:this.#f,totalLogs:this.#y,evictedLogs:this.#x,clearedLogs:this.#g,totalEvents:this.#w,totalAcks:this.#E,invalidFrames:this.#z,buckets:i,priorSignalCounts:{...this.#r},priorSignalSums:{...this.#l},priorSignalLatest:ry(this.#o),signalTotals:{...this.#u},signalSums:{...this.#m},signalLatest:ry(this.#c),signalMaximums:{...this.#d},recentLogs:this.#i.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#b,lastEventAt:this.#T}}}function vE(n,i,s,r,o=n[0]?.time??s){const d=s-r*1e3,f=d<=o,m=f?Math.floor(o/1e3)*1e3:Math.ceil(d/1e3)*1e3,g=f?o:m,v=Math.floor(s/1e3)*1e3,S=n.filter(T=>T.time>=m&&T.time<=v).reduce((T,j)=>T+(j.signals[i]?.count??0),0),z=Math.max(0,(s-g)/1e3);return z>0?S/z:0}function yE(n,i){const s=f=>vE(n.buckets,Oi(f),n.)DELIM" -R"DELIM(now,i,n.sessionStartedAt),r=s(2)+s(14);if(r>0)return{label:"Reorganizing",rate:r};const d=[{label:"Confirming blocks",rate:s(6)},{label:"Validating blocks",rate:s(5)},{label:"Archiving blocks",rate:s(3)},{label:"Synchronizing headers",rate:Math.max(s(0),s(1))}].reduce((f,m)=>m.rate>f.rate?m:f);return d.rate>0?d:{label:"Idle",rate:0}}const $c=18,bE=600*1e3;function _E(n,i,s){if(n===null||!Number.isSafeInteger(n)||n<0||i===null||!Number.isSafeInteger(i.height)||i.height<0||i.height>n||!Number.isFinite(i.timestamp)||i.timestamp<=0||!Number.isFinite(s)||s<0)return null;const r=Math.max(0,s-i.timestamp*1e3),o=Math.max(n,i.height+Math.ceil(r/bE));return{blocksRemaining:o-n,estimatedTop:o,progress:o===0?100:n/o*100}}const SE={idle:"border-slate-500/40 bg-slate-500/10 text-slate-300",connecting:"border-amber-500/40 bg-amber-500/10 text-amber-300",connected:"border-emerald-500/40 bg-emerald-500/10 text-emerald-300",reconnecting:"border-orange-500/40 bg-orange-500/10 text-orange-300"};function xE({phase:n,label:i}){return _.jsxs("span",{className:`inline-flex items-center gap-2 rounded-full border px-3 py-1 text-xs tracking-wide uppercase ${SE[n]}`,children:[_.jsx("span",{className:"h-2 w-2 rounded-full bg-current","aria-hidden":"true"}),i]})}function hc({label:n,value:i,detail:s,numeric:r=!0,emphasized:o=!1}){return _.jsxs("div",{className:"min-w-0 border-white/10 px-4 py-3 even:border-l lg:border-l lg:first:border-l-0 [&:nth-child(n+3)]:border-t lg:[&:nth-child(n+3)]:border-t-0",children:[_.jsx("dt",{className:"text-textMuted text-xs",children:n}),_.jsx("dd",{className:`mt-1 leading-7 font-medium break-words ${r?"font-mono text-xl tracking-tight tabular-nums":"text-base"} ${o?"text-accent":"text-textPrimary"}`,children:i}),_.jsx("dd",{className:"text-textMuted mt-0.5 text-xs leading-4 break-words",children:s})]})}function wE({confirmed:n,estimate:i}){if(n===null||i===null||i.blocksRemaining<=$c)return null;const s=Math.min(99.99,Math.max(0,i.progress)),r=`${s.toFixed(2)}%`;return _.jsxs("section",{className:"border-accent/25 bg-surface/70 overflow-hidden rounded-xl border","aria-labelledby":"node-sync-progress-title",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-3 px-5 pt-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Node synchronization"}),_.jsx("h2",{id:"node-sync-progress-title",className:"mt-1 font-semibold",children:"Catching up to estimated chain tip"})]}),_.jsx("p",{className:"text-accent font-mono text-xl font-semibold tabular-nums",children:r})]}),_.jsx("div",{className:"px-5 pt-4",children:_.jsx("div",{role:"progressbar","aria-label":"Node synchronization progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Number(s.toFixed(2)),"aria-valuetext":`Approximately ${Hn(i.blocksRemaining)} blocks remaining`,className:"bg-background h-3 overflow-hidden rounded-full border border-white/5",children:_.jsx("div",{className:"bg-accent h-full rounded-full transition-[width] duration-700",style:{width:`${String(s)}%`}})})}),_.jsxs("dl",{className:"mt-5 grid gap-px bg-white/5 text-sm sm:grid-cols-3",children:[_.jsx(Pd,{label:"Confirmed top",value:Hn(n)}),_.jsx(Pd,{label:"Estimated chain tip",value:Hn(i.estimatedTop)}),_.jsx(Pd,{label:"Estimated blocks remaining",value:Hn(i.blocksRemaining)})]}),_.jsx("p",{className:"bg-surface text-textMuted border-t border-white/5 px-5 py-2 text-[11px]",children:"Estimated from the confirmed block timestamp and your browser clock, assuming one block every 10 minutes. Actual block counts may differ."})]})}function Pd({label:n,value:i}){return _.jsxs("div",{className:"bg-surface px-5 py-3",children:[_.jsx("dt",{className:"text-textMuted text-xs",children:n}),_.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:i})]})}const lr=16,fh=8,Ih=80,zE=[300,900,3600],dh=["line","step","area","bar"],bn=["#ffa022","#38bdf8","#34d399","#c084fc","#fb7185","#e879f9","#facc15","#60a5fa"],EE=Jh(["occurrence-count","occurrence-rate","cumulative-occurrences","payload-latest","payload-average","payload-minimum","payload-maximum","payload-sum","payload-cumulative","payload-change-rate"]),TE=Ml({id:us().min(1).max(100),signalId:us().min(1).max(100),measure:EE,color:us().regex(/^#[\da-f]{6}$/iu),label:us().max(80).optional()}).strict(),P0=Ml({id:us().min(1).max(100),title:us().trim().min(1).max(Ih),visualization:Jh(dh),range:Kh([yc(300),yc(900),yc(3600)]),series:Qh(TE).min(1).max(fh)}).strict(),AE=Ml({version:yc(1),charts:Qh(P0).max(lr)}).strict(),W0={id:"default-sync-pipeline",title:"Sync pipeline",visualization:"line",range:900,series:[hi("sync-header",Oi(0),"occurrence-rate",bn[3]),hi("sync-archive",Oi(3),"occurrence-rate",bn[0]),hi("sync-validate",Oi(5),"occurrence-rate",bn[1]),hi("sync-confirm",Oi(6),"occurrence-rate",bn[2])]},NE={id:"default-chain-progress",title:"Chain progress",visualization:"step",range:900,series:[hi("progress-top",Nc,"payload-latest",bn[0]),hi("progress-organized",Oi(13),"payload-latest",bn[2]),hi("progress-confirmed",Oi(6),"payload-latest",bn[1])]},OE={id:"default-log-volume",title:"Log volume",visualization:"bar",range:900,series:[hi("logs-news",wl(1),"occurrence-rate",bn[2]),hi("logs-session",wl(2),"occurrence-rate",bn[3]),hi("logs-protocol",wl(3),"occurrence-rate",bn[1]),hi("logs-remote",wl(5),"occurrence-rate",bn[7]),hi("logs-fault",wl(6),"occurrence-rate",bn[4]),hi("logs-quitting",wl(7),"occurrence-rate",bn[0])]},Ph=[{id:"sync-pipeline",label:"Sync pipeline",description:"Header and block lifecycle throughput.",chart:W0},{id:"chain-progress",label:"Chain progress",description:"Canonical, organized, and confirmed heights.",chart:NE},{id:"log-volume",label:"Log volume",description:"Message rates grouped by log level.",chart:OE}],eb="libbitcoinAdminDashboardCharts";let oy=0;function hi(n,i,s,r){return{id:n,signalId:i,measure:s,color:r}}function Oc(n){return oy+=1,`${n}-${Date.now().toString(36)}-${String(oy)}`}function Wh(n,i=!1){return{...n,id:i?Oc("chart"):n.id,series:n.series.map(s=>({...s,id:i?Oc("series"):s.id}))}}function bc(){return Ph.map(n=>Wh(n.chart))}function ME(n){const i=Ph.find(s=>s.id===n);return Wh(i?.chart??W0,!0)}function tb(){return{id:Oc("chart"),title:"Custom chart",visualization:"line",range:900,series:[{id:Oc("series"),signalId:Oi(3),measure:"occurrence-rate",color:bn[0]}]}}function jE(n){const i=" copy",s=`${n.title.slice(0,Ih-i.length).trimEnd()}${i}`;return{...Wh(n,!0),title:s}}function hh(n){const i=new Set(n.series.map(s=>El($a(s.signalId),s.measure).unit));return i.size===1?[...i][0]??null:null}function nb(n){const i=P0.safeParse(n);if(!i.success)return i.error.issues[0]?.message??"Invalid chart configuration";for(const s of n.series){const r=$a(s.signalId);if(!cE(r,s.measure))return`${X0[s.measure].label} is not valid for ${r.label}.`;const o=El(r,s.measure);if(!o.chartTypes.includes(n.visualization))return`${o.label} cannot be displayed as a ${n.visualization} chart.`}return hh(n)===null?"All series on a chart must use compatible units.":null}function ib(n){const i=AE.safeParse(n);return!i.success||new Set(i.data.charts.map(s=>s.id)).size!==i.data.charts.length||i.data.charts.some(s=>new Set(s.series.map(r=>r.id)).size!==s.series.length)?null:i.data.charts.every(s=>nb(s)===null)?i.data.charts:null}function ab(){try{return globalThis.window?.localStorage??null}catch{return null}}function kE(n=ab()){try{const i=n?.getItem(eb);return i?ib(JSON.parse(i))??bc():bc()}catch{return bc()}}function RE(n,i=ab()){try{const s={version:1,charts:n};if(!ib(s))return;i?.setItem(eb,JSON.stringify(s))}catch{}}function em(n,i){return n.signals[i]}function cy(n,i,s,r){let o=r==="count"?n.priorSignalCounts[i]??0:n.priorSignalSums[i]??0;for(const d of n.buckets){if(d.time>=s)break;const f=em(d,i);o+=r==="count"?f?.count??0:f?.sum??0}return o}function CE(n,i,s){let r=n.priorSignalLatest[i]??null;for(const o of n.buckets){if(o.time>=s)break;const d=em(o,i);d?.last!==n)DELIM" -R"DELIM(ull&&d?.last!==void 0&&d.lastAt!==null&&(r={value:d.last,time:d.lastAt})}return r}function DE(n,i){const s=i<=n.sessionStartedAt?Math.floor(n.sessionStartedAt/1e3)*1e3:Math.ceil(i/1e3)*1e3,r=Math.floor(n.now/1e3)*1e3,o=new Map(n.buckets.map(f=>[f.time,f])),d=[];for(let f=s;f<=r;f+=1e3)d.push(o.get(f)??{time:f,signals:{}});return d}function UE(n,i,s){const r=Math.max(n.time,s),o=Math.min(i,n.time+1e3);return Math.max(0,(o-r)/1e3)}function ZE(n,i,s,r){const o=$a(r.signalId);let d=r.measure==="cumulative-occurrences"?cy(n,r.signalId,s,"count"):r.measure==="payload-cumulative"?cy(n,r.signalId,s,"sum"):0,f=CE(n,r.signalId,s);return i.map(m=>{const g=em(m,r.signalId);switch(r.measure){case"occurrence-count":return g?.count??0;case"occurrence-rate":{const v=UE(m,n.now,n.sessionStartedAt);return v>0?(g?.count??0)/v:0}case"cumulative-occurrences":return d+=g?.count??0,d;case"payload-sum":return g&&g.samples>0?g.sum:null;case"payload-cumulative":return d+=g?.sum??0,d;case"payload-average":return g&&g.samples>0?g.sum/g.samples:null;case"payload-minimum":return g?.minimum??null;case"payload-maximum":return g?.maximum??null;case"payload-latest":return g?.last!==null&&g?.last!==void 0&&g.lastAt!==null?(f={value:g.last,time:g.lastAt},g.last):o.payloadKind==="height"?f?.value??null:null;case"payload-change-rate":{if(g?.last===null||g?.last===void 0||g.lastAt===null)return null;const v=f??(g.first!==null&&g.firstAt!==null?{value:g.first,time:g.firstAt}:null);if(f={value:g.last,time:g.lastAt},!v)return null;const w=(g.lastAt-v.time)/1e3;return w>0?(g.last-v.value)/w:null}}})}function $E(n,i){const s=n.now-i.range*1e3,r=DE(n,s),o=r[0]?.time??Math.floor(n.now/1e3)*1e3,d=i.series[0],f=El($a(d.signalId),d.measure).unit,m=i.series.filter(g=>(n.signalTotals[g.signalId]??0)===0).map(g=>g.label??$a(g.signalId).label);return{data:[r.map(g=>g.time/1e3),...i.series.map(g=>ZE(n,r,o,g))],unit:f,hasObservedData:m.length({...i}))}}function GE(){const n=new Map;for(const i of Xh){const s=n.get(i.category)??[];s.push(i),n.set(i.category,s)}return[...n]}const YE=GE();function QE({chart:n,mode:i,onCancel:s,onSave:r}){const[o,d]=se.useState(()=>VE(n)),f=nb(o),m=hh(o);se.useEffect(()=>{function T(j){j.key==="Escape"&&s()}return globalThis.addEventListener("keydown",T),()=>{globalThis.removeEventListener("keydown",T)}},[s]);const g=se.useMemo(()=>new Set(dh.filter(T=>o.series.every(j=>El($a(j.signalId),j.measure).chartTypes.includes(T)))),[o.series]);function v(T,j){d(C=>({...C,series:C.series.map((Q,B)=>B===T?j:Q)}))}function w(T,j){const C=o.series[T],Q=$a(j);v(T,{...C,signalId:j,measure:Q.defaultMeasure})}function S(){if(o.series.length>=fh)return;const T=hh(o),j=Xh.find(B=>B.allowedMeasures.some(Y=>T===null||El(B,Y).unit===T));if(!j)return;const C=j.allowedMeasures.find(B=>T===null||El(j,B).unit===T)??j.defaultMeasure,Q={id:`series-${Date.now().toString(36)}-${String(o.series.length+1)}`,signalId:j.id,measure:C,color:bn[o.series.length%bn.length]??bn[0]};d(B=>({...B,series:[...B.series,Q]}))}function z(T){T.preventDefault(),!f&&r({...o,title:o.title.trim()})}return _.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/75 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:T=>{T.target===T.currentTarget&&s()},children:_.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"chart-editor-title",className:"border-accent/30 bg-surface max-h-[92vh] w-full max-w-4xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/60",children:[_.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Dashboard builder"}),_.jsx("h2",{id:"chart-editor-title",className:"mt-1 text-xl font-semibold",children:i==="add"?"Add chart":"Edit chart"})]}),_.jsx("button",{type:"button",onClick:s,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close chart editor",children:"×"})]}),i==="add"&&_.jsxs("div",{className:"border-accent/15 border-b p-5",children:[_.jsx("p",{className:"text-textMuted mb-3 text-xs font-medium tracking-wide uppercase",children:"Start from a template"}),_.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-5",children:[Ph.map(T=>_.jsxs("button",{type:"button",onClick:()=>{d(ME(T.id))},className:"border-accent/20 bg-background/50 hover:border-accent/60 rounded-lg border p-3 text-left",children:[_.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:T.label}),_.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:T.description})]},T.id)),_.jsxs("button",{type:"button",onClick:()=>{d(tb())},className:"border-accent/20 bg-background/50 hover:border-accent/60 rounded-lg border p-3 text-left",children:[_.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:"Custom"}),_.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:"Begin with one editable series."})]})]})]}),_.jsxs("form",{onSubmit:z,className:"space-y-6 p-5",children:[_.jsxs("div",{className:"grid gap-4 md:grid-cols-[minmax(0,1fr)_11rem_11rem]",children:[_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Chart title"}),_.jsx("input",{value:o.title,maxLength:Ih,onChange:T=>{d(j=>({...j,title:T.target.value}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Chart type"}),_.jsx("select",{value:o.visualization,onChange:T=>{d(j=>({...j,visualization:T.target.value}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0",children:dh.map(T=>_.jsx("option",{value:T,disabled:!g.has(T),children:BE[T]},T))})]}),_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Time range"}),_.jsx("select",{value:o.range,onChange:T=>{d(j=>({...j,range:Number(T.target.value)}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0",children:zE.map(T=>_.jsx("option",{value:T,children:qE[T]},T))})]})]}),_.jsxs("section",{className:"space-y-3",children:[_.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[_.jsxs("div",{children:[_.jsx("h3",{className:"font-semibold",children:"Series"}),_.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:["One chart uses one axis unit",m===null?".":`: ${lb(m)}.`]})]}),_.jsx("button",{type:"button",onClick:S,disabled:o.series.length>=fh,className:"border-accent/35 text-accent hover:bg-accent/10 disabled:text-textMuted rounded-lg border px-3 py-2 text-xs font-medium uppercase disabled:cursor-not-allowed disabled:opacity-50",children:"Add series"})]}),_.jsx("div",{className:"space-y-3",children:o.series.map((T,j)=>{const C=$a(T.signalId),Q=El(C,T.measure);return _.jsxs("article",{className:"border-accent/15 bg-background/35 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]",ch)DELIM" -R"DELIM(ildren:[_.jsxs("label",{className:"space-y-1.5",children:[_.jsxs("span",{className:"text-textMuted text-xs",children:["Signal ",String(j+1)]}),_.jsx("select",{"aria-label":`Signal ${String(j+1)}`,value:T.signalId,onChange:B=>{w(j,B.target.value)},className:"border-accent/25 bg-surface text-textPrimary focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0",children:YE.map(([B,Y])=>_.jsx("optgroup",{label:B,children:Y.map(J=>_.jsx("option",{value:J.id,children:J.label},J.id))},B))})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Measurement"}),_.jsx("select",{"aria-label":`Measurement ${String(j+1)}`,value:T.measure,onChange:B=>{v(j,{...T,measure:B.target.value})},className:"border-accent/25 bg-surface text-textPrimary focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0",title:Q.description,children:C.allowedMeasures.map(B=>_.jsx("option",{value:B,children:El(C,B).label},B))})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Display label"}),_.jsx("input",{"aria-label":`Display label ${String(j+1)}`,value:T.label??"",onChange:B=>{v(j,{...T,label:B.target.value||void 0})},placeholder:C.label,className:"border-accent/25 bg-surface text-textPrimary placeholder:text-textMuted/50 focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Color"}),_.jsx("input",{"aria-label":`Series color ${String(j+1)}`,type:"color",value:T.color,onChange:B=>{v(j,{...T,color:B.target.value})},className:"border-accent/25 bg-surface h-10 w-full rounded-lg border p-1"})]}),_.jsx("button",{type:"button",onClick:()=>{d(B=>({...B,series:B.series.filter((Y,J)=>J!==j)}))},disabled:o.series.length===1,"aria-label":`Remove series ${String(j+1)}`,className:"text-textMuted self-end rounded-lg px-3 py-2 text-sm hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-30",children:"Remove"})]},T.id)})})]}),f&&_.jsx("p",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-200",children:f}),_.jsxs("div",{className:"flex justify-end gap-2 border-t border-white/5 pt-4",children:[_.jsx("button",{type:"button",onClick:s,className:"text-textMuted hover:text-textPrimary rounded-lg px-4 py-2 text-sm",children:"Cancel"}),_.jsx("button",{type:"submit",disabled:f!==null,className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold disabled:cursor-not-allowed disabled:opacity-40",children:i==="add"?"Add chart":"Save changes"})]})]})]})})}const KE=!0,tn="u-",JE="uplot",FE=tn+"hz",XE=tn+"vt",IE=tn+"title",PE=tn+"wrap",WE=tn+"under",eT=tn+"over",tT=tn+"axis",rs=tn+"off",nT=tn+"select",iT=tn+"cursor-x",aT=tn+"cursor-y",lT=tn+"cursor-pt",sT=tn+"legend",rT=tn+"live",uT=tn+"inline",oT=tn+"series",cT=tn+"marker",fy=tn+"label",fT=tn+"value",Au="width",Nu="height",wu="top",dy="bottom",ir="left",Wd="right",tm="#000",hy=tm+"0",eh="mousemove",my="mousedown",th="mouseup",py="mouseenter",gy="mouseleave",vy="dblclick",dT="resize",hT="scroll",yy="change",Mc="dppxchange",nm="--",_r=typeof window<"u",mh=_r?document:null,fr=_r?window:null,mT=_r?navigator:null;let Pe,mc;function ph(){let n=devicePixelRatio;Pe!=n&&(Pe=n,mc&&vh(yy,mc,ph),mc=matchMedia(`(min-resolution: ${Pe-.001}dppx) and (max-resolution: ${Pe+.001}dppx)`),cs(yy,mc,ph),fr.dispatchEvent(new CustomEvent(Mc)))}function fi(n,i){if(i!=null){let s=n.classList;!s.contains(i)&&s.add(i)}}function gh(n,i){let s=n.classList;s.contains(i)&&s.remove(i)}function wt(n,i,s){n.style[i]=s+"px"}function Bi(n,i,s,r){let o=mh.createElement(n);return i!=null&&fi(o,i),s?.insertBefore(o,r),o}function Ai(n,i){return Bi("div",n,i)}const by=new WeakMap;function sa(n,i,s,r,o){let d="translate("+i+"px,"+s+"px)",f=by.get(n);d!=f&&(n.style.transform=d,by.set(n,d),i<0||s<0||i>r||s>o?fi(n,rs):gh(n,rs))}const _y=new WeakMap;function Sy(n,i,s){let r=i+s,o=_y.get(n);r!=o&&(_y.set(n,r),n.style.background=i,n.style.borderColor=s)}const xy=new WeakMap;function wy(n,i,s,r){let o=i+""+s,d=xy.get(n);o!=d&&(xy.set(n,o),n.style.height=s+"px",n.style.width=i+"px",n.style.marginLeft=r?-i/2+"px":0,n.style.marginTop=r?-s/2+"px":0)}const im={passive:!0},pT={...im,capture:!0};function cs(n,i,s,r){i.addEventListener(n,s,r?pT:im)}function vh(n,i,s,r){i.removeEventListener(n,s,im)}_r&&ph();function Vi(n,i,s,r){let o;s=s||0,r=r||i.length-1;let d=r<=2147483647;for(;r-s>1;)o=d?s+r>>1:mi((s+r)/2),i[o]{let d=-1,f=-1;for(let m=r;m<=o;m++)if(n(s[m])){d=m;break}for(let m=o;m>=r;m--)if(n(s[m])){f=m;break}return[d,f]}}const rb=n=>n!=null,ub=n=>n!=null&&n>0,Lc=sb(rb),gT=sb(ub);function vT(n,i,s,r=0,o=!1){let d=o?gT:Lc,f=o?ub:rb;[i,s]=d(n,i,s);let m=n[i],g=n[i];if(i>-1)if(r==1)m=n[i],g=n[s];else if(r==-1)m=n[s],g=n[i];else for(let v=i;v<=s;v++){let w=n[v];f(w)&&(wg&&(g=w))}return[m??gt,g??-gt]}function Hc(n,i,s,r){let o=Ty(n),d=Ty(i);n==i&&(o==-1?(n*=s,i/=s):(n/=s,i*=s));let f=s==10?La:ob,m=o==1?mi:Ni,g=d==1?Ni:mi,v=m(f(en(n))),w=g(f(en(i))),S=hr(s,v),z=hr(s,w);return s==10&&(v<0&&(S=vt(S,-v)),w<0&&(z=vt(z,-w))),r||s==2?(n=S*o,i=z*d):(n=hb(n,S),i=qc(i,z)),[n,i]}function am(n,i,s,r){let o=Hc(n,i,s,r);return n==0&&(o[0]=0),i==0&&(o[1]=0),o}const lm=.1,zy={mode:3,pad:lm},ju={pad:0,soft:null,mode:0},yT={min:ju,max:ju};function jc(n,i,s,r){return Bc(s)?Ey(n,i,s):(ju.pad=s,ju.soft=r?0:null,ju.mode=r?3:0,Ey(n,i,yT))}function Fe(n,i){return n??i}function bT(n,i,s){for(i=Fe(i,0),s=Fe(s,n.length-1);i<=s;){if(n[i]!=null)return!0;i++}return!1}function Ey(n,i,s){let r=s.min,o=s.max,d=Fe(r.pad,0),f=Fe(o.pad,0),m=Fe(r.hard,-gt),g=Fe(o.hard,gt),v=Fe(r.soft,gt),w=Fe(o.soft,-gt),S=Fe(r.mode,0),z=Fe(o.mode,0),T=i-n,j=La(T),C=qn(en(n),en(i)),Q=La(C),B=en(Q-j);(T<1e-24||B>10)&&(T=0,(n==0||i==0)&&(T=1e-24,S==2&&v!=gt&&(d=0),z==2&&w!=-gt&&(f=0)));let Y=T||C||1e3,J=La(Y),q=hr(10,mi(J)),ee=Y*(T==0?n==0?.1:1:d),ne=vt(hb(n-ee,q/10),24),F=n>=v&&(S==1||S==3&&ne<=v||S==2&&ne>=v)?v:gt,ue=qn(m,ne=F?F:Gi(F,ne)),Ne=Y*(T==0?i==0?.1:1:f),we=vt(qc(i+Ne,q/10),24),ie=i<=w&&(z==1||z==3&&we>=w||z==2&&we<=w)?w:-gt,be=Gi(g,we>ie&&i<=ie?ie:qn(ie,we));return ue==be&&ue==0&&(be=100),[ue,be]}const _T=new Intl.NumberFormat(_r?mT.language:"en-US"),sm=n=>_T.format(n),pi=Math,_c=pi.PI,en=pi.abs,mi=pi.floor,Wt=pi.round,Ni=pi.ceil,Gi=pi.min,qn=pi.max,hr=pi.pow,Ty=pi.sign,La=pi.log10,ob=pi.log2,ST=(n,i=1)=>pi.sinh(n)*i,nh=(n,i=1)=>pi.asinh(n/i),gt=1/0;function Ay(n){return(La((n^n>>31)-(n>>31))|0)+1}function yh(n,i,s){return Gi(qn(n,i),s)}function cb(n){return typeof n=="function"}function Be(n){return cb(n)?n:()=>n}const xT=()=>{},fb=n=>n,db=(n,i)=>i,wT=n=>null,Ny=n=>!0,Oy=(n,i)=>n==i,zT=/\.\d*?(?=9{6,}|0{6,})/gm,hs=n=>{if(pb(n)||Al.has(n))return n;const i=`${n}`,s=i.match(zT);if(s==null)return n;let r=s[0].length-1;if(i.indexOf("e-")!=-1){let[o,d]=i.split("e");return+`${hs(o)}e${d}`}return vt(n,r)};function ls(n,i){return hs(vt(hs(n/i))*i)}function qc(n,i){return hs(Ni(hs(n/i))*i)}function hb(n,i){return hs(mi(hs(n/i))*i)}function vt(n,i=0){if(pb(n))return n;let s=10**i,r=n*s*(1+Number.EPSILON);return Wt(r)/s}const Al=new Map;function mb(n){return((""+n).split(".")[1]||"").length}function Du(n,i,s,r){let o=[],d=r.map(mb);for(let f=i;f=0?0:m)+(f>=d[v]?0:d[v]),z=n==10?w:vt(w,S);o.push(z),Al.set(z,S)}}return o}const ku={},rm=[],mr=[null,null],zl=Array.isArray,pb=Number.isInteger,ET=n=>n===void 0;function My(n){return typeof n=="string"}function Bc(n){let i=!1;if(n!=null){let s=n.constructor;i=s==null||s==Object}return i}function TT(n){return n!=null&&typeof n=="object"}const AT=Object.getPrototypeOf(Uint8Array),gb="__proto__";function pr(n,i=Bc){let s;if(zl(n)){let r=n.find(o=>o!=null);if(zl(r)||i(r)){s=A)DELIM" -R"DELIM(rray(n.length);for(let o=0;od){for(o=f-1;o>=0&&n[o]==null;)n[o--]=null;for(o=f+1;of-m)],o=r[0].length,d=new Map;for(let f=0;f"u"?n=>Promise.resolve().then(n):queueMicrotask;function CT(n){let i=n[0],s=i.length,r=Array(s);for(let d=0;di[d]-i[f]);let o=[];for(let d=0;d=r&&n[o]==null;)o--;if(o<=r)return!0;const d=qn(1,mi((o-r+1)/i));for(let f=n[r],m=r+d;m<=o;m+=d){const g=n[m];if(g!=null){if(g<=f)return!1;f=g}}return!0}const vb=["January","February","March","April","May","June","July","August","September","October","November","December"],yb=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function bb(n){return n.slice(0,3)}const ZT=yb.map(bb),$T=vb.map(bb),LT={MMMM:vb,MMM:$T,WWWW:yb,WWW:ZT};function zu(n){return(n<10?"0":"")+n}function HT(n){return(n<10?"00":n<100?"0":"")+n}const qT={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=>zu(n.getMonth()+1),M:n=>n.getMonth()+1,DD:n=>zu(n.getDate()),D:n=>n.getDate(),WWWW:(n,i)=>i.WWWW[n.getDay()],WWW:(n,i)=>i.WWW[n.getDay()],HH:n=>zu(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=>zu(n.getMinutes()),m:n=>n.getMinutes(),ss:n=>zu(n.getSeconds()),s:n=>n.getSeconds(),fff:n=>HT(n.getMilliseconds())};function um(n,i){i=i||LT;let s=[],r=/\{([a-z]+)\}|[^{]+/gi,o;for(;o=r.exec(n);)s.push(o[0][0]=="{"?qT[o[1]]:o[0]);return d=>{let f="";for(let m=0;mn%1==0,kc=[1,2,2.5,5],GT=Du(10,-32,0,kc),Sb=Du(10,0,32,kc),YT=Sb.filter(_b),ss=GT.concat(Sb),om=` -`,xb="{YYYY}",jy=om+xb,wb="{M}/{D}",Ou=om+wb,pc=Ou+"/{YY}",zb="{aa}",QT="{h}:{mm}",sr=QT+zb,ky=om+sr,Ry=":{ss}",tt=null;function Eb(n){let i=n*1e3,s=i*60,r=s*60,o=r*24,d=o*30,f=o*365,g=(n==1?Du(10,0,3,kc).filter(_b):Du(10,-3,0,kc)).concat([i,i*5,i*10,i*15,i*30,s,s*5,s*10,s*15,s*30,r,r*2,r*3,r*4,r*6,r*8,r*12,o,o*2,o*3,o*4,o*5,o*6,o*7,o*8,o*9,o*10,o*15,d,d*2,d*3,d*4,d*6,f,f*2,f*5,f*10,f*25,f*50,f*100]);const v=[[f,xb,tt,tt,tt,tt,tt,tt,1],[o*28,"{MMM}",jy,tt,tt,tt,tt,tt,1],[o,wb,jy,tt,tt,tt,tt,tt,1],[r,"{h}"+zb,pc,tt,Ou,tt,tt,tt,1],[s,sr,pc,tt,Ou,tt,tt,tt,1],[i,Ry,pc+" "+sr,tt,Ou+" "+sr,tt,ky,tt,1],[n,Ry+".{fff}",pc+" "+sr,tt,Ou+" "+sr,tt,ky,tt,1]];function w(S){return(z,T,j,C,Q,B)=>{let Y=[],J=Q>=f,q=Q>=d&&Q=o?o:Q,we=mi(j)-mi(ne),ie=ue+we+qc(ne-ue,Ne);Y.push(ie);let be=S(ie),ce=be.getHours()+be.getMinutes()/s+be.getSeconds()/r,ze=Q/r,he=z.axes[T]._space,U=B/he;for(;ie=vt(ie+Q,n==1?0:3),!(ie>C);)if(ze>1){let G=mi(vt(ce+ze,6))%24,_e=S(ie).getHours()-G;_e>1&&(_e=-1),ie-=_e*r,ce=(ce+ze)%24;let N=Y[Y.length-1];vt((ie-N)/Q,3)*U>=.7&&Y.push(ie)}else Y.push(ie)}return Y}}return[g,v,w]}const[KT,JT,FT]=Eb(1),[XT,IT,PT]=Eb(.001);Du(2,-53,53,[1]);function Cy(n,i){return n.map(s=>s.map((r,o)=>o==0||o==8||r==null?r:i(o==1||s[8]==0?r:s[1]+r)))}function Dy(n,i){return(s,r,o,d,f)=>{let m=i.find(j=>f>=j[0])||i[i.length-1],g,v,w,S,z,T;return r.map(j=>{let C=n(j),Q=C.getFullYear(),B=C.getMonth(),Y=C.getDate(),J=C.getHours(),q=C.getMinutes(),ee=C.getSeconds(),ne=Q!=g&&m[2]||B!=v&&m[3]||Y!=w&&m[4]||J!=S&&m[5]||q!=z&&m[6]||ee!=T&&m[7]||m[1];return g=Q,v=B,w=Y,S=J,z=q,T=ee,ne(C)})}}function WT(n,i){let s=um(i);return(r,o,d,f,m)=>o.map(g=>s(n(g)))}function ih(n,i,s){return new Date(n,i,s)}function Uy(n,i){return i(n)}const eA="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function Zy(n,i){return(s,r,o,d)=>d==null?nm:i(n(r))}function tA(n,i){let s=n.series[i];return s.width?s.stroke(n,i):s.points.width?s.points.stroke(n,i):null}function nA(n,i){return n.series[i].fill(n,i)}const iA={show:!0,live:!0,isolate:!1,mount:xT,markers:{show:!0,width:2,stroke:tA,fill:nA,dash:"solid"},idx:null,idxs:null,values:[]};function aA(n,i){let s=n.cursor.points,r=Ai(),o=s.size(n,i);wt(r,Au,o),wt(r,Nu,o);let d=o/-2;wt(r,"marginLeft",d),wt(r,"marginTop",d);let f=s.width(n,i,o);return f&&wt(r,"borderWidth",f),r}function lA(n,i){let s=n.series[i].points;return s._fill||s._stroke}function sA(n,i){let s=n.series[i].points;return s._stroke||s._fill}function rA(n,i){return n.series[i].points.size}const ah=[0,0];function uA(n,i,s){return ah[0]=i,ah[1]=s,ah}function gc(n,i,s,r=!0){return o=>{o.button==0&&(!r||o.target==i)&&s(o)}}function lh(n,i,s,r=!0){return o=>{(!r||o.target==i)&&s(o)}}const oA={show:!0,x:!0,y:!0,lock:!1,move:uA,points:{one:!1,show:aA,size:rA,width:0,stroke:sA,fill:lA},bind:{mousedown:gc,mouseup:gc,click:gc,dblclick:gc,mousemove:lh,mouseleave:lh,mouseenter:lh},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,s,r,o)=>r-o,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Tb={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},cm=Ft({},Tb,{filter:db}),Ab=Ft({},cm,{size:10}),Nb=Ft({},Tb,{show:!1}),fm='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"',Ob="bold "+fm,Mb=1.5,$y={show:!0,scale:"x",stroke:tm,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:Ob,side:2,grid:cm,ticks:Ab,border:Nb,font:fm,lineGap:Mb,rotate:0},cA="Value",fA="Time",Ly={show:!0,scale:"x",auto:!1,sorted:1,min:gt,max:-gt,idxs:[]};function dA(n,i,s,r,o){return i.map(d=>d==null?"":sm(d))}function hA(n,i,s,r,o,d,f){let m=[],g=Al.get(o)||0;s=f?s:vt(qc(s,o),g);for(let v=s;v<=r;v=vt(v+o,g))m.push(Object.is(v,-0)?0:v);return m}function bh(n,i,s,r,o,d,f){const m=[],g=n.scales[n.axes[i].scale].log,v=g==10?La:ob,w=mi(v(s));o=hr(g,w),g==10&&(o=ss[Vi(o,ss)]);let S=s,z=o*g;g==10&&(z=ss[Vi(z,ss)]);do m.push(S),S=S+o,g==10&&!Al.has(S)&&(S=vt(S,Al.get(o))),S>=z&&(o=S,z=o*g,g==10&&(z=ss[Vi(z,ss)]));while(S<=r);return m}function mA(n,i,s,r,o,d,f){let g=n.scales[n.axes[i].scale].asinh,v=r>g)DELIM" -R"DELIM(?bh(n,i,qn(g,s),r,o):[g],w=r>=0&&s<=0?[0]:[];return(s<-g?bh(n,i,qn(g,-r),-s,o):[g]).reverse().map(z=>-z).concat(w,v)}const jb=/./,pA=/[12357]/,gA=/[125]/,Hy=/1/,_h=(n,i,s,r)=>n.map((o,d)=>i==4&&o==0||d%r==0&&s.test(o.toExponential()[o<0?1:0])?o:null);function vA(n,i,s,r,o){let d=n.axes[s],f=d.scale,m=n.scales[f],g=n.valToPos,v=d._space,w=g(10,f),S=g(9,f)-w>=v?jb:g(7,f)-w>=v?pA:g(5,f)-w>=v?gA:Hy;if(S==Hy){let z=en(g(1,f)-w);if(zo,Vy={show:!0,auto:!0,sorted:0,gaps:kb,alpha:1,facets:[Ft({},By,{scale:"x"}),Ft({},By,{scale:"y"})]},Gy={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:kb,alpha:1,points:{show:SA,filter:null},values:null,min:gt,max:-gt,idxs:[],path:null,clip:null};function xA(n,i,s,r,o){return s/10}const Rb={time:KE,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},wA=Ft({},Rb,{time:!1,ori:1}),Yy={};function Cb(n,i){let s=Yy[n];return s||(s={key:n,plots:[],sub(r){s.plots.push(r)},unsub(r){s.plots=s.plots.filter(o=>o!=r)},pub(r,o,d,f,m,g,v){for(let w=0;w{let B=f.pxRound;const Y=v.dir*(v.ori==0?1:-1),J=v.ori==0?Sr:xr;let q,ee;Y==1?(q=s,ee=r):(q=r,ee=s);let ne=B(S(m[q],v,C,T)),F=B(z(g[q],w,Q,j)),ue=B(S(m[ee],v,C,T)),Ne=B(z(d==1?w.max:w.min,w,Q,j)),we=new Path2D(o);return J(we,ue,Ne),J(we,ne,Ne),J(we,ne,F),we})}function Vc(n,i,s,r,o,d){let f=null;if(n.length>0){f=new Path2D;const m=i==0?Qc:mm;let g=s;for(let S=0;Sz[0]){let T=z[0]-g;T>0&&m(f,g,r,T,r+d),g=z[1]}}let v=s+o-g,w=10;v>0&&m(f,g,r-w/2,v,r+d+w)}return f}function EA(n,i,s){let r=n[n.length-1];r&&r[0]==i?r[1]=s:n.push([i,s])}function hm(n,i,s,r,o,d,f){let m=[],g=n.length;for(let v=o==1?s:r;v>=s&&v<=r;v+=o)if(i[v]===null){let S=v,z=v;if(o==1)for(;++v<=r&&i[v]===null;)z=v;else for(;--v>=s&&i[v]===null;)z=v;let T=d(n[S]),j=z==S?T:d(n[z]),C=S-o;T=f<=0&&C>=0&&C=0&&B>=0&&B=T&&m.push([T,j])}return m}function Qy(n){return n==0?fb:n==1?Wt:i=>ls(i,n)}function Db(n){let i=n==0?Gc:Yc,s=n==0?(o,d,f,m,g,v)=>{o.arcTo(d,f,m,g,v)}:(o,d,f,m,g,v)=>{o.arcTo(f,d,g,m,v)},r=n==0?(o,d,f,m,g)=>{o.rect(d,f,m,g)}:(o,d,f,m,g)=>{o.rect(f,d,g,m)};return(o,d,f,m,g,v=0,w=0)=>{v==0&&w==0?r(o,d,f,m,g):(v=Gi(v,m/2,g/2),w=Gi(w,m/2,g/2),i(o,d+v,f),s(o,d+m,f,d+m,f+g,v),s(o,d+m,f+g,d,f+g,w),s(o,d,f+g,d,f,w),s(o,d,f,d+m,f,v),o.closePath())}}const Gc=(n,i,s)=>{n.moveTo(i,s)},Yc=(n,i,s)=>{n.moveTo(s,i)},Sr=(n,i,s)=>{n.lineTo(i,s)},xr=(n,i,s)=>{n.lineTo(s,i)},Qc=Db(0),mm=Db(1),Ub=(n,i,s,r,o,d)=>{n.arc(i,s,r,o,d)},Zb=(n,i,s,r,o,d)=>{n.arc(s,i,r,o,d)},$b=(n,i,s,r,o,d,f)=>{n.bezierCurveTo(i,s,r,o,d,f)},Lb=(n,i,s,r,o,d,f)=>{n.bezierCurveTo(s,i,o,r,f,d)};function Hb(n){return(i,s,r,o,d)=>ps(i,s,(f,m,g,v,w,S,z,T,j,C,Q)=>{let{pxRound:B,points:Y}=f,J,q;v.ori==0?(J=Gc,q=Ub):(J=Yc,q=Zb);const ee=vt(Y.width*Pe,3);let ne=(Y.size-Y.width)/2*Pe,F=vt(ne*2,3),ue=new Path2D,Ne=new Path2D,{left:we,top:ie,width:be,height:ce}=i.bbox;Qc(Ne,we-F,ie-F,be+F*2,ce+F*2);const ze=he=>{if(g[he]!=null){let U=B(S(m[he],v,C,T)),G=B(z(g[he],w,Q,j));J(ue,U+ne,G),q(ue,U,G,ne,0,_c*2)}};if(d)d.forEach(ze);else for(let he=r;he<=o;he++)ze(he);return{stroke:ee>0?ue:null,fill:ue,clip:Ne,flags:gr|Sh}})}function qb(n){return(i,s,r,o,d,f)=>{r!=o&&(d!=r&&f!=r&&n(i,s,r),d!=o&&f!=o&&n(i,s,o),n(i,s,f))}}const TA=qb(Sr),AA=qb(xr);function Bb(n){const i=Fe(n?.alignGaps,0);return(s,r,o,d)=>ps(s,r,(f,m,g,v,w,S,z,T,j,C,Q)=>{[o,d]=Lc(g,o,d);let B=f.pxRound,Y=ce=>B(S(ce,v,C,T)),J=ce=>B(z(ce,w,Q,j)),q,ee;v.ori==0?(q=Sr,ee=TA):(q=xr,ee=AA);const ne=v.dir*(v.ori==0?1:-1),F={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:gr},ue=F.stroke;let Ne=!1;if(d-o>=C*4){let ce=V=>s.posToVal(V,v.key,!0),ze=null,he=null,U,G,pe,Oe=Y(m[ne==1?o:d]),_e=Y(m[o]),N=Y(m[d]),L=ce(ne==1?_e+1:N-1);for(let V=ne==1?o:d;V>=o&&V<=d;V+=ne){let le=m[V],ge=(ne==1?leL)?Oe:Y(le),ve=g[V];ge==Oe?ve!=null?(G=ve,ze==null?(q(ue,ge,J(G)),U=ze=he=G):Ghe&&(he=G)):ve===null&&(Ne=!0):(ze!=null&&ee(ue,Oe,J(ze),J(he),J(U),J(G)),ve!=null?(G=ve,q(ue,ge,J(G)),ze=he=U=G):(ze=he=null,ve===null&&(Ne=!0)),Oe=ge,L=ce(Oe+ne))}ze!=null&&ze!=he&&pe!=Oe&&ee(ue,Oe,J(ze),J(he),J(U),J(G))}else for(let ce=ne==1?o:d;ce>=o&&ce<=d;ce+=ne){let ze=g[ce];ze===null?Ne=!0:ze!=null&&q(ue,Y(m[ce]),J(ze))}let[ie,be]=dm(s,r);if(f.fill!=null||ie!=0){let ce=F.fill=new Path2D(ue),ze=f.fillTo(s,r,f.min,f.max,ie),he=J(ze),U=Y(m[o]),G=Y(m[d]);ne==-1&&([G,U]=[U,G]),q(ce,G,he),q(ce,U,he)}if(!f.spanGaps){let ce=[];Ne&&ce.push(...hm(m,g,o,d,ne,Y,i)),F.gaps=ce=f.gaps(s,r,o,d,ce),F.clip=Vc(ce,v.ori,T,j,C,Q)}return be!=0&&(F.band=be==2?[Ha(s,r,o,d,ue,-1),Ha(s,r,o,d,ue,1)]:Ha(s,r,o,d,ue,be)),F})}function NA(n){const i=Fe(n.align,1),s=Fe(n.ascDesc,!1),r=Fe(n.alignGaps,0),o=Fe(n.extend,!1);return(d,f,m,g)=>ps(d,f,(v,w,S,z,T,j,C,Q,B,Y,J)=>{[m,g]=Lc(S,m,g);let q=v.pxRound,{left:ee,width:ne}=d.bbox,F=_e=>q(j(_e,z,Y,Q)),ue=_e=>q(C(_e,T,J,B)),Ne=z.ori==0?Sr:xr;const we={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:gr},ie=we.stroke,be=z.dir*(z.ori==0?1:-1);let ce=ue(S[be==1?m:g]),ze=F(w[be==1?m:g]),he=ze,U=ze;o&&i==-1&&(U=ee,Ne(ie,U,ce)),Ne(ie,ze,ce);for(let _e=be==1?m:g;_e>=m&&_e<=g;_e+=be){let N=S[_e];if(N==null)continue;let L=F(w[_e]),V=ue(N);i==1?Ne(ie,L,ce):Ne(ie,he,V),Ne(ie,L,V),ce=V,he=L}let G=he;o&&i==1&&(G=ee+ne,Ne(ie,G,ce));let[pe,Oe]=dm(d,f);if(v.fill!=null||pe!=0){let _e=we.fill=new Path2D(ie),N=v.fillTo(d,f,v.min,v.max,pe),L=ue(N);Ne(_e,G,L),Ne(_e,U,L)}if(!v.spanGaps){let _e=[];_e.push(...hm(w,S,m,g,be,F,r));let N=v.width*Pe/2,L=s||i==1?N:-N,V=s||i==-1?-N:N;_e.forEach(le=>{le[0]+=L,le[1]+=V}),we.gaps=_e=v.gaps(d,f,m,g,_e),we.clip=Vc(_e,z.ori,Q,B,Y,J)}return Oe!=0&&(we.band=Oe==2?[Ha(d,f,m,g,ie,-1),Ha(d,f,m,g,ie,1)]:Ha(d,f,m,g,ie,Oe)),we})}function Ky(n,i,s,r,o,d,f=gt){if(n.length>1){let m=null;for(let g=0,v=1/0;g{}),{fill:S,stroke:z}=v;return(T,j,C,Q)=>ps(T,j,(B,Y,J,q,ee,ne,F,ue,Ne,we,ie)=>{let be=B.pxRound,ce=s,ze=r*Pe,he=m*Pe,U=g*Pe,G,pe;q.ori==0?[G,pe]=d(T,j):[pe,G]=d(T,j);const Oe=q.dir*(q.ori==0?1:-1);let _e=q.ori==0?Qc:mm,N=q.ori==0?w:(fe,it,Mt,Ri,ca,ti,fa)=>{w(fe,it,Mt,)DELIM" -R"DELIM(ca,Ri,fa,ti)},L=Fe(T.bands,rm).find(fe=>fe.series[0]==j),V=L!=null?L.dir:0,le=B.fillTo(T,j,B.min,B.max,V),xe=be(F(le,ee,ie,Ne)),ge,ve,mt,Ve=we,nt=be(B.width*Pe),Mn=!1,ei=null,jn=null,xn=null,Yi=null;S!=null&&(nt==0||z!=null)&&(Mn=!0,ei=S.values(T,j,C,Q),jn=new Map,new Set(ei).forEach(fe=>{fe!=null&&jn.set(fe,new Path2D)}),nt>0&&(xn=z.values(T,j,C,Q),Yi=new Map,new Set(xn).forEach(fe=>{fe!=null&&Yi.set(fe,new Path2D)})));let{x0:Qi,size:jl}=v;if(Qi!=null&&jl!=null){ce=1,Y=Qi.values(T,j,C,Q),Qi.unit==2&&(Y=Y.map(Mt=>T.posToVal(ue+Mt*we,q.key,!0)));let fe=jl.values(T,j,C,Q);jl.unit==2?ve=fe[0]*we:ve=ne(fe[0],q,we,ue)-ne(0,q,we,ue),Ve=Ky(Y,J,ne,q,we,ue,Ve),mt=Ve-ve+ze}else Ve=Ky(Y,J,ne,q,we,ue,Ve),mt=Ve*f+ze,ve=Ve-mt;mt<1&&(mt=0),nt>=ve/2&&(nt=0),mt<5&&(be=fb);let kl=mt>0,ji=Ve-mt-(kl?nt:0);ve=be(yh(ji,U,he)),ge=(ce==0?ve/2:ce==Oe?0:ve)-ce*Oe*((ce==0?ze/2:0)+(kl?nt/2:0));const Xt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Ki=Mn?null:new Path2D;let ki=null;if(L!=null)ki=T.data[L.series[1]];else{let{y0:fe,y1:it}=v;fe!=null&&it!=null&&(J=it.values(T,j,C,Q),ki=fe.values(T,j,C,Q))}let oa=G*ve,Ee=pe*ve;for(let fe=Oe==1?C:Q;fe>=C&&fe<=Q;fe+=Oe){let it=J[fe];if(it==null)continue;if(ki!=null){let ut=ki[fe]??0;if(it-ut==0)continue;xe=F(ut,ee,ie,Ne)}let Mt=q.distr!=2||v!=null?Y[fe]:fe,Ri=ne(Mt,q,we,ue),ca=F(Fe(it,le),ee,ie,Ne),ti=be(Ri-ge),fa=be(qn(ca,xe)),kn=be(Gi(ca,xe)),nn=fa-kn;if(it!=null){let ut=it<0?Ee:oa,Vt=it<0?oa:Ee;Mn?(nt>0&&xn[fe]!=null&&_e(Yi.get(xn[fe]),ti,kn+mi(nt/2),ve,qn(0,nn-nt),ut,Vt),ei[fe]!=null&&_e(jn.get(ei[fe]),ti,kn+mi(nt/2),ve,qn(0,nn-nt),ut,Vt)):_e(Ki,ti,kn+mi(nt/2),ve,qn(0,nn-nt),ut,Vt),N(T,j,fe,ti-nt/2,kn,ve+nt,nn)}}return nt>0?Xt.stroke=Mn?Yi:Ki:Mn||(Xt._fill=B.width==0?B._fill:B._stroke??B._fill,Xt.width=0),Xt.fill=Mn?jn:Ki,Xt})}function MA(n,i){const s=Fe(i?.alignGaps,0);return(r,o,d,f)=>ps(r,o,(m,g,v,w,S,z,T,j,C,Q,B)=>{[d,f]=Lc(v,d,f);let Y=m.pxRound,J=G=>Y(z(G,w,Q,j)),q=G=>Y(T(G,S,B,C)),ee,ne,F;w.ori==0?(ee=Gc,F=Sr,ne=$b):(ee=Yc,F=xr,ne=Lb);const ue=w.dir*(w.ori==0?1:-1);let Ne=J(g[ue==1?d:f]),we=Ne,ie=[],be=[];for(let G=ue==1?d:f;G>=d&&G<=f;G+=ue)if(v[G]!=null){let Oe=g[G],_e=J(Oe);ie.push(we=_e),be.push(q(v[G]))}const ce={stroke:n(ie,be,ee,F,ne,Y),fill:null,clip:null,band:null,gaps:null,flags:gr},ze=ce.stroke;let[he,U]=dm(r,o);if(m.fill!=null||he!=0){let G=ce.fill=new Path2D(ze),pe=m.fillTo(r,o,m.min,m.max,he),Oe=q(pe);F(G,we,Oe),F(G,Ne,Oe)}if(!m.spanGaps){let G=[];G.push(...hm(g,v,d,f,ue,J,s)),ce.gaps=G=m.gaps(r,o,d,f,G),ce.clip=Vc(G,w.ori,j,C,Q,B)}return U!=0&&(ce.band=U==2?[Ha(r,o,d,f,ze,-1),Ha(r,o,d,f,ze,1)]:Ha(r,o,d,f,ze,U)),ce})}function jA(n){return MA(kA,n)}function kA(n,i,s,r,o,d){const f=n.length;if(f<2)return null;const m=new Path2D;if(s(m,n[0],i[0]),f==2)r(m,n[1],i[1]);else{let g=Array(f),v=Array(f-1),w=Array(f-1),S=Array(f-1);for(let z=0;z0!=v[z]>0?g[z]=0:(g[z]=3*(S[z-1]+S[z])/((2*S[z]+S[z-1])/v[z-1]+(S[z]+2*S[z-1])/v[z]),isFinite(g[z])||(g[z]=0));g[f-1]=v[f-2];for(let z=0;z{on.pxRatio=Pe}));const RA=Bb(),CA=Hb();function Fy(n,i,s,r){return(r?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map((d,f)=>wh(d,f,i,s))}function DA(n,i){return n.map((s,r)=>r==0?{}:Ft({},i,s))}function wh(n,i,s,r){return Ft({},i==0?s:r,n)}function Vb(n,i,s){return i==null?mr:[i,s]}const UA=Vb;function ZA(n,i,s){return i==null?mr:jc(i,s,lm,!0)}function Gb(n,i,s,r){return i==null?mr:Hc(i,s,n.scales[r].log,!1)}const $A=Gb;function Yb(n,i,s,r){return i==null?mr:am(i,s,n.scales[r].log,!1)}const LA=Yb;function HA(n,i,s,r,o){let d=qn(Ay(n),Ay(i)),f=i-n,m=Vi(o/r*f,s);do{let g=s[m],v=r*g/f;if(v>=o&&d+(g<5?Al.get(g):0)<=17)return[g,v]}while(++m(i=Wt((s=+o)*Pe))+"px"),[n,i,s]}function qA(n){n.show&&[n.font,n.labelFont].forEach(i=>{let s=vt(i[2]*Pe,1);i[0]=i[0].replace(/[0-9.]+px/,s+"px"),i[1]=s})}function on(n,i,s){const r={mode:Fe(n.mode,1)},o=r.mode;function d(p,y,x,E){let O=y.valToPct(p);return E+x*(y.dir==-1?1-O:O)}function f(p,y,x,E){let O=y.valToPct(p);return E+x*(y.dir==-1?O:1-O)}function m(p,y,x,E){return y.ori==0?d(p,y,x,E):f(p,y,x,E)}r.valToPosH=d,r.valToPosV=f;let g=!1;r.status=0;const v=r.root=Ai(JE);if(n.id!=null&&(v.id=n.id),fi(v,n.class),n.title){let p=Ai(IE,v);p.textContent=n.title}const w=Bi("canvas"),S=r.ctx=w.getContext("2d"),z=Ai(PE,v);cs("click",z,p=>{p.target===j&&(We!=Un||at!=Wi)&&Qe.click(r,p)},!0);const T=r.under=Ai(WE,z);z.appendChild(w);const j=r.over=Ai(eT,z);n=pr(n);const C=+Fe(n.pxAlign,1),Q=Qy(C);(n.plugins||[]).forEach(p=>{p.opts&&(n=p.opts(r,n)||n)});const B=n.ms||.001,Y=r.series=o==1?Fy(n.series||[],Ly,Gy,!1):DA(n.series||[null],Vy),J=r.axes=Fy(n.axes||[],$y,qy,!0),q=r.scales={},ee=r.bands=n.bands||[];ee.forEach(p=>{p.fill=Be(p.fill||null),p.dir=Fe(p.dir,-1)});const ne=o==2?Y[1].facets[0].scale:Y[0].scale,F={axes:jr,series:Jc},ue=(n.drawOrder||["axes","series"]).map(p=>F[p]);function Ne(p){const y=p.distr==3?x=>La(x>0?x:p.clamp(r,x,p.min,p.max,p.key)):p.distr==4?x=>nh(x,p.asinh):p.distr==100?x=>p.fwd(x):x=>x;return x=>{let E=y(x),{_min:O,_max:R}=p,X=R-O;return(E-O)/X}}function we(p){let y=q[p];if(y==null){let x=(n.scales||ku)[p]||ku;if(x.from!=null){we(x.from);let E=Ft({},q[x.from],x,{key:p});E.valToPct=Ne(E),q[p]=E}else{y=q[p]=Ft({},p==ne?Rb:wA,x),y.key=p;let E=y.time,O=y.range,R=zl(O);if((p!=ne||o==2&&!E)&&(R&&(O[0]==null||O[1]==null)&&(O={min:O[0]==null?zy:{mode:1,hard:O[0],soft:O[0]},max:O[1]==null?zy:{mode:1,hard:O[1],soft:O[1]}},R=!1),!R&&Bc(O))){let X=O;O=(te,ae,re)=>ae==null?mr:jc(ae,re,X)}y.range=Be(O||(E?UA:p==ne?y.distr==3?$A:y.distr==4?LA:Vb:y.distr==3?Gb:y.distr==4?Yb:ZA)),y.auto=Be(R?!1:y.auto),y.clamp=Be(y.clamp||xA),y._min=y._max=null,y.valToPct=Ne(y)}}}we("x"),we("y"),o==1&&Y.forEach(p=>{we(p.scale)}),J.forEach(p=>{we(p.scale)});for(let p in n.scales)we(p);const ie=q[ne],be=ie.distr;let ce,ze;ie.ori==0?(fi(v,FE),ce=d,ze=f):(fi(v,XE),ce=f,ze=d);const he={};for(let p in q){let y=q[p];(y.min!=null||y.max!=null)&&(he[p]={min:y.min,max:y.max},y.min=y.max=null)}const U=n.tzDate||(p=>new Date(Wt(p/B))),G=n.fmtDate||um,pe=B==1?FT(U):PT(U),Oe=Dy(U,Cy(B==1?JT:IT,G)),_e=Zy(U,Uy(eA,G)),N=[],L=r.legend=Ft({},iA,n.legend),V=r.cursor=Ft({},oA,{drag:{y:o==2}},n.cursor),le=L.show,xe=V.show,ge=L.markers;L.idxs=N,ge.width=Be(ge.width),ge.dash=Be(ge.dash),ge.stroke=Be(ge.stroke),ge.fill=Be(ge.fill);let ve,mt,Ve,nt=[],Mn=[],ei,jn=!1,xn={};if(L.live){const p=Y[1]?Y[1].values:null;jn=p!=null,ei=jn?p(r,1,0):{_:0};for(let y in ei)xn[y]=nm}if(le)if(ve=Bi("table",sT,v),Ve=Bi("tbody",null,ve),L.mount(r,ve),jn){mt=Bi("thead",null,ve,Ve);let p=Bi("tr",null,mt);Bi("th",null,p);for(var Yi in ei)Bi("th",fy,p).textContent=Yi}else fi(ve,uT),L.live&&fi(ve,rT);const Qi={show:!0},jl={show:!1};function kl(p,y){if(y==0&&(jn||!L.live||o==2))return mr;let x=[],E=Bi("tr",oT,Ve,Ve.childNodes[y]);fi(E,p.class),p.show||fi(E,rs);let O=Bi("th",null,E);if(ge.show){let te=Ai(cT,O);if(y>0){let ae=ge.width(r,y);ae&&(te.style.border=ae+"px "+ge.dash(r,y)+" "+ge.stroke(r,y)),te.style.background=ge.fill(r,y)}}let R=Ai(fy,O);p.label instanceof HTMLElement?R.appendChild(p.label):R.textContent=p.label,y>0&&(ge.show||(R.style.color=p.width>0?ge.stroke(r,y):ge.fill(r,y)),Xt("click",O,te=>{if(V._lock)return;ni(te);let ae=Y.indexOf(p);if((te.ctrlKey||te.metaKey)!=L.isolate){let re=Y.some((oe,de)=>de>0&&de!=ae&&oe.show);Y.forEach((oe,de)=>{de>0&&Zn(de,re?de==ae?Qi:jl:Qi,!0,kt.setSeries)})}else Zn(ae,{show:!p.show},!0,kt.setSeries)},!1),ma&&Xt(py,O,te=>{V._lock||(ni(te),Zn(Y.indexOf(p),Pa,!0,kt.setSeries))},!1));for(var X in ei){let te=Bi("td",fT,E);te.textContent="--",x.push(te)}return[E,x]}const ji=new Map;function Xt(p,y,x,E=!0){)DELIM" -R"DELIM(const O=ji.get(y)||{},R=V.bind[p](r,y,x,E);R&&(cs(p,y,O[p]=R),ji.set(y,O))}function Ki(p,y,x){const E=ji.get(y)||{};for(let O in E)(p==null||O==p)&&(vh(O,y,E[O]),delete E[O]);p==null&&ji.delete(y)}let ki=0,oa=0,Ee=0,fe=0,it=0,Mt=0,Ri=it,ca=Mt,ti=Ee,fa=fe,kn=0,nn=0,ut=0,Vt=0;r.bbox={};let cn=!1,gs=!1,qa=!1,da=!1,ha=!1,fn=!1;function Ba(p,y,x){(x||p!=r.width||y!=r.height)&&Ji(p,y),Qa(!1),qa=!0,gs=!0,Pi()}function Ji(p,y){r.width=ki=Ee=p,r.height=oa=fe=y,it=Mt=0,Bu(),wr();let x=r.bbox;kn=x.left=ls(it*Pe,.5),nn=x.top=ls(Mt*Pe,.5),ut=x.width=ls(Ee*Pe,.5),Vt=x.height=ls(fe*Pe,.5)}const vs=3;function Rl(){let p=!1,y=0;for(;!p;){y++;let x=Qu(y),E=Ku(y);p=y==vs||x&&E,p||(Ji(r.width,r.height),gs=!0)}}function Kc({width:p,height:y}){Ba(p,y)}r.setSize=Kc;function Bu(){let p=!1,y=!1,x=!1,E=!1;J.forEach((O,R)=>{if(O.show&&O._show){let{side:X,_size:te}=O,ae=X%2,re=O.label!=null?O.labelSize:0,oe=te+re;oe>0&&(ae?(Ee-=oe,X==3?(it+=oe,E=!0):x=!0):(fe-=oe,X==0?(Mt+=oe,p=!0):y=!0))}}),Bn[0]=p,Bn[1]=x,Bn[2]=y,Bn[3]=E,Ee-=Di[1]+Di[3],it+=Di[3],fe-=Di[2]+Di[0],Mt+=Di[0]}function wr(){let p=it+Ee,y=Mt+fe,x=it,E=Mt;function O(R,X){switch(R){case 1:return p+=X,p-X;case 2:return y+=X,y-X;case 3:return x-=X,x+X;case 0:return E-=X,E+X}}J.forEach((R,X)=>{if(R.show&&R._show){let te=R.side;R._pos=O(te,R._size),R.label!=null&&(R._lpos=O(te,R.labelSize))}})}if(V.dataIdx==null){let p=V.hover,y=p.skip=new Set(p.skip??[]);y.add(void 0);let x=p.prox=Be(p.prox),E=p.bias??=0;V.dataIdx=(O,R,X,te)=>{if(R==0)return X;let ae=X,re=x(O,R,X,te)??gt,oe=re>=0&&re0;)y.has(Re[Se])||(De=Se);if(E==0||E==1)for(Se=X;Me==null&&Se++re&&(ae=null);return ae}}const ni=p=>{V.event=p};V.idxs=N,V._lock=!1;let an=V.points;an.show=Be(an.show),an.size=Be(an.size),an.stroke=Be(an.stroke),an.width=Be(an.width),an.fill=Be(an.fill);const ii=r.focus=Ft({},n.focus||{alpha:.3},V.focus),ma=ii.prox>=0,pa=ma&&an.one;let wn=[],Fi=[],ga=[];function zr(p,y){let x=an.show(r,y);if(x instanceof HTMLElement)return fi(x,lT),fi(x,p.class),sa(x,-10,-10,Ee,fe),j.insertBefore(x,wn[y]),x}function Ci(p,y){if(o==1||y>0){let x=o==1&&q[p.scale].time,E=p.value;p.value=x?My(E)?Zy(U,Uy(E,G)):E||_e:E||bA,p.label=p.label||(x?fA:cA)}if(pa||y>0){p.width=p.width==null?1:p.width,p.paths=p.paths||RA||wT,p.fillTo=Be(p.fillTo||zA),p.pxAlign=+Fe(p.pxAlign,C),p.pxRound=Qy(p.pxAlign),p.stroke=Be(p.stroke||null),p.fill=Be(p.fill||null),p._stroke=p._fill=p._paths=p._focus=null;let x=_A(qn(1,p.width),1),E=p.points=Ft({},{size:x,width:qn(1,x*.2),stroke:p.stroke,space:x*2,paths:CA,_stroke:null,_fill:null},p.points);E.show=Be(E.show),E.filter=Be(E.filter),E.fill=Be(E.fill),E.stroke=Be(E.stroke),E.paths=Be(E.paths),E.pxAlign=p.pxAlign}if(le){let x=kl(p,y);nt.splice(y,0,x[0]),Mn.splice(y,0,x[1]),L.values.push(null)}if(xe){N.splice(y,0,null);let x=null;pa?y==0&&(x=zr(p,y)):y>0&&(x=zr(p,y)),wn.splice(y,0,x),Fi.splice(y,0,0),ga.splice(y,0,0)}Lt("addSeries",y)}function It(p,y){y=y??Y.length,p=o==1?wh(p,y,Ly,Gy):wh(p,y,{},Vy),Y.splice(y,0,p),Ci(Y[y],y)}r.addSeries=It;function zn(p){if(Y.splice(p,1),le){L.values.splice(p,1),Mn.splice(p,1);let y=nt.splice(p,1)[0];Ki(null,y.firstChild),y.remove()}xe&&(N.splice(p,1),wn.splice(p,1)[0].remove(),Fi.splice(p,1),ga.splice(p,1)),Lt("delSeries",p)}r.delSeries=zn;const Bn=[!1,!1,!1,!1];function Er(p,y){if(p._show=p.show,p.show){let x=p.side%2,E=q[p.scale];E==null&&(p.scale=x?Y[1].scale:ne,E=q[p.scale]);let O=E.time;p.size=Be(p.size),p.space=Be(p.space),p.rotate=Be(p.rotate),zl(p.incrs)&&p.incrs.forEach(X=>{!Al.has(X)&&Al.set(X,mb(X))}),p.incrs=Be(p.incrs||(E.distr==2?YT:O?B==1?KT:XT:ss)),p.splits=Be(p.splits||(O&&E.distr==1?pe:E.distr==3?bh:E.distr==4?mA:hA)),p.stroke=Be(p.stroke),p.grid.stroke=Be(p.grid.stroke),p.ticks.stroke=Be(p.ticks.stroke),p.border.stroke=Be(p.border.stroke);let R=p.values;p.values=zl(R)&&!zl(R[0])?Be(R):O?zl(R)?Dy(U,Cy(R,G)):My(R)?WT(U,R):R||Oe:R||dA,p.filter=Be(p.filter||(E.distr>=3&&E.log==10?vA:E.distr==3&&E.log==2?yA:db)),p.font=Xy(p.font),p.labelFont=Xy(p.labelFont),p._size=p.size(r,null,y,0),p._space=p._rotate=p._incrs=p._found=p._splits=p._values=null,p._size>0&&(Bn[y]=!0,p._el=Ai(tT,z))}}function Cl(p,y,x,E){let[O,R,X,te]=x,ae=y%2,re=0;return ae==0&&(te||R)&&(re=y==0&&!O||y==2&&!X?Wt($y.size/3):0),ae==1&&(O||X)&&(re=y==1&&!R||y==3&&!te?Wt(qy.size/2):0),re}const Vu=r.padding=(n.padding||[Cl,Cl,Cl,Cl]).map(p=>Be(Fe(p,Cl))),Di=r._padding=Vu.map((p,y)=>p(r,y,Bn,0));let At,jt=null,bt=null;const Ui=o==1?Y[0].idxs:null;let dn=null,gi=!1;function $t(p,y){if(i=p??[],r.data=r._data=i,o==2){At=0;for(let x=1;x=0,fn=!0,Pi()}}r.setData=$t;function ys(){gi=!0;let p,y;o==1&&(At>0?(jt=Ui[0]=0,bt=Ui[1]=At-1,p=i[0][jt],y=i[0][bt],be==2?(p=jt,y=bt):p==y&&(be==3?[p,y]=Hc(p,p,ie.log,!1):be==4?[p,y]=am(p,p,ie.log,!1):ie.time?y=p+Wt(86400/B):[p,y]=jc(p,y,lm,!0))):(jt=Ui[0]=p=null,bt=Ui[1]=y=null)),Gn(ne,p,y)}let Dl,Vn,Xi,Tr,bs,_s,Ar,Va,Ga,zt;function Rn(p,y,x,E,O,R){p??=hy,x??=rm,E??="butt",O??=hy,R??="round",p!=Dl&&(S.strokeStyle=Dl=p),O!=Vn&&(S.fillStyle=Vn=O),y!=Xi&&(S.lineWidth=Xi=y),R!=bs&&(S.lineJoin=bs=R),E!=_s&&(S.lineCap=_s=E),x!=Tr&&S.setLineDash(Tr=x)}function Nr(p,y,x,E){y!=Vn&&(S.fillStyle=Vn=y),p!=Ar&&(S.font=Ar=p),x!=Va&&(S.textAlign=Va=x),E!=Ga&&(S.textBaseline=Ga=E)}function Or(p,y,x,E,O=0){if(E.length>0&&p.auto(r,gi)&&(y==null||y.min==null)){let R=Fe(jt,0),X=Fe(bt,E.length-1),te=x.min==null?vT(E,R,X,O,p.distr==3):[x.min,x.max];p.min=Gi(p.min,x.min=te[0]),p.max=qn(p.max,x.max=te[1])}}const Ss={min:null,max:null};function Gu(){for(let E in q){let O=q[E];he[E]==null&&(O.min==null||he[ne]!=null&&O.auto(r,gi))&&(he[E]=Ss)}for(let E in q){let O=q[E];he[E]==null&&O.from!=null&&he[O.from]!=null&&(he[E]=Ss)}he[ne]!=null&&Qa(!0);let p={};for(let E in he){let O=he[E];if(O!=null){let R=p[E]=pr(q[E],TT);if(O.min!=null)Ft(R,O);else if(E!=ne||o==2)if(At==0&&R.from==null){let X=R.range(r,null,null,E);R.min=X[0],R.max=X[1]}else R.min=gt,R.max=-gt}}if(At>0){Y.forEach((E,O)=>{if(o==1){let R=E.scale,X=he[R];if(X==null)return;let te=p[R];if(O==0){let ae=te.range(r,te.min,te.max,R);te.min=ae[0],te.max=ae[1],jt=Vi(te.min,i[0]),bt=Vi(te.max,i[0]),bt-jt>1&&(i[0][jt]te.max&&bt--),E.min=dn[jt],E.max=dn[bt]}else E.show&&E.auto&&Or(te,X,E,i[O],E.sorted);E.idxs[0]=jt,E.idxs[1]=bt}else if(O>0&&E.show&&E.auto){let[R,X]=E.facets,te=R.scale,ae=X.scale,[re,oe]=i[O],de=p[te],ke=p[ae];de!=null&&Or(de,he[te],R,re,R.sorted),ke!=null&&Or(ke,he[ae],X,oe,X.sorted),E.min=X.min,E.max=X.max}});for(let E in p){let O=p[E],R=he[E];if(O.from==null&&(R==null||R.min==null)){let X=O.range(r,O.min==gt?null:O.min,O.max==-gt?null:O.max,E);O.min=X[0],O.max=X[1]}}}for(let E in p){let O=p[E];if(O.from!=null){let R=p[O.from];if(R.min==null)O.min=O.max=null;else{let X=O.range(r,R.min,R.max,E);O.min=X[0],O.max=X[1]}}}let y={},x=!1;for(let E in p){let O=p[E],R=q[E];if(R.min!=O.min||R.max!=O.max){R.min=O.min,R.max=O.max;let X=R.distr;R._min=X==3?La(R.min):X==4?nh(R.min,R.asinh):X==100?R.fwd(R.min):R.min,R._max=X==3?La(R.max):X==4?nh(R.max,R.asinh):X==100?R.fwd(R.max):R.max,y[E]=x=!0}}if(x){Y.forEach((E,O)=>{o==2?O>0&&y.y&&(E._paths=null):y[E.scale]&&(E._paths=null)});for(let E in y)qa=!0,Lt("setScale",E);xe&&V.left>=0&&(da=fn=!0)}for(let E in he)he[E]=null}function xs(p){let y=yh(jt-1,0,At-1),x=yh(bt+1,0,At-1);for(;p[y]==null&&y>0;)y--;for(;p[x]==)DELIM" -R"DELIM(null&&x0){let p=Y.some(y=>y._focus)&&zt!=ii.alpha;p&&(S.globalAlpha=zt=ii.alpha),Y.forEach((y,x)=>{if(x>0&&y.show&&(Cn(x,!1),Cn(x,!0),y._paths==null)){let E=zt;zt!=y.alpha&&(S.globalAlpha=zt=y.alpha);let O=o==2?[0,i[x][0].length-1]:xs(i[x]);y._paths=y.paths(r,x,O[0],O[1]),zt!=E&&(S.globalAlpha=zt=E)}}),Y.forEach((y,x)=>{if(x>0&&y.show){let E=zt;zt!=y.alpha&&(S.globalAlpha=zt=y.alpha),y._paths!=null&&ws(x,!1);{let O=y._paths!=null?y._paths.gaps:null,R=y.points.show(r,x,jt,bt,O),X=y.points.filter(r,x,R,O);(R||X)&&(y.points._paths=y.points.paths(r,x,jt,bt,X),ws(x,!0))}zt!=E&&(S.globalAlpha=zt=E),Lt("drawSeries",x)}}),p&&(S.globalAlpha=zt=1)}}function Cn(p,y){let x=y?Y[p].points:Y[p];x._stroke=x.stroke(r,p),x._fill=x.fill(r,p)}function ws(p,y){let x=y?Y[p].points:Y[p],{stroke:E,fill:O,clip:R,flags:X,_stroke:te=x._stroke,_fill:ae=x._fill,_width:re=x.width}=x._paths;re=vt(re*Pe,3);let oe=null,de=re%2/2;y&&ae==null&&(ae=re>0?"#fff":te);let ke=x.pxAlign==1&&de>0;if(ke&&S.translate(de,de),!y){let Ye=kn-re/2,Re=nn-re/2,De=ut+re,Me=Vt+re;oe=new Path2D,oe.rect(Ye,Re,De,Me)}y?Ii(te,re,x.dash,x.cap,ae,E,O,X,R):Yu(p,te,re,x.dash,x.cap,ae,E,O,X,oe,R),ke&&S.translate(-de,-de)}function Yu(p,y,x,E,O,R,X,te,ae,re,oe){let de=!1;ae!=0&&ee.forEach((ke,Ye)=>{if(ke.series[0]==p){let Re=Y[ke.series[1]],De=i[ke.series[1]],Me=(Re._paths||ku).band;zl(Me)&&(Me=ke.dir==1?Me[0]:Me[1]);let Se,ot=null;Re.show&&Me&&bT(De,jt,bt)?(ot=ke.fill(r,Ye)||R,Se=Re._paths.clip):Me=null,Ii(y,x,E,O,ot,X,te,ae,re,oe,Se,Me),de=!0}}),de||Ii(y,x,E,O,R,X,te,ae,re,oe)}const zs=gr|Sh;function Ii(p,y,x,E,O,R,X,te,ae,re,oe,de){Rn(p,y,x,E,O),(ae||re||de)&&(S.save(),ae&&S.clip(ae),re&&S.clip(re)),de?(te&zs)==zs?(S.clip(de),oe&&S.clip(oe),Zl(O,X),Ul(p,R,y)):te&Sh?(Zl(O,X),S.clip(de),Ul(p,R,y)):te&gr&&(S.save(),S.clip(de),oe&&S.clip(oe),Zl(O,X),S.restore(),Ul(p,R,y)):(Zl(O,X),Ul(p,R,y)),(ae||re||de)&&S.restore()}function Ul(p,y,x){x>0&&(y instanceof Map?y.forEach((E,O)=>{S.strokeStyle=Dl=O,S.stroke(E)}):y!=null&&p&&S.stroke(y))}function Zl(p,y){y instanceof Map?y.forEach((x,E)=>{S.fillStyle=Vn=E,S.fill(x)}):y!=null&&p&&S.fill(y)}function Ya(p,y,x,E){let O=J[p],R;if(E<=0)R=[0,0];else{let X=O._space=O.space(r,p,y,x,E),te=O._incrs=O.incrs(r,p,y,x,E,X);R=HA(y,x,te,E,X)}return O._found=R}function Mr(p,y,x,E,O,R,X,te,ae,re){let oe=X%2/2;C==1&&S.translate(oe,oe),Rn(te,X,ae,re,te),S.beginPath();let de,ke,Ye,Re,De=O+(E==0||E==3?-R:R);x==0?(ke=O,Re=De):(de=O,Ye=De);for(let Me=0;Me{if(!x.show)return;let O=q[x.scale];if(O.min==null){x._show&&(y=!1,x._show=!1,Qa(!1));return}else x._show||(y=!1,x._show=!0,Qa(!1));let R=x.side,X=R%2,{min:te,max:ae}=O,[re,oe]=Ya(E,te,ae,X==0?Ee:fe);if(oe==0)return;let de=O.distr==2,ke=x._splits=x.splits(r,E,te,ae,re,oe,de),Ye=O.distr==2?ke.map(Se=>dn[Se]):ke,Re=O.distr==2?dn[ke[1]]-dn[ke[0]]:re,De=x._values=x.values(r,x.filter(r,Ye,E,oe,Re),E,oe,Re);x._rotate=R==2?x.rotate(r,De,E,oe):0;let Me=x._size;x._size=Ni(x.size(r,De,E,p)),Me!=null&&x._size!=Me&&(y=!1)}),y}function Ku(p){let y=!0;return Vu.forEach((x,E)=>{let O=x(r,E,Bn,p);O!=Di[E]&&(y=!1),Di[E]=O}),y}function jr(){for(let p=0;pdn[rn]):Ye,De=oe.distr==2?dn[Ye[1]]-dn[Ye[0]]:ae,Me=y.ticks,Se=y.border,ot=Me.show?Me.size:0,_t=Wt(ot*Pe),Rt=Wt((y.alignTo==2?y._size-ot-y.gap:y.gap)*Pe),et=y._rotate*-_c/180,lt=Q(y._pos*Pe),hn=(_t+Rt)*te,Ht=lt+hn;R=E==0?Ht:0,O=E==1?Ht:0;let Tn=y.font[0],Yn=y.align==1?ir:y.align==2?Wd:et>0?ir:et<0?Wd:E==0?"center":x==3?Wd:ir,ln=et||E==1?"middle":x==2?wu:dy;Nr(Tn,X,Yn,ln);let Gt=y.font[1]*y.lineGap,An=Ye.map(rn=>Q(m(rn,oe,de,ke))),Qn=y._values;for(let rn=0;rn{x>0&&(y._paths=null,p&&(o==1?(y.min=null,y.max=null):y.facets.forEach(E=>{E.min=null,E.max=null})))})}let Es=!1,Ka=!1,Dn=[];function kr(){Ka=!1;for(let p=0;p0&&queueMicrotask(kr)}r.batch=Ja;function va(){if(cn&&(Gu(),cn=!1),qa&&(Rl(),qa=!1),gs){if(wt(T,ir,it),wt(T,wu,Mt),wt(T,Au,Ee),wt(T,Nu,fe),wt(j,ir,it),wt(j,wu,Mt),wt(j,Au,Ee),wt(j,Nu,fe),wt(z,Au,ki),wt(z,Nu,oa),w.width=Wt(ki*Pe),w.height=Wt(oa*Pe),J.forEach(({_el:p,_show:y,_size:x,_pos:E,side:O})=>{if(p!=null)if(y){let R=O===3||O===0?x:0,X=O%2==1;wt(p,X?"left":"top",E-R),wt(p,X?"width":"height",x),wt(p,X?"top":"left",X?Mt:it),wt(p,X?"height":"width",X?fe:Ee),gh(p,rs)}else fi(p,rs)}),Dl=Vn=Xi=bs=_s=Ar=Va=Ga=Tr=null,zt=1,Bl(!0),it!=Ri||Mt!=ca||Ee!=ti||fe!=fa){Qa(!1);let p=Ee/ti,y=fe/fa;if(xe&&!da&&V.left>=0){V.left*=p,V.top*=y,vi&&sa(vi,Wt(V.left),0,Ee,fe),En&&sa(En,0,Wt(V.top),Ee,fe);for(let x=0;x=0&&Xe.width>0){Xe.left*=p,Xe.width*=p,Xe.top*=y,Xe.height*=y;for(let x in $r)wt(Xa,x,Xe[x])}Ri=it,ca=Mt,ti=Ee,fa=fe}Lt("setSize"),gs=!1}ki>0&&oa>0&&(S.clearRect(0,0,w.width,w.height),Lt("drawClear"),ue.forEach(p=>p()),Lt("draw")),Xe.show&&ha&&(Ia(Xe),ha=!1),xe&&da&&(ba(null,!0,!1),da=!1),L.show&&L.live&&fn&&(Ur(),fn=!1),g||(g=!0,r.status=1,Lt("ready")),gi=!1,Es=!1}r.redraw=(p,y)=>{qa=y||!1,p!==!1?Gn(ne,ie.min,ie.max):Pi()};function Ts(p,y){let x=q[p];if(x.from==null){if(At==0){let E=x.range(r,y.min,y.max,p);y.min=E[0],y.max=E[1]}if(y.min>y.max){let E=y.min;y.min=y.max,y.max=E}if(At>1&&y.min!=null&&y.max!=null&&y.max-y.min<1e-16)return;p==ne&&x.distr==2&&At>0&&(y.min=Vi(y.min,i[0]),y.max=Vi(y.max,i[0]),y.min==y.max&&y.max++),he[p]=y,cn=!0,Pi()}}r.setScale=Ts;let $l,As,vi,En,Ns,Fa,Un,Wi,Ll,Rr,We,at,Zi=!1;const Qe=V.drag;let yt=Qe.x,Nt=Qe.y;xe&&(V.x&&($l=Ai(iT,j)),V.y&&(As=Ai(aT,j)),ie.ori==0?(vi=$l,En=As):(vi=As,En=$l),We=V.left,at=V.top);const Xe=r.select=Ft({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),Xa=Xe.show?Ai(nT,Xe.over?j:T):null;function Ia(p,y){if(Xe.show){for(let x in p)Xe[x]=p[x],x in $r&&wt(Xa,x,p[x]);y!==!1&&Lt("setSelect")}}r.setSelect=Ia;function Cr(p){if(Y[p].show)le&&gh(nt[p],rs);else if(le&&fi(nt[p],rs),xe){let x=pa?wn[0]:wn[p];x!=null&&sa(x,-10,-10,Ee,fe)}}function Gn(p,y,x){Ts(p,{min:y,max:x})}function Zn(p,y,x,E){y.focus!=null&&Pc(p),y.show!=null&&Y.forEach((O,R)=>{R>0&&(p==R||p==null)&&(O.show=y.show,Cr(R),o==2?(Gn(O.facets[0].scale,null,null),Gn(O.facets[1].scale,null,null)):Gn(O.scale,null,null),Pi())}),x!==!1&&Lt("setSeries",p,y),E&&el("setSeries",r,p,y)}r.setSeries=Zn;function Ju(p,y){Ft(ee[p],y)}function Fc(p,y){p.fill=Be(p.fill||null),p.dir=Fe(p.dir,-1),y=y??ee.length,ee.splice(y,0,p)}function Xc(p){p==null?ee.length=0:ee.splice(p,1)}r.addBand=Fc,r.setBand=Ju,r.delBand=Xc;function Ic(p,y){Y[p].alpha=y,xe&&wn[p]!=null&&(wn[p].style.opacity=y),le&&nt[p]&&(nt[p].st)DELIM" -R"DELIM(yle.opacity=y)}let ai,ea,ya;const Pa={focus:!0};function Pc(p){if(p!=ya){let y=p==null,x=ii.alpha!=1;Y.forEach((E,O)=>{if(o==1||O>0){let R=y||O==0||O==p;E._focus=y?null:R,x&&Ic(O,R?1:ii.alpha)}}),ya=p,x&&Pi()}}le&&ma&&Xt(gy,ve,p=>{V._lock||(ni(p),ya!=null&&Zn(null,Pa,!0,kt.setSeries))});function yi(p,y,x){let E=q[y];x&&(p=p/Pe-(E.ori==1?Mt:it));let O=Ee;E.ori==1&&(O=fe,p=O-p),E.dir==-1&&(p=O-p);let R=E._min,X=E._max,te=p/O,ae=R+(X-R)*te,re=E.distr;return re==3?hr(10,ae):re==4?ST(ae,E.asinh):re==100?E.bwd(ae):ae}function Fu(p,y){let x=yi(p,ne,y);return Vi(x,i[0],jt,bt)}r.valToIdx=p=>Vi(p,i[0]),r.posToIdx=Fu,r.posToVal=yi,r.valToPos=(p,y,x)=>q[y].ori==0?d(p,q[y],x?ut:Ee,x?kn:0):f(p,q[y],x?Vt:fe,x?nn:0),r.setCursor=(p,y,x)=>{We=p.left,at=p.top,ba(null,y,x)};function Xu(p,y){wt(Xa,ir,Xe.left=p),wt(Xa,Au,Xe.width=y)}function Iu(p,y){wt(Xa,wu,Xe.top=p),wt(Xa,Nu,Xe.height=y)}let Hl=ie.ori==0?Xu:Iu,ql=ie.ori==1?Xu:Iu;function Dr(){if(le&&L.live)for(let p=o==2?1:0;p{N[E]=x}):ET(p.idx)||N.fill(p.idx),L.idx=N[0]),le&&L.live){for(let x=0;x0||o==1&&!jn)&&Wc(x,N[x]);Dr()}fn=!1,y!==!1&&Lt("setLegend")}r.setLegend=Ur;function Wc(p,y){let x=Y[p],E=p==0&&be==2?dn:i[p],O;jn?O=x.values(r,p,y)??xn:(O=x.value(r,y==null?null:E[y],p,y),O=O==null?xn:{_:O}),L.values[p]=O}function ba(p,y,x){Ll=We,Rr=at,[We,at]=V.move(r,We,at),V.left=We,V.top=at,xe&&(vi&&sa(vi,Wt(We),0,Ee,fe),En&&sa(En,0,Wt(at),Ee,fe));let E,O=jt>bt;ai=gt,ea=null;let R=ie.ori==0?Ee:fe,X=ie.ori==1?Ee:fe;if(We<0||At==0||O){E=V.idx=null;for(let te=0;te0&&ot.show){let hn=et==null?-10:et==E?re:ce(o==1?i[0][et]:i[Se][0][et],ie,R,0),Ht=lt==null?-10:ze(lt,o==1?q[ot.scale]:q[ot.facets[1].scale],X,0);if(ma&<!=null){let Tn=ie.ori==1?We:at,Yn=en(ii.dist(r,Se,et,Ht,Tn));if(Yn=0?1:-1,Qn=Gt>=0?1:-1;Qn==An&&(Qn==1?ln==1?lt>=Gt:lt<=Gt:ln==1?lt<=Gt:lt>=Gt)&&(ai=Yn,ea=Se)}else ai=Yn,ea=Se}}if(fn||pa){let Tn,Yn;ie.ori==0?(Tn=hn,Yn=Ht):(Tn=Ht,Yn=hn);let ln,Gt,An,Qn,sn,rn,Nn=!0,ta=an.bbox;if(ta!=null){Nn=!1;let mn=ta(r,Se);An=mn.left,Qn=mn.top,ln=mn.width,Gt=mn.height}else An=Tn,Qn=Yn,ln=Gt=an.size(r,Se);if(rn=an.fill(r,Se),sn=an.stroke(r,Se),pa)Se==ea&&ai<=ii.prox&&(oe=An,de=Qn,ke=ln,Ye=Gt,Re=Nn,De=rn,Me=sn);else{let mn=wn[Se];mn!=null&&(Fi[Se]=An,ga[Se]=Qn,wy(mn,ln,Gt,Nn),Sy(mn,rn,sn),sa(mn,Ni(An),Ni(Qn),Ee,fe))}}}}if(pa){let Se=ii.prox,ot=ya==null?ai<=Se:ai>Se||ea!=ya;if(fn||ot){let _t=wn[0];_t!=null&&(Fi[0]=oe,ga[0]=de,wy(_t,ke,Ye,Re),Sy(_t,De,Me),sa(_t,Ni(oe),Ni(de),Ee,fe))}}}if(Xe.show&&Zi)if(p!=null){let[te,ae]=kt.scales,[re,oe]=kt.match,[de,ke]=p.cursor.sync.scales,Ye=p.cursor.drag;if(yt=Ye._x,Nt=Ye._y,yt||Nt){let{left:Re,top:De,width:Me,height:Se}=p.select,ot=p.scales[de].ori,_t=p.posToVal,Rt,et,lt,hn,Ht,Tn=te!=null&&re(te,de),Yn=ae!=null&&oe(ae,ke);Tn&&yt?(ot==0?(Rt=Re,et=Me):(Rt=De,et=Se),lt=q[te],hn=ce(_t(Rt,de),lt,R,0),Ht=ce(_t(Rt+et,de),lt,R,0),Hl(Gi(hn,Ht),en(Ht-hn))):Hl(0,R),Yn&&Nt?(ot==1?(Rt=Re,et=Me):(Rt=De,et=Se),lt=q[ae],hn=ze(_t(Rt,ke),lt,X,0),Ht=ze(_t(Rt+et,ke),lt,X,0),ql(Gi(hn,Ht),en(Ht-hn))):ql(0,X)}else Lr()}else{let te=en(Ll-Ns),ae=en(Rr-Fa);if(ie.ori==1){let ke=te;te=ae,ae=ke}yt=Qe.x&&te>=Qe.dist,Nt=Qe.y&&ae>=Qe.dist;let re=Qe.uni;re!=null?yt&&Nt&&(yt=te>=re,Nt=ae>=re,!yt&&!Nt&&(ae>te?Nt=!0:yt=!0)):Qe.x&&Qe.y&&(yt||Nt)&&(yt=Nt=!0);let oe,de;yt&&(ie.ori==0?(oe=Un,de=We):(oe=Wi,de=at),Hl(Gi(oe,de),en(de-oe)),Nt||ql(0,X)),Nt&&(ie.ori==1?(oe=Un,de=We):(oe=Wi,de=at),ql(Gi(oe,de),en(de-oe)),yt||Hl(0,R)),!yt&&!Nt&&(Hl(0,0),ql(0,0))}if(Qe._x=yt,Qe._y=Nt,p==null){if(x){if(io!=null){let[te,ae]=kt.scales;kt.values[0]=te!=null?yi(ie.ori==0?We:at,te):null,kt.values[1]=ae!=null?yi(ie.ori==1?We:at,ae):null}el(eh,r,We,at,Ee,fe,E)}if(ma){let te=x&&kt.setSeries,ae=ii.prox;ya==null?ai<=ae&&Zn(ea,Pa,!0,te):ai>ae?Zn(null,Pa,!0,te):ea!=ya&&Zn(ea,Pa,!0,te)}}fn&&(L.idx=E,Ur()),y!==!1&&Lt("setCursor")}let $i=null;Object.defineProperty(r,"rect",{get(){return $i==null&&Bl(!1),$i}});function Bl(p=!1){p?$i=null:($i=j.getBoundingClientRect(),Lt("syncRect",$i))}function Pu(p,y,x,E,O,R,X){V._lock||Zi&&p!=null&&p.movementX==0&&p.movementY==0||(Zr(p,y,x,E,O,R,X,!1,p!=null),p!=null?ba(null,!0,!0):ba(y,!0,!1))}function Zr(p,y,x,E,O,R,X,te,ae){if($i==null&&Bl(!1),ni(p),p!=null)x=p.clientX-$i.left,E=p.clientY-$i.top;else{if(x<0||E<0){We=-10,at=-10;return}let[re,oe]=kt.scales,de=y.cursor.sync,[ke,Ye]=de.values,[Re,De]=de.scales,[Me,Se]=kt.match,ot=y.axes[0].side%2==1,_t=ie.ori==0?Ee:fe,Rt=ie.ori==1?Ee:fe,et=ot?R:O,lt=ot?O:R,hn=ot?E:x,Ht=ot?x:E;if(Re!=null?x=Me(re,Re)?m(ke,q[re],_t,0):-10:x=_t*(hn/et),De!=null?E=Se(oe,De)?m(Ye,q[oe],Rt,0):-10:E=Rt*(Ht/lt),ie.ori==1){let Tn=x;x=E,E=Tn}}ae&&(y==null||y.cursor.event.type==eh)&&((x<=1||x>=Ee-1)&&(x=ls(x,Ee)),(E<=1||E>=fe-1)&&(E=ls(E,fe))),te?(Ns=x,Fa=E,[Un,Wi]=V.move(r,x,E)):(We=x,at=E)}const $r={width:0,height:0,left:0,top:0};function Lr(){Ia($r,!1)}let Wu,eo,to,no;function Os(p,y,x,E,O,R,X){Zi=!0,yt=Nt=Qe._x=Qe._y=!1,Zr(p,y,x,E,O,R,X,!0,!1),p!=null&&(Xt(th,mh,Wa,!1),el(my,r,Un,Wi,Ee,fe,null));let{left:te,top:ae,width:re,height:oe}=Xe;Wu=te,eo=ae,to=re,no=oe}function Wa(p,y,x,E,O,R,X){Zi=Qe._x=Qe._y=!1,Zr(p,y,x,E,O,R,X,!1,!0);let{left:te,top:ae,width:re,height:oe}=Xe,de=re>0||oe>0,ke=Wu!=te||eo!=ae||to!=re||no!=oe;if(de&&ke&&Ia(Xe),Qe.setScale&&de&&ke){let Ye=te,Re=re,De=ae,Me=oe;if(ie.ori==1&&(Ye=ae,Re=oe,De=te,Me=re),yt&&Gn(ne,yi(Ye,ne),yi(Ye+Re,ne)),Nt)for(let Se in q){let ot=q[Se];Se!=ne&&ot.from==null&&ot.min!=gt&&Gn(Se,yi(De+Me,Se),yi(De,Se))}Lr()}else V.lock&&(V._lock=!V._lock,ba(y,!0,p!=null));p!=null&&(Ki(th,mh),el(th,r,We,at,Ee,fe,null))}function ef(p,y,x,E,O,R,X){if(V._lock)return;ni(p);let te=Zi;if(Zi){let ae=!0,re=!0,oe=10,de,ke;ie.ori==0?(de=yt,ke=Nt):(de=Nt,ke=yt),de&&ke&&(ae=We<=oe||We>=Ee-oe,re=at<=oe||at>=fe-oe),de&&ae&&(We=We{let O=kt.match[2];x=O(r,y,x),x!=-1&&Zn(x,E,!0,!1)},xe&&(Xt(my,j,Os),Xt(eh,j,Pu),Xt(py,j,p=>{ni(p),Bl(!1)}),Xt(gy,j,ef),Xt(vy,j,Hr),xh.add(r),r.syncRect=Bl);const Vl=r.hooks=n.hooks||{};function Lt(p,y,x){Ka?Dn.push([p,y,x]):p in Vl&&Vl[p].forEach(E=>{E.call(null,r,y,x)})}(n.plugins||[]).forEach(p=>{for(let y in p.hooks)Vl[y]=(Vl[y]||[]).concat(p.hooks[y])});const Sa=(p,y,x)=>x,kt=Ft({key:null,setSeries:!1,filters:{pub:Ny,sub:Ny},scales:[ne,Y[1]?Y[1].scale:null],match:[Oy,Oy,Sa],values:[null,null]},V.sync);kt.match.length==2&&kt.match.push(Sa),V.sync=kt;const io=kt.key,Br=Cb(io);function el(p,y,x,E,O,R,X){kt.filters.pub(p,y,x,E,O,R,X)&&Br.pub(p,y,x,E,O,R,X)}Br.sub(r);function ao(p,y,x,E,O,R,X){kt.filters.sub(p,y,x,E,O,R,X)&&_a[p](null,y,x,E,O,R,X)}r.pub=ao;function Gl(){Br.unsub(r),xh.delete(r),ji.clear(),vh(Mc,fr,qr),v.remove(),ve?.remove(),Lt("destroy")}r.destroy=Gl;function xa(){Lt("init",n,i),$t(i||n.data,!1),he[ne]?Ts(ne,he[ne]):ys(),ha=Xe.show&&(Xe.width>0||Xe.height>0),da=fn=!0,Ba(n.width,n.height)}return Y.forEach(Ci),J.forEach(Er),s?s instanceof HTMLElement?(s.appendChild(v),xa()):s(r,xa):xa(),r}on.assign=Ft;on.fmtNum=sm;on.rangeNum=jc;on.rangeLog=Hc;on.rangeAsinh=am;on.)DELIM" -R"DELIM(orient=ps;on.pxRatio=Pe;on.join=kT;on.fmtDate=um,on.tzDate=VT;on.sync=Cb;{on.addGap=EA,on.clipGaps=Vc;let n=on.paths={points:Hb};n.linear=Bb,n.stepped=NA,n.bars=OA,n.spline=jA}function BA({data:n,series:i,height:s=280,emptyMessage:r="Waiting for live data…",valueSuffix:o="",zeroBased:d=!0,valueFormatter:f=QA,visualization:m="line",forceEmpty:g=!1}){const v=se.useRef(null),w=se.useRef(null),S=se.useRef(!1),z=se.useMemo(()=>YA(n),[n]),T=se.useRef(z),j=!g&&n[0]?.length>0;return se.useLayoutEffect(()=>{T.current=z},[z]),se.useLayoutEffect(()=>{const C=v.current;if(!C)return;const Q={width:Math.max(240,C.clientWidth),height:s,padding:[12,8,0,0],cursor:{drag:{x:!0,y:!1,setScale:!0},focus:{prox:24}},hooks:{setSelect:[J=>{J.select.width>0&&(S.current=!0)}]},legend:{show:!0,live:!0},scales:{x:{time:!0},y:{auto:!0,...d?{range:(J,q,ee)=>[Math.min(0,q),ee===0?1:ee*1.08]}:{range:(J,q,ee)=>{const ne=ee-q,F=ne===0?Math.max(1,Math.abs(ee)*5e-4):ne*.08;return[q-F,ee+F]}}}},axes:[{stroke:"#9f9f98",grid:{stroke:"#ffffff12",width:1},ticks:{stroke:"#ffffff20",width:1},font:"11px system-ui"},{size:72,stroke:"#9f9f98",grid:{stroke:"#ffffff12",width:1},ticks:{stroke:"#ffffff20",width:1},font:"11px system-ui",values:(J,q)=>q.map(ee=>`${f(ee)}${o}`)}],series:[{},...i.map((J,q)=>{const ee=m==="step"?on.paths.stepped?.({align:1}):m==="bar"?VA(q,i.length):void 0;return{label:J.label,stroke:J.color,fill:m==="area"||m==="bar"?J.fill??`${J.color}24`:J.fill,width:J.width??2,paths:ee,points:{show:m==="line"?J.points??!1:!1},value:(ne,F)=>F===null?"—":`${f(F)}${o}`}})]};S.current=!1;const B=new on(Q,T.current,C);w.current=B;const Y=new ResizeObserver(J=>{const q=J[0]?.contentRect.width;q&&q>0&&B.setSize({width:Math.round(q),height:s})});return Y.observe(C),()=>{Y.disconnect(),B.destroy(),w.current=null}},[s,i,f,o,m,d]),se.useEffect(()=>{const C=w.current;if(!C)return;const Q=!S.current;C.setData(z,Q),Q||C.redraw()},[z]),_.jsxs("div",{className:"relative min-w-0",children:[_.jsx("div",{ref:v,className:"min-w-0 overflow-hidden"}),!j&&_.jsx("div",{className:"bg-surface text-textMuted pointer-events-none absolute inset-0 z-10 flex items-center justify-center text-sm",children:r})]})}function VA(n,i){const s=Math.max(1,i);return on.paths.bars?.({size:[1,48/s,0],disp:{x0:{unit:1,values:r=>{const o=Iy(r,s),d=-o.groupWidth/2+o.barWidth*n;return Array.from(r.data[0],f=>f+d)}},size:{unit:1,values:r=>[Iy(r,s).barWidth]}}})}function Iy(n,i){const s=GA(n.data[0]),r=Math.abs(n.posToVal(48,"x")-n.posToVal(0,"x")),o=Math.min(s*.72,r);return{groupWidth:o,barWidth:o/i}}function GA(n){let i=Number.POSITIVE_INFINITY,s;for(const r of n)if(Number.isFinite(r)){if(s!==void 0){const o=Math.abs(r-s);o>0&&o=2)return n;const s=Date.now()/1e3,r=i[0]??s,o=[r-1,r],d=n.slice(1).map(f=>{const m=f[0]??null;return[m,m]});return[o,...d]}function QA(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 KA={300:"5m",900:"15m",3600:"1h"},JA=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),FA=new Intl.NumberFormat(void 0,{maximumFractionDigits:2});function XA(n){return JA.format(n)}function IA(n){return FA.format(n)}function PA(n){return n==="height"||n==="occurrences"?XA:IA}function WA({metrics:n}){const[i,s]=se.useState(kE),[r,o]=se.useState(null),[d,f]=se.useState(!1);se.useEffect(()=>{RE(i)},[i]);function m(w){s(S=>r?.mode==="add"?S.length>=lr?S:[...S,w]:S.map(z=>z.id===w.id?w:z)),o(null)}function g(w,S){s(z=>{const T=w+S;if(T<0||T>=z.length)return z;const j=[...z],C=j[w],Q=j[T];return j[w]=Q,j[T]=C,j})}function v(){if(!d){f(!0);return}s(bc()),f(!1)}return _.jsxs("section",{className:"space-y-4",children:[_.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Live telemetry"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Custom charts"}),_.jsxs("p",{className:"text-textMuted mt-1 text-sm",children:["Session data only · ",String(i.length)," of ",String(lr)," charts"]})]}),_.jsxs("div",{className:"flex flex-wrap gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{f(!1),o({mode:"add",chart:tb()})},disabled:i.length>=lr,className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold disabled:cursor-not-allowed disabled:opacity-40",children:"Add chart"}),_.jsx("button",{type:"button",onClick:v,onBlur:()=>{f(!1)},className:`rounded-lg border px-4 py-2 text-sm ${d?"border-amber-400/60 text-amber-200":"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary"}`,children:d?"Confirm reset":"Reset defaults"})]})]}),i.length===0?_.jsxs("div",{className:"border-accent/20 bg-surface/60 rounded-xl border border-dashed px-6 py-16 text-center",children:[_.jsx("p",{className:"text-textPrimary font-medium",children:"No charts in this dashboard."}),_.jsx("p",{className:"text-textMuted mt-2 text-sm",children:"Add a custom chart or start from a template."})]}):_.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:i.map((w,S)=>_.jsx(eN,{chart:w,metrics:n,canMoveEarlier:S>0,canMoveLater:S{s(z=>z.filter(T=>T.id!==w.id))},onDuplicate:()=>{s(z=>z.length>=lr?z:[...z,jE(w)])},onEdit:()=>{o({mode:"edit",chart:w})},onMoveEarlier:()=>{g(S,-1)},onMoveLater:()=>{g(S,1)}},w.id))}),r&&_.jsx(QE,{chart:r.chart,mode:r.mode,onCancel:()=>{o(null)},onSave:m},`${r.mode}-${r.chart.id}`)]})}function eN({chart:n,metrics:i,canMoveEarlier:s,canMoveLater:r,canDuplicate:o,onDelete:d,onDuplicate:f,onEdit:m,onMoveEarlier:g,onMoveLater:v}){const[w,S]=se.useState(null),[z,T]=se.useState(0),j=w??i,C=se.useMemo(()=>$E(j,n),[n,j]),Q=se.useMemo(()=>n.series.map(J=>({label:J.label??$a(J.signalId).label,color:J.color})),[n.series]),B=PA(C.unit),Y=`Waiting for ${n.series.length===1?Q[0]?.label?.toLowerCase():"the selected signals"}…`;return _.jsxs("article",{className:"border-accent/20 bg-surface/70 min-w-0 overflow-hidden rounded-xl border",children:[_.jsx("header",{className:"border-accent/15 space-y-3 border-b px-4 py-4 sm:px-5",children:_.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[_.jsxs("div",{className:"min-w-0",children:[_.jsx("h3",{className:"truncate font-semibold",title:n.title,children:n.title}),_.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:[lb(C.unit)," · ",KA[n.range]," · ",n.visualization,w?" · paused":""]})]}),_.jsxs("div",{className:"flex flex-wrap justify-end gap-1 text-xs",children:[_.jsx(as,{label:w?"Resume chart":"Pause chart",onClick:()=>{S(J=>J?null:i)},children:w?"Resume":"Pause"}),_.jsx(as,{label:"Reset chart zoom",onClick:()=>{T(J=>J+1)},children:"Reset zoom"}),_.jsx(as,{label:"Edit chart",onClick:m,children:"Edit"}),_.jsx(as,{label:"Duplicate chart",onClick:f,disabled:!o,children:"Duplicate"}),_.jsx(as,{label:`Move ${n.title} earlier`,onClick:g,disabled:!s,children:"←"}),_.jsx(as,{label:`Move ${n.title} later`,onClick:v,disabled:!r,children:"→"}),_.jsx(as,{label:"Delete chart",onClick:d,danger:!0,children:"Delete"})]})]})}),_.jsx("div",{className:"min-w-0 p-3 sm:p-5",children:_.jsx(BA,{data:C.data,series:Q,visualization:n.visualization,zeroBased:HE(C.unit),valueFormatter:B,valueSuffix:LE(C.unit),forceEmpty:!C.hasObservedData,emptyMessage:Y},z)}),C.unobservedLabels.length>0&&C.hasObservedData&&_.jsxs("footer",{className:"border-accent/10 text-textMuted border-t px-5 py-2 text-[11px]",children:["Not observed this session: ",C.unobservedLabels.join(", ")]})]})}function as({label:n,children:i,onClick:s,disabled:r=!1,danger:o=!1}){return _.jsx("button",{type:"button","aria-label":n,onClick:s,disabled:r,className:`rounded px-2 py-1.5 disabled:cursor-not-allowed disabled:opacity-30 ${o?"tex)DELIM" -R"DELIM(t-textMuted hover:bg-red-500/10 hover:text-red-300":"text-textMuted hover:text-textPrimary hover:bg-white/5"}`,children:i})}const tN=[{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 nN({adminStatus:n,endpoints:i,metrics:s,native:r,syncEstimate:o}){const d=yE(s,10),f=r.configuration,m=Oi(6),g=[n.error?`Admin: ${n.error}`:null,r.status.error?`Native: ${r.status.error}`:null,r.transport==="none"&&r.restError?`Native REST: ${r.restError}`:null,s.invalidFrames>0?`${String(s.invalidFrames)} malformed admin frame${s.invalidFrames===1?"":"s"} ignored`:null,r.live.invalidFrames>0?`${String(r.live.invalidFrames)} malformed native frame${r.live.invalidFrames===1?"":"s"} ignored`:null,r.status.phase==="connected"&&r.transport==="none"?"Native: Connected, but no fresh valid state has been received":null].filter(v=>v!==null);return _.jsxs("div",{className:"space-y-8",children:[g.length>0&&_.jsxs("section",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3",children:[_.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Transport notice"}),_.jsx("ul",{className:"text-textMuted mt-1 space-y-1 text-xs",children:g.map(v=>_.jsx("li",{children:v},v))})]}),_.jsx(wE,{confirmed:r.top,estimate:o}),_.jsxs("dl",{"aria-label":"Node summary",className:"grid grid-cols-2 border-y border-white/10 lg:grid-cols-[1fr_1.15fr_1fr_1fr]",children:[_.jsx(hc,{label:"Canonical top",value:r.top===null?"—":Hn(r.top),detail:r.transport==="none"?"Waiting for native API":`${aN(o)} · via ${r.transport==="websocket"?"native WebSocket":"REST fallback"}`,emphasized:!0}),_.jsx(hc,{label:"Current activity",value:d.label,detail:d.rate>0?`${Q2(d.rate)} over the last 10 seconds`:"No lifecycle events in the last 10 seconds",numeric:!1}),_.jsx(hc,{label:"Highest confirmed",value:s.signalMaximums[m]===void 0?"—":Hn(s.signalMaximums[m]),detail:`${Hn(s.signalTotals[m]??0)} confirmations observed`}),_.jsx(hc,{label:"Collection uptime",value:Y2(s.now-s.sessionStartedAt),detail:`${Hn(s.totalEvents)} events · ${Hn(s.totalLogs)} logs`})]}),_.jsxs("section",{className:"grid gap-4 lg:grid-cols-2",children:[_.jsx(Py,{title:"Admin stream",endpoint:i.adminUrl,status:n,detail:n.lastMessageAt?`Last frame ${Mu(n.lastMessageAt)}`:"Waiting for the first frame"}),_.jsx(Py,{title:"Native interface",endpoint:i.nativeUrl,status:r.status,detail:r.receivedAt?`Last state ${Mu(r.receivedAt)} · ${r.transport}`:"Waiting for node state"})]}),_.jsx(WA,{metrics:s}),_.jsxs("section",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsxs("header",{className:"border-accent/15 border-b px-5 py-4",children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Lifecycle heights"}),_.jsx("h2",{className:"mt-1 font-semibold",children:"Highest observed event values"})]}),_.jsx("div",{className:"grid gap-px bg-white/5 sm:grid-cols-2 lg:grid-cols-3",children:tN.map(({event:v,label:w})=>{const S=s.signalMaximums[Oi(v)];return _.jsxs("div",{className:"bg-surface px-5 py-4",children:[_.jsx("p",{className:"text-textMuted text-xs",children:w}),_.jsx("p",{className:"text-textPrimary mt-2 font-mono text-lg tabular-nums",children:S===void 0?"—":Hn(S)})]},v)})})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsxs("header",{className:"border-accent/15 border-b px-5 py-4",children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Capabilities"}),_.jsx("h2",{className:"mt-1 font-semibold",children:"Native configuration"})]}),f?_.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-4 p-5 text-sm",children:[_.jsx(ar,{label:"Address index",enabled:f.address}),_.jsx(ar,{label:"Client filters",enabled:f.filter}),_.jsx(ar,{label:"Turbo",enabled:f.turbo}),_.jsx(ar,{label:"Witness",enabled:f.witness}),_.jsx(ar,{label:"Retarget",enabled:f.retarget}),_.jsx(ar,{label:"Difficulty",enabled:f.difficult}),_.jsxs("div",{className:"col-span-2 border-t border-white/5 pt-3",children:[_.jsx("span",{className:"text-textMuted",children:"Pruned below"}),_.jsx("span",{className:"text-textPrimary float-right font-mono",children:f.pruned>0?Hn(f.pruned):"Not pruned"})]})]}):_.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:"Waiting for native configuration."})]})]}),_.jsx("section",{children:_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsx("header",{className:"border-accent/15 border-b px-5 py-4",children:_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Recent events"})}),s.recentEvents.length===0?_.jsx(iN,{text:"No events observed yet."}):_.jsx("ul",{className:"divide-y divide-white/5",children:s.recentEvents.slice(0,6).map(v=>_.jsxs("li",{className:"flex items-center gap-3 px-5 py-3 text-xs",children:[_.jsx("time",{className:"text-textMuted w-24 shrink-0 font-mono",children:Mu(v.time)}),_.jsx("span",{className:"text-textPrimary min-w-0 flex-1 truncate font-mono",children:Hu(v.event).name}),_.jsx("span",{className:"text-accent tabular-nums",children:F0(v.event,v.value)})]},v.id))})]})})]})}function Py({title:n,endpoint:i,status:s,detail:r}){return _.jsxs("article",{className:"border-accent/20 bg-surface/70 min-w-0 rounded-xl border p-5",children:[_.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-textMuted text-xs tracking-wide uppercase",children:n}),_.jsx("p",{className:"text-textPrimary mt-2 font-mono text-sm break-all",children:K2(i)})]}),_.jsx(xE,{phase:s.phase,label:s.phase})]}),_.jsxs("div",{className:"text-textMuted mt-4 flex flex-wrap justify-between gap-2 border-t border-white/5 pt-3 text-xs",children:[_.jsx("span",{children:r}),_.jsxs("span",{children:[String(s.reconnects)," reconnect",s.reconnects===1?"":"s"]})]})]})}function ar({label:n,enabled:i}){return _.jsxs("div",{className:"flex items-center justify-between gap-3",children:[_.jsx("span",{className:"text-textMuted",children:n}),_.jsx("span",{className:i?"text-emerald-300":"text-textMuted",children:i?"Enabled":"Disabled"})]})}function iN({text:n}){return _.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:n})}function aN(n){return n?n.blocksRemaining<=$c?"Near current (estimated)":`${Hn(n.blocksRemaining)} blocks remaining (estimated)`:"Waiting for confirmed block timestamp"}const lN=8e3;function sN({estimate:n,browserNotificationsEnabled:i}){const s=se.useRef(null),[r,o]=se.useState(null),d=n?.blocksRemaining??null;if(se.useEffect(()=>{const m=uN(d);if(!m)return;const g=s.current;if(s.current=m.state,!(g===null||g===m.state)&&(o(m),i)){const v=rN(m);G_(v.title,{body:v.body,tag:"libbitcoin-sync-status"})}},[i,d]),se.useEffect(()=>{if(!r)return;const m=setTimeout(()=>{o(g=>g===r?null:g)},lN);return()=>{clearTimeout(m)}},[r]),!r)return null;const f=r.state==="near-current";return _.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 ${f?"border-emerald-400/35 bg-emerald-950/95":"border-amber-400/35 bg-amber-950/95"}`,children:_.jsxs("div",{className:"flex items-start gap-4",children:[_.jsxs("div",{className:"min-w-0 flex-1",children:[_.jsx("p",{className:f?"font-semibold text-emerald-200":"font-semibold text-amber-200",children:f?"Node near current (estimated)":"Node fell behind (estimated)"}),_.jsx("p",{className:"mt-1 text-sm text-white/75",children:zh(r)})]}),_.jsx("button",{type:"button","aria-label":"Dismiss synchronization notification",onClick:()=>{o(null)},className:"text-lg leading-none text-white/60 hover:text-white",children:"×"})]})})}fu)DELIM" -R"DELIM(nction rN(n){return n.state==="near-current"?{title:"Libbitcoin node near current (estimated)",body:zh(n)}:{title:"Libbitcoin node fell behind (estimated)",body:zh(n)}}function uN(n){return n===null?null:{state:n<=$c?"near-current":"behind",blocksBehind:n}}function zh(n){return n.state==="near-current"?`Confirmed top is estimated to be within ${String($c)} blocks of the chain tip, based on block time.`:`Confirmed top is estimated to be ${Hn(n.blocksBehind)} blocks behind the chain tip, based on block time.`}const Qb='(function(){"use strict";var $e;function c(e,t,n){function r(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,u);const l=s.prototype,h=Object.keys(l);for(let m=0;mn?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class j extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Se extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}($e=globalThis).__zod_globalConfig??($e.__zod_globalConfig={});const se=globalThis.__zod_globalConfig;function A(e){return se}function Ze(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 oe(e,t){return typeof t=="bigint"?t.toString():t}function ae(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ce(e){return e==null}function ue(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Lt(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r){};function V(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ft=ae(()=>{if(se.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function F(e){if(V(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(V(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Te(e){return F(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const xt=new Set(["string","number","symbol"]);function W(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function N(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function f(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 Dt(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ut={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Jt(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 o=T(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return P(this,"shape",s),s},checks:[]});return N(e,o)}function Kt(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 o=T(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return P(this,"shape",s),s},checks:[]});return N(e,o)}function Vt(e,t){if(!F(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=T(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return P(this,"shape",o),o}});return N(e,i)}function Wt(e,t){if(!F(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=T(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return P(this,"shape",r),r}});return N(e,n)}function Bt(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=T(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return P(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return N(e,n)}function Gt(e,t,n){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=T(t._zod.def,{get shape(){const a=t._zod.def.shape,u={...a};if(n)for(const l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(u[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(const l in a)u[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return P(this,"shape",u),u},checks:[]});return N(t,s)}function qt(e,t,n){const r=T(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:i[s]}))}else for(const s in i)o[s]=new e({type:"nonoptional",innerType:i[s]});return P(this,"shape",o),o}});return N(t,r)}function R(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 B(e){return typeof e=="string"?e:e?.message}function M(e,t,n){const r=e.message?e.message:B(e.inst?._zod.def?.error?.(e))??B(t?.error?.(e))??B(n.customError?.(e))??B(n.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=s),a}function le(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function x(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Ae=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,oe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Pe=c("$ZodError",Ae),Me=c("$ZodError",Ae,{Parent:Error)DELIM" -R"DELIM(});function Yt(e,t=n=>n.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Xt(e,t=n=>n.message){const n={_errors:[]},r=(i,o=[])=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...o,...s.path]);else{const a=[...o,...s.path];if(a.length===0)n._errors.push(t(s));else{let u=n,l=0;for(;l(t,n,r,i)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new j;if(s.issues.length){const a=new(i?.Err??e)(s.issues.map(u=>M(u,o,A())));throw Oe(a,i?.callee),a}return s.value},fe=e=>async(t,n,r,i)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(i?.Err??e)(s.issues.map(u=>M(u,o,A())));throw Oe(a,i?.callee),a}return s.value},G=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new j;return o.issues.length?{success:!1,error:new(e??Pe)(o.issues.map(s=>M(s,i,A())))}:{success:!0,data:o.value}},Qt=G(Me),q=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>M(s,i,A())))}:{success:!0,data:o.value}},en=q(Me),tn=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return he(e)(t,n,i)},nn=e=>(t,n,r)=>he(e)(t,n,r),rn=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return fe(e)(t,n,i)},sn=e=>async(t,n,r)=>fe(e)(t,n,r),on=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return G(e)(t,n,i)},an=e=>(t,n,r)=>G(e)(t,n,r),cn=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return q(e)(t,n,i)},un=e=>async(t,n,r)=>q(e)(t,n,r),ln=/^[cC][0-9a-z]{6,}$/,hn=/^[0-9a-z]+$/,fn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,dn=/^[0-9a-vA-V]{20}$/,pn=/^[A-Za-z0-9]{27}$/,mn=/^[a-zA-Z0-9_-]{21}$/,gn=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,_n=/^([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})$/,je=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)$/,vn=/^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_\'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,bn="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$";function yn(){return new RegExp(bn,"u")}const wn=/^(?:(?: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])$/,zn=/^(([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}|:))$/,kn=/^((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])$/,$n=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Re=/^[A-Za-z0-9_-]*$/,Zn=/^https?$/,En=/^\\+[1-9]\\d{6,14}$/,Le="(?:(?:\\\\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])))",In=new RegExp(`^${Le}$`);function Ce(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}}`:`${t}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`}function On(e){return new RegExp(`^${Ce(e)}$`)}function Tn(e){const t=Ce({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Le}T(?:${r})$`)}const Nn=e=>{const t=e?`[\\\\s\\\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\\\s\\\\S]*";return new RegExp(`^${t}$`)},An=/^-?\\d+$/,Pn=/^-?\\d+(?:\\.\\d+)?$/,Mn=/^[^A-Z]*$/,jn=/^[^a-z]*$/,E=c("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Fe={number:"number",bigint:"bigint",object:"date"},xe=c("$ZodCheckLessThan",(e,t)=>{E.init(e,t);const n=Fe[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?r.value<=t.value:r.value{E.init(e,t);const n=Fe[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Rn=c("$ZodCheckMultipleOf",(e,t)=>{E.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Lt(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})}}),Ln=c("$ZodCheckNumberFormat",(e,t)=>{E.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=Ut[t.format];e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,a.minimum=i,a.maximum=o,n&&(a.pattern=An)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}ao&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Cn=c("$ZodCheckMaxLength",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const i=r.value;if(i.length<=t.maximum)return;const s=le(i);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:)DELIM" -R"DELIM(e,continue:!t.abort})}}),Fn=c("$ZodCheckMinLength",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const s=le(i);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),xn=c("$ZodCheckLengthEquals",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=r=>{const i=r.value,o=i.length;if(o===t.length)return;const s=le(i),a=o>t.length;r.issues.push({origin:s,...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})}}),H=c("$ZodCheckStringFormat",(e,t)=>{var n,r;E.init(e,t),e._zod.onattach.push(i=>{const o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),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=()=>{})}),Dn=c("$ZodCheckRegex",(e,t)=>{H.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})}}),Un=c("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Mn),H.init(e,t)}),Jn=c("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=jn),H.init(e,t)}),Kn=c("$ZodCheckIncludes",(e,t)=>{E.init(e,t);const n=W(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(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})}}),Vn=c("$ZodCheckStartsWith",(e,t)=>{E.init(e,t);const n=new RegExp(`^${W(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(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})}}),Wn=c("$ZodCheckEndsWith",(e,t)=>{E.init(e,t);const n=new RegExp(`.*${W(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(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})}}),Bn=c("$ZodCheckOverwrite",(e,t)=>{E.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Gn{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`\n`).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),o=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of o)this.content.push(s)}compile(){const t=Function,n=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,i.join(`\n`))}}const qn={major:4,minor:4,patch:3},w=c("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qn;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const o of i._zod.onattach)o(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,a,u)=>{let l=R(s),h;for(const m of a){if(m._zod.def.when){if(Ht(s)||!m._zod.def.when(s))continue}else if(l)continue;const p=s.issues.length,d=m._zod.check(s);if(d instanceof Promise&&u?.async===!1)throw new j;if(h||d instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await d,s.issues.length!==p&&(l||(l=R(s,p)))});else{if(s.issues.length===p)continue;l||(l=R(s,p))}}return h?h.then(()=>s):s},o=(s,a,u)=>{if(R(s))return s.aborted=!0,s;const l=i(a,r,u);if(l instanceof Promise){if(u.async===!1)throw new j;return l.then(h=>e._zod.parse(h,u))}return e._zod.parse(l,u)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const l=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(h=>o(h,s,a)):o(l,s,a)}const u=e._zod.parse(s,a);if(u instanceof Promise){if(a.async===!1)throw new j;return u.then(l=>i(l,r,a))}return i(u,r,a)}}g(e,"~standard",()=>({validate:i=>{try{const o=Qt(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return en(e,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),de=c("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Nn(e._zod.bag),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}}),v=c("$ZodStringFormat",(e,t)=>{H.init(e,t),de.init(e,t)}),Hn=c("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=_n),v.init(e,t)}),Yn=c("$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=je(r))}else t.pattern??(t.pattern=je());v.init(e,t)}),Xn=c("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=vn),v.init(e,t)}),Qn=c("$ZodURL",(e,t)=>{v.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===Zn.source&&!/^https?:\\/\\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),er=c("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=yn()),v.init(e,t)}),tr=c("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=mn),v.init(e,t)}),nr=c("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ln),v.init(e,t)}),rr=c("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=hn),v.init(e,t)}),ir=c("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fn),v.init(e,t)}),sr=c("$ZodXID",(e,t)=>{t.pattern??(t.pattern=dn),v.init(e,t)}),or=c("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=pn),v.init(e,t)}),ar=c("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Tn(t)),v.init(e,t)}),cr=c("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=In),v.init(e,t)}),ur=c("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=On(t)),v.init(e,t)}),lr=c("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=gn),v.init(e,t)}),hr=c("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wn),v.init(e,t),e._zod.bag.format="ipv4"}),fr=c("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=zn),v.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),dr=c("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=kn),v.init(e,t)}),pr=c("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=$n)DELIM" -R"DELIM(),v.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[i,o]=r;if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Ue(e){if(e==="")return!0;if(/\\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const mr=c("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Sn),v.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Ue(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function gr(e){if(!Re.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ue(n)}const _r=c("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Re),v.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{gr(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),vr=c("$ZodE164",(e,t)=>{t.pattern??(t.pattern=En),v.init(e,t)});function br(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 yr=c("$ZodJWT",(e,t)=>{v.init(e,t),e._zod.check=n=>{br(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Je=c("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=e._zod.bag.pattern??Pn,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 o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),wr=c("$ZodNumberFormat",(e,t)=>{Ln.init(e,t),Je.init(e,t)}),zr=c("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=n=>n}),kr=c("$ZodNever",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ke(e,t,n){e.issues.length&&t.issues.push(...Ne(n,e.issues)),t.value[n]=e.value}const $r=c("$ZodArray",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let s=0;sKe(l,n,s))):Ke(u,n,s)}return o.length?Promise.all(o).then(()=>n):n}});function Y(e,t,n,r,i,o){const s=n in r;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...Ne(n,e.issues))}if(!s&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?s&&(t.value[n]=void 0):t.value[n]=e.value}function Ve(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=Dt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function We(e,t,n,r,i,o){const s=[],a=i.keySet,u=i.catchall._zod,l=u.def.type,h=u.optin==="optional",m=u.optout==="optional";for(const p in t){if(p==="__proto__"||a.has(p))continue;if(l==="never"){s.push(p);continue}const d=u.run({value:t[p],issues:[]},r);d instanceof Promise?e.push(d.then(_=>Y(_,n,p,t,h,m))):Y(d,n,p,t,h,m)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const Sr=c("$ZodObject",(e,t)=>{if(w.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...a};return Object.defineProperty(t,"shape",{value:u}),u}})}const r=ae(()=>Ve(t));g(e._zod,"propValues",()=>{const a=t.shape,u={};for(const l in a){const h=a[l]._zod;if(h.values){u[l]??(u[l]=new Set);for(const m of h.values)u[l].add(m)}}return u});const i=V,o=t.catchall;let s;e._zod.parse=(a,u)=>{s??(s=r.value);const l=a.value;if(!i(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};const h=[],m=s.shape;for(const p of s.keys){const d=m[p],_=d._zod.optin==="optional",K=d._zod.optout==="optional",k=d._zod.run({value:l[p],issues:[]},u);k instanceof Promise?h.push(k.then(ke=>Y(ke,a,p,l,_,K))):Y(k,a,p,l,_,K)}return o?We(h,l,a,u,r.value,e):h.length?Promise.all(h).then(()=>a):a}}),Zr=c("$ZodObjectJIT",(e,t)=>{Sr.init(e,t);const n=e._zod.parse,r=ae(()=>Ve(t)),i=p=>{const d=new Gn(["shape","payload","ctx"]),_=r.value,K=O=>{const y=Ie(O);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};d.write("const input = payload.value;");const k=Object.create(null);let ke=0;for(const O of _.keys)k[O]=`key_${ke++}`;d.write("const newResult = {};");for(const O of _.keys){const y=k[O],S=Ie(O),jt=p[O],Rt=jt?._zod?.optin==="optional",Bo=jt?._zod?.optout==="optional";d.write(`const ${y} = ${K(O)};`),Rt&&Bo?d.write(`\n if (${y}.issues.length) {\n if (${S} in input) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n }\n \n if (${y}.value === undefined) {\n if (${S} in input) {\n newResult[${S}] = undefined;\n }\n } else {\n newResult[${S}] = ${y}.value;\n }\n \n `):Rt?d.write(`\n if (${y}.issues.length) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n \n if (${y}.value === undefined) {\n if (${S} in input) {\n newResult[${S}] = undefined;\n }\n } else {\n newResult[${S}] = ${y}.value;\n }\n \n `):d.write(`\n const ${y}_present = ${S} in input;\n if (${y}.issues.length) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n if (!${y}_present && !${y}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${S}]\n });\n }\n\n if (${y}_present) {\n if (${y}.value === undefined) {\n newResult[${S}] = undefined;\n } else {\n newResult[${S}] = ${y}.value;\n }\n }\n\n `)}d.write("payload.value = newResult;"),d.write("return payload;");const Wo=d.compile();return(O,y)=>Wo(p,O,y)};let o;const s=V,a=!se.jitless,l=a&&Ft.value,h=t.catchall;let m;e._zod.parse=(p,d)=>{m??(m=r.value);const _=p.value;return s(_)?a&&l&&d?.async===!1&&d.jitless!==!0?(o||(o=i(t.shape)),p=o(p,d),h?We([],_,p,d,m,e):p):n(p,d):(p.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),p)}});function Be(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const i=e.filter(o=>!R(o));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(o=>o.issues.map(s=>M(s,r,A())))}),t)}const Er=c("$ZodUnion",(e,t)=>{w.init(e,t),g(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),g(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),g(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),g(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>ue(i.source)).join(")DELIM" -R"DELIM(|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1;const s=[];for(const a of t.options){const u=a._zod.run({value:r.value,issues:[]},i);if(u instanceof Promise)s.push(u),o=!0;else{if(u.issues.length===0)return u;s.push(u)}}return o?Promise.all(s).then(a=>Be(a,r,e,i)):Be(s,r,e,i)}}),Ir=c("$ZodIntersection",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,o=t.left._zod.run({value:i,issues:[]},r),s=t.right._zod.run({value:i,issues:[]},r);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([u,l])=>Ge(n,u,l)):Ge(n,o,s)}});function pe(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(F(e)&&F(t)){const n=Object.keys(t),r=Object.keys(e).filter(o=>n.indexOf(o)!==-1),i={...e,...t};for(const o of r){const s=pe(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.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;ra.l&&a.r).map(([a])=>a);if(o.length&&i&&e.issues.push({...i,keys:o}),R(e))return e;const s=pe(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Or=c("$ZodEnum",(e,t)=>{w.init(e,t);const n=Ze(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(i=>xt.has(typeof i)).map(i=>typeof i=="string"?W(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{const s=i.value;return r.has(s)||i.issues.push({code:"invalid_value",values:n,input:s,inst:e}),i}}),Tr=c("$ZodTransform",(e,t)=>{w.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Se(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(n.value=s,n.fallback=!0,n));if(i instanceof Promise)throw new j;return n.value=i,n.fallback=!0,n}});function qe(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const He=c("$ZodOptional",(e,t)=>{w.init(e,t),e._zod.optin="optional",e._zod.optout="optional",g(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),g(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ue(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const i=n.value,o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>qe(s,i)):qe(o,i)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Nr=c("$ZodExactOptional",(e,t)=>{He.init(e,t),g(e._zod,"values",()=>t.innerType._zod.values),g(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Ar=c("$ZodNullable",(e,t)=>{w.init(e,t),g(e._zod,"optin",()=>t.innerType._zod.optin),g(e._zod,"optout",()=>t.innerType._zod.optout),g(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ue(n.source)}|null)$`):void 0}),g(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Pr=c("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"values",()=>t.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(o=>Ye(o,t)):Ye(i,t)}});function Ye(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Mr=c("$ZodPrefault",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"values",()=>t.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))}),jr=c("$ZodNonOptional",(e,t)=>{w.init(e,t),g(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Xe(o,e)):Xe(i,e)}});function Xe(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Rr=c("$ZodCatch",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"optout",()=>t.innerType._zod.optout),g(e._zod,"values",()=>t.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(n,r);return i instanceof Promise?i.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>M(s,r,A()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(o=>M(o,r,A()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Lr=c("$ZodPipe",(e,t)=>{w.init(e,t),g(e._zod,"values",()=>t.in._zod.values),g(e._zod,"optin",()=>t.in._zod.optin),g(e._zod,"optout",()=>t.out._zod.optout),g(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const o=t.out._zod.run(n,r);return o instanceof Promise?o.then(s=>X(s,t.in,r)):X(o,t.in,r)}const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(o=>X(o,t.out,r)):X(i,t.out,r)}});function X(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Cr=c("$ZodReadonly",(e,t)=>{w.init(e,t),g(e._zod,"propValues",()=>t.innerType._zod.propValues),g(e._zod,"values",()=>t.innerType._zod.values),g(e._zod,"optin",()=>t.innerType?._zod?.optin),g(e._zod,"optout",()=>t.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(Qe):Qe(i)}});function Qe(e){return e.value=Object.freeze(e.value),e}const Fr=c("$ZodCustom",(e,t)=>{E.init(e,t),w.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(o=>et(o,n,r,e));et(i,n,r,e)}});function et(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(x(i))}}var tt;class xr{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 Dr(){return new xr}(tt=globalThis).__zod_globalRegistry??(tt.__zod_globalRegistry=Dr());const D=globalThis.__zod_globalRegistry;function Ur(e,t){return new e({type:"string",...f(t)})}function Jr(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...f(t)})}function nt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...f(t)})}function Kr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...f(t)})}function Vr(e,t){return new e({type:"string",format:"uuid",check:"string_)DELIM" -R"DELIM(format",abort:!1,version:"v4",...f(t)})}function Wr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f(t)})}function Br(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f(t)})}function Gr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...f(t)})}function qr(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...f(t)})}function Hr(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...f(t)})}function Yr(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...f(t)})}function Xr(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...f(t)})}function Qr(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...f(t)})}function ei(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...f(t)})}function ti(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...f(t)})}function ni(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...f(t)})}function ri(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...f(t)})}function ii(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f(t)})}function si(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f(t)})}function oi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...f(t)})}function ai(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...f(t)})}function ci(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...f(t)})}function ui(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...f(t)})}function li(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(t)})}function hi(e,t){return new e({type:"string",format:"date",check:"string_format",...f(t)})}function fi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...f(t)})}function di(e,t){return new e({type:"string",format:"duration",check:"string_format",...f(t)})}function pi(e,t){return new e({type:"number",checks:[],...f(t)})}function mi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...f(t)})}function gi(e){return new e({type:"unknown"})}function _i(e,t){return new e({type:"never",...f(t)})}function rt(e,t){return new xe({check:"less_than",...f(t),value:e,inclusive:!1})}function me(e,t){return new xe({check:"less_than",...f(t),value:e,inclusive:!0})}function it(e,t){return new De({check:"greater_than",...f(t),value:e,inclusive:!1})}function ge(e,t){return new De({check:"greater_than",...f(t),value:e,inclusive:!0})}function st(e,t){return new Rn({check:"multiple_of",...f(t),value:e})}function ot(e,t){return new Cn({check:"max_length",...f(t),maximum:e})}function Q(e,t){return new Fn({check:"min_length",...f(t),minimum:e})}function at(e,t){return new xn({check:"length_equals",...f(t),length:e})}function vi(e,t){return new Dn({check:"string_format",format:"regex",...f(t),pattern:e})}function bi(e){return new Un({check:"string_format",format:"lowercase",...f(e)})}function yi(e){return new Jn({check:"string_format",format:"uppercase",...f(e)})}function wi(e,t){return new Kn({check:"string_format",format:"includes",...f(t),includes:e})}function zi(e,t){return new Vn({check:"string_format",format:"starts_with",...f(t),prefix:e})}function ki(e,t){return new Wn({check:"string_format",format:"ends_with",...f(t),suffix:e})}function L(e){return new Bn({check:"overwrite",tx:e})}function $i(e){return L(t=>t.normalize(e))}function Si(){return L(e=>e.trim())}function Zi(){return L(e=>e.toLowerCase())}function Ei(){return L(e=>e.toUpperCase())}function Ii(){return L(e=>Ct(e))}function Oi(e,t,n){return new e({type:"array",element:t,...f(n)})}function Ti(e,t,n){return new e({type:"custom",check:"custom",fn:t,...f(n)})}function Ni(e,t){const n=Ai(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(x(i,r.value,n._zod.def));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),r.issues.push(x(o))}},e(r.value,r)),t);return n}function Ai(e,t){const n=new E({check:"custom",...f(t)});return n._zod.check=e,n}function ct(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??D,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function $(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const h={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,h);else{const p=s.schema,d=t.processors[i.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);d(e,t,p,h)}const m=e._zod.parent;m&&(s.ref||(s.ref=m),$(m,t,h),t.seen.get(m).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&Z(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ut(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const s of e.seen.entries()){const a=e.metadataRegistry.get(s[0])?.id;if(a){const u=r.get(a);if(u&&u!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}const i=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const m=e.external.registry.get(s[0])?.id,p=e.external.uri??(_=>_);if(m)return{ref:p(m)};const d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${p("__shared")}#/${a}/${d}`}}if(s[1]===n)return{ref:"#"};const l=`#/${a}/`,h=s[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:l+h}},o=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:u,defId:l}=i(s);a.def={...a.schema},l&&(a.defId=l);const h=a.schema;for(const m in h)delete h[m];h.$ref=u};if(e.cycles==="throw")for(const s of e.seen.entries()){const a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/\n\nSet the \\`cycles\\` parameter to \\`"ref"\\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){o(s);continue}if(e.external){const l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}}function lt(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const u=e.seen.get(a);if(u.ref===null)return;const l=u.def??u.schema,h={...l},m=u.ref;if(u.ref=null,m){r(m);const d=e.seen.get(m),_=d.schema;if(_.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(_)):Object.assign(l,_),Object.assign(l,h),a._zod.parent===m)for(const k in l)k==="$ref"||k==="allOf"||k in h||delete l[k];if(_.$ref&&d.def)for(const k in l)k==="$ref"||k==="allOf"||k in d.def&&JSON.stringify(l[k])===JSON.stringify(d.def[k])&&delete l[k]}const p=a._zod.parent;if(p&&p!==m){r(p);const d=e.seen.get(p);if(d?.schema.$ref&&()DELIM" -R"DELIM(l.$ref=d.schema.$ref,d.def))for(const _ in l)_==="$ref"||_==="allOf"||_ in d.def&&JSON.stringify(l[_])===JSON.stringify(d.def[_])&&delete l[_]}e.override({zodSchema:a,jsonSchema:l,path:u.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);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 a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;o!==void 0&&i.id===o&&delete i.id;const s=e.external?.defs??{};for(const a of e.seen.entries()){const u=a[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,s[u.defId]=u.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:ee(t,"input",e.processors),output:ee(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Z(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 Z(r.element,n);if(r.type==="set")return Z(r.valueType,n);if(r.type==="lazy")return Z(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")return Z(r.innerType,n);if(r.type==="intersection")return Z(r.left,n)||Z(r.right,n);if(r.type==="record"||r.type==="map")return Z(r.keyType,n)||Z(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Z(r.in,n)||Z(r.out,n);if(r.type==="object"){for(const i in r.shape)if(Z(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Z(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Z(i,n))return!0;return!!(r.rest&&Z(r.rest,n))}return!1}const Pi=(e,t={})=>n=>{const r=ct({...n,processors:t});return $(e,r),ut(r,e),lt(r,e)},ee=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=ct({...i??{},target:o,io:t,processors:n});return $(e,s),ut(s,e),lt(s,e)},Mi={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ji=(e,t,n,r)=>{const i=n;i.type="string";const{minimum:o,maximum:s,format:a,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=Mi[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),l&&(i.contentEncoding=l),u&&u.size>0){const h=[...u];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Ri=(e,t,n,r)=>{const i=n,{minimum:o,maximum:s,format:a,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:h}=e._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";const m=typeof h=="number"&&h>=(o??Number.NEGATIVE_INFINITY),p=typeof l=="number"&&l<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";m?d?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h:typeof o=="number"&&(i.minimum=o),p?d?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof s=="number"&&(i.maximum=s),typeof u=="number"&&(i.multipleOf=u)},Li=(e,t,n,r)=>{n.not={}},Ci=(e,t,n,r)=>{},Fi=(e,t,n,r)=>{const i=e._zod.def,o=Ze(i.entries);o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),n.enum=o},xi=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Di=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ui=(e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=$(o.element,t,{...r,path:[...r.path,"items"]})},Ji=(e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const l in s)i.properties[l]=$(s[l],t,{...r,path:[...r.path,"properties",l]});const a=new Set(Object.keys(s)),u=new Set([...a].filter(l=>{const h=o.shape[l]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));u.size>0&&(i.required=Array.from(u)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=$(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Ki=(e,t,n,r)=>{const i=e._zod.def,o=i.inclusive===!1,s=i.options.map((a,u)=>$(a,t,{...r,path:[...r.path,o?"oneOf":"anyOf",u]}));o?n.oneOf=s:n.anyOf=s},Vi=(e,t,n,r)=>{const i=e._zod.def,o=$(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=$(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,u=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=u},Wi=(e,t,n,r)=>{const i=e._zod.def,o=$(i.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Bi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType},Gi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},qi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Hi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},Yi=(e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?i.out:i.in:i.out;$(s,t,r);const a=t.seen.get(e);a.ref=s},Xi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,n.readOnly=!0},ht=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType},Qi=c("ZodISODateTime",(e,t)=>{ar.init(e,t),b.init(e,t)});function es(e){return li(Qi,e)}const ts=c("ZodISODate",(e,t)=>{cr.init(e,t),b.init(e,t)});function ns(e){return hi(ts,e)}const rs=c("ZodISOTime",(e,t)=>{ur.init(e,t),b.init(e,t)});function is(e){return fi(rs,e)}const ss=c("ZodISODuration",(e,t)=>{lr.init(e,t),b.init(e,t)});function os(e){return di(ss,e)}const I=c("ZodError",(e,t)=>{Pe.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Xt(e,n)},flatten:{value:n=>Yt(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,oe,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,oe,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),as=he(I),cs=fe(I),us=G(I),ls=q(I),hs=tn(I),fs=nn(I),ds=rn(I),ps=sn(I),ms=on(I),gs=an(I),_s=cn(I),vs=un(I),ft=new WeakMap;function U(e,t,n){const r=Object.getPrototypeOf(e);let i=ft.get(r);if(i||(i=new Set,ft.set(r,i)),!i.has(t)){i.add(t);for(const o in n){const s=n[o];Object.defineProperty(r,o,{configurable:!0,enumerable:!1,get(){const a=s.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const z=c("ZodType",(e,t)=>(w.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ee(e,"input"),output:ee(e,"output")}}),e.toJSONSchema=Pi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>as(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>us(e,n,r),e.parseAsync=async(n,r)=>cs(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>ls(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>h)DELIM" -R"DELIM(s(e,n,r),e.decode=(n,r)=>fs(e,n,r),e.encodeAsync=async(n,r)=>ds(e,n,r),e.decodeAsync=async(n,r)=>ps(e,n,r),e.safeEncode=(n,r)=>ms(e,n,r),e.safeDecode=(n,r)=>gs(e,n,r),e.safeEncodeAsync=async(n,r)=>_s(e,n,r),e.safeDecodeAsync=async(n,r)=>vs(e,n,r),U(e,"ZodType",{check(...n){const r=this.def;return this.clone(T(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return N(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(ho(n,r))},superRefine(n,r){return this.check(fo(n,r))},overwrite(n){return this.check(L(n))},optional(){return yt(this)},exactOptional(){return Xs(this)},nullable(){return wt(this)},nullish(){return yt(wt(this))},nonoptional(n){return io(this,n)},array(){return Js(this)},or(n){return vt([this,n])},and(n){return Bs(this,n)},transform(n){return kt(this,Hs(n))},default(n){return to(this,n)},prefault(n){return ro(this,n)},catch(n){return oo(this,n)},pipe(n){return kt(this,n)},readonly(){return uo(this)},describe(n){const r=this.clone();return D.add(r,{description:n}),r},meta(...n){if(n.length===0)return D.get(this);const r=this.clone();return D.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return D.get(e)?.description},configurable:!0}),e)),dt=c("_ZodString",(e,t)=>{de.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>ji(e,r,i);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,U(e,"_ZodString",{regex(...r){return this.check(vi(...r))},includes(...r){return this.check(wi(...r))},startsWith(...r){return this.check(zi(...r))},endsWith(...r){return this.check(ki(...r))},min(...r){return this.check(Q(...r))},max(...r){return this.check(ot(...r))},length(...r){return this.check(at(...r))},nonempty(...r){return this.check(Q(1,...r))},lowercase(r){return this.check(bi(r))},uppercase(r){return this.check(yi(r))},trim(){return this.check(Si())},normalize(...r){return this.check($i(...r))},toLowerCase(){return this.check(Zi())},toUpperCase(){return this.check(Ei())},slugify(){return this.check(Ii())}})}),bs=c("ZodString",(e,t)=>{de.init(e,t),dt.init(e,t),e.email=n=>e.check(Jr(ws,n)),e.url=n=>e.check(Gr(zs,n)),e.jwt=n=>e.check(ui(Ls,n)),e.emoji=n=>e.check(qr(ks,n)),e.guid=n=>e.check(nt(pt,n)),e.uuid=n=>e.check(Kr(te,n)),e.uuidv4=n=>e.check(Vr(te,n)),e.uuidv6=n=>e.check(Wr(te,n)),e.uuidv7=n=>e.check(Br(te,n)),e.nanoid=n=>e.check(Hr($s,n)),e.guid=n=>e.check(nt(pt,n)),e.cuid=n=>e.check(Yr(Ss,n)),e.cuid2=n=>e.check(Xr(Zs,n)),e.ulid=n=>e.check(Qr(Es,n)),e.base64=n=>e.check(oi(Ms,n)),e.base64url=n=>e.check(ai(js,n)),e.xid=n=>e.check(ei(Is,n)),e.ksuid=n=>e.check(ti(Os,n)),e.ipv4=n=>e.check(ni(Ts,n)),e.ipv6=n=>e.check(ri(Ns,n)),e.cidrv4=n=>e.check(ii(As,n)),e.cidrv6=n=>e.check(si(Ps,n)),e.e164=n=>e.check(ci(Rs,n)),e.datetime=n=>e.check(es(n)),e.date=n=>e.check(ns(n)),e.time=n=>e.check(is(n)),e.duration=n=>e.check(os(n))});function ys(e){return Ur(bs,e)}const b=c("ZodStringFormat",(e,t)=>{v.init(e,t),dt.init(e,t)}),ws=c("ZodEmail",(e,t)=>{Xn.init(e,t),b.init(e,t)}),pt=c("ZodGUID",(e,t)=>{Hn.init(e,t),b.init(e,t)}),te=c("ZodUUID",(e,t)=>{Yn.init(e,t),b.init(e,t)}),zs=c("ZodURL",(e,t)=>{Qn.init(e,t),b.init(e,t)}),ks=c("ZodEmoji",(e,t)=>{er.init(e,t),b.init(e,t)}),$s=c("ZodNanoID",(e,t)=>{tr.init(e,t),b.init(e,t)}),Ss=c("ZodCUID",(e,t)=>{nr.init(e,t),b.init(e,t)}),Zs=c("ZodCUID2",(e,t)=>{rr.init(e,t),b.init(e,t)}),Es=c("ZodULID",(e,t)=>{ir.init(e,t),b.init(e,t)}),Is=c("ZodXID",(e,t)=>{sr.init(e,t),b.init(e,t)}),Os=c("ZodKSUID",(e,t)=>{or.init(e,t),b.init(e,t)}),Ts=c("ZodIPv4",(e,t)=>{hr.init(e,t),b.init(e,t)}),Ns=c("ZodIPv6",(e,t)=>{fr.init(e,t),b.init(e,t)}),As=c("ZodCIDRv4",(e,t)=>{dr.init(e,t),b.init(e,t)}),Ps=c("ZodCIDRv6",(e,t)=>{pr.init(e,t),b.init(e,t)}),Ms=c("ZodBase64",(e,t)=>{mr.init(e,t),b.init(e,t)}),js=c("ZodBase64URL",(e,t)=>{_r.init(e,t),b.init(e,t)}),Rs=c("ZodE164",(e,t)=>{vr.init(e,t),b.init(e,t)}),Ls=c("ZodJWT",(e,t)=>{yr.init(e,t),b.init(e,t)}),mt=c("ZodNumber",(e,t)=>{Je.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>Ri(e,r,i),U(e,"ZodNumber",{gt(r,i){return this.check(it(r,i))},gte(r,i){return this.check(ge(r,i))},min(r,i){return this.check(ge(r,i))},lt(r,i){return this.check(rt(r,i))},lte(r,i){return this.check(me(r,i))},max(r,i){return this.check(me(r,i))},int(r){return this.check(gt(r))},safe(r){return this.check(gt(r))},positive(r){return this.check(it(0,r))},nonnegative(r){return this.check(ge(0,r))},negative(r){return this.check(rt(0,r))},nonpositive(r){return this.check(me(0,r))},multipleOf(r,i){return this.check(st(r,i))},step(r,i){return this.check(st(r,i))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function C(e){return pi(mt,e)}const Cs=c("ZodNumberFormat",(e,t)=>{wr.init(e,t),mt.init(e,t)});function gt(e){return mi(Cs,e)}const Fs=c("ZodUnknown",(e,t)=>{zr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ci()});function _t(){return gi(Fs)}const xs=c("ZodNever",(e,t)=>{kr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Li(e,n,r)});function Ds(e){return _i(xs,e)}const Us=c("ZodArray",(e,t)=>{$r.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ui(e,n,r,i),e.element=t.element,U(e,"ZodArray",{min(n,r){return this.check(Q(n,r))},nonempty(n){return this.check(Q(1,n))},max(n,r){return this.check(ot(n,r))},length(n,r){return this.check(at(n,r))},unwrap(){return this.element}})});function Js(e,t){return Oi(Us,e,t)}const Ks=c("ZodObject",(e,t)=>{Zr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ji(e,n,r,i),g(e,"shape",()=>t.shape),U(e,"ZodObject",{keyof(){return Gs(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:_t()})},loose(){return this.clone({...this._zod.def,catchall:_t()})},strict(){return this.clone({...this._zod.def,catchall:Ds()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Vt(this,n)},safeExtend(n){return Wt(this,n)},merge(n){return Bt(this,n)},pick(n){return Jt(this,n)},omit(n){return Kt(this,n)},partial(...n){return Gt(bt,this,n[0])},required(...n){return qt(zt,this,n[0])}})});function _e(e,t){const n={type:"object",shape:e??{},...f(t)};return new Ks(n)}const Vs=c("ZodUnion",(e,t)=>{Er.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ki(e,n,r,i),e.options=t.options});function vt(e,t){return new Vs({type:"union",options:e,...f(t)})}const Ws=c("ZodIntersection",(e,t)=>{Ir.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Vi(e,n,r,i)});function Bs(e,t){return new Ws({type:"intersection",left:e,right:t})}const ve=c("ZodEnum",(e,t)=>{Or.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>Fi(e,r,i),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const o={};for(const s of r)if(n.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new ve({...t,checks:[],...f(i),entries:o})},e.exclude=(r,i)=>{const o={...t.entries};for(const s of r)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new ve({...t,checks:[],...f(i),entries:o})}});function Gs(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ve({type:"enum",entries:n,...f(t)})}const qs=c("ZodTransform",(e,t)=>{Tr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Di(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Se(e.construc)DELIM" -R"DELIM(tor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(x(o,n.value,t));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(x(s))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(o=>(n.value=o,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Hs(e){return new qs({type:"transform",transform:e})}const bt=c("ZodOptional",(e,t)=>{He.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ht(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function yt(e){return new bt({type:"optional",innerType:e})}const Ys=c("ZodExactOptional",(e,t)=>{Nr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ht(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Xs(e){return new Ys({type:"optional",innerType:e})}const Qs=c("ZodNullable",(e,t)=>{Ar.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Wi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function wt(e){return new Qs({type:"nullable",innerType:e})}const eo=c("ZodDefault",(e,t)=>{Pr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Gi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function to(e,t){return new eo({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Te(t)}})}const no=c("ZodPrefault",(e,t)=>{Mr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>qi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function ro(e,t){return new no({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Te(t)}})}const zt=c("ZodNonOptional",(e,t)=>{jr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Bi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function io(e,t){return new zt({type:"nonoptional",innerType:e,...f(t)})}const so=c("ZodCatch",(e,t)=>{Rr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Hi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function oo(e,t){return new so({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const ao=c("ZodPipe",(e,t)=>{Lr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Yi(e,n,r,i),e.in=t.in,e.out=t.out});function kt(e,t){return new ao({type:"pipe",in:e,out:t})}const co=c("ZodReadonly",(e,t)=>{Cr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Xi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function uo(e){return new co({type:"readonly",innerType:e})}const lo=c("ZodCustom",(e,t)=>{Fr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>xi(e,n)});function ho(e,t={}){return Ti(lo,e,t)}function fo(e,t){return Ni(e,t)}const ne=[{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"}],be=[{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:"count"},{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:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],$t=_e({level:C().int().nonnegative(),time:C().int().nonnegative(),message:ys()}),St=_e({event:C().int().nonnegative(),value:C().nonnegative(),time:C().int().nonnegative()}),Zt=_e({previous:C().nonnegative()});vt([$t,St,Zt]);const po=2**ne.length-1,Et=2**be.length-1;function It(e,t){return Number.isInteger(t)&&t>=0&&tnew WebSocket(n))},this.#c=this.#e.retryMinimumMs}getStatus=()=>this.#t;subscribeStatus=t=>(this.#r.add(t),()=>{this.#r.delete(t)});start(){this.#o||(this.#o=!0,this.#c=this.#e.retryMinimumMs,this.#h())}stop(){this.#o=!1,this.#g();const t=this.#n;if(this.#n=null,t)try{t.readyState===1&&this.#e.onBeforeStop?.(t),t.close()}catch{}this.#u(Tt)}send(t){if(this.#n?.re)DELIM" -R"DELIM(adyState!==1)return!1;try{return this.#n.send(t),!0}catch{return!1}}#h(){if(!this.#o||this.#n)return;const t=this.#t.reconnects>0;this.#u({...this.#t,phase:t?"reconnecting":"connecting",attempt:this.#t.attempt+1,error:null});let n;try{n=this.#e.webSocketFactory(this.#e.url),this.#n=n}catch(r){this.#u({...this.#t,error:$o(r)}),this.#d();return}this.#s=setTimeout(()=>{if(this.#n===n){this.#u({...this.#t,error:"Connection timed out"});try{n.close()}catch{this.#n=null,this.#d()}}},this.#e.connectTimeoutMs),n.addEventListener("open",()=>{this.#n!==n||!this.#o||(this.#p(),this.#c=this.#e.retryMinimumMs,this.#u({...this.#t,phase:"connected",connectedAt:this.#e.now(),error:null}),this.#e.onOpen?.(n),this.#m(n))}),n.addEventListener("message",r=>{if(this.#n!==n||!this.#o)return;const i=ko(r.data);if(i===null)return;const o=this.#e.now();(this.#t.lastMessageAt===null||o-this.#t.lastMessageAt>=1e3)&&this.#u({...this.#t,lastMessageAt:o}),this.#e.onMessage(i)}),n.addEventListener("error",()=>{if(!(this.#n!==n||!this.#o)){this.#u({...this.#t,error:"WebSocket connection failed"});try{n.close()}catch{this.#n=null,this.#d()}}}),n.addEventListener("close",()=>{this.#n===n&&(this.#n=null,this.#p(),this.#l(),this.#o&&this.#d())})}#d(){if(!this.#o||this.#i)return;const t=1+(this.#e.random()*2-1)*this.#e.jitterRatio,n=Math.max(0,Math.round(this.#c*t));this.#c=Math.min(this.#c*2,this.#e.retryMaximumMs),this.#u({...this.#t,phase:"reconnecting",reconnects:this.#t.reconnects+1,connectedAt:null}),this.#i=setTimeout(()=>{this.#i=null,this.#h()},n)}#m(t){this.#l(),!(!this.#e.onHeartbeat||this.#e.heartbeatMs<=0)&&(this.#a=setInterval(()=>{this.#n===t&&t.readyState===1&&this.#e.onHeartbeat?.(t)},this.#e.heartbeatMs))}#p(){this.#s&&(clearTimeout(this.#s),this.#s=null)}#l(){this.#a&&(clearInterval(this.#a),this.#a=null)}#g(){this.#p(),this.#l(),this.#i&&(clearTimeout(this.#i),this.#i=null)}#u(t){this.#t=t;for(const n of this.#r)n()}}function ko(e){return typeof e=="string"?e:e instanceof ArrayBuffer?new TextDecoder().decode(e):null}function $o(e){return e instanceof Error?e.message:"Unable to create WebSocket"}class So{#e;#t;#n=new Set;#r=new Set;#s;constructor(t,n={}){this.#e=n.logFilter??po,this.#t=n.eventFilter??Et,this.#s=new zo({url:wo(t),webSocketFactory:n.webSocketFactory,retryMinimumMs:n.retryMinimumMs,retryMaximumMs:n.retryMaximumMs,jitterRatio:n.jitterRatio,onOpen:r=>{this.#i(r)},onHeartbeat:r=>{this.#i(r)},onBeforeStop:r=>{r.send("/v1/log/subscribe?filter=0"),r.send("/v1/event/subscribe?filter=0")},onMessage:r=>{const i=_o(r);if(!i){for(const o of this.#r)o(r);return}if(!(Ot(i)&&!It(this.#e,i.level)))for(const o of this.#n)o(i)}})}getStatus=()=>this.#s.getStatus();subscribeStatus=t=>this.#s.subscribeStatus(t);start(){this.#s.start()}stop(){this.#s.stop()}subscribeFrames(t){return this.#n.add(t),()=>{this.#n.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.#t!==n&&(this.#t=n,this.#s.send(`/v1/event/subscribe?filter=${String(n)}`))}#i(t){t.send(`/v1/log/subscribe?filter=${String(this.#e)}`),t.send(`/v1/event/subscribe?filter=${String(this.#t)}`)}}const J=["occurrence-rate","occurrence-count","cumulative-occurrences"],Zo=["payload-latest","payload-maximum","payload-change-rate",...J],Eo=["payload-average","payload-latest","payload-minimum","payload-maximum",...J],Io=["payload-sum","payload-cumulative","payload-latest","payload-average",...J];function Nt(e){return`event:${String(e)}`}function At(e){return`log:${String(e)}`}const we="native:top";function Oo(e){switch(e){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";default:return"unknown"}}function To(e){switch(e){case"height":return Zo;case"duration":return Eo;case"count":return Io;default:return J}}function No(e){switch(e){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function Ao(e){const t=ye(e),n=Oo(t.valueKind);return{id:Nt(e),source:"event",sourceId:e,name:t.name,label:t.label,category:t.category,payloadKind:n,allowedMeasures:To(n),defaultMeasure:No(n),description:n==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${t.label} event with a ${n} payload.`}}const Po=[...be.map(e=>Ao(e.id)),...ne.map(e=>({id:At(e.id),source:"log",sourceId:e.id,name:e.name,label:`${e.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:J,defaultMeasure:"occurrence-rate",description:`${e.label} log message volume. Message text is not interpreted as numeric data.`})),{id:we,source:"native",sourceId:"top",name:"canonical_top",label:"Canonical 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(Po.map(e=>[e.id,e]));function Mo(e,t){return bo(e,t)??t}const jo=3600*1e3,Ro=1e3,Lo=1e3,Co=1e3;class Pt{constructor(t){this.capacity=t,this.#e=Array.from({length:t})}capacity;#e;#t=0;#n=0;#r=null;get size(){return this.#n}push(t){const n=this.#n===this.capacity;return this.#r=null,this.#e[this.#t]=t,this.#t=(this.#t+1)%this.capacity,this.#n=Math.min(this.#n+1,this.capacity),n}clear(){this.#r=null,this.#e.fill(void 0),this.#t=0,this.#n=0}newestFirst(){if(this.#r)return this.#r;const t=[];for(let n=0;nthis.#T;getRecentLogs=()=>this.#r.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=t=>(this.#n.add(t),()=>{this.#n.delete(t)});start(){this.#v||(this.tick(),this.#v=setInterval(()=>{this.tick()},1e3))}stop(){this.#v&&(clearInterval(this.#v),this.#v=null),this.#f&&(clearTimeout(this.#f),this.#f=null)}ingest(t,n=this.#e()){const r=this.#b(n);this.#u+=1,Ot(t)?this.#M(t,r):mo(t)?this.#j(t,r):go(t)&&(this.#Z+=1),this.#w()}recordInvalidFrame(){this.#E+=1,this.#w()}recordNativeTop(t,n=this.#e()){const r=this.#b(n),i=this.#m[we];i?.value===t&&r-i.time<15e3||(this.#N(we,r,t),this.#A(r),this.#w())}clearLogs(){this.#$+=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.#a={},this.#c={},this.#o={},this.#h={},this.#d={},this.#m={},this.#p={},this.#l=this.#b(this.#e()),this.#u=0,this.#z=0,this.#k=0,this.#$=0,this.#S=0,this.#Z=0,this.#E=0,this.#I=null,this.#O=null,this.#_=0,this.#y(this.#l),this.flush()}tick(){const t=this.#b(this.#e());this.#y(t),this.#A(t),this.#w()}flush(){this.#f&&(clearTimeout(this.#f),this.#f=null),this.#T=this.#P();for(const t of this.#n)t()}#M(t,n){this.#z+=1,this.#I=n,this.#_+=1,this.#r.push({...t,id:this.#_,receivedAt:n})&&(this.#k+=1),this.#N(At(t.level),n,null)}#j(t,n){this.#S+=1,this.#O=n,this.#_+=1,this.#s.push({...t,id:this.#_,receivedAt:n}),this.#N(Nt(t.event),n,Mo(t.event,t.value))}#b(t){return Number.isFinite(t)?(this.#g=Math.max(this.#g,t),this.#g):this.#g}#N(t,n,r){const i=this.#y(n);i.snapshot=null;const o=i.signals.get(t)??Fo();if(o.count+=1,re(this.#h,t,1),r!==null){o.samples+=1,o.sum+=r,o.minimum=o.minimum===null?r:Math.min(o.minimum,r),o.maximum=o.maximum===null?r:Math.max(o.maximum,r),(o.firstAt===null||n=o.lastAt)&&(o.last=r,o.lastAt=n),re(this.#d,t,r);const s=this.#m[t];(!s||n>=s.time)&&(this.#m[t]={value:r,time:n}),this.#p[t]=Math.max(this.#p[t]??r,r)}i.signals.set(t,o)}#y(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};return this.#i.set(n,i),i}#A(t){const n=t-jo;for(const[r,i]of this.#i){if(r>=n)break;for(const[o,s]of i.signals)if(re(this.#a,o,s.count),re(this.#c,o,s.sum),s.last!==null&&s.lastAt!==null){const a=this.#o[o];(!a||s.lastAt>=a.time)&&(this.#o[o]={value:s.last,time:s.lastAt})}this.#i.delete(r)}}#w(){!this.#t||this.#f||(this.#f=setTimeout(()=>{this.#f=null,this.flush()},Ro))}#P(){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.#b(this.#e()),sessionStartedAt:this.#l,totalFrames:this.#u,totalLogs:this.#z,evictedLogs:this.#k,clearedLogs:this.#$,totalEvents:this.#S,totalAcks:this.#Z,invalidFrames:this.#E,buckets:t,priorSignalCounts:{...this.#a},priorSignalSums:{...this.#c},priorSignalLatest:Mt(this.#o),signalTotals:{...this.#h},signalSums:{...this.#d},signalLatest:Mt(this.#m),signalMaximums:{...this.#p},recentLogs:this.#r.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#I,lastEventAt:this.#O}}}const ie=40;function Do(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(s=>It(t.filter,s.level)&&(!n||s.message.toLowerCase().includes(n)||vo(s.level).name.includes(n))),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,o=Math.min(i,Math.max(0,r.length-ie));return{logs:r.slice(o,o+ie),retained:e.length,matched:r.length,offset:o}}function Uo(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(s=>{const a=ye(s.event);return(t.category==="all"||a.category===t.category)&&(!n||a.name.includes(n)||a.label.toLowerCase().includes(n)||String(s.value).includes(n))}),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,o=Math.min(i,Math.max(0,r.length-ie));return{events:r.slice(o,o+ie),retained:e.length,matched:r.length,offset:o}}function Jo(e,t){const{buckets:n,recentLogs:r,recentEvents:i,...o}=e,s=new Map(t?.buckets.map(a=>[a.time,a]));return{summary:o,reset:t===null,firstBucketTime:n[0]?.time??e.now,buckets:n.filter(a=>s.get(a.time)!==a),recentLogs:r===t?.recentLogs?null:r,recentEvents:i===t?.recentEvents?null:i}}class Ko{constructor(t,n=(i,o)=>new So(i,{logFilter:o}),r=Date.now){this.send=t,this.createClient=n,this.#e=new xo(r,!1)}send;createClient;#e;#t=null;#n=null;#r=0;#s=null;#i=null;#a=null;#c=[];handle(t){if(t.type==="stop"){this.#h(),this.#e.stop(),this.send({type:"stopped"});return}if(t.type==="configure"){if(t.generation{this.#e.ingest(n)}),this.#t.subscribeInvalidFrames(()=>{this.#e.recordInvalidFrame()})],this.#t.start(),this.#e.start()):this.#t.setFilters(t.logFilter,Et);return}if(t.type==="reset"){t.generation>=this.#r&&this.#o(t.generation);return}if(t.generation===this.#r)switch(t.type){case"pause-display":{t.stream==="logs"?this.#i=t.paused?this.#i??this.#e.getRecentLogs():null:this.#a=t.paused?this.#a??this.#e.getRecentEvents():null;break}case"poll-events":{this.send({type:"events",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Uo(this.#a??this.#e.getRecentEvents(),t.query)});break}case"poll-logs":{this.send({type:"logs",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Do(this.#i??this.#e.getRecentLogs(),t.query)});break}case"native-top":{this.#e.recordNativeTop(t.height,t.receivedAt);break}case"clear-logs":{this.#e.clearLogs(),this.#i!==null&&(this.#i=[]);break}case"clear-events":{this.#e.clearEvents(),this.#a!==null&&(this.#a=[]);break}case"poll":{if(!this.#t)return;this.#e.flush();const n=this.#e.getSnapshot();this.send({type:"snapshot",generation:this.#r,requestId:t.requestId,status:this.#t.getStatus(),update:Jo(n,this.#s)}),this.#s=n;break}}}#o(t){this.#r=t,this.#s=null,this.#i!==null&&(this.#i=[]),this.#a!==null&&(this.#a=[]),this.#e.reset()}#h(){for(const t of this.#c)t();this.#c=[],this.#t?.stop(),this.#t=null}}const ze=globalThis,Vo=new Ko(e=>{ze.postMessage(e)});ze.addEventListener("message",e=>{Vo.handle(e.data),e.data.type==="stop"&&ze.close()})})();\n',Wy=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Qb],{type:"text/javascript;charset=utf-8"});function oN(n){let i;try{if(i=Wy&&(self.URL||self.webkitURL).createObjectURL(Wy),!i)throw"";const s=new Worker(i,{name:n?.name});return s.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(i)}),s}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Qb),{name:n?.name})}}const e0=100;function cN(n,i){const s=new Map((i.reset?[]:n.buckets).filter(r=>r.time>=i.firstBucketTime).map(r=>[r.time,r]));for(const r of i.buckets)s.set(r.time,r);return{...i.summary,buckets:[...s.values()],recentLogs:Rc(i.reset?[]:n.recentLogs,i.recentLogs),recentEvents:Rc(i.reset?[]:n.recentEvents,i.recentEvents)}}function Rc(n,i){if(i===null)return n;const s=new Map(n.map(r=>[r.id,r]));return i.map(r=>s.get(r.id)??r)}const Eu={phase:"idle",attempt:0,reconnects:0,connectedAt:null,lastMessageAt:null,error:null};class fN{constructor(i=()=>new oN){this.createWorker=i}createWorker;#e=null;#t=new uy().getSnapshot();#n=Eu;#i=new Set;#s=new Set;#a=null;#r=or;#l=0;#o=0;#u=null;#m=null;#c=null;#d=new Set;#h={logs:[],retained:0,matched:0,offset:0};#p={search:"",filter:or,offset:0};#f=0;#y=null;#x=null;#g=new Set;#w={events:[],retained:0,matched:0,offset:0};#E={search:"",category:"all",offset:0};#z=0;#b=null;#T=!1;#A=!1;getSnapshot=()=>this.#t;getStatus=()=>this.#n;getLogWindow=()=>this.#h;getEventWindow=()=>this.#w;subscribeEvents=i=>(this.#g.add(i),this.#S(),this.#_(),()=>{this.#g.delete(i),this.#g.size===0&&this.#M()});subscribeLogs=i=>(this.#d.add(i),this.#N(),this.#D(),()=>{this.#d.delete(i),this.#d.size===0&&this.#O()});subscribe=i=>(this.#i.add(i),()=>{this.#i.delete(i)});subscribeStatus=i=>(this.#s.add(i),()=>{this.#s.delete(i)});configure(i,s){i===this.#a&&s===this.#r||(this.#a!==null&&i!==this.#a&&(this.reset(),this.#U({...Eu,phase:"connecting"})),this.#a=i,this.#r=s,this.#C())}start(){if(!(this.#e||this.#a===null))try{const i=this.createWorker();this.#e=i,this.#h={logs:[],retained:0,matched:0,offset:0},this.#w={events:[],retained:0,matched:0,offset:0};for(const s of this.#d)s();for(const s of this.#g)s();this.#U({...Eu,phase:"connecting"}),i.onmessage=s=>{if(this.#e!==i)return;const r=s.data;if(r.type==="events"){if(r.requestId!==this.#b||(this.#b=null,r.generation!==this.#l))return;if(r.queryVersion!==this.#z){this.#S();return}this.#w={...r.window,events:Rc(this.#w.events,r.window.events)};for(const o of this.#g)o();return}if(r.type==="logs"){if(r.requestId!==this.#y||(this.#y=null,r.generation!==this.#l))return;if(r.queryVersion!==this.#f){this.#N();return}this.#h={...r.window,logs:Rc(this.#h.logs,r.window.logs)};for(const o of this.#d)o();return}if(r.type==="snapshot"&&r.requestId===this.#u&&(this.#u=null,r.generation===this.#l)){this.#t=cN(this.#t,r.update),this.#U(r.status);for(const o of this.#i)o()}},i.onerror=()=>{this.#R("Telemetry worker failed. Reload the dashboard to reconnect.")},i.onmessageerror=()=>{this.#R("Unable to read telemetry worker data. Reload the dashboard to reconnect.")},this.#C(),this.#T&&this.#v({type:"pause-display",generation:this.#l,stream:"logs",paused:!0}),this.#A&&this.#v({type:"pause-display",generation:this.#l,stream:"events",paused:!0}),this.#j(),this.getStatus().error===null&&(this.#m=setInterval(()=>{this.#j()},1e3)),this.#D(),this.#_()}catch(i){this.#R(`Unable to start telemetry worker: ${i instanceof Error?i.message:String(i)}`)}}stop(){th)DELIM" -R"DELIM(is.#k();const i=this.#e;if(this.#e=null,i){const s=setTimeout(()=>{i.terminate()},500),r=()=>{clearTimeout(s),i.terminate()};i.onmessage=o=>{o.data.type==="stopped"&&r()},i.onerror=r,i.onmessageerror=r;try{i.postMessage({type:"stop"})}catch{r()}}this.#U(Eu)}recordNativeTop(i,s=Date.now()){this.#v({type:"native-top",generation:this.#l,height:i,receivedAt:s})}clearLogs(){this.#v({type:"clear-logs",generation:this.#l}),this.#f+=1,this.#N()}clearEvents(){this.#v({type:"clear-events",generation:this.#l}),this.#z+=1,this.#S()}setLogsPaused(i){i!==this.#T&&(this.#T=i,this.#O(),this.#v({type:"pause-display",generation:this.#l,stream:"logs",paused:i}),this.#f+=1,this.#N(),this.#D())}setEventsPaused(i){i!==this.#A&&(this.#A=i,this.#M(),this.#v({type:"pause-display",generation:this.#l,stream:"events",paused:i}),this.#z+=1,this.#S(),this.#_())}reset(){this.#l+=1,this.#u=null,this.#y=null,this.#b=null,this.#h={logs:[],retained:0,matched:0,offset:0},this.#w={events:[],retained:0,matched:0,offset:0},this.#t=new uy().getSnapshot(),this.#v({type:"reset",generation:this.#l});for(const i of this.#i)i();for(const i of this.#d)i();for(const i of this.#g)i()}setLogQuery(i){JSON.stringify(i)!==JSON.stringify(this.#p)&&(this.#p=i,this.#f+=1,this.#N())}setEventQuery(i){JSON.stringify(i)!==JSON.stringify(this.#E)&&(this.#E=i,this.#z+=1,this.#S())}#_(){!this.#e||this.#g.size===0||this.#x||this.#A||(this.#S(),this.getStatus().error===null&&(this.#x=setInterval(()=>{this.#S()},e0)))}#S(){this.#b!==null||!this.#e||this.#g.size===0||(this.#b=++this.#o,this.#v({type:"poll-events",generation:this.#l,requestId:this.#b,queryVersion:this.#z,query:this.#E}))}#M(){this.#x&&clearInterval(this.#x),this.#x=null,this.#b=null}#D(){!this.#e||this.#d.size===0||this.#c||this.#T||(this.#N(),this.getStatus().error===null&&(this.#c=setInterval(()=>{this.#N()},e0)))}#N(){this.#y!==null||!this.#e||this.#d.size===0||(this.#y=++this.#o,this.#v({type:"poll-logs",generation:this.#l,requestId:this.#y,queryVersion:this.#f,query:this.#p}))}#O(){this.#c&&clearInterval(this.#c),this.#c=null,this.#y=null}#C(){this.#a!==null&&this.#v({type:"configure",generation:this.#l,endpoint:this.#a,logFilter:this.#r})}#j(){this.#u!==null||!this.#e||(this.#u=++this.#o,this.#v({type:"poll",generation:this.#l,requestId:this.#u}))}#v(i){try{this.#e?.postMessage(i)}catch{this.#R("Unable to communicate with telemetry worker. Reload the dashboard to reconnect.")}}#k(){this.#O(),this.#M(),this.#m&&clearInterval(this.#m),this.#m=null,this.#u=null}#R(i){this.#k(),this.#e?.terminate(),this.#e=null,this.#U({...Eu,error:i})}#U(i){if(JSON.stringify(i)!==JSON.stringify(this.#n)){this.#n=i;for(const s of this.#s)s()}}}const Kb="libbitcoinAdminDashboardLogFilter";function Jb(){try{return globalThis.localStorage}catch{return null}}function dN(n=Jb()){try{const i=n?.getItem(Kb);if(!i)return or;const s=JSON.parse(i);return typeof s=="number"&&Number.isInteger(s)&&s>=0&&s<=Fh?s:or}catch{return or}}function hN(n,i=Jb()){try{i?.setItem(Kb,String(n))}catch{}}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(){}},mN=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"}},pm=new mN,pN={setTimeout:(n,i)=>setTimeout(n,i),clearTimeout:n=>clearTimeout(n),setInterval:(n,i)=>setInterval(n,i),clearInterval:n=>clearInterval(n)},gN=class{#e=pN;#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)}},os=new gN;function vN(n){setTimeout(n,0)}var yN=typeof window>"u"||"Deno"in globalThis;function Pn(){}function bN(n,i){return typeof n=="function"?n(i):n}function Eh(n){return typeof n=="number"&&n>=0&&n!==1/0}function Fb(n,i){return Math.max(n+(i||0)-Date.now(),0)}function Tl(n,i){return typeof n=="function"?n(i):n}function di(n,i){return typeof n=="function"?n(i):n}function t0(n,i){const{type:s="all",exact:r,fetchStatus:o,predicate:d,queryKey:f,stale:m}=n;if(f){if(r){if(i.queryHash!==gm(f,i.options))return!1}else if(!vr(i.queryKey,f))return!1}if(s!=="all"){const g=i.isActive();if(s==="active"&&!g||s==="inactive"&&g)return!1}return!(typeof m=="boolean"&&i.isStale()!==m||o&&o!==i.state.fetchStatus||d&&!d(i))}function n0(n,i){const{exact:s,status:r,predicate:o,mutationKey:d}=n;if(d){if(!i.options.mutationKey)return!1;if(s){if(Uu(i.options.mutationKey)!==Uu(d))return!1}else if(!vr(i.options.mutationKey,d))return!1}return!(r&&i.state.status!==r||o&&!o(i))}function gm(n,i){return(i?.queryKeyHashFn||Uu)(n)}function Uu(n){return JSON.stringify(n,(i,s)=>Ah(s)?Object.keys(s).sort().reduce((r,o)=>(r[o]=s[o],r),{}):s)}function vr(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)){for(let r=0;r500)return i;const r=i0(n)&&i0(i);if(!r&&!(Ah(n)&&Ah(i)))return i;const d=(r?n:Object.keys(n)).length,f=r?i:Object.keys(i),m=f.length,g=r?new Array(m):{};let v=0;for(let w=0;w{os.setTimeout(i,n)})}function Nh(n,i,s){return typeof s.structuralSharing=="function"?s.structuralSharing(n,i):s.structuralSharing!==!1?Xb(n,i):i}function xN(n,i,s=0){const r=[...n,i];return s&&r.length>s?r.slice(1):r}function wN(n,i,s=0){const r=[i,...n];return s&&r.length>s?r.slice(0,-1):r}var vm=Symbol();function Ib(n,i){return!n.queryFn&&i?.initialPromise?()=>i.initialPromise:!n.queryFn||n.queryFn===vm?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function Pb(n,i){return typeof n=="function"?n(...i):!!n}function zN(n,i,s){let r=!1,o;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(o??=i(),r||(r=!0,o.aborted?s():o.addEventListener("abort",s,{once:!0})),o)}),n}var Zu=(()=>{let n=()=>yN;return{isServer(){return n()},setIsServer(i){n=i}}})();function Oh(){let n,i;const s=new Promise((o,d)=>{n=o,i=d});s.status="pending",s.catch(()=>{});function r(o){Object.assign(s,o),delete s.resolve,delete s.reject}return s.resolve=o=>{r({status:"fulfilled",value:o}),n(o)},s.reject=o=>{r({status:"rejected",reason:o}),i(o)},s}var EN=vN;function TN(){let n=[],i=0,s=m=>{m()},r=m=>{m()},o=EN;const d=m=>{i?n.push(m):o(()=>{s(m)})},f=()=>{const m=n)DELIM" -R"DELIM(;n=[],m.length&&o(()=>{r(()=>{m.forEach(g=>{s(g)})})})};return{batch:m=>{let g;i++;try{g=m()}finally{i--,i||f()}return g},batchCalls:m=>(...g)=>{d(()=>{m(...g)})},schedule:d,setNotifyFunction:m=>{s=m},setBatchNotifyFunction:m=>{r=m},setScheduler:m=>{o=m}}}var _n=TN(),AN=class extends qu{#e=!0;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n(!0),s=()=>n(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",s)}}}}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(s=>{s(n)}))}isOnline(){return this.#e}},Cc=new AN;function NN(n){return Math.min(1e3*2**n,3e4)}function Wb(n){return(n??"online")==="online"?Cc.isOnline():!0}var Mh=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function e1(n){let i=!1,s=0,r;const o=Oh(),d=()=>o.status!=="pending",f=C=>{if(!d()){const Q=new Mh(C);z(Q),n.onCancel?.(Q)}},m=()=>{i=!0},g=()=>{i=!1},v=()=>pm.isFocused()&&(n.networkMode==="always"||Cc.isOnline())&&n.canRun(),w=()=>Wb(n.networkMode)&&n.canRun(),S=C=>{d()||(r?.(),o.resolve(C))},z=C=>{d()||(r?.(),o.reject(C))},T=()=>new Promise(C=>{r=Q=>{(d()||v())&&C(Q)},n.onPause?.()}).then(()=>{r=void 0,d()||n.onContinue?.()}),j=()=>{if(d())return;let C;const Q=s===0?n.initialPromise:void 0;try{C=Q??n.fn()}catch(B){C=Promise.reject(B)}Promise.resolve(C).then(S).catch(B=>{if(d())return;const Y=n.retry??(Zu.isServer()?0:3),J=n.retryDelay??NN,q=typeof J=="function"?J(s,B):J,ee=Y===!0||typeof Y=="number"&&sv()?void 0:T()).then(()=>{i?z(B):j()})})};return{promise:o,status:()=>o.status,cancel:f,continue:()=>(r?.(),o),cancelRetry:m,continueRetry:g,canStart:w,start:()=>(w()?j():T().then(j),o)}}var t1=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Eh(this.gcTime)&&(this.#e=os.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(Zu.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(os.clearTimeout(this.#e),this.#e=void 0)}};function ON(n){return{onFetch:(i,s)=>{const r=i.options,o=i.fetchOptions?.meta?.fetchMore?.direction,d=i.state.data?.pages||[],f=i.state.data?.pageParams||[];let m={pages:[],pageParams:[]},g=0;const v=async()=>{let w=!1;const S=j=>{zN(j,()=>i.signal,()=>w=!0)},z=Ib(i.options,i.fetchOptions),T=async(j,C,Q)=>{if(w)return Promise.reject(i.signal.reason);if(C==null&&j.pages.length)return Promise.resolve(j);const Y=(()=>{const ne={client:i.client,queryKey:i.queryKey,pageParam:C,direction:Q?"backward":"forward",meta:i.options.meta};return S(ne),ne})(),J=await z(Y),{maxPages:q}=i.options,ee=Q?wN:xN;return{pages:ee(j.pages,J,q),pageParams:ee(j.pageParams,C,q)}};if(o&&d.length){const j=o==="backward",C=j?MN:l0,Q={pages:d,pageParams:f},B=C(r,Q);m=await T(Q,B,j)}else{const j=n??d.length;do{const C=g===0?f[0]??r.initialPageParam:l0(r,m);if(g>0&&C==null)break;m=await T(m,C),g++}while(gi.options.persister?.(v,{client:i.client,queryKey:i.queryKey,meta:i.options.meta,signal:i.signal},s):i.fetchFn=v}}}function l0(n,{pages:i,pageParams:s}){const r=i.length-1;return i.length>0?n.getNextPageParam(i[r],i,s[r],s):void 0}function MN(n,{pages:i,pageParams:s}){return i.length>0?n.getPreviousPageParam?.(i[0],i,s[0],s):void 0}var jN=class extends t1{#e;#t;#n;#i;#s;#a;#r;#l;constructor(n){super(),this.#l=!1,this.#r=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=r0(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.#a?.promise}setOptions(n){if(this.options={...this.#r,...n},n?._type&&(this.#e=n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=r0(this.options);i.data!==void 0&&(this.setState(s0(i.data,i.dataUpdatedAt)),this.#t=i)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(n,i){const s=Nh(this.state.data,n,this.options);return this.#u({data:s,type:"success",dataUpdatedAt:i?.updatedAt,manual:i?.manual}),s}setState(n){this.#u({type:"setState",state:n})}cancel(n){const i=this.#a?.promise;return this.#a?.cancel(n),i?i.then(Pn).catch(Pn):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=>di(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vm||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(n=>Tl(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:!Fb(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(i=>i.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(i=>i.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){this.observers.includes(n)&&(this.observers=this.observers.filter(i=>i!==n),this.observers.length||(this.#a&&(this.#l||this.#o()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}#o(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#u({type:"invalidate"})}async fetch(n,i){if(this.state.fetchStatus!=="idle"&&this.#a?.status()!=="rejected"){if(this.state.data!==void 0&&i?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(n&&this.setOptions(n),!this.options.queryFn){const g=this.observers.find(v=>v.options.queryFn);g&&this.setOptions(g.options)}const s=new AbortController,r=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(this.#l=!0,s.signal)})},o=()=>{const g=Ib(this.options,i),w=(()=>{const S={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(S),S})();return this.#l=!1,this.options.persister?this.options.persister(g,w,this):g(w)},f=(()=>{const g={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:o};return r(g),g})();(this.#e==="infinite"?ON(this.options.pages):this.options.behavior)?.onFetch(f,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==f.fetchOptions?.meta)&&this.#u({type:"fetch",meta:f.fetchOptions?.meta}),this.#a=e1({initialPromise:i?.initialPromise,fn:f.fetchFn,onCancel:g=>{g instanceof Mh&&g.revert&&this.setState({...this.#n,fetchStatus:"idle"}),s.abort()},onFail:(g,v)=>{this.#u({type:"failed",failureCount:g,error:v})},onPause:()=>{this.#u({type:"pause"})},onContinue:()=>{this.#u({type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0});try{const g=await this.#a.start();if(g===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(g),this.#i.config.onSuccess?.(g,th)DELIM" -R"DELIM(is),this.#i.config.onSettled?.(g,this.state.error,this),g}catch(g){if(g instanceof Mh){if(g.silent)return this.#a.promise;if(g.revert){if(this.state.data===void 0)throw g;return this.state.data}}throw this.#u({type:"error",error:g}),this.#i.config.onError?.(g,this),this.#i.config.onSettled?.(this.state.data,g,this),g}finally{this.scheduleGc()}}#u(n){const i=s=>{switch(n.type){case"failed":return{...s,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...n1(s.data,this.options),fetchMeta:n.meta??null};case"success":const r={...s,...s0(n.data,n.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=n.manual?r:void 0,r;case"error":const o=n.error;return{...s,error:o,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...n.state}}};this.state=i(this.state),_n.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:n})})}};function n1(n,i){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wb(i.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function s0(n,i){return{data:n,dataUpdatedAt:i??Date.now(),error:null,isInvalidated:!1,status:"success"}}function r0(n){const i=typeof n.initialData=="function"?n.initialData():n.initialData,s=i!==void 0,r=s?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:i,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var kN=class extends qu{constructor(n,i){super(),this.options=i,this.#e=n,this.#l=null,this.#r=Oh(),this.bindMethods(),this.setOptions(i)}#e;#t=void 0;#n=void 0;#i=void 0;#s;#a;#r;#l;#o;#u;#m;#c;#d;#h;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),u0(this.#t,this.options)?this.#f():this.updateResult(),this.#w())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return jh(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return jh(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#E(),this.#z(),this.#t.removeObserver(this)}setOptions(n){const i=this.options,s=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 di(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#b(),this.#t.setOptions(this.options),i._defaulted&&!Th(this.options,i)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&o0(this.#t,s,this.options,i)&&this.#f(),this.updateResult(),r&&(this.#t!==s||di(this.options.enabled,this.#t)!==di(i.enabled,this.#t)||Tl(this.options.staleTime,this.#t)!==Tl(i.staleTime,this.#t))&&this.#y();const o=this.#x();r&&(this.#t!==s||di(this.options.enabled,this.#t)!==di(i.enabled,this.#t)||o!==this.#h)&&this.#g(o)}getOptimisticResult(n){const i=this.#e.getQueryCache().build(this.#e,n),s=this.createResult(i,n);return CN(this,s)&&(this.#i=s,this.#a=this.options,this.#s=this.#t.state),s}getCurrentResult(){return this.#i}trackResult(n,i){return new Proxy(n,{get:(s,r)=>(this.trackProp(r),i?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(n){this.#p.add(n)}getCurrentQuery(){return this.#t}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const i=this.#e.defaultQueryOptions(n),s=this.#e.getQueryCache().build(this.#e,i);return s.fetch().then(()=>this.createResult(s,i))}fetch(n){return this.#f({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#f(n){this.#b();let i=this.#t.fetch(this.options,n);return n?.throwOnError||(i=i.catch(Pn)),i}#y(){this.#E();const n=Tl(this.options.staleTime,this.#t);if(Zu.isServer()||this.#i.isStale||!Eh(n))return;const s=Fb(this.#i.dataUpdatedAt,n)+1;this.#c=os.setTimeout(()=>{this.#i.isStale||this.updateResult()},s)}#x(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#g(n){this.#z(),this.#h=n,!(Zu.isServer()||di(this.options.enabled,this.#t)===!1||!Eh(this.#h)||this.#h===0)&&(this.#d=os.setInterval(()=>{(this.options.refetchIntervalInBackground||pm.isFocused())&&this.#f()},this.#h))}#w(){this.#y(),this.#g(this.#x())}#E(){this.#c!==void 0&&(os.clearTimeout(this.#c),this.#c=void 0)}#z(){this.#d!==void 0&&(os.clearInterval(this.#d),this.#d=void 0)}createResult(n,i){const s=this.#t,r=this.options,o=this.#i,d=this.#s,f=this.#a,g=n!==s?n.state:this.#n,{state:v}=n;let w={...v},S=!1,z;if(i._optimisticResults){const ue=this.hasListeners(),Ne=!ue&&u0(n,i),we=ue&&o0(n,s,i,r);(Ne||we)&&(w={...w,...n1(v.data,n.options)}),i._optimisticResults==="isRestoring"&&(w.fetchStatus="idle")}let{error:T,errorUpdatedAt:j,status:C}=w;z=w.data;let Q=!1;if(i.placeholderData!==void 0&&z===void 0&&C==="pending"){let ue;o?.isPlaceholderData&&i.placeholderData===f?.placeholderData?(ue=o.data,Q=!0):ue=typeof i.placeholderData=="function"?i.placeholderData(this.#m?.state.data,this.#m):i.placeholderData,ue!==void 0&&(C="success",z=Nh(o?.data,ue,i),S=!0)}if(i.select&&z!==void 0&&!Q)if(o&&z===d?.data&&i.select===this.#o)z=this.#u;else try{this.#o=i.select,z=i.select(z),z=Nh(o?.data,z,i),this.#u=z,this.#l=null}catch(ue){this.#l=ue}this.#l&&(T=this.#l,z=this.#u,j=Date.now(),C="error");const B=w.fetchStatus==="fetching",Y=C==="pending",J=C==="error",q=Y&&B,ee=z!==void 0,F={status:C,fetchStatus:w.fetchStatus,isPending:Y,isSuccess:C==="success",isError:J,isInitialLoading:q,isLoading:q,data:z,dataUpdatedAt:w.dataUpdatedAt,error:T,errorUpdatedAt:j,failureCount:w.fetchFailureCount,failureReason:w.fetchFailureReason,errorUpdateCount:w.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:w.dataUpdateCount>g.dataUpdateCount||w.errorUpdateCount>g.errorUpdateCount,isFetching:B,isRefetching:B&&!Y,isLoadingError:J&&!ee,isPaused:w.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:J&&ee,isStale:ym(n,i),refetch:this.refetch,promise:this.#r,isEnabled:di(i.enabled,n)!==!1};if(this.options.experimental_prefetchInRender){const ue=F.data!==void 0,Ne=F.status==="error"&&!ue,we=ce=>{Ne?ce.reject(F.error):ue&&ce.resolve(F.data)},ie=()=>{const ce=this.#r=F.promise=Oh();we(ce)},be=this.#r;switch(be.status){case"pending":n.queryHash===s.queryHash&&we(be);break;case"fulfilled":(Ne||F.data!==be.value)&&ie();break;case"rejected":(!Ne||F.error!==be.reason)&&ie();break}}return F}updateResult(){const n=this.#i,i=this.createResult(this.#t,this.options);if(this.#s=this.#t.state,this.#a=this.options,this.#s.data!==void 0&&(this.#m=this.#t),Th(i,n))return;this.#i=i;const s=()=>{if(!n)return!0;const{notifyOnChangeProps:r}=this.options,o=typeof r=="function"?r():r;if(o==="all"||!o&&!this.#p.size)return!0;const d=new Set(o??this.#p);return this.options.throwOnError&&d.add("error"),Object.keys(this.#i).some(f=>{const m=f;return this.#i[m]!==n[m]&&d.has(m)})};this.#T({listeners:s()})}#b(){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))}onQuery)DELIM" -R"DELIM(Update(){this.updateResult(),this.hasListeners()&&this.#w()}#T(n){_n.batch(()=>{n.listeners&&this.listeners.forEach(i=>{i(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function RN(n,i){return di(i.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&di(i.retryOnMount,n)===!1)}function u0(n,i){return RN(n,i)||n.state.data!==void 0&&jh(n,i,i.refetchOnMount)}function jh(n,i,s){if(di(i.enabled,n)!==!1&&Tl(i.staleTime,n)!=="static"){const r=typeof s=="function"?s(n):s;return r==="always"||r!==!1&&ym(n,i)}return!1}function o0(n,i,s,r){return(n!==i||di(r.enabled,n)===!1)&&(!s.suspense||n.state.status!=="error")&&ym(n,s)}function ym(n,i){return di(i.enabled,n)!==!1&&n.isStaleByTime(Tl(i.staleTime,n))}function CN(n,i){return!Th(n.getCurrentResult(),i)}var DN=class extends t1{#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||UN(),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.execute(this.state.variables)}async execute(n){const i=()=>{this.#s({type:"continue"})},s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=e1({fn:()=>this.options.mutationFn?this.options.mutationFn(n,s):Promise.reject(new Error("No mutationFn found")),onFail:(d,f)=>{this.#s({type:"failed",failureCount:d,error:f})},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)});const r=this.state.status==="pending",o=!this.#i.canStart();try{if(r)i();else{this.#s({type:"pending",variables:n,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(n,this,s);const f=await this.options.onMutate?.(n,s);f!==this.state.context&&this.#s({type:"pending",context:f,variables:n,isPaused:o})}const d=await this.#i.start();return await this.#n.config.onSuccess?.(d,n,this.state.context,this,s),await this.options.onSuccess?.(d,n,this.state.context,s),await this.#n.config.onSettled?.(d,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(d,null,n,this.state.context,s),this.#s({type:"success",data:d}),d}catch(d){try{await this.#n.config.onError?.(d,n,this.state.context,this,s)}catch(f){Promise.reject(f)}try{await this.options.onError?.(d,n,this.state.context,s)}catch(f){Promise.reject(f)}try{await this.#n.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,s)}catch(f){Promise.reject(f)}try{await this.options.onSettled?.(void 0,d,n,this.state.context,s)}catch(f){Promise.reject(f)}throw this.#s({type:"error",error:d}),d}finally{this.#n.runNext(this)}}#s(n){const i=s=>{switch(n.type){case"failed":return{...s,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,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{...s,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:n.error,failureCount:s.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=i(this.state),_n.batch(()=>{this.#t.forEach(s=>{s.onMutationUpdate(n)}),this.#n.notify({mutation:this,type:"updated",action:n})})}};function UN(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ZN=class extends qu{constructor(n={}){super(),this.config=n,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(n,i,s){const r=new DN({client:n,mutationCache:this,mutationId:++this.#n,options:n.defaultMutationOptions(i),state:s});return this.add(r),r}add(n){this.#e.add(n);const i=vc(n);if(typeof i=="string"){const s=this.#t.get(i);s?s.push(n):this.#t.set(i,[n])}this.notify({type:"added",mutation:n})}remove(n){if(this.#e.delete(n)){const i=vc(n);if(typeof i=="string"){const s=this.#t.get(i);if(s)if(s.length>1){const r=s.indexOf(n);r!==-1&&s.splice(r,1)}else s[0]===n&&this.#t.delete(i)}}this.notify({type:"removed",mutation:n})}canRun(n){const i=vc(n);if(typeof i=="string"){const r=this.#t.get(i)?.find(o=>o.state.status==="pending");return!r||r===n}else return!0}runNext(n){const i=vc(n);return typeof i=="string"?this.#t.get(i)?.find(r=>r!==n&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){_n.batch(()=>{this.#e.forEach(n=>{this.notify({type:"removed",mutation:n})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(n){const i={exact:!0,...n};return this.getAll().find(s=>n0(i,s))}findAll(n={}){return this.getAll().filter(i=>n0(n,i))}notify(n){_n.batch(()=>{this.listeners.forEach(i=>{i(n)})})}resumePausedMutations(){const n=this.getAll().filter(i=>i.state.isPaused);return _n.batch(()=>Promise.all(n.map(i=>i.continue().catch(Pn))))}};function vc(n){return n.options.scope?.id}var $N=class extends qu{constructor(n={}){super(),this.config=n,this.#e=new Map}#e;build(n,i,s){const r=i.queryKey,o=i.queryHash??gm(r,i);let d=this.get(o);return d||(d=new jN({client:n,queryKey:r,queryHash:o,options:n.defaultQueryOptions(i),state:s,defaultOptions:n.getQueryDefaults(r)}),this.add(d)),d}add(n){this.#e.has(n.queryHash)||(this.#e.set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){const i=this.#e.get(n.queryHash);i&&(n.destroy(),i===n&&this.#e.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){_n.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(s=>t0(i,s))}findAll(n={}){const i=this.getAll();return Object.keys(n).length>0?i.filter(s=>t0(n,s)):i}notify(n){_n.batch(()=>{this.listeners.forEach(i=>{i(n)})})}onFocus(){_n.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){_n.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},LN=class{#e;#t;#n;#i;#s;#a;#r;#l;constructor(n={}){this.#e=n.queryCache||new $N,this.#t=n.mutationCache||new ZN,this.#n=n.defaultOptions||{},this.#i=new Map,this.#s=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#r=pm.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#l=Cc.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#r?.(),this.#r=void 0,this.#l?.(),this.#l=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),s=this.#e.build(this,i),r=s.state.data;return r===void 0?this.fetchQuery(n):(n.revalidateIfStale&&s.isStaleByTime(Tl(i.staleTime,s))&&this.prefetchQuery(i),Promise.resolve(r))}getQueriesData(n){return this.#e.findAll(n).map(({queryKey:i,state:s})=>{const r=s.data;return[i,r]})}setQueryData(n,i,s){const r=this.defaultQueryOptions({queryKey:n}),d=this.#e.get(r.queryHash)?.state.data,f=bN(i,d);if(f!==void 0)return this.#e.build(this,r).setData(f,{...s,manual:!0})}setQueriesData(n,i,s){return _n.batch(()=>this.#e.findAll(n).map(({queryKey:r})=>[r,this.setQueryData(r,i,s)]))}getQueryState(n){co)DELIM" -R"DELIM(nst i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state}removeQueries(n){const i=this.#e;_n.batch(()=>{i.findAll(n).forEach(s=>{i.remove(s)})})}resetQueries(n,i){const s=this.#e;return _n.batch(()=>(s.findAll(n).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...n},i)))}cancelQueries(n,i={}){const s={revert:!0,...i},r=_n.batch(()=>this.#e.findAll(n).map(o=>o.cancel(s)));return Promise.all(r).then(Pn).catch(Pn)}invalidateQueries(n,i={}){return _n.batch(()=>(this.#e.findAll(n).forEach(s=>{s.invalidate()}),n?.refetchType==="none"?Promise.resolve():this.refetchQueries({...n,type:n?.refetchType??n?.type??"active"},i)))}refetchQueries(n,i={}){const s={...i,cancelRefetch:i.cancelRefetch??!0},r=_n.batch(()=>this.#e.findAll(n).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let d=o.fetch(void 0,s);return s.throwOnError||(d=d.catch(Pn)),o.state.fetchStatus==="paused"?Promise.resolve():d}));return Promise.all(r).then(Pn)}fetchQuery(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const s=this.#e.build(this,i);return s.isStaleByTime(Tl(i.staleTime,s))?s.fetch(i):Promise.resolve(s.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(Pn).catch(Pn)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(Pn).catch(Pn)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return Cc.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(Uu(n),{queryKey:n,defaultOptions:i})}getQueryDefaults(n){const i=[...this.#i.values()],s={};return i.forEach(r=>{vr(n,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(n,i){this.#s.set(Uu(n),{mutationKey:n,defaultOptions:i})}getMutationDefaults(n){const i=[...this.#s.values()],s={};return i.forEach(r=>{vr(n,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(n){if(n._defaulted)return n;const i={...this.#n.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return i.queryHash||(i.queryHash=gm(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===vm&&(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()}},i1=se.createContext(void 0),HN=n=>{const i=se.useContext(i1);if(!i)throw new Error("No QueryClient set, use QueryClientProvider to set one");return i},qN=({client:n,children:i})=>(se.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),_.jsx(i1.Provider,{value:n,children:i})),a1=se.createContext(!1),BN=()=>se.useContext(a1);a1.Provider;function VN(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var GN=se.createContext(VN()),YN=()=>se.useContext(GN),QN=(n,i,s)=>{const r=s?.state.error&&typeof n.throwOnError=="function"?Pb(n.throwOnError,[s.state.error,s]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||r)&&(i.isReset()||(n.retryOnMount=!1))},KN=n=>{se.useEffect(()=>{n.clearReset()},[n])},JN=({result:n,errorResetBoundary:i,throwOnError:s,query:r,suspense:o})=>n.isError&&!i.isReset()&&!n.isFetching&&r&&(o&&n.data===void 0||Pb(s,[n.error,r])),FN=n=>{if(n.suspense){const s=o=>o==="static"?o:Math.max(o??1e3,1e3),r=n.staleTime;n.staleTime=typeof r=="function"?(...o)=>s(r(...o)):s(r),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},XN=(n,i)=>n.isLoading&&n.isFetching&&!i,IN=(n,i)=>n?.suspense&&i.isPending,c0=(n,i,s)=>i.fetchOptimistic(n).catch(()=>{s.clearReset()});function PN(n,i,s){const r=BN(),o=YN(),d=HN(),f=d.defaultQueryOptions(n);d.getDefaultOptions().queries?._experimental_beforeQuery?.(f);const m=d.getQueryCache().get(f.queryHash),g=n.subscribed!==!1;f._optimisticResults=r?"isRestoring":g?"optimistic":void 0,FN(f),QN(f,o,m),KN(o);const v=!d.getQueryCache().get(f.queryHash),[w]=se.useState(()=>new i(d,f)),S=w.getOptimisticResult(f),z=!r&&g;if(se.useSyncExternalStore(se.useCallback(T=>{const j=z?w.subscribe(_n.batchCalls(T)):Pn;return w.updateResult(),j},[w,z]),()=>w.getCurrentResult(),()=>w.getCurrentResult()),se.useEffect(()=>{w.setOptions(f)},[f,w]),IN(f,S))throw c0(f,w,o);if(JN({result:S,errorResetBoundary:o,throwOnError:f.throwOnError,query:m,suspense:f.suspense}))throw S.error;return d.getDefaultOptions().queries?._experimental_afterQuery?.(f,S),f.experimental_prefetchInRender&&!Zu.isServer()&&XN(S,r)&&(v?c0(f,w,o):m?.promise)?.catch(Pn).finally(()=>{w.updateResult()}),f.notifyOnChangeProps?S:w.trackResult(S)}function WN(n,i){return PN(n,kN)}const l1=Ml({address:nr(),filter:nr(),turbo:nr(),witness:nr(),retarget:nr(),difficult:nr(),pruned:ra().int().nonnegative()}),s1=Ml({height:ra().int().nonnegative(),timestamp:ra().int().positive().max(4294967295)}),r1=ra().int().nonnegative();function eO(n){try{const i=JSON.parse(n),s=l1.safeParse(i);if(s.success)return{type:"configuration",payload:s.data};const r=s1.safeParse(i);if(r.success)return{type:"header",payload:r.data};const o=r1.safeParse(i);return o.success?{type:"top",payload:o.data}:null}catch{return null}}function sh(n,i){return new URL(i,`${n.replace(/\/+$/u,"")}/`).toString()}async function rh(n,i){const s=await fetch(n,{headers:{Accept:"application/json"},signal:i});if(!s.ok)throw new Error(`Native API request failed with status ${String(s.status)}`);return await s.json()}async function tO(n,i){const[s,r]=await Promise.all([rh(sh(n,"/v1/configuration?format=json"),i),rh(sh(n,"/v1/top?format=json"),i)]),o=l1.parse(s),d=r1.parse(r),f=Date.now();let m=null;try{const g=s1.parse(await rh(sh(n,u1(d)),i));g.height===d&&(m=g)}catch{i?.throwIfAborted()}return{configuration:o,top:d,topHeader:m,receivedAt:f}}function u1(n){return`/v1/block/height/${String(n)}/header?format=json`}const f0={phase:"idle",attempt:0,reconnects:0,connectedAt:null,lastMessageAt:null,error:null};class nO{#e;#t=f0;#n=null;#i=new Set;#s=null;#a=null;#r=null;#l;#o=!1;constructor(i){this.#e={...i,connectTimeoutMs:i.connectTimeoutMs??5e3,retryMinimumMs:i.retryMinimumMs??1e3,retryMaximumMs:i.retryMaximumMs??3e4,heartbeatMs:i.heartbeatMs??24e4,jitterRatio:i.jitterRatio??.2,now:i.now??Date.now,random:i.random??Math.random,webSocketFactory:i.webSocketFactory??(s=>new WebSocket(s))},this.#l=this.#e.retryMinimumMs}getStatus=()=>this.#t;subscribeStatus=i=>(this.#i.add(i),()=>{this.#i.delete(i)});start(){this.#o||(this.#o=!0,this.#l=this.#e.retryMinimumMs,this.#u())}stop(){this.#o=!1,this.#p();const i=this.#n;if(this.#n=null,i)try{i.readyState===1&&this.#e.onBeforeStop?.(i),i.close()}catch{}this.#f(f0)}send(i){if(this.#n?.readyState!==1)return!1;try{return this.#n.send(i),!0}catch{return!1}}#u(){if(!this.#o||this.#n)return;const i=this.#t.reconnects>0;this.#f({...this.#t,phase:i?"reconnecting":"connecting",attempt:this.#t.attempt+1,error:null});let s;try{s=this.#e.webSocketFactory(this.#e.url),this.#n=s}catch(r){this.#f({...this.#t,error:aO(r)}),this.#m();return}this.#s=setTimeout(()=>{if(this.#n===s){this.#f({...this.#t,error:"Connection timed out"});try{s.close()}catch{this.#n=null,this.#m()}}},this.#e.connectTimeoutMs),s.addEventListener("open",()=>{this.#n!==s||!this.#o||(this.#d(),this.#l=this.#e.retryMinimumMs,this.#f({...this.#t,phase:"connected",connectedAt:this.#e.now(),error:null}),this.#e.onOpen?.(s),this.#c(s))}),s.addEventListener("message",r=>{if(this.#n!==s||!this.#o)return;const o=iO(r.data);if(o===null)return;const d=this.#e.now();(this.#t.lastMessageAt===null||d-this.#t.lastMessageAt>=1e3)&&this.#f({...this.#t,lastMessageAt:d}),this.#e.onMessage(o)}),s.addEventListener("error",()=>{if(!(this.#n!==s||!this.#o)){this.#f({...this.#t,error:)DELIM" -R"DELIM("WebSocket connection failed"});try{s.close()}catch{this.#n=null,this.#m()}}}),s.addEventListener("close",()=>{this.#n===s&&(this.#n=null,this.#d(),this.#h(),this.#o&&this.#m())})}#m(){if(!this.#o||this.#a)return;const i=1+(this.#e.random()*2-1)*this.#e.jitterRatio,s=Math.max(0,Math.round(this.#l*i));this.#l=Math.min(this.#l*2,this.#e.retryMaximumMs),this.#f({...this.#t,phase:"reconnecting",reconnects:this.#t.reconnects+1,connectedAt:null}),this.#a=setTimeout(()=>{this.#a=null,this.#u()},s)}#c(i){this.#h(),!(!this.#e.onHeartbeat||this.#e.heartbeatMs<=0)&&(this.#r=setInterval(()=>{this.#n===i&&i.readyState===1&&this.#e.onHeartbeat?.(i)},this.#e.heartbeatMs))}#d(){this.#s&&(clearTimeout(this.#s),this.#s=null)}#h(){this.#r&&(clearInterval(this.#r),this.#r=null)}#p(){this.#d(),this.#h(),this.#a&&(clearTimeout(this.#a),this.#a=null)}#f(i){this.#t=i;for(const s of this.#i)s()}}function iO(n){return typeof n=="string"?n:n instanceof ArrayBuffer?new TextDecoder().decode(n):null}function aO(n){return n instanceof Error?n.message:"Unable to create WebSocket"}const bm=15e3,kh=3*bm,d0={configuration:null,configurationReceivedAt:null,top:null,topReceivedAt:null,topHeader:null,headerReceivedAt:null,invalidFrames:0};class lO{#e=d0;#t=new Set;#n;#i;#s=null;#a=null;#r=null;#l;constructor(i,s={}){this.#i=s.now??Date.now,this.#l=s.pollIntervalMs??bm,this.#n=new nO({url:Q_(i),webSocketFactory:s.webSocketFactory,retryMinimumMs:s.retryMinimumMs,retryMaximumMs:s.retryMaximumMs,jitterRatio:s.jitterRatio,heartbeatMs:this.#l,now:this.#i,onOpen:r=>{this.#s=this.#i(),r.send("/v1/configuration?format=json"),r.send("/v1/top/subscribe?format=json")},onHeartbeat:r=>{const o=this.#e.topReceivedAt??this.#s;if(o!==null&&this.#i()-o>=kh){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 o=eO(r);if(!o){this.#c({...this.#e,invalidFrames:this.#e.invalidFrames+1});return}this.#o(o)}}),this.#n.subscribeStatus(()=>{this.#n.getStatus().phase!=="connected"&&(this.#s=null,this.#a=null,this.#r=null,this.#m())})}getStatus=()=>this.#n.getStatus();subscribeStatus=i=>this.#n.subscribeStatus(i);getState=()=>this.#e;subscribeState=i=>(this.#t.add(i),()=>{this.#t.delete(i)});start(){this.#n.start()}stop(){this.#n.stop()}#o(i){const s=this.#i();if(i.type==="top"){const r=this.#e.top!==null&&i.payload{i.configure(n,s)},[n,i,s]),se.useEffect(()=>(i.start(),()=>{i.stop()}),[i]),r}function rO(n,i,s){const r=se.useMemo(()=>new lO(n),[n]),o=se.useMemo(()=>K_(n),[n]),d=se.useSyncExternalStore(r.subscribeStatus,r.getStatus,r.getStatus),f=se.useSyncExternalStore(r.subscribeState,r.getState,r.getState),m=o1(d,f,s);se.useEffect(()=>(r.start(),()=>{r.stop()}),[r]);const g=WN({queryKey:["native-snapshot",n],queryFn:({signal:w})=>tO(n,w),enabled:o&&!m,refetchInterval:bm,retry:!1}),v=uO(d,f,g.data??null,s);return se.useEffect(()=>{v.top!==null&&i.recordNativeTop(v.top,v.receivedAt??Date.now())},[i,v.receivedAt,v.top]),{status:d,live:f,...v,restError:g.error instanceof Error?g.error.message:null}}function o1(n,i,s){return n.phase==="connected"&&i.top!==null&&i.topReceivedAt!==null&&i.configuration!==null&&i.configurationReceivedAt!==null&&Rh(i.topReceivedAt,s)}function uO(n,i,s,r){return o1(n,i,r)?{top:i.top,topHeader:i.headerReceivedAt!==null&&Rh(i.headerReceivedAt,r)?i.topHeader:null,configuration:i.configuration,receivedAt:i.topReceivedAt,transport:"websocket"}:s&&Rh(s.receivedAt,r)?{top:s.top,topHeader:s.topHeader,configuration:s.configuration,receivedAt:s.receivedAt,transport:"rest"}:{top:null,topHeader:null,configuration:null,receivedAt:null,transport:"none"}}function Rh(n,i){return i-n<=kh}const oO=[{id:"overview",label:"Overview"},{id:"logs",label:"Logs"},{id:"events",label:"Events"}];function cO(){const n=se.useMemo(()=>new fN,[]),[i,s]=se.useState(J_),[r,o]=se.useState("overview"),[d,f]=se.useState(!1),[m,g]=se.useState(dN),[v,w]=se.useState(!1),[S,z]=se.useState(!1),[T,j]=se.useState(B_),C=se.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot),Q=sO(i.adminUrl,n,m),B=rO(i.nativeUrl,n,C.now),Y=_E(B.top,B.topHeader,C.now);function J(F){F_(F),(F.adminUrl!==i.adminUrl||F.nativeUrl!==i.nativeUrl)&&n.reset(),s(F),f(!1)}function q(){X_();const F=y0();(F.adminUrl!==i.adminUrl||F.nativeUrl!==i.nativeUrl)&&n.reset(),s(F),f(!1)}function ee(F){V_(F),j(F)}function ne(F){hN(F),g(F)}return _.jsxs("div",{className:"bg-background text-textPrimary min-h-screen",children:[_.jsx("header",{className:"border-accent/25 bg-surface/95 sticky top-0 z-40 border-b backdrop-blur",children:_.jsx("div",{className:"mx-auto max-w-[96rem] px-4 sm:px-6",children:_.jsxs("div",{className:"flex min-h-16 flex-wrap items-center gap-x-6 gap-y-2 py-3",children:[_.jsxs("button",{type:"button",onClick:()=>{o("overview")},className:"mr-auto text-left",children:[_.jsx("p",{className:"text-accentSecondary text-[10px] font-medium tracking-[0.2em] uppercase",children:"Libbitcoin Server"}),_.jsx("h1",{className:"text-accent text-lg font-semibold tracking-tight",children:"Admin Dashboard"})]}),_.jsx("nav",{className:"order-3 flex w-full items-center gap-1 sm:order-none sm:w-auto",children:oO.map(F=>_.jsxs("button",{type:"button",onClick:()=>{o(F.id)},className:`rounded-lg px-3 py-2 text-sm transition ${r===F.id?"bg-accent/15 text-accent":"text-textMuted hover:text-textPrimary hover:bg-white/5"}`,children:[F.label,F.id==="logs"&&C.totalLogs>0&&_.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:C.totalLogs>999?"999+":String(C.totalLogs)}),F.id==="events"&&C.totalEvents>0&&_.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:C.totalEvents>999?"999+":String(C.totalEvents)})]},F.id))}),_.jsxs("div",{className:"flex items-center gap-3",children:[_.jsxs("div",{className:"hidden items-center gap-2 lg:flex","aria-label":"Connection summary",children:[_.jsx(h0,{connected:Q.phase==="connected",label:"Admin"}),_.jsx(h0,{connected:B.transport!=="none",label:"Native"})]}),_.jsx("button",{type:"button",onClick:()=>{f(!0)},className:"border-accent/30 text-textMuted hover:border-accent hover:text-accent rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Endpoints"})]})]})})}),_.jsxs("main",{className:"mx-auto max-w-[96rem] min-w-0 px-4 py-8 sm:px-6",children:[r==="overview"&&_.jsx(nN,{adminStatus:Q,endpoints:i,metrics:C,native:B,syncEstimate:Y}),r==="logs"&&_.jsx(P2,{metrics:n,delivery:C,status:Q,logFilter:m,paused:v,onLogFilterChange:ne,onPausedChange:F=>{n.setLogsPaused(F),w(F)},onClear:()=>{n.clearLogs()}}),r==="events"&&_.jsx(X2,{metrics:n,paused:S,onPausedChange:F=>{n.setEventsPaused(F),z(F)},onClear:()=>{n.clearEvents()}})]}),_.jsx(sN,{estimate:Y,browserNotificationsEnabled:T},i.nativeUrl),d&&_.jsx(I_,{configuration:i,browserNotificationsEnabled:T,onClose:()=>{f(!1)},onReset:q,onSave:J,onBrowserNotificationsEnabledChan)DELIM" -R"DELIM(ge:ee},`${i.adminUrl}|${i.nativeUrl}`)]})}function h0({connected:n,label:i}){return _.jsxs("span",{className:"text-textMuted inline-flex items-center gap-1.5 text-xs",children:[_.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-400":"bg-amber-400"}`,"aria-hidden":"true"}),i]})}function fO({children:n}){const[i]=se.useState(()=>new LN({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:1}}}));return _.jsxs(qN,{client:i,children:[n,null]})}const c1=document.querySelector("#root");if(!c1)throw new Error("Root element not found");H_.createRoot(c1).render(_.jsx(k_.StrictMode,{children:_.jsx(fO,{children:_.jsx(cO,{})})})); +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of n.seen.entries()){const p=f[1];if(i===f[0]){d(f);continue}if(n.external){const v=n.external.registry.get(f[0])?.id;if(i!=)DELIM" +R"DELIM(=f[0]&&v){d(f);continue}}if(n.metadataRegistry.get(f[0])?.id){d(f);continue}if(p.cycle){d(f);continue}if(p.count>1&&n.reused==="ref"){d(f);continue}}}function B0(n,i){const l=n.seen.get(i);if(!l)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const m=n.seen.get(p);if(m.ref===null)return;const v=m.def??m.schema,w={...v},S=m.ref;if(m.ref=null,S){r(S);const T=n.seen.get(S),j=T.schema;if(j.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(v.allOf=v.allOf??[],v.allOf.push(j)):Object.assign(v,j),Object.assign(v,w),p._zod.parent===S)for(const V in v)V==="$ref"||V==="allOf"||V in w||delete v[V];if(j.$ref&&T.def)for(const V in v)V==="$ref"||V==="allOf"||V in T.def&&JSON.stringify(v[V])===JSON.stringify(T.def[V])&&delete v[V]}const z=p._zod.parent;if(z&&z!==S){r(z);const T=n.seen.get(z);if(T?.schema.$ref&&(v.$ref=T.schema.$ref,T.def))for(const j in v)j==="$ref"||j==="allOf"||j in T.def&&JSON.stringify(v[j])===JSON.stringify(T.def[j])&&delete v[j]}n.override({zodSchema:p,jsonSchema:v,path:m.path??[]})};for(const p of[...n.seen.entries()].reverse())r(p[0]);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 p=n.external.registry.get(i)?.id;if(!p)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(p)}Object.assign(u,l.def??l.schema);const d=n.metadataRegistry.get(i)?.id;d!==void 0&&u.id===d&&delete u.id;const f=n.external?.defs??{};for(const p of n.seen.entries()){const m=p[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,f[m.defId]=m.def)}n.external||Object.keys(f).length>0&&(n.target==="draft-2020-12"?u.$defs=f:u.definitions=f);try{const p=JSON.parse(JSON.stringify(u));return Object.defineProperty(p,"~standard",{value:{...i["~standard"],jsonSchema:{input:zc(i,"input",n.processors),output:zc(i,"output",n.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function Ln(n,i){const l=i??{seen:new Set};if(l.seen.has(n))return!1;l.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ln(r.element,l);if(r.type==="set")return Ln(r.valueType,l);if(r.type==="lazy")return Ln(r.getter(),l);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ln(r.innerType,l);if(r.type==="intersection")return Ln(r.left,l)||Ln(r.right,l);if(r.type==="record"||r.type==="map")return Ln(r.keyType,l)||Ln(r.valueType,l);if(r.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:Ln(r.in,l)||Ln(r.out,l);if(r.type==="object"){for(const u in r.shape)if(Ln(r.shape[u],l))return!0;return!1}if(r.type==="union"){for(const u of r.options)if(Ln(u,l))return!0;return!1}if(r.type==="tuple"){for(const u of r.items)if(Ln(u,l))return!0;return!!(r.rest&&Ln(r.rest,l))}return!1}const Ww=(n,i={})=>l=>{const r=H0({...l,processors:i});return Sn(n,r),q0(r,n),B0(r,n)},zc=(n,i,l={})=>r=>{const{libraryOptions:u,target:d}=r??{},f=H0({...u??{},target:d,io:i,processors:l});return Sn(n,f),q0(f,n),B0(f,n)},ez={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tz=(n,i,l,r)=>{const u=l;u.type="string";const{minimum:d,maximum:f,format:p,patterns:m,contentEncoding:v}=n._zod.bag;if(typeof d=="number"&&(u.minLength=d),typeof f=="number"&&(u.maxLength=f),p&&(u.format=ez[p]??p,u.format===""&&delete u.format,p==="time"&&delete u.format),v&&(u.contentEncoding=v),m&&m.size>0){const w=[...m];w.length===1?u.pattern=w[0].source:w.length>1&&(u.allOf=[...w.map(S=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:S.source}))])}},nz=(n,i,l,r)=>{const u=l,{minimum:d,maximum:f,format:p,multipleOf:m,exclusiveMaximum:v,exclusiveMinimum:w}=n._zod.bag;typeof p=="string"&&p.includes("int")?u.type="integer":u.type="number";const S=typeof w=="number"&&w>=(d??Number.NEGATIVE_INFINITY),z=typeof v=="number"&&v<=(f??Number.POSITIVE_INFINITY),T=i.target==="draft-04"||i.target==="openapi-3.0";S?T?(u.minimum=w,u.exclusiveMinimum=!0):u.exclusiveMinimum=w:typeof d=="number"&&(u.minimum=d),z?T?(u.maximum=v,u.exclusiveMaximum=!0):u.exclusiveMaximum=v:typeof f=="number"&&(u.maximum=f),typeof m=="number"&&(u.multipleOf=m)},iz=(n,i,l,r)=>{l.type="boolean"},az=(n,i,l,r)=>{l.not={}},lz=(n,i,l,r)=>{},sz=(n,i,l,r)=>{const u=n._zod.def,d=_0(u.entries);d.every(f=>typeof f=="number")&&(l.type="number"),d.every(f=>typeof f=="string")&&(l.type="string"),l.enum=d},rz=(n,i,l,r)=>{const u=n._zod.def,d=[];for(const f of u.values)if(f===void 0){if(i.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof f=="bigint"){if(i.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");d.push(Number(f))}else d.push(f);if(d.length!==0)if(d.length===1){const f=d[0];l.type=f===null?"null":typeof f,i.target==="draft-04"||i.target==="openapi-3.0"?l.enum=[f]:l.const=f}else d.every(f=>typeof f=="number")&&(l.type="number"),d.every(f=>typeof f=="string")&&(l.type="string"),d.every(f=>typeof f=="boolean")&&(l.type="boolean"),d.every(f=>f===null)&&(l.type="null"),l.enum=d},oz=(n,i,l,r)=>{if(i.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},uz=(n,i,l,r)=>{if(i.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},cz=(n,i,l,r)=>{const u=l,d=n._zod.def,{minimum:f,maximum:p}=n._zod.bag;typeof f=="number"&&(u.minItems=f),typeof p=="number"&&(u.maxItems=p),u.type="array",u.items=Sn(d.element,i,{...r,path:[...r.path,"items"]})},fz=(n,i,l,r)=>{const u=l,d=n._zod.def;u.type="object",u.properties={};const f=d.shape;for(const v in f)u.properties[v]=Sn(f[v],i,{...r,path:[...r.path,"properties",v]});const p=new Set(Object.keys(f)),m=new Set([...p].filter(v=>{const w=d.shape[v]._zod;return i.io==="input"?w.optin===void 0:w.optout===void 0}));m.size>0&&(u.required=Array.from(m)),d.catchall?._zod.def.type==="never"?u.additionalProperties=!1:d.catchall?d.catchall&&(u.additionalProperties=Sn(d.catchall,i,{...r,path:[...r.path,"additionalProperties"]})):i.io==="output"&&(u.additionalProperties=!1)},dz=(n,i,l,r)=>{const u=n._zod.def,d=u.inclusive===!1,f=u.options.map((p,m)=>Sn(p,i,{...r,path:[...r.path,d?"oneOf":"anyOf",m]}));d?l.oneOf=f:l.anyOf=f},hz=(n,i,l,r)=>{const u=n._zod.def,d=Sn(u.left,i,{...r,path:[...r.path,"allOf",0]}),f=Sn(u.right,i,{...r,path:[...r.path,"allOf",1]}),p=v=>"allOf"in v&&Object.keys(v).length===1,m=[...p(d)?d.allOf:[d],...p(f)?f.allOf:[f]];l.allOf=m},mz=(n,i,l,r)=>{const u=n._zod.def,d=Sn(u.innerType,i,r),f=i.seen.get(n);i.target==="openapi-3.0"?(f.ref=u.innerType,l.nullable=!0):l.anyOf=[d,{type:"null"}]},pz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType},gz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType,l.default=JSON.parse(JSON.stringify(u.defaultValue))},vz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType,i.io==="input"&&(l._prefault=JSON.parse(JSON.stringify(u.defaultValue)))},yz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType;let f;try{f=u.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}l.default=f},bz=(n,i,l,r)=>{const u=n._zod.def,d=u.in._zod.traits.has("$ZodTransform"),f=i.io==="input"?d?u.out:u.in:u.out;Sn(f,i,r);const p=i.seen.get(n);p.ref=f},_z=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType,l.readOnly=!0},V0=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType},Sz=I("ZodISODateTime",(n,i)=>{zx.init(n,i),Ot.init(n,i)});fu)DELIM" +R"DELIM(nction xz(n){return Ow(Sz,n)}const wz=I("ZodISODate",(n,i)=>{Ex.init(n,i),Ot.init(n,i)});function zz(n){return Mw(wz,n)}const Ez=I("ZodISOTime",(n,i)=>{Tx.init(n,i),Ot.init(n,i)});function Tz(n){return jw(Ez,n)}const Az=I("ZodISODuration",(n,i)=>{Ax.init(n,i),Ot.init(n,i)});function Nz(n){return kw(Az,n)}const Oz=(n,i)=>{E0.init(n,i),n.name="ZodError",Object.defineProperties(n,{format:{value:l=>pS(n,l)},flatten:{value:l=>mS(n,l)},addIssue:{value:l=>{n.issues.push(l),n.message=JSON.stringify(n.issues,uh,2)}},addIssues:{value:l=>{n.issues.push(...l),n.message=JSON.stringify(n.issues,uh,2)}},isEmpty:{get(){return n.issues.length===0}}})},Mi=I("ZodError",Oz,{Parent:Error}),Mz=Gh(Mi),jz=Yh(Mi),kz=Uc(Mi),Rz=Zc(Mi),Cz=yS(Mi),Dz=bS(Mi),Uz=_S(Mi),Zz=SS(Mi),$z=xS(Mi),Lz=wS(Mi),Hz=zS(Mi),qz=ES(Mi),Iv=new WeakMap;function Lo(n,i,l){const r=Object.getPrototypeOf(n);let u=Iv.get(r);if(u||(u=new Set,Iv.set(r,u)),!u.has(i)){u.add(i);for(const d in l){const f=l[d];Object.defineProperty(r,d,{configurable:!0,enumerable:!1,get(){const p=f.bind(this);return Object.defineProperty(this,d,{configurable:!0,writable:!0,enumerable:!0,value:p}),p},set(p){Object.defineProperty(this,d,{configurable:!0,writable:!0,enumerable:!0,value:p})}})}}}const Zt=I("ZodType",(n,i)=>(Ut.init(n,i),Object.assign(n["~standard"],{jsonSchema:{input:zc(n,"input"),output:zc(n,"output")}}),n.toJSONSchema=Ww(n,{}),n.def=i,n.type=i.type,Object.defineProperty(n,"_def",{value:i}),n.parse=(l,r)=>Mz(n,l,r,{callee:n.parse}),n.safeParse=(l,r)=>kz(n,l,r),n.parseAsync=async(l,r)=>jz(n,l,r,{callee:n.parseAsync}),n.safeParseAsync=async(l,r)=>Rz(n,l,r),n.spa=n.safeParseAsync,n.encode=(l,r)=>Cz(n,l,r),n.decode=(l,r)=>Dz(n,l,r),n.encodeAsync=async(l,r)=>Uz(n,l,r),n.decodeAsync=async(l,r)=>Zz(n,l,r),n.safeEncode=(l,r)=>$z(n,l,r),n.safeDecode=(l,r)=>Lz(n,l,r),n.safeEncodeAsync=async(l,r)=>Hz(n,l,r),n.safeDecodeAsync=async(l,r)=>qz(n,l,r),Lo(n,"ZodType",{check(...l){const r=this.def;return this.clone(Nl(r,{checks:[...r.checks??[],...l.map(u=>typeof u=="function"?{_zod:{check:u,def:{check:"custom"},onattach:[]}}:u)]}),{parent:!0})},with(...l){return this.check(...l)},clone(l,r){return Ol(this,l,r)},brand(){return this},register(l,r){return l.add(this,r),this},refine(l,r){return this.check(R2(l,r))},superRefine(l,r){return this.check(C2(l,r))},overwrite(l){return this.check(yr(l))},optional(){return ty(this)},exactOptional(){return _2(this)},nullable(){return ny(this)},nullish(){return ty(ny(this))},nonoptional(l){return T2(this,l)},array(){return Kh(this)},or(l){return Fh([this,l])},and(l){return p2(this,l)},transform(l){return iy(this,y2(l))},default(l){return w2(this,l)},prefault(l){return E2(this,l)},catch(l){return N2(this,l)},pipe(l){return iy(this,l)},readonly(){return j2(this)},describe(l){const r=this.clone();return Ao.add(r,{description:l}),r},meta(...l){if(l.length===0)return Ao.get(this);const r=this.clone();return Ao.add(r,l[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(l){return l(this)}}),Object.defineProperty(n,"description",{get(){return Ao.get(n)?.description},configurable:!0}),n)),G0=I("_ZodString",(n,i)=>{Qh.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,u,d)=>tz(n,r,u);const l=n._zod.bag;n.format=l.format??null,n.minLength=l.minimum??null,n.maxLength=l.maximum??null,Lo(n,"_ZodString",{regex(...r){return this.check($w(...r))},includes(...r){return this.check(qw(...r))},startsWith(...r){return this.check(Bw(...r))},endsWith(...r){return this.check(Vw(...r))},min(...r){return this.check(wc(...r))},max(...r){return this.check($0(...r))},length(...r){return this.check(L0(...r))},nonempty(...r){return this.check(wc(1,...r))},lowercase(r){return this.check(Lw(r))},uppercase(r){return this.check(Hw(r))},trim(){return this.check(Yw())},normalize(...r){return this.check(Gw(...r))},toLowerCase(){return this.check(Qw())},toUpperCase(){return this.check(Kw())},slugify(){return this.check(Fw())}})}),Bz=I("ZodString",(n,i)=>{Qh.init(n,i),G0.init(n,i),n.email=l=>n.check(ow(Vz,l)),n.url=l=>n.check(hw(Gz,l)),n.jwt=l=>n.check(Nw(l2,l)),n.emoji=l=>n.check(mw(Yz,l)),n.guid=l=>n.check(Kv(Pv,l)),n.uuid=l=>n.check(uw(fc,l)),n.uuidv4=l=>n.check(cw(fc,l)),n.uuidv6=l=>n.check(fw(fc,l)),n.uuidv7=l=>n.check(dw(fc,l)),n.nanoid=l=>n.check(pw(Qz,l)),n.guid=l=>n.check(Kv(Pv,l)),n.cuid=l=>n.check(gw(Kz,l)),n.cuid2=l=>n.check(vw(Fz,l)),n.ulid=l=>n.check(yw(Jz,l)),n.base64=l=>n.check(Ew(n2,l)),n.base64url=l=>n.check(Tw(i2,l)),n.xid=l=>n.check(bw(Xz,l)),n.ksuid=l=>n.check(_w(Iz,l)),n.ipv4=l=>n.check(Sw(Pz,l)),n.ipv6=l=>n.check(xw(Wz,l)),n.cidrv4=l=>n.check(ww(e2,l)),n.cidrv6=l=>n.check(zw(t2,l)),n.e164=l=>n.check(Aw(a2,l)),n.datetime=l=>n.check(xz(l)),n.date=l=>n.check(zz(l)),n.time=l=>n.check(Tz(l)),n.duration=l=>n.check(Nz(l))});function os(n){return rw(Bz,n)}const Ot=I("ZodStringFormat",(n,i)=>{Tt.init(n,i),G0.init(n,i)}),Vz=I("ZodEmail",(n,i)=>{px.init(n,i),Ot.init(n,i)}),Pv=I("ZodGUID",(n,i)=>{hx.init(n,i),Ot.init(n,i)}),fc=I("ZodUUID",(n,i)=>{mx.init(n,i),Ot.init(n,i)}),Gz=I("ZodURL",(n,i)=>{gx.init(n,i),Ot.init(n,i)}),Yz=I("ZodEmoji",(n,i)=>{vx.init(n,i),Ot.init(n,i)}),Qz=I("ZodNanoID",(n,i)=>{yx.init(n,i),Ot.init(n,i)}),Kz=I("ZodCUID",(n,i)=>{bx.init(n,i),Ot.init(n,i)}),Fz=I("ZodCUID2",(n,i)=>{_x.init(n,i),Ot.init(n,i)}),Jz=I("ZodULID",(n,i)=>{Sx.init(n,i),Ot.init(n,i)}),Xz=I("ZodXID",(n,i)=>{xx.init(n,i),Ot.init(n,i)}),Iz=I("ZodKSUID",(n,i)=>{wx.init(n,i),Ot.init(n,i)}),Pz=I("ZodIPv4",(n,i)=>{Nx.init(n,i),Ot.init(n,i)}),Wz=I("ZodIPv6",(n,i)=>{Ox.init(n,i),Ot.init(n,i)}),e2=I("ZodCIDRv4",(n,i)=>{Mx.init(n,i),Ot.init(n,i)}),t2=I("ZodCIDRv6",(n,i)=>{jx.init(n,i),Ot.init(n,i)}),n2=I("ZodBase64",(n,i)=>{kx.init(n,i),Ot.init(n,i)}),i2=I("ZodBase64URL",(n,i)=>{Cx.init(n,i),Ot.init(n,i)}),a2=I("ZodE164",(n,i)=>{Dx.init(n,i),Ot.init(n,i)}),l2=I("ZodJWT",(n,i)=>{Zx.init(n,i),Ot.init(n,i)}),Y0=I("ZodNumber",(n,i)=>{C0.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,u,d)=>nz(n,r,u),Lo(n,"ZodNumber",{gt(r,u){return this.check(Jv(r,u))},gte(r,u){return this.check(Id(r,u))},min(r,u){return this.check(Id(r,u))},lt(r,u){return this.check(Fv(r,u))},lte(r,u){return this.check(Xd(r,u))},max(r,u){return this.check(Xd(r,u))},int(r){return this.check(Wv(r))},safe(r){return this.check(Wv(r))},positive(r){return this.check(Jv(0,r))},nonnegative(r){return this.check(Id(0,r))},negative(r){return this.check(Fv(0,r))},nonpositive(r){return this.check(Xd(0,r))},multipleOf(r,u){return this.check(Xv(r,u))},step(r,u){return this.check(Xv(r,u))},finite(){return this}});const l=n._zod.bag;n.minValue=Math.max(l.minimum??Number.NEGATIVE_INFINITY,l.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(l.maximum??Number.POSITIVE_INFINITY,l.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(l.format??"").includes("int")||Number.isSafeInteger(l.multipleOf??.5),n.isFinite=!0,n.format=l.format??null});function ra(n){return Rw(Y0,n)}const s2=I("ZodNumberFormat",(n,i)=>{$x.init(n,i),Y0.init(n,i)});function Wv(n){return Cw(s2,n)}const r2=I("ZodBoolean",(n,i)=>{Lx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>iz(n,l,r)});function nr(n){return Dw(r2,n)}const o2=I("ZodUnknown",(n,i)=>{Hx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>lz()});function ey(){return Uw(o2)}const u2=I("ZodNever",(n,i)=>{qx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>az(n,l,r)});function c2(n){return Zw(u2,n)}const f2=I("ZodArray",(n,i)=>{Bx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>cz(n,l,r,u),n.element=i.element,Lo(n,"ZodArray",{min(l,r){return this.check(wc(l,r))},nonempty(l){return this.check(wc(1,l))},max(l,r){return this.check($0(l,r))},length(l,r){return this.check(L0(l,r))},unwrap(){return this.element}})});function Kh(n,i){return Jw(f2,n,i)}const d2=I("ZodObject",(n,i)=>{Gx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>fz(n,l,r,u),ht(n,"shape",()=>i.shape),Lo(n,"ZodObject",{keyof(){return Ec(Object.keys(this._zod.def.shape))},catch)DELIM" +R"DELIM(all(l){return this.clone({...this._zod.def,catchall:l})},passthrough(){return this.clone({...this._zod.def,catchall:ey()})},loose(){return this.clone({...this._zod.def,catchall:ey()})},strict(){return this.clone({...this._zod.def,catchall:c2()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(l){return oS(this,l)},safeExtend(l){return uS(this,l)},merge(l){return cS(this,l)},pick(l){return sS(this,l)},omit(l){return rS(this,l)},partial(...l){return fS(Q0,this,l[0])},required(...l){return dS(K0,this,l[0])}})});function Ml(n,i){const l={type:"object",shape:n??{},...Ne(i)};return new d2(l)}const h2=I("ZodUnion",(n,i)=>{Yx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>dz(n,l,r,u),n.options=i.options});function Fh(n,i){return new h2({type:"union",options:n,...Ne(i)})}const m2=I("ZodIntersection",(n,i)=>{Qx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>hz(n,l,r,u)});function p2(n,i){return new m2({type:"intersection",left:n,right:i})}const fh=I("ZodEnum",(n,i)=>{Kx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,u,d)=>sz(n,r,u),n.enum=i.entries,n.options=Object.values(i.entries);const l=new Set(Object.keys(i.entries));n.extract=(r,u)=>{const d={};for(const f of r)if(l.has(f))d[f]=i.entries[f];else throw new Error(`Key ${f} not found in enum`);return new fh({...i,checks:[],...Ne(u),entries:d})},n.exclude=(r,u)=>{const d={...i.entries};for(const f of r)if(l.has(f))delete d[f];else throw new Error(`Key ${f} not found in enum`);return new fh({...i,checks:[],...Ne(u),entries:d})}});function Ec(n,i){const l=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new fh({type:"enum",entries:l,...Ne(i)})}const g2=I("ZodLiteral",(n,i)=>{Fx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>rz(n,l,r),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 yc(n,i){return new g2({type:"literal",values:Array.isArray(n)?n:[n],...Ne(i)})}const v2=I("ZodTransform",(n,i)=>{Jx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>uz(n,l),n._zod.parse=(l,r)=>{if(r.direction==="backward")throw new b0(n.constructor.name);l.addIssue=d=>{if(typeof d=="string")l.issues.push(Do(d,l.value,i));else{const f=d;f.fatal&&(f.continue=!1),f.code??(f.code="custom"),f.input??(f.input=l.value),f.inst??(f.inst=n),l.issues.push(Do(f))}};const u=i.transform(l.value,l);return u instanceof Promise?u.then(d=>(l.value=d,l.fallback=!0,l)):(l.value=u,l.fallback=!0,l)}});function y2(n){return new v2({type:"transform",transform:n})}const Q0=I("ZodOptional",(n,i)=>{Z0.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>V0(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function ty(n){return new Q0({type:"optional",innerType:n})}const b2=I("ZodExactOptional",(n,i)=>{Xx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>V0(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function _2(n){return new b2({type:"optional",innerType:n})}const S2=I("ZodNullable",(n,i)=>{Ix.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>mz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function ny(n){return new S2({type:"nullable",innerType:n})}const x2=I("ZodDefault",(n,i)=>{Px.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>gz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function w2(n,i){return new x2({type:"default",innerType:n,get defaultValue(){return typeof i=="function"?i():x0(i)}})}const z2=I("ZodPrefault",(n,i)=>{Wx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>vz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function E2(n,i){return new z2({type:"prefault",innerType:n,get defaultValue(){return typeof i=="function"?i():x0(i)}})}const K0=I("ZodNonOptional",(n,i)=>{ew.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>pz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function T2(n,i){return new K0({type:"nonoptional",innerType:n,...Ne(i)})}const A2=I("ZodCatch",(n,i)=>{tw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>yz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function N2(n,i){return new A2({type:"catch",innerType:n,catchValue:typeof i=="function"?i:()=>i})}const O2=I("ZodPipe",(n,i)=>{nw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>bz(n,l,r,u),n.in=i.in,n.out=i.out});function iy(n,i){return new O2({type:"pipe",in:n,out:i})}const M2=I("ZodReadonly",(n,i)=>{iw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>_z(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function j2(n){return new M2({type:"readonly",innerType:n})}const k2=I("ZodCustom",(n,i)=>{aw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>oz(n,l)});function R2(n,i={}){return Xw(k2,n,i)}function C2(n,i){return Iw(n,i)}const Ho=[{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"}],Tc=[{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:"count"},{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:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],D2=Ml({level:ra().int().nonnegative(),time:ra().int().nonnegative(),message:os()}),U2=Ml({event:ra().int().nonnegative(),value:ra().nonn)DELIM" +R"DELIM(egative(),time:ra().int().nonnegative()}),Z2=Ml({previous:ra().nonnegative()});Fh([D2,U2,Z2]);const Jh=2**Ho.length-1,ur=Jh,$2=2**0+2**1+2**2+2**6+2**7;function L2(n,i){return Number.isInteger(i)&&i>=0&&i0?`${String(l)}d ${String(r)}h`:r>0?`${String(r)}h ${String(u)}m`:u>0?`${String(u)}m ${String(d)}s`:`${String(d)}s`}function J0(n,i){switch(qo(n).valueKind){case"height":return`height ${Hn(i)}`;case"seconds":return`${cr(i)} s`;case"milliseconds":return`${cr(i)} ms`;case"microseconds":return`${cr(i)} µs`;case"count":return Hn(i);default:return String(i)}}function Q2(n){return n>=100?`${cr(n,0)}/s`:n>=10?`${cr(n,1)}/s`:`${cr(n,2)}/s`}function K2(n){try{const i=new URL(n),l=i.pathname==="/"?"":i.pathname.replace(/\/$/u,"");return`${i.host}${l}`}catch{return n}}const Ac=32,F2=[{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"}],J2={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 X2({metrics:n,paused:i,onPausedChange:l,onClear:r}){const[u,d]=re.useState(""),[f,p]=re.useState("all"),[m,v]=re.useState({offset:0,search:u,category:f}),w=m.search===u&&m.category===f?m.offset:0,S=re.useRef(null),z=re.useSyncExternalStore(n.subscribeEvents,n.getEventWindow,n.getEventWindow);return re.useEffect(()=>{n.setEventQuery({search:u,category:f,offset:w})},[n,u,f,w]),re.useEffect(()=>{S.current&&(S.current.scrollTop=0)},[u,f]),_.jsxs("section",{className:"space-y-4",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Node lifecycle"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Live events"}),_.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"Heights are event payloads; timing values retain their source units."}),_.jsx("p",{className:"text-textMuted mt-1 text-xs",children:"Pause freezes this view; collection and charts continue."})]}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{i&&(S.current&&(S.current.scrollTop=0),v({offset:0,search:u,category:f})),l(!i)},className:"border-accent/35 text-accent hover:bg-accent/10 rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:i?"Resume display":"Pause display"}),_.jsx("button",{type:"button",onClick:r,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Clear"})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 flex flex-wrap gap-3 rounded-xl border p-4",children:[_.jsxs("label",{className:"min-w-56 flex-1",children:[_.jsx("span",{className:"sr-only",children:"Search events"}),_.jsx("input",{type:"search",value:u,onChange:T=>{d(T.target.value)},placeholder:"Search event names or values…",className:"border-accent/25 bg-background/70 text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{children:[_.jsx("span",{className:"sr-only",children:"Filter event category"}),_.jsx("select",{value:f,onChange:T=>{p(T.target.value)},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent rounded-lg border px-3 py-2 text-sm focus:ring-0",children:F2.map(T=>_.jsx("option",{value:T.value,children:T.label},T.value))})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 overflow-hidden rounded-xl border",children:[_.jsxs("div",{className:"border-accent/15 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[_.jsx("span",{children:i?"Display paused · collection continues":"Live stream · newest first"}),_.jsxs("span",{children:[String(z.matched)," matching · ",String(z.retained)," retained"]})]}),_.jsx("div",{ref:S,role:"region","aria-label":"Scrollable event history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:T=>{v({offset:Math.max(0,Math.floor(T.currentTarget.scrollTop/Ac)-8),search:u,category:f})},children:z.matched===0?_.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching events."}):_.jsx("ol",{"aria-label":"Received events",className:"relative min-w-[32rem]",style:{height:z.matched*Ac},children:z.events.map((T,j)=>_.jsx(I2,{event:T,index:z.offset+j,total:z.matched},T.id))})})]}),_.jsxs("details",{className:"border-accent/20 bg-surface/50 rounded-xl border",children:[_.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-4 py-3 text-sm",children:["Event contract (",String(Tc.length)," identifiers)"]}),_.jsx("div",{className:"grid gap-2 border-t border-white/5 p-4 sm:grid-cols-2 lg:grid-cols-3",children:Tc.map(T=>_.jsxs("div",{className:"text-xs",children:[_.jsx("span",{className:"text-textMuted font-mono",children:String(T.id).padStart(2,"0")}),_.jsx("span",{className:"text-textPrimary ml-2",children:T.name})]},T.id))})]})]})}const I2=re.memo(function({event:i,index:l,total:r}){const u=qo(i.event);return _.jsxs("li",{"aria-setsize":r,"aria-posinset":l+1,className:"absolute inset-x-0 grid grid-cols-[8.5rem_10rem_minmax(0,1fr)] items-center gap-2 border-b border-white/5 px-4 text-xs",style:{top:l*Ac,height:Ac},children:[_.jsx("time",{dateTime:new Date(i.time).toISOString(),className:"text-textMuted font-mono tabular-nums",children:jo(i.time)}),_.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${J2[u.category]}`,children:u.name}),_.jsx("span",{className:"text-textPrimary font-mono tabular-nums",children:J0(i.event,i.value)})]})}),Nc=32,ay={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 P2({metrics:n,delivery:i,status:l,logFilter:r,paused:u,onLogFilterChange:d,onPausedChange:f,onClear:p}){const[m,v]=re.useState(""),[w,S]=re.useState({offset:0,search:m,filter:r}),z=w.search===m&&w.filter===r?w.offset:0,[T,j]=re.useState(null),L=re.useRef(null),V=re.useSyncExternalStore(n.subscribeLogs,n.getLogWindow,n.getLogWindow);return re.useEffect(()=>{n.setLogQuery({search:m,filter:r,offset:z})},[n,m,r,z]),re.useEffect(()=>{L.current&&(L.current.scrollTop=0)},[m,r]))DELIM" +R"DELIM(,_.jsxs("section",{className:"space-y-4",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Diagnostic stream"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Node logs"}),_.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"The newest 1,000 messages are retained in this browser session."})]}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{u&&(L.current&&(L.current.scrollTop=0),S({offset:0,search:m,filter:r})),f(!u)},className:"border-accent/35 text-accent hover:bg-accent/10 rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:u?"Resume display":"Pause display"}),_.jsx("button",{type:"button",onClick:p,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Clear"})]})]}),_.jsxs("fieldset",{className:"border-accent/20 bg-surface/70 space-y-3 rounded-xl border p-4",children:[_.jsx("legend",{className:"text-textPrimary px-1 text-sm font-medium",children:"Requested log levels"}),_.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."}),_.jsx("div",{className:"flex flex-wrap gap-x-5 gap-y-3",children:Ho.map(H=>_.jsxs("label",{className:"text-textPrimary flex items-center gap-2 text-sm",children:[_.jsx("input",{type:"checkbox",checked:L2(r,H.id),onChange:()=>{d(r^1<{d($2)},className:"text-accent hover:underline",children:"Operational levels"}),_.jsx("button",{type:"button",onClick:()=>{d(Jh)},className:"text-accent hover:underline",children:"All levels"}),_.jsx("button",{type:"button",onClick:()=>{d(0)},className:"text-accent hover:underline",children:"No levels"}),_.jsx("span",{className:"text-textMuted",children:"Selection is saved in this browser."})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 space-y-2 rounded-xl border p-4 text-xs",children:[_.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",l.reconnects]].map(([H,G])=>_.jsxs("div",{children:[_.jsx("dt",{className:"text-textMuted",children:H}),_.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:G.toLocaleString()})]},H))}),_.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."}),_.jsxs("p",{className:"text-textMuted",role:"status",children:["Admin connection: ",l.phase,l.error?` · ${l.error}`:""]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 flex flex-wrap gap-3 rounded-xl border p-4",children:[_.jsxs("label",{className:"min-w-56 flex-1",children:[_.jsx("span",{className:"sr-only",children:"Search logs"}),_.jsx("input",{type:"search",value:m,onChange:H=>{v(H.target.value)},placeholder:"Search received messages…",className:"border-accent/25 bg-background/70 text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsx("p",{className:"text-textMuted self-center text-xs",children:"Search filters received messages only."})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 overflow-hidden rounded-xl border",children:[_.jsxs("div",{className:"border-accent/15 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[_.jsx("span",{children:u?"Display paused · collection continues":r===0?"Log delivery disabled":z>0?"Viewing older rows · collection continues":"Live stream · newest first"}),_.jsxs("span",{children:[String(V.matched)," matching · ",String(V.retained)," retained"]})]}),_.jsx("div",{ref:L,role:"region","aria-label":"Scrollable log history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:H=>{S({offset:Math.max(0,Math.floor(H.currentTarget.scrollTop/Nc)-8),search:m,filter:r})},children:V.matched===0?_.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching log messages."}):_.jsx("ol",{"aria-label":"Received logs",className:"relative",style:{height:V.matched*Nc},children:V.logs.map((H,G)=>_.jsx(W2,{log:H,index:V.offset+G,total:V.matched,onSelect:j},H.id))})})]}),_.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[_.jsx("p",{className:"text-textMuted",children:"Select a row to read its full message."}),!u&&_.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{L.current&&(L.current.scrollTop=0),S({offset:0,search:m,filter:r})},children:"Jump to latest"})]}),T&&_.jsx(eE,{log:T,onClose:()=>{j(null)}})]})}const W2=re.memo(function({log:i,index:l,total:r,onSelect:u}){return _.jsx("li",{"aria-setsize":r,"aria-posinset":l+1,className:"absolute inset-x-0 border-b border-white/5",style:{top:l*Nc,height:Nc},children:_.jsxs("button",{type:"button",onClick:()=>{u(i)},className:"grid h-full w-full grid-cols-[5.5rem_4.5rem_minmax(0,1fr)] items-center gap-2 px-4 text-left text-xs hover:bg-white/5 focus-visible:bg-white/10 sm:grid-cols-[7.5rem_7.5rem_minmax(0,1fr)]",children:[_.jsx("time",{dateTime:new Date(i.time).toISOString(),className:"text-textMuted font-mono tabular-nums",children:jo(i.time,!1)}),_.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${ay[i.level]??ay[8]}`,children:F0(i.level).name}),_.jsx("span",{className:"text-textPrimary min-w-0 truncate font-mono",children:i.message.replaceAll(` +`," ↵ ")})]})})});function eE({log:n,onClose:i}){const l=re.useRef(null);return re.useEffect(()=>{const r=l.current;return r?.showModal(),()=>{r?.close()}},[]),_.jsxs("dialog",{ref:l,onClose:i,"aria-labelledby":"log-detail-title",className:"border-accent/30 bg-surface text-textPrimary fixed inset-0 m-auto max-h-[80vh] w-[min(60rem,90vw)] rounded-xl border p-5 shadow-xl backdrop:bg-black/70",children:[_.jsxs("header",{className:"mb-4 flex items-center justify-between gap-4",children:[_.jsxs("h3",{id:"log-detail-title",className:"font-semibold",children:[F0(n.level).label," · ",new Date(n.time).toISOString()]}),_.jsx("button",{type:"button",onClick:i,className:"text-accent rounded px-3 py-2",children:"Close"})]}),_.jsx("pre",{className:"text-sm break-words whitespace-pre-wrap",children:n.message})]})}const Pd=["line","area","bar"],ly=["line","step","area"],tE=["line","step","area"],X0={"occurrence-count":{id:"occurrence-count",label:"Occurrences per bucket",description:"Number of frames observed in each one-second bucket.",unit:"occurrences",chartTypes:Pd},"occurrence-rate":{id:"occurrence-rate",label:"Occurrence rate",description:"Frames observed per second.",unit:"occurrences-per-second",chartTypes:Pd},"cumulative-occurrences":{id:"cumulative-occurrences",label:"Cumulative occurrences",description:"Running number of frames observed during this browser session.",unit:"occurrences",chartTypes:ly},"payload-latest":{id:"payload-latest",label:"Latest value",description:"Most recently observed payload value.",unit:"count",chartTypes:tE},"payload-average":{id:"payload-average",label:"Average value",description:"Average payload value within each on)DELIM" +R"DELIM(e-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:ly},"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:Pd}},br=["occurrence-rate","occurrence-count","cumulative-occurrences"],nE=["payload-latest","payload-maximum","payload-change-rate",...br],iE=["payload-average","payload-latest","payload-minimum","payload-maximum",...br],aE=["payload-sum","payload-cumulative","payload-latest","payload-average",...br];function Oi(n){return`event:${String(n)}`}function wl(n){return`log:${String(n)}`}const Oc="native:top";function lE(n){switch(n){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";default:return"unknown"}}function sE(n){switch(n){case"height":return nE;case"duration":return iE;case"count":return aE;default:return br}}function rE(n){switch(n){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function I0(n){const i=qo(n),l=lE(i.valueKind);return{id:Oi(n),source:"event",sourceId:n,name:i.name,label:i.label,category:i.category,payloadKind:l,allowedMeasures:sE(l),defaultMeasure:rE(l),description:l==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${i.label} event with a ${l} payload.`}}const oE=[...Tc.map(n=>I0(n.id)),...Ho.map(n=>({id:wl(n.id),source:"log",sourceId:n.id,name:n.name,label:`${n.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:br,defaultMeasure:"occurrence-rate",description:`${n.label} log message volume. Message text is not interpreted as numeric data.`})),{id:Oc,source:"native",sourceId:"top",name:"canonical_top",label:"Canonical 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."}],Xh=oE,uE=new Map(Xh.map(n=>[n.id,n]));function $a(n){const i=uE.get(n);if(i)return i;const l=/^event:(\d+)$/u.exec(n);return l?I0(Number(l[1])):{id:n,source:"event",sourceId:-1,name:n,label:n,category:"unknown",payloadKind:"unknown",allowedMeasures:br,defaultMeasure:"occurrence-rate",description:"Unknown signal; only occurrence measurements are available."}}function El(n,i){const l=X0[i];if(i.startsWith("occurrence")||i==="cumulative-occurrences")return l;const r=i==="payload-change-rate"?"height-per-second":n.payloadKind==="height"?"height":n.payloadKind==="duration"?"milliseconds":"count";return{...l,unit:r}}function cE(n,i){return n.allowedMeasures.includes(i)}function fE(n,i){return V2(n,i)??i}const dE=3600*1e3,hE=1e3,mE=1e3,pE=1e3;class sy{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 l=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),l}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 l=0;lthis.#M;getRecentLogs=()=>this.#i.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=i=>(this.#n.add(i),()=>{this.#n.delete(i)});start(){this.#S||(this.tick(),this.#S=setInterval(()=>{this.tick()},1e3))}stop(){this.#S&&(clearInterval(this.#S),this.#S=null),this.#_&&(clearTimeout(this.#_),this.#_=null)}ingest(i,l=this.#e()){const r=this.#O(l);this.#f+=1,H2(i)?this.#D(i,r):q2(i)?this.#N(i,r):B2(i)&&(this.#E+=1),this.#k()}recordInvalidFrame(){this.#z+=1,this.#k()}recordNativeTop(i,l=this.#e()){const r=this.#O(l),u=this.#c[Oc];u?.value===i&&r-u.time<15e3||(this.#C(Oc,r,i),this.#v(r),this.#k())}clearLogs(){this.#g+=this.#i.size,this.#i.clear(),this.flush()}clearEvents(){this.#s.clear(),this.flush()}reset(){this.#i.clear(),this.#s.clear(),this.#a.clear(),this.#r={},this.#l={},this.#u={},this.#o={},this.#m={},this.#c={},this.#d={},this.#h=this.#O(this.#e()),this.#f=0,this.#y=0,this.#x=0,this.#g=0,this.#w=0,this.#E=0,this.#z=0,this.#b=null,this.#T=null,this.#A=0,this.#j(this.#h),this.flush()}tick(){const i=this.#O(this.#e());this.#j(i),this.#v(i),this.#k()}flush(){this.#_&&(clearTimeout(this.#_),this.#_=null),this.#M=this.#R();for(const i of this.#n)i()}#D(i,l){this.#y+=1,this.#b=l,this.#A+=1,this.#i.push({...i,id:this.#A,receivedAt:l})&&(this.#x+=1),this.#C(wl(i.level),l,null)}#N(i,l){this.#w+=1,this.#T=l,this.#A+=1,this.#s.push({...i,id:this.#A,receivedAt:l}),this.#C(Oi(i.event),l,fE(i.event,i.value))}#O(i){return Number.isFinite(i)?(this.#p=Math.max(this.#p,i),this.#p):this.#p}#C(i,l,r){const u=this.#j(l);u.snapshot=null;const d=u.signals.get(i)??gE();if(d.count+=1,dc(this.#o,i,1),r!==null){d.samples+=1,d.sum+=r,d.minimum=d.minimum===null?r:Math.min(d.minimum,r),d.maximum=d.maximum===null?r:Math.max(d.maximum,r),(d.firstAt===null||l=d.lastAt)&&(d.last=r,d.lastAt=l),dc(this.#m,i,r);const f=this.#c[i];(!f||l>=f.time)&&(this.#c[i]={value:r,time:l}),this.#d[i]=Math.max(this.#d[i]??r,r)}u.signals.set(i,d)}#j(i){const l=Math.floor(i/1e3)*1e3,r=this.#a.get(l);if(r)return r;const u={time:l,signals:new Map,snapshot:null};return this.#a.set(l,u),u}#v(i){const l=i-dE;for(const[r,u]of this.#a){if(r>=l)break;for(const[d,f]of u.signals)if(dc(this.#r,d,f.count),dc(this.#l,d,f.sum),f.last!==null&&f.lastAt!==null){const p=this.#u[d];(!p||f.lastAt>=p.time)&&(this.#u[d]={value:f.last,time:f.lastAt})}this.#a.delete(r)}}#k(){!this.#t||this.#_||(this.#_=setTimeout(()=>{this.#_=null,this.flush()},hE))}#R(){const i=[...this.#a.values()].map(l=>(l.snapshot??={time:l.time,signals:Object.fromEntries([...l.signals].map(([r,u])=>[r,{...u}]))},l.snapshot));return{now:this.#O(this.#e()),sessionStartedAt:this.#h,totalFrames:this.#f,totalLogs:this.#y,evictedLogs:this.#x,clearedLogs:this.#g,totalEvents:this.#w,totalAcks:this.#E,invalidFrames:this.#z,buckets:i,priorSignalCounts:{...this.#r},priorSignalSums:{...this.#l},priorSignalLatest:ry(this.#u),signalTotals:{...this.#o},signalSums:{...this.#m},signalLatest:ry(this.#c),signalMaximums:{...this.#d},recentLogs:this.#i.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#b,lastEventAt:this.#T}}}function vE(n,i,l,r,u=n[0]?.time??l){const d=l-r*1e3,f=d<=u,p=f?Math.floor(u/1e3)*1e3:Math.ceil(d/1e3)*1e3,m=f?u:p,v=Math.floor(l/1e3)*1e3,S=n.filter(T=>T.time>=p&&T.time<=v).reduce((T,j)=>T+(j.signals[i]?.count??0),0),z=Math.max(0,(l-m)/1e3);return z>0?S/z:0}function yE(n,i){const l=f=>vE(n.buckets,Oi(f),n.)DELIM" +R"DELIM(now,i,n.sessionStartedAt),r=l(2)+l(14);if(r>0)return{label:"Reorganizing",rate:r};const d=[{label:"Confirming blocks",rate:l(6)},{label:"Validating blocks",rate:l(5)},{label:"Archiving blocks",rate:l(3)},{label:"Synchronizing headers",rate:Math.max(l(0),l(1))}].reduce((f,p)=>p.rate>f.rate?p:f);return d.rate>0?d:{label:"Idle",rate:0}}const Lc=18,bE=600*1e3;function _E(n,i,l){if(n===null||!Number.isSafeInteger(n)||n<0||i===null||!Number.isSafeInteger(i.height)||i.height<0||i.height>n||!Number.isFinite(i.timestamp)||i.timestamp<=0||!Number.isFinite(l)||l<0)return null;const r=Math.max(0,l-i.timestamp*1e3),u=Math.max(n,i.height+Math.ceil(r/bE));return{blocksRemaining:u-n,estimatedTop:u,progress:u===0?100:n/u*100}}const SE={idle:"border-slate-500/40 bg-slate-500/10 text-slate-300",connecting:"border-amber-500/40 bg-amber-500/10 text-amber-300",connected:"border-emerald-500/40 bg-emerald-500/10 text-emerald-300",reconnecting:"border-orange-500/40 bg-orange-500/10 text-orange-300"};function xE({phase:n,label:i}){return _.jsxs("span",{className:`inline-flex items-center gap-2 rounded-full border px-3 py-1 text-xs tracking-wide uppercase ${SE[n]}`,children:[_.jsx("span",{className:"h-2 w-2 rounded-full bg-current","aria-hidden":"true"}),i]})}function hc({label:n,value:i,detail:l,numeric:r=!0,emphasized:u=!1}){return _.jsxs("div",{className:"min-w-0 border-white/10 px-4 py-3 even:border-l lg:border-l lg:first:border-l-0 [&:nth-child(n+3)]:border-t lg:[&:nth-child(n+3)]:border-t-0",children:[_.jsx("dt",{className:"text-textMuted text-xs",children:n}),_.jsx("dd",{className:`mt-1 leading-7 font-medium break-words ${r?"font-mono text-xl tracking-tight tabular-nums":"text-base"} ${u?"text-accent":"text-textPrimary"}`,children:i}),_.jsx("dd",{className:"text-textMuted mt-0.5 text-xs leading-4 break-words",children:l})]})}function wE({confirmed:n,estimate:i}){if(n===null||i===null||i.blocksRemaining<=Lc)return null;const l=Math.min(99.99,Math.max(0,i.progress)),r=`${l.toFixed(2)}%`;return _.jsxs("section",{className:"border-accent/25 bg-surface/70 overflow-hidden rounded-xl border","aria-labelledby":"node-sync-progress-title",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-3 px-5 pt-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Node synchronization"}),_.jsx("h2",{id:"node-sync-progress-title",className:"mt-1 font-semibold",children:"Catching up to estimated chain tip"})]}),_.jsx("p",{className:"text-accent font-mono text-xl font-semibold tabular-nums",children:r})]}),_.jsx("div",{className:"px-5 pt-4",children:_.jsx("div",{role:"progressbar","aria-label":"Node synchronization progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Number(l.toFixed(2)),"aria-valuetext":`Approximately ${Hn(i.blocksRemaining)} blocks remaining`,className:"bg-background h-3 overflow-hidden rounded-full border border-white/5",children:_.jsx("div",{className:"bg-accent h-full rounded-full transition-[width] duration-700",style:{width:`${String(l)}%`}})})}),_.jsxs("dl",{className:"mt-5 grid gap-px bg-white/5 text-sm sm:grid-cols-3",children:[_.jsx(Wd,{label:"Confirmed top",value:Hn(n)}),_.jsx(Wd,{label:"Estimated chain tip",value:Hn(i.estimatedTop)}),_.jsx(Wd,{label:"Estimated blocks remaining",value:Hn(i.blocksRemaining)})]}),_.jsx("p",{className:"bg-surface text-textMuted border-t border-white/5 px-5 py-2 text-[11px]",children:"Estimated from the confirmed block timestamp and your browser clock, assuming one block every 10 minutes. Actual block counts may differ."})]})}function Wd({label:n,value:i}){return _.jsxs("div",{className:"bg-surface px-5 py-3",children:[_.jsx("dt",{className:"text-textMuted text-xs",children:n}),_.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:i})]})}const lr=16,dh=8,Ih=80,zE=[300,900,3600],hh=["line","step","area","bar"],EE=["linear","compressed"],bn=["#ffa022","#38bdf8","#34d399","#c084fc","#fb7185","#e879f9","#facc15","#60a5fa"],TE=Ec(["occurrence-count","occurrence-rate","cumulative-occurrences","payload-latest","payload-average","payload-minimum","payload-maximum","payload-sum","payload-cumulative","payload-change-rate"]),AE=Ml({id:os().min(1).max(100),signalId:os().min(1).max(100),measure:TE,color:os().regex(/^#[\da-f]{6}$/iu),label:os().max(80).optional()}).strict(),P0=Ml({id:os().min(1).max(100),title:os().trim().min(1).max(Ih),visualization:Ec(hh),scale:Ec(EE).default("linear"),range:Fh([yc(300),yc(900),yc(3600)]),series:Kh(AE).min(1).max(dh)}).strict(),NE=Ml({version:yc(1),charts:Kh(P0).max(lr)}).strict(),W0={id:"default-sync-pipeline",title:"Sync pipeline",visualization:"line",scale:"linear",range:900,series:[hi("sync-header",Oi(0),"occurrence-rate",bn[3]),hi("sync-archive",Oi(3),"occurrence-rate",bn[0]),hi("sync-validate",Oi(5),"occurrence-rate",bn[1]),hi("sync-confirm",Oi(6),"occurrence-rate",bn[2])]},OE={id:"default-chain-progress",title:"Chain progress",visualization:"step",scale:"linear",range:900,series:[hi("progress-top",Oc,"payload-latest",bn[0]),hi("progress-organized",Oi(13),"payload-latest",bn[2]),hi("progress-confirmed",Oi(6),"payload-latest",bn[1])]},ME={id:"default-log-volume",title:"Log volume",visualization:"bar",scale:"linear",range:900,series:[hi("logs-news",wl(1),"occurrence-rate",bn[2]),hi("logs-session",wl(2),"occurrence-rate",bn[3]),hi("logs-protocol",wl(3),"occurrence-rate",bn[1]),hi("logs-remote",wl(5),"occurrence-rate",bn[7]),hi("logs-fault",wl(6),"occurrence-rate",bn[4]),hi("logs-quitting",wl(7),"occurrence-rate",bn[0])]},Ph=[{id:"sync-pipeline",label:"Sync pipeline",description:"Header and block lifecycle throughput.",chart:W0},{id:"chain-progress",label:"Chain progress",description:"Canonical, organized, and confirmed heights.",chart:OE},{id:"log-volume",label:"Log volume",description:"Message rates grouped by log level.",chart:ME}],eb="libbitcoinAdminDashboardCharts";let uy=0;function hi(n,i,l,r){return{id:n,signalId:i,measure:l,color:r}}function Mc(n){return uy+=1,`${n}-${Date.now().toString(36)}-${String(uy)}`}function Wh(n,i=!1){return{...n,id:i?Mc("chart"):n.id,series:n.series.map(l=>({...l,id:i?Mc("series"):l.id}))}}function bc(){return Ph.map(n=>Wh(n.chart))}function jE(n){const i=Ph.find(l=>l.id===n);return Wh(i?.chart??W0,!0)}function tb(){return{id:Mc("chart"),title:"Custom chart",visualization:"line",scale:"linear",range:900,series:[{id:Mc("series"),signalId:Oi(3),measure:"occurrence-rate",color:bn[0]}]}}function kE(n){const i=" copy",l=`${n.title.slice(0,Ih-i.length).trimEnd()}${i}`;return{...Wh(n,!0),title:l}}function mh(n){const i=new Set(n.series.map(l=>El($a(l.signalId),l.measure).unit));return i.size===1?[...i][0]??null:null}function nb(n){const i=P0.safeParse(n);if(!i.success)return i.error.issues[0]?.message??"Invalid chart configuration";for(const l of n.series){const r=$a(l.signalId);if(!cE(r,l.measure))return`${X0[l.measure].label} is not valid for ${r.label}.`;const u=El(r,l.measure);if(!u.chartTypes.includes(n.visualization))return`${u.label} cannot be displayed as a ${n.visualization} chart.`}return mh(n)===null?"All series on a chart must use compatible units.":null}function ib(n){const i=NE.safeParse(n);return!i.success||new Set(i.data.charts.map(l=>l.id)).size!==i.data.charts.length||i.data.charts.some(l=>new Set(l.series.map(r=>r.id)).size!==l.series.length)?null:i.data.charts.every(l=>nb(l)===null)?i.data.charts:null}function ab(){try{return globalThis.window?.localStorage??null}catch{return null}}function RE(n=ab()){try{const i=n?.getItem(eb);return i?ib(JSON.parse(i))??bc():bc()}catch{return bc()}}function CE(n,i=ab()){try{const l={version:1,charts:n};if(!ib(l))return;i?.setItem(eb,JSON.stringify(l))}catch{}}function em(n,i){return n.signals[i]}function cy(n,i,l,r){let u=r==="count"?n.priorSignalCounts[i]??0:n.priorSignalSums[i]??0;for(const d of n.buckets){if(d.time>=l)break;const f=em(d,i);u+=r==="count"?f?.count??0:f?.sum??0}return u}function)DELIM" +R"DELIM( DE(n,i,l){let r=n.priorSignalLatest[i]??null;for(const u of n.buckets){if(u.time>=l)break;const d=em(u,i);d?.last!==null&&d?.last!==void 0&&d.lastAt!==null&&(r={value:d.last,time:d.lastAt})}return r}function UE(n,i){const l=i<=n.sessionStartedAt?Math.floor(n.sessionStartedAt/1e3)*1e3:Math.ceil(i/1e3)*1e3,r=Math.floor(n.now/1e3)*1e3,u=new Map(n.buckets.map(f=>[f.time,f])),d=[];for(let f=l;f<=r;f+=1e3)d.push(u.get(f)??{time:f,signals:{}});return d}function ZE(n,i,l){const r=Math.max(n.time,l),u=Math.min(i,n.time+1e3);return Math.max(0,(u-r)/1e3)}function $E(n,i,l,r){const u=$a(r.signalId);let d=r.measure==="cumulative-occurrences"?cy(n,r.signalId,l,"count"):r.measure==="payload-cumulative"?cy(n,r.signalId,l,"sum"):0,f=DE(n,r.signalId,l);return i.map(p=>{const m=em(p,r.signalId);switch(r.measure){case"occurrence-count":return m?.count??0;case"occurrence-rate":{const v=ZE(p,n.now,n.sessionStartedAt);return v>0?(m?.count??0)/v:0}case"cumulative-occurrences":return d+=m?.count??0,d;case"payload-sum":return m&&m.samples>0?m.sum:null;case"payload-cumulative":return d+=m?.sum??0,d;case"payload-average":return m&&m.samples>0?m.sum/m.samples:null;case"payload-minimum":return m?.minimum??null;case"payload-maximum":return m?.maximum??null;case"payload-latest":return m?.last!==null&&m?.last!==void 0&&m.lastAt!==null?(f={value:m.last,time:m.lastAt},m.last):u.payloadKind==="height"?f?.value??null:null;case"payload-change-rate":{if(m?.last===null||m?.last===void 0||m.lastAt===null)return null;const v=f??(m.first!==null&&m.firstAt!==null?{value:m.first,time:m.firstAt}:null);if(f={value:m.last,time:m.lastAt},!v)return null;const w=(m.lastAt-v.time)/1e3;return w>0?(m.last-v.value)/w:null}}})}function LE(n,i){const l=n.now-i.range*1e3,r=UE(n,l),u=r[0]?.time??Math.floor(n.now/1e3)*1e3,d=i.series[0],f=El($a(d.signalId),d.measure).unit,p=i.series.filter(m=>(n.signalTotals[m.signalId]??0)===0).map(m=>m.label??$a(m.signalId).label);return{data:[r.map(m=>m.time/1e3),...i.series.map(m=>$E(n,r,u,m))],unit:f,hasObservedData:p.length({...i}))}}function YE(){const n=new Map;for(const i of Xh){const l=n.get(i.category)??[];l.push(i),n.set(i.category,l)}return[...n]}const QE=YE();function KE({chart:n,mode:i,onCancel:l,onSave:r}){const[u,d]=re.useState(()=>GE(n)),f=nb(u),p=mh(u);re.useEffect(()=>{function T(j){j.key==="Escape"&&l()}return globalThis.addEventListener("keydown",T),()=>{globalThis.removeEventListener("keydown",T)}},[l]);const m=re.useMemo(()=>new Set(hh.filter(T=>u.series.every(j=>El($a(j.signalId),j.measure).chartTypes.includes(T)))),[u.series]);function v(T,j){d(L=>({...L,series:L.series.map((V,H)=>H===T?j:V)}))}function w(T,j){const L=u.series[T],V=$a(j);v(T,{...L,signalId:j,measure:V.defaultMeasure})}function S(){if(u.series.length>=dh)return;const T=mh(u),j=Xh.find(H=>H.allowedMeasures.some(G=>T===null||El(H,G).unit===T));if(!j)return;const L=j.allowedMeasures.find(H=>T===null||El(j,H).unit===T)??j.defaultMeasure,V={id:`series-${Date.now().toString(36)}-${String(u.series.length+1)}`,signalId:j.id,measure:L,color:bn[u.series.length%bn.length]??bn[0]};d(H=>({...H,series:[...H.series,V]}))}function z(T){T.preventDefault(),!f&&r({...u,title:u.title.trim()})}return _.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/75 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:T=>{T.target===T.currentTarget&&l()},children:_.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"chart-editor-title",className:"border-accent/30 bg-surface max-h-[92vh] w-full max-w-4xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/60",children:[_.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Dashboard builder"}),_.jsx("h2",{id:"chart-editor-title",className:"mt-1 text-xl font-semibold",children:i==="add"?"Add chart":"Edit chart"})]}),_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close chart editor",children:"×"})]}),i==="add"&&_.jsxs("div",{className:"border-accent/15 border-b p-5",children:[_.jsx("p",{className:"text-textMuted mb-3 text-xs font-medium tracking-wide uppercase",children:"Start from a template"}),_.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-5",children:[Ph.map(T=>_.jsxs("button",{type:"button",onClick:()=>{d(jE(T.id))},className:"border-accent/20 bg-background/50 hover:border-accent/60 rounded-lg border p-3 text-left",children:[_.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:T.label}),_.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:T.description})]},T.id)),_.jsxs("button",{type:"button",onClick:()=>{d(tb())},className:"border-accent/20 bg-background/50 hover:border-accent/60 rounded-lg border p-3 text-left",children:[_.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:"Custom"}),_.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:"Begin with one editable series."})]})]})]}),_.jsxs("form",{onSubmit:z,className:"space-y-6 p-5",children:[_.jsxs("div",{className:"grid gap-4 md:grid-cols-[minmax(0,1fr)_11rem_11rem]",children:[_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Chart title"}),_.jsx("input",{value:u.title,maxLength:Ih,onChange:T=>{d(j=>({...j,title:T.target.value}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Chart type"}),_.jsx("select",{value:u.visualization,onChange:T=>{d(j=>({...j,visualization:T.target.value}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0",children:hh.map(T=>_.jsx("option",{value:T,disabled:!m.has(T),children:VE[T]},T))})]}),_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Time range"}),_.jsx("select",{value:u.range,onChange:T=>{d(j=>({...j,range:Number(T.target.value)}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0",children:zE.map(T=>_.jsx("option",{value:T,children:BE[T]},T))})]})]}),_.jsxs("section",{className:"space-y-3",children:[_.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[_.jsxs("div",{children:[_.jsx("h3",{className:"font-semibold",children:"Series"}),_.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:["One chart uses one axis unit",p===null?".":`: ${lb(p)}.`]})]}),_.jsx("button",{type:"button",onClick:S,disabled:u.series.length>=dh,className:"border-accent/35 text-accent hover:bg-accent/10 disabled:text-textMuted rounded-lg border px-3 py-2 text-xs font-medium uppercase disabled:cursor-not-allowed disabled:opacity-50",children:"Add series"})]}),_.jsx("div",{className:"space-y-3",children:u.series.map((T,j)=>{const L=$a(T.signalId),V=El(L,T.measure);return _.jsxs("article",{className:"border-accent/15 bg-background/35 gr)DELIM" +R"DELIM(id 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:[_.jsxs("label",{className:"space-y-1.5",children:[_.jsxs("span",{className:"text-textMuted text-xs",children:["Signal ",String(j+1)]}),_.jsx("select",{"aria-label":`Signal ${String(j+1)}`,value:T.signalId,onChange:H=>{w(j,H.target.value)},className:"border-accent/25 bg-surface text-textPrimary focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0",children:QE.map(([H,G])=>_.jsx("optgroup",{label:H,children:G.map(W=>_.jsx("option",{value:W.id,children:W.label},W.id))},H))})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Measurement"}),_.jsx("select",{"aria-label":`Measurement ${String(j+1)}`,value:T.measure,onChange:H=>{v(j,{...T,measure:H.target.value})},className:"border-accent/25 bg-surface text-textPrimary focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0",title:V.description,children:L.allowedMeasures.map(H=>_.jsx("option",{value:H,children:El(L,H).label},H))})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Display label"}),_.jsx("input",{"aria-label":`Display label ${String(j+1)}`,value:T.label??"",onChange:H=>{v(j,{...T,label:H.target.value||void 0})},placeholder:L.label,className:"border-accent/25 bg-surface text-textPrimary placeholder:text-textMuted/50 focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Color"}),_.jsx("input",{"aria-label":`Series color ${String(j+1)}`,type:"color",value:T.color,onChange:H=>{v(j,{...T,color:H.target.value})},className:"border-accent/25 bg-surface h-10 w-full rounded-lg border p-1"})]}),_.jsx("button",{type:"button",onClick:()=>{d(H=>({...H,series:H.series.filter((G,W)=>W!==j)}))},disabled:u.series.length===1,"aria-label":`Remove series ${String(j+1)}`,className:"text-textMuted self-end rounded-lg px-3 py-2 text-sm hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-30",children:"Remove"})]},T.id)})})]}),f&&_.jsx("p",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-200",children:f}),_.jsxs("div",{className:"flex justify-end gap-2 border-t border-white/5 pt-4",children:[_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-textPrimary rounded-lg px-4 py-2 text-sm",children:"Cancel"}),_.jsx("button",{type:"submit",disabled:f!==null,className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold disabled:cursor-not-allowed disabled:opacity-40",children:i==="add"?"Add chart":"Save changes"})]})]})]})})}const FE=!0,tn="u-",JE="uplot",XE=tn+"hz",IE=tn+"vt",PE=tn+"title",WE=tn+"wrap",eT=tn+"under",tT=tn+"over",nT=tn+"axis",rs=tn+"off",iT=tn+"select",aT=tn+"cursor-x",lT=tn+"cursor-y",sT=tn+"cursor-pt",rT=tn+"legend",oT=tn+"live",uT=tn+"inline",cT=tn+"series",fT=tn+"marker",fy=tn+"label",dT=tn+"value",No="width",Oo="height",zo="top",dy="bottom",ir="left",eh="right",tm="#000",hy=tm+"0",th="mousemove",my="mousedown",nh="mouseup",py="mouseenter",gy="mouseleave",vy="dblclick",hT="resize",mT="scroll",yy="change",jc="dppxchange",nm="--",_r=typeof window<"u",ph=_r?document:null,fr=_r?window:null,pT=_r?navigator:null;let Pe,mc;function gh(){let n=devicePixelRatio;Pe!=n&&(Pe=n,mc&&yh(yy,mc,gh),mc=matchMedia(`(min-resolution: ${Pe-.001}dppx) and (max-resolution: ${Pe+.001}dppx)`),cs(yy,mc,gh),fr.dispatchEvent(new CustomEvent(jc)))}function fi(n,i){if(i!=null){let l=n.classList;!l.contains(i)&&l.add(i)}}function vh(n,i){let l=n.classList;l.contains(i)&&l.remove(i)}function wt(n,i,l){n.style[i]=l+"px"}function Bi(n,i,l,r){let u=ph.createElement(n);return i!=null&&fi(u,i),l?.insertBefore(u,r),u}function Ai(n,i){return Bi("div",n,i)}const by=new WeakMap;function sa(n,i,l,r,u){let d="translate("+i+"px,"+l+"px)",f=by.get(n);d!=f&&(n.style.transform=d,by.set(n,d),i<0||l<0||i>r||l>u?fi(n,rs):vh(n,rs))}const _y=new WeakMap;function Sy(n,i,l){let r=i+l,u=_y.get(n);r!=u&&(_y.set(n,r),n.style.background=i,n.style.borderColor=l)}const xy=new WeakMap;function wy(n,i,l,r){let u=i+""+l,d=xy.get(n);u!=d&&(xy.set(n,u),n.style.height=l+"px",n.style.width=i+"px",n.style.marginLeft=r?-i/2+"px":0,n.style.marginTop=r?-l/2+"px":0)}const im={passive:!0},gT={...im,capture:!0};function cs(n,i,l,r){i.addEventListener(n,l,r?gT:im)}function yh(n,i,l,r){i.removeEventListener(n,l,im)}_r&&gh();function Vi(n,i,l,r){let u;l=l||0,r=r||i.length-1;let d=r<=2147483647;for(;r-l>1;)u=d?l+r>>1:mi((l+r)/2),i[u]{let d=-1,f=-1;for(let p=r;p<=u;p++)if(n(l[p])){d=p;break}for(let p=u;p>=r;p--)if(n(l[p])){f=p;break}return[d,f]}}const rb=n=>n!=null,ob=n=>n!=null&&n>0,Hc=sb(rb),vT=sb(ob);function yT(n,i,l,r=0,u=!1){let d=u?vT:Hc,f=u?ob:rb;[i,l]=d(n,i,l);let p=n[i],m=n[i];if(i>-1)if(r==1)p=n[i],m=n[l];else if(r==-1)p=n[l],m=n[i];else for(let v=i;v<=l;v++){let w=n[v];f(w)&&(wm&&(m=w))}return[p??gt,m??-gt]}function qc(n,i,l,r){let u=Ty(n),d=Ty(i);n==i&&(u==-1?(n*=l,i/=l):(n/=l,i*=l));let f=l==10?La:ub,p=u==1?mi:Ni,m=d==1?Ni:mi,v=p(f(en(n))),w=m(f(en(i))),S=hr(l,v),z=hr(l,w);return l==10&&(v<0&&(S=vt(S,-v)),w<0&&(z=vt(z,-w))),r||l==2?(n=S*u,i=z*d):(n=hb(n,S),i=Bc(i,z)),[n,i]}function am(n,i,l,r){let u=qc(n,i,l,r);return n==0&&(u[0]=0),i==0&&(u[1]=0),u}const lm=.1,zy={mode:3,pad:lm},ko={pad:0,soft:null,mode:0},bT={min:ko,max:ko};function kc(n,i,l,r){return Vc(l)?Ey(n,i,l):(ko.pad=l,ko.soft=r?0:null,ko.mode=r?3:0,Ey(n,i,bT))}function Je(n,i){return n??i}function _T(n,i,l){for(i=Je(i,0),l=Je(l,n.length-1);i<=l;){if(n[i]!=null)return!0;i++}return!1}function Ey(n,i,l){let r=l.min,u=l.max,d=Je(r.pad,0),f=Je(u.pad,0),p=Je(r.hard,-gt),m=Je(u.hard,gt),v=Je(r.soft,gt),w=Je(u.soft,-gt),S=Je(r.mode,0),z=Je(u.mode,0),T=i-n,j=La(T),L=qn(en(n),en(i)),V=La(L),H=en(V-j);(T<1e-24||H>10)&&(T=0,(n==0||i==0)&&(T=1e-24,S==2&&v!=gt&&(d=0),z==2&&w!=-gt&&(f=0)));let G=T||L||1e3,W=La(G),B=hr(10,mi(W)),ne=G*(T==0?n==0?.1:1:d),ee=vt(hb(n-ne,B/10),24),K=n>=v&&(S==1||S==3&&ee<=v||S==2&&ee>=v)?v:gt,le=qn(p,ee=K?K:Gi(K,ee)),ze=G*(T==0?i==0?.1:1:f),ve=vt(Bc(i+ze,B/10),24),ie=i<=w&&(z==1||z==3&&ve>=w||z==2&&ve<=w)?w:-gt,_e=Gi(m,ve>ie&&i<=ie?ie:qn(ie,ve));return le==_e&&le==0&&(_e=100),[le,_e]}const ST=new Intl.NumberFormat(_r?pT.language:"en-US"),sm=n=>ST.format(n),pi=Math,_c=pi.PI,en=pi.abs,mi=pi.floor,Wt=pi.round,Ni=pi.ceil,Gi=pi.min,qn=pi.max,hr=pi.pow,Ty=pi.sign,La=pi.log10,ub=pi.log2,xT=(n,i=1)=>pi.sinh(n)*i,ih=(n,i=1)=>pi.asinh(n/i),gt=1/0;function Ay(n){return(La((n^n>>31)-(n>>31))|0)+1}function bh(n,i,l){return Gi(qn(n,i),l)}function cb(n){return typeof n=="function"}function Be(n){return cb(n)?n:()=>n}const wT=()=>{},fb=n=>n,db=(n,i)=>i,zT=n=>null,Ny=n=>!0,Oy=(n,i)=>n==i,ET=/\.\d*?(?=9{6,}|0{6,})/gm,hs=n=>{if(pb(n)||Al.has(n))return n;const i=`${n}`,l=i.match(ET);if(l==null)return n;let r=l[0].length-1;if(i.indexOf("e-")!=-1){let[u,d]=i.split("e");return+`${hs(u)}e${d}`}return vt(n,r)};function ls(n,i){return hs(vt(hs(n/i))*i)}function Bc(n,i){return hs(Ni(hs(n/i))*i)}function hb(n,i){return hs(mi(hs(n/i))*i)}function vt(n,i=0){if(pb(n))return n;let l=10**i,r=n*l*(1+Number.EPSILON);return Wt(r)/l}const Al=new Map;function mb(n){return((""+n).split(".")[1]||"").length}function Uo(n,i,l,r){let u=[],d=r.map(mb);for(let f=i;f=0?0:p)+(f>=d[v]?0:d[v]),z=n==10?w:vt(w,S);u.push(z),Al.set(z,S)}}return u}const Ro={},rm=[],mr=[null,null],zl=Array.isArray,pb=Number.isInteger,TT=n=>n===void 0;function My(n){return typeof n=="string"}function Vc(n){let i=!1;if(n!=null){let l=n.constructor;i=l==null||l==Object}return i}function AT(n){return n!=null&&typeof n=="object"}const NT=Object.getP)DELIM" +R"DELIM(rototypeOf(Uint8Array),gb="__proto__";function pr(n,i=Vc){let l;if(zl(n)){let r=n.find(u=>u!=null);if(zl(r)||i(r)){l=Array(n.length);for(let u=0;ud){for(u=f-1;u>=0&&n[u]==null;)n[u--]=null;for(u=f+1;uf-p)],u=r[0].length,d=new Map;for(let f=0;f"u"?n=>Promise.resolve().then(n):queueMicrotask;function DT(n){let i=n[0],l=i.length,r=Array(l);for(let d=0;di[d]-i[f]);let u=[];for(let d=0;d=r&&n[u]==null;)u--;if(u<=r)return!0;const d=qn(1,mi((u-r+1)/i));for(let f=n[r],p=r+d;p<=u;p+=d){const m=n[p];if(m!=null){if(m<=f)return!1;f=m}}return!0}const vb=["January","February","March","April","May","June","July","August","September","October","November","December"],yb=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function bb(n){return n.slice(0,3)}const $T=yb.map(bb),LT=vb.map(bb),HT={MMMM:vb,MMM:LT,WWWW:yb,WWW:$T};function Eo(n){return(n<10?"0":"")+n}function qT(n){return(n<10?"00":n<100?"0":"")+n}const BT={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=>Eo(n.getMonth()+1),M:n=>n.getMonth()+1,DD:n=>Eo(n.getDate()),D:n=>n.getDate(),WWWW:(n,i)=>i.WWWW[n.getDay()],WWW:(n,i)=>i.WWW[n.getDay()],HH:n=>Eo(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=>Eo(n.getMinutes()),m:n=>n.getMinutes(),ss:n=>Eo(n.getSeconds()),s:n=>n.getSeconds(),fff:n=>qT(n.getMilliseconds())};function om(n,i){i=i||HT;let l=[],r=/\{([a-z]+)\}|[^{]+/gi,u;for(;u=r.exec(n);)l.push(u[0][0]=="{"?BT[u[1]]:u[0]);return d=>{let f="";for(let p=0;pn%1==0,Rc=[1,2,2.5,5],YT=Uo(10,-32,0,Rc),Sb=Uo(10,0,32,Rc),QT=Sb.filter(_b),ss=YT.concat(Sb),um=` +`,xb="{YYYY}",jy=um+xb,wb="{M}/{D}",Mo=um+wb,pc=Mo+"/{YY}",zb="{aa}",KT="{h}:{mm}",sr=KT+zb,ky=um+sr,Ry=":{ss}",tt=null;function Eb(n){let i=n*1e3,l=i*60,r=l*60,u=r*24,d=u*30,f=u*365,m=(n==1?Uo(10,0,3,Rc).filter(_b):Uo(10,-3,0,Rc)).concat([i,i*5,i*10,i*15,i*30,l,l*5,l*10,l*15,l*30,r,r*2,r*3,r*4,r*6,r*8,r*12,u,u*2,u*3,u*4,u*5,u*6,u*7,u*8,u*9,u*10,u*15,d,d*2,d*3,d*4,d*6,f,f*2,f*5,f*10,f*25,f*50,f*100]);const v=[[f,xb,tt,tt,tt,tt,tt,tt,1],[u*28,"{MMM}",jy,tt,tt,tt,tt,tt,1],[u,wb,jy,tt,tt,tt,tt,tt,1],[r,"{h}"+zb,pc,tt,Mo,tt,tt,tt,1],[l,sr,pc,tt,Mo,tt,tt,tt,1],[i,Ry,pc+" "+sr,tt,Mo+" "+sr,tt,ky,tt,1],[n,Ry+".{fff}",pc+" "+sr,tt,Mo+" "+sr,tt,ky,tt,1]];function w(S){return(z,T,j,L,V,H)=>{let G=[],W=V>=f,B=V>=d&&V=u?u:V,ve=mi(j)-mi(ee),ie=le+ve+Bc(ee-le,ze);G.push(ie);let _e=S(ie),ce=_e.getHours()+_e.getMinutes()/l+_e.getSeconds()/r,Ee=V/r,he=z.axes[T]._space,D=H/he;for(;ie=vt(ie+V,n==1?0:3),!(ie>L);)if(Ee>1){let Q=mi(vt(ce+Ee,6))%24,Se=S(ie).getHours()-Q;Se>1&&(Se=-1),ie-=Se*r,ce=(ce+Ee)%24;let N=G[G.length-1];vt((ie-N)/V,3)*D>=.7&&G.push(ie)}else G.push(ie)}return G}}return[m,v,w]}const[FT,JT,XT]=Eb(1),[IT,PT,WT]=Eb(.001);Uo(2,-53,53,[1]);function Cy(n,i){return n.map(l=>l.map((r,u)=>u==0||u==8||r==null?r:i(u==1||l[8]==0?r:l[1]+r)))}function Dy(n,i){return(l,r,u,d,f)=>{let p=i.find(j=>f>=j[0])||i[i.length-1],m,v,w,S,z,T;return r.map(j=>{let L=n(j),V=L.getFullYear(),H=L.getMonth(),G=L.getDate(),W=L.getHours(),B=L.getMinutes(),ne=L.getSeconds(),ee=V!=m&&p[2]||H!=v&&p[3]||G!=w&&p[4]||W!=S&&p[5]||B!=z&&p[6]||ne!=T&&p[7]||p[1];return m=V,v=H,w=G,S=W,z=B,T=ne,ee(L)})}}function eA(n,i){let l=om(i);return(r,u,d,f,p)=>u.map(m=>l(n(m)))}function ah(n,i,l){return new Date(n,i,l)}function Uy(n,i){return i(n)}const tA="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function Zy(n,i){return(l,r,u,d)=>d==null?nm:i(n(r))}function nA(n,i){let l=n.series[i];return l.width?l.stroke(n,i):l.points.width?l.points.stroke(n,i):null}function iA(n,i){return n.series[i].fill(n,i)}const aA={show:!0,live:!0,isolate:!1,mount:wT,markers:{show:!0,width:2,stroke:nA,fill:iA,dash:"solid"},idx:null,idxs:null,values:[]};function lA(n,i){let l=n.cursor.points,r=Ai(),u=l.size(n,i);wt(r,No,u),wt(r,Oo,u);let d=u/-2;wt(r,"marginLeft",d),wt(r,"marginTop",d);let f=l.width(n,i,u);return f&&wt(r,"borderWidth",f),r}function sA(n,i){let l=n.series[i].points;return l._fill||l._stroke}function rA(n,i){let l=n.series[i].points;return l._stroke||l._fill}function oA(n,i){return n.series[i].points.size}const lh=[0,0];function uA(n,i,l){return lh[0]=i,lh[1]=l,lh}function gc(n,i,l,r=!0){return u=>{u.button==0&&(!r||u.target==i)&&l(u)}}function sh(n,i,l,r=!0){return u=>{(!r||u.target==i)&&l(u)}}const cA={show:!0,x:!0,y:!0,lock:!1,move:uA,points:{one:!1,show:lA,size:oA,width:0,stroke:rA,fill:sA},bind:{mousedown:gc,mouseup:gc,click:gc,dblclick:gc,mousemove:sh,mouseleave:sh,mouseenter:sh},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,l,r,u)=>r-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},Tb={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},cm=Jt({},Tb,{filter:db}),Ab=Jt({},cm,{size:10}),Nb=Jt({},Tb,{show:!1}),fm='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"',Ob="bold "+fm,Mb=1.5,$y={show:!0,scale:"x",stroke:tm,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:Ob,side:2,grid:cm,ticks:Ab,border:Nb,font:fm,lineGap:Mb,rotate:0},fA="Value",dA="Time",Ly={show:!0,scale:"x",auto:!1,sorted:1,min:gt,max:-gt,idxs:[]};function hA(n,i,l,r,u){return i.map(d=>d==null?"":sm(d))}function mA(n,i,l,r,u,d,f){let p=[],m=Al.get(u)||0;l=f?l:vt(Bc(l,u),m);for(let v=l;v<=r;v=vt(v+u,m))p.push(Object.is(v,-0)?0:v);return p}function _h(n,i,l,r,u,d,f){const p=[],m=n.scales[n.axes[i].scale].log,v=m==10?La:ub,w=mi(v(l));u=hr(m,w),m==10&&(u=ss[Vi(u,ss)]);let S=l,z=u*m;m==10&&(z=ss[Vi(z,ss)]);do p.push(S),S=S+u,m==10&&!Al.has(S)&&(S=vt(S,Al.get(u))),S>=z&&(u=S,z=u*)DELIM" +R"DELIM(m,m==10&&(z=ss[Vi(z,ss)]));while(S<=r);return p}function pA(n,i,l,r,u,d,f){let m=n.scales[n.axes[i].scale].asinh,v=r>m?_h(n,i,qn(m,l),r,u):[m],w=r>=0&&l<=0?[0]:[];return(l<-m?_h(n,i,qn(m,-r),-l,u):[m]).reverse().map(z=>-z).concat(w,v)}const jb=/./,gA=/[12357]/,vA=/[125]/,Hy=/1/,Sh=(n,i,l,r)=>n.map((u,d)=>i==4&&u==0||d%r==0&&l.test(u.toExponential()[u<0?1:0])?u:null);function yA(n,i,l,r,u){let d=n.axes[l],f=d.scale,p=n.scales[f],m=n.valToPos,v=d._space,w=m(10,f),S=m(9,f)-w>=v?jb:m(7,f)-w>=v?gA:m(5,f)-w>=v?vA:Hy;if(S==Hy){let z=en(m(1,f)-w);if(zu,Vy={show:!0,auto:!0,sorted:0,gaps:kb,alpha:1,facets:[Jt({},By,{scale:"x"}),Jt({},By,{scale:"y"})]},Gy={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:kb,alpha:1,points:{show:xA,filter:null},values:null,min:gt,max:-gt,idxs:[],path:null,clip:null};function wA(n,i,l,r,u){return l/10}const Rb={time:FE,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},zA=Jt({},Rb,{time:!1,ori:1}),Yy={};function Cb(n,i){let l=Yy[n];return l||(l={key:n,plots:[],sub(r){l.plots.push(r)},unsub(r){l.plots=l.plots.filter(u=>u!=r)},pub(r,u,d,f,p,m,v){for(let w=0;w{let H=f.pxRound;const G=v.dir*(v.ori==0?1:-1),W=v.ori==0?Sr:xr;let B,ne;G==1?(B=l,ne=r):(B=r,ne=l);let ee=H(S(p[B],v,L,T)),K=H(z(m[B],w,V,j)),le=H(S(p[ne],v,L,T)),ze=H(z(d==1?w.max:w.min,w,V,j)),ve=new Path2D(u);return W(ve,le,ze),W(ve,ee,ze),W(ve,ee,K),ve})}function Gc(n,i,l,r,u,d){let f=null;if(n.length>0){f=new Path2D;const p=i==0?Kc:mm;let m=l;for(let S=0;Sz[0]){let T=z[0]-m;T>0&&p(f,m,r,T,r+d),m=z[1]}}let v=l+u-m,w=10;v>0&&p(f,m,r-w/2,v,r+d+w)}return f}function TA(n,i,l){let r=n[n.length-1];r&&r[0]==i?r[1]=l:n.push([i,l])}function hm(n,i,l,r,u,d,f){let p=[],m=n.length;for(let v=u==1?l:r;v>=l&&v<=r;v+=u)if(i[v]===null){let S=v,z=v;if(u==1)for(;++v<=r&&i[v]===null;)z=v;else for(;--v>=l&&i[v]===null;)z=v;let T=d(n[S]),j=z==S?T:d(n[z]),L=S-u;T=f<=0&&L>=0&&L=0&&H>=0&&H=T&&p.push([T,j])}return p}function Qy(n){return n==0?fb:n==1?Wt:i=>ls(i,n)}function Db(n){let i=n==0?Yc:Qc,l=n==0?(u,d,f,p,m,v)=>{u.arcTo(d,f,p,m,v)}:(u,d,f,p,m,v)=>{u.arcTo(f,d,m,p,v)},r=n==0?(u,d,f,p,m)=>{u.rect(d,f,p,m)}:(u,d,f,p,m)=>{u.rect(f,d,m,p)};return(u,d,f,p,m,v=0,w=0)=>{v==0&&w==0?r(u,d,f,p,m):(v=Gi(v,p/2,m/2),w=Gi(w,p/2,m/2),i(u,d+v,f),l(u,d+p,f,d+p,f+m,v),l(u,d+p,f+m,d,f+m,w),l(u,d,f+m,d,f,w),l(u,d,f,d+p,f,v),u.closePath())}}const Yc=(n,i,l)=>{n.moveTo(i,l)},Qc=(n,i,l)=>{n.moveTo(l,i)},Sr=(n,i,l)=>{n.lineTo(i,l)},xr=(n,i,l)=>{n.lineTo(l,i)},Kc=Db(0),mm=Db(1),Ub=(n,i,l,r,u,d)=>{n.arc(i,l,r,u,d)},Zb=(n,i,l,r,u,d)=>{n.arc(l,i,r,u,d)},$b=(n,i,l,r,u,d,f)=>{n.bezierCurveTo(i,l,r,u,d,f)},Lb=(n,i,l,r,u,d,f)=>{n.bezierCurveTo(l,i,u,r,f,d)};function Hb(n){return(i,l,r,u,d)=>ps(i,l,(f,p,m,v,w,S,z,T,j,L,V)=>{let{pxRound:H,points:G}=f,W,B;v.ori==0?(W=Yc,B=Ub):(W=Qc,B=Zb);const ne=vt(G.width*Pe,3);let ee=(G.size-G.width)/2*Pe,K=vt(ee*2,3),le=new Path2D,ze=new Path2D,{left:ve,top:ie,width:_e,height:ce}=i.bbox;Kc(ze,ve-K,ie-K,_e+K*2,ce+K*2);const Ee=he=>{if(m[he]!=null){let D=H(S(p[he],v,L,T)),Q=H(z(m[he],w,V,j));W(le,D+ee,Q),B(le,D,Q,ee,0,_c*2)}};if(d)d.forEach(Ee);else for(let he=r;he<=u;he++)Ee(he);return{stroke:ne>0?le:null,fill:le,clip:ze,flags:gr|xh}})}function qb(n){return(i,l,r,u,d,f)=>{r!=u&&(d!=r&&f!=r&&n(i,l,r),d!=u&&f!=u&&n(i,l,u),n(i,l,f))}}const AA=qb(Sr),NA=qb(xr);function Bb(n){const i=Je(n?.alignGaps,0);return(l,r,u,d)=>ps(l,r,(f,p,m,v,w,S,z,T,j,L,V)=>{[u,d]=Hc(m,u,d);let H=f.pxRound,G=ce=>H(S(ce,v,L,T)),W=ce=>H(z(ce,w,V,j)),B,ne;v.ori==0?(B=Sr,ne=AA):(B=xr,ne=NA);const ee=v.dir*(v.ori==0?1:-1),K={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:gr},le=K.stroke;let ze=!1;if(d-u>=L*4){let ce=Y=>l.posToVal(Y,v.key,!0),Ee=null,he=null,D,Q,pe,Oe=G(p[ee==1?u:d]),Se=G(p[u]),N=G(p[d]),$=ce(ee==1?Se+1:N-1);for(let Y=ee==1?u:d;Y>=u&&Y<=d;Y+=ee){let se=p[Y],ge=(ee==1?se<$:se>$)?Oe:G(se),ye=m[Y];ge==Oe?ye!=null?(Q=ye,Ee==null?(B(le,ge,W(Q)),D=Ee=he=Q):Qhe&&(he=Q)):ye===null&&(ze=!0):(Ee!=null&&ne(le,Oe,W(Ee),W(he),W(D),W(Q)),ye!=null?(Q=ye,B(le,ge,W(Q)),Ee=he=D=Q):(Ee=he=null,ye===null&&(ze=!0)),Oe=ge,$=ce(Oe+ee))}Ee!=null&&Ee!=he&&pe!=Oe&&ne(le,Oe,W(Ee),W(he),W(D),W(Q))}else for(let ce=ee==1?u:d;ce>=u&&ce<=d;ce+=ee){let Ee=m[ce];Ee===null?ze=!0:Ee!=null&&B(le,G(p[ce]),W(Ee))}let[ie,_e]=dm(l,r);if(f.fill!=null||ie!=0){let ce=K.fill=new Path2D(le),Ee=f.fillTo(l,r,f.min,f.max,ie),he=W(Ee),D=G(p[u]),Q=G(p[d]);ee==-1&&([Q,D]=[D,Q]),B(ce,Q,he),B(ce,D,he)}if(!f.spanGaps){let ce=[];ze&&ce.push(...hm(p,m,u,d,ee,G,i)),K.gaps=ce=f.gaps(l,r,u,d,ce),K.clip=Gc(ce,v.ori,T,j,L,V)}return _e!=0&&(K.band=_e==2?[Ha(l,r,u,d,le,-1),Ha(l,r,u,d,le,1)]:Ha(l,r,u,d,le,_e)),K})}function OA(n){const i=Je(n.align,1),l=Je(n.ascDesc,!1),r=Je(n.alignGaps,0),u=Je(n.extend,!1);return(d,f,p,m)=>ps(d,f,(v,w,S,z,T,j,L,V,H,G,W)=>{[p,m]=Hc(S,p,m);let B=v.pxRound,{left:ne,width:ee}=d.bbox,K=Se=>B(j(Se,z,G,V)),le=Se=>B(L(Se,T,W,H)),ze=z.ori==0?Sr:xr;const ve={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:gr},ie=ve.stroke,_e=z.dir*(z.ori==0?1:-1);let ce=le(S[_e==1?p:m]),Ee=K(w[_e==1?p:m]),he=Ee,D=Ee;u&&i==-1&&(D=ne,ze(ie,D,ce)),ze(ie,Ee,ce);for(let Se=_e==1?p:m;Se>=p&&Se<=m;Se+=_e){let N=S[Se];if(N==null)continue;let $=K(w[Se]),Y=le(N);i==1?ze(ie,$,ce):ze(ie,he,Y),ze(ie,$,Y),ce=Y,he=$}let Q=he;u&&i==1&&(Q=ne+ee,ze(ie,Q,ce));let[pe,Oe]=dm(d,f);if(v.fill!=null||pe!=0){let Se=ve.fill=new Path2D(ie),N=v.fillTo(d,f,v.min,v.max,pe),$=le(N);ze(Se,Q,$),ze(Se,D,$)}if(!v.spanGaps){let Se=[];Se.push(...hm(w,S,p,m,_e,K,r));let N=v.width*Pe/2,$=l||i==1?N:-N,Y=l||i==-1?-N:N;Se.forEach(se=>{se[0]+=$,se[1]+=Y}),ve.gaps=Se=v.gaps(d,f,p,m,Se),ve.clip=Gc(Se,z.ori,V,H,G,W)}return Oe!=0&&(ve.band=Oe==2?[Ha(d,f,p,m,ie,-1),Ha(d,f,p,m,ie,1)]:Ha(d,f,p,m,ie,Oe)),ve})}function Ky(n,i,l,r,u,d,f=gt){if(n.length>1){let p=null;for(let m=0,v=1/0;m{}),{fill:S,stroke:z}=v;return(T,j,L,V)=>ps(T,j,(H,G,W,B,ne,ee,K,le,ze,ve,ie)=>{let _e=H.pxRound,ce=l,Ee=r*Pe,he=p*Pe,D=m*Pe,Q,pe;B.ori==0?[Q,pe]=d(T,j)DELIM" +R"DELIM():[pe,Q]=d(T,j);const Oe=B.dir*(B.ori==0?1:-1);let Se=B.ori==0?Kc:mm,N=B.ori==0?w:(fe,it,Mt,Ri,ca,ti,fa)=>{w(fe,it,Mt,ca,Ri,fa,ti)},$=Je(T.bands,rm).find(fe=>fe.series[0]==j),Y=$!=null?$.dir:0,se=H.fillTo(T,j,H.min,H.max,Y),we=_e(K(se,ne,ie,ze)),ge,ye,mt,Ve=ve,nt=_e(H.width*Pe),Mn=!1,ei=null,jn=null,xn=null,Yi=null;S!=null&&(nt==0||z!=null)&&(Mn=!0,ei=S.values(T,j,L,V),jn=new Map,new Set(ei).forEach(fe=>{fe!=null&&jn.set(fe,new Path2D)}),nt>0&&(xn=z.values(T,j,L,V),Yi=new Map,new Set(xn).forEach(fe=>{fe!=null&&Yi.set(fe,new Path2D)})));let{x0:Qi,size:jl}=v;if(Qi!=null&&jl!=null){ce=1,G=Qi.values(T,j,L,V),Qi.unit==2&&(G=G.map(Mt=>T.posToVal(le+Mt*ve,B.key,!0)));let fe=jl.values(T,j,L,V);jl.unit==2?ye=fe[0]*ve:ye=ee(fe[0],B,ve,le)-ee(0,B,ve,le),Ve=Ky(G,W,ee,B,ve,le,Ve),mt=Ve-ye+Ee}else Ve=Ky(G,W,ee,B,ve,le,Ve),mt=Ve*f+Ee,ye=Ve-mt;mt<1&&(mt=0),nt>=ye/2&&(nt=0),mt<5&&(_e=fb);let kl=mt>0,ji=Ve-mt-(kl?nt:0);ye=_e(bh(ji,D,he)),ge=(ce==0?ye/2:ce==Oe?0:ye)-ce*Oe*((ce==0?Ee/2:0)+(kl?nt/2:0));const Xt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Ki=Mn?null:new Path2D;let ki=null;if($!=null)ki=T.data[$.series[1]];else{let{y0:fe,y1:it}=v;fe!=null&&it!=null&&(W=it.values(T,j,L,V),ki=fe.values(T,j,L,V))}let ua=Q*ye,Te=pe*ye;for(let fe=Oe==1?L:V;fe>=L&&fe<=V;fe+=Oe){let it=W[fe];if(it==null)continue;if(ki!=null){let ot=ki[fe]??0;if(it-ot==0)continue;we=K(ot,ne,ie,ze)}let Mt=B.distr!=2||v!=null?G[fe]:fe,Ri=ee(Mt,B,ve,le),ca=K(Je(it,se),ne,ie,ze),ti=_e(Ri-ge),fa=_e(qn(ca,we)),kn=_e(Gi(ca,we)),nn=fa-kn;if(it!=null){let ot=it<0?Te:ua,Vt=it<0?ua:Te;Mn?(nt>0&&xn[fe]!=null&&Se(Yi.get(xn[fe]),ti,kn+mi(nt/2),ye,qn(0,nn-nt),ot,Vt),ei[fe]!=null&&Se(jn.get(ei[fe]),ti,kn+mi(nt/2),ye,qn(0,nn-nt),ot,Vt)):Se(Ki,ti,kn+mi(nt/2),ye,qn(0,nn-nt),ot,Vt),N(T,j,fe,ti-nt/2,kn,ye+nt,nn)}}return nt>0?Xt.stroke=Mn?Yi:Ki:Mn||(Xt._fill=H.width==0?H._fill:H._stroke??H._fill,Xt.width=0),Xt.fill=Mn?jn:Ki,Xt})}function jA(n,i){const l=Je(i?.alignGaps,0);return(r,u,d,f)=>ps(r,u,(p,m,v,w,S,z,T,j,L,V,H)=>{[d,f]=Hc(v,d,f);let G=p.pxRound,W=Q=>G(z(Q,w,V,j)),B=Q=>G(T(Q,S,H,L)),ne,ee,K;w.ori==0?(ne=Yc,K=Sr,ee=$b):(ne=Qc,K=xr,ee=Lb);const le=w.dir*(w.ori==0?1:-1);let ze=W(m[le==1?d:f]),ve=ze,ie=[],_e=[];for(let Q=le==1?d:f;Q>=d&&Q<=f;Q+=le)if(v[Q]!=null){let Oe=m[Q],Se=W(Oe);ie.push(ve=Se),_e.push(B(v[Q]))}const ce={stroke:n(ie,_e,ne,K,ee,G),fill:null,clip:null,band:null,gaps:null,flags:gr},Ee=ce.stroke;let[he,D]=dm(r,u);if(p.fill!=null||he!=0){let Q=ce.fill=new Path2D(Ee),pe=p.fillTo(r,u,p.min,p.max,he),Oe=B(pe);K(Q,ve,Oe),K(Q,ze,Oe)}if(!p.spanGaps){let Q=[];Q.push(...hm(m,v,d,f,le,W,l)),ce.gaps=Q=p.gaps(r,u,d,f,Q),ce.clip=Gc(Q,w.ori,j,L,V,H)}return D!=0&&(ce.band=D==2?[Ha(r,u,d,f,Ee,-1),Ha(r,u,d,f,Ee,1)]:Ha(r,u,d,f,Ee,D)),ce})}function kA(n){return jA(RA,n)}function RA(n,i,l,r,u,d){const f=n.length;if(f<2)return null;const p=new Path2D;if(l(p,n[0],i[0]),f==2)r(p,n[1],i[1]);else{let m=Array(f),v=Array(f-1),w=Array(f-1),S=Array(f-1);for(let z=0;z0!=v[z]>0?m[z]=0:(m[z]=3*(S[z-1]+S[z])/((2*S[z]+S[z-1])/v[z-1]+(S[z]+2*S[z-1])/v[z]),isFinite(m[z])||(m[z]=0));m[f-1]=v[f-2];for(let z=0;z{un.pxRatio=Pe}));const CA=Bb(),DA=Hb();function Jy(n,i,l,r){return(r?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map((d,f)=>zh(d,f,i,l))}function UA(n,i){return n.map((l,r)=>r==0?{}:Jt({},i,l))}function zh(n,i,l,r){return Jt({},i==0?l:r,n)}function Vb(n,i,l){return i==null?mr:[i,l]}const ZA=Vb;function $A(n,i,l){return i==null?mr:kc(i,l,lm,!0)}function Gb(n,i,l,r){return i==null?mr:qc(i,l,n.scales[r].log,!1)}const LA=Gb;function Yb(n,i,l,r){return i==null?mr:am(i,l,n.scales[r].log,!1)}const HA=Yb;function qA(n,i,l,r,u){let d=qn(Ay(n),Ay(i)),f=i-n,p=Vi(u/r*f,l);do{let m=l[p],v=r*m/f;if(v>=u&&d+(m<5?Al.get(m):0)<=17)return[m,v]}while(++p(i=Wt((l=+u)*Pe))+"px"),[n,i,l]}function BA(n){n.show&&[n.font,n.labelFont].forEach(i=>{let l=vt(i[2]*Pe,1);i[0]=i[0].replace(/[0-9.]+px/,l+"px"),i[1]=l})}function un(n,i,l){const r={mode:Je(n.mode,1)},u=r.mode;function d(g,y,x,E){let O=y.valToPct(g);return E+x*(y.dir==-1?1-O:O)}function f(g,y,x,E){let O=y.valToPct(g);return E+x*(y.dir==-1?O:1-O)}function p(g,y,x,E){return y.ori==0?d(g,y,x,E):f(g,y,x,E)}r.valToPosH=d,r.valToPosV=f;let m=!1;r.status=0;const v=r.root=Ai(JE);if(n.id!=null&&(v.id=n.id),fi(v,n.class),n.title){let g=Ai(PE,v);g.textContent=n.title}const w=Bi("canvas"),S=r.ctx=w.getContext("2d"),z=Ai(WE,v);cs("click",z,g=>{g.target===j&&(We!=Un||at!=Wi)&&Qe.click(r,g)},!0);const T=r.under=Ai(eT,z);z.appendChild(w);const j=r.over=Ai(tT,z);n=pr(n);const L=+Je(n.pxAlign,1),V=Qy(L);(n.plugins||[]).forEach(g=>{g.opts&&(n=g.opts(r,n)||n)});const H=n.ms||.001,G=r.series=u==1?Jy(n.series||[],Ly,Gy,!1):UA(n.series||[null],Vy),W=r.axes=Jy(n.axes||[],$y,qy,!0),B=r.scales={},ne=r.bands=n.bands||[];ne.forEach(g=>{g.fill=Be(g.fill||null),g.dir=Je(g.dir,-1)});const ee=u==2?G[1].facets[0].scale:G[0].scale,K={axes:jr,series:Jc},le=(n.drawOrder||["axes","series"]).map(g=>K[g]);function ze(g){const y=g.distr==3?x=>La(x>0?x:g.clamp(r,x,g.min,g.max,g.key)):g.distr==4?x=>ih(x,g.asinh):g.distr==100?x=>g.fwd(x):x=>x;return x=>{let E=y(x),{_min:O,_max:R}=g,J=R-O;return(E-O)/J}}function ve(g){let y=B[g];if(y==null){let x=(n.scales||Ro)[g]||Ro;if(x.from!=null){ve(x.from);let E=Jt({},B[x.from],x,{key:g});E.valToPct=ze(E),B[g]=E}else{y=B[g]=Jt({},g==ee?Rb:zA,x),y.key=g;let E=y.time,O=y.range,R=zl(O);if((g!=ee||u==2&&!E)&&(R&&(O[0]==null||O[1]==null)&&(O={min:O[0]==null?zy:{mode:1,hard:O[0],soft:O[0]},max:O[1]==null?zy:{mode:1,hard:O[1],soft:O[1]}},R=!1),!R&&Vc(O))){let J=O;O=(te,ae,oe)=>ae==null?mr:kc(ae,oe,J)}y.range=Be(O||(E?ZA:g==ee?y.distr==3?LA:y.distr==4?HA:Vb:y.distr==3?Gb:y.distr==4?Yb:$A)),y.auto=Be(R?!1:y.auto),y.clamp=Be(y.clamp||wA),y._min=y._max=null,y.valToPct=ze(y)}}}ve("x"),ve("y"),u==1&&G.forEach(g=>{ve(g.scale)}),W.forEach(g=>{ve(g.scale)});for(let g in n.scales)ve(g);const ie=B[ee],_e=ie.distr;let ce,Ee;ie.ori==0?(fi(v,XE),ce=d,Ee=f):(fi(v,IE),ce=f,Ee=d);const he={};for(let g in B){let y=B[g];(y.min!=null||y.max!=null)&&(he[g]={min:y.min,max:y.max},y.min=y.max=null)}const D=n.tzDate||(g=>new Date(Wt(g/H))),Q=n.fmtDate||om,pe=H==1?XT(D):WT(D),Oe=Dy(D,Cy(H==1?JT:PT,Q)),Se=Zy(D,Uy(tA,Q)),N=[],$=r.legend=Jt({},aA,n.legend),Y=r.cursor=Jt({},cA,{drag:{y:u==2}},n.cursor),se=$.show,we=Y.show,ge=$.markers;$.idxs=N,ge.width=Be(ge.width),ge.dash=Be(ge.dash),ge.stroke=Be(ge.stroke),ge.fill=Be(ge.fill);let ye,mt,Ve,nt=[],Mn=[],ei,jn=!1,xn={};if($.live){const g=G[1]?G[1].values:null;jn=g!=null,ei=jn?g(r,1,0):{_:0};for(let y in ei)xn[y]=nm}if(se)if(ye=Bi("table",rT,v),Ve=Bi("tbody",null,ye),$.mount(r,ye),jn){mt=Bi("thead",null,ye,Ve);let g=Bi("tr",null,mt);Bi("th",null,g);for(var Yi in ei)Bi("th",fy,g).textContent=Yi}else fi(ye,uT),$.live&&fi(ye,oT);const Qi={show:!0},jl={show:!1};function kl(g,y){if(y==0&&(jn||!$.live||u==2))return mr;let x=[],E=Bi("tr",cT,Ve,Ve.childNodes[y]);fi(E,g.class),g.show||fi(E,rs);let O=Bi("th",null,E);if(ge.show){let te=Ai(fT,O);if(y>0){let ae=ge.width(r,y);ae&&(te.style.border=ae+"px "+ge.dash(r,y)+" "+ge.stroke(r,y)),te.style.background=ge.fill(r,y)}}let R=Ai(fy,O);g.label instanceof HTMLElement?R.appendChild(g.label):R.textContent=g.label,y>0&&(ge.show||(R.style.color=g.width>0?ge.stroke(r,y):ge.fill(r,y)),Xt("click",O,te=>{if(Y._lock)return;ni(te);let ae=G.indexOf(g);if((te.ctrlKey||te.metaKey)!=$.isolate){let oe=G.some((ue,de)=>de>0&&de!=ae&&ue.show);G.forEach((ue,de)=>{de>0&&Zn(de,oe?de==ae?Qi:jl:Qi,!0,kt.setSeries)})}else Zn(ae,{show:!g.show},!0,kt.setSeries)},!1),ma&&Xt(py,O,te=>{Y._lock||(ni(te),Zn(G.indexOf(g),Pa,!0,kt.setSeries))},!1));for()DELIM" +R"DELIM(var J in ei){let te=Bi("td",dT,E);te.textContent="--",x.push(te)}return[E,x]}const ji=new Map;function Xt(g,y,x,E=!0){const O=ji.get(y)||{},R=Y.bind[g](r,y,x,E);R&&(cs(g,y,O[g]=R),ji.set(y,O))}function Ki(g,y,x){const E=ji.get(y)||{};for(let O in E)(g==null||O==g)&&(yh(O,y,E[O]),delete E[O]);g==null&&ji.delete(y)}let ki=0,ua=0,Te=0,fe=0,it=0,Mt=0,Ri=it,ca=Mt,ti=Te,fa=fe,kn=0,nn=0,ot=0,Vt=0;r.bbox={};let cn=!1,gs=!1,qa=!1,da=!1,ha=!1,fn=!1;function Ba(g,y,x){(x||g!=r.width||y!=r.height)&&Fi(g,y),Qa(!1),qa=!0,gs=!0,Pi()}function Fi(g,y){r.width=ki=Te=g,r.height=ua=fe=y,it=Mt=0,Vo(),wr();let x=r.bbox;kn=x.left=ls(it*Pe,.5),nn=x.top=ls(Mt*Pe,.5),ot=x.width=ls(Te*Pe,.5),Vt=x.height=ls(fe*Pe,.5)}const vs=3;function Rl(){let g=!1,y=0;for(;!g;){y++;let x=Ko(y),E=Fo(y);g=y==vs||x&&E,g||(Fi(r.width,r.height),gs=!0)}}function Fc({width:g,height:y}){Ba(g,y)}r.setSize=Fc;function Vo(){let g=!1,y=!1,x=!1,E=!1;W.forEach((O,R)=>{if(O.show&&O._show){let{side:J,_size:te}=O,ae=J%2,oe=O.label!=null?O.labelSize:0,ue=te+oe;ue>0&&(ae?(Te-=ue,J==3?(it+=ue,E=!0):x=!0):(fe-=ue,J==0?(Mt+=ue,g=!0):y=!0))}}),Bn[0]=g,Bn[1]=x,Bn[2]=y,Bn[3]=E,Te-=Di[1]+Di[3],it+=Di[3],fe-=Di[2]+Di[0],Mt+=Di[0]}function wr(){let g=it+Te,y=Mt+fe,x=it,E=Mt;function O(R,J){switch(R){case 1:return g+=J,g-J;case 2:return y+=J,y-J;case 3:return x-=J,x+J;case 0:return E-=J,E+J}}W.forEach((R,J)=>{if(R.show&&R._show){let te=R.side;R._pos=O(te,R._size),R.label!=null&&(R._lpos=O(te,R.labelSize))}})}if(Y.dataIdx==null){let g=Y.hover,y=g.skip=new Set(g.skip??[]);y.add(void 0);let x=g.prox=Be(g.prox),E=g.bias??=0;Y.dataIdx=(O,R,J,te)=>{if(R==0)return J;let ae=J,oe=x(O,R,J,te)??gt,ue=oe>=0&&oe0;)y.has(Re[xe])||(De=xe);if(E==0||E==1)for(xe=J;Me==null&&xe++oe&&(ae=null);return ae}}const ni=g=>{Y.event=g};Y.idxs=N,Y._lock=!1;let an=Y.points;an.show=Be(an.show),an.size=Be(an.size),an.stroke=Be(an.stroke),an.width=Be(an.width),an.fill=Be(an.fill);const ii=r.focus=Jt({},n.focus||{alpha:.3},Y.focus),ma=ii.prox>=0,pa=ma&&an.one;let wn=[],Ji=[],ga=[];function zr(g,y){let x=an.show(r,y);if(x instanceof HTMLElement)return fi(x,sT),fi(x,g.class),sa(x,-10,-10,Te,fe),j.insertBefore(x,wn[y]),x}function Ci(g,y){if(u==1||y>0){let x=u==1&&B[g.scale].time,E=g.value;g.value=x?My(E)?Zy(D,Uy(E,Q)):E||Se:E||_A,g.label=g.label||(x?dA:fA)}if(pa||y>0){g.width=g.width==null?1:g.width,g.paths=g.paths||CA||zT,g.fillTo=Be(g.fillTo||EA),g.pxAlign=+Je(g.pxAlign,L),g.pxRound=Qy(g.pxAlign),g.stroke=Be(g.stroke||null),g.fill=Be(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let x=SA(qn(1,g.width),1),E=g.points=Jt({},{size:x,width:qn(1,x*.2),stroke:g.stroke,space:x*2,paths:DA,_stroke:null,_fill:null},g.points);E.show=Be(E.show),E.filter=Be(E.filter),E.fill=Be(E.fill),E.stroke=Be(E.stroke),E.paths=Be(E.paths),E.pxAlign=g.pxAlign}if(se){let x=kl(g,y);nt.splice(y,0,x[0]),Mn.splice(y,0,x[1]),$.values.push(null)}if(we){N.splice(y,0,null);let x=null;pa?y==0&&(x=zr(g,y)):y>0&&(x=zr(g,y)),wn.splice(y,0,x),Ji.splice(y,0,0),ga.splice(y,0,0)}Lt("addSeries",y)}function It(g,y){y=y??G.length,g=u==1?zh(g,y,Ly,Gy):zh(g,y,{},Vy),G.splice(y,0,g),Ci(G[y],y)}r.addSeries=It;function zn(g){if(G.splice(g,1),se){$.values.splice(g,1),Mn.splice(g,1);let y=nt.splice(g,1)[0];Ki(null,y.firstChild),y.remove()}we&&(N.splice(g,1),wn.splice(g,1)[0].remove(),Ji.splice(g,1),ga.splice(g,1)),Lt("delSeries",g)}r.delSeries=zn;const Bn=[!1,!1,!1,!1];function Er(g,y){if(g._show=g.show,g.show){let x=g.side%2,E=B[g.scale];E==null&&(g.scale=x?G[1].scale:ee,E=B[g.scale]);let O=E.time;g.size=Be(g.size),g.space=Be(g.space),g.rotate=Be(g.rotate),zl(g.incrs)&&g.incrs.forEach(J=>{!Al.has(J)&&Al.set(J,mb(J))}),g.incrs=Be(g.incrs||(E.distr==2?QT:O?H==1?FT:IT:ss)),g.splits=Be(g.splits||(O&&E.distr==1?pe:E.distr==3?_h:E.distr==4?pA:mA)),g.stroke=Be(g.stroke),g.grid.stroke=Be(g.grid.stroke),g.ticks.stroke=Be(g.ticks.stroke),g.border.stroke=Be(g.border.stroke);let R=g.values;g.values=zl(R)&&!zl(R[0])?Be(R):O?zl(R)?Dy(D,Cy(R,Q)):My(R)?eA(D,R):R||Oe:R||hA,g.filter=Be(g.filter||(E.distr>=3&&E.log==10?yA:E.distr==3&&E.log==2?bA:db)),g.font=Xy(g.font),g.labelFont=Xy(g.labelFont),g._size=g.size(r,null,y,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&(Bn[y]=!0,g._el=Ai(nT,z))}}function Cl(g,y,x,E){let[O,R,J,te]=x,ae=y%2,oe=0;return ae==0&&(te||R)&&(oe=y==0&&!O||y==2&&!J?Wt($y.size/3):0),ae==1&&(O||J)&&(oe=y==1&&!R||y==3&&!te?Wt(qy.size/2):0),oe}const Go=r.padding=(n.padding||[Cl,Cl,Cl,Cl]).map(g=>Be(Je(g,Cl))),Di=r._padding=Go.map((g,y)=>g(r,y,Bn,0));let At,jt=null,bt=null;const Ui=u==1?G[0].idxs:null;let dn=null,gi=!1;function $t(g,y){if(i=g??[],r.data=r._data=i,u==2){At=0;for(let x=1;x=0,fn=!0,Pi()}}r.setData=$t;function ys(){gi=!0;let g,y;u==1&&(At>0?(jt=Ui[0]=0,bt=Ui[1]=At-1,g=i[0][jt],y=i[0][bt],_e==2?(g=jt,y=bt):g==y&&(_e==3?[g,y]=qc(g,g,ie.log,!1):_e==4?[g,y]=am(g,g,ie.log,!1):ie.time?y=g+Wt(86400/H):[g,y]=kc(g,y,lm,!0))):(jt=Ui[0]=g=null,bt=Ui[1]=y=null)),Gn(ee,g,y)}let Dl,Vn,Xi,Tr,bs,_s,Ar,Va,Ga,zt;function Rn(g,y,x,E,O,R){g??=hy,x??=rm,E??="butt",O??=hy,R??="round",g!=Dl&&(S.strokeStyle=Dl=g),O!=Vn&&(S.fillStyle=Vn=O),y!=Xi&&(S.lineWidth=Xi=y),R!=bs&&(S.lineJoin=bs=R),E!=_s&&(S.lineCap=_s=E),x!=Tr&&S.setLineDash(Tr=x)}function Nr(g,y,x,E){y!=Vn&&(S.fillStyle=Vn=y),g!=Ar&&(S.font=Ar=g),x!=Va&&(S.textAlign=Va=x),E!=Ga&&(S.textBaseline=Ga=E)}function Or(g,y,x,E,O=0){if(E.length>0&&g.auto(r,gi)&&(y==null||y.min==null)){let R=Je(jt,0),J=Je(bt,E.length-1),te=x.min==null?yT(E,R,J,O,g.distr==3):[x.min,x.max];g.min=Gi(g.min,x.min=te[0]),g.max=qn(g.max,x.max=te[1])}}const Ss={min:null,max:null};function Yo(){for(let E in B){let O=B[E];he[E]==null&&(O.min==null||he[ee]!=null&&O.auto(r,gi))&&(he[E]=Ss)}for(let E in B){let O=B[E];he[E]==null&&O.from!=null&&he[O.from]!=null&&(he[E]=Ss)}he[ee]!=null&&Qa(!0);let g={};for(let E in he){let O=he[E];if(O!=null){let R=g[E]=pr(B[E],AT);if(O.min!=null)Jt(R,O);else if(E!=ee||u==2)if(At==0&&R.from==null){let J=R.range(r,null,null,E);R.min=J[0],R.max=J[1]}else R.min=gt,R.max=-gt}}if(At>0){G.forEach((E,O)=>{if(u==1){let R=E.scale,J=he[R];if(J==null)return;let te=g[R];if(O==0){let ae=te.range(r,te.min,te.max,R);te.min=ae[0],te.max=ae[1],jt=Vi(te.min,i[0]),bt=Vi(te.max,i[0]),bt-jt>1&&(i[0][jt]te.max&&bt--),E.min=dn[jt],E.max=dn[bt]}else E.show&&E.auto&&Or(te,J,E,i[O],E.sorted);E.idxs[0]=jt,E.idxs[1]=bt}else if(O>0&&E.show&&E.auto){let[R,J]=E.facets,te=R.scale,ae=J.scale,[oe,ue]=i[O],de=g[te],ke=g[ae];de!=null&&Or(de,he[te],R,oe,R.sorted),ke!=null&&Or(ke,he[ae],J,ue,J.sorted),E.min=J.min,E.max=J.max}});for(let E in g){let O=g[E],R=he[E];if(O.from==null&&(R==null||R.min==null)){let J=O.range(r,O.min==gt?null:O.min,O.max==-gt?null:O.max,E);O.min=J[0],O.max=J[1]}}}for(let E in g){let O=g[E];if(O.from!=null){let R=g[O.from];if(R.min==null)O.min=O.max=null;else{let J=O.range(r,R.min,R.max,E);O.min=J[0],O.max=J[1]}}}let y={},x=!1;for(let E in g){let O=g[E],R=B[E];if(R.min!=O.min||R.max!=O.max){R.min=O.min,R.max=O.max;let J=R.distr;R._min=J==3?La(R.min):J==4?ih(R.min,R.asinh):J==100?R.fwd(R.min):R.min,R._max=J==3?La(R.max):J==4?ih(R.max,R.asinh):J==100?R.fwd(R.max):R.max,y[E]=x=!0}}if(x){G.forEach((E,O)=>{u==2?O>0&&y.y&&(E._paths=null):y[E.scale]&&(E._paths=null)});for(let E in y)qa=!0,Lt("setScale",E);we&&Y.left>=0&&(da=fn=!0)}f)DELIM" +R"DELIM(or(let E in he)he[E]=null}function xs(g){let y=bh(jt-1,0,At-1),x=bh(bt+1,0,At-1);for(;g[y]==null&&y>0;)y--;for(;g[x]==null&&x0){let g=G.some(y=>y._focus)&&zt!=ii.alpha;g&&(S.globalAlpha=zt=ii.alpha),G.forEach((y,x)=>{if(x>0&&y.show&&(Cn(x,!1),Cn(x,!0),y._paths==null)){let E=zt;zt!=y.alpha&&(S.globalAlpha=zt=y.alpha);let O=u==2?[0,i[x][0].length-1]:xs(i[x]);y._paths=y.paths(r,x,O[0],O[1]),zt!=E&&(S.globalAlpha=zt=E)}}),G.forEach((y,x)=>{if(x>0&&y.show){let E=zt;zt!=y.alpha&&(S.globalAlpha=zt=y.alpha),y._paths!=null&&ws(x,!1);{let O=y._paths!=null?y._paths.gaps:null,R=y.points.show(r,x,jt,bt,O),J=y.points.filter(r,x,R,O);(R||J)&&(y.points._paths=y.points.paths(r,x,jt,bt,J),ws(x,!0))}zt!=E&&(S.globalAlpha=zt=E),Lt("drawSeries",x)}}),g&&(S.globalAlpha=zt=1)}}function Cn(g,y){let x=y?G[g].points:G[g];x._stroke=x.stroke(r,g),x._fill=x.fill(r,g)}function ws(g,y){let x=y?G[g].points:G[g],{stroke:E,fill:O,clip:R,flags:J,_stroke:te=x._stroke,_fill:ae=x._fill,_width:oe=x.width}=x._paths;oe=vt(oe*Pe,3);let ue=null,de=oe%2/2;y&&ae==null&&(ae=oe>0?"#fff":te);let ke=x.pxAlign==1&&de>0;if(ke&&S.translate(de,de),!y){let Ye=kn-oe/2,Re=nn-oe/2,De=ot+oe,Me=Vt+oe;ue=new Path2D,ue.rect(Ye,Re,De,Me)}y?Ii(te,oe,x.dash,x.cap,ae,E,O,J,R):Qo(g,te,oe,x.dash,x.cap,ae,E,O,J,ue,R),ke&&S.translate(-de,-de)}function Qo(g,y,x,E,O,R,J,te,ae,oe,ue){let de=!1;ae!=0&&ne.forEach((ke,Ye)=>{if(ke.series[0]==g){let Re=G[ke.series[1]],De=i[ke.series[1]],Me=(Re._paths||Ro).band;zl(Me)&&(Me=ke.dir==1?Me[0]:Me[1]);let xe,ut=null;Re.show&&Me&&_T(De,jt,bt)?(ut=ke.fill(r,Ye)||R,xe=Re._paths.clip):Me=null,Ii(y,x,E,O,ut,J,te,ae,oe,ue,xe,Me),de=!0}}),de||Ii(y,x,E,O,R,J,te,ae,oe,ue)}const zs=gr|xh;function Ii(g,y,x,E,O,R,J,te,ae,oe,ue,de){Rn(g,y,x,E,O),(ae||oe||de)&&(S.save(),ae&&S.clip(ae),oe&&S.clip(oe)),de?(te&zs)==zs?(S.clip(de),ue&&S.clip(ue),Zl(O,J),Ul(g,R,y)):te&xh?(Zl(O,J),S.clip(de),Ul(g,R,y)):te&gr&&(S.save(),S.clip(de),ue&&S.clip(ue),Zl(O,J),S.restore(),Ul(g,R,y)):(Zl(O,J),Ul(g,R,y)),(ae||oe||de)&&S.restore()}function Ul(g,y,x){x>0&&(y instanceof Map?y.forEach((E,O)=>{S.strokeStyle=Dl=O,S.stroke(E)}):y!=null&&g&&S.stroke(y))}function Zl(g,y){y instanceof Map?y.forEach((x,E)=>{S.fillStyle=Vn=E,S.fill(x)}):y!=null&&g&&S.fill(y)}function Ya(g,y,x,E){let O=W[g],R;if(E<=0)R=[0,0];else{let J=O._space=O.space(r,g,y,x,E),te=O._incrs=O.incrs(r,g,y,x,E,J);R=qA(y,x,te,E,J)}return O._found=R}function Mr(g,y,x,E,O,R,J,te,ae,oe){let ue=J%2/2;L==1&&S.translate(ue,ue),Rn(te,J,ae,oe,te),S.beginPath();let de,ke,Ye,Re,De=O+(E==0||E==3?-R:R);x==0?(ke=O,Re=De):(de=O,Ye=De);for(let Me=0;Me{if(!x.show)return;let O=B[x.scale];if(O.min==null){x._show&&(y=!1,x._show=!1,Qa(!1));return}else x._show||(y=!1,x._show=!0,Qa(!1));let R=x.side,J=R%2,{min:te,max:ae}=O,[oe,ue]=Ya(E,te,ae,J==0?Te:fe);if(ue==0)return;let de=O.distr==2,ke=x._splits=x.splits(r,E,te,ae,oe,ue,de),Ye=O.distr==2?ke.map(xe=>dn[xe]):ke,Re=O.distr==2?dn[ke[1]]-dn[ke[0]]:oe,De=x._values=x.values(r,x.filter(r,Ye,E,ue,Re),E,ue,Re);x._rotate=R==2?x.rotate(r,De,E,ue):0;let Me=x._size;x._size=Ni(x.size(r,De,E,g)),Me!=null&&x._size!=Me&&(y=!1)}),y}function Fo(g){let y=!0;return Go.forEach((x,E)=>{let O=x(r,E,Bn,g);O!=Di[E]&&(y=!1),Di[E]=O}),y}function jr(){for(let g=0;gdn[rn]):Ye,De=ue.distr==2?dn[Ye[1]]-dn[Ye[0]]:ae,Me=y.ticks,xe=y.border,ut=Me.show?Me.size:0,_t=Wt(ut*Pe),Rt=Wt((y.alignTo==2?y._size-ut-y.gap:y.gap)*Pe),et=y._rotate*-_c/180,lt=V(y._pos*Pe),hn=(_t+Rt)*te,Ht=lt+hn;R=E==0?Ht:0,O=E==1?Ht:0;let Tn=y.font[0],Yn=y.align==1?ir:y.align==2?eh:et>0?ir:et<0?eh:E==0?"center":x==3?eh:ir,ln=et||E==1?"middle":x==2?zo:dy;Nr(Tn,J,Yn,ln);let Gt=y.font[1]*y.lineGap,An=Ye.map(rn=>V(p(rn,ue,de,ke))),Qn=y._values;for(let rn=0;rn{x>0&&(y._paths=null,g&&(u==1?(y.min=null,y.max=null):y.facets.forEach(E=>{E.min=null,E.max=null})))})}let Es=!1,Ka=!1,Dn=[];function kr(){Ka=!1;for(let g=0;g0&&queueMicrotask(kr)}r.batch=Fa;function va(){if(cn&&(Yo(),cn=!1),qa&&(Rl(),qa=!1),gs){if(wt(T,ir,it),wt(T,zo,Mt),wt(T,No,Te),wt(T,Oo,fe),wt(j,ir,it),wt(j,zo,Mt),wt(j,No,Te),wt(j,Oo,fe),wt(z,No,ki),wt(z,Oo,ua),w.width=Wt(ki*Pe),w.height=Wt(ua*Pe),W.forEach(({_el:g,_show:y,_size:x,_pos:E,side:O})=>{if(g!=null)if(y){let R=O===3||O===0?x:0,J=O%2==1;wt(g,J?"left":"top",E-R),wt(g,J?"width":"height",x),wt(g,J?"top":"left",J?Mt:it),wt(g,J?"height":"width",J?fe:Te),vh(g,rs)}else fi(g,rs)}),Dl=Vn=Xi=bs=_s=Ar=Va=Ga=Tr=null,zt=1,Bl(!0),it!=Ri||Mt!=ca||Te!=ti||fe!=fa){Qa(!1);let g=Te/ti,y=fe/fa;if(we&&!da&&Y.left>=0){Y.left*=g,Y.top*=y,vi&&sa(vi,Wt(Y.left),0,Te,fe),En&&sa(En,0,Wt(Y.top),Te,fe);for(let x=0;x=0&&Xe.width>0){Xe.left*=g,Xe.width*=g,Xe.top*=y,Xe.height*=y;for(let x in $r)wt(Xa,x,Xe[x])}Ri=it,ca=Mt,ti=Te,fa=fe}Lt("setSize"),gs=!1}ki>0&&ua>0&&(S.clearRect(0,0,w.width,w.height),Lt("drawClear"),le.forEach(g=>g()),Lt("draw")),Xe.show&&ha&&(Ia(Xe),ha=!1),we&&da&&(ba(null,!0,!1),da=!1),$.show&&$.live&&fn&&(Ur(),fn=!1),m||(m=!0,r.status=1,Lt("ready")),gi=!1,Es=!1}r.redraw=(g,y)=>{qa=y||!1,g!==!1?Gn(ee,ie.min,ie.max):Pi()};function Ts(g,y){let x=B[g];if(x.from==null){if(At==0){let E=x.range(r,y.min,y.max,g);y.min=E[0],y.max=E[1]}if(y.min>y.max){let E=y.min;y.min=y.max,y.max=E}if(At>1&&y.min!=null&&y.max!=null&&y.max-y.min<1e-16)return;g==ee&&x.distr==2&&At>0&&(y.min=Vi(y.min,i[0]),y.max=Vi(y.max,i[0]),y.min==y.max&&y.max++),he[g]=y,cn=!0,Pi()}}r.setScale=Ts;let $l,As,vi,En,Ns,Ja,Un,Wi,Ll,Rr,We,at,Zi=!1;const Qe=Y.drag;let yt=Qe.x,Nt=Qe.y;we&&(Y.x&&($l=Ai(aT,j)),Y.y&&(As=Ai(lT,j)),ie.ori==0?(vi=$l,En=As):(vi=As,En=$l),We=Y.left,at=Y.top);const Xe=r.select=Jt({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),Xa=Xe.show?Ai(iT,Xe.over?j:T):null;function Ia(g,y){if(Xe.show){for(let x in g)Xe[x]=g[x],x in $r&&wt(Xa,x,g[x]);y!==!1&&Lt("setSelect")}}r.setSelect=Ia;function Cr(g){if(G[g].show)se&&vh(nt[g],rs);else if(se&&fi(nt[g],rs),we){let x=pa?wn[0]:wn[g];x!=null&&sa(x,-10,-10,Te,fe)}}function Gn(g,y,x){Ts(g,{min:y,max:x})}function Zn(g,y,x,E){y.focus!=null&&Wc(g),y.show!=null&&G.forEach((O,R)=>{R>0&&(g==R||g==null)&&(O.show=y.show,Cr(R),u==2?(Gn(O.facets[0].scale,null,null),Gn(O.facets[1].scale,null,null)):Gn(O.scale,null,null),Pi())}),x!==!1&&Lt("setSeries",g,y),E&&el("setSeries",r,g,y)}r.setSeries=Zn;function Jo(g,y){Jt(ne[g],y)}function Xc(g,y){g.fill=Be(g.fill||null),g.dir=Je(g.dir,-1),y=y??ne.length,ne.splice(y,0,g)}function Ic(g){g==null?ne.length=0:ne.splice(g,1)}r.addBand=Xc)DELIM" +R"DELIM(,r.setBand=Jo,r.delBand=Ic;function Pc(g,y){G[g].alpha=y,we&&wn[g]!=null&&(wn[g].style.opacity=y),se&&nt[g]&&(nt[g].style.opacity=y)}let ai,ea,ya;const Pa={focus:!0};function Wc(g){if(g!=ya){let y=g==null,x=ii.alpha!=1;G.forEach((E,O)=>{if(u==1||O>0){let R=y||O==0||O==g;E._focus=y?null:R,x&&Pc(O,R?1:ii.alpha)}}),ya=g,x&&Pi()}}se&&ma&&Xt(gy,ye,g=>{Y._lock||(ni(g),ya!=null&&Zn(null,Pa,!0,kt.setSeries))});function yi(g,y,x){let E=B[y];x&&(g=g/Pe-(E.ori==1?Mt:it));let O=Te;E.ori==1&&(O=fe,g=O-g),E.dir==-1&&(g=O-g);let R=E._min,J=E._max,te=g/O,ae=R+(J-R)*te,oe=E.distr;return oe==3?hr(10,ae):oe==4?xT(ae,E.asinh):oe==100?E.bwd(ae):ae}function Xo(g,y){let x=yi(g,ee,y);return Vi(x,i[0],jt,bt)}r.valToIdx=g=>Vi(g,i[0]),r.posToIdx=Xo,r.posToVal=yi,r.valToPos=(g,y,x)=>B[y].ori==0?d(g,B[y],x?ot:Te,x?kn:0):f(g,B[y],x?Vt:fe,x?nn:0),r.setCursor=(g,y,x)=>{We=g.left,at=g.top,ba(null,y,x)};function Io(g,y){wt(Xa,ir,Xe.left=g),wt(Xa,No,Xe.width=y)}function Po(g,y){wt(Xa,zo,Xe.top=g),wt(Xa,Oo,Xe.height=y)}let Hl=ie.ori==0?Io:Po,ql=ie.ori==1?Io:Po;function Dr(){if(se&&$.live)for(let g=u==2?1:0;g{N[E]=x}):TT(g.idx)||N.fill(g.idx),$.idx=N[0]),se&&$.live){for(let x=0;x0||u==1&&!jn)&&ef(x,N[x]);Dr()}fn=!1,y!==!1&&Lt("setLegend")}r.setLegend=Ur;function ef(g,y){let x=G[g],E=g==0&&_e==2?dn:i[g],O;jn?O=x.values(r,g,y)??xn:(O=x.value(r,y==null?null:E[y],g,y),O=O==null?xn:{_:O}),$.values[g]=O}function ba(g,y,x){Ll=We,Rr=at,[We,at]=Y.move(r,We,at),Y.left=We,Y.top=at,we&&(vi&&sa(vi,Wt(We),0,Te,fe),En&&sa(En,0,Wt(at),Te,fe));let E,O=jt>bt;ai=gt,ea=null;let R=ie.ori==0?Te:fe,J=ie.ori==1?Te:fe;if(We<0||At==0||O){E=Y.idx=null;for(let te=0;te0&&ut.show){let hn=et==null?-10:et==E?oe:ce(u==1?i[0][et]:i[xe][0][et],ie,R,0),Ht=lt==null?-10:Ee(lt,u==1?B[ut.scale]:B[ut.facets[1].scale],J,0);if(ma&<!=null){let Tn=ie.ori==1?We:at,Yn=en(ii.dist(r,xe,et,Ht,Tn));if(Yn=0?1:-1,Qn=Gt>=0?1:-1;Qn==An&&(Qn==1?ln==1?lt>=Gt:lt<=Gt:ln==1?lt<=Gt:lt>=Gt)&&(ai=Yn,ea=xe)}else ai=Yn,ea=xe}}if(fn||pa){let Tn,Yn;ie.ori==0?(Tn=hn,Yn=Ht):(Tn=Ht,Yn=hn);let ln,Gt,An,Qn,sn,rn,Nn=!0,ta=an.bbox;if(ta!=null){Nn=!1;let mn=ta(r,xe);An=mn.left,Qn=mn.top,ln=mn.width,Gt=mn.height}else An=Tn,Qn=Yn,ln=Gt=an.size(r,xe);if(rn=an.fill(r,xe),sn=an.stroke(r,xe),pa)xe==ea&&ai<=ii.prox&&(ue=An,de=Qn,ke=ln,Ye=Gt,Re=Nn,De=rn,Me=sn);else{let mn=wn[xe];mn!=null&&(Ji[xe]=An,ga[xe]=Qn,wy(mn,ln,Gt,Nn),Sy(mn,rn,sn),sa(mn,Ni(An),Ni(Qn),Te,fe))}}}}if(pa){let xe=ii.prox,ut=ya==null?ai<=xe:ai>xe||ea!=ya;if(fn||ut){let _t=wn[0];_t!=null&&(Ji[0]=ue,ga[0]=de,wy(_t,ke,Ye,Re),Sy(_t,De,Me),sa(_t,Ni(ue),Ni(de),Te,fe))}}}if(Xe.show&&Zi)if(g!=null){let[te,ae]=kt.scales,[oe,ue]=kt.match,[de,ke]=g.cursor.sync.scales,Ye=g.cursor.drag;if(yt=Ye._x,Nt=Ye._y,yt||Nt){let{left:Re,top:De,width:Me,height:xe}=g.select,ut=g.scales[de].ori,_t=g.posToVal,Rt,et,lt,hn,Ht,Tn=te!=null&&oe(te,de),Yn=ae!=null&&ue(ae,ke);Tn&&yt?(ut==0?(Rt=Re,et=Me):(Rt=De,et=xe),lt=B[te],hn=ce(_t(Rt,de),lt,R,0),Ht=ce(_t(Rt+et,de),lt,R,0),Hl(Gi(hn,Ht),en(Ht-hn))):Hl(0,R),Yn&&Nt?(ut==1?(Rt=Re,et=Me):(Rt=De,et=xe),lt=B[ae],hn=Ee(_t(Rt,ke),lt,J,0),Ht=Ee(_t(Rt+et,ke),lt,J,0),ql(Gi(hn,Ht),en(Ht-hn))):ql(0,J)}else Lr()}else{let te=en(Ll-Ns),ae=en(Rr-Ja);if(ie.ori==1){let ke=te;te=ae,ae=ke}yt=Qe.x&&te>=Qe.dist,Nt=Qe.y&&ae>=Qe.dist;let oe=Qe.uni;oe!=null?yt&&Nt&&(yt=te>=oe,Nt=ae>=oe,!yt&&!Nt&&(ae>te?Nt=!0:yt=!0)):Qe.x&&Qe.y&&(yt||Nt)&&(yt=Nt=!0);let ue,de;yt&&(ie.ori==0?(ue=Un,de=We):(ue=Wi,de=at),Hl(Gi(ue,de),en(de-ue)),Nt||ql(0,J)),Nt&&(ie.ori==1?(ue=Un,de=We):(ue=Wi,de=at),ql(Gi(ue,de),en(de-ue)),yt||Hl(0,R)),!yt&&!Nt&&(Hl(0,0),ql(0,0))}if(Qe._x=yt,Qe._y=Nt,g==null){if(x){if(au!=null){let[te,ae]=kt.scales;kt.values[0]=te!=null?yi(ie.ori==0?We:at,te):null,kt.values[1]=ae!=null?yi(ie.ori==1?We:at,ae):null}el(th,r,We,at,Te,fe,E)}if(ma){let te=x&&kt.setSeries,ae=ii.prox;ya==null?ai<=ae&&Zn(ea,Pa,!0,te):ai>ae?Zn(null,Pa,!0,te):ea!=ya&&Zn(ea,Pa,!0,te)}}fn&&($.idx=E,Ur()),y!==!1&&Lt("setCursor")}let $i=null;Object.defineProperty(r,"rect",{get(){return $i==null&&Bl(!1),$i}});function Bl(g=!1){g?$i=null:($i=j.getBoundingClientRect(),Lt("syncRect",$i))}function Wo(g,y,x,E,O,R,J){Y._lock||Zi&&g!=null&&g.movementX==0&&g.movementY==0||(Zr(g,y,x,E,O,R,J,!1,g!=null),g!=null?ba(null,!0,!0):ba(y,!0,!1))}function Zr(g,y,x,E,O,R,J,te,ae){if($i==null&&Bl(!1),ni(g),g!=null)x=g.clientX-$i.left,E=g.clientY-$i.top;else{if(x<0||E<0){We=-10,at=-10;return}let[oe,ue]=kt.scales,de=y.cursor.sync,[ke,Ye]=de.values,[Re,De]=de.scales,[Me,xe]=kt.match,ut=y.axes[0].side%2==1,_t=ie.ori==0?Te:fe,Rt=ie.ori==1?Te:fe,et=ut?R:O,lt=ut?O:R,hn=ut?E:x,Ht=ut?x:E;if(Re!=null?x=Me(oe,Re)?p(ke,B[oe],_t,0):-10:x=_t*(hn/et),De!=null?E=xe(ue,De)?p(Ye,B[ue],Rt,0):-10:E=Rt*(Ht/lt),ie.ori==1){let Tn=x;x=E,E=Tn}}ae&&(y==null||y.cursor.event.type==th)&&((x<=1||x>=Te-1)&&(x=ls(x,Te)),(E<=1||E>=fe-1)&&(E=ls(E,fe))),te?(Ns=x,Ja=E,[Un,Wi]=Y.move(r,x,E)):(We=x,at=E)}const $r={width:0,height:0,left:0,top:0};function Lr(){Ia($r,!1)}let eu,tu,nu,iu;function Os(g,y,x,E,O,R,J){Zi=!0,yt=Nt=Qe._x=Qe._y=!1,Zr(g,y,x,E,O,R,J,!0,!1),g!=null&&(Xt(nh,ph,Wa,!1),el(my,r,Un,Wi,Te,fe,null));let{left:te,top:ae,width:oe,height:ue}=Xe;eu=te,tu=ae,nu=oe,iu=ue}function Wa(g,y,x,E,O,R,J){Zi=Qe._x=Qe._y=!1,Zr(g,y,x,E,O,R,J,!1,!0);let{left:te,top:ae,width:oe,height:ue}=Xe,de=oe>0||ue>0,ke=eu!=te||tu!=ae||nu!=oe||iu!=ue;if(de&&ke&&Ia(Xe),Qe.setScale&&de&&ke){let Ye=te,Re=oe,De=ae,Me=ue;if(ie.ori==1&&(Ye=ae,Re=ue,De=te,Me=oe),yt&&Gn(ee,yi(Ye,ee),yi(Ye+Re,ee)),Nt)for(let xe in B){let ut=B[xe];xe!=ee&&ut.from==null&&ut.min!=gt&&Gn(xe,yi(De+Me,xe),yi(De,xe))}Lr()}else Y.lock&&(Y._lock=!Y._lock,ba(y,!0,g!=null));g!=null&&(Ki(nh,ph),el(nh,r,We,at,Te,fe,null))}function tf(g,y,x,E,O,R,J){if(Y._lock)return;ni(g);let te=Zi;if(Zi){let ae=!0,oe=!0,ue=10,de,ke;ie.ori==0?(de=yt,ke=Nt):(de=Nt,ke=yt),de&&ke&&(ae=We<=ue||We>=Te-ue,oe=at<=ue||at>=fe-ue),de&&ae&&(We=We{let O=kt.match[2];x=O(r,y,x),x!=-1&&Zn(x,E,!0,!1)},we&&(Xt(my,j,Os),Xt(th,j,Wo),Xt(py,j,g=>{ni(g),Bl(!1)}),Xt(gy,j,tf),Xt(vy,j,Hr),wh.add(r),r.syncRect=Bl);const Vl=r.hooks=n.hooks||{};function Lt(g,y,x){Ka?Dn.push([g,y,x]):g in Vl&&Vl[g].forEach(E=>{E.call(null,r,y,x)})}(n.plugins||[]).forEach(g=>{for(let y in g.hooks)Vl[y]=(Vl[y]||[]).concat(g.hooks[y])});const Sa=(g,y,x)=>x,kt=Jt({key:null,setSeries:!1,filters:{pub:Ny,sub:Ny},scales:[ee,G[1]?G[1].scale:null],match:[Oy,Oy,Sa],values:[null,null]},Y.sync);kt.match.length==2&&kt.match.push(Sa),Y.sync=kt;const au=kt.key,Br=Cb(au);function el(g,y,x,E,O,R,J){kt.filters.pub(g,y,x,E,O,R,J)&&Br.pub(g,y,x,E,O,R,J)}Br.sub(r);function lu(g,y,x,E,O,R,J){kt.filters.sub(g,y,x,E,O,R,J)&&_a[g](null,y,x,E,O,R,J)}r.pub=lu;function Gl(){Br.unsub(r),wh.delete(r),ji.clear(),yh(jc,fr,qr),v.remove(),ye?.remove(),Lt("destroy")}r.destroy=Gl;function xa(){Lt("init",n,i),$t(i||n.data,!1),he[ee]?Ts(ee,he[ee]):ys(),ha=Xe.show&&(Xe.width>0||Xe.height>0),da=fn=!0,Ba(n.width,n.height)}return G.forEach(Ci),W.forEach(Er),l?l instanceof HTMLEleme)DELIM" +R"DELIM(nt?(l.appendChild(v),xa()):l(r,xa):xa(),r}un.assign=Jt;un.fmtNum=sm;un.rangeNum=kc;un.rangeLog=qc;un.rangeAsinh=am;un.orient=ps;un.pxRatio=Pe;un.join=RT;un.fmtDate=om,un.tzDate=GT;un.sync=Cb;{un.addGap=TA,un.clipGaps=Gc;let n=un.paths={points:Hb};n.linear=Bb,n.stepped=OA,n.bars=MA,n.spline=kA}const VA=(n,i,l,r,u)=>{if(!Number.isFinite(l)||!Number.isFinite(r)||r<=l)return[];const d=[];if(Math.asinh(r)-Math.asinh(l)<1.5){const m=Number.isFinite(u)&&u>0?u:(r-l)/4,v=Math.ceil(l/m)*m;for(let w=0;w<100;w++){const S=Number((v+w*m).toPrecision(14));if(S>r)break;d.push({value:S,priority:S===0?0:1})}}else{const m=Math.ceil(Math.log10(Math.max(Math.abs(l),Math.abs(r))));for(let v=Math.min(-1,m-1);v<=m;v++)for(const w of[1,2,5]){const S=w*10**v;for(const z of[-S,S])Number.isFinite(z)&&z>=l&&z<=r&&d.push({value:z,priority:w===1?1:2})}l<=0&&r>=0&&d.push({value:0,priority:0})}d.sort((m,v)=>m.priority-v.priority||m.value-v.value);const f=[],p=[];for(const{value:m}of d){const v=n.valToPos(m,"y");Number.isFinite(v)&&p.every(w=>Math.abs(v-w)>=36)&&(f.push(m),p.push(v))}return f.sort((m,v)=>m-v),f};function GA({data:n,series:i,height:l=280,emptyMessage:r="Waiting for live data…",valueSuffix:u="",zeroBased:d=!0,valueFormatter:f=FA,visualization:p="line",scale:m="linear",forceEmpty:v=!1}){const w=re.useRef(null),S=re.useRef(null),z=re.useRef(!1),T=re.useRef(null),j=re.useMemo(()=>KA(n),[n]),L=re.useRef(j),V=!v&&n[0]?.length>0;return re.useLayoutEffect(()=>{L.current=j},[j]),re.useLayoutEffect(()=>{const H=w.current;if(!H)return;const G={width:Math.max(240,H.clientWidth),height:l,padding:[12,8,0,0],cursor:{drag:{x:!0,y:!1,setScale:!0},focus:{prox:24}},hooks:{setSelect:[ee=>{ee.select.width>0&&(z.current=!0)}]},legend:{show:!0,live:!0},scales:{x:{time:!0},y:{auto:!0,distr:m==="compressed"?4:1,asinh:1,...d?{range:(ee,K,le)=>[Math.min(0,K),le===0?1:le*1.08]}:{range:(ee,K,le)=>{const ze=le-K,ve=ze===0?Math.max(1,Math.abs(le)*5e-4):ze*.08;return[K-ve,le+ve]}}}},axes:[{stroke:"#9f9f98",grid:{stroke:"#ffffff12",width:1},ticks:{stroke:"#ffffff20",width:1},font:"11px system-ui"},{size:72,stroke:"#9f9f98",grid:{stroke:"#ffffff12",width:1},ticks:{stroke:"#ffffff20",width:1},font:"11px system-ui",values:(ee,K)=>K.map(le=>le===null?null:`${f(le)}${u}`),...m==="compressed"?{splits:VA,filter:(ee,K)=>K}:{}}],series:[{},...i.map((ee,K)=>{const le=p==="step"?un.paths.stepped?.({align:1}):p==="bar"?YA(K,i.length):void 0;return{label:ee.label,stroke:ee.color,fill:p==="area"||p==="bar"?ee.fill??`${ee.color}24`:ee.fill,width:ee.width??2,paths:le,points:{show:p==="line"?ee.points??!1:!1},value:(ze,ve)=>ve===null?"—":`${f(ve)}${u}`}})]},W=new un(G,L.current,H),B=T.current;B&&W.setScale("x",B),S.current=W;const ne=new ResizeObserver(ee=>{const K=ee[0]?.contentRect.width;K&&K>0&&W.setSize({width:Math.round(K),height:l})});return ne.observe(H),()=>{T.current=z.current&&W.scales.x.min!=null&&W.scales.x.max!=null?{min:W.scales.x.min,max:W.scales.x.max}:null,ne.disconnect(),W.destroy(),S.current=null}},[l,i,f,u,p,d,m]),re.useEffect(()=>{const H=S.current;if(!H)return;const G=!z.current;H.setData(j,G),G||H.redraw()},[j]),_.jsxs("div",{className:"relative min-w-0",children:[_.jsx("div",{ref:w,className:"min-w-0 overflow-hidden"}),!V&&_.jsx("div",{className:"bg-surface text-textMuted pointer-events-none absolute inset-0 z-10 flex items-center justify-center text-sm",children:r})]})}function YA(n,i){const l=Math.max(1,i);return un.paths.bars?.({size:[1,48/l,0],disp:{x0:{unit:1,values:r=>{const u=Iy(r,l),d=-u.groupWidth/2+u.barWidth*n;return Array.from(r.data[0],f=>f+d)}},size:{unit:1,values:r=>[Iy(r,l).barWidth]}}})}function Iy(n,i){const l=QA(n.data[0]),r=Math.abs(n.posToVal(48,"x")-n.posToVal(0,"x")),u=Math.min(l*.72,r);return{groupWidth:u,barWidth:u/i}}function QA(n){let i=Number.POSITIVE_INFINITY,l;for(const r of n)if(Number.isFinite(r)){if(l!==void 0){const u=Math.abs(r-l);u>0&&u=2)return n;const l=Date.now()/1e3,r=i[0]??l,u=[r-1,r],d=n.slice(1).map(f=>{const p=f[0]??null;return[p,p]});return[u,...d]}function FA(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 JA={300:"5m",900:"15m",3600:"1h"},XA=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),IA=new Intl.NumberFormat(void 0,{maximumFractionDigits:2});function PA(n){return XA.format(n)}function WA(n){return IA.format(n)}function eN(n){return n==="height"||n==="occurrences"?PA:WA}function tN({metrics:n}){const[i,l]=re.useState(RE),[r,u]=re.useState(null),[d,f]=re.useState(!1);re.useEffect(()=>{CE(i)},[i]);function p(w){l(S=>r?.mode==="add"?S.length>=lr?S:[...S,w]:S.map(z=>z.id===w.id?w:z)),u(null)}function m(w,S){l(z=>{const T=w+S;if(T<0||T>=z.length)return z;const j=[...z],L=j[w],V=j[T];return j[w]=V,j[T]=L,j})}function v(){if(!d){f(!0);return}l(bc()),f(!1)}return _.jsxs("section",{className:"space-y-4",children:[_.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Live telemetry"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Custom charts"}),_.jsxs("p",{className:"text-textMuted mt-1 text-sm",children:["Session data only · ",String(i.length)," of ",String(lr)," charts"]})]}),_.jsxs("div",{className:"flex flex-wrap gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{f(!1),u({mode:"add",chart:tb()})},disabled:i.length>=lr,className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold disabled:cursor-not-allowed disabled:opacity-40",children:"Add chart"}),_.jsx("button",{type:"button",onClick:v,onBlur:()=>{f(!1)},className:`rounded-lg border px-4 py-2 text-sm ${d?"border-amber-400/60 text-amber-200":"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary"}`,children:d?"Confirm reset":"Reset defaults"})]})]}),i.length===0?_.jsxs("div",{className:"border-accent/20 bg-surface/60 rounded-xl border border-dashed px-6 py-16 text-center",children:[_.jsx("p",{className:"text-textPrimary font-medium",children:"No charts in this dashboard."}),_.jsx("p",{className:"text-textMuted mt-2 text-sm",children:"Add a custom chart or start from a template."})]}):_.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:i.map((w,S)=>_.jsx(nN,{chart:w,metrics:n,canMoveEarlier:S>0,canMoveLater:S{l(z=>z.map(T=>T.id===w.id?{...T,scale:T.scale==="compressed"?"linear":"compressed"}:T))},onDelete:()=>{l(z=>z.filter(T=>T.id!==w.id))},onDuplicate:()=>{l(z=>z.length>=lr?z:[...z,kE(w)])},onEdit:()=>{u({mode:"edit",chart:w})},onMoveEarlier:()=>{m(S,-1)},onMoveLater:()=>{m(S,1)}},w.id))}),r&&_.jsx(KE,{chart:r.chart,mode:r.mode,onCancel:()=>{u(null)},onSave:p},`${r.mode}-${r.chart.id}`)]})}function nN({chart:n,metrics:i,canMoveEarlier:l,canMoveLater:r,canDuplicate:u,onDelete:d,onDuplicate:f,onEdit:p,onMoveEarlier:m,onMoveLater:v,onToggleScale:w}){const[S,z]=re.useState(null),[T,j]=re.useState(0),L=S??i,V=re.useMemo(()=>LE(L,n),[n,L]),H=re.useMemo(()=>n.series.map(B=>({label:B.label??$a(B.signalId).label,color:B.color})),[n.series]),G=eN(V.unit),W=`Waiting for ${n.series.length===1?H[0]?.label?.toLowerCase():"the selected signals"}…`;return _.jsxs("article",{className:"border-accent/20 bg-surface/70 min-w-0 overflow-hidden rounded-xl border",children:[_.jsx("header",{className:"border-accent/15 space-y-3 border-b px-4 py-4 sm:px-5",children:_.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[_.jsxs("div",{className:"min-w-0",children:[_.jsx("h3",{className:"truncate font-semibold",title:n.title,children:n.title}),_.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:[lb(V.unit)," · ",JA[n.range]," · ",n.visualization,n.scale)DELIM" +R"DELIM(==="compressed"?" · compressed scale":"",S?" · paused":""]})]}),_.jsxs("div",{className:"flex flex-wrap justify-end gap-1 text-xs",children:[_.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:w,className:`rounded border px-2 py-1.5 ${n.scale==="compressed"?"border-accent/40 bg-accent/10 text-accent":"text-textMuted hover:text-textPrimary border-white/10 hover:bg-white/5"}`,children:"Compress peaks"}),_.jsx(as,{label:S?"Resume chart":"Pause chart",onClick:()=>{z(B=>B?null:i)},children:S?"Resume":"Pause"}),_.jsx(as,{label:"Reset chart zoom",onClick:()=>{j(B=>B+1)},children:"Reset zoom"}),_.jsx(as,{label:"Edit chart",onClick:p,children:"Edit"}),_.jsx(as,{label:"Duplicate chart",onClick:f,disabled:!u,children:"Duplicate"}),_.jsx(as,{label:`Move ${n.title} earlier`,onClick:m,disabled:!l,children:"←"}),_.jsx(as,{label:`Move ${n.title} later`,onClick:v,disabled:!r,children:"→"}),_.jsx(as,{label:"Delete chart",onClick:d,danger:!0,children:"Delete"})]})]})}),_.jsx("div",{className:"min-w-0 p-3 sm:p-5",children:_.jsx(GA,{data:V.data,series:H,visualization:n.visualization,scale:n.scale,zeroBased:qE(V.unit),valueFormatter:G,valueSuffix:HE(V.unit),forceEmpty:!V.hasObservedData,emptyMessage:W},T)}),n.scale==="compressed"&&_.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."}),V.unobservedLabels.length>0&&V.hasObservedData&&_.jsxs("footer",{className:"border-accent/10 text-textMuted border-t px-5 py-2 text-[11px]",children:["Not observed this session: ",V.unobservedLabels.join(", ")]})]})}function as({label:n,children:i,onClick:l,disabled:r=!1,danger:u=!1}){return _.jsx("button",{type:"button","aria-label":n,onClick:l,disabled:r,className:`rounded 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-textPrimary hover:bg-white/5"}`,children:i})}const iN=[{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 aN({adminStatus:n,endpoints:i,metrics:l,native:r,syncEstimate:u}){const d=yE(l,10),f=r.configuration,p=Oi(6),m=[n.error?`Admin: ${n.error}`:null,r.status.error?`Native: ${r.status.error}`:null,r.transport==="none"&&r.restError?`Native REST: ${r.restError}`:null,l.invalidFrames>0?`${String(l.invalidFrames)} malformed admin frame${l.invalidFrames===1?"":"s"} ignored`:null,r.live.invalidFrames>0?`${String(r.live.invalidFrames)} malformed native frame${r.live.invalidFrames===1?"":"s"} ignored`:null,r.status.phase==="connected"&&r.transport==="none"?"Native: Connected, but no fresh valid state has been received":null].filter(v=>v!==null);return _.jsxs("div",{className:"space-y-8",children:[m.length>0&&_.jsxs("section",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3",children:[_.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Transport notice"}),_.jsx("ul",{className:"text-textMuted mt-1 space-y-1 text-xs",children:m.map(v=>_.jsx("li",{children:v},v))})]}),_.jsx(wE,{confirmed:r.top,estimate:u}),_.jsxs("dl",{"aria-label":"Node summary",className:"grid grid-cols-2 border-y border-white/10 lg:grid-cols-[1fr_1.15fr_1fr_1fr]",children:[_.jsx(hc,{label:"Canonical top",value:r.top===null?"—":Hn(r.top),detail:r.transport==="none"?"Waiting for native API":`${sN(u)} · via ${r.transport==="websocket"?"native WebSocket":"REST fallback"}`,emphasized:!0}),_.jsx(hc,{label:"Current activity",value:d.label,detail:d.rate>0?`${Q2(d.rate)} over the last 10 seconds`:"No lifecycle events in the last 10 seconds",numeric:!1}),_.jsx(hc,{label:"Highest confirmed",value:l.signalMaximums[p]===void 0?"—":Hn(l.signalMaximums[p]),detail:`${Hn(l.signalTotals[p]??0)} confirmations observed`}),_.jsx(hc,{label:"Collection uptime",value:Y2(l.now-l.sessionStartedAt),detail:`${Hn(l.totalEvents)} events · ${Hn(l.totalLogs)} logs`})]}),_.jsxs("section",{className:"grid gap-4 lg:grid-cols-2",children:[_.jsx(Py,{title:"Admin stream",endpoint:i.adminUrl,status:n,detail:n.lastMessageAt?`Last frame ${jo(n.lastMessageAt)}`:"Waiting for the first frame"}),_.jsx(Py,{title:"Native interface",endpoint:i.nativeUrl,status:r.status,detail:r.receivedAt?`Last state ${jo(r.receivedAt)} · ${r.transport}`:"Waiting for node state"})]}),_.jsx(tN,{metrics:l}),_.jsxs("section",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsxs("header",{className:"border-accent/15 border-b px-5 py-4",children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Lifecycle heights"}),_.jsx("h2",{className:"mt-1 font-semibold",children:"Highest observed event values"})]}),_.jsx("div",{className:"grid gap-px bg-white/5 sm:grid-cols-2 lg:grid-cols-3",children:iN.map(({event:v,label:w})=>{const S=l.signalMaximums[Oi(v)];return _.jsxs("div",{className:"bg-surface px-5 py-4",children:[_.jsx("p",{className:"text-textMuted text-xs",children:w}),_.jsx("p",{className:"text-textPrimary mt-2 font-mono text-lg tabular-nums",children:S===void 0?"—":Hn(S)})]},v)})})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsxs("header",{className:"border-accent/15 border-b px-5 py-4",children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Capabilities"}),_.jsx("h2",{className:"mt-1 font-semibold",children:"Native configuration"})]}),f?_.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-4 p-5 text-sm",children:[_.jsx(ar,{label:"Address index",enabled:f.address}),_.jsx(ar,{label:"Client filters",enabled:f.filter}),_.jsx(ar,{label:"Turbo",enabled:f.turbo}),_.jsx(ar,{label:"Witness",enabled:f.witness}),_.jsx(ar,{label:"Retarget",enabled:f.retarget}),_.jsx(ar,{label:"Difficulty",enabled:f.difficult}),_.jsxs("div",{className:"col-span-2 border-t border-white/5 pt-3",children:[_.jsx("span",{className:"text-textMuted",children:"Pruned below"}),_.jsx("span",{className:"text-textPrimary float-right font-mono",children:f.pruned>0?Hn(f.pruned):"Not pruned"})]})]}):_.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:"Waiting for native configuration."})]})]}),_.jsx("section",{children:_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsx("header",{className:"border-accent/15 border-b px-5 py-4",children:_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Recent events"})}),l.recentEvents.length===0?_.jsx(lN,{text:"No events observed yet."}):_.jsx("ul",{className:"divide-y divide-white/5",children:l.recentEvents.slice(0,6).map(v=>_.jsxs("li",{className:"flex items-center gap-3 px-5 py-3 text-xs",children:[_.jsx("time",{className:"text-textMuted w-24 shrink-0 font-mono",children:jo(v.time)}),_.jsx("span",{className:"text-textPrimary min-w-0 flex-1 truncate font-mono",children:qo(v.event).name}),_.jsx("span",{className:"text-accent tabular-nums",children:J0(v.event,v.value)})]},v.id))})]})})]})}function Py({title:n,endpoint:i,status:l,detail:r}){return _.jsxs("article",{className:"border-accent/20 bg-surface/70 min-w-0 rounded-xl border p-5",children:[_.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-textMuted text-xs tracking-wide uppercase",children:n}),_.jsx("p",{className:"text-textPrimary mt-2 font-mono text-sm break-all",children:K2(i)})]}),_.jsx(xE,{phase:l.phase,label:l.phase})]}),_.jsxs("div",{className:"text-textMuted mt-4 flex flex-wrap justify-between gap-2 border-t borde)DELIM" +R"DELIM(r-white/5 pt-3 text-xs",children:[_.jsx("span",{children:r}),_.jsxs("span",{children:[String(l.reconnects)," reconnect",l.reconnects===1?"":"s"]})]})]})}function ar({label:n,enabled:i}){return _.jsxs("div",{className:"flex items-center justify-between gap-3",children:[_.jsx("span",{className:"text-textMuted",children:n}),_.jsx("span",{className:i?"text-emerald-300":"text-textMuted",children:i?"Enabled":"Disabled"})]})}function lN({text:n}){return _.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:n})}function sN(n){return n?n.blocksRemaining<=Lc?"Near current (estimated)":`${Hn(n.blocksRemaining)} blocks remaining (estimated)`:"Waiting for confirmed block timestamp"}const rN=8e3;function oN({estimate:n,browserNotificationsEnabled:i}){const l=re.useRef(null),[r,u]=re.useState(null),d=n?.blocksRemaining??null;if(re.useEffect(()=>{const p=cN(d);if(!p)return;const m=l.current;if(l.current=p.state,!(m===null||m===p.state)&&(u(p),i)){const v=uN(p);G_(v.title,{body:v.body,tag:"libbitcoin-sync-status"})}},[i,d]),re.useEffect(()=>{if(!r)return;const p=setTimeout(()=>{u(m=>m===r?null:m)},rN);return()=>{clearTimeout(p)}},[r]),!r)return null;const f=r.state==="near-current";return _.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 ${f?"border-emerald-400/35 bg-emerald-950/95":"border-amber-400/35 bg-amber-950/95"}`,children:_.jsxs("div",{className:"flex items-start gap-4",children:[_.jsxs("div",{className:"min-w-0 flex-1",children:[_.jsx("p",{className:f?"font-semibold text-emerald-200":"font-semibold text-amber-200",children:f?"Node near current (estimated)":"Node fell behind (estimated)"}),_.jsx("p",{className:"mt-1 text-sm text-white/75",children:Eh(r)})]}),_.jsx("button",{type:"button","aria-label":"Dismiss synchronization notification",onClick:()=>{u(null)},className:"text-lg leading-none text-white/60 hover:text-white",children:"×"})]})})}function uN(n){return n.state==="near-current"?{title:"Libbitcoin node near current (estimated)",body:Eh(n)}:{title:"Libbitcoin node fell behind (estimated)",body:Eh(n)}}function cN(n){return n===null?null:{state:n<=Lc?"near-current":"behind",blocksBehind:n}}function Eh(n){return n.state==="near-current"?`Confirmed top is estimated to be within ${String(Lc)} blocks of the chain tip, based on block time.`:`Confirmed top is estimated to be ${Hn(n.blocksBehind)} blocks behind the chain tip, based on block time.`}const Qb='(function(){"use strict";var $e;function c(e,t,n){function r(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,u);const l=s.prototype,h=Object.keys(l);for(let m=0;mn?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class j extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Se extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}($e=globalThis).__zod_globalConfig??($e.__zod_globalConfig={});const se=globalThis.__zod_globalConfig;function A(e){return se}function Ze(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 oe(e,t){return typeof t=="bigint"?t.toString():t}function ae(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ce(e){return e==null}function ue(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Lt(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r){};function V(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ft=ae(()=>{if(se.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function F(e){if(V(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(V(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Te(e){return F(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const xt=new Set(["string","number","symbol"]);function W(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function N(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function f(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 Dt(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ut={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Jt(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 o=T(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return P(this,"shape",s),s},checks:[]});return N(e,o)}function Kt(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 o=T(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return P(this,"shape",s),s},checks:[]});return N(e,o)}function Vt(e,t){if(!F(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=T(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return P(this,"shape",o),o}});return N(e,i)}function Wt(e,t){if(!F(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=T(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return P(this,"shape",r),r}});return N(e,n)}function Bt(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=T(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return P(this,"shape",r),r},get catchall(){return t._zod.def.catchall},ch)DELIM" +R"DELIM(ecks:t._zod.def.checks??[]});return N(e,n)}function Gt(e,t,n){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=T(t._zod.def,{get shape(){const a=t._zod.def.shape,u={...a};if(n)for(const l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(u[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(const l in a)u[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return P(this,"shape",u),u},checks:[]});return N(t,s)}function qt(e,t,n){const r=T(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:i[s]}))}else for(const s in i)o[s]=new e({type:"nonoptional",innerType:i[s]});return P(this,"shape",o),o}});return N(t,r)}function R(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 B(e){return typeof e=="string"?e:e?.message}function M(e,t,n){const r=e.message?e.message:B(e.inst?._zod.def?.error?.(e))??B(t?.error?.(e))??B(n.customError?.(e))??B(n.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=s),a}function le(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function x(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Ae=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,oe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Pe=c("$ZodError",Ae),Me=c("$ZodError",Ae,{Parent:Error});function Yt(e,t=n=>n.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Xt(e,t=n=>n.message){const n={_errors:[]},r=(i,o=[])=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...o,...s.path]);else{const a=[...o,...s.path];if(a.length===0)n._errors.push(t(s));else{let u=n,l=0;for(;l(t,n,r,i)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new j;if(s.issues.length){const a=new(i?.Err??e)(s.issues.map(u=>M(u,o,A())));throw Oe(a,i?.callee),a}return s.value},fe=e=>async(t,n,r,i)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(i?.Err??e)(s.issues.map(u=>M(u,o,A())));throw Oe(a,i?.callee),a}return s.value},G=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new j;return o.issues.length?{success:!1,error:new(e??Pe)(o.issues.map(s=>M(s,i,A())))}:{success:!0,data:o.value}},Qt=G(Me),q=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>M(s,i,A())))}:{success:!0,data:o.value}},en=q(Me),tn=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return he(e)(t,n,i)},nn=e=>(t,n,r)=>he(e)(t,n,r),rn=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return fe(e)(t,n,i)},sn=e=>async(t,n,r)=>fe(e)(t,n,r),on=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return G(e)(t,n,i)},an=e=>(t,n,r)=>G(e)(t,n,r),cn=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return q(e)(t,n,i)},un=e=>async(t,n,r)=>q(e)(t,n,r),ln=/^[cC][0-9a-z]{6,}$/,hn=/^[0-9a-z]+$/,fn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,dn=/^[0-9a-vA-V]{20}$/,pn=/^[A-Za-z0-9]{27}$/,mn=/^[a-zA-Z0-9_-]{21}$/,gn=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,_n=/^([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})$/,je=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)$/,vn=/^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_\'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,bn="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$";function yn(){return new RegExp(bn,"u")}const wn=/^(?:(?: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])$/,zn=/^(([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}|:))$/,kn=/^((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])$/,$n=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Re=/^[A-Za-z0-9_-]*$/,Zn=/^https?$/,En=/^\\+[1-9]\\d{6,14}$/,Le="(?:(?:\\\\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])))",In=new RegExp(`^${Le}$`);function Ce(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}}`:`${t}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`}function On(e){return new RegExp(`^${Ce(e)}$`)}function Tn(e){const t=Ce({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Le}T(?:${r})$`)}const Nn=e=>{const t=e?`[\\\\s\\\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\\\s\\\\S]*";return new RegExp(`^${t}$`)},An=/^-?\\d+$/,Pn=/^-?\\d+(?:\\.\\d+)?$/,Mn=/^[^A-Z]*$/,jn=/^[^a-z]*$/,E=c("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Fe={number:"number",bigint:"bigint",object:"date"},xe=c("$ZodCheckLessThan",(e,t)=>{E.init(e,t);const n=Fe[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?r.value<=t.value:r.value{E.init(e,t);const n=Fe[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_s)DELIM" +R"DELIM(mall",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Rn=c("$ZodCheckMultipleOf",(e,t)=>{E.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Lt(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})}}),Ln=c("$ZodCheckNumberFormat",(e,t)=>{E.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=Ut[t.format];e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,a.minimum=i,a.maximum=o,n&&(a.pattern=An)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}ao&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Cn=c("$ZodCheckMaxLength",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const i=r.value;if(i.length<=t.maximum)return;const s=le(i);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Fn=c("$ZodCheckMinLength",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const s=le(i);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),xn=c("$ZodCheckLengthEquals",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=r=>{const i=r.value,o=i.length;if(o===t.length)return;const s=le(i),a=o>t.length;r.issues.push({origin:s,...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})}}),H=c("$ZodCheckStringFormat",(e,t)=>{var n,r;E.init(e,t),e._zod.onattach.push(i=>{const o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),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=()=>{})}),Dn=c("$ZodCheckRegex",(e,t)=>{H.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})}}),Un=c("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Mn),H.init(e,t)}),Jn=c("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=jn),H.init(e,t)}),Kn=c("$ZodCheckIncludes",(e,t)=>{E.init(e,t);const n=W(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(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})}}),Vn=c("$ZodCheckStartsWith",(e,t)=>{E.init(e,t);const n=new RegExp(`^${W(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(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})}}),Wn=c("$ZodCheckEndsWith",(e,t)=>{E.init(e,t);const n=new RegExp(`.*${W(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(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})}}),Bn=c("$ZodCheckOverwrite",(e,t)=>{E.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Gn{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`\n`).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),o=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of o)this.content.push(s)}compile(){const t=Function,n=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,i.join(`\n`))}}const qn={major:4,minor:4,patch:3},w=c("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qn;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const o of i._zod.onattach)o(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,a,u)=>{let l=R(s),h;for(const m of a){if(m._zod.def.when){if(Ht(s)||!m._zod.def.when(s))continue}else if(l)continue;const p=s.issues.length,d=m._zod.check(s);if(d instanceof Promise&&u?.async===!1)throw new j;if(h||d instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await d,s.issues.length!==p&&(l||(l=R(s,p)))});else{if(s.issues.length===p)continue;l||(l=R(s,p))}}return h?h.then(()=>s):s},o=(s,a,u)=>{if(R(s))return s.aborted=!0,s;const l=i(a,r,u);if(l instanceof Promise){if(u.async===!1)throw new j;return l.then(h=>e._zod.parse(h,u))}return e._zod.parse(l,u)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const l=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(h=>o(h,s,a)):o(l,s,a)}const u=e._zod.parse(s,a);if(u instanceof Promise){if(a.async===!1)throw new j;return u.then(l=>i(l,r,a))}return i(u,r,a)}}g(e,"~standard",()=>({validate:i=>{try{const o=Qt(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return en(e,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),de=c("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Nn(e._zod.bag),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}}),v=c("$ZodStringFormat",(e,t)=>{H.init(e,t),de.init(e,t)}),Hn=c("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=_n),v.init(e,t)}),Yn=c("$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=je(r))}else t.pattern??(t.pattern=je());v.init(e,t)}),Xn=c("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=vn),v.init(e,t)}),Qn=c("$ZodURL",(e,t)=>{v.init(e,t),e._zod.check=n=>{try)DELIM" +R"DELIM({const r=n.value.trim();if(!t.normalize&&t.protocol?.source===Zn.source&&!/^https?:\\/\\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),er=c("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=yn()),v.init(e,t)}),tr=c("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=mn),v.init(e,t)}),nr=c("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ln),v.init(e,t)}),rr=c("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=hn),v.init(e,t)}),ir=c("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fn),v.init(e,t)}),sr=c("$ZodXID",(e,t)=>{t.pattern??(t.pattern=dn),v.init(e,t)}),or=c("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=pn),v.init(e,t)}),ar=c("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Tn(t)),v.init(e,t)}),cr=c("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=In),v.init(e,t)}),ur=c("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=On(t)),v.init(e,t)}),lr=c("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=gn),v.init(e,t)}),hr=c("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wn),v.init(e,t),e._zod.bag.format="ipv4"}),fr=c("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=zn),v.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),dr=c("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=kn),v.init(e,t)}),pr=c("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=$n),v.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[i,o]=r;if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Ue(e){if(e==="")return!0;if(/\\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const mr=c("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Sn),v.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Ue(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function gr(e){if(!Re.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ue(n)}const _r=c("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Re),v.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{gr(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),vr=c("$ZodE164",(e,t)=>{t.pattern??(t.pattern=En),v.init(e,t)});function br(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 yr=c("$ZodJWT",(e,t)=>{v.init(e,t),e._zod.check=n=>{br(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Je=c("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=e._zod.bag.pattern??Pn,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 o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),wr=c("$ZodNumberFormat",(e,t)=>{Ln.init(e,t),Je.init(e,t)}),zr=c("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=n=>n}),kr=c("$ZodNever",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ke(e,t,n){e.issues.length&&t.issues.push(...Ne(n,e.issues)),t.value[n]=e.value}const $r=c("$ZodArray",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let s=0;sKe(l,n,s))):Ke(u,n,s)}return o.length?Promise.all(o).then(()=>n):n}});function Y(e,t,n,r,i,o){const s=n in r;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...Ne(n,e.issues))}if(!s&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?s&&(t.value[n]=void 0):t.value[n]=e.value}function Ve(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=Dt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function We(e,t,n,r,i,o){const s=[],a=i.keySet,u=i.catchall._zod,l=u.def.type,h=u.optin==="optional",m=u.optout==="optional";for(const p in t){if(p==="__proto__"||a.has(p))continue;if(l==="never"){s.push(p);continue}const d=u.run({value:t[p],issues:[]},r);d instanceof Promise?e.push(d.then(_=>Y(_,n,p,t,h,m))):Y(d,n,p,t,h,m)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const Sr=c("$ZodObject",(e,t)=>{if(w.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...a};return Object.defineProperty(t,"shape",{value:u}),u}})}const r=ae(()=>Ve(t));g(e._zod,"propValues",()=>{const a=t.shape,u={};for(const l in a){const h=a[l]._zod;if(h.values){u[l]??(u[l]=new Set);for(const m of h.values)u[l].add(m)}}return u});const i=V,o=t.catchall;let s;e._zod.parse=(a,u)=>{s??(s=r.value);const l=a.value;if(!i(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};const h=[],m=s.shape;for(const p of s.keys){const d=m[p],_=d._zod.optin==="optional",K=d._zod.optout==="optional",k=d._zod.run({value:l[p],issues:[]},u);k instanceof Promise?h.push(k.then(ke=>Y(ke,a,p,l,_,K))):Y(k,a,p,l,_,K)}return o?We(h,l,a,u,r.value,e):h.length?Promise.all(h).then(()=>a):a}}),Zr=c("$ZodObjectJIT",(e,t)=>{Sr.init(e,t);const n=e._zod.parse,r=ae(()=>Ve(t)),i=p=>{const d=new Gn(["shape","payload","ctx"]),_=r.value,K=O=>{const y=Ie(O);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};d.write("const input = payload.value;");const k=Object.create(null);let ke=0;for(const O of _.keys)k[O]=`key_${ke++}`;d.write("const newResult = {};");for(const O of _.keys){const y=k[O],S=Ie(O),jt=p[O],Rt=jt?._zod?.optin==="optional",Bo=jt?._zod?.optout==="optional";d.write(`const ${y} = ${K(O)};`),Rt&&Bo?d.write(`\n if (${y}.issues.length) {\n if (${S} in input) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n }\n \n if (${y}.value === undefined) {\n if (${S} in input) {\n newResult[${S}] = undefined;\n }\n } else {\n newResult[${S}] = ${y}.value;\n }\n \n `):Rt?d.write(`\n if (${y}.issues.length) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n \n if (${y}.value === undefined) {\n if (${S} in input) {\n n)DELIM" +R"DELIM(ewResult[${S}] = undefined;\n }\n } else {\n newResult[${S}] = ${y}.value;\n }\n \n `):d.write(`\n const ${y}_present = ${S} in input;\n if (${y}.issues.length) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n if (!${y}_present && !${y}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${S}]\n });\n }\n\n if (${y}_present) {\n if (${y}.value === undefined) {\n newResult[${S}] = undefined;\n } else {\n newResult[${S}] = ${y}.value;\n }\n }\n\n `)}d.write("payload.value = newResult;"),d.write("return payload;");const Wo=d.compile();return(O,y)=>Wo(p,O,y)};let o;const s=V,a=!se.jitless,l=a&&Ft.value,h=t.catchall;let m;e._zod.parse=(p,d)=>{m??(m=r.value);const _=p.value;return s(_)?a&&l&&d?.async===!1&&d.jitless!==!0?(o||(o=i(t.shape)),p=o(p,d),h?We([],_,p,d,m,e):p):n(p,d):(p.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),p)}});function Be(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const i=e.filter(o=>!R(o));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(o=>o.issues.map(s=>M(s,r,A())))}),t)}const Er=c("$ZodUnion",(e,t)=>{w.init(e,t),g(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),g(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),g(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),g(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>ue(i.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 o=!1;const s=[];for(const a of t.options){const u=a._zod.run({value:r.value,issues:[]},i);if(u instanceof Promise)s.push(u),o=!0;else{if(u.issues.length===0)return u;s.push(u)}}return o?Promise.all(s).then(a=>Be(a,r,e,i)):Be(s,r,e,i)}}),Ir=c("$ZodIntersection",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,o=t.left._zod.run({value:i,issues:[]},r),s=t.right._zod.run({value:i,issues:[]},r);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([u,l])=>Ge(n,u,l)):Ge(n,o,s)}});function pe(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(F(e)&&F(t)){const n=Object.keys(t),r=Object.keys(e).filter(o=>n.indexOf(o)!==-1),i={...e,...t};for(const o of r){const s=pe(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.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;ra.l&&a.r).map(([a])=>a);if(o.length&&i&&e.issues.push({...i,keys:o}),R(e))return e;const s=pe(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Or=c("$ZodEnum",(e,t)=>{w.init(e,t);const n=Ze(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(i=>xt.has(typeof i)).map(i=>typeof i=="string"?W(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{const s=i.value;return r.has(s)||i.issues.push({code:"invalid_value",values:n,input:s,inst:e}),i}}),Tr=c("$ZodTransform",(e,t)=>{w.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Se(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(n.value=s,n.fallback=!0,n));if(i instanceof Promise)throw new j;return n.value=i,n.fallback=!0,n}});function qe(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const He=c("$ZodOptional",(e,t)=>{w.init(e,t),e._zod.optin="optional",e._zod.optout="optional",g(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),g(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ue(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const i=n.value,o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>qe(s,i)):qe(o,i)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Nr=c("$ZodExactOptional",(e,t)=>{He.init(e,t),g(e._zod,"values",()=>t.innerType._zod.values),g(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Ar=c("$ZodNullable",(e,t)=>{w.init(e,t),g(e._zod,"optin",()=>t.innerType._zod.optin),g(e._zod,"optout",()=>t.innerType._zod.optout),g(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ue(n.source)}|null)$`):void 0}),g(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Pr=c("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"values",()=>t.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(o=>Ye(o,t)):Ye(i,t)}});function Ye(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Mr=c("$ZodPrefault",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"values",()=>t.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))}),jr=c("$ZodNonOptional",(e,t)=>{w.init(e,t),g(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Xe(o,e)):Xe(i,e)}});function Xe(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Rr=c("$ZodCatch",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"optout",()=>t.innerType._zod.optout),g(e._zod,"values",()=>t.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(n,r);return i instanceof Promise?i.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>M(s,r,A()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(o=>M(o,r,A()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Lr=c("$ZodPipe",(e,t)=>{w.init(e,t),g(e._zod,"values",()=>t.in._zod.values),g(e._zod,"optin",()=>t.in._zod.optin),g(e._zod,"optout",()=>t.out._zod.optout),g(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const o=t.out._zod.run(n,r);return o instanceof Promise?o.then(s=>X(s,t.in,r)):X(o,t.in,r)}const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(o=>X(o,t.out,r)):X(i,t.out,r)}});function X(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.va)DELIM" +R"DELIM(lue,issues:e.issues,fallback:e.fallback},n)}const Cr=c("$ZodReadonly",(e,t)=>{w.init(e,t),g(e._zod,"propValues",()=>t.innerType._zod.propValues),g(e._zod,"values",()=>t.innerType._zod.values),g(e._zod,"optin",()=>t.innerType?._zod?.optin),g(e._zod,"optout",()=>t.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(Qe):Qe(i)}});function Qe(e){return e.value=Object.freeze(e.value),e}const Fr=c("$ZodCustom",(e,t)=>{E.init(e,t),w.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(o=>et(o,n,r,e));et(i,n,r,e)}});function et(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(x(i))}}var tt;class xr{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 Dr(){return new xr}(tt=globalThis).__zod_globalRegistry??(tt.__zod_globalRegistry=Dr());const D=globalThis.__zod_globalRegistry;function Ur(e,t){return new e({type:"string",...f(t)})}function Jr(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...f(t)})}function nt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...f(t)})}function Kr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...f(t)})}function Vr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f(t)})}function Wr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f(t)})}function Br(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f(t)})}function Gr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...f(t)})}function qr(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...f(t)})}function Hr(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...f(t)})}function Yr(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...f(t)})}function Xr(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...f(t)})}function Qr(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...f(t)})}function ei(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...f(t)})}function ti(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...f(t)})}function ni(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...f(t)})}function ri(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...f(t)})}function ii(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f(t)})}function si(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f(t)})}function oi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...f(t)})}function ai(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...f(t)})}function ci(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...f(t)})}function ui(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...f(t)})}function li(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(t)})}function hi(e,t){return new e({type:"string",format:"date",check:"string_format",...f(t)})}function fi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...f(t)})}function di(e,t){return new e({type:"string",format:"duration",check:"string_format",...f(t)})}function pi(e,t){return new e({type:"number",checks:[],...f(t)})}function mi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...f(t)})}function gi(e){return new e({type:"unknown"})}function _i(e,t){return new e({type:"never",...f(t)})}function rt(e,t){return new xe({check:"less_than",...f(t),value:e,inclusive:!1})}function me(e,t){return new xe({check:"less_than",...f(t),value:e,inclusive:!0})}function it(e,t){return new De({check:"greater_than",...f(t),value:e,inclusive:!1})}function ge(e,t){return new De({check:"greater_than",...f(t),value:e,inclusive:!0})}function st(e,t){return new Rn({check:"multiple_of",...f(t),value:e})}function ot(e,t){return new Cn({check:"max_length",...f(t),maximum:e})}function Q(e,t){return new Fn({check:"min_length",...f(t),minimum:e})}function at(e,t){return new xn({check:"length_equals",...f(t),length:e})}function vi(e,t){return new Dn({check:"string_format",format:"regex",...f(t),pattern:e})}function bi(e){return new Un({check:"string_format",format:"lowercase",...f(e)})}function yi(e){return new Jn({check:"string_format",format:"uppercase",...f(e)})}function wi(e,t){return new Kn({check:"string_format",format:"includes",...f(t),includes:e})}function zi(e,t){return new Vn({check:"string_format",format:"starts_with",...f(t),prefix:e})}function ki(e,t){return new Wn({check:"string_format",format:"ends_with",...f(t),suffix:e})}function L(e){return new Bn({check:"overwrite",tx:e})}function $i(e){return L(t=>t.normalize(e))}function Si(){return L(e=>e.trim())}function Zi(){return L(e=>e.toLowerCase())}function Ei(){return L(e=>e.toUpperCase())}function Ii(){return L(e=>Ct(e))}function Oi(e,t,n){return new e({type:"array",element:t,...f(n)})}function Ti(e,t,n){return new e({type:"custom",check:"custom",fn:t,...f(n)})}function Ni(e,t){const n=Ai(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(x(i,r.value,n._zod.def));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),r.issues.push(x(o))}},e(r.value,r)),t);return n}function Ai(e,t){const n=new E({check:"custom",...f(t)});return n._zod.check=e,n}function ct(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??D,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function $(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const h={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,h);else{const p=s.schema,d=t.processors[i.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);d(e,t,p,h)}const m=e._zod.parent;m&&(s.ref||(s.ref=m),$(m,t,h),t.seen.get(m).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&Z(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ut(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const s of e.seen.entries()){const a=e.metadataR)DELIM" +R"DELIM(egistry.get(s[0])?.id;if(a){const u=r.get(a);if(u&&u!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}const i=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const m=e.external.registry.get(s[0])?.id,p=e.external.uri??(_=>_);if(m)return{ref:p(m)};const d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${p("__shared")}#/${a}/${d}`}}if(s[1]===n)return{ref:"#"};const l=`#/${a}/`,h=s[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:l+h}},o=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:u,defId:l}=i(s);a.def={...a.schema},l&&(a.defId=l);const h=a.schema;for(const m in h)delete h[m];h.$ref=u};if(e.cycles==="throw")for(const s of e.seen.entries()){const a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/\n\nSet the \\`cycles\\` parameter to \\`"ref"\\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){o(s);continue}if(e.external){const l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}}function lt(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const u=e.seen.get(a);if(u.ref===null)return;const l=u.def??u.schema,h={...l},m=u.ref;if(u.ref=null,m){r(m);const d=e.seen.get(m),_=d.schema;if(_.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(_)):Object.assign(l,_),Object.assign(l,h),a._zod.parent===m)for(const k in l)k==="$ref"||k==="allOf"||k in h||delete l[k];if(_.$ref&&d.def)for(const k in l)k==="$ref"||k==="allOf"||k in d.def&&JSON.stringify(l[k])===JSON.stringify(d.def[k])&&delete l[k]}const p=a._zod.parent;if(p&&p!==m){r(p);const d=e.seen.get(p);if(d?.schema.$ref&&(l.$ref=d.schema.$ref,d.def))for(const _ in l)_==="$ref"||_==="allOf"||_ in d.def&&JSON.stringify(l[_])===JSON.stringify(d.def[_])&&delete l[_]}e.override({zodSchema:a,jsonSchema:l,path:u.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);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 a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;o!==void 0&&i.id===o&&delete i.id;const s=e.external?.defs??{};for(const a of e.seen.entries()){const u=a[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,s[u.defId]=u.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:ee(t,"input",e.processors),output:ee(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Z(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 Z(r.element,n);if(r.type==="set")return Z(r.valueType,n);if(r.type==="lazy")return Z(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")return Z(r.innerType,n);if(r.type==="intersection")return Z(r.left,n)||Z(r.right,n);if(r.type==="record"||r.type==="map")return Z(r.keyType,n)||Z(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Z(r.in,n)||Z(r.out,n);if(r.type==="object"){for(const i in r.shape)if(Z(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Z(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Z(i,n))return!0;return!!(r.rest&&Z(r.rest,n))}return!1}const Pi=(e,t={})=>n=>{const r=ct({...n,processors:t});return $(e,r),ut(r,e),lt(r,e)},ee=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=ct({...i??{},target:o,io:t,processors:n});return $(e,s),ut(s,e),lt(s,e)},Mi={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ji=(e,t,n,r)=>{const i=n;i.type="string";const{minimum:o,maximum:s,format:a,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=Mi[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),l&&(i.contentEncoding=l),u&&u.size>0){const h=[...u];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Ri=(e,t,n,r)=>{const i=n,{minimum:o,maximum:s,format:a,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:h}=e._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";const m=typeof h=="number"&&h>=(o??Number.NEGATIVE_INFINITY),p=typeof l=="number"&&l<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";m?d?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h:typeof o=="number"&&(i.minimum=o),p?d?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof s=="number"&&(i.maximum=s),typeof u=="number"&&(i.multipleOf=u)},Li=(e,t,n,r)=>{n.not={}},Ci=(e,t,n,r)=>{},Fi=(e,t,n,r)=>{const i=e._zod.def,o=Ze(i.entries);o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),n.enum=o},xi=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Di=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ui=(e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=$(o.element,t,{...r,path:[...r.path,"items"]})},Ji=(e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const l in s)i.properties[l]=$(s[l],t,{...r,path:[...r.path,"properties",l]});const a=new Set(Object.keys(s)),u=new Set([...a].filter(l=>{const h=o.shape[l]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));u.size>0&&(i.required=Array.from(u)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=$(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Ki=(e,t,n,r)=>{const i=e._zod.def,o=i.inclusive===!1,s=i.options.map((a,u)=>$(a,t,{...r,path:[...r.path,o?"oneOf":"anyOf",u]}));o?n.oneOf=s:n.anyOf=s},Vi=(e,t,n,r)=>{const i=e._zod.def,o=$(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=$(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,u=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=u},Wi=(e,t,n,r)=>{const i=e._zod.def,o=$(i.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Bi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType},Gi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},qi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Hi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},Yi=(e,t)DELIM" +R"DELIM(,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?i.out:i.in:i.out;$(s,t,r);const a=t.seen.get(e);a.ref=s},Xi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,n.readOnly=!0},ht=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType},Qi=c("ZodISODateTime",(e,t)=>{ar.init(e,t),b.init(e,t)});function es(e){return li(Qi,e)}const ts=c("ZodISODate",(e,t)=>{cr.init(e,t),b.init(e,t)});function ns(e){return hi(ts,e)}const rs=c("ZodISOTime",(e,t)=>{ur.init(e,t),b.init(e,t)});function is(e){return fi(rs,e)}const ss=c("ZodISODuration",(e,t)=>{lr.init(e,t),b.init(e,t)});function os(e){return di(ss,e)}const I=c("ZodError",(e,t)=>{Pe.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Xt(e,n)},flatten:{value:n=>Yt(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,oe,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,oe,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),as=he(I),cs=fe(I),us=G(I),ls=q(I),hs=tn(I),fs=nn(I),ds=rn(I),ps=sn(I),ms=on(I),gs=an(I),_s=cn(I),vs=un(I),ft=new WeakMap;function U(e,t,n){const r=Object.getPrototypeOf(e);let i=ft.get(r);if(i||(i=new Set,ft.set(r,i)),!i.has(t)){i.add(t);for(const o in n){const s=n[o];Object.defineProperty(r,o,{configurable:!0,enumerable:!1,get(){const a=s.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const z=c("ZodType",(e,t)=>(w.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ee(e,"input"),output:ee(e,"output")}}),e.toJSONSchema=Pi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>as(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>us(e,n,r),e.parseAsync=async(n,r)=>cs(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>ls(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>hs(e,n,r),e.decode=(n,r)=>fs(e,n,r),e.encodeAsync=async(n,r)=>ds(e,n,r),e.decodeAsync=async(n,r)=>ps(e,n,r),e.safeEncode=(n,r)=>ms(e,n,r),e.safeDecode=(n,r)=>gs(e,n,r),e.safeEncodeAsync=async(n,r)=>_s(e,n,r),e.safeDecodeAsync=async(n,r)=>vs(e,n,r),U(e,"ZodType",{check(...n){const r=this.def;return this.clone(T(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return N(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(ho(n,r))},superRefine(n,r){return this.check(fo(n,r))},overwrite(n){return this.check(L(n))},optional(){return yt(this)},exactOptional(){return Xs(this)},nullable(){return wt(this)},nullish(){return yt(wt(this))},nonoptional(n){return io(this,n)},array(){return Js(this)},or(n){return vt([this,n])},and(n){return Bs(this,n)},transform(n){return kt(this,Hs(n))},default(n){return to(this,n)},prefault(n){return ro(this,n)},catch(n){return oo(this,n)},pipe(n){return kt(this,n)},readonly(){return uo(this)},describe(n){const r=this.clone();return D.add(r,{description:n}),r},meta(...n){if(n.length===0)return D.get(this);const r=this.clone();return D.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return D.get(e)?.description},configurable:!0}),e)),dt=c("_ZodString",(e,t)=>{de.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>ji(e,r,i);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,U(e,"_ZodString",{regex(...r){return this.check(vi(...r))},includes(...r){return this.check(wi(...r))},startsWith(...r){return this.check(zi(...r))},endsWith(...r){return this.check(ki(...r))},min(...r){return this.check(Q(...r))},max(...r){return this.check(ot(...r))},length(...r){return this.check(at(...r))},nonempty(...r){return this.check(Q(1,...r))},lowercase(r){return this.check(bi(r))},uppercase(r){return this.check(yi(r))},trim(){return this.check(Si())},normalize(...r){return this.check($i(...r))},toLowerCase(){return this.check(Zi())},toUpperCase(){return this.check(Ei())},slugify(){return this.check(Ii())}})}),bs=c("ZodString",(e,t)=>{de.init(e,t),dt.init(e,t),e.email=n=>e.check(Jr(ws,n)),e.url=n=>e.check(Gr(zs,n)),e.jwt=n=>e.check(ui(Ls,n)),e.emoji=n=>e.check(qr(ks,n)),e.guid=n=>e.check(nt(pt,n)),e.uuid=n=>e.check(Kr(te,n)),e.uuidv4=n=>e.check(Vr(te,n)),e.uuidv6=n=>e.check(Wr(te,n)),e.uuidv7=n=>e.check(Br(te,n)),e.nanoid=n=>e.check(Hr($s,n)),e.guid=n=>e.check(nt(pt,n)),e.cuid=n=>e.check(Yr(Ss,n)),e.cuid2=n=>e.check(Xr(Zs,n)),e.ulid=n=>e.check(Qr(Es,n)),e.base64=n=>e.check(oi(Ms,n)),e.base64url=n=>e.check(ai(js,n)),e.xid=n=>e.check(ei(Is,n)),e.ksuid=n=>e.check(ti(Os,n)),e.ipv4=n=>e.check(ni(Ts,n)),e.ipv6=n=>e.check(ri(Ns,n)),e.cidrv4=n=>e.check(ii(As,n)),e.cidrv6=n=>e.check(si(Ps,n)),e.e164=n=>e.check(ci(Rs,n)),e.datetime=n=>e.check(es(n)),e.date=n=>e.check(ns(n)),e.time=n=>e.check(is(n)),e.duration=n=>e.check(os(n))});function ys(e){return Ur(bs,e)}const b=c("ZodStringFormat",(e,t)=>{v.init(e,t),dt.init(e,t)}),ws=c("ZodEmail",(e,t)=>{Xn.init(e,t),b.init(e,t)}),pt=c("ZodGUID",(e,t)=>{Hn.init(e,t),b.init(e,t)}),te=c("ZodUUID",(e,t)=>{Yn.init(e,t),b.init(e,t)}),zs=c("ZodURL",(e,t)=>{Qn.init(e,t),b.init(e,t)}),ks=c("ZodEmoji",(e,t)=>{er.init(e,t),b.init(e,t)}),$s=c("ZodNanoID",(e,t)=>{tr.init(e,t),b.init(e,t)}),Ss=c("ZodCUID",(e,t)=>{nr.init(e,t),b.init(e,t)}),Zs=c("ZodCUID2",(e,t)=>{rr.init(e,t),b.init(e,t)}),Es=c("ZodULID",(e,t)=>{ir.init(e,t),b.init(e,t)}),Is=c("ZodXID",(e,t)=>{sr.init(e,t),b.init(e,t)}),Os=c("ZodKSUID",(e,t)=>{or.init(e,t),b.init(e,t)}),Ts=c("ZodIPv4",(e,t)=>{hr.init(e,t),b.init(e,t)}),Ns=c("ZodIPv6",(e,t)=>{fr.init(e,t),b.init(e,t)}),As=c("ZodCIDRv4",(e,t)=>{dr.init(e,t),b.init(e,t)}),Ps=c("ZodCIDRv6",(e,t)=>{pr.init(e,t),b.init(e,t)}),Ms=c("ZodBase64",(e,t)=>{mr.init(e,t),b.init(e,t)}),js=c("ZodBase64URL",(e,t)=>{_r.init(e,t),b.init(e,t)}),Rs=c("ZodE164",(e,t)=>{vr.init(e,t),b.init(e,t)}),Ls=c("ZodJWT",(e,t)=>{yr.init(e,t),b.init(e,t)}),mt=c("ZodNumber",(e,t)=>{Je.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>Ri(e,r,i),U(e,"ZodNumber",{gt(r,i){return this.check(it(r,i))},gte(r,i){return this.check(ge(r,i))},min(r,i){return this.check(ge(r,i))},lt(r,i){return this.check(rt(r,i))},lte(r,i){return this.check(me(r,i))},max(r,i){return this.check(me(r,i))},int(r){return this.check(gt(r))},safe(r){return this.check(gt(r))},positive(r){return this.check(it(0,r))},nonnegative(r){return this.check(ge(0,r))},negative(r){return this.check(rt(0,r))},nonpositive(r){return this.check(me(0,r))},multipleOf(r,i){return this.check(st(r,i))},step(r,i){return this.check(st(r,i))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function C(e){return pi(mt,e)}const Cs=c("ZodNumberFormat",(e,t)=>{wr.init(e,t),mt.init(e,t)});function gt(e){return mi(Cs,e)}const Fs=c("ZodUnknown",(e,t)=>{zr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ci()});function _t(){return gi(Fs)}const xs=c("ZodNever",(e,t)=>{kr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Li(e,n,r)});function Ds(e){return _i(xs,e)}const Us=c("ZodArray",(e,t)=>{$r.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ui(e,n,r,i),e.element=t.element,U(e,"ZodArray",{min(n,r){return this.check(Q(n,r))},nonempty(n){return this.check(Q(1,n))},max(n,r){return this.check(ot(n,r))},length(n,r){return this.check(at(n,r))},unwrap(){return this.element}})});function Js(e,t){return Oi(Us,e,t)}const)DELIM" +R"DELIM( Ks=c("ZodObject",(e,t)=>{Zr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ji(e,n,r,i),g(e,"shape",()=>t.shape),U(e,"ZodObject",{keyof(){return Gs(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:_t()})},loose(){return this.clone({...this._zod.def,catchall:_t()})},strict(){return this.clone({...this._zod.def,catchall:Ds()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Vt(this,n)},safeExtend(n){return Wt(this,n)},merge(n){return Bt(this,n)},pick(n){return Jt(this,n)},omit(n){return Kt(this,n)},partial(...n){return Gt(bt,this,n[0])},required(...n){return qt(zt,this,n[0])}})});function _e(e,t){const n={type:"object",shape:e??{},...f(t)};return new Ks(n)}const Vs=c("ZodUnion",(e,t)=>{Er.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ki(e,n,r,i),e.options=t.options});function vt(e,t){return new Vs({type:"union",options:e,...f(t)})}const Ws=c("ZodIntersection",(e,t)=>{Ir.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Vi(e,n,r,i)});function Bs(e,t){return new Ws({type:"intersection",left:e,right:t})}const ve=c("ZodEnum",(e,t)=>{Or.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>Fi(e,r,i),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const o={};for(const s of r)if(n.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new ve({...t,checks:[],...f(i),entries:o})},e.exclude=(r,i)=>{const o={...t.entries};for(const s of r)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new ve({...t,checks:[],...f(i),entries:o})}});function Gs(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ve({type:"enum",entries:n,...f(t)})}const qs=c("ZodTransform",(e,t)=>{Tr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Di(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Se(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(x(o,n.value,t));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(x(s))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(o=>(n.value=o,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Hs(e){return new qs({type:"transform",transform:e})}const bt=c("ZodOptional",(e,t)=>{He.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ht(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function yt(e){return new bt({type:"optional",innerType:e})}const Ys=c("ZodExactOptional",(e,t)=>{Nr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ht(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Xs(e){return new Ys({type:"optional",innerType:e})}const Qs=c("ZodNullable",(e,t)=>{Ar.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Wi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function wt(e){return new Qs({type:"nullable",innerType:e})}const eo=c("ZodDefault",(e,t)=>{Pr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Gi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function to(e,t){return new eo({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Te(t)}})}const no=c("ZodPrefault",(e,t)=>{Mr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>qi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function ro(e,t){return new no({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Te(t)}})}const zt=c("ZodNonOptional",(e,t)=>{jr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Bi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function io(e,t){return new zt({type:"nonoptional",innerType:e,...f(t)})}const so=c("ZodCatch",(e,t)=>{Rr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Hi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function oo(e,t){return new so({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const ao=c("ZodPipe",(e,t)=>{Lr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Yi(e,n,r,i),e.in=t.in,e.out=t.out});function kt(e,t){return new ao({type:"pipe",in:e,out:t})}const co=c("ZodReadonly",(e,t)=>{Cr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Xi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function uo(e){return new co({type:"readonly",innerType:e})}const lo=c("ZodCustom",(e,t)=>{Fr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>xi(e,n)});function ho(e,t={}){return Ti(lo,e,t)}function fo(e,t){return Ni(e,t)}const ne=[{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"}],be=[{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:"count"},{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:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],$t=_e({level:C().int().nonnegative(),time:C().int().nonnegative(),message:ys()}),St=_e({event:C().int().nonnegative(),value:C().nonnegative(),time:C().int().nonnegative()}),Zt=_e({previous:C().nonnegative()});vt([$t,St,Zt]);const po=2**ne.length-1,Et=2**be.length-1;function It(e,t){return Number.isInteger(t)&&t>=0&&tnew WebSocket(n))},this.#c=this.#e.retryMinimumMs}getStatus=()=>this.#t;subscribeStatus=t=>(this.#r.add(t),()=>{this.#r.delete(t)});start(){this.#o||(this.#o=!0,this.#c=this.#e.retryMinimumMs,this.#h())}stop(){this.#o=!1,this.#g();const t=this.#n;if(this.#n=null,t)try{t.readyState===1&&this.#e.onBeforeStop?.(t),t.close()}catch{}this.#u(Tt)}send(t){if(this.#n?.readyState!==1)return!1;try{return this.#n.send(t),!0}catch{return!1}}#h(){if(!this.#o||this.#n)return;const t=this.#t.reconnects>0;this.#u({...this.#t,phase:t?"reconnecting":"connecting",attempt:this.#t.attempt+1,error:null});let n;try{n=this.#e.webSocketFactory(this.#e.url),this.#n=n}catch(r){this.#u({...this.#t,error:$o(r)}),this.#d();return}this.#s=setTimeout(()=>{if(this.#n===n){this.#u({...this.#t,error:"Connection timed out"});try{n.close()}catch{this.#n=null,this.#d()}}},this.#e.connectTimeoutMs),n.addEventListener("open",()=>{this.#n!==n||!this.#o||(this.#p(),this.#c=this.#e.retryMinimumMs,this.#u({...this.#t,phase:"connected",connectedAt:this.#e.now(),error:null}),this.#e.onOpen?.(n),this.#m(n))}),n.addEventListener("message",r=>{if(this.#n!==n||!this.#o)return;const i=ko(r.data);if(i===null)return;const o=this.#e.now();(this.#t.lastMessageAt===null||o-this.#t.lastMessageAt>=1e3)&&this.#u({...this.#t,lastMessageAt:o}),this.#e.onMessage(i)}),n.addEventListener("error",()=>{if(!(this.#n!==n||!this.#o)){this.#u({...this.#t,error:"WebSocket connection failed"});try{n.close()}catch{this.#n=null,this.#d()}}}),n.addEventListener("close",()=>{this.#n===n&&(this.#n=null,this.#p(),this.#l(),this.#o&&this.#d())})}#d(){if(!this.#o||this.#i)return;const t=1+(this.#e.random()*2-1)*this.#e.jitterRatio,n=Math.max(0,Math.round(this.#c*t));this.#c=Math.min(this.#c*2,this.#e.retryMaximumMs),this.#u({...this.#t,phase:"reconnecting",reconnects:this.#t.reconnects+1,connectedAt:null}),this.#i=setTimeout(()=>{this.#i=null,this.#h()},n)}#m(t){this.#l(),!(!this.#e.onHeartbeat||this.#e.heartbeatMs<=0)&&(this.#a=setInterval(()=>{this.#n===t&&t.readyState===1&&this.#e.onHeartbeat?.(t)},this.#e.heartbeatMs))}#p(){this.#s&&(clearTimeout(this.#s),this.#s=null)}#l(){this.#a&&(clearInterval(this.#a),this.#a=null)}#g(){this.#p(),this.#l(),this.#i&&(clearTimeout(this.#i),this.#i=null)}#u(t){this.#t=t;for(const n of this.#r)n()}}function ko(e){return typeof e=="string"?e:e instanceof ArrayBuffer?new TextDecoder().decode(e):null}function $o(e){return e instanceof Error?e.message:"Unable to create WebSocket"}class So{#e;#t;#n=new Set;#r=new Set;#s;constructor(t,n={}){this.#e=n.logFilter??po,this.#t=n.eventFilter??Et,this.#s=new zo({url:wo(t),webSocketFactory:n.webSocketFactory,retryMinimumMs:n.retryMinimumMs,retryMaximumMs:n.retryMaximumMs,jitterRatio:n.jitterRatio,onOpen:r=>{this.#i(r)},onHeartbeat:r=>{this.#i(r)},onBeforeStop:r=>{r.send("/v1/log/subscribe?filter=0"),r.send("/v1/event/subscribe?filter=0")},onMessage:r=>{const i=_o(r);if(!i){for(const o of this.#r)o(r);return}if(!(Ot(i)&&!It(this.#e,i.level)))for(const o of this.#n)o(i)}})}getStatus=()=>this.#s.getStatus();subscribeStatus=t=>this.#s.subscribeStatus(t);start(){this.#s.start()}stop(){this.#s.stop()}subscribeFrames(t){return this.#n.add(t),()=>{this.#n.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.#t!==n&&(this.#t=n,this.#s.send(`/v1/event/subscribe?filter=${String(n)}`))}#i(t){t.send(`/v1/log/subscribe?filter=${String(this.#e)}`),t.send(`/v1/event/subscribe?filter=${String(this.#t)}`)}}const J=["occurrence-rate","occurrence-count","cumulative-occurrences"],Zo=["payload-latest","payload-maximum","payload-change-rate",...J],Eo=["payload-average","payload-latest","payload-minimum","payload-maximum",...J],Io=["payload-sum","payload-cumulative","payload-latest","payload-average",...J];function Nt(e){return`event:${String(e)}`}function At(e){return`log:${String(e)}`}const we="native:top";function Oo(e){switch(e){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";default:return"unknown"}}function To(e){switch(e){case"height":return Zo;case"duration":return Eo;case"count":return Io;default:return J}}function No(e){switch(e){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function Ao(e){const t=ye(e),n=Oo(t.valueKind);return{id:Nt(e),source:"event",sourceId:e,name:t.name,label:t.label,category:t.category,payloadKind:n,allowedMeasures:To(n),defaultMeasure:No(n),description:n==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${t.label} event with a ${n} payload.`}}const Po=[...be.map(e=>Ao(e.id)),...ne.map(e=>({id:At(e.id),source:"log",sourceId:e.id,name:e.name,label:`${e.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:J,defaultMeasure:"occurrence-rate",description:`${e.label} log message volume. Message text is not interpreted as numeric data.`})),{id:we,source:"native",sourceId:"top",name:"canonical_top",label:"Canonical 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(Po.map(e=>[e.id,e]));function Mo(e,t){return bo(e,t)??t}const jo=3600*1e3,Ro=1e3,Lo=1e3,Co=1e3;class Pt{constructor(t){this.capacity=t,this.#e=Array.from({length:t})}capacity;#e;#t=0;#n=0;#r=null;get size(){return this.#n}push(t){const n=this.#n===this.capacity;return this.#r=null,this.#e[this.#t]=t,this.#t=(this.#t+1)%this.capacity,this.#n=Math.min(this.#n+1,this.capacity),n}clear(){this.#r=null,this.#e.fill(void 0),this.#t=0,this.#n=0}newestFirst(){if(this.#r)return this.#r;const t=[];for(let n=0;nthis.#T;getRecentLogs=()=>this.#r.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=t=>(this.#n.add(t),()=>{this.#n.delete(t)});start(){this.#v||(this.tick(),this.#v=setInterval(()=>{this.tick()},1e3))}stop(){this.#v&&(clearInterval(this.#v),this.#v=null),this.#f&&(clearTimeout(this.#f),this.#f=null)}ingest(t,n=this.#e()){const r=this.#b(n);this.#u+=1,Ot(t)?this.#M(t,r):mo(t)?this.#j(t,r):go(t)&&(this.#Z+=1),this.#w()}recordInvalidFrame(){this.#E+=1,this.#w()}recordNativeTop(t,n=this.#e()){const r=this.#b(n),i=this.#m[we];i?.value===t&&r-i.time<15e3||(this.#N(we,r,t),this.#A(r),this.#w())}clearLogs(){this.#$+=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.#a={},this.#c={},this.#o={},this.#h={},this.#d={},this.#m={},this.#p={},this.#l=this.#b(this.#e()),this.#u=0,this.#z=0,this.#k=0,this.#$=0,this.#S=0,this.#Z=0,this.#E=0,this.#I=null,this.#O=null,this.#_=0,this.#y(this.#l),this.flush()}tick(){const t=this.#b(this.#e());this.#y(t),this.#A(t),this.#w()}flush(){this.#f&&(clearTimeout(this.#f),this.#f=null),this.#T=this.#P();for(const t of this.#n)t()}#M(t,n){this.#z+=1,this.#I=n,this.#_+=1,this.#r.push({...t,id:this.#_,receivedAt:n})&&(this.#k+=1),this.#N(At(t.level),n,null)}#j(t,n){this.#S+=1,this.#O=n,this.#_+=1,this.#s.push({...t,id:this.#_,receivedAt:n}),this.#N(Nt(t.event),n,Mo(t.event,t.value))}#b(t){return Number.isFinite(t)?(this.#g=Math.max(this.#g,t),this.#g):this.#g}#N(t,n,r){const i=this.#y(n);i.snapshot=null;const o=i.signals.get(t)??Fo();if(o.count+=1,re(this.#h,t,1),r!==null){o.samples+=1,o.sum+=r,o.minimum=o.minimum===null?r:Math.min(o.minimum,r),o.maximum=o.maximum===null?r:Math.max(o.maximum,r),(o.firstAt===null||n=o.lastAt)&&(o.last=r,o.lastAt=n),re(this.#d,t,r);const s=this.#m[t];(!s||n>=s.time)&&(this.#m[t]={value:r,time:n}),this.#p[t]=Math.max(this.#p[t]??r,r)}i.signals.set(t,o)}#y(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};return this.#i.set(n,i),i}#A(t){const n=t-jo;for(const[r,i]of this.#i){if(r>=n)break;for(const[o,s]of i.signals)if(re(this.#a,o,s.count),re(this.#c,o,s.sum),s.last!==null&&s.lastAt!==null){const a=this.#o[o];(!a||s.lastAt>=a.time)&&(this.#o[o]={value:s.last,time:s.lastAt})}this.#i.delete(r)}}#w(){!this.#t||this.#f||(this.#f=setTimeout(()=>{this.#f=null,this.flush()},Ro))}#P(){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.#b(this.#e()),sessionStartedAt:this.#l,totalFrames:this.#u,totalLogs:this.#z,evictedLogs:this.#k,clearedLogs:this.#$,totalEvents:this.#S,totalAcks:this.#Z,invalidFrames:this.#E,buckets:t,priorSignalCounts:{...this.#a},priorSignalSums:{...this.#c},priorSignalLatest:Mt(this.#o),signalTotals:{...this.#h},signalSums:{...this.#d},signalLatest:Mt(this.#m),signalMaximums:{...this.#p},recentLogs:this.#r.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#I,lastEventAt:this.#O}}}const ie=40;function Do(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(s=>It(t.filter,s.level)&&(!n||s.message.toLowerCase().includes(n)||vo(s.level).name.includes(n))),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,o=Math.min(i,Math.max(0,r.length-ie));return{logs:r.slice(o,o+ie),retained:e.length,matched:r.length,offset:o}}function Uo(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(s=>{const a=ye(s.event);return(t.category==="all"||a.category===t.category)&&(!n||a.name.includes(n)||a.label.toLowerCase().includes(n)||String(s.value).includes(n))}),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,o=Math.min(i,Math.max(0,r.length-ie));return{events:r.slice(o,o+ie),retained:e.length,matched:r.length,offset:o}}function Jo(e,t){const{buckets:n,recentLogs:r,recentEvents:i,...o}=e,s=new Map(t?.buckets.map(a=>[a.time,a]));return{summary:o,reset:t===null,firstBucketTime:n[0]?.time??e.now,buckets:n.filter(a=>s.get(a.time)!==a),recentLogs:r===t?.recentLogs?null:r,recentEvents:i===t?.recentEvents?null:i}}class Ko{constructor(t,n=(i,o)=>new So(i,{logFilter:o}),r=Date.now){this.send=t,this.createClient=n,this.#e=new xo(r,!1)}send;createClient;#e;#t=null;#n=null;#r=0;#s=null;#i=null;#a=null;#c=[];handle(t){if(t.type==="stop"){this.#h(),this.#e.stop(),this.send({type:"stopped"});return}if(t.type==="configure"){if(t.generation{this.#e.ingest(n)}),this.#t.subscribeInvalidFrames(()=>{this.#e.recordInvalidFrame()})],this.#t.start(),this.#e.start()):this.#t.setFilters(t.logFilter,Et);return}if(t.type==="reset"){t.generation>=this.#r&&this.#o(t.generation);return}if(t.generation===this.#r)switch(t.type){case"pause-display":{t.stream==="logs"?this.#i=t.paused?this.#i??this.#e.getRecentLogs():null:this.#a=t.paused?this.#a??this.#e.getRecentEvents():null;break}case"poll-events":{this.send({type:"events",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Uo(this.#a??this.#e.getRecentEvents(),t.query)});break}case"poll-logs":{this.send({type:"logs",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Do(this.#i??this.#e.getRecentLogs(),t.query)});break}case"native-top":{this.#e.recordNativeTop(t.height,t.receivedAt);break}case"clear-logs":{this.#e.clearLogs(),this.#i!==null&&(this.#i=[]);break}case"clear-events":{this.#e.clearEvents(),this.#a!==null&&(this.#a=[]);break}case"poll":{if(!this.#t)return;this.#e.flush();const n=this.#e.getSnapshot();this.send({type:"snapshot",generation:this.#r,requestId:t.requestId,status:this.#t.getStatus(),update:Jo(n,this.#s)}),this.#s=n;break}}}#o(t){this.#r=t,this.#s=null,this.#i!==null&&(this.#i=[]),this.#a!==null&&(this.#a=[]),this.#e.reset()}#h(){for(const t of this.#c)t();this.#c=[],this.#t?.stop(),this.#t=null}}const ze=globalThis,Vo=new Ko(e=>{ze.postMessage(e)});ze.addEventListener("message",e=>{Vo.handle(e.data),e.data.type==="stop"&&ze.close()})})();\n',Wy=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Qb],{type:"text/javascript;charset=utf-8"});function fN(n){let i;try{if(i=Wy&&(self.URL||self.webkitURL).createObjectURL(Wy),!i)throw"";const l=new Worker(i,{name:n?.name});return l.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(i)}),l}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Qb),{name:n?.name})}}const e0=100;function dN(n,i){const l=new Map((i.reset?[]:n.buckets).filter(r=>r.time>=i.firstBucketTime).map(r=>[r.time,r]));for(const r of i.buckets)l.set(r.time,r);return{...i.summary,buckets:[...l.values()],recentLogs:Cc(i.reset?[]:n.recentLogs,i.recentLogs),recentEvents:Cc(i.reset?[]:n.recentEvents,i.recentEvents)}}function Cc(n,i){if(i===null)return n;const l=new Map(n.map(r=>[r.id,r]));return i.map(r=>l.get(r.id)??r)}const To={phase:"idle",attempt:0,reconnects:0,connectedAt:null,lastMessageAt:null,error:null};class hN{constructor(i=()=>new fN){this.createWorker=i}createWorker;#e=null;#t=new oy().getSnapshot();#n=To;#i=new Set;#s=new Set;#a=null;#r=ur;#l=0;#u=0;#o=null;#m=null;#c=null;#d=new Set;#h={logs:[],retained:0,matched:0,offset:0};#p={search:"",filter:ur,offset:0};#f=0;#y=null;#x=null;#g=new Set;#w={events:[],retained:0,matched:0,offset:0};#E={search:"",category:"all",offset:0};#z=0;#b=null;#T=!1;#A=!1;getSnapshot=()=>this.#t;getStatus=()=>this.#n;getLogWindow=()=>this.#h;getEvent)DELIM" +R"DELIM(Window=()=>this.#w;subscribeEvents=i=>(this.#g.add(i),this.#S(),this.#_(),()=>{this.#g.delete(i),this.#g.size===0&&this.#M()});subscribeLogs=i=>(this.#d.add(i),this.#N(),this.#D(),()=>{this.#d.delete(i),this.#d.size===0&&this.#O()});subscribe=i=>(this.#i.add(i),()=>{this.#i.delete(i)});subscribeStatus=i=>(this.#s.add(i),()=>{this.#s.delete(i)});configure(i,l){i===this.#a&&l===this.#r||(this.#a!==null&&i!==this.#a&&(this.reset(),this.#U({...To,phase:"connecting"})),this.#a=i,this.#r=l,this.#C())}start(){if(!(this.#e||this.#a===null))try{const i=this.createWorker();this.#e=i,this.#h={logs:[],retained:0,matched:0,offset:0},this.#w={events:[],retained:0,matched:0,offset:0};for(const l of this.#d)l();for(const l of this.#g)l();this.#U({...To,phase:"connecting"}),i.onmessage=l=>{if(this.#e!==i)return;const r=l.data;if(r.type==="events"){if(r.requestId!==this.#b||(this.#b=null,r.generation!==this.#l))return;if(r.queryVersion!==this.#z){this.#S();return}this.#w={...r.window,events:Cc(this.#w.events,r.window.events)};for(const u of this.#g)u();return}if(r.type==="logs"){if(r.requestId!==this.#y||(this.#y=null,r.generation!==this.#l))return;if(r.queryVersion!==this.#f){this.#N();return}this.#h={...r.window,logs:Cc(this.#h.logs,r.window.logs)};for(const u of this.#d)u();return}if(r.type==="snapshot"&&r.requestId===this.#o&&(this.#o=null,r.generation===this.#l)){this.#t=dN(this.#t,r.update),this.#U(r.status);for(const u of this.#i)u()}},i.onerror=()=>{this.#R("Telemetry worker failed. Reload the dashboard to reconnect.")},i.onmessageerror=()=>{this.#R("Unable to read telemetry worker data. Reload the dashboard to reconnect.")},this.#C(),this.#T&&this.#v({type:"pause-display",generation:this.#l,stream:"logs",paused:!0}),this.#A&&this.#v({type:"pause-display",generation:this.#l,stream:"events",paused:!0}),this.#j(),this.getStatus().error===null&&(this.#m=setInterval(()=>{this.#j()},1e3)),this.#D(),this.#_()}catch(i){this.#R(`Unable to start telemetry worker: ${i instanceof Error?i.message:String(i)}`)}}stop(){this.#k();const i=this.#e;if(this.#e=null,i){const l=setTimeout(()=>{i.terminate()},500),r=()=>{clearTimeout(l),i.terminate()};i.onmessage=u=>{u.data.type==="stopped"&&r()},i.onerror=r,i.onmessageerror=r;try{i.postMessage({type:"stop"})}catch{r()}}this.#U(To)}recordNativeTop(i,l=Date.now()){this.#v({type:"native-top",generation:this.#l,height:i,receivedAt:l})}clearLogs(){this.#v({type:"clear-logs",generation:this.#l}),this.#f+=1,this.#N()}clearEvents(){this.#v({type:"clear-events",generation:this.#l}),this.#z+=1,this.#S()}setLogsPaused(i){i!==this.#T&&(this.#T=i,this.#O(),this.#v({type:"pause-display",generation:this.#l,stream:"logs",paused:i}),this.#f+=1,this.#N(),this.#D())}setEventsPaused(i){i!==this.#A&&(this.#A=i,this.#M(),this.#v({type:"pause-display",generation:this.#l,stream:"events",paused:i}),this.#z+=1,this.#S(),this.#_())}reset(){this.#l+=1,this.#o=null,this.#y=null,this.#b=null,this.#h={logs:[],retained:0,matched:0,offset:0},this.#w={events:[],retained:0,matched:0,offset:0},this.#t=new oy().getSnapshot(),this.#v({type:"reset",generation:this.#l});for(const i of this.#i)i();for(const i of this.#d)i();for(const i of this.#g)i()}setLogQuery(i){JSON.stringify(i)!==JSON.stringify(this.#p)&&(this.#p=i,this.#f+=1,this.#N())}setEventQuery(i){JSON.stringify(i)!==JSON.stringify(this.#E)&&(this.#E=i,this.#z+=1,this.#S())}#_(){!this.#e||this.#g.size===0||this.#x||this.#A||(this.#S(),this.getStatus().error===null&&(this.#x=setInterval(()=>{this.#S()},e0)))}#S(){this.#b!==null||!this.#e||this.#g.size===0||(this.#b=++this.#u,this.#v({type:"poll-events",generation:this.#l,requestId:this.#b,queryVersion:this.#z,query:this.#E}))}#M(){this.#x&&clearInterval(this.#x),this.#x=null,this.#b=null}#D(){!this.#e||this.#d.size===0||this.#c||this.#T||(this.#N(),this.getStatus().error===null&&(this.#c=setInterval(()=>{this.#N()},e0)))}#N(){this.#y!==null||!this.#e||this.#d.size===0||(this.#y=++this.#u,this.#v({type:"poll-logs",generation:this.#l,requestId:this.#y,queryVersion:this.#f,query:this.#p}))}#O(){this.#c&&clearInterval(this.#c),this.#c=null,this.#y=null}#C(){this.#a!==null&&this.#v({type:"configure",generation:this.#l,endpoint:this.#a,logFilter:this.#r})}#j(){this.#o!==null||!this.#e||(this.#o=++this.#u,this.#v({type:"poll",generation:this.#l,requestId:this.#o}))}#v(i){try{this.#e?.postMessage(i)}catch{this.#R("Unable to communicate with telemetry worker. Reload the dashboard to reconnect.")}}#k(){this.#O(),this.#M(),this.#m&&clearInterval(this.#m),this.#m=null,this.#o=null}#R(i){this.#k(),this.#e?.terminate(),this.#e=null,this.#U({...To,error:i})}#U(i){if(JSON.stringify(i)!==JSON.stringify(this.#n)){this.#n=i;for(const l of this.#s)l()}}}const Kb="libbitcoinAdminDashboardLogFilter";function Fb(){try{return globalThis.localStorage}catch{return null}}function mN(n=Fb()){try{const i=n?.getItem(Kb);if(!i)return ur;const l=JSON.parse(i);return typeof l=="number"&&Number.isInteger(l)&&l>=0&&l<=Jh?l:ur}catch{return ur}}function pN(n,i=Fb()){try{i?.setItem(Kb,String(n))}catch{}}var Bo=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(){}},gN=class extends Bo{#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"}},pm=new gN,vN={setTimeout:(n,i)=>setTimeout(n,i),clearTimeout:n=>clearTimeout(n),setInterval:(n,i)=>setInterval(n,i),clearInterval:n=>clearInterval(n)},yN=class{#e=vN;#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)}},us=new yN;function bN(n){setTimeout(n,0)}var _N=typeof window>"u"||"Deno"in globalThis;function Pn(){}function SN(n,i){return typeof n=="function"?n(i):n}function Th(n){return typeof n=="number"&&n>=0&&n!==1/0}function Jb(n,i){return Math.max(n+(i||0)-Date.now(),0)}function Tl(n,i){return typeof n=="function"?n(i):n}function di(n,i){return typeof n=="function"?n(i):n}function t0(n,i){const{type:l="all",exact:r,fetchStatus:u,predicate:d,queryKey:f,stale:p}=n;if(f){if(r){if(i.queryHash!==gm(f,i.options))return!1}else if(!vr(i.queryKey,f))return!1}if(l!=="all"){const m=i.isActive();if(l==="active"&&!m||l==="inactive"&&m)return!1}return!(typeof p=="boolean"&&i.isStale()!==p||u&&u!==i.state.fetchStatus||d&&!d(i))}function n0(n,i){const{exact:l,status:r,predicate:u,mutationKey:d}=n;if(d){if(!i.options.mutationKey)return!1;if(l){if(Zo(i.options.mutationKey)!==Zo(d))return!1}else if(!vr(i.options.mutationKey,d))return!1}return!(r&&i.state.status!==r||u&&!u(i))}function gm(n,i){return(i?.queryKeyHashFn||Zo)(n)}function Zo(n){return JSON.stringify(n,(i,l)=>Nh(l)?Object.keys(l).sort().reduce((r,u)=>(r[u]=l[u],r),{}):l)}function vr(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)){for(let r=0;r500)return i;const r=i0(n)&&i0(i);if(!r&&!(Nh(n)&&Nh(i)))return i;const d=(r)DELIM" +R"DELIM(?n:Object.keys(n)).length,f=r?i:Object.keys(i),p=f.length,m=r?new Array(p):{};let v=0;for(let w=0;w{us.setTimeout(i,n)})}function Oh(n,i,l){return typeof l.structuralSharing=="function"?l.structuralSharing(n,i):l.structuralSharing!==!1?Xb(n,i):i}function zN(n,i,l=0){const r=[...n,i];return l&&r.length>l?r.slice(1):r}function EN(n,i,l=0){const r=[i,...n];return l&&r.length>l?r.slice(0,-1):r}var vm=Symbol();function Ib(n,i){return!n.queryFn&&i?.initialPromise?()=>i.initialPromise:!n.queryFn||n.queryFn===vm?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function Pb(n,i){return typeof n=="function"?n(...i):!!n}function TN(n,i,l){let r=!1,u;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(u??=i(),r||(r=!0,u.aborted?l():u.addEventListener("abort",l,{once:!0})),u)}),n}var $o=(()=>{let n=()=>_N;return{isServer(){return n()},setIsServer(i){n=i}}})();function Mh(){let n,i;const l=new Promise((u,d)=>{n=u,i=d});l.status="pending",l.catch(()=>{});function r(u){Object.assign(l,u),delete l.resolve,delete l.reject}return l.resolve=u=>{r({status:"fulfilled",value:u}),n(u)},l.reject=u=>{r({status:"rejected",reason:u}),i(u)},l}var AN=bN;function NN(){let n=[],i=0,l=p=>{p()},r=p=>{p()},u=AN;const d=p=>{i?n.push(p):u(()=>{l(p)})},f=()=>{const p=n;n=[],p.length&&u(()=>{r(()=>{p.forEach(m=>{l(m)})})})};return{batch:p=>{let m;i++;try{m=p()}finally{i--,i||f()}return m},batchCalls:p=>(...m)=>{d(()=>{p(...m)})},schedule:d,setNotifyFunction:p=>{l=p},setBatchNotifyFunction:p=>{r=p},setScheduler:p=>{u=p}}}var _n=NN(),ON=class extends Bo{#e=!0;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n(!0),l=()=>n(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",l,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",l)}}}}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(l=>{l(n)}))}isOnline(){return this.#e}},Dc=new ON;function MN(n){return Math.min(1e3*2**n,3e4)}function Wb(n){return(n??"online")==="online"?Dc.isOnline():!0}var jh=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function e1(n){let i=!1,l=0,r;const u=Mh(),d=()=>u.status!=="pending",f=L=>{if(!d()){const V=new jh(L);z(V),n.onCancel?.(V)}},p=()=>{i=!0},m=()=>{i=!1},v=()=>pm.isFocused()&&(n.networkMode==="always"||Dc.isOnline())&&n.canRun(),w=()=>Wb(n.networkMode)&&n.canRun(),S=L=>{d()||(r?.(),u.resolve(L))},z=L=>{d()||(r?.(),u.reject(L))},T=()=>new Promise(L=>{r=V=>{(d()||v())&&L(V)},n.onPause?.()}).then(()=>{r=void 0,d()||n.onContinue?.()}),j=()=>{if(d())return;let L;const V=l===0?n.initialPromise:void 0;try{L=V??n.fn()}catch(H){L=Promise.reject(H)}Promise.resolve(L).then(S).catch(H=>{if(d())return;const G=n.retry??($o.isServer()?0:3),W=n.retryDelay??MN,B=typeof W=="function"?W(l,H):W,ne=G===!0||typeof G=="number"&&lv()?void 0:T()).then(()=>{i?z(H):j()})})};return{promise:u,status:()=>u.status,cancel:f,continue:()=>(r?.(),u),cancelRetry:p,continueRetry:m,canStart:w,start:()=>(w()?j():T().then(j),u)}}var t1=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Th(this.gcTime)&&(this.#e=us.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??($o.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(us.clearTimeout(this.#e),this.#e=void 0)}};function jN(n){return{onFetch:(i,l)=>{const r=i.options,u=i.fetchOptions?.meta?.fetchMore?.direction,d=i.state.data?.pages||[],f=i.state.data?.pageParams||[];let p={pages:[],pageParams:[]},m=0;const v=async()=>{let w=!1;const S=j=>{TN(j,()=>i.signal,()=>w=!0)},z=Ib(i.options,i.fetchOptions),T=async(j,L,V)=>{if(w)return Promise.reject(i.signal.reason);if(L==null&&j.pages.length)return Promise.resolve(j);const G=(()=>{const ee={client:i.client,queryKey:i.queryKey,pageParam:L,direction:V?"backward":"forward",meta:i.options.meta};return S(ee),ee})(),W=await z(G),{maxPages:B}=i.options,ne=V?EN:zN;return{pages:ne(j.pages,W,B),pageParams:ne(j.pageParams,L,B)}};if(u&&d.length){const j=u==="backward",L=j?kN:l0,V={pages:d,pageParams:f},H=L(r,V);p=await T(V,H,j)}else{const j=n??d.length;do{const L=m===0?f[0]??r.initialPageParam:l0(r,p);if(m>0&&L==null)break;p=await T(p,L),m++}while(mi.options.persister?.(v,{client:i.client,queryKey:i.queryKey,meta:i.options.meta,signal:i.signal},l):i.fetchFn=v}}}function l0(n,{pages:i,pageParams:l}){const r=i.length-1;return i.length>0?n.getNextPageParam(i[r],i,l[r],l):void 0}function kN(n,{pages:i,pageParams:l}){return i.length>0?n.getPreviousPageParam?.(i[0],i,l[0],l):void 0}var RN=class extends t1{#e;#t;#n;#i;#s;#a;#r;#l;constructor(n){super(),this.#l=!1,this.#r=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=r0(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.#a?.promise}setOptions(n){if(this.options={...this.#r,...n},n?._type&&(this.#e=n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=r0(this.options);i.data!==void 0&&(this.setState(s0(i.data,i.dataUpdatedAt)),this.#t=i)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(n,i){const l=Oh(this.state.data,n,this.options);return this.#o({data:l,type:"success",dataUpdatedAt:i?.updatedAt,manual:i?.manual}),l}setState(n){this.#o({type:"setState",state:n})}cancel(n){const i=this.#a?.promise;return this.#a?.cancel(n),i?i.then(Pn).catch(Pn):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=>di(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vm||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(n=>Tl(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:!Jb(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(i=>i.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(i=>i.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){this.observers.includes)DELIM" +R"DELIM((n)&&(this.observers=this.observers.filter(i=>i!==n),this.observers.length||(this.#a&&(this.#l||this.#u()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(n,i){if(this.state.fetchStatus!=="idle"&&this.#a?.status()!=="rejected"){if(this.state.data!==void 0&&i?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(n&&this.setOptions(n),!this.options.queryFn){const m=this.observers.find(v=>v.options.queryFn);m&&this.setOptions(m.options)}const l=new AbortController,r=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(this.#l=!0,l.signal)})},u=()=>{const m=Ib(this.options,i),w=(()=>{const S={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(S),S})();return this.#l=!1,this.options.persister?this.options.persister(m,w,this):m(w)},f=(()=>{const m={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:u};return r(m),m})();(this.#e==="infinite"?jN(this.options.pages):this.options.behavior)?.onFetch(f,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==f.fetchOptions?.meta)&&this.#o({type:"fetch",meta:f.fetchOptions?.meta}),this.#a=e1({initialPromise:i?.initialPromise,fn:f.fetchFn,onCancel:m=>{m instanceof jh&&m.revert&&this.setState({...this.#n,fetchStatus:"idle"}),l.abort()},onFail:(m,v)=>{this.#o({type:"failed",failureCount:m,error:v})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0});try{const m=await this.#a.start();if(m===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(m),this.#i.config.onSuccess?.(m,this),this.#i.config.onSettled?.(m,this.state.error,this),m}catch(m){if(m instanceof jh){if(m.silent)return this.#a.promise;if(m.revert){if(this.state.data===void 0)throw m;return this.state.data}}throw this.#o({type:"error",error:m}),this.#i.config.onError?.(m,this),this.#i.config.onSettled?.(this.state.data,m,this),m}finally{this.scheduleGc()}}#o(n){const i=l=>{switch(n.type){case"failed":return{...l,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...l,fetchStatus:"paused"};case"continue":return{...l,fetchStatus:"fetching"};case"fetch":return{...l,...n1(l.data,this.options),fetchMeta:n.meta??null};case"success":const r={...l,...s0(n.data,n.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=n.manual?r:void 0,r;case"error":const u=n.error;return{...l,error:u,errorUpdateCount:l.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:l.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...l,isInvalidated:!0};case"setState":return{...l,...n.state}}};this.state=i(this.state),_n.batch(()=>{this.observers.forEach(l=>{l.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:n})})}};function n1(n,i){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wb(i.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function s0(n,i){return{data:n,dataUpdatedAt:i??Date.now(),error:null,isInvalidated:!1,status:"success"}}function r0(n){const i=typeof n.initialData=="function"?n.initialData():n.initialData,l=i!==void 0,r=l?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:i,dataUpdateCount:0,dataUpdatedAt:l?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:l?"success":"pending",fetchStatus:"idle"}}var CN=class extends Bo{constructor(n,i){super(),this.options=i,this.#e=n,this.#l=null,this.#r=Mh(),this.bindMethods(),this.setOptions(i)}#e;#t=void 0;#n=void 0;#i=void 0;#s;#a;#r;#l;#u;#o;#m;#c;#d;#h;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),o0(this.#t,this.options)?this.#f():this.updateResult(),this.#w())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return kh(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return kh(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#E(),this.#z(),this.#t.removeObserver(this)}setOptions(n){const i=this.options,l=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 di(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#b(),this.#t.setOptions(this.options),i._defaulted&&!Ah(this.options,i)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&u0(this.#t,l,this.options,i)&&this.#f(),this.updateResult(),r&&(this.#t!==l||di(this.options.enabled,this.#t)!==di(i.enabled,this.#t)||Tl(this.options.staleTime,this.#t)!==Tl(i.staleTime,this.#t))&&this.#y();const u=this.#x();r&&(this.#t!==l||di(this.options.enabled,this.#t)!==di(i.enabled,this.#t)||u!==this.#h)&&this.#g(u)}getOptimisticResult(n){const i=this.#e.getQueryCache().build(this.#e,n),l=this.createResult(i,n);return UN(this,l)&&(this.#i=l,this.#a=this.options,this.#s=this.#t.state),l}getCurrentResult(){return this.#i}trackResult(n,i){return new Proxy(n,{get:(l,r)=>(this.trackProp(r),i?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(l,r))})}trackProp(n){this.#p.add(n)}getCurrentQuery(){return this.#t}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const i=this.#e.defaultQueryOptions(n),l=this.#e.getQueryCache().build(this.#e,i);return l.fetch().then(()=>this.createResult(l,i))}fetch(n){return this.#f({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#f(n){this.#b();let i=this.#t.fetch(this.options,n);return n?.throwOnError||(i=i.catch(Pn)),i}#y(){this.#E();const n=Tl(this.options.staleTime,this.#t);if($o.isServer()||this.#i.isStale||!Th(n))return;const l=Jb(this.#i.dataUpdatedAt,n)+1;this.#c=us.setTimeout(()=>{this.#i.isStale||this.updateResult()},l)}#x(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#g(n){this.#z(),this.#h=n,!($o.isServer()||di(this.options.enabled,this.#t)===!1||!Th(this.#h)||this.#h===0)&&(this.#d=us.setInterval(()=>{(this.options.refetchIntervalInBackground||pm.isFocused())&&this.#f()},this.#h))}#w(){this.#y(),this.#g(this.#x())}#E(){this.#c!==void 0&&(us.clearTimeout(this.#c),this.#c=void 0)}#z(){this.#d!==void 0&&(us.clearInterval(this.#d),this.#d=void 0)}createResult(n,i){const l=this.#t,r=this.options,u=this.#i,d=this.#s,f=this.#a,m=n!==l?n.state:this.#n,{state:v}=n;let w={...v},S=!1,z;if(i._optimisticResults){const le=this.hasListeners(),ze=!le&&o0(n,i),ve=le&&u0(n,l,i,r);(ze||ve)&&(w={...w,...n1(v.data,n.options)}),i._optimisticResults==="isRestoring"&&(w.fetchStatus="idle")}let{error:T,errorUpdatedAt:j,status:L}=w;z=w.data;let V=!1;if(i.placeholderData!==void 0&&z===void 0&&L==="pending"){let le;u?.isPlaceholderData&&i.placeholderData===f?.placeholderData?(le=u.data,V=!0):le=typeof i.placeholderData=="function"?i.placeholderData(this.#m?.state.data,this.#m):i.placeholderData,le!==void 0&&(L="success",z=Oh(u?.data,le,i),S=!0)}if(i.se)DELIM" +R"DELIM(lect&&z!==void 0&&!V)if(u&&z===d?.data&&i.select===this.#u)z=this.#o;else try{this.#u=i.select,z=i.select(z),z=Oh(u?.data,z,i),this.#o=z,this.#l=null}catch(le){this.#l=le}this.#l&&(T=this.#l,z=this.#o,j=Date.now(),L="error");const H=w.fetchStatus==="fetching",G=L==="pending",W=L==="error",B=G&&H,ne=z!==void 0,K={status:L,fetchStatus:w.fetchStatus,isPending:G,isSuccess:L==="success",isError:W,isInitialLoading:B,isLoading:B,data:z,dataUpdatedAt:w.dataUpdatedAt,error:T,errorUpdatedAt:j,failureCount:w.fetchFailureCount,failureReason:w.fetchFailureReason,errorUpdateCount:w.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:w.dataUpdateCount>m.dataUpdateCount||w.errorUpdateCount>m.errorUpdateCount,isFetching:H,isRefetching:H&&!G,isLoadingError:W&&!ne,isPaused:w.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:W&&ne,isStale:ym(n,i),refetch:this.refetch,promise:this.#r,isEnabled:di(i.enabled,n)!==!1};if(this.options.experimental_prefetchInRender){const le=K.data!==void 0,ze=K.status==="error"&&!le,ve=ce=>{ze?ce.reject(K.error):le&&ce.resolve(K.data)},ie=()=>{const ce=this.#r=K.promise=Mh();ve(ce)},_e=this.#r;switch(_e.status){case"pending":n.queryHash===l.queryHash&&ve(_e);break;case"fulfilled":(ze||K.data!==_e.value)&&ie();break;case"rejected":(!ze||K.error!==_e.reason)&&ie();break}}return K}updateResult(){const n=this.#i,i=this.createResult(this.#t,this.options);if(this.#s=this.#t.state,this.#a=this.options,this.#s.data!==void 0&&(this.#m=this.#t),Ah(i,n))return;this.#i=i;const l=()=>{if(!n)return!0;const{notifyOnChangeProps:r}=this.options,u=typeof r=="function"?r():r;if(u==="all"||!u&&!this.#p.size)return!0;const d=new Set(u??this.#p);return this.options.throwOnError&&d.add("error"),Object.keys(this.#i).some(f=>{const p=f;return this.#i[p]!==n[p]&&d.has(p)})};this.#T({listeners:l()})}#b(){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.#w()}#T(n){_n.batch(()=>{n.listeners&&this.listeners.forEach(i=>{i(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function DN(n,i){return di(i.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&di(i.retryOnMount,n)===!1)}function o0(n,i){return DN(n,i)||n.state.data!==void 0&&kh(n,i,i.refetchOnMount)}function kh(n,i,l){if(di(i.enabled,n)!==!1&&Tl(i.staleTime,n)!=="static"){const r=typeof l=="function"?l(n):l;return r==="always"||r!==!1&&ym(n,i)}return!1}function u0(n,i,l,r){return(n!==i||di(r.enabled,n)===!1)&&(!l.suspense||n.state.status!=="error")&&ym(n,l)}function ym(n,i){return di(i.enabled,n)!==!1&&n.isStaleByTime(Tl(i.staleTime,n))}function UN(n,i){return!Ah(n.getCurrentResult(),i)}var ZN=class extends t1{#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||$N(),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.execute(this.state.variables)}async execute(n){const i=()=>{this.#s({type:"continue"})},l={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=e1({fn:()=>this.options.mutationFn?this.options.mutationFn(n,l):Promise.reject(new Error("No mutationFn found")),onFail:(d,f)=>{this.#s({type:"failed",failureCount:d,error:f})},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)});const r=this.state.status==="pending",u=!this.#i.canStart();try{if(r)i();else{this.#s({type:"pending",variables:n,isPaused:u}),this.#n.config.onMutate&&await this.#n.config.onMutate(n,this,l);const f=await this.options.onMutate?.(n,l);f!==this.state.context&&this.#s({type:"pending",context:f,variables:n,isPaused:u})}const d=await this.#i.start();return await this.#n.config.onSuccess?.(d,n,this.state.context,this,l),await this.options.onSuccess?.(d,n,this.state.context,l),await this.#n.config.onSettled?.(d,null,this.state.variables,this.state.context,this,l),await this.options.onSettled?.(d,null,n,this.state.context,l),this.#s({type:"success",data:d}),d}catch(d){try{await this.#n.config.onError?.(d,n,this.state.context,this,l)}catch(f){Promise.reject(f)}try{await this.options.onError?.(d,n,this.state.context,l)}catch(f){Promise.reject(f)}try{await this.#n.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,l)}catch(f){Promise.reject(f)}try{await this.options.onSettled?.(void 0,d,n,this.state.context,l)}catch(f){Promise.reject(f)}throw this.#s({type:"error",error:d}),d}finally{this.#n.runNext(this)}}#s(n){const i=l=>{switch(n.type){case"failed":return{...l,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...l,isPaused:!0};case"continue":return{...l,isPaused:!1};case"pending":return{...l,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{...l,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...l,data:void 0,error:n.error,failureCount:l.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=i(this.state),_n.batch(()=>{this.#t.forEach(l=>{l.onMutationUpdate(n)}),this.#n.notify({mutation:this,type:"updated",action:n})})}};function $N(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var LN=class extends Bo{constructor(n={}){super(),this.config=n,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(n,i,l){const r=new ZN({client:n,mutationCache:this,mutationId:++this.#n,options:n.defaultMutationOptions(i),state:l});return this.add(r),r}add(n){this.#e.add(n);const i=vc(n);if(typeof i=="string"){const l=this.#t.get(i);l?l.push(n):this.#t.set(i,[n])}this.notify({type:"added",mutation:n})}remove(n){if(this.#e.delete(n)){const i=vc(n);if(typeof i=="string"){const l=this.#t.get(i);if(l)if(l.length>1){const r=l.indexOf(n);r!==-1&&l.splice(r,1)}else l[0]===n&&this.#t.delete(i)}}this.notify({type:"removed",mutation:n})}canRun(n){const i=vc(n);if(typeof i=="string"){const r=this.#t.get(i)?.find(u=>u.state.status==="pending");return!r||r===n}else return!0}runNext(n){const i=vc(n);return typeof i=="string"?this.#t.get(i)?.find(r=>r!==n&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){_n.batch(()=>{this.#e.forEach(n=>{this.notify({type:"removed",mutation:n})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(n){const i={exact:!0,...n};return this.getAll().find(l=>n0(i,l))}findAll(n={}){return this.getAll().filter(i=>n0(n,i))}notify(n){_n.batch(()=>{this.listeners.forEach(i=>{i(n)})})}resumePausedMutations(){const n=this.getAll().filter(i=>i.state.isPaused);return _n.batch(()=>Promise.all(n.map(i=>i.continue().catch(Pn))))}};function vc(n){return n.options.scope?.id}var HN=class extends Bo{constructor(n={}){super(),this.config=n,this.#e=new Map}#e;build(n,i,l){const r=i.queryKey,u=i.queryHash??gm(r,i);let d=this.get(u);return d||(d=new RN({client:n,queryKey:r,queryHash:u,options:n.defaultQueryOptions(i),state:l,defaultOptions:n.getQueryDefaults(r)}),this.add(d)),d}add(n){this.#e.has(n.queryHash)||(this.#e.set(n.queryHash,n),this.notify({typ)DELIM" +R"DELIM(e:"added",query:n}))}remove(n){const i=this.#e.get(n.queryHash);i&&(n.destroy(),i===n&&this.#e.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){_n.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(l=>t0(i,l))}findAll(n={}){const i=this.getAll();return Object.keys(n).length>0?i.filter(l=>t0(n,l)):i}notify(n){_n.batch(()=>{this.listeners.forEach(i=>{i(n)})})}onFocus(){_n.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){_n.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},qN=class{#e;#t;#n;#i;#s;#a;#r;#l;constructor(n={}){this.#e=n.queryCache||new HN,this.#t=n.mutationCache||new LN,this.#n=n.defaultOptions||{},this.#i=new Map,this.#s=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#r=pm.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#l=Dc.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#r?.(),this.#r=void 0,this.#l?.(),this.#l=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),l=this.#e.build(this,i),r=l.state.data;return r===void 0?this.fetchQuery(n):(n.revalidateIfStale&&l.isStaleByTime(Tl(i.staleTime,l))&&this.prefetchQuery(i),Promise.resolve(r))}getQueriesData(n){return this.#e.findAll(n).map(({queryKey:i,state:l})=>{const r=l.data;return[i,r]})}setQueryData(n,i,l){const r=this.defaultQueryOptions({queryKey:n}),d=this.#e.get(r.queryHash)?.state.data,f=SN(i,d);if(f!==void 0)return this.#e.build(this,r).setData(f,{...l,manual:!0})}setQueriesData(n,i,l){return _n.batch(()=>this.#e.findAll(n).map(({queryKey:r})=>[r,this.setQueryData(r,i,l)]))}getQueryState(n){const i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state}removeQueries(n){const i=this.#e;_n.batch(()=>{i.findAll(n).forEach(l=>{i.remove(l)})})}resetQueries(n,i){const l=this.#e;return _n.batch(()=>(l.findAll(n).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...n},i)))}cancelQueries(n,i={}){const l={revert:!0,...i},r=_n.batch(()=>this.#e.findAll(n).map(u=>u.cancel(l)));return Promise.all(r).then(Pn).catch(Pn)}invalidateQueries(n,i={}){return _n.batch(()=>(this.#e.findAll(n).forEach(l=>{l.invalidate()}),n?.refetchType==="none"?Promise.resolve():this.refetchQueries({...n,type:n?.refetchType??n?.type??"active"},i)))}refetchQueries(n,i={}){const l={...i,cancelRefetch:i.cancelRefetch??!0},r=_n.batch(()=>this.#e.findAll(n).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let d=u.fetch(void 0,l);return l.throwOnError||(d=d.catch(Pn)),u.state.fetchStatus==="paused"?Promise.resolve():d}));return Promise.all(r).then(Pn)}fetchQuery(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const l=this.#e.build(this,i);return l.isStaleByTime(Tl(i.staleTime,l))?l.fetch(i):Promise.resolve(l.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(Pn).catch(Pn)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(Pn).catch(Pn)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return Dc.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(Zo(n),{queryKey:n,defaultOptions:i})}getQueryDefaults(n){const i=[...this.#i.values()],l={};return i.forEach(r=>{vr(n,r.queryKey)&&Object.assign(l,r.defaultOptions)}),l}setMutationDefaults(n,i){this.#s.set(Zo(n),{mutationKey:n,defaultOptions:i})}getMutationDefaults(n){const i=[...this.#s.values()],l={};return i.forEach(r=>{vr(n,r.mutationKey)&&Object.assign(l,r.defaultOptions)}),l}defaultQueryOptions(n){if(n._defaulted)return n;const i={...this.#n.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return i.queryHash||(i.queryHash=gm(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===vm&&(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()}},i1=re.createContext(void 0),BN=n=>{const i=re.useContext(i1);if(!i)throw new Error("No QueryClient set, use QueryClientProvider to set one");return i},VN=({client:n,children:i})=>(re.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),_.jsx(i1.Provider,{value:n,children:i})),a1=re.createContext(!1),GN=()=>re.useContext(a1);a1.Provider;function YN(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var QN=re.createContext(YN()),KN=()=>re.useContext(QN),FN=(n,i,l)=>{const r=l?.state.error&&typeof n.throwOnError=="function"?Pb(n.throwOnError,[l.state.error,l]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||r)&&(i.isReset()||(n.retryOnMount=!1))},JN=n=>{re.useEffect(()=>{n.clearReset()},[n])},XN=({result:n,errorResetBoundary:i,throwOnError:l,query:r,suspense:u})=>n.isError&&!i.isReset()&&!n.isFetching&&r&&(u&&n.data===void 0||Pb(l,[n.error,r])),IN=n=>{if(n.suspense){const l=u=>u==="static"?u:Math.max(u??1e3,1e3),r=n.staleTime;n.staleTime=typeof r=="function"?(...u)=>l(r(...u)):l(r),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},PN=(n,i)=>n.isLoading&&n.isFetching&&!i,WN=(n,i)=>n?.suspense&&i.isPending,c0=(n,i,l)=>i.fetchOptimistic(n).catch(()=>{l.clearReset()});function eO(n,i,l){const r=GN(),u=KN(),d=BN(),f=d.defaultQueryOptions(n);d.getDefaultOptions().queries?._experimental_beforeQuery?.(f);const p=d.getQueryCache().get(f.queryHash),m=n.subscribed!==!1;f._optimisticResults=r?"isRestoring":m?"optimistic":void 0,IN(f),FN(f,u,p),JN(u);const v=!d.getQueryCache().get(f.queryHash),[w]=re.useState(()=>new i(d,f)),S=w.getOptimisticResult(f),z=!r&&m;if(re.useSyncExternalStore(re.useCallback(T=>{const j=z?w.subscribe(_n.batchCalls(T)):Pn;return w.updateResult(),j},[w,z]),()=>w.getCurrentResult(),()=>w.getCurrentResult()),re.useEffect(()=>{w.setOptions(f)},[f,w]),WN(f,S))throw c0(f,w,u);if(XN({result:S,errorResetBoundary:u,throwOnError:f.throwOnError,query:p,suspense:f.suspense}))throw S.error;return d.getDefaultOptions().queries?._experimental_afterQuery?.(f,S),f.experimental_prefetchInRender&&!$o.isServer()&&PN(S,r)&&(v?c0(f,w,u):p?.promise)?.catch(Pn).finally(()=>{w.updateResult()}),f.notifyOnChangeProps?S:w.trackResult(S)}function tO(n,i){return eO(n,CN)}const l1=Ml({address:nr(),filter:nr(),turbo:nr(),witness:nr(),retarget:nr(),difficult:nr(),pruned:ra().int().nonnegative()}),s1=Ml({height:ra().int().nonnegative(),timestamp:ra().int().positive().max(4294967295)}),r1=ra().int().nonnegative();function nO(n){try{const i=JSON.parse(n),l=l1.safeParse(i);if(l.success)return{type:"configuration",payload:l.data};const r=s1.safeParse(i);if(r.success)return{type:"header",payload:r.data};const u=r1.safeParse(i);return u.success?{type:"top",payload:u.data}:null}catch{return null}}function rh(n,i){return new URL(i,`${n.replace(/\/+$/u,"")}/`).toString()}async function oh(n,i){const l=await fetch(n,{headers:{Accept:"application/json"},signal:i});if(!l.ok)throw new Error(`Native API request failed with status ${String(l.status)}`);return await l.json()}async function iO(n,i){const[l,r]=await Promise.all([oh(rh(n,"/v1/configuration?format=json"),i),oh(rh(n,"/v1/top?format=json"),i)]),u=l1.parse(l),d=r1.parse(r),f=Date.now();let p=null;try{const m=s1.parse(await oh(rh(n,o1(d)),i));m.height===d&&)DELIM" +R"DELIM((p=m)}catch{i?.throwIfAborted()}return{configuration:u,top:d,topHeader:p,receivedAt:f}}function o1(n){return`/v1/block/height/${String(n)}/header?format=json`}const f0={phase:"idle",attempt:0,reconnects:0,connectedAt:null,lastMessageAt:null,error:null};class aO{#e;#t=f0;#n=null;#i=new Set;#s=null;#a=null;#r=null;#l;#u=!1;constructor(i){this.#e={...i,connectTimeoutMs:i.connectTimeoutMs??5e3,retryMinimumMs:i.retryMinimumMs??1e3,retryMaximumMs:i.retryMaximumMs??3e4,heartbeatMs:i.heartbeatMs??24e4,jitterRatio:i.jitterRatio??.2,now:i.now??Date.now,random:i.random??Math.random,webSocketFactory:i.webSocketFactory??(l=>new WebSocket(l))},this.#l=this.#e.retryMinimumMs}getStatus=()=>this.#t;subscribeStatus=i=>(this.#i.add(i),()=>{this.#i.delete(i)});start(){this.#u||(this.#u=!0,this.#l=this.#e.retryMinimumMs,this.#o())}stop(){this.#u=!1,this.#p();const i=this.#n;if(this.#n=null,i)try{i.readyState===1&&this.#e.onBeforeStop?.(i),i.close()}catch{}this.#f(f0)}send(i){if(this.#n?.readyState!==1)return!1;try{return this.#n.send(i),!0}catch{return!1}}#o(){if(!this.#u||this.#n)return;const i=this.#t.reconnects>0;this.#f({...this.#t,phase:i?"reconnecting":"connecting",attempt:this.#t.attempt+1,error:null});let l;try{l=this.#e.webSocketFactory(this.#e.url),this.#n=l}catch(r){this.#f({...this.#t,error:sO(r)}),this.#m();return}this.#s=setTimeout(()=>{if(this.#n===l){this.#f({...this.#t,error:"Connection timed out"});try{l.close()}catch{this.#n=null,this.#m()}}},this.#e.connectTimeoutMs),l.addEventListener("open",()=>{this.#n!==l||!this.#u||(this.#d(),this.#l=this.#e.retryMinimumMs,this.#f({...this.#t,phase:"connected",connectedAt:this.#e.now(),error:null}),this.#e.onOpen?.(l),this.#c(l))}),l.addEventListener("message",r=>{if(this.#n!==l||!this.#u)return;const u=lO(r.data);if(u===null)return;const d=this.#e.now();(this.#t.lastMessageAt===null||d-this.#t.lastMessageAt>=1e3)&&this.#f({...this.#t,lastMessageAt:d}),this.#e.onMessage(u)}),l.addEventListener("error",()=>{if(!(this.#n!==l||!this.#u)){this.#f({...this.#t,error:"WebSocket connection failed"});try{l.close()}catch{this.#n=null,this.#m()}}}),l.addEventListener("close",()=>{this.#n===l&&(this.#n=null,this.#d(),this.#h(),this.#u&&this.#m())})}#m(){if(!this.#u||this.#a)return;const i=1+(this.#e.random()*2-1)*this.#e.jitterRatio,l=Math.max(0,Math.round(this.#l*i));this.#l=Math.min(this.#l*2,this.#e.retryMaximumMs),this.#f({...this.#t,phase:"reconnecting",reconnects:this.#t.reconnects+1,connectedAt:null}),this.#a=setTimeout(()=>{this.#a=null,this.#o()},l)}#c(i){this.#h(),!(!this.#e.onHeartbeat||this.#e.heartbeatMs<=0)&&(this.#r=setInterval(()=>{this.#n===i&&i.readyState===1&&this.#e.onHeartbeat?.(i)},this.#e.heartbeatMs))}#d(){this.#s&&(clearTimeout(this.#s),this.#s=null)}#h(){this.#r&&(clearInterval(this.#r),this.#r=null)}#p(){this.#d(),this.#h(),this.#a&&(clearTimeout(this.#a),this.#a=null)}#f(i){this.#t=i;for(const l of this.#i)l()}}function lO(n){return typeof n=="string"?n:n instanceof ArrayBuffer?new TextDecoder().decode(n):null}function sO(n){return n instanceof Error?n.message:"Unable to create WebSocket"}const bm=15e3,Rh=3*bm,d0={configuration:null,configurationReceivedAt:null,top:null,topReceivedAt:null,topHeader:null,headerReceivedAt:null,invalidFrames:0};class rO{#e=d0;#t=new Set;#n;#i;#s=null;#a=null;#r=null;#l;constructor(i,l={}){this.#i=l.now??Date.now,this.#l=l.pollIntervalMs??bm,this.#n=new aO({url:Q_(i),webSocketFactory:l.webSocketFactory,retryMinimumMs:l.retryMinimumMs,retryMaximumMs:l.retryMaximumMs,jitterRatio:l.jitterRatio,heartbeatMs:this.#l,now:this.#i,onOpen:r=>{this.#s=this.#i(),r.send("/v1/configuration?format=json"),r.send("/v1/top/subscribe?format=json")},onHeartbeat:r=>{const u=this.#e.topReceivedAt??this.#s;if(u!==null&&this.#i()-u>=Rh){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 u=nO(r);if(!u){this.#c({...this.#e,invalidFrames:this.#e.invalidFrames+1});return}this.#u(u)}}),this.#n.subscribeStatus(()=>{this.#n.getStatus().phase!=="connected"&&(this.#s=null,this.#a=null,this.#r=null,this.#m())})}getStatus=()=>this.#n.getStatus();subscribeStatus=i=>this.#n.subscribeStatus(i);getState=()=>this.#e;subscribeState=i=>(this.#t.add(i),()=>{this.#t.delete(i)});start(){this.#n.start()}stop(){this.#n.stop()}#u(i){const l=this.#i();if(i.type==="top"){const r=this.#e.top!==null&&i.payload{i.configure(n,l)},[n,i,l]),re.useEffect(()=>(i.start(),()=>{i.stop()}),[i]),r}function uO(n,i,l){const r=re.useMemo(()=>new rO(n),[n]),u=re.useMemo(()=>K_(n),[n]),d=re.useSyncExternalStore(r.subscribeStatus,r.getStatus,r.getStatus),f=re.useSyncExternalStore(r.subscribeState,r.getState,r.getState),p=u1(d,f,l);re.useEffect(()=>(r.start(),()=>{r.stop()}),[r]);const m=tO({queryKey:["native-snapshot",n],queryFn:({signal:w})=>iO(n,w),enabled:u&&!p,refetchInterval:bm,retry:!1}),v=cO(d,f,m.data??null,l);return re.useEffect(()=>{v.top!==null&&i.recordNativeTop(v.top,v.receivedAt??Date.now())},[i,v.receivedAt,v.top]),{status:d,live:f,...v,restError:m.error instanceof Error?m.error.message:null}}function u1(n,i,l){return n.phase==="connected"&&i.top!==null&&i.topReceivedAt!==null&&i.configuration!==null&&i.configurationReceivedAt!==null&&Ch(i.topReceivedAt,l)}function cO(n,i,l,r){return u1(n,i,r)?{top:i.top,topHeader:i.headerReceivedAt!==null&&Ch(i.headerReceivedAt,r)?i.topHeader:null,configuration:i.configuration,receivedAt:i.topReceivedAt,transport:"websocket"}:l&&Ch(l.receivedAt,r)?{top:l.top,topHeader:l.topHeader,configuration:l.configuration,receivedAt:l.receivedAt,transport:"rest"}:{top:null,topHeader:null,configuration:null,receivedAt:null,transport:"none"}}function Ch(n,i){return i-n<=Rh}const fO=[{id:"overview",label:"Overview"},{id:"logs",label:"Logs"},{id:"events",label:"Events"}];function dO(){const n=re.useMemo(()=>new hN,[]),[i,l]=re.useState(F_),[r,u]=re.useState("overview"),[d,f]=re.useState(!1),[p,m]=re.useState(mN),[v,w]=re.useState(!1),[S,z]=re.useState(!1),[T,j]=re.useState(B_),L=re.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot),V=oO(i.adminUrl,n,p),H=uO(i.nativeUrl,n,L.now),G=_E(H.top,H.topHeader,L.now);function W(K){J_(K),(K.adminUrl!==i.adminUrl||K.nativeUrl!==i.nativeUrl)&&n.reset(),l(K),f(!1)}function B(){X_();const K=y0();(K.adminUrl!==i.adminUrl||K.nativeUrl!==i.nativeUrl)&&n.reset(),l(K),f(!1)}function ne(K){V_(K),j(K)}function ee(K){pN(K),m(K)}return _.jsxs("div",{className:"bg-background text-textPrimary min-h-screen",children:[_.jsx("header",{className:"border-accent/25 bg-surface/95 sticky top-0 z-40 border-b backdrop-blur",children:_.jsx("div",{className:"mx-auto max-w-[96rem] px-4 sm:px-6",children:_.jsxs("div",{className:"flex min-h-16 flex-wrap items-center gap-x-6 gap-y-2 py-3",children:[_.jsxs("button",{type:"button",onClick:()=>{u("overview")},className:"mr-auto text-left",children:[_.jsx("p",{className:"text-accentSecondary text-[10px] font-medium tracking-[0.2em)DELIM" +R"DELIM(] uppercase",children:"Libbitcoin Server"}),_.jsx("h1",{className:"text-accent text-lg font-semibold tracking-tight",children:"Admin Dashboard"})]}),_.jsx("nav",{className:"order-3 flex w-full items-center gap-1 sm:order-none sm:w-auto",children:fO.map(K=>_.jsxs("button",{type:"button",onClick:()=>{u(K.id)},className:`rounded-lg px-3 py-2 text-sm transition ${r===K.id?"bg-accent/15 text-accent":"text-textMuted hover:text-textPrimary hover:bg-white/5"}`,children:[K.label,K.id==="logs"&&L.totalLogs>0&&_.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:L.totalLogs>999?"999+":String(L.totalLogs)}),K.id==="events"&&L.totalEvents>0&&_.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:L.totalEvents>999?"999+":String(L.totalEvents)})]},K.id))}),_.jsxs("div",{className:"flex items-center gap-3",children:[_.jsxs("div",{className:"hidden items-center gap-2 lg:flex","aria-label":"Connection summary",children:[_.jsx(h0,{connected:V.phase==="connected",label:"Admin"}),_.jsx(h0,{connected:H.transport!=="none",label:"Native"})]}),_.jsx("button",{type:"button",onClick:()=>{f(!0)},className:"border-accent/30 text-textMuted hover:border-accent hover:text-accent rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Endpoints"})]})]})})}),_.jsxs("main",{className:"mx-auto max-w-[96rem] min-w-0 px-4 py-8 sm:px-6",children:[r==="overview"&&_.jsx(aN,{adminStatus:V,endpoints:i,metrics:L,native:H,syncEstimate:G}),r==="logs"&&_.jsx(P2,{metrics:n,delivery:L,status:V,logFilter:p,paused:v,onLogFilterChange:ee,onPausedChange:K=>{n.setLogsPaused(K),w(K)},onClear:()=>{n.clearLogs()}}),r==="events"&&_.jsx(X2,{metrics:n,paused:S,onPausedChange:K=>{n.setEventsPaused(K),z(K)},onClear:()=>{n.clearEvents()}})]}),_.jsx(oN,{estimate:G,browserNotificationsEnabled:T},i.nativeUrl),d&&_.jsx(I_,{configuration:i,browserNotificationsEnabled:T,onClose:()=>{f(!1)},onReset:B,onSave:W,onBrowserNotificationsEnabledChange:ne},`${i.adminUrl}|${i.nativeUrl}`)]})}function h0({connected:n,label:i}){return _.jsxs("span",{className:"text-textMuted inline-flex items-center gap-1.5 text-xs",children:[_.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-400":"bg-amber-400"}`,"aria-hidden":"true"}),i]})}function hO({children:n}){const[i]=re.useState(()=>new qN({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:1}}}));return _.jsxs(VN,{client:i,children:[n,null]})}const c1=document.querySelector("#root");if(!c1)throw new Error("Root element not found");H_.createRoot(c1).render(_.jsx(k_.StrictMode,{children:_.jsx(hO,{children:_.jsx(dO,{})})})); )DELIM" ) From 093b66c1e53d9eec7ed4cd62f31436dae828cd71 Mon Sep 17 00:00:00 2001 From: BOB450 Date: Wed, 14 Oct 2026 05:06:43 -0600 Subject: [PATCH 2/2] Multiple fixes to embedded admin site. - Fixed. Logs and Events now maintain 100 ms display polling through reconnects, including when opened or resumed during an error. - Invalid timestamps are rejected and counted as malformed frames. Log rows, event rows, and log details render safely if an invalid timestamp reaches them. --- console/embedded/admin_ecma.cpp | 146 ++++++++++++++++---------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/console/embedded/admin_ecma.cpp b/console/embedded/admin_ecma.cpp index 1b879121..57053da6 100644 --- a/console/embedded/admin_ecma.cpp +++ b/console/embedded/admin_ecma.cpp @@ -23,45 +23,45 @@ namespace server { // Simple test ecma script for embedded page. DEFINE_EMBEDDED_PAGE(admin_pages, char, ecma, -R"DELIM((function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))r(u);new MutationObserver(u=>{for(const d of u)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&r(f)}).observe(document,{childList:!0,subtree:!0});function l(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(u){if(u.ep)return;u.ep=!0;const d=l(u);fetch(u.href,d)}})();function m0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Gd={exports:{}},xo={};var zv;function O_(){if(zv)return xo;zv=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function l(r,u,d){var f=null;if(d!==void 0&&(f=""+d),u.key!==void 0&&(f=""+u.key),"key"in u){d={};for(var p in u)p!=="key"&&(d[p]=u[p])}else d=u;return u=d.ref,{$$typeof:n,type:r,key:f,ref:u!==void 0?u:null,props:d}}return xo.Fragment=i,xo.jsx=l,xo.jsxs=l,xo}var Ev;function M_(){return Ev||(Ev=1,Gd.exports=O_()),Gd.exports}var _=M_(),Yd={exports:{}},Ce={};var Tv;function j_(){if(Tv)return Ce;Tv=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),z=Symbol.iterator;function T(N){return N===null||typeof N!="object"?null:(N=z&&N[z]||N["@@iterator"],typeof N=="function"?N:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,V={};function H(N,$,Y){this.props=N,this.context=$,this.refs=V,this.updater=Y||j}H.prototype.isReactComponent={},H.prototype.setState=function(N,$){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,$,"setState")},H.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function G(){}G.prototype=H.prototype;function W(N,$,Y){this.props=N,this.context=$,this.refs=V,this.updater=Y||j}var B=W.prototype=new G;B.constructor=W,L(B,H.prototype),B.isPureReactComponent=!0;var ne=Array.isArray;function ee(){}var K={H:null,A:null,T:null,S:null},le=Object.prototype.hasOwnProperty;function ze(N,$,Y){var se=Y.ref;return{$$typeof:n,type:N,key:$,ref:se!==void 0?se:null,props:Y}}function ve(N,$){return ze(N.type,$,N.props)}function ie(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function _e(N){var $={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(Y){return $[Y]})}var ce=/\/+/g;function Ee(N,$){return typeof N=="object"&&N!==null&&N.key!=null?_e(""+N.key):$.toString(36)}function he(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(ee,ee):(N.status="pending",N.then(function($){N.status==="pending"&&(N.status="fulfilled",N.value=$)},function($){N.status==="pending"&&(N.status="rejected",N.reason=$)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function D(N,$,Y,se,we){var ge=typeof N;(ge==="undefined"||ge==="boolean")&&(N=null);var ye=!1;if(N===null)ye=!0;else switch(ge){case"bigint":case"string":case"number":ye=!0;break;case"object":switch(N.$$typeof){case n:case i:ye=!0;break;case w:return ye=N._init,D(ye(N._payload),$,Y,se,we)}}if(ye)return we=we(N),ye=se===""?"."+Ee(N,0):se,ne(we)?(Y="",ye!=null&&(Y=ye.replace(ce,"$&/")+"/"),D(we,$,Y,"",function(nt){return nt})):we!=null&&(ie(we)&&(we=ve(we,Y+(we.key==null||N&&N.key===we.key?"":(""+we.key).replace(ce,"$&/")+"/")+ye)),$.push(we)),1;ye=0;var mt=se===""?".":se+":";if(ne(N))for(var Ve=0;Ve>>1,Se=D[Oe];if(0>>1;Oeu(Y,pe))seu(we,Y)?(D[Oe]=we,D[se]=pe,Oe=se):(D[Oe]=Y,D[$]=pe,Oe=$);else if(seu(we,pe))D[Oe]=we,D[se]=pe,Oe=se;else break e}}return Q}function u(D,Q){var pe=D.sortIndex-Q.sortIndex;return pe!==0?pe:D.id-Q.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var m=[],v=[],w=1,S=null,z=3,T=!1,j=!1,L=!1,V=!1,H=typeof setTimeout=="function"?setTimeout:null,G=typeof clearTimeout=="function"?clearTimeout:null,W=typeof setImmediate<"u"?setImmediate:null;function B(D){for(var Q=l(v);Q!==null;){if(Q.callback===null)r(v);else if(Q.startTime<=D)r(v),Q.sortIndex=Q.expirationTime,i(m,Q);else break;Q=l(v)}}function ne(D){if(L=!1,B(D),!j)if(l(m)!==null)j=!0,ee||(ee=!0,_e());else{var Q=l(v);Q!==null&&he(ne,Q.startTime-D)}}var ee=!1,K=-1,le=5,ze=-1;function ve(){return V?!0:!(n.unstable_now()-zeD&&ve());){var Oe=S.callback;if(typeof Oe=="function"){S.callback=null,z=S.priorityLevel;var Se=Oe(S.expirationTime<=D);if(D=n.unstable_now(),typeof Se=="function"){S.callback=Se,B(D),Q=!0;break t}S===l(m)&&r(m),B(D)}else r(m);S=l(m)}if(S!==null)Q=!0;else{var N=l(v);N!==null&&he(ne,N.startTime-D),Q=!1}}break e}finally{S=null,z=pe,T=!1}Q=void 0}}finally{Q?_e():ee=!1}}}var _e;if(typeof W=="function")_e=function(){W(ie)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,Ee=ce.port2;ce.port1.onmessage=ie,_e=function(){Ee.postMessage(null)}}else _e=function(){H(ie,0)};function he(D,Q){K=H(function(){D(n.unstable_now())},Q)}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(D){D.callback=null},n.unstable_forceFrameRate=function(D){0>D||125Oe?(D.sortIndex=pe,i(v,D),l(m)===null&&D===l(v)&&(L?(G(K),K=-1):L=!0,he(ne,pe-Oe))):(D.sortIndex=Se,i(m,D),j||T||(j=!0,ee||(ee=!0,_e()))),D},n.unstable_shouldYield=ve,n.unstable_wrapCallback=function(D){var Q=z;return function(){var pe=z;z=Q;try{return D.apply(this,arguments)}finally{z=pe}}}})(Fd)),Fd}var Ov;function C_(){return Ov||(Ov=1,Kd.exports=R_()),Kd.exports}var Jd={exports:{}},On={};var Mv;function D_(){if(Mv)return On;Mv=1;var n=Dh();function i(m){var v="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Jd.exports=D_(),Jd.exports}var kv;function Z_(){if(kv)return wo;kv=1;var n=C_(),i=Dh(),l=U_();function r(e){var t="https://react.dev/errors/"+e;if(1Se||(e.current=Oe[Se],Oe[Se]=null,Se--)}function Y(e,t){Se++,Oe[Se]=e.current,e.current=t}var se=N(null),we=N(null),ge=N(null),ye=N(null);function mt(e,t){switch(Y(ge,t),Y(we,e),Y(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Kg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Kg(t),e=Fg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}$(se),Y(se,e)}function Ve(){$(se),$(we),$(ge)}function nt(e){e.memoizedState!==null&&Y(ye,e);var t=se.current,a=Fg(t,e.type);t!==a&&(Y(we,e),Y(se,a))}function Mn(e){we.current===e&&($(se),$(we)),ye.current===e&&($(ye),yo._currentValue=pe)}var ei,jn;function xn(e){if(ei===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);ei=t&&t[1]||"",jn=-1{for(const d of u)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&r(f)}).observe(document,{childList:!0,subtree:!0});function l(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(u){if(u.ep)return;u.ep=!0;const d=l(u);fetch(u.href,d)}})();function p0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Gd={exports:{}},xo={};var Ev;function j_(){if(Ev)return xo;Ev=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function l(r,u,d){var f=null;if(d!==void 0&&(f=""+d),u.key!==void 0&&(f=""+u.key),"key"in u){d={};for(var p in u)p!=="key"&&(d[p]=u[p])}else d=u;return u=d.ref,{$$typeof:n,type:r,key:f,ref:u!==void 0?u:null,props:d}}return xo.Fragment=i,xo.jsx=l,xo.jsxs=l,xo}var Tv;function k_(){return Tv||(Tv=1,Gd.exports=j_()),Gd.exports}var _=k_(),Yd={exports:{}},Ce={};var Av;function R_(){if(Av)return Ce;Av=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),z=Symbol.iterator;function T(N){return N===null||typeof N!="object"?null:(N=z&&N[z]||N["@@iterator"],typeof N=="function"?N:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,V={};function H(N,$,Y){this.props=N,this.context=$,this.refs=V,this.updater=Y||j}H.prototype.isReactComponent={},H.prototype.setState=function(N,$){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,$,"setState")},H.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function G(){}G.prototype=H.prototype;function W(N,$,Y){this.props=N,this.context=$,this.refs=V,this.updater=Y||j}var B=W.prototype=new G;B.constructor=W,L(B,H.prototype),B.isPureReactComponent=!0;var ne=Array.isArray;function ee(){}var K={H:null,A:null,T:null,S:null},le=Object.prototype.hasOwnProperty;function ze(N,$,Y){var se=Y.ref;return{$$typeof:n,type:N,key:$,ref:se!==void 0?se:null,props:Y}}function ve(N,$){return ze(N.type,$,N.props)}function ie(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function _e(N){var $={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(Y){return $[Y]})}var ce=/\/+/g;function Ee(N,$){return typeof N=="object"&&N!==null&&N.key!=null?_e(""+N.key):$.toString(36)}function he(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(ee,ee):(N.status="pending",N.then(function($){N.status==="pending"&&(N.status="fulfilled",N.value=$)},function($){N.status==="pending"&&(N.status="rejected",N.reason=$)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function D(N,$,Y,se,we){var ge=typeof N;(ge==="undefined"||ge==="boolean")&&(N=null);var ye=!1;if(N===null)ye=!0;else switch(ge){case"bigint":case"string":case"number":ye=!0;break;case"object":switch(N.$$typeof){case n:case i:ye=!0;break;case w:return ye=N._init,D(ye(N._payload),$,Y,se,we)}}if(ye)return we=we(N),ye=se===""?"."+Ee(N,0):se,ne(we)?(Y="",ye!=null&&(Y=ye.replace(ce,"$&/")+"/"),D(we,$,Y,"",function(nt){return nt})):we!=null&&(ie(we)&&(we=ve(we,Y+(we.key==null||N&&N.key===we.key?"":(""+we.key).replace(ce,"$&/")+"/")+ye)),$.push(we)),1;ye=0;var mt=se===""?".":se+":";if(ne(N))for(var Ve=0;Ve>>1,Se=D[Me];if(0>>1;Meu(Y,pe))seu(we,Y)?(D[Me]=we,D[se]=pe,Me=se):(D[Me]=Y,D[$]=pe,Me=$);else if(seu(we,pe))D[Me]=we,D[se]=pe,Me=se;else break e}}return Q}function u(D,Q){var pe=D.sortIndex-Q.sortIndex;return pe!==0?pe:D.id-Q.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var m=[],v=[],w=1,S=null,z=3,T=!1,j=!1,L=!1,V=!1,H=typeof setTimeout=="function"?setTimeout:null,G=typeof clearTimeout=="function"?clearTimeout:null,W=typeof setImmediate<"u"?setImmediate:null;function B(D){for(var Q=l(v);Q!==null;){if(Q.callback===null)r(v);else if(Q.startTime<=D)r(v),Q.sortIndex=Q.expirationTime,i(m,Q);else break;Q=l(v)}}function ne(D){if(L=!1,B(D),!j)if(l(m)!==null)j=!0,ee||(ee=!0,_e());else{var Q=l(v);Q!==null&&he(ne,Q.startTime-D)}}var ee=!1,K=-1,le=5,ze=-1;function ve(){return V?!0:!(n.unstable_now()-zeD&&ve());){var Me=S.callback;if(typeof Me=="function"){S.callback=null,z=S.priorityLevel;var Se=Me(S.expirationTime<=D);if(D=n.unstable_now(),typeof Se=="function"){S.callback=Se,B(D),Q=!0;break t}S===l(m)&&r(m),B(D)}else r(m);S=l(m)}if(S!==null)Q=!0;else{var N=l(v);N!==null&&he(ne,N.startTime-D),Q=!1}}break e}finally{S=null,z=pe,T=!1}Q=void 0}}finally{Q?_e():ee=!1}}}var _e;if(typeof W=="function")_e=function(){W(ie)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,Ee=ce.port2;ce.port1.onmessage=ie,_e=function(){Ee.postMessage(null)}}else _e=function(){H(ie,0)};function he(D,Q){K=H(function(){D(n.unstable_now())},Q)}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(D){D.callback=null},n.unstable_forceFrameRate=function(D){0>D||125Me?(D.sortIndex=pe,i(v,D),l(m)===null&&D===l(v)&&(L?(G(K),K=-1):L=!0,he(ne,pe-Me))):(D.sortIndex=Se,i(m,D),j||T||(j=!0,ee||(ee=!0,_e()))),D},n.unstable_shouldYield=ve,n.unstable_wrapCallback=function(D){var Q=z;return function(){var pe=z;z=Q;try{return D.apply(this,arguments)}finally{z=pe}}}})(Fd)),Fd}var Ov;function U_(){return Ov||(Ov=1,Kd.exports=D_()),Kd.exports}var Jd={exports:{}},Mn={};var jv;function Z_(){if(jv)return Mn;jv=1;var n=Dh();function i(m){var v="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Jd.exports=Z_(),Jd.exports}var Rv;function L_(){if(Rv)return wo;Rv=1;var n=U_(),i=Dh(),l=$_();function r(e){var t="https://react.dev/errors/"+e;if(1Se||(e.current=Me[Se],Me[Se]=null,Se--)}function Y(e,t){Se++,Me[Se]=e.current,e.current=t}var se=N(null),we=N(null),ge=N(null),ye=N(null);function mt(e,t){switch(Y(ge,t),Y(we,e),Y(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Fg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Fg(t),e=Jg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}$(se),Y(se,e)}function Ve(){$(se),$(we),$(ge)}function nt(e){e.memoizedState!==null&&Y(ye,e);var t=se.current,a=Jg(t,e.type);t!==a&&(Y(we,e),Y(se,a))}function On(e){we.current===e&&($(se),$(we)),ye.current===e&&($(ye),yo._currentValue=pe)}var ei,jn;function xn(e){if(ei===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);ei=t&&t[1]||"",jn=-1)":-1o||A[s]!==U[o]){var F=` `+A[s].replace(" at new "," at ");return e.displayName&&F.includes("")&&(F=F.replace("",e.displayName)),F}while(1<=s&&0<=o);break}}}finally{Yi=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?xn(a):""}function jl(e,t){switch(e.tag){case 26:case 27:case 5:return xn(e.type);case 16:return xn("Lazy");case 13:return e.child!==t&&t!==null?xn("Suspense Fallback"):xn("Suspense");case 19:return xn("SuspenseList");case 0:case 15:return Qi(e.type,!1);case 11:return Qi(e.type.render,!1);case 1:return Qi(e.type,!0);case 31:return xn("Activity");default:return""}}function kl(e){try{var t="",a=null;do t+=jl(e,a),a=e,e=e.return;while(e);return t}catch(s){return` Error generating stack: `+s.message+` -`+s.stack}}var ji=Object.prototype.hasOwnProperty,Xt=n.unstable_scheduleCallback,Ki=n.unstable_cancelCallback,ki=n.unstable_shouldYield,ua=n.unstable_requestPaint,Te=n.unstable_now,fe=n.unstable_getCurrentPriorityLevel,it=n.unstable_ImmediatePriority,Mt=n.unstable_UserBlockingPriority,Ri=n.unstable_NormalPriority,ca=n.unstable_LowPriority,ti=n.unstable_IdlePriority,fa=n.log,kn=n.unstable_setDisableYieldValue,nn=null,ot=null;function Vt(e){if(typeof fa=="function"&&kn(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(nn,e)}catch{}}var cn=Math.clz32?Math.clz32:da,gs=Math.log,qa=Math.LN2;function da(e){return e>>>=0,e===0?32:31-(gs(e)/qa|0)|0}var ha=256,fn=262144,Ba=4194304;function Fi(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 655)DELIM" -R"DELIM(36:case 131072:return e&261888;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 vs(e,t,a){var s=e.pendingLanes;if(s===0)return 0;var o=0,c=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var b=s&134217727;return b!==0?(s=b&~c,s!==0?o=Fi(s):(h&=b,h!==0?o=Fi(h):a||(a=b&~e,a!==0&&(o=Fi(a))))):(b=s&~c,b!==0?o=Fi(b):h!==0?o=Fi(h):a||(a=s&~e,a!==0&&(o=Fi(a)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,a=t&-t,c>=a||c===32&&(a&4194048)!==0)?t:o}function Rl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Fc(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Vo(){var e=Ba;return Ba<<=1,(Ba&62914560)===0&&(Ba=4194304),e}function wr(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function ni(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function an(e,t,a,s,o,c){var h=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var b=e.entanglements,A=e.expirationTimes,U=e.hiddenUpdates;for(a=h&~a;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Jc=/[\n"\\]/g;function Cn(e){return e.replace(Jc,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ws(e,t,a,s,o,c,h,b){e.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.type=h:e.removeAttribute("type"),t!=null?h==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Rn(t)):e.value!==""+Rn(t)&&(e.value=""+Rn(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?zs(e,h,Rn(t)):a!=null?zs(e,h,Rn(a)):s!=null&&e.removeAttribute("value"),o==null&&c!=null&&(e.defaultChecked=!!c),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Rn(b):e.removeAttribute("name")}function Qo(e,t,a,s,o,c,h,b){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||a!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){Ss(e);return}a=a!=null?""+Rn(a):"",t=t!=null?""+Rn(t):a,b||t===e.value||(e.value=t),e.defaultValue=t}s=s??o,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=b?e.checked:!!s,e.defaultChecked=!!s,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),Ss(e)}function zs(e,t,a){t==="number"&&xs(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Ii(e,t,a,s){if(e=e.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ns=!1;if(En)try{var Ja={};Object.defineProperty(Ja,"passive",{get:function(){Ns=!0}}),window.addEventListener("test",Ja,Ja),window.removeEventListener("test",Ja,Ja)}catch{Ns=!1}var Un=null,Wi=null,Ll=null;function Rr(){if(Ll)return Ll;var e,t=Wi,a=t.length,s,o="value"in Un?Un.value:Un.textContent,c=o.length;for(e=0;e=Wa),qr=" ",_a=!1;function Vl(e,t){switch(e){case"keyup":return iu.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lt(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Sa=!1;function kt(e,t){switch(e){case"compositionend":return Lt(t);case"keypress":return t.which!==32?null:(_a=!0,qr);case"textInput":return e=t.data,e===qr&&_a?null:e;default:return null}}function au(e,t){if(Sa)return e==="compositionend"||!Os&&Vl(e,t)?(e=Rr(),Ll=Wi=Un=null,Sa=!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=t)return{node:a,offset:t-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Me(a)}}function ut(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ut(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _t(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=xs(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=xs(e.document)}return t}function Rt(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 et=En&&"documentMode"in document&&11>=document.documentMode,lt=null,hn=null,Ht=null,Tn=!1;function Yn(e,t,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Tn||lt==null||lt!==xs(s)||(s=lt,"selectionStart"in s&&Rt(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}),Ht&&De(Ht,s)||(Ht=s,s=Fu(hn,"onSelect"),0>=h,o-=h,na=1<<32-cn(t)+o|a<Ze?(qe=be,be=null):qe=be.sibling;var Fe=Z(k,be,C[Ze],X);if(Fe===null){be===null&&(be=qe);break}e&&be&&Fe.alternate===null&&t(k,be),M=c(Fe,M,Ze),Ke===null?Ae=Fe:Ke.sibling=Fe,Ke=Fe,be=qe}if(Ze===C.length)return a(k,be),Ge&&za(k,Ze),A)DELIM" -R"DELIM(e;if(be===null){for(;ZeZe?(qe=be,be=null):qe=be.sibling;var xl=Z(k,be,Fe.value,X);if(xl===null){be===null&&(be=qe);break}e&&be&&xl.alternate===null&&t(k,be),M=c(xl,M,Ze),Ke===null?Ae=xl:Ke.sibling=xl,Ke=xl,be=qe}if(Fe.done)return a(k,be),Ge&&za(k,Ze),Ae;if(be===null){for(;!Fe.done;Ze++,Fe=C.next())Fe=P(k,Fe.value,X),Fe!==null&&(M=c(Fe,M,Ze),Ke===null?Ae=Fe:Ke.sibling=Fe,Ke=Fe);return Ge&&za(k,Ze),Ae}for(be=s(be);!Fe.done;Ze++,Fe=C.next())Fe=q(be,k,Ze,Fe.value,X),Fe!==null&&(e&&Fe.alternate!==null&&be.delete(Fe.key===null?Ze:Fe.key),M=c(Fe,M,Ze),Ke===null?Ae=Fe:Ke.sibling=Fe,Ke=Fe);return e&&be.forEach(function(N_){return t(k,N_)}),Ge&&za(k,Ze),Ae}function dt(k,M,C,X){if(typeof C=="object"&&C!==null&&C.type===L&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case T:e:{for(var Ae=C.key;M!==null;){if(M.key===Ae){if(Ae=C.type,Ae===L){if(M.tag===7){a(k,M.sibling),X=o(M,C.props.children),X.return=k,k=X;break e}}else if(M.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===le&&Il(Ae)===M.type){a(k,M.sibling),X=o(M,C.props),Fr(X,C),X.return=k,k=X;break e}a(k,M);break}else t(k,M);M=M.sibling}C.type===L?(X=Ql(C.props.children,k.mode,X,C.key),X.return=k,k=X):(X=fu(C.type,C.key,C.props,null,k.mode,X),Fr(X,C),X.return=k,k=X)}return h(k);case j:e:{for(Ae=C.key;M!==null;){if(M.key===Ae)if(M.tag===4&&M.stateNode.containerInfo===C.containerInfo&&M.stateNode.implementation===C.implementation){a(k,M.sibling),X=o(M,C.children||[]),X.return=k,k=X;break e}else{a(k,M);break}else t(k,M);M=M.sibling}X=of(C,k.mode,X),X.return=k,k=X}return h(k);case le:return C=Il(C),dt(k,M,C,X)}if(he(C))return me(k,M,C,X);if(_e(C)){if(Ae=_e(C),typeof Ae!="function")throw Error(r(150));return C=Ae.call(C),je(k,M,C,X)}if(typeof C.then=="function")return dt(k,M,yu(C),X);if(C.$$typeof===W)return dt(k,M,mu(k,C),X);bu(k,C)}return typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint"?(C=""+C,M!==null&&M.tag===6?(a(k,M.sibling),X=o(M,C),X.return=k,k=X):(a(k,M),X=rf(C,k.mode,X),X.return=k,k=X),h(k)):a(k,M)}return function(k,M,C,X){try{Kr=0;var Ae=dt(k,M,C,X);return Ls=null,Ae}catch(be){if(be===$s||be===gu)throw be;var Ke=li(29,be,null,k.mode);return Ke.lanes=X,Ke.return=k,Ke}}}var Wl=$m(!0),Lm=$m(!1),ll=!1;function _f(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sf(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 sl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function rl(e,t,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ie&2)!==0){var o=s.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),s.pending=t,t=cu(e),xm(e,null,a),t}return uu(e,s,t,a),cu(e)}function Jr(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,ma(e,a)}}function xf(e,t){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var o=null,c=null;if(a=a.firstBaseUpdate,a!==null){do{var h={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};c===null?o=c=h:c=c.next=h,a=a.next}while(a!==null);c===null?o=c=t:c=c.next=t}else o=c=t;a={baseState:s.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var wf=!1;function Xr(){if(wf){var e=Zs;if(e!==null)throw e}}function Ir(e,t,a,s){wf=!1;var o=e.updateQueue;ll=!1;var c=o.firstBaseUpdate,h=o.lastBaseUpdate,b=o.shared.pending;if(b!==null){o.shared.pending=null;var A=b,U=A.next;A.next=null,h===null?c=U:h.next=U,h=A;var F=e.alternate;F!==null&&(F=F.updateQueue,b=F.lastBaseUpdate,b!==h&&(b===null?F.firstBaseUpdate=U:b.next=U,F.lastBaseUpdate=A))}if(c!==null){var P=o.baseState;h=0,F=U=A=null,b=c;do{var Z=b.lane&-536870913,q=Z!==b.lane;if(q?(He&Z)===Z:(s&Z)===Z){Z!==0&&Z===Us&&(wf=!0),F!==null&&(F=F.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var me=e,je=b;Z=t;var dt=a;switch(je.tag){case 1:if(me=je.payload,typeof me=="function"){P=me.call(dt,P,Z);break e}P=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=je.payload,Z=typeof me=="function"?me.call(dt,P,Z):me,Z==null)break e;P=S({},P,Z);break e;case 2:ll=!0}}Z=b.callback,Z!==null&&(e.flags|=64,q&&(e.flags|=8192),q=o.callbacks,q===null?o.callbacks=[Z]:q.push(Z))}else q={lane:Z,tag:b.tag,payload:b.payload,callback:b.callback,next:null},F===null?(U=F=q,A=P):F=F.next=q,h|=Z;if(b=b.next,b===null){if(b=o.shared.pending,b===null)break;q=b,b=q.next,q.next=null,o.lastBaseUpdate=q,o.shared.pending=null}}while(!0);F===null&&(A=P),o.baseState=A,o.firstBaseUpdate=U,o.lastBaseUpdate=F,c===null&&(o.shared.lanes=0),dl|=h,e.lanes=h,e.memoizedState=P}}function Hm(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function qm(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;ec?c:8;var h=D.T,b={};D.T=b,Bf(e,!1,t,a);try{var A=o(),U=D.S;if(U!==null&&U(b,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var F=v1(A,s);eo(e,t,F,ci(e))}else eo(e,t,s,ci(e))}catch(P){eo(e,t,{then:function(){},status:"rejected",reason:P},ci())}finally{Q.p=c,h!==null&&b.types!==null&&(h.types=b.types),D.T=h}}function w1(){}function Hf(e,t,a,s){if(e.tag!==5)throw Error(r(476));var o=bp(e).queue;yp(e,o,t,pe,a===null?w1:function(){return _p(e),a(s)})}function bp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:pe,baseState:pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:pe},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function _p(e){var t=bp(e);t.next===null&&(t=e.alternate.memoizedState),eo(e,t.next.queue,{},ci())}function qf(){return gn(yo)}function Sp(){return Bt().memoizedState}function xp(){return Bt().memoizedState}function z1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=ci();e=sl(a);var s=rl(t,e,a);s!==null&&(In(s,t,a),Jr(s,t,a)),t={cache:gf()},e.payload=t;return}t=t.return}}function E1(e,t,a){var s=ci();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ou(e)?zp(t,a):(a=lf(e,t,a,s),a!==null&&(In(a,e,s),Ep(a,t,s)))}function wp(e,t,a){var s=ci();eo(e,t,a,s)}function eo(e,t,a,s){var o={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ou(e))zp(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,b=c(h,a);if(o.hasEagerState=!0,o.eagerState=b,Re(b,h))return uu(e,t,o,0),pt===null&&ou(),!1}catch{}if(a=lf(e,t,o,s),a!==null)return In(a,e,s),Ep(a,t,s),!0}return!1}function Bf(e,t,a,s){if(s={lane:2,revertLane:_d(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Ou(e)){if(t)throw Error(r(479))}else t=lf(e,a,s,2),t!==null&&In(t,e,2)}function Ou(e){var t=e.alternate;return e===Ue||t!==null&&t===Ue}function zp(e,t){qs=xu=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Ep(e,t,a){if((a&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,ma(e,a)}}var to={readContext:gn,use:Eu,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};to.useEffectEvent=Ct;var Tp={readContext:gn,use:Eu,useCallback:function(e,t){return $n().memoizedState=[e,t===void 0?null:t],e},useContext:gn,useEffect:up,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Au(4194308,4,hp.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Au(4194308,4,e,t)},useInsertionEffect:function(e,t){Au(4,2,e,t)},useMemo:function(e,t){var a=$n();t=t===void 0?null:t;var s=e();if(es){Vt(!0);try{e()}finally{Vt(!1)}}return a.memoizedState=[s,t],s},useReducer:function(e,t,a){var s=$n();if(a!==void 0){var o=a(t);if(es){Vt(!0);try{a(t)}finally{Vt(!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=E1.bind(null,Ue,e),[s.memoizedState,e]},useRef:function(e){var t=$n();return e={current:e},t.memoizedState=e},useState:function(e){e=Df(e);var t=e.queue,a=wp.bind(null,Ue,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:$f,useDeferredValue:function(e,t){var a=$n();return Lf(a,e,t)},useTransition:function(){var e=Df(!1);return e=yp.bind(null,Ue,e.queue,!0,!1),$n().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var s=Ue,o=$n();if(Ge){if(a===void 0)throw Error(r(407));a=a()}else{if(a=t(),pt===null)throw Error(r(349));(He&127)!==0||Km(s,t,a)}o.memoizedState=a;var c={value:a,getSnapshot:t};return o.queue=c,up(Jm.bind(null,s,c,e),[e]),s.flags|=2048,Vs(9,{destroy:void 0},Fm.bind(null,s,c,a,t),null),a},useId:function(){var e=$n(),t=pt.identifierPrefix;if(Ge){var a=ia,s=na;a=(s&~(1<<32-cn(s)-1)).toString(32)+a,t="_"+t+"R_"+a,a=wu++,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[It]=t,c[zn]=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(yn(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&&Ma(t)}}return xt(t),nd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Ma(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(r(166));if(e=ge.current,Cs(t)){if(e=t.stateNode,a=t.memoizedProps,s=null,o=pn,o!==null)switch(o.tag){case 27:case 5:s=o.memoizedProps}e[It]=t,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||Yg(e.nodeValue,a)),e||il(t,!0)}else e=Ju(e).createTextNode(s),e[It]=t,t.stateNode=e}return xt(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(s=Cs(t),a!==null){if(e===null){if(!s)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[It]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;xt(t),e=!1}else a=df(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(ri(t),t):(ri(t),null);if((t.flags&128)!==0)throw Error(r(558))}return xt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Cs(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(r(318));if(o=t.memoizedState,o)DELIM" -R"DELIM(=o!==null?o.dehydrated:null,!o)throw Error(r(317));o[It]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;xt(t),o=!1}else o=df(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(ri(t),t):(ri(t),null)}return ri(t),(t.flags&128)!==0?(t.lanes=a,t):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(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)),a!==e&&a&&(t.child.flags|=8192),Cu(t,t.updateQueue),xt(t),null);case 4:return Ve(),e===null&&zd(t.stateNode.containerInfo),xt(t),null;case 10:return Ta(t.type),xt(t),null;case 19:if($(qt),s=t.memoizedState,s===null)return xt(t),null;if(o=(t.flags&128)!==0,c=s.rendering,c===null)if(o)io(s,!1);else{if(Dt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=Su(e),c!==null){for(t.flags|=128,io(s,!1),e=c.updateQueue,t.updateQueue=e,Cu(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)wm(a,e),a=a.sibling;return Y(qt,qt.current&1|2),Ge&&za(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Te()>Lu&&(t.flags|=128,o=!0,io(s,!1),t.lanes=4194304)}else{if(!o)if(e=Su(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Cu(t,e),io(s,!0),s.tail===null&&s.tailMode==="hidden"&&!c.alternate&&!Ge)return xt(t),null}else 2*Te()-s.renderingStartTime>Lu&&a!==536870912&&(t.flags|=128,o=!0,io(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)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Te(),e.sibling=null,a=qt.current,Y(qt,o?a&1|2:a&1),Ge&&za(t,s.treeForkCount),e):(xt(t),null);case 22:case 23:return ri(t),Ef(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(a&536870912)!==0&&(t.flags&128)===0&&(xt(t),t.subtreeFlags&6&&(t.flags|=8192)):xt(t),a=t.updateQueue,a!==null&&Cu(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==a&&(t.flags|=2048),e!==null&&$(Xl),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ta(Yt),xt(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function M1(e,t){switch(cf(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ta(Yt),Ve(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Mn(t),null;case 31:if(t.memoizedState!==null){if(ri(t),t.alternate===null)throw Error(r(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ri(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $(qt),null;case 4:return Ve(),null;case 10:return Ta(t.type),null;case 22:case 23:return ri(t),Ef(),e!==null&&$(Xl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ta(Yt),null;case 25:return null;default:return null}}function Xp(e,t){switch(cf(t),t.tag){case 3:Ta(Yt),Ve();break;case 26:case 27:case 5:Mn(t);break;case 4:Ve();break;case 31:t.memoizedState!==null&&ri(t);break;case 13:ri(t);break;case 19:$(qt);break;case 10:Ta(t.type);break;case 22:case 23:ri(t),Ef(),e!==null&&$(Xl);break;case 24:Ta(Yt)}}function ao(e,t){try{var a=t.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var o=s.next;a=o;do{if((a.tag&e)===e){s=void 0;var c=a.create,h=a.inst;s=c(),h.destroy=s}a=a.next}while(a!==o)}}catch(b){rt(t,t.return,b)}}function cl(e,t,a){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,b=h.destroy;if(b!==void 0){h.destroy=void 0,o=t;var A=a,U=b;try{U()}catch(F){rt(o,A,F)}}}s=s.next}while(s!==c)}}catch(F){rt(t,t.return,F)}}function Ip(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{qm(t,a)}catch(s){rt(e,e.return,s)}}}function Pp(e,t,a){a.props=ts(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){rt(e,t,s)}}function lo(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof a=="function"?e.refCleanup=a(s):a.current=s}}catch(o){rt(e,t,o)}}function aa(e,t){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(o){rt(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){rt(e,t,o)}else a.current=null}function Wp(e){var t=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(o){rt(e,e.return,o)}}function id(e,t,a){try{var s=e.stateNode;P1(s,e.type,a,t),s[zn]=t}catch(o){rt(e,e.return,o)}}function eg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&vl(e.type)||e.tag===4}function ad(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||eg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&vl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ld(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Dn));else if(s!==4&&(s===27&&vl(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(ld(e,t,a),e=e.sibling;e!==null;)ld(e,t,a),e=e.sibling}function Du(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(s!==4&&(s===27&&vl(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Du(e,t,a),e=e.sibling;e!==null;)Du(e,t,a),e=e.sibling}function tg(e){var t=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);yn(t,s,a),t[It]=e,t[zn]=a}catch(c){rt(e,e.return,c)}}var ja=!1,Ft=!1,sd=!1,ng=typeof WeakSet=="function"?WeakSet:Set,on=null;function j1(e,t){if(e=e.containerInfo,Ad=nc,e=_t(e),Rt(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var o=s.anchorOffset,c=s.focusNode;s=s.focusOffset;try{a.nodeType,c.nodeType}catch{a=null;break e}var h=0,b=-1,A=-1,U=0,F=0,P=e,Z=null;t:for(;;){for(var q;P!==a||o!==0&&P.nodeType!==3||(b=h+o),P!==c||s!==0&&P.nodeType!==3||(A=h+s),P.nodeType===3&&(h+=P.nodeValue.length),(q=P.firstChild)!==null;)Z=P,P=q;for(;;){if(P===e)break t;if(Z===a&&++U===o&&(b=h),Z===c&&++F===s&&(A=h),(q=P.nextSibling)!==null)break;P=Z,Z=P.parentNode}P=q}a=b===-1||A===-1?null:{start:b,end:A}}else a=null}a=a||{start:0,end:0}}else a=null;for(Nd={focusedElem:e,selectionRange:a},nc=!1,on=t;on!==null;)if(t=on,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,on=e;else for(;on!==null;){switch(t=on,c=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a title"))),yn(c,s,a),c[It]=e,$t(c),s=c;break e;case"link":var h=ov("link","href",o).get(s+(a.href||""));if(h){for(var b=0;bdt&&(h=dt,dt=je,je=h);var k=xe(b,je),M=xe(b,dt);if(k&&M&&(q.rangeCount!==1||q.anchorNode!==k.node||q.anchorOffset!==k.offset||q.focusNode!==M.node||q.focusOffset!==M.offset)){var C=P.createRange();C.setStart(k.node,k.offset),q.removeAllRanges(),je>dt?(q.addRange(C),q.extend(M.node,M.offset)):(C.setEnd(M.node,M.offset),q.addRange(C))}}}}for(P=[],q=b;q=q.parentNode;)q.nodeType===1&&P.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;ba?32:a,D.T=null,a=hd,hd=null;var c=ml,h=Ua;if(Pt=0,Fs=ml=null,Ua=0,(Ie&6)!==0)throw Error(r(331));var b=Ie;if(Ie|=4,hg(c.current),cg(c,c.current,h,a),Ie=b,fo(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(nn,c)}catch{}return!0}finally{Q.p=o,D.T=s,jg(e,t)}}function Rg(e,t,a){t=_i(a,t),t=Qf(e.stateNode,t,2),e=rl(e,t,2),e!==null&&(ni(e,2),la(e))}function rt(e,t,a){if(e.tag===3)Rg(e,e,a);else for(;t!==null;){if(t.tag===3){Rg(t,e,a);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(hl===null||!hl.has(s))){e=_i(a,e),a=Cp(2),s=rl(t,a,2),s!==null&&(Dp(a,s,t,e),ni(s,2),la(s));break}}t=t.return}}function vd(e,t,a){var s=e.pingCache;if(s===null){s=e.pingCache=new C1;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(a)||(ud=!0,o.add(a),e=L1.bind(null,e,t,a),t.then(e,e))}function L1(e,t,a){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,pt===e&&(He&a)===a&&(Dt===4||Dt===3&&(He&62914560)===He&&300>Te()-$u?(Ie&2)===0&&Js(e,0):cd|=a,Ks===He&&(Ks=0)),la(e)}function Cg(e,t){t===0&&(t=Vo()),e=Yl(e,t),e!==null&&(ni(e,t),la(e))}function H1(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Cg(e,a)}function q1(e,t){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,o=e.memoizedState;o!==null&&(a=o.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(r(314))}s!==null&&s.delete(t),Cg(e,a)}function B1(e,t){return Xt(e,t)}var Yu=null,Is=null,yd=!1,Qu=!1,bd=!1,gl=0;function la(e){e!==Is&&e.next===null&&(Is===null?Yu=Is=e:Is=Is.next=e),Qu=!0,yd||(yd=!0,G1())}function fo(e,t){if(!bd&&Qu){bd=!0;do for(var a=!1,s=Yu;s!==null;){if(e!==0){var o=s.pendingLanes;if(o===0)var c=0;else{var h=s.suspendedLanes,b=s.pingedLanes;c=(1<<31-cn(42|e)+1)-1,c&=o&~(h&~b),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(a=!0,$g(s,c))}else c=He,c=vs(s,s===pt?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(c&3)===0||Rl(s,c)||(a=!0,$g(s,c));s=s.next}while(a);bd=!1}}function V1(){Dg()}function Dg(){Qu=yd=!1;var e=0;gl!==0&&e_()&&(e=gl);for(var t=Te(),a=null,s=Yu;s!==null;){var o=s.next,c=Ug(s,t);c===0?(s.next=null,a===null?Yu=o:a.next=o,o===null&&(Is=a)):(a=s,(e!==0||(c&3)!==0)&&(Qu=!0)),s=o}Pt!==0&&Pt!==5||fo(e),gl!==0&&(gl=0)}function Ug(e,t){for(var a=e.suspendedLanes,s=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0b)break;var F=A.transferSize,P=A.initiatorType;F&&Qg(P)&&(A=A.responseEnd,h+=F*(A"u"?null:document;function av(e,t,a){var s=Ps;if(s&&typeof t=="string"&&t){var o=Cn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),iv.has(o)||(iv.add(o),e={rel:e,crossOrigin:a,href:t},s.querySelector(o)===null&&(t=s.createElement("link"),yn(t,"link",e),$t(t),s.head.appendChild(t)))}}function u_(e){Za.D(e),av("dns-prefetch",e,null)}function c_(e,t){Za.C(e,t),av("preconnect",e,t)}function f_(e,t,a){Za.L(e,t,a);var s=Ps;if(s&&e&&t){var o='link[rel="preload"][as="'+Cn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Cn(a.imageSizes)+'"]')):o+='[href="'+Cn(e)+'"]';var c=o;switch(t){case"style":c=Ws(e);break;case"script":c=er(e)}Ti.has(c)||(e=S({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Ti.set(c,e),s.querySelector(o)!==null||t==="style"&&s.querySelector(go(c))||t==="script"&&s.querySelector(vo(c))||(t=s.createElement("link"),yn(t,"link",e),$t(t),s.head.appendChild(t)))}}function d_(e,t){Za.m(e,t);var a=Ps;if(a&&e){var s=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Cn(s)+'"][href="'+Cn(e)+'"]',c=o;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=er(e)}if(!Ti.has(c)&&(e=S({rel:"modulepreload",href:e},t),Ti.set(c,e),a.querySelector(o)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(vo(c)))return}s=a.createElement("link"),yn(s,"link",e),$t(s),a.head.appendChild(s)}}}function h_(e,t,a){Za.S(e,t,a);var s=Ps;if(s&&e){var o=gi(s).hoistableStyles,c=Ws(e);t=t||"default";var h=o.get(c);if(!h){var b={loading:0,preload:null};if(h=s.querySelector(go(c)))b.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Ti.get(c))&&Dd(e,a);var A=h=s.createElement("link");$t(A),yn(A,"link",e),A._p=new Promise(function(U,F){A.onload=U,A.onerror=F}),A.addEventListener("load",function(){b.loading|=1}),A.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Iu(h,t,s)}h={type:"stylesheet",instance:h,count:1,state:b},o.set(c,h)}}}function m_(e,t){Za.X(e,t);var a=Ps;if(a&&e){var s=gi(a).hoistableScripts,o=er(e),c=s.get(o);c||(c=a.querySelector(vo(o)),c||(e=S({src:e,async:!0},t),(t=Ti.get(o))&&Ud(e,t),c=a.createElement("script"),$t(c),yn(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function p_(e,t){Za.M(e,t);var a=Ps;if(a&&e){var s=gi(a).hoistableScripts,o=er(e),c=s.get(o);c||(c=a.querySelector(vo(o)),c||(e=S({s)DELIM" -R"DELIM(rc:e,async:!0,type:"module"},t),(t=Ti.get(o))&&Ud(e,t),c=a.createElement("script"),$t(c),yn(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function lv(e,t,a,s){var o=(o=ge.current)?Xu(o):null;if(!o)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Ws(a.href),a=gi(o).hoistableStyles,s=a.get(t),s||(s={type:"style",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Ws(a.href);var c=gi(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(go(e)))&&!c._p&&(h.instance=c,h.state.loading=5),Ti.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Ti.set(e,a),c||g_(o,e,a,h.state))),t&&s===null)throw Error(r(528,""));return h}if(t&&s!==null)throw Error(r(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=er(a),a=gi(o).hoistableScripts,s=a.get(t),s||(s={type:"script",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Ws(e){return'href="'+Cn(e)+'"'}function go(e){return'link[rel="stylesheet"]['+e+"]"}function sv(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function g_(e,t,a,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),yn(t,"link",a),$t(t),e.head.appendChild(t))}function er(e){return'[src="'+Cn(e)+'"]'}function vo(e){return"script[async]"+e}function rv(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Cn(a.href)+'"]');if(s)return t.instance=s,$t(s),s;var o=S({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),$t(s),yn(s,"style",o),Iu(s,a.precedence,e),t.instance=s;case"stylesheet":o=Ws(a.href);var c=e.querySelector(go(o));if(c)return t.state.loading|=4,t.instance=c,$t(c),c;s=sv(a),(o=Ti.get(o))&&Dd(s,o),c=(e.ownerDocument||e).createElement("link"),$t(c);var h=c;return h._p=new Promise(function(b,A){h.onload=b,h.onerror=A}),yn(c,"link",s),t.state.loading|=4,Iu(c,a.precedence,e),t.instance=c;case"script":return c=er(a.src),(o=e.querySelector(vo(c)))?(t.instance=o,$t(o),o):(s=a,(o=Ti.get(c))&&(s=S({},a),Ud(s,o)),e=e.ownerDocument||e,o=e.createElement("script"),$t(o),yn(o,"link",s),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,Iu(s,a.precedence,e));return t.instance}function Iu(e,t,a){for(var s=a.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 v_(e,t,a){if(a===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 cv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function y_(e,t,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=Ws(s.href),c=t.querySelector(go(o));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Wu.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=c,$t(c);return}c=t.ownerDocument||t,s=sv(s),(o=Ti.get(o))&&Dd(s,o),c=c.createElement("link"),$t(c);var h=c;h._p=new Promise(function(b,A){h.onload=b,h.onerror=A}),yn(c,"link",s),a.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Wu.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Zd=0;function b_(e,t){return e.stylesheets&&e.count===0&&tc(e,e.stylesheets),0Zd?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(o)}}:null}function Wu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ec=null;function tc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ec=new Map,t.forEach(__,e),ec=null,Wu.call(e))}function __(e,t){if(!(t.state.loading&4)){var a=ec.get(e);if(a)var s=a.get(null);else{a=new Map,ec.set(e,a);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(),Qd.exports=Z_(),Qd.exports}var L_=$_();const H_=m0(L_),p0="libbitcoinAdminDashboardBrowserNotifications";function g0(){try{return globalThis.window?.localStorage??null}catch{return null}}function Uh(){const n=globalThis.Notification;return typeof n=="function"?n:null}function v0(){return Uh()?.permission??"unsupported"}async function q_(){const n=Uh();return n?n.permission!=="default"?n.permission:n.requestPermission():"unsupported"}function B_(n=g0()){try{return v0()==="granted"&&n?.getItem(p0)==="true"}catch{return!1}}function V_(n,i=g0()){try{i?.setItem(p0,String(n))}catch{}}function G_(n,i){const l=Uh();if(!l||l.permission!=="granted")return!1;try{return new l(n,i),!0}catch{return!1}}const Zh="libbitcoinAdminDashboardEndpoints";function $h(){try{return globalThis.window?.localStorage??null}catch{return null}}function Y_(){return globalThis.window?.location.origin??"http://localhost"}function oa(n){const i=n.trim();if(!i)throw new Error("Endpoint URL is required");const l=/^[a-z][a-z\d+\-.]*:\/\//iu.test(i)?i:`http://${i}`,r=new URL(l);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 Q_(n){const i=new URL(oa(n));return i.protocol=i.protocol==="https:"?"wss:":"ws:",i.pathname="/",i.search="",i.hash="",i.toString()}function K_(n,i=Y_()){return new URL(oa(n)).origin===new URL(i).origin}function y0(){return{adminUrl:oa("http://172.20.208.1:8080"),nativeUrl:oa("http://172.20.208.1:80")}}function F_(n=$h()){const i=y0();try{const l=n?.getItem(Zh);if(!l)return i;const r=JSON.parse(l);if(!r||typeof r!="object"||Array.isArray(r))return i;const u=r;return{adminUrl:typeof u.adminUrl=="string"?oa(u.adminUrl):i.adminUrl,nativeUrl:typeof u.nativeUrl=="string"?oa(u.nativeUrl):i.nativeUrl}}catch{return i}}function J_(n,i=$h()){const l={adminUrl:oa(n.adminUrl),nativeUrl:oa(n.nativeUrl)};try{i?.setItem(Zh,JSON.stringify(l))}catch{}}function X_(n=$h()){try{n?.removeItem(Zh)}catch{}}function I_({configuration:n,browserNotificationsEnabled:i,onClose:l,onBrowserNotificationsEnabledChange:r,onReset:u,onSave:d}){const[f,p]=re.useState(n.adminUrl),[m,v]=re.useState(n.nativeUrl),[w,S]=re.useState(null),[z,T]=re.useState(v0),[j,L]=re.useState(!1),[V,H]=re.useState(null),G=i&&z==="granted";async function W(){if(G){r(!1);return}L(!0),H(null);try{const ne=await q_();T(ne),ne==="granted"?r(!0):ne==="denied"&&H("Permission was denied. It can be changed in your browser settings.")}catch{H("The browser could not enable notifications.")}finally{L(!1)}}function B(ne){ne.preventDefault();try{d({adminUrl:oa(f),nativeUrl:oa(m)})}catch(ee){S(ee instanceof Error?ee.message:"Invalid endpoint configuration")}}return _.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:ne=>{ne.target===ne.currentTarget&&l()},children:_.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"endpoint-settings-title",className:"border-accent/30 bg-surface max-h-[calc(100vh-2rem)] w-full max-w-xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/50",children:[_.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Runtime configuration"}),_.jsx("h2",{id:"endpoint-settings-title",className:"mt-1 text-xl font-semibold",children:"Node endpoints"})]}),_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close endpoint settings",children:"×"})]}),_.jsxs("form",{onSubmit:B,className:"space-y-5 p-5",children:[_.jsxs("label",{className:"block space-y-2",children:[_.jsx("span",{className:"text-textPrimary text-sm font-medium",children:"Admin endpoint"}),_.jsx("input",{value:f,onChange:ne=>{p(ne.target.value)},className:"border-accent/30 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 font-mono text-sm focus:ring-0",placeholder:"http://node-host:admin-port",autoComplete:"url"})]}),_.jsxs("label",{className:"block space-y-2",children:[_.jsx("span",{className:"text-textPrimary text-sm font-medium",children:"Native endpoint"}),_.jsx("input",{value:m,onChange:ne=>{v(ne.target.value)},className:"border-accent/30 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 font-mono text-sm focus:ring-0",placeholder:"http://node-host:native-port",autoComplete:"url"})]}),_.jsxs("div",{className:"border-accent/20 bg-background/35 space-y-3 rounded-xl border p-4",children:[_.jsxs("div",{children:[_.jsx("h3",{className:"text-textPrimary text-sm font-medium",children:"Browser notifications"}),_.jsx("p",{id:"browser-notifications-help",className:"text-textMuted mt-1 text-xs",children:W_(z,G,j)})]}),_.jsx("button",{type:"button","aria-describedby":"browser-notifications-help",disabled:j||z==="unsupported"||z==="denied",onClick:()=>{W()},className:"border-accent/30 text-textMuted hover:border-accent hover:text-accent rounded-lg border px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:P_(z,G,j)}),V&&_.jsx("p",{className:"text-sm text-red-300",role:"alert",children:V})]}),w&&_.jsx("p",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-300",children:w}),_.jsxs("div",{className:"flex flex-wrap justify-between gap-3 pt-2",children:[_.jsx("button",{type:"button",onClick:u,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-4 py-2 text-sm",children:"Reset defaults"}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-textPrimary rounded-lg px-4 py-2 text-sm",children:"Cancel"}),_.jsx("button",{type:"submit",className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold",children:"Save endpoints"})]})]})]})]})})}function P_(n,i,l){return l?"Req)DELIM" -R"DELIM(uesting permission…":n==="unsupported"?"Notifications unavailable":n==="denied"?"Blocked by browser":i?"Disable notifications":"Enable notifications"}function W_(n,i,l){return l?"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."}var Cv;function I(n,i,l){function r(p,m){if(p._zod||Object.defineProperty(p,"_zod",{value:{def:m,constr:f,traits:new Set},enumerable:!1}),p._zod.traits.has(n))return;p._zod.traits.add(n),i(p,m);const v=f.prototype,w=Object.keys(v);for(let S=0;Sl?.Parent&&p instanceof l.Parent?!0:p?._zod?.traits?.has(n)}),Object.defineProperty(f,"name",{value:n}),f}class or extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class b0 extends Error{constructor(i){super(`Encountered unidirectional transform during encode: ${i}`),this.name="ZodEncodeError"}}(Cv=globalThis).__zod_globalConfig??(Cv.__zod_globalConfig={});const Lh=globalThis.__zod_globalConfig;function fs(n){return Lh}function _0(n){const i=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,u])=>i.indexOf(+r)===-1).map(([r,u])=>u)}function uh(n,i){return typeof i=="bigint"?i.toString():i}function Hh(n){return{get value(){{const i=n();return Object.defineProperty(this,"value",{value:i}),i}}}}function qh(n){return n==null}function Bh(n){const i=n.startsWith("^")?1:0,l=n.endsWith("$")?n.length-1:n.length;return n.slice(i,l)}function eS(n,i){const l=n/i,r=Math.round(l),u=Number.EPSILON*Math.max(Math.abs(l),1);return Math.abs(l-r){};function Sc(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const nS=Hh(()=>{if(Lh.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function Co(n){if(Sc(n)===!1)return!1;const i=n.constructor;if(i===void 0||typeof i!="function")return!0;const l=i.prototype;return!(Sc(l)===!1||Object.prototype.hasOwnProperty.call(l,"isPrototypeOf")===!1)}function x0(n){return Co(n)?{...n}:Array.isArray(n)?[...n]:n instanceof Map?new Map(n):n instanceof Set?new Set(n):n}const iS=new Set(["string","number","symbol"]);function dr(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ol(n,i,l){const r=new n._zod.constr(i??n._zod.def);return(!i||l?.parent)&&(r._zod.parent=n),r}function Ne(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 aS(n){return Object.keys(n).filter(i=>n[i]._zod.optin==="optional"&&n[i]._zod.optout==="optional")}const lS={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function sS(n,i){const l=n._zod.def,r=l.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const d=Nl(n._zod.def,{get shape(){const f={};for(const p in i){if(!(p in l.shape))throw new Error(`Unrecognized key: "${p}"`);i[p]&&(f[p]=l.shape[p])}return ms(this,"shape",f),f},checks:[]});return Ol(n,d)}function rS(n,i){const l=n._zod.def,r=l.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const d=Nl(n._zod.def,{get shape(){const f={...n._zod.def.shape};for(const p in i){if(!(p in l.shape))throw new Error(`Unrecognized key: "${p}"`);i[p]&&delete f[p]}return ms(this,"shape",f),f},checks:[]});return Ol(n,d)}function oS(n,i){if(!Co(i))throw new Error("Invalid input to extend: expected a plain object");const l=n._zod.def.checks;if(l&&l.length>0){const d=n._zod.def.shape;for(const f in i)if(Object.getOwnPropertyDescriptor(d,f)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const u=Nl(n._zod.def,{get shape(){const d={...n._zod.def.shape,...i};return ms(this,"shape",d),d}});return Ol(n,u)}function uS(n,i){if(!Co(i))throw new Error("Invalid input to safeExtend: expected a plain object");const l=Nl(n._zod.def,{get shape(){const r={...n._zod.def.shape,...i};return ms(this,"shape",r),r}});return Ol(n,l)}function cS(n,i){if(n._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const l=Nl(n._zod.def,{get shape(){const r={...n._zod.def.shape,...i._zod.def.shape};return ms(this,"shape",r),r},get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return Ol(n,l)}function fS(n,i,l){const u=i._zod.def.checks;if(u&&u.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const f=Nl(i._zod.def,{get shape(){const p=i._zod.def.shape,m={...p};if(l)for(const v in l){if(!(v in p))throw new Error(`Unrecognized key: "${v}"`);l[v]&&(m[v]=n?new n({type:"optional",innerType:p[v]}):p[v])}else for(const v in p)m[v]=n?new n({type:"optional",innerType:p[v]}):p[v];return ms(this,"shape",m),m},checks:[]});return Ol(i,f)}function dS(n,i,l){const r=Nl(i._zod.def,{get shape(){const u=i._zod.def.shape,d={...u};if(l)for(const f in l){if(!(f in d))throw new Error(`Unrecognized key: "${f}"`);l[f]&&(d[f]=new n({type:"nonoptional",innerType:u[f]}))}else for(const f in u)d[f]=new n({type:"nonoptional",innerType:u[f]});return ms(this,"shape",d),d}});return Ol(i,r)}function rr(n,i=0){if(n.aborted===!0)return!0;for(let l=i;l{var r;return(r=l).path??(r.path=[]),l.path.unshift(n),l})}function uc(n){return typeof n=="string"?n:n?.message}function ds(n,i,l){const r=n.message?n.message:uc(n.inst?._zod.def?.error?.(n))??uc(i?.error?.(n))??uc(l.customError?.(n))??uc(l.localeError?.(n))??"Invalid input",{inst:u,continue:d,input:f,...p}=n;return p.path??(p.path=[]),p.message=r,i?.reportInput&&(p.input=f),p}function Vh(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function Do(...n){const[i,l,r]=n;return typeof i=="string"?{message:i,code:"custom",input:l,inst:r}:{...i}}const z0=(n,i)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:i,enumerable:!1}),n.message=JSON.stringify(i,uh,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerab)DELIM" -R"DELIM(le:!1})},E0=I("$ZodError",z0),T0=I("$ZodError",z0,{Parent:Error});function mS(n,i=l=>l.message){const l={},r=[];for(const u of n.issues)u.path.length>0?(l[u.path[0]]=l[u.path[0]]||[],l[u.path[0]].push(i(u))):r.push(i(u));return{formErrors:r,fieldErrors:l}}function pS(n,i=l=>l.message){const l={_errors:[]},r=(u,d=[])=>{for(const f of u.issues)if(f.code==="invalid_union"&&f.errors.length)f.errors.map(p=>r({issues:p},[...d,...f.path]));else if(f.code==="invalid_key")r({issues:f.issues},[...d,...f.path]);else if(f.code==="invalid_element")r({issues:f.issues},[...d,...f.path]);else{const p=[...d,...f.path];if(p.length===0)l._errors.push(i(f));else{let m=l,v=0;for(;v(i,l,r,u)=>{const d=r?{...r,async:!1}:{async:!1},f=i._zod.run({value:l,issues:[]},d);if(f instanceof Promise)throw new or;if(f.issues.length){const p=new(u?.Err??n)(f.issues.map(m=>ds(m,d,fs())));throw S0(p,u?.callee),p}return f.value},Yh=n=>async(i,l,r,u)=>{const d=r?{...r,async:!0}:{async:!0};let f=i._zod.run({value:l,issues:[]},d);if(f instanceof Promise&&(f=await f),f.issues.length){const p=new(u?.Err??n)(f.issues.map(m=>ds(m,d,fs())));throw S0(p,u?.callee),p}return f.value},Uc=n=>(i,l,r)=>{const u=r?{...r,async:!1}:{async:!1},d=i._zod.run({value:l,issues:[]},u);if(d instanceof Promise)throw new or;return d.issues.length?{success:!1,error:new(n??E0)(d.issues.map(f=>ds(f,u,fs())))}:{success:!0,data:d.value}},gS=Uc(T0),Zc=n=>async(i,l,r)=>{const u=r?{...r,async:!0}:{async:!0};let d=i._zod.run({value:l,issues:[]},u);return d instanceof Promise&&(d=await d),d.issues.length?{success:!1,error:new n(d.issues.map(f=>ds(f,u,fs())))}:{success:!0,data:d.value}},vS=Zc(T0),yS=n=>(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Gh(n)(i,l,u)},bS=n=>(i,l,r)=>Gh(n)(i,l,r),_S=n=>async(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Yh(n)(i,l,u)},SS=n=>async(i,l,r)=>Yh(n)(i,l,r),xS=n=>(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Uc(n)(i,l,u)},wS=n=>(i,l,r)=>Uc(n)(i,l,r),zS=n=>async(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Zc(n)(i,l,u)},ES=n=>async(i,l,r)=>Zc(n)(i,l,r),TS=/^[cC][0-9a-z]{6,}$/,AS=/^[0-9a-z]+$/,NS=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,OS=/^[0-9a-vA-V]{20}$/,MS=/^[A-Za-z0-9]{27}$/,jS=/^[a-zA-Z0-9_-]{21}$/,kS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,RS=/^([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})$/,Zv=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)$/,CS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,DS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function US(){return new RegExp(DS,"u")}const ZS=/^(?:(?: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])$/,$S=/^(([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}|:))$/,LS=/^((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])$/,HS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,A0=/^[A-Za-z0-9_-]*$/,BS=/^https?$/,VS=/^\+[1-9]\d{6,14}$/,N0="(?:(?:\\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])))",GS=new RegExp(`^${N0}$`);function O0(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}}`:`${i}(?::[0-5]\\d(?:\\.\\d+)?)?`}function YS(n){return new RegExp(`^${O0(n)}$`)}function QS(n){const i=O0({precision:n.precision}),l=["Z"];n.local&&l.push(""),n.offset&&l.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${i}(?:${l.join("|")})`;return new RegExp(`^${N0}T(?:${r})$`)}const KS=n=>{const i=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${i}$`)},FS=/^-?\d+$/,JS=/^-?\d+(?:\.\d+)?$/,XS=/^(?:true|false)$/i,IS=/^[^A-Z]*$/,PS=/^[^a-z]*$/,Wn=I("$ZodCheck",(n,i)=>{var l;n._zod??(n._zod={}),n._zod.def=i,(l=n._zod).onattach??(l.onattach=[])}),M0={number:"number",bigint:"bigint",object:"date"},j0=I("$ZodCheckLessThan",(n,i)=>{Wn.init(n,i);const l=M0[typeof i.value];n._zod.onattach.push(r=>{const u=r._zod.bag,d=(i.inclusive?u.maximum:u.exclusiveMaximum)??Number.POSITIVE_INFINITY;i.value{(i.inclusive?r.value<=i.value:r.value{Wn.init(n,i);const l=M0[typeof i.value];n._zod.onattach.push(r=>{const u=r._zod.bag,d=(i.inclusive?u.minimum:u.exclusiveMinimum)??Number.NEGATIVE_INFINITY;i.value>d&&(i.inclusive?u.minimum=i.value:u.exclusiveMinimum=i.value)}),n._zod.check=r=>{(i.inclusive?r.value>=i.value:r.value>i.value)||r.issues.push({origin:l,code:"too_small",minimum:typeof i.value=="object"?i.value.getTime():i.value,input:r.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),WS=I("$ZodCheckMultipleOf",(n,i)=>{Wn.init(n,i),n._zod.onattach.push(l=>{var r;(r=l._zod.bag).multipleOf??(r.multipleOf=i.value)}),n._zod.check=l=>{if(typeof l.value!=typeof i.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof l.value=="bigint"?l.value%i.value===BigInt(0):eS(l.value,i.value)===0)||l.issues.push({origin:typeof l.value,code:"not_multiple_of",divisor:i.value,input:l.value,inst:n,continue:!i.abort})}}),ex=I("$ZodCheckNumberFormat",(n,i)=>{Wn.init(n,i),i.format=i.format||"float64";const l=i.format?.includes("int"),r=l?"int":"number",[u,d]=lS[i.format];n._zod.onattach.push(f=>{const p=f._zod.bag;p.format=i.format,p.minimum=u,p.maximum=d,l&&(p.pattern=FS)}),n._zod.check=f=>{const p=f.value;if(l){if(!Number.isInteger(p)){f.issues.push({expected:r,format:i.format,code:"invalid_type",continue:!1,input:p,inst:n});return}if(!Number.isSafeInteger(p)){p>0?f.issues.push({input:p,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!i.abort}):f.issues.push({input:p,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!i.abort});return}}pd&&f.issues.push({origin:"number",input:p,code:"too_big",maximum:d,inclusive:!0,inst:n,continue:!i.abort})}}),tx=I("$ZodCheckMaxLength",(n,i)=>{var l;Wn.init(n,i),(l=n._zod.def).when??(l.when=r=>{const u=r.value;return!qh(u)&&u.length!==void 0}),n._zod.onattach.push(r=>{const u=r._zod.bag.maximum??Number.POSITIVE_INFINITY;i.maximum{const u=r.value;if(u.length<=i.maximum)return;const f=Vh(u);r.issues.push({origin:f,code:"too_big",maximum:i.maximum)DELIM" -R"DELIM(,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),nx=I("$ZodCheckMinLength",(n,i)=>{var l;Wn.init(n,i),(l=n._zod.def).when??(l.when=r=>{const u=r.value;return!qh(u)&&u.length!==void 0}),n._zod.onattach.push(r=>{const u=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;i.minimum>u&&(r._zod.bag.minimum=i.minimum)}),n._zod.check=r=>{const u=r.value;if(u.length>=i.minimum)return;const f=Vh(u);r.issues.push({origin:f,code:"too_small",minimum:i.minimum,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),ix=I("$ZodCheckLengthEquals",(n,i)=>{var l;Wn.init(n,i),(l=n._zod.def).when??(l.when=r=>{const u=r.value;return!qh(u)&&u.length!==void 0}),n._zod.onattach.push(r=>{const u=r._zod.bag;u.minimum=i.length,u.maximum=i.length,u.length=i.length}),n._zod.check=r=>{const u=r.value,d=u.length;if(d===i.length)return;const f=Vh(u),p=d>i.length;r.issues.push({origin:f,...p?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!i.abort})}}),$c=I("$ZodCheckStringFormat",(n,i)=>{var l,r;Wn.init(n,i),n._zod.onattach.push(u=>{const d=u._zod.bag;d.format=i.format,i.pattern&&(d.patterns??(d.patterns=new Set),d.patterns.add(i.pattern))}),i.pattern?(l=n._zod).check??(l.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})}):(r=n._zod).check??(r.check=()=>{})}),ax=I("$ZodCheckRegex",(n,i)=>{$c.init(n,i),n._zod.check=l=>{i.pattern.lastIndex=0,!i.pattern.test(l.value)&&l.issues.push({origin:"string",code:"invalid_format",format:"regex",input:l.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),lx=I("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=IS),$c.init(n,i)}),sx=I("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=PS),$c.init(n,i)}),rx=I("$ZodCheckIncludes",(n,i)=>{Wn.init(n,i);const l=dr(i.includes),r=new RegExp(typeof i.position=="number"?`^.{${i.position}}${l}`:l);i.pattern=r,n._zod.onattach.push(u=>{const d=u._zod.bag;d.patterns??(d.patterns=new Set),d.patterns.add(r)}),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})}}),ox=I("$ZodCheckStartsWith",(n,i)=>{Wn.init(n,i);const l=new RegExp(`^${dr(i.prefix)}.*`);i.pattern??(i.pattern=l),n._zod.onattach.push(r=>{const u=r._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(l)}),n._zod.check=r=>{r.value.startsWith(i.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:r.value,inst:n,continue:!i.abort})}}),ux=I("$ZodCheckEndsWith",(n,i)=>{Wn.init(n,i);const l=new RegExp(`.*${dr(i.suffix)}$`);i.pattern??(i.pattern=l),n._zod.onattach.push(r=>{const u=r._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(l)}),n._zod.check=r=>{r.value.endsWith(i.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:r.value,inst:n,continue:!i.abort})}}),cx=I("$ZodCheckOverwrite",(n,i)=>{Wn.init(n,i),n._zod.check=l=>{l.value=i.tx(l.value)}});class fx{constructor(i=[]){this.content=[],this.indent=0,this&&(this.args=i)}indented(i){this.indent+=1,i(this),this.indent-=1}write(i){if(typeof i=="function"){i(this,{execution:"sync"}),i(this,{execution:"async"});return}const r=i.split(` +`+s.stack}}var ji=Object.prototype.hasOwnProperty,Xt=n.unstable_scheduleCallback,Ki=n.unstable_cancelCallback,ki=n.unstable_shouldYield,oa=n.unstable_requestPaint,Te=n.unstable_now,fe=n.unstable_getCurrentPriorityLevel,it=n.unstable_ImmediatePriority,Ot=n.unstable_UserBlockingPriority,Ri=n.unstable_NormalPriority,ua=n.unstable_LowPriority,ti=n.unstable_IdlePriority,ca=n.log,kn=n.unstable_setDisableYieldValue,nn=null,ot=null;function Vt(e){if(typeof ca=="function"&&kn(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(nn,e)}catch{}}var cn=Math.clz32?Math.clz32:fa,gs=Math.log,qa=Math.LN2;function fa(e){return e>>>=0,e===0?32:31-(gs(e)/qa|0)|0}var da=256,fn=262144,Ba=4194304;function Fi(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 655)DELIM" +R"DELIM(36:case 131072:return e&261888;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 vs(e,t,a){var s=e.pendingLanes;if(s===0)return 0;var o=0,c=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var b=s&134217727;return b!==0?(s=b&~c,s!==0?o=Fi(s):(h&=b,h!==0?o=Fi(h):a||(a=b&~e,a!==0&&(o=Fi(a))))):(b=s&~c,b!==0?o=Fi(b):h!==0?o=Fi(h):a||(a=s&~e,a!==0&&(o=Fi(a)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,a=t&-t,c>=a||c===32&&(a&4194048)!==0)?t:o}function Rl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Fc(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Vo(){var e=Ba;return Ba<<=1,(Ba&62914560)===0&&(Ba=4194304),e}function wr(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function ni(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function an(e,t,a,s,o,c){var h=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var b=e.entanglements,A=e.expirationTimes,U=e.hiddenUpdates;for(a=h&~a;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Jc=/[\n"\\]/g;function Cn(e){return e.replace(Jc,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ws(e,t,a,s,o,c,h,b){e.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.type=h:e.removeAttribute("type"),t!=null?h==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Rn(t)):e.value!==""+Rn(t)&&(e.value=""+Rn(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?zs(e,h,Rn(t)):a!=null?zs(e,h,Rn(a)):s!=null&&e.removeAttribute("value"),o==null&&c!=null&&(e.defaultChecked=!!c),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Rn(b):e.removeAttribute("name")}function Qo(e,t,a,s,o,c,h,b){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||a!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){Ss(e);return}a=a!=null?""+Rn(a):"",t=t!=null?""+Rn(t):a,b||t===e.value||(e.value=t),e.defaultValue=t}s=s??o,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=b?e.checked:!!s,e.defaultChecked=!!s,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),Ss(e)}function zs(e,t,a){t==="number"&&xs(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Ii(e,t,a,s){if(e=e.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ns=!1;if(En)try{var Ja={};Object.defineProperty(Ja,"passive",{get:function(){Ns=!0}}),window.addEventListener("test",Ja,Ja),window.removeEventListener("test",Ja,Ja)}catch{Ns=!1}var Un=null,Wi=null,Ll=null;function Rr(){if(Ll)return Ll;var e,t=Wi,a=t.length,s,o="value"in Un?Un.value:Un.textContent,c=o.length;for(e=0;e=Wa),qr=" ",ba=!1;function Vl(e,t){switch(e){case"keyup":return iu.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lt(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _a=!1;function kt(e,t){switch(e){case"compositionend":return Lt(t);case"keypress":return t.which!==32?null:(ba=!0,qr);case"textInput":return e=t.data,e===qr&&ba?null:e;default:return null}}function au(e,t){if(_a)return e==="compositionend"||!Ms&&Vl(e,t)?(e=Rr(),Ll=Wi=Un=null,_a=!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=t)return{node:a,offset:t-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Oe(a)}}function ut(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ut(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _t(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=xs(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=xs(e.document)}return t}function Rt(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 et=En&&"documentMode"in document&&11>=document.documentMode,lt=null,hn=null,Ht=null,Tn=!1;function Yn(e,t,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Tn||lt==null||lt!==xs(s)||(s=lt,"selectionStart"in s&&Rt(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}),Ht&&De(Ht,s)||(Ht=s,s=Fu(hn,"onSelect"),0>=h,o-=h,na=1<<32-cn(t)+o|a<Ze?(qe=be,be=null):qe=be.sibling;var Fe=Z(k,be,C[Ze],X);if(Fe===null){be===null&&(be=qe);break}e&&be&&Fe.alternate===null&&t(k,be),O=c(Fe,O,Ze),Ke===null?Ae=Fe:Ke.sibling=Fe,Ke=Fe,be=qe}if(Ze===C.length)return a(k,be),Ge&&wa(k,Ze),A)DELIM" +R"DELIM(e;if(be===null){for(;ZeZe?(qe=be,be=null):qe=be.sibling;var xl=Z(k,be,Fe.value,X);if(xl===null){be===null&&(be=qe);break}e&&be&&xl.alternate===null&&t(k,be),O=c(xl,O,Ze),Ke===null?Ae=xl:Ke.sibling=xl,Ke=xl,be=qe}if(Fe.done)return a(k,be),Ge&&wa(k,Ze),Ae;if(be===null){for(;!Fe.done;Ze++,Fe=C.next())Fe=P(k,Fe.value,X),Fe!==null&&(O=c(Fe,O,Ze),Ke===null?Ae=Fe:Ke.sibling=Fe,Ke=Fe);return Ge&&wa(k,Ze),Ae}for(be=s(be);!Fe.done;Ze++,Fe=C.next())Fe=q(be,k,Ze,Fe.value,X),Fe!==null&&(e&&Fe.alternate!==null&&be.delete(Fe.key===null?Ze:Fe.key),O=c(Fe,O,Ze),Ke===null?Ae=Fe:Ke.sibling=Fe,Ke=Fe);return e&&be.forEach(function(O_){return t(k,O_)}),Ge&&wa(k,Ze),Ae}function dt(k,O,C,X){if(typeof C=="object"&&C!==null&&C.type===L&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case T:e:{for(var Ae=C.key;O!==null;){if(O.key===Ae){if(Ae=C.type,Ae===L){if(O.tag===7){a(k,O.sibling),X=o(O,C.props.children),X.return=k,k=X;break e}}else if(O.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===le&&Il(Ae)===O.type){a(k,O.sibling),X=o(O,C.props),Fr(X,C),X.return=k,k=X;break e}a(k,O);break}else t(k,O);O=O.sibling}C.type===L?(X=Ql(C.props.children,k.mode,X,C.key),X.return=k,k=X):(X=fu(C.type,C.key,C.props,null,k.mode,X),Fr(X,C),X.return=k,k=X)}return h(k);case j:e:{for(Ae=C.key;O!==null;){if(O.key===Ae)if(O.tag===4&&O.stateNode.containerInfo===C.containerInfo&&O.stateNode.implementation===C.implementation){a(k,O.sibling),X=o(O,C.children||[]),X.return=k,k=X;break e}else{a(k,O);break}else t(k,O);O=O.sibling}X=of(C,k.mode,X),X.return=k,k=X}return h(k);case le:return C=Il(C),dt(k,O,C,X)}if(he(C))return me(k,O,C,X);if(_e(C)){if(Ae=_e(C),typeof Ae!="function")throw Error(r(150));return C=Ae.call(C),je(k,O,C,X)}if(typeof C.then=="function")return dt(k,O,yu(C),X);if(C.$$typeof===W)return dt(k,O,mu(k,C),X);bu(k,C)}return typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint"?(C=""+C,O!==null&&O.tag===6?(a(k,O.sibling),X=o(O,C),X.return=k,k=X):(a(k,O),X=rf(C,k.mode,X),X.return=k,k=X),h(k)):a(k,O)}return function(k,O,C,X){try{Kr=0;var Ae=dt(k,O,C,X);return Ls=null,Ae}catch(be){if(be===$s||be===gu)throw be;var Ke=li(29,be,null,k.mode);return Ke.lanes=X,Ke.return=k,Ke}}}var Wl=Lm(!0),Hm=Lm(!1),ll=!1;function _f(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sf(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 sl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function rl(e,t,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ie&2)!==0){var o=s.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),s.pending=t,t=cu(e),wm(e,null,a),t}return uu(e,s,t,a),cu(e)}function Jr(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,ha(e,a)}}function xf(e,t){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var o=null,c=null;if(a=a.firstBaseUpdate,a!==null){do{var h={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};c===null?o=c=h:c=c.next=h,a=a.next}while(a!==null);c===null?o=c=t:c=c.next=t}else o=c=t;a={baseState:s.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var wf=!1;function Xr(){if(wf){var e=Zs;if(e!==null)throw e}}function Ir(e,t,a,s){wf=!1;var o=e.updateQueue;ll=!1;var c=o.firstBaseUpdate,h=o.lastBaseUpdate,b=o.shared.pending;if(b!==null){o.shared.pending=null;var A=b,U=A.next;A.next=null,h===null?c=U:h.next=U,h=A;var F=e.alternate;F!==null&&(F=F.updateQueue,b=F.lastBaseUpdate,b!==h&&(b===null?F.firstBaseUpdate=U:b.next=U,F.lastBaseUpdate=A))}if(c!==null){var P=o.baseState;h=0,F=U=A=null,b=c;do{var Z=b.lane&-536870913,q=Z!==b.lane;if(q?(He&Z)===Z:(s&Z)===Z){Z!==0&&Z===Us&&(wf=!0),F!==null&&(F=F.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var me=e,je=b;Z=t;var dt=a;switch(je.tag){case 1:if(me=je.payload,typeof me=="function"){P=me.call(dt,P,Z);break e}P=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=je.payload,Z=typeof me=="function"?me.call(dt,P,Z):me,Z==null)break e;P=S({},P,Z);break e;case 2:ll=!0}}Z=b.callback,Z!==null&&(e.flags|=64,q&&(e.flags|=8192),q=o.callbacks,q===null?o.callbacks=[Z]:q.push(Z))}else q={lane:Z,tag:b.tag,payload:b.payload,callback:b.callback,next:null},F===null?(U=F=q,A=P):F=F.next=q,h|=Z;if(b=b.next,b===null){if(b=o.shared.pending,b===null)break;q=b,b=q.next,q.next=null,o.lastBaseUpdate=q,o.shared.pending=null}}while(!0);F===null&&(A=P),o.baseState=A,o.firstBaseUpdate=U,o.lastBaseUpdate=F,c===null&&(o.shared.lanes=0),dl|=h,e.lanes=h,e.memoizedState=P}}function qm(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function Bm(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;ec?c:8;var h=D.T,b={};D.T=b,Bf(e,!1,t,a);try{var A=o(),U=D.S;if(U!==null&&U(b,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var F=b1(A,s);eo(e,t,F,ci(e))}else eo(e,t,s,ci(e))}catch(P){eo(e,t,{then:function(){},status:"rejected",reason:P},ci())}finally{Q.p=c,h!==null&&b.types!==null&&(h.types=b.types),D.T=h}}function E1(){}function Hf(e,t,a,s){if(e.tag!==5)throw Error(r(476));var o=_p(e).queue;bp(e,o,t,pe,a===null?E1:function(){return Sp(e),a(s)})}function _p(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:pe,baseState:pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Aa,lastRenderedState:pe},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Aa,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Sp(e){var t=_p(e);t.next===null&&(t=e.alternate.memoizedState),eo(e,t.next.queue,{},ci())}function qf(){return gn(yo)}function xp(){return Bt().memoizedState}function wp(){return Bt().memoizedState}function T1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=ci();e=sl(a);var s=rl(t,e,a);s!==null&&(In(s,t,a),Jr(s,t,a)),t={cache:gf()},e.payload=t;return}t=t.return}}function A1(e,t,a){var s=ci();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Mu(e)?Ep(t,a):(a=lf(e,t,a,s),a!==null&&(In(a,e,s),Tp(a,t,s)))}function zp(e,t,a){var s=ci();eo(e,t,a,s)}function eo(e,t,a,s){var o={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Mu(e))Ep(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,b=c(h,a);if(o.hasEagerState=!0,o.eagerState=b,Re(b,h))return uu(e,t,o,0),pt===null&&ou(),!1}catch{}if(a=lf(e,t,o,s),a!==null)return In(a,e,s),Tp(a,t,s),!0}return!1}function Bf(e,t,a,s){if(s={lane:2,revertLane:_d(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Mu(e)){if(t)throw Error(r(479))}else t=lf(e,a,s,2),t!==null&&In(t,e,2)}function Mu(e){var t=e.alternate;return e===Ue||t!==null&&t===Ue}function Ep(e,t){qs=xu=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Tp(e,t,a){if((a&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,ha(e,a)}}var to={readContext:gn,use:Eu,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};to.useEffectEvent=Ct;var Ap={readContext:gn,use:Eu,useCallback:function(e,t){return $n().memoizedState=[e,t===void 0?null:t],e},useContext:gn,useEffect:cp,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Au(4194308,4,mp.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Au(4194308,4,e,t)},useInsertionEffect:function(e,t){Au(4,2,e,t)},useMemo:function(e,t){var a=$n();t=t===void 0?null:t;var s=e();if(es){Vt(!0);try{e()}finally{Vt(!1)}}return a.memoizedState=[s,t],s},useReducer:function(e,t,a){var s=$n();if(a!==void 0){var o=a(t);if(es){Vt(!0);try{a(t)}finally{Vt(!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=A1.bind(null,Ue,e),[s.memoizedState,e]},useRef:function(e){var t=$n();return e={current:e},t.memoizedState=e},useState:function(e){e=Df(e);var t=e.queue,a=zp.bind(null,Ue,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:$f,useDeferredValue:function(e,t){var a=$n();return Lf(a,e,t)},useTransition:function(){var e=Df(!1);return e=bp.bind(null,Ue,e.queue,!0,!1),$n().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var s=Ue,o=$n();if(Ge){if(a===void 0)throw Error(r(407));a=a()}else{if(a=t(),pt===null)throw Error(r(349));(He&127)!==0||Fm(s,t,a)}o.memoizedState=a;var c={value:a,getSnapshot:t};return o.queue=c,cp(Xm.bind(null,s,c,e),[e]),s.flags|=2048,Vs(9,{destroy:void 0},Jm.bind(null,s,c,a,t),null),a},useId:function(){var e=$n(),t=pt.identifierPrefix;if(Ge){var a=ia,s=na;a=(s&~(1<<32-cn(s)-1)).toString(32)+a,t="_"+t+"R_"+a,a=wu++,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[It]=t,c[zn]=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(yn(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&&Ma(t)}}return xt(t),nd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Ma(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(r(166));if(e=ge.current,Cs(t)){if(e=t.stateNode,a=t.memoizedProps,s=null,o=pn,o!==null)switch(o.tag){case 27:case 5:s=o.memoizedProps}e[It]=t,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||Qg(e.nodeValue,a)),e||il(t,!0)}else e=Ju(e).createTextNode(s),e[It]=t,t.stateNode=e}return xt(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(s=Cs(t),a!==null){if(e===null){if(!s)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[It]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;xt(t),e=!1}else a=df(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(ri(t),t):(ri(t),null);if((t.flags&128)!==0)throw Error(r(558))}return xt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Cs(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(r(318));if(o=t.memoizedState,o)DELIM" +R"DELIM(=o!==null?o.dehydrated:null,!o)throw Error(r(317));o[It]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;xt(t),o=!1}else o=df(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(ri(t),t):(ri(t),null)}return ri(t),(t.flags&128)!==0?(t.lanes=a,t):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(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)),a!==e&&a&&(t.child.flags|=8192),Cu(t,t.updateQueue),xt(t),null);case 4:return Ve(),e===null&&zd(t.stateNode.containerInfo),xt(t),null;case 10:return Ea(t.type),xt(t),null;case 19:if($(qt),s=t.memoizedState,s===null)return xt(t),null;if(o=(t.flags&128)!==0,c=s.rendering,c===null)if(o)io(s,!1);else{if(Dt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=Su(e),c!==null){for(t.flags|=128,io(s,!1),e=c.updateQueue,t.updateQueue=e,Cu(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)zm(a,e),a=a.sibling;return Y(qt,qt.current&1|2),Ge&&wa(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Te()>Lu&&(t.flags|=128,o=!0,io(s,!1),t.lanes=4194304)}else{if(!o)if(e=Su(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Cu(t,e),io(s,!0),s.tail===null&&s.tailMode==="hidden"&&!c.alternate&&!Ge)return xt(t),null}else 2*Te()-s.renderingStartTime>Lu&&a!==536870912&&(t.flags|=128,o=!0,io(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)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Te(),e.sibling=null,a=qt.current,Y(qt,o?a&1|2:a&1),Ge&&wa(t,s.treeForkCount),e):(xt(t),null);case 22:case 23:return ri(t),Ef(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(a&536870912)!==0&&(t.flags&128)===0&&(xt(t),t.subtreeFlags&6&&(t.flags|=8192)):xt(t),a=t.updateQueue,a!==null&&Cu(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==a&&(t.flags|=2048),e!==null&&$(Xl),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ea(Yt),xt(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function k1(e,t){switch(cf(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ea(Yt),Ve(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return On(t),null;case 31:if(t.memoizedState!==null){if(ri(t),t.alternate===null)throw Error(r(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ri(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $(qt),null;case 4:return Ve(),null;case 10:return Ea(t.type),null;case 22:case 23:return ri(t),Ef(),e!==null&&$(Xl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ea(Yt),null;case 25:return null;default:return null}}function Ip(e,t){switch(cf(t),t.tag){case 3:Ea(Yt),Ve();break;case 26:case 27:case 5:On(t);break;case 4:Ve();break;case 31:t.memoizedState!==null&&ri(t);break;case 13:ri(t);break;case 19:$(qt);break;case 10:Ea(t.type);break;case 22:case 23:ri(t),Ef(),e!==null&&$(Xl);break;case 24:Ea(Yt)}}function ao(e,t){try{var a=t.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var o=s.next;a=o;do{if((a.tag&e)===e){s=void 0;var c=a.create,h=a.inst;s=c(),h.destroy=s}a=a.next}while(a!==o)}}catch(b){rt(t,t.return,b)}}function cl(e,t,a){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,b=h.destroy;if(b!==void 0){h.destroy=void 0,o=t;var A=a,U=b;try{U()}catch(F){rt(o,A,F)}}}s=s.next}while(s!==c)}}catch(F){rt(t,t.return,F)}}function Pp(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Bm(t,a)}catch(s){rt(e,e.return,s)}}}function Wp(e,t,a){a.props=ts(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){rt(e,t,s)}}function lo(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof a=="function"?e.refCleanup=a(s):a.current=s}}catch(o){rt(e,t,o)}}function aa(e,t){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(o){rt(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){rt(e,t,o)}else a.current=null}function eg(e){var t=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(o){rt(e,e.return,o)}}function id(e,t,a){try{var s=e.stateNode;e_(s,e.type,a,t),s[zn]=t}catch(o){rt(e,e.return,o)}}function tg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&vl(e.type)||e.tag===4}function ad(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||tg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&vl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ld(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Dn));else if(s!==4&&(s===27&&vl(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(ld(e,t,a),e=e.sibling;e!==null;)ld(e,t,a),e=e.sibling}function Du(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(s!==4&&(s===27&&vl(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Du(e,t,a),e=e.sibling;e!==null;)Du(e,t,a),e=e.sibling}function ng(e){var t=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);yn(t,s,a),t[It]=e,t[zn]=a}catch(c){rt(e,e.return,c)}}var Oa=!1,Ft=!1,sd=!1,ig=typeof WeakSet=="function"?WeakSet:Set,on=null;function R1(e,t){if(e=e.containerInfo,Ad=nc,e=_t(e),Rt(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var o=s.anchorOffset,c=s.focusNode;s=s.focusOffset;try{a.nodeType,c.nodeType}catch{a=null;break e}var h=0,b=-1,A=-1,U=0,F=0,P=e,Z=null;t:for(;;){for(var q;P!==a||o!==0&&P.nodeType!==3||(b=h+o),P!==c||s!==0&&P.nodeType!==3||(A=h+s),P.nodeType===3&&(h+=P.nodeValue.length),(q=P.firstChild)!==null;)Z=P,P=q;for(;;){if(P===e)break t;if(Z===a&&++U===o&&(b=h),Z===c&&++F===s&&(A=h),(q=P.nextSibling)!==null)break;P=Z,Z=P.parentNode}P=q}a=b===-1||A===-1?null:{start:b,end:A}}else a=null}a=a||{start:0,end:0}}else a=null;for(Nd={focusedElem:e,selectionRange:a},nc=!1,on=t;on!==null;)if(t=on,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,on=e;else for(;on!==null;){switch(t=on,c=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a title"))),yn(c,s,a),c[It]=e,$t(c),s=c;break e;case"link":var h=uv("link","href",o).get(s+(a.href||""));if(h){for(var b=0;bdt&&(h=dt,dt=je,je=h);var k=xe(b,je),O=xe(b,dt);if(k&&O&&(q.rangeCount!==1||q.anchorNode!==k.node||q.anchorOffset!==k.offset||q.focusNode!==O.node||q.focusOffset!==O.offset)){var C=P.createRange();C.setStart(k.node,k.offset),q.removeAllRanges(),je>dt?(q.addRange(C),q.extend(O.node,O.offset)):(C.setEnd(O.node,O.offset),q.addRange(C))}}}}for(P=[],q=b;q=q.parentNode;)q.nodeType===1&&P.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;ba?32:a,D.T=null,a=hd,hd=null;var c=ml,h=Da;if(Pt=0,Fs=ml=null,Da=0,(Ie&6)!==0)throw Error(r(331));var b=Ie;if(Ie|=4,mg(c.current),fg(c,c.current,h,a),Ie=b,fo(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(nn,c)}catch{}return!0}finally{Q.p=o,D.T=s,kg(e,t)}}function Cg(e,t,a){t=_i(a,t),t=Qf(e.stateNode,t,2),e=rl(e,t,2),e!==null&&(ni(e,2),la(e))}function rt(e,t,a){if(e.tag===3)Cg(e,e,a);else for(;t!==null;){if(t.tag===3){Cg(t,e,a);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(hl===null||!hl.has(s))){e=_i(a,e),a=Dp(2),s=rl(t,a,2),s!==null&&(Up(a,s,t,e),ni(s,2),la(s));break}}t=t.return}}function vd(e,t,a){var s=e.pingCache;if(s===null){s=e.pingCache=new U1;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(a)||(ud=!0,o.add(a),e=q1.bind(null,e,t,a),t.then(e,e))}function q1(e,t,a){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,pt===e&&(He&a)===a&&(Dt===4||Dt===3&&(He&62914560)===He&&300>Te()-$u?(Ie&2)===0&&Js(e,0):cd|=a,Ks===He&&(Ks=0)),la(e)}function Dg(e,t){t===0&&(t=Vo()),e=Yl(e,t),e!==null&&(ni(e,t),la(e))}function B1(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Dg(e,a)}function V1(e,t){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,o=e.memoizedState;o!==null&&(a=o.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(r(314))}s!==null&&s.delete(t),Dg(e,a)}function G1(e,t){return Xt(e,t)}var Yu=null,Is=null,yd=!1,Qu=!1,bd=!1,gl=0;function la(e){e!==Is&&e.next===null&&(Is===null?Yu=Is=e:Is=Is.next=e),Qu=!0,yd||(yd=!0,Q1())}function fo(e,t){if(!bd&&Qu){bd=!0;do for(var a=!1,s=Yu;s!==null;){if(e!==0){var o=s.pendingLanes;if(o===0)var c=0;else{var h=s.suspendedLanes,b=s.pingedLanes;c=(1<<31-cn(42|e)+1)-1,c&=o&~(h&~b),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(a=!0,Lg(s,c))}else c=He,c=vs(s,s===pt?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(c&3)===0||Rl(s,c)||(a=!0,Lg(s,c));s=s.next}while(a);bd=!1}}function Y1(){Ug()}function Ug(){Qu=yd=!1;var e=0;gl!==0&&n_()&&(e=gl);for(var t=Te(),a=null,s=Yu;s!==null;){var o=s.next,c=Zg(s,t);c===0?(s.next=null,a===null?Yu=o:a.next=o,o===null&&(Is=a)):(a=s,(e!==0||(c&3)!==0)&&(Qu=!0)),s=o}Pt!==0&&Pt!==5||fo(e),gl!==0&&(gl=0)}function Zg(e,t){for(var a=e.suspendedLanes,s=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0b)break;var F=A.transferSize,P=A.initiatorType;F&&Kg(P)&&(A=A.responseEnd,h+=F*(A"u"?null:document;function lv(e,t,a){var s=Ps;if(s&&typeof t=="string"&&t){var o=Cn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),av.has(o)||(av.add(o),e={rel:e,crossOrigin:a,href:t},s.querySelector(o)===null&&(t=s.createElement("link"),yn(t,"link",e),$t(t),s.head.appendChild(t)))}}function f_(e){Ua.D(e),lv("dns-prefetch",e,null)}function d_(e,t){Ua.C(e,t),lv("preconnect",e,t)}function h_(e,t,a){Ua.L(e,t,a);var s=Ps;if(s&&e&&t){var o='link[rel="preload"][as="'+Cn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Cn(a.imageSizes)+'"]')):o+='[href="'+Cn(e)+'"]';var c=o;switch(t){case"style":c=Ws(e);break;case"script":c=er(e)}Ti.has(c)||(e=S({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Ti.set(c,e),s.querySelector(o)!==null||t==="style"&&s.querySelector(go(c))||t==="script"&&s.querySelector(vo(c))||(t=s.createElement("link"),yn(t,"link",e),$t(t),s.head.appendChild(t)))}}function m_(e,t){Ua.m(e,t);var a=Ps;if(a&&e){var s=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Cn(s)+'"][href="'+Cn(e)+'"]',c=o;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=er(e)}if(!Ti.has(c)&&(e=S({rel:"modulepreload",href:e},t),Ti.set(c,e),a.querySelector(o)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(vo(c)))return}s=a.createElement("link"),yn(s,"link",e),$t(s),a.head.appendChild(s)}}}function p_(e,t,a){Ua.S(e,t,a);var s=Ps;if(s&&e){var o=gi(s).hoistableStyles,c=Ws(e);t=t||"default";var h=o.get(c);if(!h){var b={loading:0,preload:null};if(h=s.querySelector(go(c)))b.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Ti.get(c))&&Dd(e,a);var A=h=s.createElement("link");$t(A),yn(A,"link",e),A._p=new Promise(function(U,F){A.onload=U,A.onerror=F}),A.addEventListener("load",function(){b.loading|=1}),A.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Iu(h,t,s)}h={type:"stylesheet",instance:h,count:1,state:b},o.set(c,h)}}}function g_(e,t){Ua.X(e,t);var a=Ps;if(a&&e){var s=gi(a).hoistableScripts,o=er(e),c=s.get(o);c||(c=a.querySelector(vo(o)),c||(e=S({src:e,async:!0},t),(t=Ti.get(o))&&Ud(e,t),c=a.createElement("script"),$t(c),yn(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function v_(e,t){Ua.M(e,t);var a=Ps;if(a&&e){var s=gi(a).hoistableScripts,o=er(e),c=s.get(o);c||(c=a.querySelector(vo(o)),c||(e=S({s)DELIM" +R"DELIM(rc:e,async:!0,type:"module"},t),(t=Ti.get(o))&&Ud(e,t),c=a.createElement("script"),$t(c),yn(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function sv(e,t,a,s){var o=(o=ge.current)?Xu(o):null;if(!o)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Ws(a.href),a=gi(o).hoistableStyles,s=a.get(t),s||(s={type:"style",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Ws(a.href);var c=gi(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(go(e)))&&!c._p&&(h.instance=c,h.state.loading=5),Ti.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Ti.set(e,a),c||y_(o,e,a,h.state))),t&&s===null)throw Error(r(528,""));return h}if(t&&s!==null)throw Error(r(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=er(a),a=gi(o).hoistableScripts,s=a.get(t),s||(s={type:"script",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Ws(e){return'href="'+Cn(e)+'"'}function go(e){return'link[rel="stylesheet"]['+e+"]"}function rv(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function y_(e,t,a,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),yn(t,"link",a),$t(t),e.head.appendChild(t))}function er(e){return'[src="'+Cn(e)+'"]'}function vo(e){return"script[async]"+e}function ov(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Cn(a.href)+'"]');if(s)return t.instance=s,$t(s),s;var o=S({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),$t(s),yn(s,"style",o),Iu(s,a.precedence,e),t.instance=s;case"stylesheet":o=Ws(a.href);var c=e.querySelector(go(o));if(c)return t.state.loading|=4,t.instance=c,$t(c),c;s=rv(a),(o=Ti.get(o))&&Dd(s,o),c=(e.ownerDocument||e).createElement("link"),$t(c);var h=c;return h._p=new Promise(function(b,A){h.onload=b,h.onerror=A}),yn(c,"link",s),t.state.loading|=4,Iu(c,a.precedence,e),t.instance=c;case"script":return c=er(a.src),(o=e.querySelector(vo(c)))?(t.instance=o,$t(o),o):(s=a,(o=Ti.get(c))&&(s=S({},a),Ud(s,o)),e=e.ownerDocument||e,o=e.createElement("script"),$t(o),yn(o,"link",s),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,Iu(s,a.precedence,e));return t.instance}function Iu(e,t,a){for(var s=a.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 b_(e,t,a){if(a===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 fv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function __(e,t,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=Ws(s.href),c=t.querySelector(go(o));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Wu.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=c,$t(c);return}c=t.ownerDocument||t,s=rv(s),(o=Ti.get(o))&&Dd(s,o),c=c.createElement("link"),$t(c);var h=c;h._p=new Promise(function(b,A){h.onload=b,h.onerror=A}),yn(c,"link",s),a.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Wu.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Zd=0;function S_(e,t){return e.stylesheets&&e.count===0&&tc(e,e.stylesheets),0Zd?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(o)}}:null}function Wu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ec=null;function tc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ec=new Map,t.forEach(x_,e),ec=null,Wu.call(e))}function x_(e,t){if(!(t.state.loading&4)){var a=ec.get(e);if(a)var s=a.get(null);else{a=new Map,ec.set(e,a);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(),Qd.exports=L_(),Qd.exports}var q_=H_();const B_=p0(q_),g0="libbitcoinAdminDashboardBrowserNotifications";function v0(){try{return globalThis.window?.localStorage??null}catch{return null}}function Uh(){const n=globalThis.Notification;return typeof n=="function"?n:null}function y0(){return Uh()?.permission??"unsupported"}async function V_(){const n=Uh();return n?n.permission!=="default"?n.permission:n.requestPermission():"unsupported"}function G_(n=v0()){try{return y0()==="granted"&&n?.getItem(g0)==="true"}catch{return!1}}function Y_(n,i=v0()){try{i?.setItem(g0,String(n))}catch{}}function Q_(n,i){const l=Uh();if(!l||l.permission!=="granted")return!1;try{return new l(n,i),!0}catch{return!1}}const Zh="libbitcoinAdminDashboardEndpoints";function $h(){try{return globalThis.window?.localStorage??null}catch{return null}}function K_(){return globalThis.window?.location.origin??"http://localhost"}function ra(n){const i=n.trim();if(!i)throw new Error("Endpoint URL is required");const l=/^[a-z][a-z\d+\-.]*:\/\//iu.test(i)?i:`http://${i}`,r=new URL(l);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 F_(n){const i=new URL(ra(n));return i.protocol=i.protocol==="https:"?"wss:":"ws:",i.pathname="/",i.search="",i.hash="",i.toString()}function J_(n,i=K_()){return new URL(ra(n)).origin===new URL(i).origin}function b0(){return{adminUrl:ra("http://172.20.208.1:8080"),nativeUrl:ra("http://172.20.208.1:80")}}function X_(n=$h()){const i=b0();try{const l=n?.getItem(Zh);if(!l)return i;const r=JSON.parse(l);if(!r||typeof r!="object"||Array.isArray(r))return i;const u=r;return{adminUrl:typeof u.adminUrl=="string"?ra(u.adminUrl):i.adminUrl,nativeUrl:typeof u.nativeUrl=="string"?ra(u.nativeUrl):i.nativeUrl}}catch{return i}}function I_(n,i=$h()){const l={adminUrl:ra(n.adminUrl),nativeUrl:ra(n.nativeUrl)};try{i?.setItem(Zh,JSON.stringify(l))}catch{}}function P_(n=$h()){try{n?.removeItem(Zh)}catch{}}function W_({configuration:n,browserNotificationsEnabled:i,onClose:l,onBrowserNotificationsEnabledChange:r,onReset:u,onSave:d}){const[f,p]=re.useState(n.adminUrl),[m,v]=re.useState(n.nativeUrl),[w,S]=re.useState(null),[z,T]=re.useState(y0),[j,L]=re.useState(!1),[V,H]=re.useState(null),G=i&&z==="granted";async function W(){if(G){r(!1);return}L(!0),H(null);try{const ne=await V_();T(ne),ne==="granted"?r(!0):ne==="denied"&&H("Permission was denied. It can be changed in your browser settings.")}catch{H("The browser could not enable notifications.")}finally{L(!1)}}function B(ne){ne.preventDefault();try{d({adminUrl:ra(f),nativeUrl:ra(m)})}catch(ee){S(ee instanceof Error?ee.message:"Invalid endpoint configuration")}}return _.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:ne=>{ne.target===ne.currentTarget&&l()},children:_.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"endpoint-settings-title",className:"border-accent/30 bg-surface max-h-[calc(100vh-2rem)] w-full max-w-xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/50",children:[_.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Runtime configuration"}),_.jsx("h2",{id:"endpoint-settings-title",className:"mt-1 text-xl font-semibold",children:"Node endpoints"})]}),_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close endpoint settings",children:"×"})]}),_.jsxs("form",{onSubmit:B,className:"space-y-5 p-5",children:[_.jsxs("label",{className:"block space-y-2",children:[_.jsx("span",{className:"text-textPrimary text-sm font-medium",children:"Admin endpoint"}),_.jsx("input",{value:f,onChange:ne=>{p(ne.target.value)},className:"border-accent/30 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 font-mono text-sm focus:ring-0",placeholder:"http://node-host:admin-port",autoComplete:"url"})]}),_.jsxs("label",{className:"block space-y-2",children:[_.jsx("span",{className:"text-textPrimary text-sm font-medium",children:"Native endpoint"}),_.jsx("input",{value:m,onChange:ne=>{v(ne.target.value)},className:"border-accent/30 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 font-mono text-sm focus:ring-0",placeholder:"http://node-host:native-port",autoComplete:"url"})]}),_.jsxs("div",{className:"border-accent/20 bg-background/35 space-y-3 rounded-xl border p-4",children:[_.jsxs("div",{children:[_.jsx("h3",{className:"text-textPrimary text-sm font-medium",children:"Browser notifications"}),_.jsx("p",{id:"browser-notifications-help",className:"text-textMuted mt-1 text-xs",children:tS(z,G,j)})]}),_.jsx("button",{type:"button","aria-describedby":"browser-notifications-help",disabled:j||z==="unsupported"||z==="denied",onClick:()=>{W()},className:"border-accent/30 text-textMuted hover:border-accent hover:text-accent rounded-lg border px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:eS(z,G,j)}),V&&_.jsx("p",{className:"text-sm text-red-300",role:"alert",children:V})]}),w&&_.jsx("p",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-300",children:w}),_.jsxs("div",{className:"flex flex-wrap justify-between gap-3 pt-2",children:[_.jsx("button",{type:"button",onClick:u,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-4 py-2 text-sm",children:"Reset defaults"}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-textPrimary rounded-lg px-4 py-2 text-sm",children:"Cancel"}),_.jsx("button",{type:"submit",className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold",children:"Save endpoints"})]})]})]})]})})}function eS(n,i,l){return l?"Req)DELIM" +R"DELIM(uesting permission…":n==="unsupported"?"Notifications unavailable":n==="denied"?"Blocked by browser":i?"Disable notifications":"Enable notifications"}function tS(n,i,l){return l?"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."}var Dv;function I(n,i,l){function r(p,m){if(p._zod||Object.defineProperty(p,"_zod",{value:{def:m,constr:f,traits:new Set},enumerable:!1}),p._zod.traits.has(n))return;p._zod.traits.add(n),i(p,m);const v=f.prototype,w=Object.keys(v);for(let S=0;Sl?.Parent&&p instanceof l.Parent?!0:p?._zod?.traits?.has(n)}),Object.defineProperty(f,"name",{value:n}),f}class or extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _0 extends Error{constructor(i){super(`Encountered unidirectional transform during encode: ${i}`),this.name="ZodEncodeError"}}(Dv=globalThis).__zod_globalConfig??(Dv.__zod_globalConfig={});const Lh=globalThis.__zod_globalConfig;function fs(n){return Lh}function S0(n){const i=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,u])=>i.indexOf(+r)===-1).map(([r,u])=>u)}function uh(n,i){return typeof i=="bigint"?i.toString():i}function Hh(n){return{get value(){{const i=n();return Object.defineProperty(this,"value",{value:i}),i}}}}function qh(n){return n==null}function Bh(n){const i=n.startsWith("^")?1:0,l=n.endsWith("$")?n.length-1:n.length;return n.slice(i,l)}function nS(n,i){const l=n/i,r=Math.round(l),u=Number.EPSILON*Math.max(Math.abs(l),1);return Math.abs(l-r){};function Sc(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const aS=Hh(()=>{if(Lh.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function Co(n){if(Sc(n)===!1)return!1;const i=n.constructor;if(i===void 0||typeof i!="function")return!0;const l=i.prototype;return!(Sc(l)===!1||Object.prototype.hasOwnProperty.call(l,"isPrototypeOf")===!1)}function w0(n){return Co(n)?{...n}:Array.isArray(n)?[...n]:n instanceof Map?new Map(n):n instanceof Set?new Set(n):n}const lS=new Set(["string","number","symbol"]);function dr(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ml(n,i,l){const r=new n._zod.constr(i??n._zod.def);return(!i||l?.parent)&&(r._zod.parent=n),r}function Ne(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 sS(n){return Object.keys(n).filter(i=>n[i]._zod.optin==="optional"&&n[i]._zod.optout==="optional")}const rS={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function oS(n,i){const l=n._zod.def,r=l.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const d=Nl(n._zod.def,{get shape(){const f={};for(const p in i){if(!(p in l.shape))throw new Error(`Unrecognized key: "${p}"`);i[p]&&(f[p]=l.shape[p])}return ms(this,"shape",f),f},checks:[]});return Ml(n,d)}function uS(n,i){const l=n._zod.def,r=l.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const d=Nl(n._zod.def,{get shape(){const f={...n._zod.def.shape};for(const p in i){if(!(p in l.shape))throw new Error(`Unrecognized key: "${p}"`);i[p]&&delete f[p]}return ms(this,"shape",f),f},checks:[]});return Ml(n,d)}function cS(n,i){if(!Co(i))throw new Error("Invalid input to extend: expected a plain object");const l=n._zod.def.checks;if(l&&l.length>0){const d=n._zod.def.shape;for(const f in i)if(Object.getOwnPropertyDescriptor(d,f)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const u=Nl(n._zod.def,{get shape(){const d={...n._zod.def.shape,...i};return ms(this,"shape",d),d}});return Ml(n,u)}function fS(n,i){if(!Co(i))throw new Error("Invalid input to safeExtend: expected a plain object");const l=Nl(n._zod.def,{get shape(){const r={...n._zod.def.shape,...i};return ms(this,"shape",r),r}});return Ml(n,l)}function dS(n,i){if(n._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const l=Nl(n._zod.def,{get shape(){const r={...n._zod.def.shape,...i._zod.def.shape};return ms(this,"shape",r),r},get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return Ml(n,l)}function hS(n,i,l){const u=i._zod.def.checks;if(u&&u.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const f=Nl(i._zod.def,{get shape(){const p=i._zod.def.shape,m={...p};if(l)for(const v in l){if(!(v in p))throw new Error(`Unrecognized key: "${v}"`);l[v]&&(m[v]=n?new n({type:"optional",innerType:p[v]}):p[v])}else for(const v in p)m[v]=n?new n({type:"optional",innerType:p[v]}):p[v];return ms(this,"shape",m),m},checks:[]});return Ml(i,f)}function mS(n,i,l){const r=Nl(i._zod.def,{get shape(){const u=i._zod.def.shape,d={...u};if(l)for(const f in l){if(!(f in d))throw new Error(`Unrecognized key: "${f}"`);l[f]&&(d[f]=new n({type:"nonoptional",innerType:u[f]}))}else for(const f in u)d[f]=new n({type:"nonoptional",innerType:u[f]});return ms(this,"shape",d),d}});return Ml(i,r)}function rr(n,i=0){if(n.aborted===!0)return!0;for(let l=i;l{var r;return(r=l).path??(r.path=[]),l.path.unshift(n),l})}function uc(n){return typeof n=="string"?n:n?.message}function ds(n,i,l){const r=n.message?n.message:uc(n.inst?._zod.def?.error?.(n))??uc(i?.error?.(n))??uc(l.customError?.(n))??uc(l.localeError?.(n))??"Invalid input",{inst:u,continue:d,input:f,...p}=n;return p.path??(p.path=[]),p.message=r,i?.reportInput&&(p.input=f),p}function Vh(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function Do(...n){const[i,l,r]=n;return typeof i=="string"?{message:i,code:"custom",input:l,inst:r}:{...i}}const E0=(n,i)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:i,enumerable:!1}),n.message=JSON.stringify(i,uh,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerab)DELIM" +R"DELIM(le:!1})},T0=I("$ZodError",E0),A0=I("$ZodError",E0,{Parent:Error});function gS(n,i=l=>l.message){const l={},r=[];for(const u of n.issues)u.path.length>0?(l[u.path[0]]=l[u.path[0]]||[],l[u.path[0]].push(i(u))):r.push(i(u));return{formErrors:r,fieldErrors:l}}function vS(n,i=l=>l.message){const l={_errors:[]},r=(u,d=[])=>{for(const f of u.issues)if(f.code==="invalid_union"&&f.errors.length)f.errors.map(p=>r({issues:p},[...d,...f.path]));else if(f.code==="invalid_key")r({issues:f.issues},[...d,...f.path]);else if(f.code==="invalid_element")r({issues:f.issues},[...d,...f.path]);else{const p=[...d,...f.path];if(p.length===0)l._errors.push(i(f));else{let m=l,v=0;for(;v(i,l,r,u)=>{const d=r?{...r,async:!1}:{async:!1},f=i._zod.run({value:l,issues:[]},d);if(f instanceof Promise)throw new or;if(f.issues.length){const p=new(u?.Err??n)(f.issues.map(m=>ds(m,d,fs())));throw x0(p,u?.callee),p}return f.value},Yh=n=>async(i,l,r,u)=>{const d=r?{...r,async:!0}:{async:!0};let f=i._zod.run({value:l,issues:[]},d);if(f instanceof Promise&&(f=await f),f.issues.length){const p=new(u?.Err??n)(f.issues.map(m=>ds(m,d,fs())));throw x0(p,u?.callee),p}return f.value},Uc=n=>(i,l,r)=>{const u=r?{...r,async:!1}:{async:!1},d=i._zod.run({value:l,issues:[]},u);if(d instanceof Promise)throw new or;return d.issues.length?{success:!1,error:new(n??T0)(d.issues.map(f=>ds(f,u,fs())))}:{success:!0,data:d.value}},yS=Uc(A0),Zc=n=>async(i,l,r)=>{const u=r?{...r,async:!0}:{async:!0};let d=i._zod.run({value:l,issues:[]},u);return d instanceof Promise&&(d=await d),d.issues.length?{success:!1,error:new n(d.issues.map(f=>ds(f,u,fs())))}:{success:!0,data:d.value}},bS=Zc(A0),_S=n=>(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Gh(n)(i,l,u)},SS=n=>(i,l,r)=>Gh(n)(i,l,r),xS=n=>async(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Yh(n)(i,l,u)},wS=n=>async(i,l,r)=>Yh(n)(i,l,r),zS=n=>(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Uc(n)(i,l,u)},ES=n=>(i,l,r)=>Uc(n)(i,l,r),TS=n=>async(i,l,r)=>{const u=r?{...r,direction:"backward"}:{direction:"backward"};return Zc(n)(i,l,u)},AS=n=>async(i,l,r)=>Zc(n)(i,l,r),NS=/^[cC][0-9a-z]{6,}$/,MS=/^[0-9a-z]+$/,OS=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,jS=/^[0-9a-vA-V]{20}$/,kS=/^[A-Za-z0-9]{27}$/,RS=/^[a-zA-Z0-9_-]{21}$/,CS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,DS=/^([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})$/,$v=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)$/,US=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ZS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $S(){return new RegExp(ZS,"u")}const LS=/^(?:(?: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])$/,HS=/^(([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}|:))$/,qS=/^((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])$/,BS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,VS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,N0=/^[A-Za-z0-9_-]*$/,GS=/^https?$/,YS=/^\+[1-9]\d{6,14}$/,M0="(?:(?:\\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])))",QS=new RegExp(`^${M0}$`);function O0(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}}`:`${i}(?::[0-5]\\d(?:\\.\\d+)?)?`}function KS(n){return new RegExp(`^${O0(n)}$`)}function FS(n){const i=O0({precision:n.precision}),l=["Z"];n.local&&l.push(""),n.offset&&l.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${i}(?:${l.join("|")})`;return new RegExp(`^${M0}T(?:${r})$`)}const JS=n=>{const i=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${i}$`)},XS=/^-?\d+$/,IS=/^-?\d+(?:\.\d+)?$/,PS=/^(?:true|false)$/i,WS=/^[^A-Z]*$/,ex=/^[^a-z]*$/,Wn=I("$ZodCheck",(n,i)=>{var l;n._zod??(n._zod={}),n._zod.def=i,(l=n._zod).onattach??(l.onattach=[])}),j0={number:"number",bigint:"bigint",object:"date"},k0=I("$ZodCheckLessThan",(n,i)=>{Wn.init(n,i);const l=j0[typeof i.value];n._zod.onattach.push(r=>{const u=r._zod.bag,d=(i.inclusive?u.maximum:u.exclusiveMaximum)??Number.POSITIVE_INFINITY;i.value{(i.inclusive?r.value<=i.value:r.value{Wn.init(n,i);const l=j0[typeof i.value];n._zod.onattach.push(r=>{const u=r._zod.bag,d=(i.inclusive?u.minimum:u.exclusiveMinimum)??Number.NEGATIVE_INFINITY;i.value>d&&(i.inclusive?u.minimum=i.value:u.exclusiveMinimum=i.value)}),n._zod.check=r=>{(i.inclusive?r.value>=i.value:r.value>i.value)||r.issues.push({origin:l,code:"too_small",minimum:typeof i.value=="object"?i.value.getTime():i.value,input:r.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),tx=I("$ZodCheckMultipleOf",(n,i)=>{Wn.init(n,i),n._zod.onattach.push(l=>{var r;(r=l._zod.bag).multipleOf??(r.multipleOf=i.value)}),n._zod.check=l=>{if(typeof l.value!=typeof i.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof l.value=="bigint"?l.value%i.value===BigInt(0):nS(l.value,i.value)===0)||l.issues.push({origin:typeof l.value,code:"not_multiple_of",divisor:i.value,input:l.value,inst:n,continue:!i.abort})}}),nx=I("$ZodCheckNumberFormat",(n,i)=>{Wn.init(n,i),i.format=i.format||"float64";const l=i.format?.includes("int"),r=l?"int":"number",[u,d]=rS[i.format];n._zod.onattach.push(f=>{const p=f._zod.bag;p.format=i.format,p.minimum=u,p.maximum=d,l&&(p.pattern=XS)}),n._zod.check=f=>{const p=f.value;if(l){if(!Number.isInteger(p)){f.issues.push({expected:r,format:i.format,code:"invalid_type",continue:!1,input:p,inst:n});return}if(!Number.isSafeInteger(p)){p>0?f.issues.push({input:p,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!i.abort}):f.issues.push({input:p,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!i.abort});return}}pd&&f.issues.push({origin:"number",input:p,code:"too_big",maximum:d,inclusive:!0,inst:n,continue:!i.abort})}}),ix=I("$ZodCheckMaxLength",(n,i)=>{var l;Wn.init(n,i),(l=n._zod.def).when??(l.when=r=>{const u=r.value;return!qh(u)&&u.length!==void 0}),n._zod.onattach.push(r=>{const u=r._zod.bag.maximum??Number.POSITIVE_INFINITY;i.maximum{const u=r.value;if(u.length<=i.maximum)return;const f=Vh(u);r.issues.push({origin:f,code:"too_big",maximum:i.maximum)DELIM" +R"DELIM(,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),ax=I("$ZodCheckMinLength",(n,i)=>{var l;Wn.init(n,i),(l=n._zod.def).when??(l.when=r=>{const u=r.value;return!qh(u)&&u.length!==void 0}),n._zod.onattach.push(r=>{const u=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;i.minimum>u&&(r._zod.bag.minimum=i.minimum)}),n._zod.check=r=>{const u=r.value;if(u.length>=i.minimum)return;const f=Vh(u);r.issues.push({origin:f,code:"too_small",minimum:i.minimum,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),lx=I("$ZodCheckLengthEquals",(n,i)=>{var l;Wn.init(n,i),(l=n._zod.def).when??(l.when=r=>{const u=r.value;return!qh(u)&&u.length!==void 0}),n._zod.onattach.push(r=>{const u=r._zod.bag;u.minimum=i.length,u.maximum=i.length,u.length=i.length}),n._zod.check=r=>{const u=r.value,d=u.length;if(d===i.length)return;const f=Vh(u),p=d>i.length;r.issues.push({origin:f,...p?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!i.abort})}}),$c=I("$ZodCheckStringFormat",(n,i)=>{var l,r;Wn.init(n,i),n._zod.onattach.push(u=>{const d=u._zod.bag;d.format=i.format,i.pattern&&(d.patterns??(d.patterns=new Set),d.patterns.add(i.pattern))}),i.pattern?(l=n._zod).check??(l.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})}):(r=n._zod).check??(r.check=()=>{})}),sx=I("$ZodCheckRegex",(n,i)=>{$c.init(n,i),n._zod.check=l=>{i.pattern.lastIndex=0,!i.pattern.test(l.value)&&l.issues.push({origin:"string",code:"invalid_format",format:"regex",input:l.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),rx=I("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=WS),$c.init(n,i)}),ox=I("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=ex),$c.init(n,i)}),ux=I("$ZodCheckIncludes",(n,i)=>{Wn.init(n,i);const l=dr(i.includes),r=new RegExp(typeof i.position=="number"?`^.{${i.position}}${l}`:l);i.pattern=r,n._zod.onattach.push(u=>{const d=u._zod.bag;d.patterns??(d.patterns=new Set),d.patterns.add(r)}),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})}}),cx=I("$ZodCheckStartsWith",(n,i)=>{Wn.init(n,i);const l=new RegExp(`^${dr(i.prefix)}.*`);i.pattern??(i.pattern=l),n._zod.onattach.push(r=>{const u=r._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(l)}),n._zod.check=r=>{r.value.startsWith(i.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:r.value,inst:n,continue:!i.abort})}}),fx=I("$ZodCheckEndsWith",(n,i)=>{Wn.init(n,i);const l=new RegExp(`.*${dr(i.suffix)}$`);i.pattern??(i.pattern=l),n._zod.onattach.push(r=>{const u=r._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(l)}),n._zod.check=r=>{r.value.endsWith(i.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:r.value,inst:n,continue:!i.abort})}}),dx=I("$ZodCheckOverwrite",(n,i)=>{Wn.init(n,i),n._zod.check=l=>{l.value=i.tx(l.value)}});class hx{constructor(i=[]){this.content=[],this.indent=0,this&&(this.args=i)}indented(i){this.indent+=1,i(this),this.indent-=1}write(i){if(typeof i=="function"){i(this,{execution:"sync"}),i(this,{execution:"async"});return}const r=i.split(` `).filter(f=>f),u=Math.min(...r.map(f=>f.length-f.trimStart().length)),d=r.map(f=>f.slice(u)).map(f=>" ".repeat(this.indent*2)+f);for(const f of d)this.content.push(f)}compile(){const i=Function,l=this?.args,u=[...(this?.content??[""]).map(d=>` ${d}`)];return new i(...l,u.join(` -`))}}const dx={major:4,minor:4,patch:3},Ut=I("$ZodType",(n,i)=>{var l;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=dx;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const u of r)for(const d of u._zod.onattach)d(n);if(r.length===0)(l=n._zod).deferred??(l.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{const u=(f,p,m)=>{let v=rr(f),w;for(const S of p){if(S._zod.def.when){if(hS(f)||!S._zod.def.when(f))continue}else if(v)continue;const z=f.issues.length,T=S._zod.check(f);if(T instanceof Promise&&m?.async===!1)throw new or;if(w||T instanceof Promise)w=(w??Promise.resolve()).then(async()=>{await T,f.issues.length!==z&&(v||(v=rr(f,z)))});else{if(f.issues.length===z)continue;v||(v=rr(f,z))}}return w?w.then(()=>f):f},d=(f,p,m)=>{if(rr(f))return f.aborted=!0,f;const v=u(p,r,m);if(v instanceof Promise){if(m.async===!1)throw new or;return v.then(w=>n._zod.parse(w,m))}return n._zod.parse(v,m)};n._zod.run=(f,p)=>{if(p.skipChecks)return n._zod.parse(f,p);if(p.direction==="backward"){const v=n._zod.parse({value:f.value,issues:[]},{...p,skipChecks:!0});return v instanceof Promise?v.then(w=>d(w,f,p)):d(v,f,p)}const m=n._zod.parse(f,p);if(m instanceof Promise){if(p.async===!1)throw new or;return m.then(v=>u(v,r,p))}return u(m,r,p)}}ht(n,"~standard",()=>({validate:u=>{try{const d=gS(n,u);return d.success?{value:d.data}:{issues:d.error?.issues}}catch{return vS(n,u).then(f=>f.success?{value:f.data}:{issues:f.error?.issues})}},vendor:"zod",version:1}))}),Qh=I("$ZodString",(n,i)=>{Ut.init(n,i),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??KS(n._zod.bag),n._zod.parse=(l,r)=>{if(i.coerce)try{l.value=String(l.value)}catch{}return typeof l.value=="string"||l.issues.push({expected:"string",code:"invalid_type",input:l.value,inst:n}),l}}),Tt=I("$ZodStringFormat",(n,i)=>{$c.init(n,i),Qh.init(n,i)}),hx=I("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=RS),Tt.init(n,i)}),mx=I("$ZodUUID",(n,i)=>{if(i.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(r===void 0)throw new Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=Zv(r))}else i.pattern??(i.pattern=Zv());Tt.init(n,i)}),px=I("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=CS),Tt.init(n,i)}),gx=I("$ZodURL",(n,i)=>{Tt.init(n,i),n._zod.check=l=>{try{const r=l.value.trim();if(!i.normalize&&i.protocol?.source===BS.source&&!/^https?:\/\//i.test(r)){l.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:l.value,inst:n,continue:!i.abort});return}const u=new URL(r);i.hostname&&(i.hostname.lastIndex=0,i.hostname.test(u.hostname)||l.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:l.value,inst:n,continue:!i.abort})),i.protocol&&(i.protocol.lastIndex=0,i.protocol.test(u.protocol.endsWith(":")?u.protocol.slice(0,-1):u.protocol)||l.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:l.value,inst:n,continue:!i.abort})),i.normalize?l.value=u.href:l.value=r;return}catch{l.issues.push({code:"invalid_format",format:"url",input:l.value,inst:n,continue:!i.abort})}}}),vx=I("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=US()),Tt.init(n,i)}),yx=I("$ZodNanoID",(n,i)=>{i.pattern??(i.pattern=jS),Tt.init(n,i)}),bx=I("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=TS),Tt.init(n,i)}),_x=I("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=AS),Tt.init(n,i)}),Sx=I("$ZodULID",(n,i)=>{i.pattern??(i.pattern=NS),Tt.init(n,i)}),xx=I("$ZodXID",(n,i)=>{i.pattern??(i.pattern=OS),Tt.init(n,i)}),wx=I("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=MS),Tt.init(n,i)}),zx=I("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=QS(i)),Tt.init(n,i)}),Ex=I("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=GS),Tt.init(n,i)}),Tx=I("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=YS(i)),Tt.init(n,i)}),Ax=I("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=kS),Tt.init(n,i)}),Nx=I("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=ZS),Tt.init(n,i),n._zod.bag.format="ipv4"}),Ox=I("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=$S),Tt.init(n,i),n._zod.bag.format="ipv6",n._zod.check=l=>{try{new URL(`http://[${l.value}]`)}catch{l.issues.push({code:"invalid_format",format:"ipv6",input:l.value,inst:n,continue:!i.abort})}}}),Mx=I("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=LS)DELIM" -R"DELIM(),Tt.init(n,i)}),jx=I("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=HS),Tt.init(n,i),n._zod.check=l=>{const r=l.value.split("/");try{if(r.length!==2)throw new Error;const[u,d]=r;if(!d)throw new Error;const f=Number(d);if(`${f}`!==d)throw new Error;if(f<0||f>128)throw new Error;new URL(`http://[${u}]`)}catch{l.issues.push({code:"invalid_format",format:"cidrv6",input:l.value,inst:n,continue:!i.abort})}}});function R0(n){if(n==="")return!0;if(/\s/.test(n)||n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const kx=I("$ZodBase64",(n,i)=>{i.pattern??(i.pattern=qS),Tt.init(n,i),n._zod.bag.contentEncoding="base64",n._zod.check=l=>{R0(l.value)||l.issues.push({code:"invalid_format",format:"base64",input:l.value,inst:n,continue:!i.abort})}});function Rx(n){if(!A0.test(n))return!1;const i=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),l=i.padEnd(Math.ceil(i.length/4)*4,"=");return R0(l)}const Cx=I("$ZodBase64URL",(n,i)=>{i.pattern??(i.pattern=A0),Tt.init(n,i),n._zod.bag.contentEncoding="base64url",n._zod.check=l=>{Rx(l.value)||l.issues.push({code:"invalid_format",format:"base64url",input:l.value,inst:n,continue:!i.abort})}}),Dx=I("$ZodE164",(n,i)=>{i.pattern??(i.pattern=VS),Tt.init(n,i)});function Ux(n,i=null){try{const l=n.split(".");if(l.length!==3)return!1;const[r]=l;if(!r)return!1;const u=JSON.parse(atob(r));return!("typ"in u&&u?.typ!=="JWT"||!u.alg||i&&(!("alg"in u)||u.alg!==i))}catch{return!1}}const Zx=I("$ZodJWT",(n,i)=>{Tt.init(n,i),n._zod.check=l=>{Ux(l.value,i.alg)||l.issues.push({code:"invalid_format",format:"jwt",input:l.value,inst:n,continue:!i.abort})}}),C0=I("$ZodNumber",(n,i)=>{Ut.init(n,i),n._zod.pattern=n._zod.bag.pattern??JS,n._zod.parse=(l,r)=>{if(i.coerce)try{l.value=Number(l.value)}catch{}const u=l.value;if(typeof u=="number"&&!Number.isNaN(u)&&Number.isFinite(u))return l;const d=typeof u=="number"?Number.isNaN(u)?"NaN":Number.isFinite(u)?void 0:"Infinity":void 0;return l.issues.push({expected:"number",code:"invalid_type",input:u,inst:n,...d?{received:d}:{}}),l}}),$x=I("$ZodNumberFormat",(n,i)=>{ex.init(n,i),C0.init(n,i)}),Lx=I("$ZodBoolean",(n,i)=>{Ut.init(n,i),n._zod.pattern=XS,n._zod.parse=(l,r)=>{if(i.coerce)try{l.value=!!l.value}catch{}const u=l.value;return typeof u=="boolean"||l.issues.push({expected:"boolean",code:"invalid_type",input:u,inst:n}),l}}),Hx=I("$ZodUnknown",(n,i)=>{Ut.init(n,i),n._zod.parse=l=>l}),qx=I("$ZodNever",(n,i)=>{Ut.init(n,i),n._zod.parse=(l,r)=>(l.issues.push({expected:"never",code:"invalid_type",input:l.value,inst:n}),l)});function $v(n,i,l){n.issues.length&&i.issues.push(...w0(l,n.issues)),i.value[l]=n.value}const Bx=I("$ZodArray",(n,i)=>{Ut.init(n,i),n._zod.parse=(l,r)=>{const u=l.value;if(!Array.isArray(u))return l.issues.push({expected:"array",code:"invalid_type",input:u,inst:n}),l;l.value=Array(u.length);const d=[];for(let f=0;f$v(v,l,f))):$v(m,l,f)}return d.length?Promise.all(d).then(()=>l):l}});function xc(n,i,l,r,u,d){const f=l in r;if(n.issues.length){if(u&&d&&!f)return;i.issues.push(...w0(l,n.issues))}if(!f&&!u){n.issues.length||i.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[l]});return}n.value===void 0?f&&(i.value[l]=void 0):i.value[l]=n.value}function D0(n){const i=Object.keys(n.shape);for(const r of i)if(!n.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const l=aS(n.shape);return{...n,keys:i,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(l)}}function U0(n,i,l,r,u,d){const f=[],p=u.keySet,m=u.catchall._zod,v=m.def.type,w=m.optin==="optional",S=m.optout==="optional";for(const z in i){if(z==="__proto__"||p.has(z))continue;if(v==="never"){f.push(z);continue}const T=m.run({value:i[z],issues:[]},r);T instanceof Promise?n.push(T.then(j=>xc(j,l,z,i,w,S))):xc(T,l,z,i,w,S)}return f.length&&l.issues.push({code:"unrecognized_keys",keys:f,input:i,inst:d}),n.length?Promise.all(n).then(()=>l):l}const Vx=I("$ZodObject",(n,i)=>{if(Ut.init(n,i),!Object.getOwnPropertyDescriptor(i,"shape")?.get){const p=i.shape;Object.defineProperty(i,"shape",{get:()=>{const m={...p};return Object.defineProperty(i,"shape",{value:m}),m}})}const r=Hh(()=>D0(i));ht(n._zod,"propValues",()=>{const p=i.shape,m={};for(const v in p){const w=p[v]._zod;if(w.values){m[v]??(m[v]=new Set);for(const S of w.values)m[v].add(S)}}return m});const u=Sc,d=i.catchall;let f;n._zod.parse=(p,m)=>{f??(f=r.value);const v=p.value;if(!u(v))return p.issues.push({expected:"object",code:"invalid_type",input:v,inst:n}),p;p.value={};const w=[],S=f.shape;for(const z of f.keys){const T=S[z],j=T._zod.optin==="optional",L=T._zod.optout==="optional",V=T._zod.run({value:v[z],issues:[]},m);V instanceof Promise?w.push(V.then(H=>xc(H,p,z,v,j,L))):xc(V,p,z,v,j,L)}return d?U0(w,v,p,m,r.value,n):w.length?Promise.all(w).then(()=>p):p}}),Gx=I("$ZodObjectJIT",(n,i)=>{Vx.init(n,i);const l=n._zod.parse,r=Hh(()=>D0(i)),u=z=>{const T=new fx(["shape","payload","ctx"]),j=r.value,L=W=>{const B=Uv(W);return`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`};T.write("const input = payload.value;");const V=Object.create(null);let H=0;for(const W of j.keys)V[W]=`key_${H++}`;T.write("const newResult = {};");for(const W of j.keys){const B=V[W],ne=Uv(W),ee=z[W],K=ee?._zod?.optin==="optional",le=ee?._zod?.optout==="optional";T.write(`const ${B} = ${L(W)};`),K&&le?T.write(` +`))}}const mx={major:4,minor:4,patch:3},Ut=I("$ZodType",(n,i)=>{var l;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=mx;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const u of r)for(const d of u._zod.onattach)d(n);if(r.length===0)(l=n._zod).deferred??(l.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{const u=(f,p,m)=>{let v=rr(f),w;for(const S of p){if(S._zod.def.when){if(pS(f)||!S._zod.def.when(f))continue}else if(v)continue;const z=f.issues.length,T=S._zod.check(f);if(T instanceof Promise&&m?.async===!1)throw new or;if(w||T instanceof Promise)w=(w??Promise.resolve()).then(async()=>{await T,f.issues.length!==z&&(v||(v=rr(f,z)))});else{if(f.issues.length===z)continue;v||(v=rr(f,z))}}return w?w.then(()=>f):f},d=(f,p,m)=>{if(rr(f))return f.aborted=!0,f;const v=u(p,r,m);if(v instanceof Promise){if(m.async===!1)throw new or;return v.then(w=>n._zod.parse(w,m))}return n._zod.parse(v,m)};n._zod.run=(f,p)=>{if(p.skipChecks)return n._zod.parse(f,p);if(p.direction==="backward"){const v=n._zod.parse({value:f.value,issues:[]},{...p,skipChecks:!0});return v instanceof Promise?v.then(w=>d(w,f,p)):d(v,f,p)}const m=n._zod.parse(f,p);if(m instanceof Promise){if(p.async===!1)throw new or;return m.then(v=>u(v,r,p))}return u(m,r,p)}}ht(n,"~standard",()=>({validate:u=>{try{const d=yS(n,u);return d.success?{value:d.data}:{issues:d.error?.issues}}catch{return bS(n,u).then(f=>f.success?{value:f.data}:{issues:f.error?.issues})}},vendor:"zod",version:1}))}),Qh=I("$ZodString",(n,i)=>{Ut.init(n,i),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??JS(n._zod.bag),n._zod.parse=(l,r)=>{if(i.coerce)try{l.value=String(l.value)}catch{}return typeof l.value=="string"||l.issues.push({expected:"string",code:"invalid_type",input:l.value,inst:n}),l}}),Tt=I("$ZodStringFormat",(n,i)=>{$c.init(n,i),Qh.init(n,i)}),px=I("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=DS),Tt.init(n,i)}),gx=I("$ZodUUID",(n,i)=>{if(i.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(r===void 0)throw new Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=$v(r))}else i.pattern??(i.pattern=$v());Tt.init(n,i)}),vx=I("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=US),Tt.init(n,i)}),yx=I("$ZodURL",(n,i)=>{Tt.init(n,i),n._zod.check=l=>{try{const r=l.value.trim();if(!i.normalize&&i.protocol?.source===GS.source&&!/^https?:\/\//i.test(r)){l.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:l.value,inst:n,continue:!i.abort});return}const u=new URL(r);i.hostname&&(i.hostname.lastIndex=0,i.hostname.test(u.hostname)||l.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:l.value,inst:n,continue:!i.abort})),i.protocol&&(i.protocol.lastIndex=0,i.protocol.test(u.protocol.endsWith(":")?u.protocol.slice(0,-1):u.protocol)||l.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:l.value,inst:n,continue:!i.abort})),i.normalize?l.value=u.href:l.value=r;return}catch{l.issues.push({code:"invalid_format",format:"url",input:l.value,inst:n,continue:!i.abort})}}}),bx=I("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=$S()),Tt.init(n,i)}),_x=I("$ZodNanoID",(n,i)=>{i.pattern??(i.pattern=RS),Tt.init(n,i)}),Sx=I("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=NS),Tt.init(n,i)}),xx=I("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=MS),Tt.init(n,i)}),wx=I("$ZodULID",(n,i)=>{i.pattern??(i.pattern=OS),Tt.init(n,i)}),zx=I("$ZodXID",(n,i)=>{i.pattern??(i.pattern=jS),Tt.init(n,i)}),Ex=I("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=kS),Tt.init(n,i)}),Tx=I("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=FS(i)),Tt.init(n,i)}),Ax=I("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=QS),Tt.init(n,i)}),Nx=I("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=KS(i)),Tt.init(n,i)}),Mx=I("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=CS),Tt.init(n,i)}),Ox=I("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=LS),Tt.init(n,i),n._zod.bag.format="ipv4"}),jx=I("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=HS),Tt.init(n,i),n._zod.bag.format="ipv6",n._zod.check=l=>{try{new URL(`http://[${l.value}]`)}catch{l.issues.push({code:"invalid_format",format:"ipv6",input:l.value,inst:n,continue:!i.abort})}}}),kx=I("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=qS)DELIM" +R"DELIM(),Tt.init(n,i)}),Rx=I("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=BS),Tt.init(n,i),n._zod.check=l=>{const r=l.value.split("/");try{if(r.length!==2)throw new Error;const[u,d]=r;if(!d)throw new Error;const f=Number(d);if(`${f}`!==d)throw new Error;if(f<0||f>128)throw new Error;new URL(`http://[${u}]`)}catch{l.issues.push({code:"invalid_format",format:"cidrv6",input:l.value,inst:n,continue:!i.abort})}}});function C0(n){if(n==="")return!0;if(/\s/.test(n)||n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const Cx=I("$ZodBase64",(n,i)=>{i.pattern??(i.pattern=VS),Tt.init(n,i),n._zod.bag.contentEncoding="base64",n._zod.check=l=>{C0(l.value)||l.issues.push({code:"invalid_format",format:"base64",input:l.value,inst:n,continue:!i.abort})}});function Dx(n){if(!N0.test(n))return!1;const i=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),l=i.padEnd(Math.ceil(i.length/4)*4,"=");return C0(l)}const Ux=I("$ZodBase64URL",(n,i)=>{i.pattern??(i.pattern=N0),Tt.init(n,i),n._zod.bag.contentEncoding="base64url",n._zod.check=l=>{Dx(l.value)||l.issues.push({code:"invalid_format",format:"base64url",input:l.value,inst:n,continue:!i.abort})}}),Zx=I("$ZodE164",(n,i)=>{i.pattern??(i.pattern=YS),Tt.init(n,i)});function $x(n,i=null){try{const l=n.split(".");if(l.length!==3)return!1;const[r]=l;if(!r)return!1;const u=JSON.parse(atob(r));return!("typ"in u&&u?.typ!=="JWT"||!u.alg||i&&(!("alg"in u)||u.alg!==i))}catch{return!1}}const Lx=I("$ZodJWT",(n,i)=>{Tt.init(n,i),n._zod.check=l=>{$x(l.value,i.alg)||l.issues.push({code:"invalid_format",format:"jwt",input:l.value,inst:n,continue:!i.abort})}}),D0=I("$ZodNumber",(n,i)=>{Ut.init(n,i),n._zod.pattern=n._zod.bag.pattern??IS,n._zod.parse=(l,r)=>{if(i.coerce)try{l.value=Number(l.value)}catch{}const u=l.value;if(typeof u=="number"&&!Number.isNaN(u)&&Number.isFinite(u))return l;const d=typeof u=="number"?Number.isNaN(u)?"NaN":Number.isFinite(u)?void 0:"Infinity":void 0;return l.issues.push({expected:"number",code:"invalid_type",input:u,inst:n,...d?{received:d}:{}}),l}}),Hx=I("$ZodNumberFormat",(n,i)=>{nx.init(n,i),D0.init(n,i)}),qx=I("$ZodBoolean",(n,i)=>{Ut.init(n,i),n._zod.pattern=PS,n._zod.parse=(l,r)=>{if(i.coerce)try{l.value=!!l.value}catch{}const u=l.value;return typeof u=="boolean"||l.issues.push({expected:"boolean",code:"invalid_type",input:u,inst:n}),l}}),Bx=I("$ZodUnknown",(n,i)=>{Ut.init(n,i),n._zod.parse=l=>l}),Vx=I("$ZodNever",(n,i)=>{Ut.init(n,i),n._zod.parse=(l,r)=>(l.issues.push({expected:"never",code:"invalid_type",input:l.value,inst:n}),l)});function Lv(n,i,l){n.issues.length&&i.issues.push(...z0(l,n.issues)),i.value[l]=n.value}const Gx=I("$ZodArray",(n,i)=>{Ut.init(n,i),n._zod.parse=(l,r)=>{const u=l.value;if(!Array.isArray(u))return l.issues.push({expected:"array",code:"invalid_type",input:u,inst:n}),l;l.value=Array(u.length);const d=[];for(let f=0;fLv(v,l,f))):Lv(m,l,f)}return d.length?Promise.all(d).then(()=>l):l}});function xc(n,i,l,r,u,d){const f=l in r;if(n.issues.length){if(u&&d&&!f)return;i.issues.push(...z0(l,n.issues))}if(!f&&!u){n.issues.length||i.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[l]});return}n.value===void 0?f&&(i.value[l]=void 0):i.value[l]=n.value}function U0(n){const i=Object.keys(n.shape);for(const r of i)if(!n.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const l=sS(n.shape);return{...n,keys:i,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(l)}}function Z0(n,i,l,r,u,d){const f=[],p=u.keySet,m=u.catchall._zod,v=m.def.type,w=m.optin==="optional",S=m.optout==="optional";for(const z in i){if(z==="__proto__"||p.has(z))continue;if(v==="never"){f.push(z);continue}const T=m.run({value:i[z],issues:[]},r);T instanceof Promise?n.push(T.then(j=>xc(j,l,z,i,w,S))):xc(T,l,z,i,w,S)}return f.length&&l.issues.push({code:"unrecognized_keys",keys:f,input:i,inst:d}),n.length?Promise.all(n).then(()=>l):l}const Yx=I("$ZodObject",(n,i)=>{if(Ut.init(n,i),!Object.getOwnPropertyDescriptor(i,"shape")?.get){const p=i.shape;Object.defineProperty(i,"shape",{get:()=>{const m={...p};return Object.defineProperty(i,"shape",{value:m}),m}})}const r=Hh(()=>U0(i));ht(n._zod,"propValues",()=>{const p=i.shape,m={};for(const v in p){const w=p[v]._zod;if(w.values){m[v]??(m[v]=new Set);for(const S of w.values)m[v].add(S)}}return m});const u=Sc,d=i.catchall;let f;n._zod.parse=(p,m)=>{f??(f=r.value);const v=p.value;if(!u(v))return p.issues.push({expected:"object",code:"invalid_type",input:v,inst:n}),p;p.value={};const w=[],S=f.shape;for(const z of f.keys){const T=S[z],j=T._zod.optin==="optional",L=T._zod.optout==="optional",V=T._zod.run({value:v[z],issues:[]},m);V instanceof Promise?w.push(V.then(H=>xc(H,p,z,v,j,L))):xc(V,p,z,v,j,L)}return d?Z0(w,v,p,m,r.value,n):w.length?Promise.all(w).then(()=>p):p}}),Qx=I("$ZodObjectJIT",(n,i)=>{Yx.init(n,i);const l=n._zod.parse,r=Hh(()=>U0(i)),u=z=>{const T=new hx(["shape","payload","ctx"]),j=r.value,L=W=>{const B=Zv(W);return`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`};T.write("const input = payload.value;");const V=Object.create(null);let H=0;for(const W of j.keys)V[W]=`key_${H++}`;T.write("const newResult = {};");for(const W of j.keys){const B=V[W],ne=Zv(W),ee=z[W],K=ee?._zod?.optin==="optional",le=ee?._zod?.optout==="optional";T.write(`const ${B} = ${L(W)};`),K&&le?T.write(` if (${B}.issues.length) { if (${ne} in input) { payload.issues = payload.issues.concat(${B}.issues.map(iss => ({ @@ -120,49 +120,49 @@ R"DELIM(),Tt.init(n,i)}),jx=I("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=HS),Tt. } } - `)}T.write("payload.value = newResult;"),T.write("return payload;");const G=T.compile();return(W,B)=>G(z,W,B)};let d;const f=Sc,p=!Lh.jitless,v=p&&nS.value,w=i.catchall;let S;n._zod.parse=(z,T)=>{S??(S=r.value);const j=z.value;return f(j)?p&&v&&T?.async===!1&&T.jitless!==!0?(d||(d=u(i.shape)),z=d(z,T),w?U0([],j,z,T,S,n):z):l(z,T):(z.issues.push({expected:"object",code:"invalid_type",input:j,inst:n}),z)}});function Lv(n,i,l,r){for(const d of n)if(d.issues.length===0)return i.value=d.value,i;const u=n.filter(d=>!rr(d));return u.length===1?(i.value=u[0].value,u[0]):(i.issues.push({code:"invalid_union",input:i.value,inst:l,errors:n.map(d=>d.issues.map(f=>ds(f,r,fs())))}),i)}const Yx=I("$ZodUnion",(n,i)=>{Ut.init(n,i),ht(n._zod,"optin",()=>i.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ht(n._zod,"optout",()=>i.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ht)DELIM" -R"DELIM((n._zod,"values",()=>{if(i.options.every(r=>r._zod.values))return new Set(i.options.flatMap(r=>Array.from(r._zod.values)))}),ht(n._zod,"pattern",()=>{if(i.options.every(r=>r._zod.pattern)){const r=i.options.map(u=>u._zod.pattern);return new RegExp(`^(${r.map(u=>Bh(u.source)).join("|")})$`)}});const l=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(r,u)=>{if(l)return l(r,u);let d=!1;const f=[];for(const p of i.options){const m=p._zod.run({value:r.value,issues:[]},u);if(m instanceof Promise)f.push(m),d=!0;else{if(m.issues.length===0)return m;f.push(m)}}return d?Promise.all(f).then(p=>Lv(p,r,n,u)):Lv(f,r,n,u)}}),Qx=I("$ZodIntersection",(n,i)=>{Ut.init(n,i),n._zod.parse=(l,r)=>{const u=l.value,d=i.left._zod.run({value:u,issues:[]},r),f=i.right._zod.run({value:u,issues:[]},r);return d instanceof Promise||f instanceof Promise?Promise.all([d,f]).then(([m,v])=>Hv(l,m,v)):Hv(l,d,f)}});function ch(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(Co(n)&&Co(i)){const l=Object.keys(i),r=Object.keys(n).filter(d=>l.indexOf(d)!==-1),u={...n,...i};for(const d of r){const f=ch(n[d],i[d]);if(!f.valid)return{valid:!1,mergeErrorPath:[d,...f.mergeErrorPath]};u[d]=f.data}return{valid:!0,data:u}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};const l=[];for(let r=0;rp.l&&p.r).map(([p])=>p);if(d.length&&u&&n.issues.push({...u,keys:d}),rr(n))return n;const f=ch(i.value,l.value);if(!f.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(f.mergeErrorPath)}`);return n.value=f.data,n}const Kx=I("$ZodEnum",(n,i)=>{Ut.init(n,i);const l=_0(i.entries),r=new Set(l);n._zod.values=r,n._zod.pattern=new RegExp(`^(${l.filter(u=>iS.has(typeof u)).map(u=>typeof u=="string"?dr(u):u.toString()).join("|")})$`),n._zod.parse=(u,d)=>{const f=u.value;return r.has(f)||u.issues.push({code:"invalid_value",values:l,input:f,inst:n}),u}}),Fx=I("$ZodLiteral",(n,i)=>{if(Ut.init(n,i),i.values.length===0)throw new Error("Cannot create literal schema with no valid values");const l=new Set(i.values);n._zod.values=l,n._zod.pattern=new RegExp(`^(${i.values.map(r=>typeof r=="string"?dr(r):r?dr(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,u)=>{const d=r.value;return l.has(d)||r.issues.push({code:"invalid_value",values:i.values,input:d,inst:n}),r}}),Jx=I("$ZodTransform",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",n._zod.parse=(l,r)=>{if(r.direction==="backward")throw new b0(n.constructor.name);const u=i.transform(l.value,l);if(r.async)return(u instanceof Promise?u:Promise.resolve(u)).then(f=>(l.value=f,l.fallback=!0,l));if(u instanceof Promise)throw new or;return l.value=u,l.fallback=!0,l}});function qv(n,i){return i===void 0&&(n.issues.length||n.fallback)?{issues:[],value:void 0}:n}const Z0=I("$ZodOptional",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",n._zod.optout="optional",ht(n._zod,"values",()=>i.innerType._zod.values?new Set([...i.innerType._zod.values,void 0]):void 0),ht(n._zod,"pattern",()=>{const l=i.innerType._zod.pattern;return l?new RegExp(`^(${Bh(l.source)})?$`):void 0}),n._zod.parse=(l,r)=>{if(i.innerType._zod.optin==="optional"){const u=l.value,d=i.innerType._zod.run(l,r);return d instanceof Promise?d.then(f=>qv(f,u)):qv(d,u)}return l.value===void 0?l:i.innerType._zod.run(l,r)}}),Xx=I("$ZodExactOptional",(n,i)=>{Z0.init(n,i),ht(n._zod,"values",()=>i.innerType._zod.values),ht(n._zod,"pattern",()=>i.innerType._zod.pattern),n._zod.parse=(l,r)=>i.innerType._zod.run(l,r)}),Ix=I("$ZodNullable",(n,i)=>{Ut.init(n,i),ht(n._zod,"optin",()=>i.innerType._zod.optin),ht(n._zod,"optout",()=>i.innerType._zod.optout),ht(n._zod,"pattern",()=>{const l=i.innerType._zod.pattern;return l?new RegExp(`^(${Bh(l.source)}|null)$`):void 0}),ht(n._zod,"values",()=>i.innerType._zod.values?new Set([...i.innerType._zod.values,null]):void 0),n._zod.parse=(l,r)=>l.value===null?l:i.innerType._zod.run(l,r)}),Px=I("$ZodDefault",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(l,r)=>{if(r.direction==="backward")return i.innerType._zod.run(l,r);if(l.value===void 0)return l.value=i.defaultValue,l;const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(d=>Bv(d,i)):Bv(u,i)}});function Bv(n,i){return n.value===void 0&&(n.value=i.defaultValue),n}const Wx=I("$ZodPrefault",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(l,r)=>(r.direction==="backward"||l.value===void 0&&(l.value=i.defaultValue),i.innerType._zod.run(l,r))}),ew=I("$ZodNonOptional",(n,i)=>{Ut.init(n,i),ht(n._zod,"values",()=>{const l=i.innerType._zod.values;return l?new Set([...l].filter(r=>r!==void 0)):void 0}),n._zod.parse=(l,r)=>{const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(d=>Vv(d,n)):Vv(u,n)}});function Vv(n,i){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:i}),n}const tw=I("$ZodCatch",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"optout",()=>i.innerType._zod.optout),ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(l,r)=>{if(r.direction==="backward")return i.innerType._zod.run(l,r);const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(d=>(l.value=d.value,d.issues.length&&(l.value=i.catchValue({...l,error:{issues:d.issues.map(f=>ds(f,r,fs()))},input:l.value}),l.issues=[],l.fallback=!0),l)):(l.value=u.value,u.issues.length&&(l.value=i.catchValue({...l,error:{issues:u.issues.map(d=>ds(d,r,fs()))},input:l.value}),l.issues=[],l.fallback=!0),l)}}),nw=I("$ZodPipe",(n,i)=>{Ut.init(n,i),ht(n._zod,"values",()=>i.in._zod.values),ht(n._zod,"optin",()=>i.in._zod.optin),ht(n._zod,"optout",()=>i.out._zod.optout),ht(n._zod,"propValues",()=>i.in._zod.propValues),n._zod.parse=(l,r)=>{if(r.direction==="backward"){const d=i.out._zod.run(l,r);return d instanceof Promise?d.then(f=>cc(f,i.in,r)):cc(d,i.in,r)}const u=i.in._zod.run(l,r);return u instanceof Promise?u.then(d=>cc(d,i.out,r)):cc(u,i.out,r)}});function cc(n,i,l){return n.issues.length?(n.aborted=!0,n):i._zod.run({value:n.value,issues:n.issues,fallback:n.fallback},l)}const iw=I("$ZodReadonly",(n,i)=>{Ut.init(n,i),ht(n._zod,"propValues",()=>i.innerType._zod.propValues),ht(n._zod,"values",()=>i.innerType._zod.values),ht(n._zod,"optin",()=>i.innerType?._zod?.optin),ht(n._zod,"optout",()=>i.innerType?._zod?.optout),n._zod.parse=(l,r)=>{if(r.direction==="backward")return i.innerType._zod.run(l,r);const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(Gv):Gv(u)}});function Gv(n){return n.value=Object.freeze(n.value),n}const aw=I("$ZodCustom",(n,i)=>{Wn.init(n,i),Ut.init(n,i),n._zod.parse=(l,r)=>l,n._zod.check=l=>{const r=l.value,u=i.fn(r);if(u instanceof Promise)return u.then(d=>Yv(d,l,r,n));Yv(u,l,r,n)}});function Yv(n,i,l,r){if(!n){const u={code:"custom",input:l,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(u.params=r._zod.def.params),i.issues.push(Do(u))}}var Qv;class lw{constructor(){this._map=new WeakMap,this._idmap=new Map}add(i,...l){const r=l[0];return this._map.set(i,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,i),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(i){const l=this._map.get(i);return l&&typeof l=="object"&&"id"in l&&this._idmap.delete(l.id),this._map.delete(i),this}get(i){const l=i._zod)DELIM" -R"DELIM(.parent;if(l){const r={...this.get(l)??{}};delete r.id;const u={...r,...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 sw(){return new lw}(Qv=globalThis).__zod_globalRegistry??(Qv.__zod_globalRegistry=sw());const Ao=globalThis.__zod_globalRegistry;function rw(n,i){return new n({type:"string",...Ne(i)})}function ow(n,i){return new n({type:"string",format:"email",check:"string_format",abort:!1,...Ne(i)})}function Kv(n,i){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...Ne(i)})}function uw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...Ne(i)})}function cw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ne(i)})}function fw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ne(i)})}function dw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ne(i)})}function hw(n,i){return new n({type:"string",format:"url",check:"string_format",abort:!1,...Ne(i)})}function mw(n,i){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...Ne(i)})}function pw(n,i){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ne(i)})}function gw(n,i){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...Ne(i)})}function vw(n,i){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ne(i)})}function yw(n,i){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...Ne(i)})}function bw(n,i){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...Ne(i)})}function _w(n,i){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ne(i)})}function Sw(n,i){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ne(i)})}function xw(n,i){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ne(i)})}function ww(n,i){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ne(i)})}function zw(n,i){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ne(i)})}function Ew(n,i){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...Ne(i)})}function Tw(n,i){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...Ne(i)})}function Aw(n,i){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...Ne(i)})}function Nw(n,i){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...Ne(i)})}function Ow(n,i){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ne(i)})}function Mw(n,i){return new n({type:"string",format:"date",check:"string_format",...Ne(i)})}function jw(n,i){return new n({type:"string",format:"time",check:"string_format",precision:null,...Ne(i)})}function kw(n,i){return new n({type:"string",format:"duration",check:"string_format",...Ne(i)})}function Rw(n,i){return new n({type:"number",checks:[],...Ne(i)})}function Cw(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...Ne(i)})}function Dw(n,i){return new n({type:"boolean",...Ne(i)})}function Uw(n){return new n({type:"unknown"})}function Zw(n,i){return new n({type:"never",...Ne(i)})}function Fv(n,i){return new j0({check:"less_than",...Ne(i),value:n,inclusive:!1})}function Xd(n,i){return new j0({check:"less_than",...Ne(i),value:n,inclusive:!0})}function Jv(n,i){return new k0({check:"greater_than",...Ne(i),value:n,inclusive:!1})}function Id(n,i){return new k0({check:"greater_than",...Ne(i),value:n,inclusive:!0})}function Xv(n,i){return new WS({check:"multiple_of",...Ne(i),value:n})}function $0(n,i){return new tx({check:"max_length",...Ne(i),maximum:n})}function wc(n,i){return new nx({check:"min_length",...Ne(i),minimum:n})}function L0(n,i){return new ix({check:"length_equals",...Ne(i),length:n})}function $w(n,i){return new ax({check:"string_format",format:"regex",...Ne(i),pattern:n})}function Lw(n){return new lx({check:"string_format",format:"lowercase",...Ne(n)})}function Hw(n){return new sx({check:"string_format",format:"uppercase",...Ne(n)})}function qw(n,i){return new rx({check:"string_format",format:"includes",...Ne(i),includes:n})}function Bw(n,i){return new ox({check:"string_format",format:"starts_with",...Ne(i),prefix:n})}function Vw(n,i){return new ux({check:"string_format",format:"ends_with",...Ne(i),suffix:n})}function yr(n){return new cx({check:"overwrite",tx:n})}function Gw(n){return yr(i=>i.normalize(n))}function Yw(){return yr(n=>n.trim())}function Qw(){return yr(n=>n.toLowerCase())}function Kw(){return yr(n=>n.toUpperCase())}function Fw(){return yr(n=>tS(n))}function Jw(n,i,l){return new n({type:"array",element:i,...Ne(l)})}function Xw(n,i,l){return new n({type:"custom",check:"custom",fn:i,...Ne(l)})}function Iw(n,i){const l=Pw(r=>(r.addIssue=u=>{if(typeof u=="string")r.issues.push(Do(u,r.value,l._zod.def));else{const d=u;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=r.value),d.inst??(d.inst=l),d.continue??(d.continue=!l._zod.def.abort),r.issues.push(Do(d))}},n(r.value,r)),i);return l}function Pw(n,i){const l=new Wn({check:"custom",...Ne(i)});return l._zod.check=n,l}function H0(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??Ao,target:i,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0}}function Sn(n,i,l={path:[],schemaPath:[]}){var r;const u=n._zod.def,d=i.seen.get(n);if(d)return d.count++,l.schemaPath.includes(n)&&(d.cycle=l.path),d.schema;const f={schema:{},count:1,cycle:void 0,path:l.path};i.seen.set(n,f);const p=n._zod.toJSONSchema?.();if(p)f.schema=p;else{const w={...l,schemaPath:[...l.schemaPath,n],path:l.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(i,f.schema,w);else{const z=f.schema,T=i.processors[u.type];if(!T)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${u.type}`);T(n,i,z,w)}const S=n._zod.parent;S&&(f.ref||(f.ref=S),Sn(S,i,w),i.seen.get(S).isParent=!0)}const m=i.metadataRegistry.get(n);return m&&Object.assign(f.schema,m),i.io==="input"&&Ln(n)&&(delete f.schema.examples,delete f.schema.default),i.io==="input"&&"_prefault"in f.schema&&((r=f.schema).default??(r.default=f.schema._prefault)),delete f.schema._prefault,i.seen.get(n).schema}function q0(n,i){const l=n.seen.get(i);if(!l)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const f of n.seen.entries()){const p=n.metadataRegistry.get(f[0])?.id;if(p){const m=r.get(p);if(m&&m!==f[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,f[0])}}const u=f=>{const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const S=n.external.registry.get(f[0])?.id,z=n.external.uri??(j=>j);if(S)return{ref:z(S)};const T=f[1].defId??f[1].schema.id??`schema${n.counter++}`;return f[1].defId=T,{defId:T,ref:`${z("__shared")}#/${p}/${T}`}}if(f[1]===l)return{ref:"#"};const v=`#/${p}/`,w=f[1].schema.id??`__schema${n.counter++}`;return{defId:w,ref:v+w}},d=f=>{if(f[1].schema.$ref)return;const p=f[1],{ref:m,defId:v}=u(f);p.def={...p.schema},v&&(p.defId=v);const w=p.schema;for(const S in w)delete w[S];w.$ref=m};if(n.cycles==="throw")for(const f of n.seen.entries()){const p=f[1];if(p.cycle)throw new Error(`Cycle detected: #/${p.cycle?.join("/")}/ + `)}T.write("payload.value = newResult;"),T.write("return payload;");const G=T.compile();return(W,B)=>G(z,W,B)};let d;const f=Sc,p=!Lh.jitless,v=p&&aS.value,w=i.catchall;let S;n._zod.parse=(z,T)=>{S??(S=r.value);const j=z.value;return f(j)?p&&v&&T?.async===!1&&T.jitless!==!0?(d||(d=u(i.shape)),z=d(z,T),w?Z0([],j,z,T,S,n):z):l(z,T):(z.issues.push({expected:"object",code:"invalid_type",input:j,inst:n}),z)}});function Hv(n,i,l,r){for(const d of n)if(d.issues.length===0)return i.value=d.value,i;const u=n.filter(d=>!rr(d));return u.length===1?(i.value=u[0].value,u[0]):(i.issues.push({code:"invalid_union",input:i.value,inst:l,errors:n.map(d=>d.issues.map(f=>ds(f,r,fs())))}),i)}const Kx=I("$ZodUnion",(n,i)=>{Ut.init(n,i),ht(n._zod,"optin",()=>i.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ht(n._zod,"optout",()=>i.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ht)DELIM" +R"DELIM((n._zod,"values",()=>{if(i.options.every(r=>r._zod.values))return new Set(i.options.flatMap(r=>Array.from(r._zod.values)))}),ht(n._zod,"pattern",()=>{if(i.options.every(r=>r._zod.pattern)){const r=i.options.map(u=>u._zod.pattern);return new RegExp(`^(${r.map(u=>Bh(u.source)).join("|")})$`)}});const l=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(r,u)=>{if(l)return l(r,u);let d=!1;const f=[];for(const p of i.options){const m=p._zod.run({value:r.value,issues:[]},u);if(m instanceof Promise)f.push(m),d=!0;else{if(m.issues.length===0)return m;f.push(m)}}return d?Promise.all(f).then(p=>Hv(p,r,n,u)):Hv(f,r,n,u)}}),Fx=I("$ZodIntersection",(n,i)=>{Ut.init(n,i),n._zod.parse=(l,r)=>{const u=l.value,d=i.left._zod.run({value:u,issues:[]},r),f=i.right._zod.run({value:u,issues:[]},r);return d instanceof Promise||f instanceof Promise?Promise.all([d,f]).then(([m,v])=>qv(l,m,v)):qv(l,d,f)}});function ch(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(Co(n)&&Co(i)){const l=Object.keys(i),r=Object.keys(n).filter(d=>l.indexOf(d)!==-1),u={...n,...i};for(const d of r){const f=ch(n[d],i[d]);if(!f.valid)return{valid:!1,mergeErrorPath:[d,...f.mergeErrorPath]};u[d]=f.data}return{valid:!0,data:u}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};const l=[];for(let r=0;rp.l&&p.r).map(([p])=>p);if(d.length&&u&&n.issues.push({...u,keys:d}),rr(n))return n;const f=ch(i.value,l.value);if(!f.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(f.mergeErrorPath)}`);return n.value=f.data,n}const Jx=I("$ZodEnum",(n,i)=>{Ut.init(n,i);const l=S0(i.entries),r=new Set(l);n._zod.values=r,n._zod.pattern=new RegExp(`^(${l.filter(u=>lS.has(typeof u)).map(u=>typeof u=="string"?dr(u):u.toString()).join("|")})$`),n._zod.parse=(u,d)=>{const f=u.value;return r.has(f)||u.issues.push({code:"invalid_value",values:l,input:f,inst:n}),u}}),Xx=I("$ZodLiteral",(n,i)=>{if(Ut.init(n,i),i.values.length===0)throw new Error("Cannot create literal schema with no valid values");const l=new Set(i.values);n._zod.values=l,n._zod.pattern=new RegExp(`^(${i.values.map(r=>typeof r=="string"?dr(r):r?dr(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,u)=>{const d=r.value;return l.has(d)||r.issues.push({code:"invalid_value",values:i.values,input:d,inst:n}),r}}),Ix=I("$ZodTransform",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",n._zod.parse=(l,r)=>{if(r.direction==="backward")throw new _0(n.constructor.name);const u=i.transform(l.value,l);if(r.async)return(u instanceof Promise?u:Promise.resolve(u)).then(f=>(l.value=f,l.fallback=!0,l));if(u instanceof Promise)throw new or;return l.value=u,l.fallback=!0,l}});function Bv(n,i){return i===void 0&&(n.issues.length||n.fallback)?{issues:[],value:void 0}:n}const $0=I("$ZodOptional",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",n._zod.optout="optional",ht(n._zod,"values",()=>i.innerType._zod.values?new Set([...i.innerType._zod.values,void 0]):void 0),ht(n._zod,"pattern",()=>{const l=i.innerType._zod.pattern;return l?new RegExp(`^(${Bh(l.source)})?$`):void 0}),n._zod.parse=(l,r)=>{if(i.innerType._zod.optin==="optional"){const u=l.value,d=i.innerType._zod.run(l,r);return d instanceof Promise?d.then(f=>Bv(f,u)):Bv(d,u)}return l.value===void 0?l:i.innerType._zod.run(l,r)}}),Px=I("$ZodExactOptional",(n,i)=>{$0.init(n,i),ht(n._zod,"values",()=>i.innerType._zod.values),ht(n._zod,"pattern",()=>i.innerType._zod.pattern),n._zod.parse=(l,r)=>i.innerType._zod.run(l,r)}),Wx=I("$ZodNullable",(n,i)=>{Ut.init(n,i),ht(n._zod,"optin",()=>i.innerType._zod.optin),ht(n._zod,"optout",()=>i.innerType._zod.optout),ht(n._zod,"pattern",()=>{const l=i.innerType._zod.pattern;return l?new RegExp(`^(${Bh(l.source)}|null)$`):void 0}),ht(n._zod,"values",()=>i.innerType._zod.values?new Set([...i.innerType._zod.values,null]):void 0),n._zod.parse=(l,r)=>l.value===null?l:i.innerType._zod.run(l,r)}),ew=I("$ZodDefault",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(l,r)=>{if(r.direction==="backward")return i.innerType._zod.run(l,r);if(l.value===void 0)return l.value=i.defaultValue,l;const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(d=>Vv(d,i)):Vv(u,i)}});function Vv(n,i){return n.value===void 0&&(n.value=i.defaultValue),n}const tw=I("$ZodPrefault",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(l,r)=>(r.direction==="backward"||l.value===void 0&&(l.value=i.defaultValue),i.innerType._zod.run(l,r))}),nw=I("$ZodNonOptional",(n,i)=>{Ut.init(n,i),ht(n._zod,"values",()=>{const l=i.innerType._zod.values;return l?new Set([...l].filter(r=>r!==void 0)):void 0}),n._zod.parse=(l,r)=>{const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(d=>Gv(d,n)):Gv(u,n)}});function Gv(n,i){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:i}),n}const iw=I("$ZodCatch",(n,i)=>{Ut.init(n,i),n._zod.optin="optional",ht(n._zod,"optout",()=>i.innerType._zod.optout),ht(n._zod,"values",()=>i.innerType._zod.values),n._zod.parse=(l,r)=>{if(r.direction==="backward")return i.innerType._zod.run(l,r);const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(d=>(l.value=d.value,d.issues.length&&(l.value=i.catchValue({...l,error:{issues:d.issues.map(f=>ds(f,r,fs()))},input:l.value}),l.issues=[],l.fallback=!0),l)):(l.value=u.value,u.issues.length&&(l.value=i.catchValue({...l,error:{issues:u.issues.map(d=>ds(d,r,fs()))},input:l.value}),l.issues=[],l.fallback=!0),l)}}),aw=I("$ZodPipe",(n,i)=>{Ut.init(n,i),ht(n._zod,"values",()=>i.in._zod.values),ht(n._zod,"optin",()=>i.in._zod.optin),ht(n._zod,"optout",()=>i.out._zod.optout),ht(n._zod,"propValues",()=>i.in._zod.propValues),n._zod.parse=(l,r)=>{if(r.direction==="backward"){const d=i.out._zod.run(l,r);return d instanceof Promise?d.then(f=>cc(f,i.in,r)):cc(d,i.in,r)}const u=i.in._zod.run(l,r);return u instanceof Promise?u.then(d=>cc(d,i.out,r)):cc(u,i.out,r)}});function cc(n,i,l){return n.issues.length?(n.aborted=!0,n):i._zod.run({value:n.value,issues:n.issues,fallback:n.fallback},l)}const lw=I("$ZodReadonly",(n,i)=>{Ut.init(n,i),ht(n._zod,"propValues",()=>i.innerType._zod.propValues),ht(n._zod,"values",()=>i.innerType._zod.values),ht(n._zod,"optin",()=>i.innerType?._zod?.optin),ht(n._zod,"optout",()=>i.innerType?._zod?.optout),n._zod.parse=(l,r)=>{if(r.direction==="backward")return i.innerType._zod.run(l,r);const u=i.innerType._zod.run(l,r);return u instanceof Promise?u.then(Yv):Yv(u)}});function Yv(n){return n.value=Object.freeze(n.value),n}const sw=I("$ZodCustom",(n,i)=>{Wn.init(n,i),Ut.init(n,i),n._zod.parse=(l,r)=>l,n._zod.check=l=>{const r=l.value,u=i.fn(r);if(u instanceof Promise)return u.then(d=>Qv(d,l,r,n));Qv(u,l,r,n)}});function Qv(n,i,l,r){if(!n){const u={code:"custom",input:l,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(u.params=r._zod.def.params),i.issues.push(Do(u))}}var Kv;class rw{constructor(){this._map=new WeakMap,this._idmap=new Map}add(i,...l){const r=l[0];return this._map.set(i,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,i),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(i){const l=this._map.get(i);return l&&typeof l=="object"&&"id"in l&&this._idmap.delete(l.id),this._map.delete(i),this}get(i){const l=i._zod)DELIM" +R"DELIM(.parent;if(l){const r={...this.get(l)??{}};delete r.id;const u={...r,...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 ow(){return new rw}(Kv=globalThis).__zod_globalRegistry??(Kv.__zod_globalRegistry=ow());const Ao=globalThis.__zod_globalRegistry;function uw(n,i){return new n({type:"string",...Ne(i)})}function cw(n,i){return new n({type:"string",format:"email",check:"string_format",abort:!1,...Ne(i)})}function Fv(n,i){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...Ne(i)})}function fw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...Ne(i)})}function dw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ne(i)})}function hw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ne(i)})}function mw(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ne(i)})}function pw(n,i){return new n({type:"string",format:"url",check:"string_format",abort:!1,...Ne(i)})}function gw(n,i){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...Ne(i)})}function vw(n,i){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ne(i)})}function yw(n,i){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...Ne(i)})}function bw(n,i){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ne(i)})}function _w(n,i){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...Ne(i)})}function Sw(n,i){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...Ne(i)})}function xw(n,i){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ne(i)})}function ww(n,i){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ne(i)})}function zw(n,i){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ne(i)})}function Ew(n,i){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ne(i)})}function Tw(n,i){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ne(i)})}function Aw(n,i){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...Ne(i)})}function Nw(n,i){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...Ne(i)})}function Mw(n,i){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...Ne(i)})}function Ow(n,i){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...Ne(i)})}function jw(n,i){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ne(i)})}function kw(n,i){return new n({type:"string",format:"date",check:"string_format",...Ne(i)})}function Rw(n,i){return new n({type:"string",format:"time",check:"string_format",precision:null,...Ne(i)})}function Cw(n,i){return new n({type:"string",format:"duration",check:"string_format",...Ne(i)})}function Dw(n,i){return new n({type:"number",checks:[],...Ne(i)})}function Uw(n,i){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...Ne(i)})}function Zw(n,i){return new n({type:"boolean",...Ne(i)})}function $w(n){return new n({type:"unknown"})}function Lw(n,i){return new n({type:"never",...Ne(i)})}function Jv(n,i){return new k0({check:"less_than",...Ne(i),value:n,inclusive:!1})}function Xd(n,i){return new k0({check:"less_than",...Ne(i),value:n,inclusive:!0})}function Xv(n,i){return new R0({check:"greater_than",...Ne(i),value:n,inclusive:!1})}function Id(n,i){return new R0({check:"greater_than",...Ne(i),value:n,inclusive:!0})}function Iv(n,i){return new tx({check:"multiple_of",...Ne(i),value:n})}function L0(n,i){return new ix({check:"max_length",...Ne(i),maximum:n})}function wc(n,i){return new ax({check:"min_length",...Ne(i),minimum:n})}function H0(n,i){return new lx({check:"length_equals",...Ne(i),length:n})}function Hw(n,i){return new sx({check:"string_format",format:"regex",...Ne(i),pattern:n})}function qw(n){return new rx({check:"string_format",format:"lowercase",...Ne(n)})}function Bw(n){return new ox({check:"string_format",format:"uppercase",...Ne(n)})}function Vw(n,i){return new ux({check:"string_format",format:"includes",...Ne(i),includes:n})}function Gw(n,i){return new cx({check:"string_format",format:"starts_with",...Ne(i),prefix:n})}function Yw(n,i){return new fx({check:"string_format",format:"ends_with",...Ne(i),suffix:n})}function yr(n){return new dx({check:"overwrite",tx:n})}function Qw(n){return yr(i=>i.normalize(n))}function Kw(){return yr(n=>n.trim())}function Fw(){return yr(n=>n.toLowerCase())}function Jw(){return yr(n=>n.toUpperCase())}function Xw(){return yr(n=>iS(n))}function Iw(n,i,l){return new n({type:"array",element:i,...Ne(l)})}function Pw(n,i,l){return new n({type:"custom",check:"custom",fn:i,...Ne(l)})}function Ww(n,i){const l=ez(r=>(r.addIssue=u=>{if(typeof u=="string")r.issues.push(Do(u,r.value,l._zod.def));else{const d=u;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=r.value),d.inst??(d.inst=l),d.continue??(d.continue=!l._zod.def.abort),r.issues.push(Do(d))}},n(r.value,r)),i);return l}function ez(n,i){const l=new Wn({check:"custom",...Ne(i)});return l._zod.check=n,l}function q0(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??Ao,target:i,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0}}function Sn(n,i,l={path:[],schemaPath:[]}){var r;const u=n._zod.def,d=i.seen.get(n);if(d)return d.count++,l.schemaPath.includes(n)&&(d.cycle=l.path),d.schema;const f={schema:{},count:1,cycle:void 0,path:l.path};i.seen.set(n,f);const p=n._zod.toJSONSchema?.();if(p)f.schema=p;else{const w={...l,schemaPath:[...l.schemaPath,n],path:l.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(i,f.schema,w);else{const z=f.schema,T=i.processors[u.type];if(!T)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${u.type}`);T(n,i,z,w)}const S=n._zod.parent;S&&(f.ref||(f.ref=S),Sn(S,i,w),i.seen.get(S).isParent=!0)}const m=i.metadataRegistry.get(n);return m&&Object.assign(f.schema,m),i.io==="input"&&Ln(n)&&(delete f.schema.examples,delete f.schema.default),i.io==="input"&&"_prefault"in f.schema&&((r=f.schema).default??(r.default=f.schema._prefault)),delete f.schema._prefault,i.seen.get(n).schema}function B0(n,i){const l=n.seen.get(i);if(!l)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const f of n.seen.entries()){const p=n.metadataRegistry.get(f[0])?.id;if(p){const m=r.get(p);if(m&&m!==f[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,f[0])}}const u=f=>{const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const S=n.external.registry.get(f[0])?.id,z=n.external.uri??(j=>j);if(S)return{ref:z(S)};const T=f[1].defId??f[1].schema.id??`schema${n.counter++}`;return f[1].defId=T,{defId:T,ref:`${z("__shared")}#/${p}/${T}`}}if(f[1]===l)return{ref:"#"};const v=`#/${p}/`,w=f[1].schema.id??`__schema${n.counter++}`;return{defId:w,ref:v+w}},d=f=>{if(f[1].schema.$ref)return;const p=f[1],{ref:m,defId:v}=u(f);p.def={...p.schema},v&&(p.defId=v);const w=p.schema;for(const S in w)delete w[S];w.$ref=m};if(n.cycles==="throw")for(const f of n.seen.entries()){const p=f[1];if(p.cycle)throw new Error(`Cycle detected: #/${p.cycle?.join("/")}/ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of n.seen.entries()){const p=f[1];if(i===f[0]){d(f);continue}if(n.external){const v=n.external.registry.get(f[0])?.id;if(i!=)DELIM" -R"DELIM(=f[0]&&v){d(f);continue}}if(n.metadataRegistry.get(f[0])?.id){d(f);continue}if(p.cycle){d(f);continue}if(p.count>1&&n.reused==="ref"){d(f);continue}}}function B0(n,i){const l=n.seen.get(i);if(!l)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const m=n.seen.get(p);if(m.ref===null)return;const v=m.def??m.schema,w={...v},S=m.ref;if(m.ref=null,S){r(S);const T=n.seen.get(S),j=T.schema;if(j.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(v.allOf=v.allOf??[],v.allOf.push(j)):Object.assign(v,j),Object.assign(v,w),p._zod.parent===S)for(const V in v)V==="$ref"||V==="allOf"||V in w||delete v[V];if(j.$ref&&T.def)for(const V in v)V==="$ref"||V==="allOf"||V in T.def&&JSON.stringify(v[V])===JSON.stringify(T.def[V])&&delete v[V]}const z=p._zod.parent;if(z&&z!==S){r(z);const T=n.seen.get(z);if(T?.schema.$ref&&(v.$ref=T.schema.$ref,T.def))for(const j in v)j==="$ref"||j==="allOf"||j in T.def&&JSON.stringify(v[j])===JSON.stringify(T.def[j])&&delete v[j]}n.override({zodSchema:p,jsonSchema:v,path:m.path??[]})};for(const p of[...n.seen.entries()].reverse())r(p[0]);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 p=n.external.registry.get(i)?.id;if(!p)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(p)}Object.assign(u,l.def??l.schema);const d=n.metadataRegistry.get(i)?.id;d!==void 0&&u.id===d&&delete u.id;const f=n.external?.defs??{};for(const p of n.seen.entries()){const m=p[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,f[m.defId]=m.def)}n.external||Object.keys(f).length>0&&(n.target==="draft-2020-12"?u.$defs=f:u.definitions=f);try{const p=JSON.parse(JSON.stringify(u));return Object.defineProperty(p,"~standard",{value:{...i["~standard"],jsonSchema:{input:zc(i,"input",n.processors),output:zc(i,"output",n.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function Ln(n,i){const l=i??{seen:new Set};if(l.seen.has(n))return!1;l.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ln(r.element,l);if(r.type==="set")return Ln(r.valueType,l);if(r.type==="lazy")return Ln(r.getter(),l);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ln(r.innerType,l);if(r.type==="intersection")return Ln(r.left,l)||Ln(r.right,l);if(r.type==="record"||r.type==="map")return Ln(r.keyType,l)||Ln(r.valueType,l);if(r.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:Ln(r.in,l)||Ln(r.out,l);if(r.type==="object"){for(const u in r.shape)if(Ln(r.shape[u],l))return!0;return!1}if(r.type==="union"){for(const u of r.options)if(Ln(u,l))return!0;return!1}if(r.type==="tuple"){for(const u of r.items)if(Ln(u,l))return!0;return!!(r.rest&&Ln(r.rest,l))}return!1}const Ww=(n,i={})=>l=>{const r=H0({...l,processors:i});return Sn(n,r),q0(r,n),B0(r,n)},zc=(n,i,l={})=>r=>{const{libraryOptions:u,target:d}=r??{},f=H0({...u??{},target:d,io:i,processors:l});return Sn(n,f),q0(f,n),B0(f,n)},ez={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tz=(n,i,l,r)=>{const u=l;u.type="string";const{minimum:d,maximum:f,format:p,patterns:m,contentEncoding:v}=n._zod.bag;if(typeof d=="number"&&(u.minLength=d),typeof f=="number"&&(u.maxLength=f),p&&(u.format=ez[p]??p,u.format===""&&delete u.format,p==="time"&&delete u.format),v&&(u.contentEncoding=v),m&&m.size>0){const w=[...m];w.length===1?u.pattern=w[0].source:w.length>1&&(u.allOf=[...w.map(S=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:S.source}))])}},nz=(n,i,l,r)=>{const u=l,{minimum:d,maximum:f,format:p,multipleOf:m,exclusiveMaximum:v,exclusiveMinimum:w}=n._zod.bag;typeof p=="string"&&p.includes("int")?u.type="integer":u.type="number";const S=typeof w=="number"&&w>=(d??Number.NEGATIVE_INFINITY),z=typeof v=="number"&&v<=(f??Number.POSITIVE_INFINITY),T=i.target==="draft-04"||i.target==="openapi-3.0";S?T?(u.minimum=w,u.exclusiveMinimum=!0):u.exclusiveMinimum=w:typeof d=="number"&&(u.minimum=d),z?T?(u.maximum=v,u.exclusiveMaximum=!0):u.exclusiveMaximum=v:typeof f=="number"&&(u.maximum=f),typeof m=="number"&&(u.multipleOf=m)},iz=(n,i,l,r)=>{l.type="boolean"},az=(n,i,l,r)=>{l.not={}},lz=(n,i,l,r)=>{},sz=(n,i,l,r)=>{const u=n._zod.def,d=_0(u.entries);d.every(f=>typeof f=="number")&&(l.type="number"),d.every(f=>typeof f=="string")&&(l.type="string"),l.enum=d},rz=(n,i,l,r)=>{const u=n._zod.def,d=[];for(const f of u.values)if(f===void 0){if(i.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof f=="bigint"){if(i.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");d.push(Number(f))}else d.push(f);if(d.length!==0)if(d.length===1){const f=d[0];l.type=f===null?"null":typeof f,i.target==="draft-04"||i.target==="openapi-3.0"?l.enum=[f]:l.const=f}else d.every(f=>typeof f=="number")&&(l.type="number"),d.every(f=>typeof f=="string")&&(l.type="string"),d.every(f=>typeof f=="boolean")&&(l.type="boolean"),d.every(f=>f===null)&&(l.type="null"),l.enum=d},oz=(n,i,l,r)=>{if(i.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},uz=(n,i,l,r)=>{if(i.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},cz=(n,i,l,r)=>{const u=l,d=n._zod.def,{minimum:f,maximum:p}=n._zod.bag;typeof f=="number"&&(u.minItems=f),typeof p=="number"&&(u.maxItems=p),u.type="array",u.items=Sn(d.element,i,{...r,path:[...r.path,"items"]})},fz=(n,i,l,r)=>{const u=l,d=n._zod.def;u.type="object",u.properties={};const f=d.shape;for(const v in f)u.properties[v]=Sn(f[v],i,{...r,path:[...r.path,"properties",v]});const p=new Set(Object.keys(f)),m=new Set([...p].filter(v=>{const w=d.shape[v]._zod;return i.io==="input"?w.optin===void 0:w.optout===void 0}));m.size>0&&(u.required=Array.from(m)),d.catchall?._zod.def.type==="never"?u.additionalProperties=!1:d.catchall?d.catchall&&(u.additionalProperties=Sn(d.catchall,i,{...r,path:[...r.path,"additionalProperties"]})):i.io==="output"&&(u.additionalProperties=!1)},dz=(n,i,l,r)=>{const u=n._zod.def,d=u.inclusive===!1,f=u.options.map((p,m)=>Sn(p,i,{...r,path:[...r.path,d?"oneOf":"anyOf",m]}));d?l.oneOf=f:l.anyOf=f},hz=(n,i,l,r)=>{const u=n._zod.def,d=Sn(u.left,i,{...r,path:[...r.path,"allOf",0]}),f=Sn(u.right,i,{...r,path:[...r.path,"allOf",1]}),p=v=>"allOf"in v&&Object.keys(v).length===1,m=[...p(d)?d.allOf:[d],...p(f)?f.allOf:[f]];l.allOf=m},mz=(n,i,l,r)=>{const u=n._zod.def,d=Sn(u.innerType,i,r),f=i.seen.get(n);i.target==="openapi-3.0"?(f.ref=u.innerType,l.nullable=!0):l.anyOf=[d,{type:"null"}]},pz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType},gz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType,l.default=JSON.parse(JSON.stringify(u.defaultValue))},vz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType,i.io==="input"&&(l._prefault=JSON.parse(JSON.stringify(u.defaultValue)))},yz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType;let f;try{f=u.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}l.default=f},bz=(n,i,l,r)=>{const u=n._zod.def,d=u.in._zod.traits.has("$ZodTransform"),f=i.io==="input"?d?u.out:u.in:u.out;Sn(f,i,r);const p=i.seen.get(n);p.ref=f},_z=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType,l.readOnly=!0},V0=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType},Sz=I("ZodISODateTime",(n,i)=>{zx.init(n,i),Ot.init(n,i)});fu)DELIM" -R"DELIM(nction xz(n){return Ow(Sz,n)}const wz=I("ZodISODate",(n,i)=>{Ex.init(n,i),Ot.init(n,i)});function zz(n){return Mw(wz,n)}const Ez=I("ZodISOTime",(n,i)=>{Tx.init(n,i),Ot.init(n,i)});function Tz(n){return jw(Ez,n)}const Az=I("ZodISODuration",(n,i)=>{Ax.init(n,i),Ot.init(n,i)});function Nz(n){return kw(Az,n)}const Oz=(n,i)=>{E0.init(n,i),n.name="ZodError",Object.defineProperties(n,{format:{value:l=>pS(n,l)},flatten:{value:l=>mS(n,l)},addIssue:{value:l=>{n.issues.push(l),n.message=JSON.stringify(n.issues,uh,2)}},addIssues:{value:l=>{n.issues.push(...l),n.message=JSON.stringify(n.issues,uh,2)}},isEmpty:{get(){return n.issues.length===0}}})},Mi=I("ZodError",Oz,{Parent:Error}),Mz=Gh(Mi),jz=Yh(Mi),kz=Uc(Mi),Rz=Zc(Mi),Cz=yS(Mi),Dz=bS(Mi),Uz=_S(Mi),Zz=SS(Mi),$z=xS(Mi),Lz=wS(Mi),Hz=zS(Mi),qz=ES(Mi),Iv=new WeakMap;function Lo(n,i,l){const r=Object.getPrototypeOf(n);let u=Iv.get(r);if(u||(u=new Set,Iv.set(r,u)),!u.has(i)){u.add(i);for(const d in l){const f=l[d];Object.defineProperty(r,d,{configurable:!0,enumerable:!1,get(){const p=f.bind(this);return Object.defineProperty(this,d,{configurable:!0,writable:!0,enumerable:!0,value:p}),p},set(p){Object.defineProperty(this,d,{configurable:!0,writable:!0,enumerable:!0,value:p})}})}}}const Zt=I("ZodType",(n,i)=>(Ut.init(n,i),Object.assign(n["~standard"],{jsonSchema:{input:zc(n,"input"),output:zc(n,"output")}}),n.toJSONSchema=Ww(n,{}),n.def=i,n.type=i.type,Object.defineProperty(n,"_def",{value:i}),n.parse=(l,r)=>Mz(n,l,r,{callee:n.parse}),n.safeParse=(l,r)=>kz(n,l,r),n.parseAsync=async(l,r)=>jz(n,l,r,{callee:n.parseAsync}),n.safeParseAsync=async(l,r)=>Rz(n,l,r),n.spa=n.safeParseAsync,n.encode=(l,r)=>Cz(n,l,r),n.decode=(l,r)=>Dz(n,l,r),n.encodeAsync=async(l,r)=>Uz(n,l,r),n.decodeAsync=async(l,r)=>Zz(n,l,r),n.safeEncode=(l,r)=>$z(n,l,r),n.safeDecode=(l,r)=>Lz(n,l,r),n.safeEncodeAsync=async(l,r)=>Hz(n,l,r),n.safeDecodeAsync=async(l,r)=>qz(n,l,r),Lo(n,"ZodType",{check(...l){const r=this.def;return this.clone(Nl(r,{checks:[...r.checks??[],...l.map(u=>typeof u=="function"?{_zod:{check:u,def:{check:"custom"},onattach:[]}}:u)]}),{parent:!0})},with(...l){return this.check(...l)},clone(l,r){return Ol(this,l,r)},brand(){return this},register(l,r){return l.add(this,r),this},refine(l,r){return this.check(R2(l,r))},superRefine(l,r){return this.check(C2(l,r))},overwrite(l){return this.check(yr(l))},optional(){return ty(this)},exactOptional(){return _2(this)},nullable(){return ny(this)},nullish(){return ty(ny(this))},nonoptional(l){return T2(this,l)},array(){return Kh(this)},or(l){return Fh([this,l])},and(l){return p2(this,l)},transform(l){return iy(this,y2(l))},default(l){return w2(this,l)},prefault(l){return E2(this,l)},catch(l){return N2(this,l)},pipe(l){return iy(this,l)},readonly(){return j2(this)},describe(l){const r=this.clone();return Ao.add(r,{description:l}),r},meta(...l){if(l.length===0)return Ao.get(this);const r=this.clone();return Ao.add(r,l[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(l){return l(this)}}),Object.defineProperty(n,"description",{get(){return Ao.get(n)?.description},configurable:!0}),n)),G0=I("_ZodString",(n,i)=>{Qh.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,u,d)=>tz(n,r,u);const l=n._zod.bag;n.format=l.format??null,n.minLength=l.minimum??null,n.maxLength=l.maximum??null,Lo(n,"_ZodString",{regex(...r){return this.check($w(...r))},includes(...r){return this.check(qw(...r))},startsWith(...r){return this.check(Bw(...r))},endsWith(...r){return this.check(Vw(...r))},min(...r){return this.check(wc(...r))},max(...r){return this.check($0(...r))},length(...r){return this.check(L0(...r))},nonempty(...r){return this.check(wc(1,...r))},lowercase(r){return this.check(Lw(r))},uppercase(r){return this.check(Hw(r))},trim(){return this.check(Yw())},normalize(...r){return this.check(Gw(...r))},toLowerCase(){return this.check(Qw())},toUpperCase(){return this.check(Kw())},slugify(){return this.check(Fw())}})}),Bz=I("ZodString",(n,i)=>{Qh.init(n,i),G0.init(n,i),n.email=l=>n.check(ow(Vz,l)),n.url=l=>n.check(hw(Gz,l)),n.jwt=l=>n.check(Nw(l2,l)),n.emoji=l=>n.check(mw(Yz,l)),n.guid=l=>n.check(Kv(Pv,l)),n.uuid=l=>n.check(uw(fc,l)),n.uuidv4=l=>n.check(cw(fc,l)),n.uuidv6=l=>n.check(fw(fc,l)),n.uuidv7=l=>n.check(dw(fc,l)),n.nanoid=l=>n.check(pw(Qz,l)),n.guid=l=>n.check(Kv(Pv,l)),n.cuid=l=>n.check(gw(Kz,l)),n.cuid2=l=>n.check(vw(Fz,l)),n.ulid=l=>n.check(yw(Jz,l)),n.base64=l=>n.check(Ew(n2,l)),n.base64url=l=>n.check(Tw(i2,l)),n.xid=l=>n.check(bw(Xz,l)),n.ksuid=l=>n.check(_w(Iz,l)),n.ipv4=l=>n.check(Sw(Pz,l)),n.ipv6=l=>n.check(xw(Wz,l)),n.cidrv4=l=>n.check(ww(e2,l)),n.cidrv6=l=>n.check(zw(t2,l)),n.e164=l=>n.check(Aw(a2,l)),n.datetime=l=>n.check(xz(l)),n.date=l=>n.check(zz(l)),n.time=l=>n.check(Tz(l)),n.duration=l=>n.check(Nz(l))});function os(n){return rw(Bz,n)}const Ot=I("ZodStringFormat",(n,i)=>{Tt.init(n,i),G0.init(n,i)}),Vz=I("ZodEmail",(n,i)=>{px.init(n,i),Ot.init(n,i)}),Pv=I("ZodGUID",(n,i)=>{hx.init(n,i),Ot.init(n,i)}),fc=I("ZodUUID",(n,i)=>{mx.init(n,i),Ot.init(n,i)}),Gz=I("ZodURL",(n,i)=>{gx.init(n,i),Ot.init(n,i)}),Yz=I("ZodEmoji",(n,i)=>{vx.init(n,i),Ot.init(n,i)}),Qz=I("ZodNanoID",(n,i)=>{yx.init(n,i),Ot.init(n,i)}),Kz=I("ZodCUID",(n,i)=>{bx.init(n,i),Ot.init(n,i)}),Fz=I("ZodCUID2",(n,i)=>{_x.init(n,i),Ot.init(n,i)}),Jz=I("ZodULID",(n,i)=>{Sx.init(n,i),Ot.init(n,i)}),Xz=I("ZodXID",(n,i)=>{xx.init(n,i),Ot.init(n,i)}),Iz=I("ZodKSUID",(n,i)=>{wx.init(n,i),Ot.init(n,i)}),Pz=I("ZodIPv4",(n,i)=>{Nx.init(n,i),Ot.init(n,i)}),Wz=I("ZodIPv6",(n,i)=>{Ox.init(n,i),Ot.init(n,i)}),e2=I("ZodCIDRv4",(n,i)=>{Mx.init(n,i),Ot.init(n,i)}),t2=I("ZodCIDRv6",(n,i)=>{jx.init(n,i),Ot.init(n,i)}),n2=I("ZodBase64",(n,i)=>{kx.init(n,i),Ot.init(n,i)}),i2=I("ZodBase64URL",(n,i)=>{Cx.init(n,i),Ot.init(n,i)}),a2=I("ZodE164",(n,i)=>{Dx.init(n,i),Ot.init(n,i)}),l2=I("ZodJWT",(n,i)=>{Zx.init(n,i),Ot.init(n,i)}),Y0=I("ZodNumber",(n,i)=>{C0.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,u,d)=>nz(n,r,u),Lo(n,"ZodNumber",{gt(r,u){return this.check(Jv(r,u))},gte(r,u){return this.check(Id(r,u))},min(r,u){return this.check(Id(r,u))},lt(r,u){return this.check(Fv(r,u))},lte(r,u){return this.check(Xd(r,u))},max(r,u){return this.check(Xd(r,u))},int(r){return this.check(Wv(r))},safe(r){return this.check(Wv(r))},positive(r){return this.check(Jv(0,r))},nonnegative(r){return this.check(Id(0,r))},negative(r){return this.check(Fv(0,r))},nonpositive(r){return this.check(Xd(0,r))},multipleOf(r,u){return this.check(Xv(r,u))},step(r,u){return this.check(Xv(r,u))},finite(){return this}});const l=n._zod.bag;n.minValue=Math.max(l.minimum??Number.NEGATIVE_INFINITY,l.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(l.maximum??Number.POSITIVE_INFINITY,l.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(l.format??"").includes("int")||Number.isSafeInteger(l.multipleOf??.5),n.isFinite=!0,n.format=l.format??null});function ra(n){return Rw(Y0,n)}const s2=I("ZodNumberFormat",(n,i)=>{$x.init(n,i),Y0.init(n,i)});function Wv(n){return Cw(s2,n)}const r2=I("ZodBoolean",(n,i)=>{Lx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>iz(n,l,r)});function nr(n){return Dw(r2,n)}const o2=I("ZodUnknown",(n,i)=>{Hx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>lz()});function ey(){return Uw(o2)}const u2=I("ZodNever",(n,i)=>{qx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>az(n,l,r)});function c2(n){return Zw(u2,n)}const f2=I("ZodArray",(n,i)=>{Bx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>cz(n,l,r,u),n.element=i.element,Lo(n,"ZodArray",{min(l,r){return this.check(wc(l,r))},nonempty(l){return this.check(wc(1,l))},max(l,r){return this.check($0(l,r))},length(l,r){return this.check(L0(l,r))},unwrap(){return this.element}})});function Kh(n,i){return Jw(f2,n,i)}const d2=I("ZodObject",(n,i)=>{Gx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>fz(n,l,r,u),ht(n,"shape",()=>i.shape),Lo(n,"ZodObject",{keyof(){return Ec(Object.keys(this._zod.def.shape))},catch)DELIM" -R"DELIM(all(l){return this.clone({...this._zod.def,catchall:l})},passthrough(){return this.clone({...this._zod.def,catchall:ey()})},loose(){return this.clone({...this._zod.def,catchall:ey()})},strict(){return this.clone({...this._zod.def,catchall:c2()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(l){return oS(this,l)},safeExtend(l){return uS(this,l)},merge(l){return cS(this,l)},pick(l){return sS(this,l)},omit(l){return rS(this,l)},partial(...l){return fS(Q0,this,l[0])},required(...l){return dS(K0,this,l[0])}})});function Ml(n,i){const l={type:"object",shape:n??{},...Ne(i)};return new d2(l)}const h2=I("ZodUnion",(n,i)=>{Yx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>dz(n,l,r,u),n.options=i.options});function Fh(n,i){return new h2({type:"union",options:n,...Ne(i)})}const m2=I("ZodIntersection",(n,i)=>{Qx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>hz(n,l,r,u)});function p2(n,i){return new m2({type:"intersection",left:n,right:i})}const fh=I("ZodEnum",(n,i)=>{Kx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,u,d)=>sz(n,r,u),n.enum=i.entries,n.options=Object.values(i.entries);const l=new Set(Object.keys(i.entries));n.extract=(r,u)=>{const d={};for(const f of r)if(l.has(f))d[f]=i.entries[f];else throw new Error(`Key ${f} not found in enum`);return new fh({...i,checks:[],...Ne(u),entries:d})},n.exclude=(r,u)=>{const d={...i.entries};for(const f of r)if(l.has(f))delete d[f];else throw new Error(`Key ${f} not found in enum`);return new fh({...i,checks:[],...Ne(u),entries:d})}});function Ec(n,i){const l=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new fh({type:"enum",entries:l,...Ne(i)})}const g2=I("ZodLiteral",(n,i)=>{Fx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>rz(n,l,r),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 yc(n,i){return new g2({type:"literal",values:Array.isArray(n)?n:[n],...Ne(i)})}const v2=I("ZodTransform",(n,i)=>{Jx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>uz(n,l),n._zod.parse=(l,r)=>{if(r.direction==="backward")throw new b0(n.constructor.name);l.addIssue=d=>{if(typeof d=="string")l.issues.push(Do(d,l.value,i));else{const f=d;f.fatal&&(f.continue=!1),f.code??(f.code="custom"),f.input??(f.input=l.value),f.inst??(f.inst=n),l.issues.push(Do(f))}};const u=i.transform(l.value,l);return u instanceof Promise?u.then(d=>(l.value=d,l.fallback=!0,l)):(l.value=u,l.fallback=!0,l)}});function y2(n){return new v2({type:"transform",transform:n})}const Q0=I("ZodOptional",(n,i)=>{Z0.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>V0(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function ty(n){return new Q0({type:"optional",innerType:n})}const b2=I("ZodExactOptional",(n,i)=>{Xx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>V0(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function _2(n){return new b2({type:"optional",innerType:n})}const S2=I("ZodNullable",(n,i)=>{Ix.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>mz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function ny(n){return new S2({type:"nullable",innerType:n})}const x2=I("ZodDefault",(n,i)=>{Px.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>gz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function w2(n,i){return new x2({type:"default",innerType:n,get defaultValue(){return typeof i=="function"?i():x0(i)}})}const z2=I("ZodPrefault",(n,i)=>{Wx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>vz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function E2(n,i){return new z2({type:"prefault",innerType:n,get defaultValue(){return typeof i=="function"?i():x0(i)}})}const K0=I("ZodNonOptional",(n,i)=>{ew.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>pz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function T2(n,i){return new K0({type:"nonoptional",innerType:n,...Ne(i)})}const A2=I("ZodCatch",(n,i)=>{tw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>yz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function N2(n,i){return new A2({type:"catch",innerType:n,catchValue:typeof i=="function"?i:()=>i})}const O2=I("ZodPipe",(n,i)=>{nw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>bz(n,l,r,u),n.in=i.in,n.out=i.out});function iy(n,i){return new O2({type:"pipe",in:n,out:i})}const M2=I("ZodReadonly",(n,i)=>{iw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>_z(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function j2(n){return new M2({type:"readonly",innerType:n})}const k2=I("ZodCustom",(n,i)=>{aw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>oz(n,l)});function R2(n,i={}){return Xw(k2,n,i)}function C2(n,i){return Iw(n,i)}const Ho=[{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"}],Tc=[{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:"count"},{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:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],D2=Ml({level:ra().int().nonnegative(),time:ra().int().nonnegative(),message:os()}),U2=Ml({event:ra().int().nonnegative(),value:ra().nonn)DELIM" -R"DELIM(egative(),time:ra().int().nonnegative()}),Z2=Ml({previous:ra().nonnegative()});Fh([D2,U2,Z2]);const Jh=2**Ho.length-1,ur=Jh,$2=2**0+2**1+2**2+2**6+2**7;function L2(n,i){return Number.isInteger(i)&&i>=0&&i0?`${String(l)}d ${String(r)}h`:r>0?`${String(r)}h ${String(u)}m`:u>0?`${String(u)}m ${String(d)}s`:`${String(d)}s`}function J0(n,i){switch(qo(n).valueKind){case"height":return`height ${Hn(i)}`;case"seconds":return`${cr(i)} s`;case"milliseconds":return`${cr(i)} ms`;case"microseconds":return`${cr(i)} µs`;case"count":return Hn(i);default:return String(i)}}function Q2(n){return n>=100?`${cr(n,0)}/s`:n>=10?`${cr(n,1)}/s`:`${cr(n,2)}/s`}function K2(n){try{const i=new URL(n),l=i.pathname==="/"?"":i.pathname.replace(/\/$/u,"");return`${i.host}${l}`}catch{return n}}const Ac=32,F2=[{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"}],J2={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 X2({metrics:n,paused:i,onPausedChange:l,onClear:r}){const[u,d]=re.useState(""),[f,p]=re.useState("all"),[m,v]=re.useState({offset:0,search:u,category:f}),w=m.search===u&&m.category===f?m.offset:0,S=re.useRef(null),z=re.useSyncExternalStore(n.subscribeEvents,n.getEventWindow,n.getEventWindow);return re.useEffect(()=>{n.setEventQuery({search:u,category:f,offset:w})},[n,u,f,w]),re.useEffect(()=>{S.current&&(S.current.scrollTop=0)},[u,f]),_.jsxs("section",{className:"space-y-4",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Node lifecycle"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Live events"}),_.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"Heights are event payloads; timing values retain their source units."}),_.jsx("p",{className:"text-textMuted mt-1 text-xs",children:"Pause freezes this view; collection and charts continue."})]}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{i&&(S.current&&(S.current.scrollTop=0),v({offset:0,search:u,category:f})),l(!i)},className:"border-accent/35 text-accent hover:bg-accent/10 rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:i?"Resume display":"Pause display"}),_.jsx("button",{type:"button",onClick:r,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Clear"})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 flex flex-wrap gap-3 rounded-xl border p-4",children:[_.jsxs("label",{className:"min-w-56 flex-1",children:[_.jsx("span",{className:"sr-only",children:"Search events"}),_.jsx("input",{type:"search",value:u,onChange:T=>{d(T.target.value)},placeholder:"Search event names or values…",className:"border-accent/25 bg-background/70 text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{children:[_.jsx("span",{className:"sr-only",children:"Filter event category"}),_.jsx("select",{value:f,onChange:T=>{p(T.target.value)},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent rounded-lg border px-3 py-2 text-sm focus:ring-0",children:F2.map(T=>_.jsx("option",{value:T.value,children:T.label},T.value))})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 overflow-hidden rounded-xl border",children:[_.jsxs("div",{className:"border-accent/15 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[_.jsx("span",{children:i?"Display paused · collection continues":"Live stream · newest first"}),_.jsxs("span",{children:[String(z.matched)," matching · ",String(z.retained)," retained"]})]}),_.jsx("div",{ref:S,role:"region","aria-label":"Scrollable event history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:T=>{v({offset:Math.max(0,Math.floor(T.currentTarget.scrollTop/Ac)-8),search:u,category:f})},children:z.matched===0?_.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching events."}):_.jsx("ol",{"aria-label":"Received events",className:"relative min-w-[32rem]",style:{height:z.matched*Ac},children:z.events.map((T,j)=>_.jsx(I2,{event:T,index:z.offset+j,total:z.matched},T.id))})})]}),_.jsxs("details",{className:"border-accent/20 bg-surface/50 rounded-xl border",children:[_.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-4 py-3 text-sm",children:["Event contract (",String(Tc.length)," identifiers)"]}),_.jsx("div",{className:"grid gap-2 border-t border-white/5 p-4 sm:grid-cols-2 lg:grid-cols-3",children:Tc.map(T=>_.jsxs("div",{className:"text-xs",children:[_.jsx("span",{className:"text-textMuted font-mono",children:String(T.id).padStart(2,"0")}),_.jsx("span",{className:"text-textPrimary ml-2",children:T.name})]},T.id))})]})]})}const I2=re.memo(function({event:i,index:l,total:r}){const u=qo(i.event);return _.jsxs("li",{"aria-setsize":r,"aria-posinset":l+1,className:"absolute inset-x-0 grid grid-cols-[8.5rem_10rem_minmax(0,1fr)] items-center gap-2 border-b border-white/5 px-4 text-xs",style:{top:l*Ac,height:Ac},children:[_.jsx("time",{dateTime:new Date(i.time).toISOString(),className:"text-textMuted font-mono tabular-nums",children:jo(i.time)}),_.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${J2[u.category]}`,children:u.name}),_.jsx("span",{className:"text-textPrimary font-mono tabular-nums",children:J0(i.event,i.value)})]})}),Nc=32,ay={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 P2({metrics:n,delivery:i,status:l,logFilter:r,paused:u,onLogFilterChange:d,onPausedChange:f,onClear:p}){const[m,v]=re.useState(""),[w,S]=re.useState({offset:0,search:m,filter:r}),z=w.search===m&&w.filter===r?w.offset:0,[T,j]=re.useState(null),L=re.useRef(null),V=re.useSyncExternalStore(n.subscribeLogs,n.getLogWindow,n.getLogWindow);return re.useEffect(()=>{n.setLogQuery({search:m,filter:r,offset:z})},[n,m,r,z]),re.useEffect(()=>{L.current&&(L.current.scrollTop=0)},[m,r]))DELIM" -R"DELIM(,_.jsxs("section",{className:"space-y-4",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Diagnostic stream"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Node logs"}),_.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"The newest 1,000 messages are retained in this browser session."})]}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{u&&(L.current&&(L.current.scrollTop=0),S({offset:0,search:m,filter:r})),f(!u)},className:"border-accent/35 text-accent hover:bg-accent/10 rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:u?"Resume display":"Pause display"}),_.jsx("button",{type:"button",onClick:p,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Clear"})]})]}),_.jsxs("fieldset",{className:"border-accent/20 bg-surface/70 space-y-3 rounded-xl border p-4",children:[_.jsx("legend",{className:"text-textPrimary px-1 text-sm font-medium",children:"Requested log levels"}),_.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."}),_.jsx("div",{className:"flex flex-wrap gap-x-5 gap-y-3",children:Ho.map(H=>_.jsxs("label",{className:"text-textPrimary flex items-center gap-2 text-sm",children:[_.jsx("input",{type:"checkbox",checked:L2(r,H.id),onChange:()=>{d(r^1<{d($2)},className:"text-accent hover:underline",children:"Operational levels"}),_.jsx("button",{type:"button",onClick:()=>{d(Jh)},className:"text-accent hover:underline",children:"All levels"}),_.jsx("button",{type:"button",onClick:()=>{d(0)},className:"text-accent hover:underline",children:"No levels"}),_.jsx("span",{className:"text-textMuted",children:"Selection is saved in this browser."})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 space-y-2 rounded-xl border p-4 text-xs",children:[_.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",l.reconnects]].map(([H,G])=>_.jsxs("div",{children:[_.jsx("dt",{className:"text-textMuted",children:H}),_.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:G.toLocaleString()})]},H))}),_.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."}),_.jsxs("p",{className:"text-textMuted",role:"status",children:["Admin connection: ",l.phase,l.error?` · ${l.error}`:""]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 flex flex-wrap gap-3 rounded-xl border p-4",children:[_.jsxs("label",{className:"min-w-56 flex-1",children:[_.jsx("span",{className:"sr-only",children:"Search logs"}),_.jsx("input",{type:"search",value:m,onChange:H=>{v(H.target.value)},placeholder:"Search received messages…",className:"border-accent/25 bg-background/70 text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsx("p",{className:"text-textMuted self-center text-xs",children:"Search filters received messages only."})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 overflow-hidden rounded-xl border",children:[_.jsxs("div",{className:"border-accent/15 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[_.jsx("span",{children:u?"Display paused · collection continues":r===0?"Log delivery disabled":z>0?"Viewing older rows · collection continues":"Live stream · newest first"}),_.jsxs("span",{children:[String(V.matched)," matching · ",String(V.retained)," retained"]})]}),_.jsx("div",{ref:L,role:"region","aria-label":"Scrollable log history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:H=>{S({offset:Math.max(0,Math.floor(H.currentTarget.scrollTop/Nc)-8),search:m,filter:r})},children:V.matched===0?_.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching log messages."}):_.jsx("ol",{"aria-label":"Received logs",className:"relative",style:{height:V.matched*Nc},children:V.logs.map((H,G)=>_.jsx(W2,{log:H,index:V.offset+G,total:V.matched,onSelect:j},H.id))})})]}),_.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[_.jsx("p",{className:"text-textMuted",children:"Select a row to read its full message."}),!u&&_.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{L.current&&(L.current.scrollTop=0),S({offset:0,search:m,filter:r})},children:"Jump to latest"})]}),T&&_.jsx(eE,{log:T,onClose:()=>{j(null)}})]})}const W2=re.memo(function({log:i,index:l,total:r,onSelect:u}){return _.jsx("li",{"aria-setsize":r,"aria-posinset":l+1,className:"absolute inset-x-0 border-b border-white/5",style:{top:l*Nc,height:Nc},children:_.jsxs("button",{type:"button",onClick:()=>{u(i)},className:"grid h-full w-full grid-cols-[5.5rem_4.5rem_minmax(0,1fr)] items-center gap-2 px-4 text-left text-xs hover:bg-white/5 focus-visible:bg-white/10 sm:grid-cols-[7.5rem_7.5rem_minmax(0,1fr)]",children:[_.jsx("time",{dateTime:new Date(i.time).toISOString(),className:"text-textMuted font-mono tabular-nums",children:jo(i.time,!1)}),_.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${ay[i.level]??ay[8]}`,children:F0(i.level).name}),_.jsx("span",{className:"text-textPrimary min-w-0 truncate font-mono",children:i.message.replaceAll(` -`," ↵ ")})]})})});function eE({log:n,onClose:i}){const l=re.useRef(null);return re.useEffect(()=>{const r=l.current;return r?.showModal(),()=>{r?.close()}},[]),_.jsxs("dialog",{ref:l,onClose:i,"aria-labelledby":"log-detail-title",className:"border-accent/30 bg-surface text-textPrimary fixed inset-0 m-auto max-h-[80vh] w-[min(60rem,90vw)] rounded-xl border p-5 shadow-xl backdrop:bg-black/70",children:[_.jsxs("header",{className:"mb-4 flex items-center justify-between gap-4",children:[_.jsxs("h3",{id:"log-detail-title",className:"font-semibold",children:[F0(n.level).label," · ",new Date(n.time).toISOString()]}),_.jsx("button",{type:"button",onClick:i,className:"text-accent rounded px-3 py-2",children:"Close"})]}),_.jsx("pre",{className:"text-sm break-words whitespace-pre-wrap",children:n.message})]})}const Pd=["line","area","bar"],ly=["line","step","area"],tE=["line","step","area"],X0={"occurrence-count":{id:"occurrence-count",label:"Occurrences per bucket",description:"Number of frames observed in each one-second bucket.",unit:"occurrences",chartTypes:Pd},"occurrence-rate":{id:"occurrence-rate",label:"Occurrence rate",description:"Frames observed per second.",unit:"occurrences-per-second",chartTypes:Pd},"cumulative-occurrences":{id:"cumulative-occurrences",label:"Cumulative occurrences",description:"Running number of frames observed during this browser session.",unit:"occurrences",chartTypes:ly},"payload-latest":{id:"payload-latest",label:"Latest value",description:"Most recently observed payload value.",unit:"count",chartTypes:tE},"payload-average":{id:"payload-average",label:"Average value",description:"Average payload value within each on)DELIM" -R"DELIM(e-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:ly},"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:Pd}},br=["occurrence-rate","occurrence-count","cumulative-occurrences"],nE=["payload-latest","payload-maximum","payload-change-rate",...br],iE=["payload-average","payload-latest","payload-minimum","payload-maximum",...br],aE=["payload-sum","payload-cumulative","payload-latest","payload-average",...br];function Oi(n){return`event:${String(n)}`}function wl(n){return`log:${String(n)}`}const Oc="native:top";function lE(n){switch(n){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";default:return"unknown"}}function sE(n){switch(n){case"height":return nE;case"duration":return iE;case"count":return aE;default:return br}}function rE(n){switch(n){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function I0(n){const i=qo(n),l=lE(i.valueKind);return{id:Oi(n),source:"event",sourceId:n,name:i.name,label:i.label,category:i.category,payloadKind:l,allowedMeasures:sE(l),defaultMeasure:rE(l),description:l==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${i.label} event with a ${l} payload.`}}const oE=[...Tc.map(n=>I0(n.id)),...Ho.map(n=>({id:wl(n.id),source:"log",sourceId:n.id,name:n.name,label:`${n.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:br,defaultMeasure:"occurrence-rate",description:`${n.label} log message volume. Message text is not interpreted as numeric data.`})),{id:Oc,source:"native",sourceId:"top",name:"canonical_top",label:"Canonical 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."}],Xh=oE,uE=new Map(Xh.map(n=>[n.id,n]));function $a(n){const i=uE.get(n);if(i)return i;const l=/^event:(\d+)$/u.exec(n);return l?I0(Number(l[1])):{id:n,source:"event",sourceId:-1,name:n,label:n,category:"unknown",payloadKind:"unknown",allowedMeasures:br,defaultMeasure:"occurrence-rate",description:"Unknown signal; only occurrence measurements are available."}}function El(n,i){const l=X0[i];if(i.startsWith("occurrence")||i==="cumulative-occurrences")return l;const r=i==="payload-change-rate"?"height-per-second":n.payloadKind==="height"?"height":n.payloadKind==="duration"?"milliseconds":"count";return{...l,unit:r}}function cE(n,i){return n.allowedMeasures.includes(i)}function fE(n,i){return V2(n,i)??i}const dE=3600*1e3,hE=1e3,mE=1e3,pE=1e3;class sy{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 l=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),l}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 l=0;lthis.#M;getRecentLogs=()=>this.#i.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=i=>(this.#n.add(i),()=>{this.#n.delete(i)});start(){this.#S||(this.tick(),this.#S=setInterval(()=>{this.tick()},1e3))}stop(){this.#S&&(clearInterval(this.#S),this.#S=null),this.#_&&(clearTimeout(this.#_),this.#_=null)}ingest(i,l=this.#e()){const r=this.#O(l);this.#f+=1,H2(i)?this.#D(i,r):q2(i)?this.#N(i,r):B2(i)&&(this.#E+=1),this.#k()}recordInvalidFrame(){this.#z+=1,this.#k()}recordNativeTop(i,l=this.#e()){const r=this.#O(l),u=this.#c[Oc];u?.value===i&&r-u.time<15e3||(this.#C(Oc,r,i),this.#v(r),this.#k())}clearLogs(){this.#g+=this.#i.size,this.#i.clear(),this.flush()}clearEvents(){this.#s.clear(),this.flush()}reset(){this.#i.clear(),this.#s.clear(),this.#a.clear(),this.#r={},this.#l={},this.#u={},this.#o={},this.#m={},this.#c={},this.#d={},this.#h=this.#O(this.#e()),this.#f=0,this.#y=0,this.#x=0,this.#g=0,this.#w=0,this.#E=0,this.#z=0,this.#b=null,this.#T=null,this.#A=0,this.#j(this.#h),this.flush()}tick(){const i=this.#O(this.#e());this.#j(i),this.#v(i),this.#k()}flush(){this.#_&&(clearTimeout(this.#_),this.#_=null),this.#M=this.#R();for(const i of this.#n)i()}#D(i,l){this.#y+=1,this.#b=l,this.#A+=1,this.#i.push({...i,id:this.#A,receivedAt:l})&&(this.#x+=1),this.#C(wl(i.level),l,null)}#N(i,l){this.#w+=1,this.#T=l,this.#A+=1,this.#s.push({...i,id:this.#A,receivedAt:l}),this.#C(Oi(i.event),l,fE(i.event,i.value))}#O(i){return Number.isFinite(i)?(this.#p=Math.max(this.#p,i),this.#p):this.#p}#C(i,l,r){const u=this.#j(l);u.snapshot=null;const d=u.signals.get(i)??gE();if(d.count+=1,dc(this.#o,i,1),r!==null){d.samples+=1,d.sum+=r,d.minimum=d.minimum===null?r:Math.min(d.minimum,r),d.maximum=d.maximum===null?r:Math.max(d.maximum,r),(d.firstAt===null||l=d.lastAt)&&(d.last=r,d.lastAt=l),dc(this.#m,i,r);const f=this.#c[i];(!f||l>=f.time)&&(this.#c[i]={value:r,time:l}),this.#d[i]=Math.max(this.#d[i]??r,r)}u.signals.set(i,d)}#j(i){const l=Math.floor(i/1e3)*1e3,r=this.#a.get(l);if(r)return r;const u={time:l,signals:new Map,snapshot:null};return this.#a.set(l,u),u}#v(i){const l=i-dE;for(const[r,u]of this.#a){if(r>=l)break;for(const[d,f]of u.signals)if(dc(this.#r,d,f.count),dc(this.#l,d,f.sum),f.last!==null&&f.lastAt!==null){const p=this.#u[d];(!p||f.lastAt>=p.time)&&(this.#u[d]={value:f.last,time:f.lastAt})}this.#a.delete(r)}}#k(){!this.#t||this.#_||(this.#_=setTimeout(()=>{this.#_=null,this.flush()},hE))}#R(){const i=[...this.#a.values()].map(l=>(l.snapshot??={time:l.time,signals:Object.fromEntries([...l.signals].map(([r,u])=>[r,{...u}]))},l.snapshot));return{now:this.#O(this.#e()),sessionStartedAt:this.#h,totalFrames:this.#f,totalLogs:this.#y,evictedLogs:this.#x,clearedLogs:this.#g,totalEvents:this.#w,totalAcks:this.#E,invalidFrames:this.#z,buckets:i,priorSignalCounts:{...this.#r},priorSignalSums:{...this.#l},priorSignalLatest:ry(this.#u),signalTotals:{...this.#o},signalSums:{...this.#m},signalLatest:ry(this.#c),signalMaximums:{...this.#d},recentLogs:this.#i.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#b,lastEventAt:this.#T}}}function vE(n,i,l,r,u=n[0]?.time??l){const d=l-r*1e3,f=d<=u,p=f?Math.floor(u/1e3)*1e3:Math.ceil(d/1e3)*1e3,m=f?u:p,v=Math.floor(l/1e3)*1e3,S=n.filter(T=>T.time>=p&&T.time<=v).reduce((T,j)=>T+(j.signals[i]?.count??0),0),z=Math.max(0,(l-m)/1e3);return z>0?S/z:0}function yE(n,i){const l=f=>vE(n.buckets,Oi(f),n.)DELIM" -R"DELIM(now,i,n.sessionStartedAt),r=l(2)+l(14);if(r>0)return{label:"Reorganizing",rate:r};const d=[{label:"Confirming blocks",rate:l(6)},{label:"Validating blocks",rate:l(5)},{label:"Archiving blocks",rate:l(3)},{label:"Synchronizing headers",rate:Math.max(l(0),l(1))}].reduce((f,p)=>p.rate>f.rate?p:f);return d.rate>0?d:{label:"Idle",rate:0}}const Lc=18,bE=600*1e3;function _E(n,i,l){if(n===null||!Number.isSafeInteger(n)||n<0||i===null||!Number.isSafeInteger(i.height)||i.height<0||i.height>n||!Number.isFinite(i.timestamp)||i.timestamp<=0||!Number.isFinite(l)||l<0)return null;const r=Math.max(0,l-i.timestamp*1e3),u=Math.max(n,i.height+Math.ceil(r/bE));return{blocksRemaining:u-n,estimatedTop:u,progress:u===0?100:n/u*100}}const SE={idle:"border-slate-500/40 bg-slate-500/10 text-slate-300",connecting:"border-amber-500/40 bg-amber-500/10 text-amber-300",connected:"border-emerald-500/40 bg-emerald-500/10 text-emerald-300",reconnecting:"border-orange-500/40 bg-orange-500/10 text-orange-300"};function xE({phase:n,label:i}){return _.jsxs("span",{className:`inline-flex items-center gap-2 rounded-full border px-3 py-1 text-xs tracking-wide uppercase ${SE[n]}`,children:[_.jsx("span",{className:"h-2 w-2 rounded-full bg-current","aria-hidden":"true"}),i]})}function hc({label:n,value:i,detail:l,numeric:r=!0,emphasized:u=!1}){return _.jsxs("div",{className:"min-w-0 border-white/10 px-4 py-3 even:border-l lg:border-l lg:first:border-l-0 [&:nth-child(n+3)]:border-t lg:[&:nth-child(n+3)]:border-t-0",children:[_.jsx("dt",{className:"text-textMuted text-xs",children:n}),_.jsx("dd",{className:`mt-1 leading-7 font-medium break-words ${r?"font-mono text-xl tracking-tight tabular-nums":"text-base"} ${u?"text-accent":"text-textPrimary"}`,children:i}),_.jsx("dd",{className:"text-textMuted mt-0.5 text-xs leading-4 break-words",children:l})]})}function wE({confirmed:n,estimate:i}){if(n===null||i===null||i.blocksRemaining<=Lc)return null;const l=Math.min(99.99,Math.max(0,i.progress)),r=`${l.toFixed(2)}%`;return _.jsxs("section",{className:"border-accent/25 bg-surface/70 overflow-hidden rounded-xl border","aria-labelledby":"node-sync-progress-title",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-3 px-5 pt-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Node synchronization"}),_.jsx("h2",{id:"node-sync-progress-title",className:"mt-1 font-semibold",children:"Catching up to estimated chain tip"})]}),_.jsx("p",{className:"text-accent font-mono text-xl font-semibold tabular-nums",children:r})]}),_.jsx("div",{className:"px-5 pt-4",children:_.jsx("div",{role:"progressbar","aria-label":"Node synchronization progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Number(l.toFixed(2)),"aria-valuetext":`Approximately ${Hn(i.blocksRemaining)} blocks remaining`,className:"bg-background h-3 overflow-hidden rounded-full border border-white/5",children:_.jsx("div",{className:"bg-accent h-full rounded-full transition-[width] duration-700",style:{width:`${String(l)}%`}})})}),_.jsxs("dl",{className:"mt-5 grid gap-px bg-white/5 text-sm sm:grid-cols-3",children:[_.jsx(Wd,{label:"Confirmed top",value:Hn(n)}),_.jsx(Wd,{label:"Estimated chain tip",value:Hn(i.estimatedTop)}),_.jsx(Wd,{label:"Estimated blocks remaining",value:Hn(i.blocksRemaining)})]}),_.jsx("p",{className:"bg-surface text-textMuted border-t border-white/5 px-5 py-2 text-[11px]",children:"Estimated from the confirmed block timestamp and your browser clock, assuming one block every 10 minutes. Actual block counts may differ."})]})}function Wd({label:n,value:i}){return _.jsxs("div",{className:"bg-surface px-5 py-3",children:[_.jsx("dt",{className:"text-textMuted text-xs",children:n}),_.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:i})]})}const lr=16,dh=8,Ih=80,zE=[300,900,3600],hh=["line","step","area","bar"],EE=["linear","compressed"],bn=["#ffa022","#38bdf8","#34d399","#c084fc","#fb7185","#e879f9","#facc15","#60a5fa"],TE=Ec(["occurrence-count","occurrence-rate","cumulative-occurrences","payload-latest","payload-average","payload-minimum","payload-maximum","payload-sum","payload-cumulative","payload-change-rate"]),AE=Ml({id:os().min(1).max(100),signalId:os().min(1).max(100),measure:TE,color:os().regex(/^#[\da-f]{6}$/iu),label:os().max(80).optional()}).strict(),P0=Ml({id:os().min(1).max(100),title:os().trim().min(1).max(Ih),visualization:Ec(hh),scale:Ec(EE).default("linear"),range:Fh([yc(300),yc(900),yc(3600)]),series:Kh(AE).min(1).max(dh)}).strict(),NE=Ml({version:yc(1),charts:Kh(P0).max(lr)}).strict(),W0={id:"default-sync-pipeline",title:"Sync pipeline",visualization:"line",scale:"linear",range:900,series:[hi("sync-header",Oi(0),"occurrence-rate",bn[3]),hi("sync-archive",Oi(3),"occurrence-rate",bn[0]),hi("sync-validate",Oi(5),"occurrence-rate",bn[1]),hi("sync-confirm",Oi(6),"occurrence-rate",bn[2])]},OE={id:"default-chain-progress",title:"Chain progress",visualization:"step",scale:"linear",range:900,series:[hi("progress-top",Oc,"payload-latest",bn[0]),hi("progress-organized",Oi(13),"payload-latest",bn[2]),hi("progress-confirmed",Oi(6),"payload-latest",bn[1])]},ME={id:"default-log-volume",title:"Log volume",visualization:"bar",scale:"linear",range:900,series:[hi("logs-news",wl(1),"occurrence-rate",bn[2]),hi("logs-session",wl(2),"occurrence-rate",bn[3]),hi("logs-protocol",wl(3),"occurrence-rate",bn[1]),hi("logs-remote",wl(5),"occurrence-rate",bn[7]),hi("logs-fault",wl(6),"occurrence-rate",bn[4]),hi("logs-quitting",wl(7),"occurrence-rate",bn[0])]},Ph=[{id:"sync-pipeline",label:"Sync pipeline",description:"Header and block lifecycle throughput.",chart:W0},{id:"chain-progress",label:"Chain progress",description:"Canonical, organized, and confirmed heights.",chart:OE},{id:"log-volume",label:"Log volume",description:"Message rates grouped by log level.",chart:ME}],eb="libbitcoinAdminDashboardCharts";let uy=0;function hi(n,i,l,r){return{id:n,signalId:i,measure:l,color:r}}function Mc(n){return uy+=1,`${n}-${Date.now().toString(36)}-${String(uy)}`}function Wh(n,i=!1){return{...n,id:i?Mc("chart"):n.id,series:n.series.map(l=>({...l,id:i?Mc("series"):l.id}))}}function bc(){return Ph.map(n=>Wh(n.chart))}function jE(n){const i=Ph.find(l=>l.id===n);return Wh(i?.chart??W0,!0)}function tb(){return{id:Mc("chart"),title:"Custom chart",visualization:"line",scale:"linear",range:900,series:[{id:Mc("series"),signalId:Oi(3),measure:"occurrence-rate",color:bn[0]}]}}function kE(n){const i=" copy",l=`${n.title.slice(0,Ih-i.length).trimEnd()}${i}`;return{...Wh(n,!0),title:l}}function mh(n){const i=new Set(n.series.map(l=>El($a(l.signalId),l.measure).unit));return i.size===1?[...i][0]??null:null}function nb(n){const i=P0.safeParse(n);if(!i.success)return i.error.issues[0]?.message??"Invalid chart configuration";for(const l of n.series){const r=$a(l.signalId);if(!cE(r,l.measure))return`${X0[l.measure].label} is not valid for ${r.label}.`;const u=El(r,l.measure);if(!u.chartTypes.includes(n.visualization))return`${u.label} cannot be displayed as a ${n.visualization} chart.`}return mh(n)===null?"All series on a chart must use compatible units.":null}function ib(n){const i=NE.safeParse(n);return!i.success||new Set(i.data.charts.map(l=>l.id)).size!==i.data.charts.length||i.data.charts.some(l=>new Set(l.series.map(r=>r.id)).size!==l.series.length)?null:i.data.charts.every(l=>nb(l)===null)?i.data.charts:null}function ab(){try{return globalThis.window?.localStorage??null}catch{return null}}function RE(n=ab()){try{const i=n?.getItem(eb);return i?ib(JSON.parse(i))??bc():bc()}catch{return bc()}}function CE(n,i=ab()){try{const l={version:1,charts:n};if(!ib(l))return;i?.setItem(eb,JSON.stringify(l))}catch{}}function em(n,i){return n.signals[i]}function cy(n,i,l,r){let u=r==="count"?n.priorSignalCounts[i]??0:n.priorSignalSums[i]??0;for(const d of n.buckets){if(d.time>=l)break;const f=em(d,i);u+=r==="count"?f?.count??0:f?.sum??0}return u}function)DELIM" -R"DELIM( DE(n,i,l){let r=n.priorSignalLatest[i]??null;for(const u of n.buckets){if(u.time>=l)break;const d=em(u,i);d?.last!==null&&d?.last!==void 0&&d.lastAt!==null&&(r={value:d.last,time:d.lastAt})}return r}function UE(n,i){const l=i<=n.sessionStartedAt?Math.floor(n.sessionStartedAt/1e3)*1e3:Math.ceil(i/1e3)*1e3,r=Math.floor(n.now/1e3)*1e3,u=new Map(n.buckets.map(f=>[f.time,f])),d=[];for(let f=l;f<=r;f+=1e3)d.push(u.get(f)??{time:f,signals:{}});return d}function ZE(n,i,l){const r=Math.max(n.time,l),u=Math.min(i,n.time+1e3);return Math.max(0,(u-r)/1e3)}function $E(n,i,l,r){const u=$a(r.signalId);let d=r.measure==="cumulative-occurrences"?cy(n,r.signalId,l,"count"):r.measure==="payload-cumulative"?cy(n,r.signalId,l,"sum"):0,f=DE(n,r.signalId,l);return i.map(p=>{const m=em(p,r.signalId);switch(r.measure){case"occurrence-count":return m?.count??0;case"occurrence-rate":{const v=ZE(p,n.now,n.sessionStartedAt);return v>0?(m?.count??0)/v:0}case"cumulative-occurrences":return d+=m?.count??0,d;case"payload-sum":return m&&m.samples>0?m.sum:null;case"payload-cumulative":return d+=m?.sum??0,d;case"payload-average":return m&&m.samples>0?m.sum/m.samples:null;case"payload-minimum":return m?.minimum??null;case"payload-maximum":return m?.maximum??null;case"payload-latest":return m?.last!==null&&m?.last!==void 0&&m.lastAt!==null?(f={value:m.last,time:m.lastAt},m.last):u.payloadKind==="height"?f?.value??null:null;case"payload-change-rate":{if(m?.last===null||m?.last===void 0||m.lastAt===null)return null;const v=f??(m.first!==null&&m.firstAt!==null?{value:m.first,time:m.firstAt}:null);if(f={value:m.last,time:m.lastAt},!v)return null;const w=(m.lastAt-v.time)/1e3;return w>0?(m.last-v.value)/w:null}}})}function LE(n,i){const l=n.now-i.range*1e3,r=UE(n,l),u=r[0]?.time??Math.floor(n.now/1e3)*1e3,d=i.series[0],f=El($a(d.signalId),d.measure).unit,p=i.series.filter(m=>(n.signalTotals[m.signalId]??0)===0).map(m=>m.label??$a(m.signalId).label);return{data:[r.map(m=>m.time/1e3),...i.series.map(m=>$E(n,r,u,m))],unit:f,hasObservedData:p.length({...i}))}}function YE(){const n=new Map;for(const i of Xh){const l=n.get(i.category)??[];l.push(i),n.set(i.category,l)}return[...n]}const QE=YE();function KE({chart:n,mode:i,onCancel:l,onSave:r}){const[u,d]=re.useState(()=>GE(n)),f=nb(u),p=mh(u);re.useEffect(()=>{function T(j){j.key==="Escape"&&l()}return globalThis.addEventListener("keydown",T),()=>{globalThis.removeEventListener("keydown",T)}},[l]);const m=re.useMemo(()=>new Set(hh.filter(T=>u.series.every(j=>El($a(j.signalId),j.measure).chartTypes.includes(T)))),[u.series]);function v(T,j){d(L=>({...L,series:L.series.map((V,H)=>H===T?j:V)}))}function w(T,j){const L=u.series[T],V=$a(j);v(T,{...L,signalId:j,measure:V.defaultMeasure})}function S(){if(u.series.length>=dh)return;const T=mh(u),j=Xh.find(H=>H.allowedMeasures.some(G=>T===null||El(H,G).unit===T));if(!j)return;const L=j.allowedMeasures.find(H=>T===null||El(j,H).unit===T)??j.defaultMeasure,V={id:`series-${Date.now().toString(36)}-${String(u.series.length+1)}`,signalId:j.id,measure:L,color:bn[u.series.length%bn.length]??bn[0]};d(H=>({...H,series:[...H.series,V]}))}function z(T){T.preventDefault(),!f&&r({...u,title:u.title.trim()})}return _.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/75 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:T=>{T.target===T.currentTarget&&l()},children:_.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"chart-editor-title",className:"border-accent/30 bg-surface max-h-[92vh] w-full max-w-4xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/60",children:[_.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Dashboard builder"}),_.jsx("h2",{id:"chart-editor-title",className:"mt-1 text-xl font-semibold",children:i==="add"?"Add chart":"Edit chart"})]}),_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close chart editor",children:"×"})]}),i==="add"&&_.jsxs("div",{className:"border-accent/15 border-b p-5",children:[_.jsx("p",{className:"text-textMuted mb-3 text-xs font-medium tracking-wide uppercase",children:"Start from a template"}),_.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-5",children:[Ph.map(T=>_.jsxs("button",{type:"button",onClick:()=>{d(jE(T.id))},className:"border-accent/20 bg-background/50 hover:border-accent/60 rounded-lg border p-3 text-left",children:[_.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:T.label}),_.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:T.description})]},T.id)),_.jsxs("button",{type:"button",onClick:()=>{d(tb())},className:"border-accent/20 bg-background/50 hover:border-accent/60 rounded-lg border p-3 text-left",children:[_.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:"Custom"}),_.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:"Begin with one editable series."})]})]})]}),_.jsxs("form",{onSubmit:z,className:"space-y-6 p-5",children:[_.jsxs("div",{className:"grid gap-4 md:grid-cols-[minmax(0,1fr)_11rem_11rem]",children:[_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Chart title"}),_.jsx("input",{value:u.title,maxLength:Ih,onChange:T=>{d(j=>({...j,title:T.target.value}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Chart type"}),_.jsx("select",{value:u.visualization,onChange:T=>{d(j=>({...j,visualization:T.target.value}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0",children:hh.map(T=>_.jsx("option",{value:T,disabled:!m.has(T),children:VE[T]},T))})]}),_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Time range"}),_.jsx("select",{value:u.range,onChange:T=>{d(j=>({...j,range:Number(T.target.value)}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0",children:zE.map(T=>_.jsx("option",{value:T,children:BE[T]},T))})]})]}),_.jsxs("section",{className:"space-y-3",children:[_.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[_.jsxs("div",{children:[_.jsx("h3",{className:"font-semibold",children:"Series"}),_.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:["One chart uses one axis unit",p===null?".":`: ${lb(p)}.`]})]}),_.jsx("button",{type:"button",onClick:S,disabled:u.series.length>=dh,className:"border-accent/35 text-accent hover:bg-accent/10 disabled:text-textMuted rounded-lg border px-3 py-2 text-xs font-medium uppercase disabled:cursor-not-allowed disabled:opacity-50",children:"Add series"})]}),_.jsx("div",{className:"space-y-3",children:u.series.map((T,j)=>{const L=$a(T.signalId),V=El(L,T.measure);return _.jsxs("article",{className:"border-accent/15 bg-background/35 gr)DELIM" -R"DELIM(id 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:[_.jsxs("label",{className:"space-y-1.5",children:[_.jsxs("span",{className:"text-textMuted text-xs",children:["Signal ",String(j+1)]}),_.jsx("select",{"aria-label":`Signal ${String(j+1)}`,value:T.signalId,onChange:H=>{w(j,H.target.value)},className:"border-accent/25 bg-surface text-textPrimary focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0",children:QE.map(([H,G])=>_.jsx("optgroup",{label:H,children:G.map(W=>_.jsx("option",{value:W.id,children:W.label},W.id))},H))})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Measurement"}),_.jsx("select",{"aria-label":`Measurement ${String(j+1)}`,value:T.measure,onChange:H=>{v(j,{...T,measure:H.target.value})},className:"border-accent/25 bg-surface text-textPrimary focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0",title:V.description,children:L.allowedMeasures.map(H=>_.jsx("option",{value:H,children:El(L,H).label},H))})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Display label"}),_.jsx("input",{"aria-label":`Display label ${String(j+1)}`,value:T.label??"",onChange:H=>{v(j,{...T,label:H.target.value||void 0})},placeholder:L.label,className:"border-accent/25 bg-surface text-textPrimary placeholder:text-textMuted/50 focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Color"}),_.jsx("input",{"aria-label":`Series color ${String(j+1)}`,type:"color",value:T.color,onChange:H=>{v(j,{...T,color:H.target.value})},className:"border-accent/25 bg-surface h-10 w-full rounded-lg border p-1"})]}),_.jsx("button",{type:"button",onClick:()=>{d(H=>({...H,series:H.series.filter((G,W)=>W!==j)}))},disabled:u.series.length===1,"aria-label":`Remove series ${String(j+1)}`,className:"text-textMuted self-end rounded-lg px-3 py-2 text-sm hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-30",children:"Remove"})]},T.id)})})]}),f&&_.jsx("p",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-200",children:f}),_.jsxs("div",{className:"flex justify-end gap-2 border-t border-white/5 pt-4",children:[_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-textPrimary rounded-lg px-4 py-2 text-sm",children:"Cancel"}),_.jsx("button",{type:"submit",disabled:f!==null,className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold disabled:cursor-not-allowed disabled:opacity-40",children:i==="add"?"Add chart":"Save changes"})]})]})]})})}const FE=!0,tn="u-",JE="uplot",XE=tn+"hz",IE=tn+"vt",PE=tn+"title",WE=tn+"wrap",eT=tn+"under",tT=tn+"over",nT=tn+"axis",rs=tn+"off",iT=tn+"select",aT=tn+"cursor-x",lT=tn+"cursor-y",sT=tn+"cursor-pt",rT=tn+"legend",oT=tn+"live",uT=tn+"inline",cT=tn+"series",fT=tn+"marker",fy=tn+"label",dT=tn+"value",No="width",Oo="height",zo="top",dy="bottom",ir="left",eh="right",tm="#000",hy=tm+"0",th="mousemove",my="mousedown",nh="mouseup",py="mouseenter",gy="mouseleave",vy="dblclick",hT="resize",mT="scroll",yy="change",jc="dppxchange",nm="--",_r=typeof window<"u",ph=_r?document:null,fr=_r?window:null,pT=_r?navigator:null;let Pe,mc;function gh(){let n=devicePixelRatio;Pe!=n&&(Pe=n,mc&&yh(yy,mc,gh),mc=matchMedia(`(min-resolution: ${Pe-.001}dppx) and (max-resolution: ${Pe+.001}dppx)`),cs(yy,mc,gh),fr.dispatchEvent(new CustomEvent(jc)))}function fi(n,i){if(i!=null){let l=n.classList;!l.contains(i)&&l.add(i)}}function vh(n,i){let l=n.classList;l.contains(i)&&l.remove(i)}function wt(n,i,l){n.style[i]=l+"px"}function Bi(n,i,l,r){let u=ph.createElement(n);return i!=null&&fi(u,i),l?.insertBefore(u,r),u}function Ai(n,i){return Bi("div",n,i)}const by=new WeakMap;function sa(n,i,l,r,u){let d="translate("+i+"px,"+l+"px)",f=by.get(n);d!=f&&(n.style.transform=d,by.set(n,d),i<0||l<0||i>r||l>u?fi(n,rs):vh(n,rs))}const _y=new WeakMap;function Sy(n,i,l){let r=i+l,u=_y.get(n);r!=u&&(_y.set(n,r),n.style.background=i,n.style.borderColor=l)}const xy=new WeakMap;function wy(n,i,l,r){let u=i+""+l,d=xy.get(n);u!=d&&(xy.set(n,u),n.style.height=l+"px",n.style.width=i+"px",n.style.marginLeft=r?-i/2+"px":0,n.style.marginTop=r?-l/2+"px":0)}const im={passive:!0},gT={...im,capture:!0};function cs(n,i,l,r){i.addEventListener(n,l,r?gT:im)}function yh(n,i,l,r){i.removeEventListener(n,l,im)}_r&&gh();function Vi(n,i,l,r){let u;l=l||0,r=r||i.length-1;let d=r<=2147483647;for(;r-l>1;)u=d?l+r>>1:mi((l+r)/2),i[u]{let d=-1,f=-1;for(let p=r;p<=u;p++)if(n(l[p])){d=p;break}for(let p=u;p>=r;p--)if(n(l[p])){f=p;break}return[d,f]}}const rb=n=>n!=null,ob=n=>n!=null&&n>0,Hc=sb(rb),vT=sb(ob);function yT(n,i,l,r=0,u=!1){let d=u?vT:Hc,f=u?ob:rb;[i,l]=d(n,i,l);let p=n[i],m=n[i];if(i>-1)if(r==1)p=n[i],m=n[l];else if(r==-1)p=n[l],m=n[i];else for(let v=i;v<=l;v++){let w=n[v];f(w)&&(wm&&(m=w))}return[p??gt,m??-gt]}function qc(n,i,l,r){let u=Ty(n),d=Ty(i);n==i&&(u==-1?(n*=l,i/=l):(n/=l,i*=l));let f=l==10?La:ub,p=u==1?mi:Ni,m=d==1?Ni:mi,v=p(f(en(n))),w=m(f(en(i))),S=hr(l,v),z=hr(l,w);return l==10&&(v<0&&(S=vt(S,-v)),w<0&&(z=vt(z,-w))),r||l==2?(n=S*u,i=z*d):(n=hb(n,S),i=Bc(i,z)),[n,i]}function am(n,i,l,r){let u=qc(n,i,l,r);return n==0&&(u[0]=0),i==0&&(u[1]=0),u}const lm=.1,zy={mode:3,pad:lm},ko={pad:0,soft:null,mode:0},bT={min:ko,max:ko};function kc(n,i,l,r){return Vc(l)?Ey(n,i,l):(ko.pad=l,ko.soft=r?0:null,ko.mode=r?3:0,Ey(n,i,bT))}function Je(n,i){return n??i}function _T(n,i,l){for(i=Je(i,0),l=Je(l,n.length-1);i<=l;){if(n[i]!=null)return!0;i++}return!1}function Ey(n,i,l){let r=l.min,u=l.max,d=Je(r.pad,0),f=Je(u.pad,0),p=Je(r.hard,-gt),m=Je(u.hard,gt),v=Je(r.soft,gt),w=Je(u.soft,-gt),S=Je(r.mode,0),z=Je(u.mode,0),T=i-n,j=La(T),L=qn(en(n),en(i)),V=La(L),H=en(V-j);(T<1e-24||H>10)&&(T=0,(n==0||i==0)&&(T=1e-24,S==2&&v!=gt&&(d=0),z==2&&w!=-gt&&(f=0)));let G=T||L||1e3,W=La(G),B=hr(10,mi(W)),ne=G*(T==0?n==0?.1:1:d),ee=vt(hb(n-ne,B/10),24),K=n>=v&&(S==1||S==3&&ee<=v||S==2&&ee>=v)?v:gt,le=qn(p,ee=K?K:Gi(K,ee)),ze=G*(T==0?i==0?.1:1:f),ve=vt(Bc(i+ze,B/10),24),ie=i<=w&&(z==1||z==3&&ve>=w||z==2&&ve<=w)?w:-gt,_e=Gi(m,ve>ie&&i<=ie?ie:qn(ie,ve));return le==_e&&le==0&&(_e=100),[le,_e]}const ST=new Intl.NumberFormat(_r?pT.language:"en-US"),sm=n=>ST.format(n),pi=Math,_c=pi.PI,en=pi.abs,mi=pi.floor,Wt=pi.round,Ni=pi.ceil,Gi=pi.min,qn=pi.max,hr=pi.pow,Ty=pi.sign,La=pi.log10,ub=pi.log2,xT=(n,i=1)=>pi.sinh(n)*i,ih=(n,i=1)=>pi.asinh(n/i),gt=1/0;function Ay(n){return(La((n^n>>31)-(n>>31))|0)+1}function bh(n,i,l){return Gi(qn(n,i),l)}function cb(n){return typeof n=="function"}function Be(n){return cb(n)?n:()=>n}const wT=()=>{},fb=n=>n,db=(n,i)=>i,zT=n=>null,Ny=n=>!0,Oy=(n,i)=>n==i,ET=/\.\d*?(?=9{6,}|0{6,})/gm,hs=n=>{if(pb(n)||Al.has(n))return n;const i=`${n}`,l=i.match(ET);if(l==null)return n;let r=l[0].length-1;if(i.indexOf("e-")!=-1){let[u,d]=i.split("e");return+`${hs(u)}e${d}`}return vt(n,r)};function ls(n,i){return hs(vt(hs(n/i))*i)}function Bc(n,i){return hs(Ni(hs(n/i))*i)}function hb(n,i){return hs(mi(hs(n/i))*i)}function vt(n,i=0){if(pb(n))return n;let l=10**i,r=n*l*(1+Number.EPSILON);return Wt(r)/l}const Al=new Map;function mb(n){return((""+n).split(".")[1]||"").length}function Uo(n,i,l,r){let u=[],d=r.map(mb);for(let f=i;f=0?0:p)+(f>=d[v]?0:d[v]),z=n==10?w:vt(w,S);u.push(z),Al.set(z,S)}}return u}const Ro={},rm=[],mr=[null,null],zl=Array.isArray,pb=Number.isInteger,TT=n=>n===void 0;function My(n){return typeof n=="string"}function Vc(n){let i=!1;if(n!=null){let l=n.constructor;i=l==null||l==Object}return i}function AT(n){return n!=null&&typeof n=="object"}const NT=Object.getP)DELIM" -R"DELIM(rototypeOf(Uint8Array),gb="__proto__";function pr(n,i=Vc){let l;if(zl(n)){let r=n.find(u=>u!=null);if(zl(r)||i(r)){l=Array(n.length);for(let u=0;ud){for(u=f-1;u>=0&&n[u]==null;)n[u--]=null;for(u=f+1;uf-p)],u=r[0].length,d=new Map;for(let f=0;f"u"?n=>Promise.resolve().then(n):queueMicrotask;function DT(n){let i=n[0],l=i.length,r=Array(l);for(let d=0;di[d]-i[f]);let u=[];for(let d=0;d=r&&n[u]==null;)u--;if(u<=r)return!0;const d=qn(1,mi((u-r+1)/i));for(let f=n[r],p=r+d;p<=u;p+=d){const m=n[p];if(m!=null){if(m<=f)return!1;f=m}}return!0}const vb=["January","February","March","April","May","June","July","August","September","October","November","December"],yb=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function bb(n){return n.slice(0,3)}const $T=yb.map(bb),LT=vb.map(bb),HT={MMMM:vb,MMM:LT,WWWW:yb,WWW:$T};function Eo(n){return(n<10?"0":"")+n}function qT(n){return(n<10?"00":n<100?"0":"")+n}const BT={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=>Eo(n.getMonth()+1),M:n=>n.getMonth()+1,DD:n=>Eo(n.getDate()),D:n=>n.getDate(),WWWW:(n,i)=>i.WWWW[n.getDay()],WWW:(n,i)=>i.WWW[n.getDay()],HH:n=>Eo(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=>Eo(n.getMinutes()),m:n=>n.getMinutes(),ss:n=>Eo(n.getSeconds()),s:n=>n.getSeconds(),fff:n=>qT(n.getMilliseconds())};function om(n,i){i=i||HT;let l=[],r=/\{([a-z]+)\}|[^{]+/gi,u;for(;u=r.exec(n);)l.push(u[0][0]=="{"?BT[u[1]]:u[0]);return d=>{let f="";for(let p=0;pn%1==0,Rc=[1,2,2.5,5],YT=Uo(10,-32,0,Rc),Sb=Uo(10,0,32,Rc),QT=Sb.filter(_b),ss=YT.concat(Sb),um=` -`,xb="{YYYY}",jy=um+xb,wb="{M}/{D}",Mo=um+wb,pc=Mo+"/{YY}",zb="{aa}",KT="{h}:{mm}",sr=KT+zb,ky=um+sr,Ry=":{ss}",tt=null;function Eb(n){let i=n*1e3,l=i*60,r=l*60,u=r*24,d=u*30,f=u*365,m=(n==1?Uo(10,0,3,Rc).filter(_b):Uo(10,-3,0,Rc)).concat([i,i*5,i*10,i*15,i*30,l,l*5,l*10,l*15,l*30,r,r*2,r*3,r*4,r*6,r*8,r*12,u,u*2,u*3,u*4,u*5,u*6,u*7,u*8,u*9,u*10,u*15,d,d*2,d*3,d*4,d*6,f,f*2,f*5,f*10,f*25,f*50,f*100]);const v=[[f,xb,tt,tt,tt,tt,tt,tt,1],[u*28,"{MMM}",jy,tt,tt,tt,tt,tt,1],[u,wb,jy,tt,tt,tt,tt,tt,1],[r,"{h}"+zb,pc,tt,Mo,tt,tt,tt,1],[l,sr,pc,tt,Mo,tt,tt,tt,1],[i,Ry,pc+" "+sr,tt,Mo+" "+sr,tt,ky,tt,1],[n,Ry+".{fff}",pc+" "+sr,tt,Mo+" "+sr,tt,ky,tt,1]];function w(S){return(z,T,j,L,V,H)=>{let G=[],W=V>=f,B=V>=d&&V=u?u:V,ve=mi(j)-mi(ee),ie=le+ve+Bc(ee-le,ze);G.push(ie);let _e=S(ie),ce=_e.getHours()+_e.getMinutes()/l+_e.getSeconds()/r,Ee=V/r,he=z.axes[T]._space,D=H/he;for(;ie=vt(ie+V,n==1?0:3),!(ie>L);)if(Ee>1){let Q=mi(vt(ce+Ee,6))%24,Se=S(ie).getHours()-Q;Se>1&&(Se=-1),ie-=Se*r,ce=(ce+Ee)%24;let N=G[G.length-1];vt((ie-N)/V,3)*D>=.7&&G.push(ie)}else G.push(ie)}return G}}return[m,v,w]}const[FT,JT,XT]=Eb(1),[IT,PT,WT]=Eb(.001);Uo(2,-53,53,[1]);function Cy(n,i){return n.map(l=>l.map((r,u)=>u==0||u==8||r==null?r:i(u==1||l[8]==0?r:l[1]+r)))}function Dy(n,i){return(l,r,u,d,f)=>{let p=i.find(j=>f>=j[0])||i[i.length-1],m,v,w,S,z,T;return r.map(j=>{let L=n(j),V=L.getFullYear(),H=L.getMonth(),G=L.getDate(),W=L.getHours(),B=L.getMinutes(),ne=L.getSeconds(),ee=V!=m&&p[2]||H!=v&&p[3]||G!=w&&p[4]||W!=S&&p[5]||B!=z&&p[6]||ne!=T&&p[7]||p[1];return m=V,v=H,w=G,S=W,z=B,T=ne,ee(L)})}}function eA(n,i){let l=om(i);return(r,u,d,f,p)=>u.map(m=>l(n(m)))}function ah(n,i,l){return new Date(n,i,l)}function Uy(n,i){return i(n)}const tA="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function Zy(n,i){return(l,r,u,d)=>d==null?nm:i(n(r))}function nA(n,i){let l=n.series[i];return l.width?l.stroke(n,i):l.points.width?l.points.stroke(n,i):null}function iA(n,i){return n.series[i].fill(n,i)}const aA={show:!0,live:!0,isolate:!1,mount:wT,markers:{show:!0,width:2,stroke:nA,fill:iA,dash:"solid"},idx:null,idxs:null,values:[]};function lA(n,i){let l=n.cursor.points,r=Ai(),u=l.size(n,i);wt(r,No,u),wt(r,Oo,u);let d=u/-2;wt(r,"marginLeft",d),wt(r,"marginTop",d);let f=l.width(n,i,u);return f&&wt(r,"borderWidth",f),r}function sA(n,i){let l=n.series[i].points;return l._fill||l._stroke}function rA(n,i){let l=n.series[i].points;return l._stroke||l._fill}function oA(n,i){return n.series[i].points.size}const lh=[0,0];function uA(n,i,l){return lh[0]=i,lh[1]=l,lh}function gc(n,i,l,r=!0){return u=>{u.button==0&&(!r||u.target==i)&&l(u)}}function sh(n,i,l,r=!0){return u=>{(!r||u.target==i)&&l(u)}}const cA={show:!0,x:!0,y:!0,lock:!1,move:uA,points:{one:!1,show:lA,size:oA,width:0,stroke:rA,fill:sA},bind:{mousedown:gc,mouseup:gc,click:gc,dblclick:gc,mousemove:sh,mouseleave:sh,mouseenter:sh},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,l,r,u)=>r-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},Tb={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},cm=Jt({},Tb,{filter:db}),Ab=Jt({},cm,{size:10}),Nb=Jt({},Tb,{show:!1}),fm='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"',Ob="bold "+fm,Mb=1.5,$y={show:!0,scale:"x",stroke:tm,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:Ob,side:2,grid:cm,ticks:Ab,border:Nb,font:fm,lineGap:Mb,rotate:0},fA="Value",dA="Time",Ly={show:!0,scale:"x",auto:!1,sorted:1,min:gt,max:-gt,idxs:[]};function hA(n,i,l,r,u){return i.map(d=>d==null?"":sm(d))}function mA(n,i,l,r,u,d,f){let p=[],m=Al.get(u)||0;l=f?l:vt(Bc(l,u),m);for(let v=l;v<=r;v=vt(v+u,m))p.push(Object.is(v,-0)?0:v);return p}function _h(n,i,l,r,u,d,f){const p=[],m=n.scales[n.axes[i].scale].log,v=m==10?La:ub,w=mi(v(l));u=hr(m,w),m==10&&(u=ss[Vi(u,ss)]);let S=l,z=u*m;m==10&&(z=ss[Vi(z,ss)]);do p.push(S),S=S+u,m==10&&!Al.has(S)&&(S=vt(S,Al.get(u))),S>=z&&(u=S,z=u*)DELIM" -R"DELIM(m,m==10&&(z=ss[Vi(z,ss)]));while(S<=r);return p}function pA(n,i,l,r,u,d,f){let m=n.scales[n.axes[i].scale].asinh,v=r>m?_h(n,i,qn(m,l),r,u):[m],w=r>=0&&l<=0?[0]:[];return(l<-m?_h(n,i,qn(m,-r),-l,u):[m]).reverse().map(z=>-z).concat(w,v)}const jb=/./,gA=/[12357]/,vA=/[125]/,Hy=/1/,Sh=(n,i,l,r)=>n.map((u,d)=>i==4&&u==0||d%r==0&&l.test(u.toExponential()[u<0?1:0])?u:null);function yA(n,i,l,r,u){let d=n.axes[l],f=d.scale,p=n.scales[f],m=n.valToPos,v=d._space,w=m(10,f),S=m(9,f)-w>=v?jb:m(7,f)-w>=v?gA:m(5,f)-w>=v?vA:Hy;if(S==Hy){let z=en(m(1,f)-w);if(zu,Vy={show:!0,auto:!0,sorted:0,gaps:kb,alpha:1,facets:[Jt({},By,{scale:"x"}),Jt({},By,{scale:"y"})]},Gy={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:kb,alpha:1,points:{show:xA,filter:null},values:null,min:gt,max:-gt,idxs:[],path:null,clip:null};function wA(n,i,l,r,u){return l/10}const Rb={time:FE,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},zA=Jt({},Rb,{time:!1,ori:1}),Yy={};function Cb(n,i){let l=Yy[n];return l||(l={key:n,plots:[],sub(r){l.plots.push(r)},unsub(r){l.plots=l.plots.filter(u=>u!=r)},pub(r,u,d,f,p,m,v){for(let w=0;w{let H=f.pxRound;const G=v.dir*(v.ori==0?1:-1),W=v.ori==0?Sr:xr;let B,ne;G==1?(B=l,ne=r):(B=r,ne=l);let ee=H(S(p[B],v,L,T)),K=H(z(m[B],w,V,j)),le=H(S(p[ne],v,L,T)),ze=H(z(d==1?w.max:w.min,w,V,j)),ve=new Path2D(u);return W(ve,le,ze),W(ve,ee,ze),W(ve,ee,K),ve})}function Gc(n,i,l,r,u,d){let f=null;if(n.length>0){f=new Path2D;const p=i==0?Kc:mm;let m=l;for(let S=0;Sz[0]){let T=z[0]-m;T>0&&p(f,m,r,T,r+d),m=z[1]}}let v=l+u-m,w=10;v>0&&p(f,m,r-w/2,v,r+d+w)}return f}function TA(n,i,l){let r=n[n.length-1];r&&r[0]==i?r[1]=l:n.push([i,l])}function hm(n,i,l,r,u,d,f){let p=[],m=n.length;for(let v=u==1?l:r;v>=l&&v<=r;v+=u)if(i[v]===null){let S=v,z=v;if(u==1)for(;++v<=r&&i[v]===null;)z=v;else for(;--v>=l&&i[v]===null;)z=v;let T=d(n[S]),j=z==S?T:d(n[z]),L=S-u;T=f<=0&&L>=0&&L=0&&H>=0&&H=T&&p.push([T,j])}return p}function Qy(n){return n==0?fb:n==1?Wt:i=>ls(i,n)}function Db(n){let i=n==0?Yc:Qc,l=n==0?(u,d,f,p,m,v)=>{u.arcTo(d,f,p,m,v)}:(u,d,f,p,m,v)=>{u.arcTo(f,d,m,p,v)},r=n==0?(u,d,f,p,m)=>{u.rect(d,f,p,m)}:(u,d,f,p,m)=>{u.rect(f,d,m,p)};return(u,d,f,p,m,v=0,w=0)=>{v==0&&w==0?r(u,d,f,p,m):(v=Gi(v,p/2,m/2),w=Gi(w,p/2,m/2),i(u,d+v,f),l(u,d+p,f,d+p,f+m,v),l(u,d+p,f+m,d,f+m,w),l(u,d,f+m,d,f,w),l(u,d,f,d+p,f,v),u.closePath())}}const Yc=(n,i,l)=>{n.moveTo(i,l)},Qc=(n,i,l)=>{n.moveTo(l,i)},Sr=(n,i,l)=>{n.lineTo(i,l)},xr=(n,i,l)=>{n.lineTo(l,i)},Kc=Db(0),mm=Db(1),Ub=(n,i,l,r,u,d)=>{n.arc(i,l,r,u,d)},Zb=(n,i,l,r,u,d)=>{n.arc(l,i,r,u,d)},$b=(n,i,l,r,u,d,f)=>{n.bezierCurveTo(i,l,r,u,d,f)},Lb=(n,i,l,r,u,d,f)=>{n.bezierCurveTo(l,i,u,r,f,d)};function Hb(n){return(i,l,r,u,d)=>ps(i,l,(f,p,m,v,w,S,z,T,j,L,V)=>{let{pxRound:H,points:G}=f,W,B;v.ori==0?(W=Yc,B=Ub):(W=Qc,B=Zb);const ne=vt(G.width*Pe,3);let ee=(G.size-G.width)/2*Pe,K=vt(ee*2,3),le=new Path2D,ze=new Path2D,{left:ve,top:ie,width:_e,height:ce}=i.bbox;Kc(ze,ve-K,ie-K,_e+K*2,ce+K*2);const Ee=he=>{if(m[he]!=null){let D=H(S(p[he],v,L,T)),Q=H(z(m[he],w,V,j));W(le,D+ee,Q),B(le,D,Q,ee,0,_c*2)}};if(d)d.forEach(Ee);else for(let he=r;he<=u;he++)Ee(he);return{stroke:ne>0?le:null,fill:le,clip:ze,flags:gr|xh}})}function qb(n){return(i,l,r,u,d,f)=>{r!=u&&(d!=r&&f!=r&&n(i,l,r),d!=u&&f!=u&&n(i,l,u),n(i,l,f))}}const AA=qb(Sr),NA=qb(xr);function Bb(n){const i=Je(n?.alignGaps,0);return(l,r,u,d)=>ps(l,r,(f,p,m,v,w,S,z,T,j,L,V)=>{[u,d]=Hc(m,u,d);let H=f.pxRound,G=ce=>H(S(ce,v,L,T)),W=ce=>H(z(ce,w,V,j)),B,ne;v.ori==0?(B=Sr,ne=AA):(B=xr,ne=NA);const ee=v.dir*(v.ori==0?1:-1),K={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:gr},le=K.stroke;let ze=!1;if(d-u>=L*4){let ce=Y=>l.posToVal(Y,v.key,!0),Ee=null,he=null,D,Q,pe,Oe=G(p[ee==1?u:d]),Se=G(p[u]),N=G(p[d]),$=ce(ee==1?Se+1:N-1);for(let Y=ee==1?u:d;Y>=u&&Y<=d;Y+=ee){let se=p[Y],ge=(ee==1?se<$:se>$)?Oe:G(se),ye=m[Y];ge==Oe?ye!=null?(Q=ye,Ee==null?(B(le,ge,W(Q)),D=Ee=he=Q):Qhe&&(he=Q)):ye===null&&(ze=!0):(Ee!=null&&ne(le,Oe,W(Ee),W(he),W(D),W(Q)),ye!=null?(Q=ye,B(le,ge,W(Q)),Ee=he=D=Q):(Ee=he=null,ye===null&&(ze=!0)),Oe=ge,$=ce(Oe+ee))}Ee!=null&&Ee!=he&&pe!=Oe&&ne(le,Oe,W(Ee),W(he),W(D),W(Q))}else for(let ce=ee==1?u:d;ce>=u&&ce<=d;ce+=ee){let Ee=m[ce];Ee===null?ze=!0:Ee!=null&&B(le,G(p[ce]),W(Ee))}let[ie,_e]=dm(l,r);if(f.fill!=null||ie!=0){let ce=K.fill=new Path2D(le),Ee=f.fillTo(l,r,f.min,f.max,ie),he=W(Ee),D=G(p[u]),Q=G(p[d]);ee==-1&&([Q,D]=[D,Q]),B(ce,Q,he),B(ce,D,he)}if(!f.spanGaps){let ce=[];ze&&ce.push(...hm(p,m,u,d,ee,G,i)),K.gaps=ce=f.gaps(l,r,u,d,ce),K.clip=Gc(ce,v.ori,T,j,L,V)}return _e!=0&&(K.band=_e==2?[Ha(l,r,u,d,le,-1),Ha(l,r,u,d,le,1)]:Ha(l,r,u,d,le,_e)),K})}function OA(n){const i=Je(n.align,1),l=Je(n.ascDesc,!1),r=Je(n.alignGaps,0),u=Je(n.extend,!1);return(d,f,p,m)=>ps(d,f,(v,w,S,z,T,j,L,V,H,G,W)=>{[p,m]=Hc(S,p,m);let B=v.pxRound,{left:ne,width:ee}=d.bbox,K=Se=>B(j(Se,z,G,V)),le=Se=>B(L(Se,T,W,H)),ze=z.ori==0?Sr:xr;const ve={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:gr},ie=ve.stroke,_e=z.dir*(z.ori==0?1:-1);let ce=le(S[_e==1?p:m]),Ee=K(w[_e==1?p:m]),he=Ee,D=Ee;u&&i==-1&&(D=ne,ze(ie,D,ce)),ze(ie,Ee,ce);for(let Se=_e==1?p:m;Se>=p&&Se<=m;Se+=_e){let N=S[Se];if(N==null)continue;let $=K(w[Se]),Y=le(N);i==1?ze(ie,$,ce):ze(ie,he,Y),ze(ie,$,Y),ce=Y,he=$}let Q=he;u&&i==1&&(Q=ne+ee,ze(ie,Q,ce));let[pe,Oe]=dm(d,f);if(v.fill!=null||pe!=0){let Se=ve.fill=new Path2D(ie),N=v.fillTo(d,f,v.min,v.max,pe),$=le(N);ze(Se,Q,$),ze(Se,D,$)}if(!v.spanGaps){let Se=[];Se.push(...hm(w,S,p,m,_e,K,r));let N=v.width*Pe/2,$=l||i==1?N:-N,Y=l||i==-1?-N:N;Se.forEach(se=>{se[0]+=$,se[1]+=Y}),ve.gaps=Se=v.gaps(d,f,p,m,Se),ve.clip=Gc(Se,z.ori,V,H,G,W)}return Oe!=0&&(ve.band=Oe==2?[Ha(d,f,p,m,ie,-1),Ha(d,f,p,m,ie,1)]:Ha(d,f,p,m,ie,Oe)),ve})}function Ky(n,i,l,r,u,d,f=gt){if(n.length>1){let p=null;for(let m=0,v=1/0;m{}),{fill:S,stroke:z}=v;return(T,j,L,V)=>ps(T,j,(H,G,W,B,ne,ee,K,le,ze,ve,ie)=>{let _e=H.pxRound,ce=l,Ee=r*Pe,he=p*Pe,D=m*Pe,Q,pe;B.ori==0?[Q,pe]=d(T,j)DELIM" -R"DELIM():[pe,Q]=d(T,j);const Oe=B.dir*(B.ori==0?1:-1);let Se=B.ori==0?Kc:mm,N=B.ori==0?w:(fe,it,Mt,Ri,ca,ti,fa)=>{w(fe,it,Mt,ca,Ri,fa,ti)},$=Je(T.bands,rm).find(fe=>fe.series[0]==j),Y=$!=null?$.dir:0,se=H.fillTo(T,j,H.min,H.max,Y),we=_e(K(se,ne,ie,ze)),ge,ye,mt,Ve=ve,nt=_e(H.width*Pe),Mn=!1,ei=null,jn=null,xn=null,Yi=null;S!=null&&(nt==0||z!=null)&&(Mn=!0,ei=S.values(T,j,L,V),jn=new Map,new Set(ei).forEach(fe=>{fe!=null&&jn.set(fe,new Path2D)}),nt>0&&(xn=z.values(T,j,L,V),Yi=new Map,new Set(xn).forEach(fe=>{fe!=null&&Yi.set(fe,new Path2D)})));let{x0:Qi,size:jl}=v;if(Qi!=null&&jl!=null){ce=1,G=Qi.values(T,j,L,V),Qi.unit==2&&(G=G.map(Mt=>T.posToVal(le+Mt*ve,B.key,!0)));let fe=jl.values(T,j,L,V);jl.unit==2?ye=fe[0]*ve:ye=ee(fe[0],B,ve,le)-ee(0,B,ve,le),Ve=Ky(G,W,ee,B,ve,le,Ve),mt=Ve-ye+Ee}else Ve=Ky(G,W,ee,B,ve,le,Ve),mt=Ve*f+Ee,ye=Ve-mt;mt<1&&(mt=0),nt>=ye/2&&(nt=0),mt<5&&(_e=fb);let kl=mt>0,ji=Ve-mt-(kl?nt:0);ye=_e(bh(ji,D,he)),ge=(ce==0?ye/2:ce==Oe?0:ye)-ce*Oe*((ce==0?Ee/2:0)+(kl?nt/2:0));const Xt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Ki=Mn?null:new Path2D;let ki=null;if($!=null)ki=T.data[$.series[1]];else{let{y0:fe,y1:it}=v;fe!=null&&it!=null&&(W=it.values(T,j,L,V),ki=fe.values(T,j,L,V))}let ua=Q*ye,Te=pe*ye;for(let fe=Oe==1?L:V;fe>=L&&fe<=V;fe+=Oe){let it=W[fe];if(it==null)continue;if(ki!=null){let ot=ki[fe]??0;if(it-ot==0)continue;we=K(ot,ne,ie,ze)}let Mt=B.distr!=2||v!=null?G[fe]:fe,Ri=ee(Mt,B,ve,le),ca=K(Je(it,se),ne,ie,ze),ti=_e(Ri-ge),fa=_e(qn(ca,we)),kn=_e(Gi(ca,we)),nn=fa-kn;if(it!=null){let ot=it<0?Te:ua,Vt=it<0?ua:Te;Mn?(nt>0&&xn[fe]!=null&&Se(Yi.get(xn[fe]),ti,kn+mi(nt/2),ye,qn(0,nn-nt),ot,Vt),ei[fe]!=null&&Se(jn.get(ei[fe]),ti,kn+mi(nt/2),ye,qn(0,nn-nt),ot,Vt)):Se(Ki,ti,kn+mi(nt/2),ye,qn(0,nn-nt),ot,Vt),N(T,j,fe,ti-nt/2,kn,ye+nt,nn)}}return nt>0?Xt.stroke=Mn?Yi:Ki:Mn||(Xt._fill=H.width==0?H._fill:H._stroke??H._fill,Xt.width=0),Xt.fill=Mn?jn:Ki,Xt})}function jA(n,i){const l=Je(i?.alignGaps,0);return(r,u,d,f)=>ps(r,u,(p,m,v,w,S,z,T,j,L,V,H)=>{[d,f]=Hc(v,d,f);let G=p.pxRound,W=Q=>G(z(Q,w,V,j)),B=Q=>G(T(Q,S,H,L)),ne,ee,K;w.ori==0?(ne=Yc,K=Sr,ee=$b):(ne=Qc,K=xr,ee=Lb);const le=w.dir*(w.ori==0?1:-1);let ze=W(m[le==1?d:f]),ve=ze,ie=[],_e=[];for(let Q=le==1?d:f;Q>=d&&Q<=f;Q+=le)if(v[Q]!=null){let Oe=m[Q],Se=W(Oe);ie.push(ve=Se),_e.push(B(v[Q]))}const ce={stroke:n(ie,_e,ne,K,ee,G),fill:null,clip:null,band:null,gaps:null,flags:gr},Ee=ce.stroke;let[he,D]=dm(r,u);if(p.fill!=null||he!=0){let Q=ce.fill=new Path2D(Ee),pe=p.fillTo(r,u,p.min,p.max,he),Oe=B(pe);K(Q,ve,Oe),K(Q,ze,Oe)}if(!p.spanGaps){let Q=[];Q.push(...hm(m,v,d,f,le,W,l)),ce.gaps=Q=p.gaps(r,u,d,f,Q),ce.clip=Gc(Q,w.ori,j,L,V,H)}return D!=0&&(ce.band=D==2?[Ha(r,u,d,f,Ee,-1),Ha(r,u,d,f,Ee,1)]:Ha(r,u,d,f,Ee,D)),ce})}function kA(n){return jA(RA,n)}function RA(n,i,l,r,u,d){const f=n.length;if(f<2)return null;const p=new Path2D;if(l(p,n[0],i[0]),f==2)r(p,n[1],i[1]);else{let m=Array(f),v=Array(f-1),w=Array(f-1),S=Array(f-1);for(let z=0;z0!=v[z]>0?m[z]=0:(m[z]=3*(S[z-1]+S[z])/((2*S[z]+S[z-1])/v[z-1]+(S[z]+2*S[z-1])/v[z]),isFinite(m[z])||(m[z]=0));m[f-1]=v[f-2];for(let z=0;z{un.pxRatio=Pe}));const CA=Bb(),DA=Hb();function Jy(n,i,l,r){return(r?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map((d,f)=>zh(d,f,i,l))}function UA(n,i){return n.map((l,r)=>r==0?{}:Jt({},i,l))}function zh(n,i,l,r){return Jt({},i==0?l:r,n)}function Vb(n,i,l){return i==null?mr:[i,l]}const ZA=Vb;function $A(n,i,l){return i==null?mr:kc(i,l,lm,!0)}function Gb(n,i,l,r){return i==null?mr:qc(i,l,n.scales[r].log,!1)}const LA=Gb;function Yb(n,i,l,r){return i==null?mr:am(i,l,n.scales[r].log,!1)}const HA=Yb;function qA(n,i,l,r,u){let d=qn(Ay(n),Ay(i)),f=i-n,p=Vi(u/r*f,l);do{let m=l[p],v=r*m/f;if(v>=u&&d+(m<5?Al.get(m):0)<=17)return[m,v]}while(++p(i=Wt((l=+u)*Pe))+"px"),[n,i,l]}function BA(n){n.show&&[n.font,n.labelFont].forEach(i=>{let l=vt(i[2]*Pe,1);i[0]=i[0].replace(/[0-9.]+px/,l+"px"),i[1]=l})}function un(n,i,l){const r={mode:Je(n.mode,1)},u=r.mode;function d(g,y,x,E){let O=y.valToPct(g);return E+x*(y.dir==-1?1-O:O)}function f(g,y,x,E){let O=y.valToPct(g);return E+x*(y.dir==-1?O:1-O)}function p(g,y,x,E){return y.ori==0?d(g,y,x,E):f(g,y,x,E)}r.valToPosH=d,r.valToPosV=f;let m=!1;r.status=0;const v=r.root=Ai(JE);if(n.id!=null&&(v.id=n.id),fi(v,n.class),n.title){let g=Ai(PE,v);g.textContent=n.title}const w=Bi("canvas"),S=r.ctx=w.getContext("2d"),z=Ai(WE,v);cs("click",z,g=>{g.target===j&&(We!=Un||at!=Wi)&&Qe.click(r,g)},!0);const T=r.under=Ai(eT,z);z.appendChild(w);const j=r.over=Ai(tT,z);n=pr(n);const L=+Je(n.pxAlign,1),V=Qy(L);(n.plugins||[]).forEach(g=>{g.opts&&(n=g.opts(r,n)||n)});const H=n.ms||.001,G=r.series=u==1?Jy(n.series||[],Ly,Gy,!1):UA(n.series||[null],Vy),W=r.axes=Jy(n.axes||[],$y,qy,!0),B=r.scales={},ne=r.bands=n.bands||[];ne.forEach(g=>{g.fill=Be(g.fill||null),g.dir=Je(g.dir,-1)});const ee=u==2?G[1].facets[0].scale:G[0].scale,K={axes:jr,series:Jc},le=(n.drawOrder||["axes","series"]).map(g=>K[g]);function ze(g){const y=g.distr==3?x=>La(x>0?x:g.clamp(r,x,g.min,g.max,g.key)):g.distr==4?x=>ih(x,g.asinh):g.distr==100?x=>g.fwd(x):x=>x;return x=>{let E=y(x),{_min:O,_max:R}=g,J=R-O;return(E-O)/J}}function ve(g){let y=B[g];if(y==null){let x=(n.scales||Ro)[g]||Ro;if(x.from!=null){ve(x.from);let E=Jt({},B[x.from],x,{key:g});E.valToPct=ze(E),B[g]=E}else{y=B[g]=Jt({},g==ee?Rb:zA,x),y.key=g;let E=y.time,O=y.range,R=zl(O);if((g!=ee||u==2&&!E)&&(R&&(O[0]==null||O[1]==null)&&(O={min:O[0]==null?zy:{mode:1,hard:O[0],soft:O[0]},max:O[1]==null?zy:{mode:1,hard:O[1],soft:O[1]}},R=!1),!R&&Vc(O))){let J=O;O=(te,ae,oe)=>ae==null?mr:kc(ae,oe,J)}y.range=Be(O||(E?ZA:g==ee?y.distr==3?LA:y.distr==4?HA:Vb:y.distr==3?Gb:y.distr==4?Yb:$A)),y.auto=Be(R?!1:y.auto),y.clamp=Be(y.clamp||wA),y._min=y._max=null,y.valToPct=ze(y)}}}ve("x"),ve("y"),u==1&&G.forEach(g=>{ve(g.scale)}),W.forEach(g=>{ve(g.scale)});for(let g in n.scales)ve(g);const ie=B[ee],_e=ie.distr;let ce,Ee;ie.ori==0?(fi(v,XE),ce=d,Ee=f):(fi(v,IE),ce=f,Ee=d);const he={};for(let g in B){let y=B[g];(y.min!=null||y.max!=null)&&(he[g]={min:y.min,max:y.max},y.min=y.max=null)}const D=n.tzDate||(g=>new Date(Wt(g/H))),Q=n.fmtDate||om,pe=H==1?XT(D):WT(D),Oe=Dy(D,Cy(H==1?JT:PT,Q)),Se=Zy(D,Uy(tA,Q)),N=[],$=r.legend=Jt({},aA,n.legend),Y=r.cursor=Jt({},cA,{drag:{y:u==2}},n.cursor),se=$.show,we=Y.show,ge=$.markers;$.idxs=N,ge.width=Be(ge.width),ge.dash=Be(ge.dash),ge.stroke=Be(ge.stroke),ge.fill=Be(ge.fill);let ye,mt,Ve,nt=[],Mn=[],ei,jn=!1,xn={};if($.live){const g=G[1]?G[1].values:null;jn=g!=null,ei=jn?g(r,1,0):{_:0};for(let y in ei)xn[y]=nm}if(se)if(ye=Bi("table",rT,v),Ve=Bi("tbody",null,ye),$.mount(r,ye),jn){mt=Bi("thead",null,ye,Ve);let g=Bi("tr",null,mt);Bi("th",null,g);for(var Yi in ei)Bi("th",fy,g).textContent=Yi}else fi(ye,uT),$.live&&fi(ye,oT);const Qi={show:!0},jl={show:!1};function kl(g,y){if(y==0&&(jn||!$.live||u==2))return mr;let x=[],E=Bi("tr",cT,Ve,Ve.childNodes[y]);fi(E,g.class),g.show||fi(E,rs);let O=Bi("th",null,E);if(ge.show){let te=Ai(fT,O);if(y>0){let ae=ge.width(r,y);ae&&(te.style.border=ae+"px "+ge.dash(r,y)+" "+ge.stroke(r,y)),te.style.background=ge.fill(r,y)}}let R=Ai(fy,O);g.label instanceof HTMLElement?R.appendChild(g.label):R.textContent=g.label,y>0&&(ge.show||(R.style.color=g.width>0?ge.stroke(r,y):ge.fill(r,y)),Xt("click",O,te=>{if(Y._lock)return;ni(te);let ae=G.indexOf(g);if((te.ctrlKey||te.metaKey)!=$.isolate){let oe=G.some((ue,de)=>de>0&&de!=ae&&ue.show);G.forEach((ue,de)=>{de>0&&Zn(de,oe?de==ae?Qi:jl:Qi,!0,kt.setSeries)})}else Zn(ae,{show:!g.show},!0,kt.setSeries)},!1),ma&&Xt(py,O,te=>{Y._lock||(ni(te),Zn(G.indexOf(g),Pa,!0,kt.setSeries))},!1));for()DELIM" -R"DELIM(var J in ei){let te=Bi("td",dT,E);te.textContent="--",x.push(te)}return[E,x]}const ji=new Map;function Xt(g,y,x,E=!0){const O=ji.get(y)||{},R=Y.bind[g](r,y,x,E);R&&(cs(g,y,O[g]=R),ji.set(y,O))}function Ki(g,y,x){const E=ji.get(y)||{};for(let O in E)(g==null||O==g)&&(yh(O,y,E[O]),delete E[O]);g==null&&ji.delete(y)}let ki=0,ua=0,Te=0,fe=0,it=0,Mt=0,Ri=it,ca=Mt,ti=Te,fa=fe,kn=0,nn=0,ot=0,Vt=0;r.bbox={};let cn=!1,gs=!1,qa=!1,da=!1,ha=!1,fn=!1;function Ba(g,y,x){(x||g!=r.width||y!=r.height)&&Fi(g,y),Qa(!1),qa=!0,gs=!0,Pi()}function Fi(g,y){r.width=ki=Te=g,r.height=ua=fe=y,it=Mt=0,Vo(),wr();let x=r.bbox;kn=x.left=ls(it*Pe,.5),nn=x.top=ls(Mt*Pe,.5),ot=x.width=ls(Te*Pe,.5),Vt=x.height=ls(fe*Pe,.5)}const vs=3;function Rl(){let g=!1,y=0;for(;!g;){y++;let x=Ko(y),E=Fo(y);g=y==vs||x&&E,g||(Fi(r.width,r.height),gs=!0)}}function Fc({width:g,height:y}){Ba(g,y)}r.setSize=Fc;function Vo(){let g=!1,y=!1,x=!1,E=!1;W.forEach((O,R)=>{if(O.show&&O._show){let{side:J,_size:te}=O,ae=J%2,oe=O.label!=null?O.labelSize:0,ue=te+oe;ue>0&&(ae?(Te-=ue,J==3?(it+=ue,E=!0):x=!0):(fe-=ue,J==0?(Mt+=ue,g=!0):y=!0))}}),Bn[0]=g,Bn[1]=x,Bn[2]=y,Bn[3]=E,Te-=Di[1]+Di[3],it+=Di[3],fe-=Di[2]+Di[0],Mt+=Di[0]}function wr(){let g=it+Te,y=Mt+fe,x=it,E=Mt;function O(R,J){switch(R){case 1:return g+=J,g-J;case 2:return y+=J,y-J;case 3:return x-=J,x+J;case 0:return E-=J,E+J}}W.forEach((R,J)=>{if(R.show&&R._show){let te=R.side;R._pos=O(te,R._size),R.label!=null&&(R._lpos=O(te,R.labelSize))}})}if(Y.dataIdx==null){let g=Y.hover,y=g.skip=new Set(g.skip??[]);y.add(void 0);let x=g.prox=Be(g.prox),E=g.bias??=0;Y.dataIdx=(O,R,J,te)=>{if(R==0)return J;let ae=J,oe=x(O,R,J,te)??gt,ue=oe>=0&&oe0;)y.has(Re[xe])||(De=xe);if(E==0||E==1)for(xe=J;Me==null&&xe++oe&&(ae=null);return ae}}const ni=g=>{Y.event=g};Y.idxs=N,Y._lock=!1;let an=Y.points;an.show=Be(an.show),an.size=Be(an.size),an.stroke=Be(an.stroke),an.width=Be(an.width),an.fill=Be(an.fill);const ii=r.focus=Jt({},n.focus||{alpha:.3},Y.focus),ma=ii.prox>=0,pa=ma&&an.one;let wn=[],Ji=[],ga=[];function zr(g,y){let x=an.show(r,y);if(x instanceof HTMLElement)return fi(x,sT),fi(x,g.class),sa(x,-10,-10,Te,fe),j.insertBefore(x,wn[y]),x}function Ci(g,y){if(u==1||y>0){let x=u==1&&B[g.scale].time,E=g.value;g.value=x?My(E)?Zy(D,Uy(E,Q)):E||Se:E||_A,g.label=g.label||(x?dA:fA)}if(pa||y>0){g.width=g.width==null?1:g.width,g.paths=g.paths||CA||zT,g.fillTo=Be(g.fillTo||EA),g.pxAlign=+Je(g.pxAlign,L),g.pxRound=Qy(g.pxAlign),g.stroke=Be(g.stroke||null),g.fill=Be(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let x=SA(qn(1,g.width),1),E=g.points=Jt({},{size:x,width:qn(1,x*.2),stroke:g.stroke,space:x*2,paths:DA,_stroke:null,_fill:null},g.points);E.show=Be(E.show),E.filter=Be(E.filter),E.fill=Be(E.fill),E.stroke=Be(E.stroke),E.paths=Be(E.paths),E.pxAlign=g.pxAlign}if(se){let x=kl(g,y);nt.splice(y,0,x[0]),Mn.splice(y,0,x[1]),$.values.push(null)}if(we){N.splice(y,0,null);let x=null;pa?y==0&&(x=zr(g,y)):y>0&&(x=zr(g,y)),wn.splice(y,0,x),Ji.splice(y,0,0),ga.splice(y,0,0)}Lt("addSeries",y)}function It(g,y){y=y??G.length,g=u==1?zh(g,y,Ly,Gy):zh(g,y,{},Vy),G.splice(y,0,g),Ci(G[y],y)}r.addSeries=It;function zn(g){if(G.splice(g,1),se){$.values.splice(g,1),Mn.splice(g,1);let y=nt.splice(g,1)[0];Ki(null,y.firstChild),y.remove()}we&&(N.splice(g,1),wn.splice(g,1)[0].remove(),Ji.splice(g,1),ga.splice(g,1)),Lt("delSeries",g)}r.delSeries=zn;const Bn=[!1,!1,!1,!1];function Er(g,y){if(g._show=g.show,g.show){let x=g.side%2,E=B[g.scale];E==null&&(g.scale=x?G[1].scale:ee,E=B[g.scale]);let O=E.time;g.size=Be(g.size),g.space=Be(g.space),g.rotate=Be(g.rotate),zl(g.incrs)&&g.incrs.forEach(J=>{!Al.has(J)&&Al.set(J,mb(J))}),g.incrs=Be(g.incrs||(E.distr==2?QT:O?H==1?FT:IT:ss)),g.splits=Be(g.splits||(O&&E.distr==1?pe:E.distr==3?_h:E.distr==4?pA:mA)),g.stroke=Be(g.stroke),g.grid.stroke=Be(g.grid.stroke),g.ticks.stroke=Be(g.ticks.stroke),g.border.stroke=Be(g.border.stroke);let R=g.values;g.values=zl(R)&&!zl(R[0])?Be(R):O?zl(R)?Dy(D,Cy(R,Q)):My(R)?eA(D,R):R||Oe:R||hA,g.filter=Be(g.filter||(E.distr>=3&&E.log==10?yA:E.distr==3&&E.log==2?bA:db)),g.font=Xy(g.font),g.labelFont=Xy(g.labelFont),g._size=g.size(r,null,y,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&(Bn[y]=!0,g._el=Ai(nT,z))}}function Cl(g,y,x,E){let[O,R,J,te]=x,ae=y%2,oe=0;return ae==0&&(te||R)&&(oe=y==0&&!O||y==2&&!J?Wt($y.size/3):0),ae==1&&(O||J)&&(oe=y==1&&!R||y==3&&!te?Wt(qy.size/2):0),oe}const Go=r.padding=(n.padding||[Cl,Cl,Cl,Cl]).map(g=>Be(Je(g,Cl))),Di=r._padding=Go.map((g,y)=>g(r,y,Bn,0));let At,jt=null,bt=null;const Ui=u==1?G[0].idxs:null;let dn=null,gi=!1;function $t(g,y){if(i=g??[],r.data=r._data=i,u==2){At=0;for(let x=1;x=0,fn=!0,Pi()}}r.setData=$t;function ys(){gi=!0;let g,y;u==1&&(At>0?(jt=Ui[0]=0,bt=Ui[1]=At-1,g=i[0][jt],y=i[0][bt],_e==2?(g=jt,y=bt):g==y&&(_e==3?[g,y]=qc(g,g,ie.log,!1):_e==4?[g,y]=am(g,g,ie.log,!1):ie.time?y=g+Wt(86400/H):[g,y]=kc(g,y,lm,!0))):(jt=Ui[0]=g=null,bt=Ui[1]=y=null)),Gn(ee,g,y)}let Dl,Vn,Xi,Tr,bs,_s,Ar,Va,Ga,zt;function Rn(g,y,x,E,O,R){g??=hy,x??=rm,E??="butt",O??=hy,R??="round",g!=Dl&&(S.strokeStyle=Dl=g),O!=Vn&&(S.fillStyle=Vn=O),y!=Xi&&(S.lineWidth=Xi=y),R!=bs&&(S.lineJoin=bs=R),E!=_s&&(S.lineCap=_s=E),x!=Tr&&S.setLineDash(Tr=x)}function Nr(g,y,x,E){y!=Vn&&(S.fillStyle=Vn=y),g!=Ar&&(S.font=Ar=g),x!=Va&&(S.textAlign=Va=x),E!=Ga&&(S.textBaseline=Ga=E)}function Or(g,y,x,E,O=0){if(E.length>0&&g.auto(r,gi)&&(y==null||y.min==null)){let R=Je(jt,0),J=Je(bt,E.length-1),te=x.min==null?yT(E,R,J,O,g.distr==3):[x.min,x.max];g.min=Gi(g.min,x.min=te[0]),g.max=qn(g.max,x.max=te[1])}}const Ss={min:null,max:null};function Yo(){for(let E in B){let O=B[E];he[E]==null&&(O.min==null||he[ee]!=null&&O.auto(r,gi))&&(he[E]=Ss)}for(let E in B){let O=B[E];he[E]==null&&O.from!=null&&he[O.from]!=null&&(he[E]=Ss)}he[ee]!=null&&Qa(!0);let g={};for(let E in he){let O=he[E];if(O!=null){let R=g[E]=pr(B[E],AT);if(O.min!=null)Jt(R,O);else if(E!=ee||u==2)if(At==0&&R.from==null){let J=R.range(r,null,null,E);R.min=J[0],R.max=J[1]}else R.min=gt,R.max=-gt}}if(At>0){G.forEach((E,O)=>{if(u==1){let R=E.scale,J=he[R];if(J==null)return;let te=g[R];if(O==0){let ae=te.range(r,te.min,te.max,R);te.min=ae[0],te.max=ae[1],jt=Vi(te.min,i[0]),bt=Vi(te.max,i[0]),bt-jt>1&&(i[0][jt]te.max&&bt--),E.min=dn[jt],E.max=dn[bt]}else E.show&&E.auto&&Or(te,J,E,i[O],E.sorted);E.idxs[0]=jt,E.idxs[1]=bt}else if(O>0&&E.show&&E.auto){let[R,J]=E.facets,te=R.scale,ae=J.scale,[oe,ue]=i[O],de=g[te],ke=g[ae];de!=null&&Or(de,he[te],R,oe,R.sorted),ke!=null&&Or(ke,he[ae],J,ue,J.sorted),E.min=J.min,E.max=J.max}});for(let E in g){let O=g[E],R=he[E];if(O.from==null&&(R==null||R.min==null)){let J=O.range(r,O.min==gt?null:O.min,O.max==-gt?null:O.max,E);O.min=J[0],O.max=J[1]}}}for(let E in g){let O=g[E];if(O.from!=null){let R=g[O.from];if(R.min==null)O.min=O.max=null;else{let J=O.range(r,R.min,R.max,E);O.min=J[0],O.max=J[1]}}}let y={},x=!1;for(let E in g){let O=g[E],R=B[E];if(R.min!=O.min||R.max!=O.max){R.min=O.min,R.max=O.max;let J=R.distr;R._min=J==3?La(R.min):J==4?ih(R.min,R.asinh):J==100?R.fwd(R.min):R.min,R._max=J==3?La(R.max):J==4?ih(R.max,R.asinh):J==100?R.fwd(R.max):R.max,y[E]=x=!0}}if(x){G.forEach((E,O)=>{u==2?O>0&&y.y&&(E._paths=null):y[E.scale]&&(E._paths=null)});for(let E in y)qa=!0,Lt("setScale",E);we&&Y.left>=0&&(da=fn=!0)}f)DELIM" -R"DELIM(or(let E in he)he[E]=null}function xs(g){let y=bh(jt-1,0,At-1),x=bh(bt+1,0,At-1);for(;g[y]==null&&y>0;)y--;for(;g[x]==null&&x0){let g=G.some(y=>y._focus)&&zt!=ii.alpha;g&&(S.globalAlpha=zt=ii.alpha),G.forEach((y,x)=>{if(x>0&&y.show&&(Cn(x,!1),Cn(x,!0),y._paths==null)){let E=zt;zt!=y.alpha&&(S.globalAlpha=zt=y.alpha);let O=u==2?[0,i[x][0].length-1]:xs(i[x]);y._paths=y.paths(r,x,O[0],O[1]),zt!=E&&(S.globalAlpha=zt=E)}}),G.forEach((y,x)=>{if(x>0&&y.show){let E=zt;zt!=y.alpha&&(S.globalAlpha=zt=y.alpha),y._paths!=null&&ws(x,!1);{let O=y._paths!=null?y._paths.gaps:null,R=y.points.show(r,x,jt,bt,O),J=y.points.filter(r,x,R,O);(R||J)&&(y.points._paths=y.points.paths(r,x,jt,bt,J),ws(x,!0))}zt!=E&&(S.globalAlpha=zt=E),Lt("drawSeries",x)}}),g&&(S.globalAlpha=zt=1)}}function Cn(g,y){let x=y?G[g].points:G[g];x._stroke=x.stroke(r,g),x._fill=x.fill(r,g)}function ws(g,y){let x=y?G[g].points:G[g],{stroke:E,fill:O,clip:R,flags:J,_stroke:te=x._stroke,_fill:ae=x._fill,_width:oe=x.width}=x._paths;oe=vt(oe*Pe,3);let ue=null,de=oe%2/2;y&&ae==null&&(ae=oe>0?"#fff":te);let ke=x.pxAlign==1&&de>0;if(ke&&S.translate(de,de),!y){let Ye=kn-oe/2,Re=nn-oe/2,De=ot+oe,Me=Vt+oe;ue=new Path2D,ue.rect(Ye,Re,De,Me)}y?Ii(te,oe,x.dash,x.cap,ae,E,O,J,R):Qo(g,te,oe,x.dash,x.cap,ae,E,O,J,ue,R),ke&&S.translate(-de,-de)}function Qo(g,y,x,E,O,R,J,te,ae,oe,ue){let de=!1;ae!=0&&ne.forEach((ke,Ye)=>{if(ke.series[0]==g){let Re=G[ke.series[1]],De=i[ke.series[1]],Me=(Re._paths||Ro).band;zl(Me)&&(Me=ke.dir==1?Me[0]:Me[1]);let xe,ut=null;Re.show&&Me&&_T(De,jt,bt)?(ut=ke.fill(r,Ye)||R,xe=Re._paths.clip):Me=null,Ii(y,x,E,O,ut,J,te,ae,oe,ue,xe,Me),de=!0}}),de||Ii(y,x,E,O,R,J,te,ae,oe,ue)}const zs=gr|xh;function Ii(g,y,x,E,O,R,J,te,ae,oe,ue,de){Rn(g,y,x,E,O),(ae||oe||de)&&(S.save(),ae&&S.clip(ae),oe&&S.clip(oe)),de?(te&zs)==zs?(S.clip(de),ue&&S.clip(ue),Zl(O,J),Ul(g,R,y)):te&xh?(Zl(O,J),S.clip(de),Ul(g,R,y)):te&gr&&(S.save(),S.clip(de),ue&&S.clip(ue),Zl(O,J),S.restore(),Ul(g,R,y)):(Zl(O,J),Ul(g,R,y)),(ae||oe||de)&&S.restore()}function Ul(g,y,x){x>0&&(y instanceof Map?y.forEach((E,O)=>{S.strokeStyle=Dl=O,S.stroke(E)}):y!=null&&g&&S.stroke(y))}function Zl(g,y){y instanceof Map?y.forEach((x,E)=>{S.fillStyle=Vn=E,S.fill(x)}):y!=null&&g&&S.fill(y)}function Ya(g,y,x,E){let O=W[g],R;if(E<=0)R=[0,0];else{let J=O._space=O.space(r,g,y,x,E),te=O._incrs=O.incrs(r,g,y,x,E,J);R=qA(y,x,te,E,J)}return O._found=R}function Mr(g,y,x,E,O,R,J,te,ae,oe){let ue=J%2/2;L==1&&S.translate(ue,ue),Rn(te,J,ae,oe,te),S.beginPath();let de,ke,Ye,Re,De=O+(E==0||E==3?-R:R);x==0?(ke=O,Re=De):(de=O,Ye=De);for(let Me=0;Me{if(!x.show)return;let O=B[x.scale];if(O.min==null){x._show&&(y=!1,x._show=!1,Qa(!1));return}else x._show||(y=!1,x._show=!0,Qa(!1));let R=x.side,J=R%2,{min:te,max:ae}=O,[oe,ue]=Ya(E,te,ae,J==0?Te:fe);if(ue==0)return;let de=O.distr==2,ke=x._splits=x.splits(r,E,te,ae,oe,ue,de),Ye=O.distr==2?ke.map(xe=>dn[xe]):ke,Re=O.distr==2?dn[ke[1]]-dn[ke[0]]:oe,De=x._values=x.values(r,x.filter(r,Ye,E,ue,Re),E,ue,Re);x._rotate=R==2?x.rotate(r,De,E,ue):0;let Me=x._size;x._size=Ni(x.size(r,De,E,g)),Me!=null&&x._size!=Me&&(y=!1)}),y}function Fo(g){let y=!0;return Go.forEach((x,E)=>{let O=x(r,E,Bn,g);O!=Di[E]&&(y=!1),Di[E]=O}),y}function jr(){for(let g=0;gdn[rn]):Ye,De=ue.distr==2?dn[Ye[1]]-dn[Ye[0]]:ae,Me=y.ticks,xe=y.border,ut=Me.show?Me.size:0,_t=Wt(ut*Pe),Rt=Wt((y.alignTo==2?y._size-ut-y.gap:y.gap)*Pe),et=y._rotate*-_c/180,lt=V(y._pos*Pe),hn=(_t+Rt)*te,Ht=lt+hn;R=E==0?Ht:0,O=E==1?Ht:0;let Tn=y.font[0],Yn=y.align==1?ir:y.align==2?eh:et>0?ir:et<0?eh:E==0?"center":x==3?eh:ir,ln=et||E==1?"middle":x==2?zo:dy;Nr(Tn,J,Yn,ln);let Gt=y.font[1]*y.lineGap,An=Ye.map(rn=>V(p(rn,ue,de,ke))),Qn=y._values;for(let rn=0;rn{x>0&&(y._paths=null,g&&(u==1?(y.min=null,y.max=null):y.facets.forEach(E=>{E.min=null,E.max=null})))})}let Es=!1,Ka=!1,Dn=[];function kr(){Ka=!1;for(let g=0;g0&&queueMicrotask(kr)}r.batch=Fa;function va(){if(cn&&(Yo(),cn=!1),qa&&(Rl(),qa=!1),gs){if(wt(T,ir,it),wt(T,zo,Mt),wt(T,No,Te),wt(T,Oo,fe),wt(j,ir,it),wt(j,zo,Mt),wt(j,No,Te),wt(j,Oo,fe),wt(z,No,ki),wt(z,Oo,ua),w.width=Wt(ki*Pe),w.height=Wt(ua*Pe),W.forEach(({_el:g,_show:y,_size:x,_pos:E,side:O})=>{if(g!=null)if(y){let R=O===3||O===0?x:0,J=O%2==1;wt(g,J?"left":"top",E-R),wt(g,J?"width":"height",x),wt(g,J?"top":"left",J?Mt:it),wt(g,J?"height":"width",J?fe:Te),vh(g,rs)}else fi(g,rs)}),Dl=Vn=Xi=bs=_s=Ar=Va=Ga=Tr=null,zt=1,Bl(!0),it!=Ri||Mt!=ca||Te!=ti||fe!=fa){Qa(!1);let g=Te/ti,y=fe/fa;if(we&&!da&&Y.left>=0){Y.left*=g,Y.top*=y,vi&&sa(vi,Wt(Y.left),0,Te,fe),En&&sa(En,0,Wt(Y.top),Te,fe);for(let x=0;x=0&&Xe.width>0){Xe.left*=g,Xe.width*=g,Xe.top*=y,Xe.height*=y;for(let x in $r)wt(Xa,x,Xe[x])}Ri=it,ca=Mt,ti=Te,fa=fe}Lt("setSize"),gs=!1}ki>0&&ua>0&&(S.clearRect(0,0,w.width,w.height),Lt("drawClear"),le.forEach(g=>g()),Lt("draw")),Xe.show&&ha&&(Ia(Xe),ha=!1),we&&da&&(ba(null,!0,!1),da=!1),$.show&&$.live&&fn&&(Ur(),fn=!1),m||(m=!0,r.status=1,Lt("ready")),gi=!1,Es=!1}r.redraw=(g,y)=>{qa=y||!1,g!==!1?Gn(ee,ie.min,ie.max):Pi()};function Ts(g,y){let x=B[g];if(x.from==null){if(At==0){let E=x.range(r,y.min,y.max,g);y.min=E[0],y.max=E[1]}if(y.min>y.max){let E=y.min;y.min=y.max,y.max=E}if(At>1&&y.min!=null&&y.max!=null&&y.max-y.min<1e-16)return;g==ee&&x.distr==2&&At>0&&(y.min=Vi(y.min,i[0]),y.max=Vi(y.max,i[0]),y.min==y.max&&y.max++),he[g]=y,cn=!0,Pi()}}r.setScale=Ts;let $l,As,vi,En,Ns,Ja,Un,Wi,Ll,Rr,We,at,Zi=!1;const Qe=Y.drag;let yt=Qe.x,Nt=Qe.y;we&&(Y.x&&($l=Ai(aT,j)),Y.y&&(As=Ai(lT,j)),ie.ori==0?(vi=$l,En=As):(vi=As,En=$l),We=Y.left,at=Y.top);const Xe=r.select=Jt({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),Xa=Xe.show?Ai(iT,Xe.over?j:T):null;function Ia(g,y){if(Xe.show){for(let x in g)Xe[x]=g[x],x in $r&&wt(Xa,x,g[x]);y!==!1&&Lt("setSelect")}}r.setSelect=Ia;function Cr(g){if(G[g].show)se&&vh(nt[g],rs);else if(se&&fi(nt[g],rs),we){let x=pa?wn[0]:wn[g];x!=null&&sa(x,-10,-10,Te,fe)}}function Gn(g,y,x){Ts(g,{min:y,max:x})}function Zn(g,y,x,E){y.focus!=null&&Wc(g),y.show!=null&&G.forEach((O,R)=>{R>0&&(g==R||g==null)&&(O.show=y.show,Cr(R),u==2?(Gn(O.facets[0].scale,null,null),Gn(O.facets[1].scale,null,null)):Gn(O.scale,null,null),Pi())}),x!==!1&&Lt("setSeries",g,y),E&&el("setSeries",r,g,y)}r.setSeries=Zn;function Jo(g,y){Jt(ne[g],y)}function Xc(g,y){g.fill=Be(g.fill||null),g.dir=Je(g.dir,-1),y=y??ne.length,ne.splice(y,0,g)}function Ic(g){g==null?ne.length=0:ne.splice(g,1)}r.addBand=Xc)DELIM" -R"DELIM(,r.setBand=Jo,r.delBand=Ic;function Pc(g,y){G[g].alpha=y,we&&wn[g]!=null&&(wn[g].style.opacity=y),se&&nt[g]&&(nt[g].style.opacity=y)}let ai,ea,ya;const Pa={focus:!0};function Wc(g){if(g!=ya){let y=g==null,x=ii.alpha!=1;G.forEach((E,O)=>{if(u==1||O>0){let R=y||O==0||O==g;E._focus=y?null:R,x&&Pc(O,R?1:ii.alpha)}}),ya=g,x&&Pi()}}se&&ma&&Xt(gy,ye,g=>{Y._lock||(ni(g),ya!=null&&Zn(null,Pa,!0,kt.setSeries))});function yi(g,y,x){let E=B[y];x&&(g=g/Pe-(E.ori==1?Mt:it));let O=Te;E.ori==1&&(O=fe,g=O-g),E.dir==-1&&(g=O-g);let R=E._min,J=E._max,te=g/O,ae=R+(J-R)*te,oe=E.distr;return oe==3?hr(10,ae):oe==4?xT(ae,E.asinh):oe==100?E.bwd(ae):ae}function Xo(g,y){let x=yi(g,ee,y);return Vi(x,i[0],jt,bt)}r.valToIdx=g=>Vi(g,i[0]),r.posToIdx=Xo,r.posToVal=yi,r.valToPos=(g,y,x)=>B[y].ori==0?d(g,B[y],x?ot:Te,x?kn:0):f(g,B[y],x?Vt:fe,x?nn:0),r.setCursor=(g,y,x)=>{We=g.left,at=g.top,ba(null,y,x)};function Io(g,y){wt(Xa,ir,Xe.left=g),wt(Xa,No,Xe.width=y)}function Po(g,y){wt(Xa,zo,Xe.top=g),wt(Xa,Oo,Xe.height=y)}let Hl=ie.ori==0?Io:Po,ql=ie.ori==1?Io:Po;function Dr(){if(se&&$.live)for(let g=u==2?1:0;g{N[E]=x}):TT(g.idx)||N.fill(g.idx),$.idx=N[0]),se&&$.live){for(let x=0;x0||u==1&&!jn)&&ef(x,N[x]);Dr()}fn=!1,y!==!1&&Lt("setLegend")}r.setLegend=Ur;function ef(g,y){let x=G[g],E=g==0&&_e==2?dn:i[g],O;jn?O=x.values(r,g,y)??xn:(O=x.value(r,y==null?null:E[y],g,y),O=O==null?xn:{_:O}),$.values[g]=O}function ba(g,y,x){Ll=We,Rr=at,[We,at]=Y.move(r,We,at),Y.left=We,Y.top=at,we&&(vi&&sa(vi,Wt(We),0,Te,fe),En&&sa(En,0,Wt(at),Te,fe));let E,O=jt>bt;ai=gt,ea=null;let R=ie.ori==0?Te:fe,J=ie.ori==1?Te:fe;if(We<0||At==0||O){E=Y.idx=null;for(let te=0;te0&&ut.show){let hn=et==null?-10:et==E?oe:ce(u==1?i[0][et]:i[xe][0][et],ie,R,0),Ht=lt==null?-10:Ee(lt,u==1?B[ut.scale]:B[ut.facets[1].scale],J,0);if(ma&<!=null){let Tn=ie.ori==1?We:at,Yn=en(ii.dist(r,xe,et,Ht,Tn));if(Yn=0?1:-1,Qn=Gt>=0?1:-1;Qn==An&&(Qn==1?ln==1?lt>=Gt:lt<=Gt:ln==1?lt<=Gt:lt>=Gt)&&(ai=Yn,ea=xe)}else ai=Yn,ea=xe}}if(fn||pa){let Tn,Yn;ie.ori==0?(Tn=hn,Yn=Ht):(Tn=Ht,Yn=hn);let ln,Gt,An,Qn,sn,rn,Nn=!0,ta=an.bbox;if(ta!=null){Nn=!1;let mn=ta(r,xe);An=mn.left,Qn=mn.top,ln=mn.width,Gt=mn.height}else An=Tn,Qn=Yn,ln=Gt=an.size(r,xe);if(rn=an.fill(r,xe),sn=an.stroke(r,xe),pa)xe==ea&&ai<=ii.prox&&(ue=An,de=Qn,ke=ln,Ye=Gt,Re=Nn,De=rn,Me=sn);else{let mn=wn[xe];mn!=null&&(Ji[xe]=An,ga[xe]=Qn,wy(mn,ln,Gt,Nn),Sy(mn,rn,sn),sa(mn,Ni(An),Ni(Qn),Te,fe))}}}}if(pa){let xe=ii.prox,ut=ya==null?ai<=xe:ai>xe||ea!=ya;if(fn||ut){let _t=wn[0];_t!=null&&(Ji[0]=ue,ga[0]=de,wy(_t,ke,Ye,Re),Sy(_t,De,Me),sa(_t,Ni(ue),Ni(de),Te,fe))}}}if(Xe.show&&Zi)if(g!=null){let[te,ae]=kt.scales,[oe,ue]=kt.match,[de,ke]=g.cursor.sync.scales,Ye=g.cursor.drag;if(yt=Ye._x,Nt=Ye._y,yt||Nt){let{left:Re,top:De,width:Me,height:xe}=g.select,ut=g.scales[de].ori,_t=g.posToVal,Rt,et,lt,hn,Ht,Tn=te!=null&&oe(te,de),Yn=ae!=null&&ue(ae,ke);Tn&&yt?(ut==0?(Rt=Re,et=Me):(Rt=De,et=xe),lt=B[te],hn=ce(_t(Rt,de),lt,R,0),Ht=ce(_t(Rt+et,de),lt,R,0),Hl(Gi(hn,Ht),en(Ht-hn))):Hl(0,R),Yn&&Nt?(ut==1?(Rt=Re,et=Me):(Rt=De,et=xe),lt=B[ae],hn=Ee(_t(Rt,ke),lt,J,0),Ht=Ee(_t(Rt+et,ke),lt,J,0),ql(Gi(hn,Ht),en(Ht-hn))):ql(0,J)}else Lr()}else{let te=en(Ll-Ns),ae=en(Rr-Ja);if(ie.ori==1){let ke=te;te=ae,ae=ke}yt=Qe.x&&te>=Qe.dist,Nt=Qe.y&&ae>=Qe.dist;let oe=Qe.uni;oe!=null?yt&&Nt&&(yt=te>=oe,Nt=ae>=oe,!yt&&!Nt&&(ae>te?Nt=!0:yt=!0)):Qe.x&&Qe.y&&(yt||Nt)&&(yt=Nt=!0);let ue,de;yt&&(ie.ori==0?(ue=Un,de=We):(ue=Wi,de=at),Hl(Gi(ue,de),en(de-ue)),Nt||ql(0,J)),Nt&&(ie.ori==1?(ue=Un,de=We):(ue=Wi,de=at),ql(Gi(ue,de),en(de-ue)),yt||Hl(0,R)),!yt&&!Nt&&(Hl(0,0),ql(0,0))}if(Qe._x=yt,Qe._y=Nt,g==null){if(x){if(au!=null){let[te,ae]=kt.scales;kt.values[0]=te!=null?yi(ie.ori==0?We:at,te):null,kt.values[1]=ae!=null?yi(ie.ori==1?We:at,ae):null}el(th,r,We,at,Te,fe,E)}if(ma){let te=x&&kt.setSeries,ae=ii.prox;ya==null?ai<=ae&&Zn(ea,Pa,!0,te):ai>ae?Zn(null,Pa,!0,te):ea!=ya&&Zn(ea,Pa,!0,te)}}fn&&($.idx=E,Ur()),y!==!1&&Lt("setCursor")}let $i=null;Object.defineProperty(r,"rect",{get(){return $i==null&&Bl(!1),$i}});function Bl(g=!1){g?$i=null:($i=j.getBoundingClientRect(),Lt("syncRect",$i))}function Wo(g,y,x,E,O,R,J){Y._lock||Zi&&g!=null&&g.movementX==0&&g.movementY==0||(Zr(g,y,x,E,O,R,J,!1,g!=null),g!=null?ba(null,!0,!0):ba(y,!0,!1))}function Zr(g,y,x,E,O,R,J,te,ae){if($i==null&&Bl(!1),ni(g),g!=null)x=g.clientX-$i.left,E=g.clientY-$i.top;else{if(x<0||E<0){We=-10,at=-10;return}let[oe,ue]=kt.scales,de=y.cursor.sync,[ke,Ye]=de.values,[Re,De]=de.scales,[Me,xe]=kt.match,ut=y.axes[0].side%2==1,_t=ie.ori==0?Te:fe,Rt=ie.ori==1?Te:fe,et=ut?R:O,lt=ut?O:R,hn=ut?E:x,Ht=ut?x:E;if(Re!=null?x=Me(oe,Re)?p(ke,B[oe],_t,0):-10:x=_t*(hn/et),De!=null?E=xe(ue,De)?p(Ye,B[ue],Rt,0):-10:E=Rt*(Ht/lt),ie.ori==1){let Tn=x;x=E,E=Tn}}ae&&(y==null||y.cursor.event.type==th)&&((x<=1||x>=Te-1)&&(x=ls(x,Te)),(E<=1||E>=fe-1)&&(E=ls(E,fe))),te?(Ns=x,Ja=E,[Un,Wi]=Y.move(r,x,E)):(We=x,at=E)}const $r={width:0,height:0,left:0,top:0};function Lr(){Ia($r,!1)}let eu,tu,nu,iu;function Os(g,y,x,E,O,R,J){Zi=!0,yt=Nt=Qe._x=Qe._y=!1,Zr(g,y,x,E,O,R,J,!0,!1),g!=null&&(Xt(nh,ph,Wa,!1),el(my,r,Un,Wi,Te,fe,null));let{left:te,top:ae,width:oe,height:ue}=Xe;eu=te,tu=ae,nu=oe,iu=ue}function Wa(g,y,x,E,O,R,J){Zi=Qe._x=Qe._y=!1,Zr(g,y,x,E,O,R,J,!1,!0);let{left:te,top:ae,width:oe,height:ue}=Xe,de=oe>0||ue>0,ke=eu!=te||tu!=ae||nu!=oe||iu!=ue;if(de&&ke&&Ia(Xe),Qe.setScale&&de&&ke){let Ye=te,Re=oe,De=ae,Me=ue;if(ie.ori==1&&(Ye=ae,Re=ue,De=te,Me=oe),yt&&Gn(ee,yi(Ye,ee),yi(Ye+Re,ee)),Nt)for(let xe in B){let ut=B[xe];xe!=ee&&ut.from==null&&ut.min!=gt&&Gn(xe,yi(De+Me,xe),yi(De,xe))}Lr()}else Y.lock&&(Y._lock=!Y._lock,ba(y,!0,g!=null));g!=null&&(Ki(nh,ph),el(nh,r,We,at,Te,fe,null))}function tf(g,y,x,E,O,R,J){if(Y._lock)return;ni(g);let te=Zi;if(Zi){let ae=!0,oe=!0,ue=10,de,ke;ie.ori==0?(de=yt,ke=Nt):(de=Nt,ke=yt),de&&ke&&(ae=We<=ue||We>=Te-ue,oe=at<=ue||at>=fe-ue),de&&ae&&(We=We{let O=kt.match[2];x=O(r,y,x),x!=-1&&Zn(x,E,!0,!1)},we&&(Xt(my,j,Os),Xt(th,j,Wo),Xt(py,j,g=>{ni(g),Bl(!1)}),Xt(gy,j,tf),Xt(vy,j,Hr),wh.add(r),r.syncRect=Bl);const Vl=r.hooks=n.hooks||{};function Lt(g,y,x){Ka?Dn.push([g,y,x]):g in Vl&&Vl[g].forEach(E=>{E.call(null,r,y,x)})}(n.plugins||[]).forEach(g=>{for(let y in g.hooks)Vl[y]=(Vl[y]||[]).concat(g.hooks[y])});const Sa=(g,y,x)=>x,kt=Jt({key:null,setSeries:!1,filters:{pub:Ny,sub:Ny},scales:[ee,G[1]?G[1].scale:null],match:[Oy,Oy,Sa],values:[null,null]},Y.sync);kt.match.length==2&&kt.match.push(Sa),Y.sync=kt;const au=kt.key,Br=Cb(au);function el(g,y,x,E,O,R,J){kt.filters.pub(g,y,x,E,O,R,J)&&Br.pub(g,y,x,E,O,R,J)}Br.sub(r);function lu(g,y,x,E,O,R,J){kt.filters.sub(g,y,x,E,O,R,J)&&_a[g](null,y,x,E,O,R,J)}r.pub=lu;function Gl(){Br.unsub(r),wh.delete(r),ji.clear(),yh(jc,fr,qr),v.remove(),ye?.remove(),Lt("destroy")}r.destroy=Gl;function xa(){Lt("init",n,i),$t(i||n.data,!1),he[ee]?Ts(ee,he[ee]):ys(),ha=Xe.show&&(Xe.width>0||Xe.height>0),da=fn=!0,Ba(n.width,n.height)}return G.forEach(Ci),W.forEach(Er),l?l instanceof HTMLEleme)DELIM" -R"DELIM(nt?(l.appendChild(v),xa()):l(r,xa):xa(),r}un.assign=Jt;un.fmtNum=sm;un.rangeNum=kc;un.rangeLog=qc;un.rangeAsinh=am;un.orient=ps;un.pxRatio=Pe;un.join=RT;un.fmtDate=om,un.tzDate=GT;un.sync=Cb;{un.addGap=TA,un.clipGaps=Gc;let n=un.paths={points:Hb};n.linear=Bb,n.stepped=OA,n.bars=MA,n.spline=kA}const VA=(n,i,l,r,u)=>{if(!Number.isFinite(l)||!Number.isFinite(r)||r<=l)return[];const d=[];if(Math.asinh(r)-Math.asinh(l)<1.5){const m=Number.isFinite(u)&&u>0?u:(r-l)/4,v=Math.ceil(l/m)*m;for(let w=0;w<100;w++){const S=Number((v+w*m).toPrecision(14));if(S>r)break;d.push({value:S,priority:S===0?0:1})}}else{const m=Math.ceil(Math.log10(Math.max(Math.abs(l),Math.abs(r))));for(let v=Math.min(-1,m-1);v<=m;v++)for(const w of[1,2,5]){const S=w*10**v;for(const z of[-S,S])Number.isFinite(z)&&z>=l&&z<=r&&d.push({value:z,priority:w===1?1:2})}l<=0&&r>=0&&d.push({value:0,priority:0})}d.sort((m,v)=>m.priority-v.priority||m.value-v.value);const f=[],p=[];for(const{value:m}of d){const v=n.valToPos(m,"y");Number.isFinite(v)&&p.every(w=>Math.abs(v-w)>=36)&&(f.push(m),p.push(v))}return f.sort((m,v)=>m-v),f};function GA({data:n,series:i,height:l=280,emptyMessage:r="Waiting for live data…",valueSuffix:u="",zeroBased:d=!0,valueFormatter:f=FA,visualization:p="line",scale:m="linear",forceEmpty:v=!1}){const w=re.useRef(null),S=re.useRef(null),z=re.useRef(!1),T=re.useRef(null),j=re.useMemo(()=>KA(n),[n]),L=re.useRef(j),V=!v&&n[0]?.length>0;return re.useLayoutEffect(()=>{L.current=j},[j]),re.useLayoutEffect(()=>{const H=w.current;if(!H)return;const G={width:Math.max(240,H.clientWidth),height:l,padding:[12,8,0,0],cursor:{drag:{x:!0,y:!1,setScale:!0},focus:{prox:24}},hooks:{setSelect:[ee=>{ee.select.width>0&&(z.current=!0)}]},legend:{show:!0,live:!0},scales:{x:{time:!0},y:{auto:!0,distr:m==="compressed"?4:1,asinh:1,...d?{range:(ee,K,le)=>[Math.min(0,K),le===0?1:le*1.08]}:{range:(ee,K,le)=>{const ze=le-K,ve=ze===0?Math.max(1,Math.abs(le)*5e-4):ze*.08;return[K-ve,le+ve]}}}},axes:[{stroke:"#9f9f98",grid:{stroke:"#ffffff12",width:1},ticks:{stroke:"#ffffff20",width:1},font:"11px system-ui"},{size:72,stroke:"#9f9f98",grid:{stroke:"#ffffff12",width:1},ticks:{stroke:"#ffffff20",width:1},font:"11px system-ui",values:(ee,K)=>K.map(le=>le===null?null:`${f(le)}${u}`),...m==="compressed"?{splits:VA,filter:(ee,K)=>K}:{}}],series:[{},...i.map((ee,K)=>{const le=p==="step"?un.paths.stepped?.({align:1}):p==="bar"?YA(K,i.length):void 0;return{label:ee.label,stroke:ee.color,fill:p==="area"||p==="bar"?ee.fill??`${ee.color}24`:ee.fill,width:ee.width??2,paths:le,points:{show:p==="line"?ee.points??!1:!1},value:(ze,ve)=>ve===null?"—":`${f(ve)}${u}`}})]},W=new un(G,L.current,H),B=T.current;B&&W.setScale("x",B),S.current=W;const ne=new ResizeObserver(ee=>{const K=ee[0]?.contentRect.width;K&&K>0&&W.setSize({width:Math.round(K),height:l})});return ne.observe(H),()=>{T.current=z.current&&W.scales.x.min!=null&&W.scales.x.max!=null?{min:W.scales.x.min,max:W.scales.x.max}:null,ne.disconnect(),W.destroy(),S.current=null}},[l,i,f,u,p,d,m]),re.useEffect(()=>{const H=S.current;if(!H)return;const G=!z.current;H.setData(j,G),G||H.redraw()},[j]),_.jsxs("div",{className:"relative min-w-0",children:[_.jsx("div",{ref:w,className:"min-w-0 overflow-hidden"}),!V&&_.jsx("div",{className:"bg-surface text-textMuted pointer-events-none absolute inset-0 z-10 flex items-center justify-center text-sm",children:r})]})}function YA(n,i){const l=Math.max(1,i);return un.paths.bars?.({size:[1,48/l,0],disp:{x0:{unit:1,values:r=>{const u=Iy(r,l),d=-u.groupWidth/2+u.barWidth*n;return Array.from(r.data[0],f=>f+d)}},size:{unit:1,values:r=>[Iy(r,l).barWidth]}}})}function Iy(n,i){const l=QA(n.data[0]),r=Math.abs(n.posToVal(48,"x")-n.posToVal(0,"x")),u=Math.min(l*.72,r);return{groupWidth:u,barWidth:u/i}}function QA(n){let i=Number.POSITIVE_INFINITY,l;for(const r of n)if(Number.isFinite(r)){if(l!==void 0){const u=Math.abs(r-l);u>0&&u=2)return n;const l=Date.now()/1e3,r=i[0]??l,u=[r-1,r],d=n.slice(1).map(f=>{const p=f[0]??null;return[p,p]});return[u,...d]}function FA(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 JA={300:"5m",900:"15m",3600:"1h"},XA=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),IA=new Intl.NumberFormat(void 0,{maximumFractionDigits:2});function PA(n){return XA.format(n)}function WA(n){return IA.format(n)}function eN(n){return n==="height"||n==="occurrences"?PA:WA}function tN({metrics:n}){const[i,l]=re.useState(RE),[r,u]=re.useState(null),[d,f]=re.useState(!1);re.useEffect(()=>{CE(i)},[i]);function p(w){l(S=>r?.mode==="add"?S.length>=lr?S:[...S,w]:S.map(z=>z.id===w.id?w:z)),u(null)}function m(w,S){l(z=>{const T=w+S;if(T<0||T>=z.length)return z;const j=[...z],L=j[w],V=j[T];return j[w]=V,j[T]=L,j})}function v(){if(!d){f(!0);return}l(bc()),f(!1)}return _.jsxs("section",{className:"space-y-4",children:[_.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Live telemetry"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Custom charts"}),_.jsxs("p",{className:"text-textMuted mt-1 text-sm",children:["Session data only · ",String(i.length)," of ",String(lr)," charts"]})]}),_.jsxs("div",{className:"flex flex-wrap gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{f(!1),u({mode:"add",chart:tb()})},disabled:i.length>=lr,className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold disabled:cursor-not-allowed disabled:opacity-40",children:"Add chart"}),_.jsx("button",{type:"button",onClick:v,onBlur:()=>{f(!1)},className:`rounded-lg border px-4 py-2 text-sm ${d?"border-amber-400/60 text-amber-200":"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary"}`,children:d?"Confirm reset":"Reset defaults"})]})]}),i.length===0?_.jsxs("div",{className:"border-accent/20 bg-surface/60 rounded-xl border border-dashed px-6 py-16 text-center",children:[_.jsx("p",{className:"text-textPrimary font-medium",children:"No charts in this dashboard."}),_.jsx("p",{className:"text-textMuted mt-2 text-sm",children:"Add a custom chart or start from a template."})]}):_.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:i.map((w,S)=>_.jsx(nN,{chart:w,metrics:n,canMoveEarlier:S>0,canMoveLater:S{l(z=>z.map(T=>T.id===w.id?{...T,scale:T.scale==="compressed"?"linear":"compressed"}:T))},onDelete:()=>{l(z=>z.filter(T=>T.id!==w.id))},onDuplicate:()=>{l(z=>z.length>=lr?z:[...z,kE(w)])},onEdit:()=>{u({mode:"edit",chart:w})},onMoveEarlier:()=>{m(S,-1)},onMoveLater:()=>{m(S,1)}},w.id))}),r&&_.jsx(KE,{chart:r.chart,mode:r.mode,onCancel:()=>{u(null)},onSave:p},`${r.mode}-${r.chart.id}`)]})}function nN({chart:n,metrics:i,canMoveEarlier:l,canMoveLater:r,canDuplicate:u,onDelete:d,onDuplicate:f,onEdit:p,onMoveEarlier:m,onMoveLater:v,onToggleScale:w}){const[S,z]=re.useState(null),[T,j]=re.useState(0),L=S??i,V=re.useMemo(()=>LE(L,n),[n,L]),H=re.useMemo(()=>n.series.map(B=>({label:B.label??$a(B.signalId).label,color:B.color})),[n.series]),G=eN(V.unit),W=`Waiting for ${n.series.length===1?H[0]?.label?.toLowerCase():"the selected signals"}…`;return _.jsxs("article",{className:"border-accent/20 bg-surface/70 min-w-0 overflow-hidden rounded-xl border",children:[_.jsx("header",{className:"border-accent/15 space-y-3 border-b px-4 py-4 sm:px-5",children:_.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[_.jsxs("div",{className:"min-w-0",children:[_.jsx("h3",{className:"truncate font-semibold",title:n.title,children:n.title}),_.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:[lb(V.unit)," · ",JA[n.range]," · ",n.visualization,n.scale)DELIM" -R"DELIM(==="compressed"?" · compressed scale":"",S?" · paused":""]})]}),_.jsxs("div",{className:"flex flex-wrap justify-end gap-1 text-xs",children:[_.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:w,className:`rounded border px-2 py-1.5 ${n.scale==="compressed"?"border-accent/40 bg-accent/10 text-accent":"text-textMuted hover:text-textPrimary border-white/10 hover:bg-white/5"}`,children:"Compress peaks"}),_.jsx(as,{label:S?"Resume chart":"Pause chart",onClick:()=>{z(B=>B?null:i)},children:S?"Resume":"Pause"}),_.jsx(as,{label:"Reset chart zoom",onClick:()=>{j(B=>B+1)},children:"Reset zoom"}),_.jsx(as,{label:"Edit chart",onClick:p,children:"Edit"}),_.jsx(as,{label:"Duplicate chart",onClick:f,disabled:!u,children:"Duplicate"}),_.jsx(as,{label:`Move ${n.title} earlier`,onClick:m,disabled:!l,children:"←"}),_.jsx(as,{label:`Move ${n.title} later`,onClick:v,disabled:!r,children:"→"}),_.jsx(as,{label:"Delete chart",onClick:d,danger:!0,children:"Delete"})]})]})}),_.jsx("div",{className:"min-w-0 p-3 sm:p-5",children:_.jsx(GA,{data:V.data,series:H,visualization:n.visualization,scale:n.scale,zeroBased:qE(V.unit),valueFormatter:G,valueSuffix:HE(V.unit),forceEmpty:!V.hasObservedData,emptyMessage:W},T)}),n.scale==="compressed"&&_.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."}),V.unobservedLabels.length>0&&V.hasObservedData&&_.jsxs("footer",{className:"border-accent/10 text-textMuted border-t px-5 py-2 text-[11px]",children:["Not observed this session: ",V.unobservedLabels.join(", ")]})]})}function as({label:n,children:i,onClick:l,disabled:r=!1,danger:u=!1}){return _.jsx("button",{type:"button","aria-label":n,onClick:l,disabled:r,className:`rounded 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-textPrimary hover:bg-white/5"}`,children:i})}const iN=[{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 aN({adminStatus:n,endpoints:i,metrics:l,native:r,syncEstimate:u}){const d=yE(l,10),f=r.configuration,p=Oi(6),m=[n.error?`Admin: ${n.error}`:null,r.status.error?`Native: ${r.status.error}`:null,r.transport==="none"&&r.restError?`Native REST: ${r.restError}`:null,l.invalidFrames>0?`${String(l.invalidFrames)} malformed admin frame${l.invalidFrames===1?"":"s"} ignored`:null,r.live.invalidFrames>0?`${String(r.live.invalidFrames)} malformed native frame${r.live.invalidFrames===1?"":"s"} ignored`:null,r.status.phase==="connected"&&r.transport==="none"?"Native: Connected, but no fresh valid state has been received":null].filter(v=>v!==null);return _.jsxs("div",{className:"space-y-8",children:[m.length>0&&_.jsxs("section",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3",children:[_.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Transport notice"}),_.jsx("ul",{className:"text-textMuted mt-1 space-y-1 text-xs",children:m.map(v=>_.jsx("li",{children:v},v))})]}),_.jsx(wE,{confirmed:r.top,estimate:u}),_.jsxs("dl",{"aria-label":"Node summary",className:"grid grid-cols-2 border-y border-white/10 lg:grid-cols-[1fr_1.15fr_1fr_1fr]",children:[_.jsx(hc,{label:"Canonical top",value:r.top===null?"—":Hn(r.top),detail:r.transport==="none"?"Waiting for native API":`${sN(u)} · via ${r.transport==="websocket"?"native WebSocket":"REST fallback"}`,emphasized:!0}),_.jsx(hc,{label:"Current activity",value:d.label,detail:d.rate>0?`${Q2(d.rate)} over the last 10 seconds`:"No lifecycle events in the last 10 seconds",numeric:!1}),_.jsx(hc,{label:"Highest confirmed",value:l.signalMaximums[p]===void 0?"—":Hn(l.signalMaximums[p]),detail:`${Hn(l.signalTotals[p]??0)} confirmations observed`}),_.jsx(hc,{label:"Collection uptime",value:Y2(l.now-l.sessionStartedAt),detail:`${Hn(l.totalEvents)} events · ${Hn(l.totalLogs)} logs`})]}),_.jsxs("section",{className:"grid gap-4 lg:grid-cols-2",children:[_.jsx(Py,{title:"Admin stream",endpoint:i.adminUrl,status:n,detail:n.lastMessageAt?`Last frame ${jo(n.lastMessageAt)}`:"Waiting for the first frame"}),_.jsx(Py,{title:"Native interface",endpoint:i.nativeUrl,status:r.status,detail:r.receivedAt?`Last state ${jo(r.receivedAt)} · ${r.transport}`:"Waiting for node state"})]}),_.jsx(tN,{metrics:l}),_.jsxs("section",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsxs("header",{className:"border-accent/15 border-b px-5 py-4",children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Lifecycle heights"}),_.jsx("h2",{className:"mt-1 font-semibold",children:"Highest observed event values"})]}),_.jsx("div",{className:"grid gap-px bg-white/5 sm:grid-cols-2 lg:grid-cols-3",children:iN.map(({event:v,label:w})=>{const S=l.signalMaximums[Oi(v)];return _.jsxs("div",{className:"bg-surface px-5 py-4",children:[_.jsx("p",{className:"text-textMuted text-xs",children:w}),_.jsx("p",{className:"text-textPrimary mt-2 font-mono text-lg tabular-nums",children:S===void 0?"—":Hn(S)})]},v)})})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsxs("header",{className:"border-accent/15 border-b px-5 py-4",children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Capabilities"}),_.jsx("h2",{className:"mt-1 font-semibold",children:"Native configuration"})]}),f?_.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-4 p-5 text-sm",children:[_.jsx(ar,{label:"Address index",enabled:f.address}),_.jsx(ar,{label:"Client filters",enabled:f.filter}),_.jsx(ar,{label:"Turbo",enabled:f.turbo}),_.jsx(ar,{label:"Witness",enabled:f.witness}),_.jsx(ar,{label:"Retarget",enabled:f.retarget}),_.jsx(ar,{label:"Difficulty",enabled:f.difficult}),_.jsxs("div",{className:"col-span-2 border-t border-white/5 pt-3",children:[_.jsx("span",{className:"text-textMuted",children:"Pruned below"}),_.jsx("span",{className:"text-textPrimary float-right font-mono",children:f.pruned>0?Hn(f.pruned):"Not pruned"})]})]}):_.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:"Waiting for native configuration."})]})]}),_.jsx("section",{children:_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsx("header",{className:"border-accent/15 border-b px-5 py-4",children:_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Recent events"})}),l.recentEvents.length===0?_.jsx(lN,{text:"No events observed yet."}):_.jsx("ul",{className:"divide-y divide-white/5",children:l.recentEvents.slice(0,6).map(v=>_.jsxs("li",{className:"flex items-center gap-3 px-5 py-3 text-xs",children:[_.jsx("time",{className:"text-textMuted w-24 shrink-0 font-mono",children:jo(v.time)}),_.jsx("span",{className:"text-textPrimary min-w-0 flex-1 truncate font-mono",children:qo(v.event).name}),_.jsx("span",{className:"text-accent tabular-nums",children:J0(v.event,v.value)})]},v.id))})]})})]})}function Py({title:n,endpoint:i,status:l,detail:r}){return _.jsxs("article",{className:"border-accent/20 bg-surface/70 min-w-0 rounded-xl border p-5",children:[_.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-textMuted text-xs tracking-wide uppercase",children:n}),_.jsx("p",{className:"text-textPrimary mt-2 font-mono text-sm break-all",children:K2(i)})]}),_.jsx(xE,{phase:l.phase,label:l.phase})]}),_.jsxs("div",{className:"text-textMuted mt-4 flex flex-wrap justify-between gap-2 border-t borde)DELIM" -R"DELIM(r-white/5 pt-3 text-xs",children:[_.jsx("span",{children:r}),_.jsxs("span",{children:[String(l.reconnects)," reconnect",l.reconnects===1?"":"s"]})]})]})}function ar({label:n,enabled:i}){return _.jsxs("div",{className:"flex items-center justify-between gap-3",children:[_.jsx("span",{className:"text-textMuted",children:n}),_.jsx("span",{className:i?"text-emerald-300":"text-textMuted",children:i?"Enabled":"Disabled"})]})}function lN({text:n}){return _.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:n})}function sN(n){return n?n.blocksRemaining<=Lc?"Near current (estimated)":`${Hn(n.blocksRemaining)} blocks remaining (estimated)`:"Waiting for confirmed block timestamp"}const rN=8e3;function oN({estimate:n,browserNotificationsEnabled:i}){const l=re.useRef(null),[r,u]=re.useState(null),d=n?.blocksRemaining??null;if(re.useEffect(()=>{const p=cN(d);if(!p)return;const m=l.current;if(l.current=p.state,!(m===null||m===p.state)&&(u(p),i)){const v=uN(p);G_(v.title,{body:v.body,tag:"libbitcoin-sync-status"})}},[i,d]),re.useEffect(()=>{if(!r)return;const p=setTimeout(()=>{u(m=>m===r?null:m)},rN);return()=>{clearTimeout(p)}},[r]),!r)return null;const f=r.state==="near-current";return _.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 ${f?"border-emerald-400/35 bg-emerald-950/95":"border-amber-400/35 bg-amber-950/95"}`,children:_.jsxs("div",{className:"flex items-start gap-4",children:[_.jsxs("div",{className:"min-w-0 flex-1",children:[_.jsx("p",{className:f?"font-semibold text-emerald-200":"font-semibold text-amber-200",children:f?"Node near current (estimated)":"Node fell behind (estimated)"}),_.jsx("p",{className:"mt-1 text-sm text-white/75",children:Eh(r)})]}),_.jsx("button",{type:"button","aria-label":"Dismiss synchronization notification",onClick:()=>{u(null)},className:"text-lg leading-none text-white/60 hover:text-white",children:"×"})]})})}function uN(n){return n.state==="near-current"?{title:"Libbitcoin node near current (estimated)",body:Eh(n)}:{title:"Libbitcoin node fell behind (estimated)",body:Eh(n)}}function cN(n){return n===null?null:{state:n<=Lc?"near-current":"behind",blocksBehind:n}}function Eh(n){return n.state==="near-current"?`Confirmed top is estimated to be within ${String(Lc)} blocks of the chain tip, based on block time.`:`Confirmed top is estimated to be ${Hn(n.blocksBehind)} blocks behind the chain tip, based on block time.`}const Qb='(function(){"use strict";var $e;function c(e,t,n){function r(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,u);const l=s.prototype,h=Object.keys(l);for(let m=0;mn?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class j extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Se extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}($e=globalThis).__zod_globalConfig??($e.__zod_globalConfig={});const se=globalThis.__zod_globalConfig;function A(e){return se}function Ze(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 oe(e,t){return typeof t=="bigint"?t.toString():t}function ae(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ce(e){return e==null}function ue(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Lt(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r){};function V(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ft=ae(()=>{if(se.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function F(e){if(V(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(V(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Te(e){return F(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const xt=new Set(["string","number","symbol"]);function W(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function N(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function f(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 Dt(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ut={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Jt(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 o=T(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return P(this,"shape",s),s},checks:[]});return N(e,o)}function Kt(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 o=T(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return P(this,"shape",s),s},checks:[]});return N(e,o)}function Vt(e,t){if(!F(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=T(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return P(this,"shape",o),o}});return N(e,i)}function Wt(e,t){if(!F(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=T(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return P(this,"shape",r),r}});return N(e,n)}function Bt(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=T(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return P(this,"shape",r),r},get catchall(){return t._zod.def.catchall},ch)DELIM" -R"DELIM(ecks:t._zod.def.checks??[]});return N(e,n)}function Gt(e,t,n){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=T(t._zod.def,{get shape(){const a=t._zod.def.shape,u={...a};if(n)for(const l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(u[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(const l in a)u[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return P(this,"shape",u),u},checks:[]});return N(t,s)}function qt(e,t,n){const r=T(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:i[s]}))}else for(const s in i)o[s]=new e({type:"nonoptional",innerType:i[s]});return P(this,"shape",o),o}});return N(t,r)}function R(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 B(e){return typeof e=="string"?e:e?.message}function M(e,t,n){const r=e.message?e.message:B(e.inst?._zod.def?.error?.(e))??B(t?.error?.(e))??B(n.customError?.(e))??B(n.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=s),a}function le(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function x(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Ae=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,oe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Pe=c("$ZodError",Ae),Me=c("$ZodError",Ae,{Parent:Error});function Yt(e,t=n=>n.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Xt(e,t=n=>n.message){const n={_errors:[]},r=(i,o=[])=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...o,...s.path]);else{const a=[...o,...s.path];if(a.length===0)n._errors.push(t(s));else{let u=n,l=0;for(;l(t,n,r,i)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new j;if(s.issues.length){const a=new(i?.Err??e)(s.issues.map(u=>M(u,o,A())));throw Oe(a,i?.callee),a}return s.value},fe=e=>async(t,n,r,i)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(i?.Err??e)(s.issues.map(u=>M(u,o,A())));throw Oe(a,i?.callee),a}return s.value},G=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new j;return o.issues.length?{success:!1,error:new(e??Pe)(o.issues.map(s=>M(s,i,A())))}:{success:!0,data:o.value}},Qt=G(Me),q=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>M(s,i,A())))}:{success:!0,data:o.value}},en=q(Me),tn=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return he(e)(t,n,i)},nn=e=>(t,n,r)=>he(e)(t,n,r),rn=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return fe(e)(t,n,i)},sn=e=>async(t,n,r)=>fe(e)(t,n,r),on=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return G(e)(t,n,i)},an=e=>(t,n,r)=>G(e)(t,n,r),cn=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return q(e)(t,n,i)},un=e=>async(t,n,r)=>q(e)(t,n,r),ln=/^[cC][0-9a-z]{6,}$/,hn=/^[0-9a-z]+$/,fn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,dn=/^[0-9a-vA-V]{20}$/,pn=/^[A-Za-z0-9]{27}$/,mn=/^[a-zA-Z0-9_-]{21}$/,gn=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,_n=/^([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})$/,je=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)$/,vn=/^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_\'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,bn="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$";function yn(){return new RegExp(bn,"u")}const wn=/^(?:(?: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])$/,zn=/^(([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}|:))$/,kn=/^((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])$/,$n=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Re=/^[A-Za-z0-9_-]*$/,Zn=/^https?$/,En=/^\\+[1-9]\\d{6,14}$/,Le="(?:(?:\\\\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])))",In=new RegExp(`^${Le}$`);function Ce(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}}`:`${t}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`}function On(e){return new RegExp(`^${Ce(e)}$`)}function Tn(e){const t=Ce({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Le}T(?:${r})$`)}const Nn=e=>{const t=e?`[\\\\s\\\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\\\s\\\\S]*";return new RegExp(`^${t}$`)},An=/^-?\\d+$/,Pn=/^-?\\d+(?:\\.\\d+)?$/,Mn=/^[^A-Z]*$/,jn=/^[^a-z]*$/,E=c("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Fe={number:"number",bigint:"bigint",object:"date"},xe=c("$ZodCheckLessThan",(e,t)=>{E.init(e,t);const n=Fe[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?r.value<=t.value:r.value{E.init(e,t);const n=Fe[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_s)DELIM" -R"DELIM(mall",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Rn=c("$ZodCheckMultipleOf",(e,t)=>{E.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Lt(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})}}),Ln=c("$ZodCheckNumberFormat",(e,t)=>{E.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=Ut[t.format];e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,a.minimum=i,a.maximum=o,n&&(a.pattern=An)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}ao&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Cn=c("$ZodCheckMaxLength",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const i=r.value;if(i.length<=t.maximum)return;const s=le(i);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Fn=c("$ZodCheckMinLength",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const s=le(i);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),xn=c("$ZodCheckLengthEquals",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=r=>{const i=r.value,o=i.length;if(o===t.length)return;const s=le(i),a=o>t.length;r.issues.push({origin:s,...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})}}),H=c("$ZodCheckStringFormat",(e,t)=>{var n,r;E.init(e,t),e._zod.onattach.push(i=>{const o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),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=()=>{})}),Dn=c("$ZodCheckRegex",(e,t)=>{H.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})}}),Un=c("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Mn),H.init(e,t)}),Jn=c("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=jn),H.init(e,t)}),Kn=c("$ZodCheckIncludes",(e,t)=>{E.init(e,t);const n=W(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(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})}}),Vn=c("$ZodCheckStartsWith",(e,t)=>{E.init(e,t);const n=new RegExp(`^${W(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(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})}}),Wn=c("$ZodCheckEndsWith",(e,t)=>{E.init(e,t);const n=new RegExp(`.*${W(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(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})}}),Bn=c("$ZodCheckOverwrite",(e,t)=>{E.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Gn{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`\n`).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),o=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of o)this.content.push(s)}compile(){const t=Function,n=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,i.join(`\n`))}}const qn={major:4,minor:4,patch:3},w=c("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qn;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const o of i._zod.onattach)o(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,a,u)=>{let l=R(s),h;for(const m of a){if(m._zod.def.when){if(Ht(s)||!m._zod.def.when(s))continue}else if(l)continue;const p=s.issues.length,d=m._zod.check(s);if(d instanceof Promise&&u?.async===!1)throw new j;if(h||d instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await d,s.issues.length!==p&&(l||(l=R(s,p)))});else{if(s.issues.length===p)continue;l||(l=R(s,p))}}return h?h.then(()=>s):s},o=(s,a,u)=>{if(R(s))return s.aborted=!0,s;const l=i(a,r,u);if(l instanceof Promise){if(u.async===!1)throw new j;return l.then(h=>e._zod.parse(h,u))}return e._zod.parse(l,u)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const l=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(h=>o(h,s,a)):o(l,s,a)}const u=e._zod.parse(s,a);if(u instanceof Promise){if(a.async===!1)throw new j;return u.then(l=>i(l,r,a))}return i(u,r,a)}}g(e,"~standard",()=>({validate:i=>{try{const o=Qt(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return en(e,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),de=c("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Nn(e._zod.bag),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}}),v=c("$ZodStringFormat",(e,t)=>{H.init(e,t),de.init(e,t)}),Hn=c("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=_n),v.init(e,t)}),Yn=c("$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=je(r))}else t.pattern??(t.pattern=je());v.init(e,t)}),Xn=c("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=vn),v.init(e,t)}),Qn=c("$ZodURL",(e,t)=>{v.init(e,t),e._zod.check=n=>{try)DELIM" -R"DELIM({const r=n.value.trim();if(!t.normalize&&t.protocol?.source===Zn.source&&!/^https?:\\/\\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),er=c("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=yn()),v.init(e,t)}),tr=c("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=mn),v.init(e,t)}),nr=c("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ln),v.init(e,t)}),rr=c("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=hn),v.init(e,t)}),ir=c("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fn),v.init(e,t)}),sr=c("$ZodXID",(e,t)=>{t.pattern??(t.pattern=dn),v.init(e,t)}),or=c("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=pn),v.init(e,t)}),ar=c("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Tn(t)),v.init(e,t)}),cr=c("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=In),v.init(e,t)}),ur=c("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=On(t)),v.init(e,t)}),lr=c("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=gn),v.init(e,t)}),hr=c("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wn),v.init(e,t),e._zod.bag.format="ipv4"}),fr=c("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=zn),v.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),dr=c("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=kn),v.init(e,t)}),pr=c("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=$n),v.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[i,o]=r;if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Ue(e){if(e==="")return!0;if(/\\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const mr=c("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Sn),v.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Ue(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function gr(e){if(!Re.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ue(n)}const _r=c("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Re),v.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{gr(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),vr=c("$ZodE164",(e,t)=>{t.pattern??(t.pattern=En),v.init(e,t)});function br(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 yr=c("$ZodJWT",(e,t)=>{v.init(e,t),e._zod.check=n=>{br(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Je=c("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=e._zod.bag.pattern??Pn,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 o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),wr=c("$ZodNumberFormat",(e,t)=>{Ln.init(e,t),Je.init(e,t)}),zr=c("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=n=>n}),kr=c("$ZodNever",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ke(e,t,n){e.issues.length&&t.issues.push(...Ne(n,e.issues)),t.value[n]=e.value}const $r=c("$ZodArray",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let s=0;sKe(l,n,s))):Ke(u,n,s)}return o.length?Promise.all(o).then(()=>n):n}});function Y(e,t,n,r,i,o){const s=n in r;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...Ne(n,e.issues))}if(!s&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?s&&(t.value[n]=void 0):t.value[n]=e.value}function Ve(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=Dt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function We(e,t,n,r,i,o){const s=[],a=i.keySet,u=i.catchall._zod,l=u.def.type,h=u.optin==="optional",m=u.optout==="optional";for(const p in t){if(p==="__proto__"||a.has(p))continue;if(l==="never"){s.push(p);continue}const d=u.run({value:t[p],issues:[]},r);d instanceof Promise?e.push(d.then(_=>Y(_,n,p,t,h,m))):Y(d,n,p,t,h,m)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const Sr=c("$ZodObject",(e,t)=>{if(w.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...a};return Object.defineProperty(t,"shape",{value:u}),u}})}const r=ae(()=>Ve(t));g(e._zod,"propValues",()=>{const a=t.shape,u={};for(const l in a){const h=a[l]._zod;if(h.values){u[l]??(u[l]=new Set);for(const m of h.values)u[l].add(m)}}return u});const i=V,o=t.catchall;let s;e._zod.parse=(a,u)=>{s??(s=r.value);const l=a.value;if(!i(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};const h=[],m=s.shape;for(const p of s.keys){const d=m[p],_=d._zod.optin==="optional",K=d._zod.optout==="optional",k=d._zod.run({value:l[p],issues:[]},u);k instanceof Promise?h.push(k.then(ke=>Y(ke,a,p,l,_,K))):Y(k,a,p,l,_,K)}return o?We(h,l,a,u,r.value,e):h.length?Promise.all(h).then(()=>a):a}}),Zr=c("$ZodObjectJIT",(e,t)=>{Sr.init(e,t);const n=e._zod.parse,r=ae(()=>Ve(t)),i=p=>{const d=new Gn(["shape","payload","ctx"]),_=r.value,K=O=>{const y=Ie(O);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};d.write("const input = payload.value;");const k=Object.create(null);let ke=0;for(const O of _.keys)k[O]=`key_${ke++}`;d.write("const newResult = {};");for(const O of _.keys){const y=k[O],S=Ie(O),jt=p[O],Rt=jt?._zod?.optin==="optional",Bo=jt?._zod?.optout==="optional";d.write(`const ${y} = ${K(O)};`),Rt&&Bo?d.write(`\n if (${y}.issues.length) {\n if (${S} in input) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n }\n \n if (${y}.value === undefined) {\n if (${S} in input) {\n newResult[${S}] = undefined;\n }\n } else {\n newResult[${S}] = ${y}.value;\n }\n \n `):Rt?d.write(`\n if (${y}.issues.length) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n \n if (${y}.value === undefined) {\n if (${S} in input) {\n n)DELIM" -R"DELIM(ewResult[${S}] = undefined;\n }\n } else {\n newResult[${S}] = ${y}.value;\n }\n \n `):d.write(`\n const ${y}_present = ${S} in input;\n if (${y}.issues.length) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n if (!${y}_present && !${y}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${S}]\n });\n }\n\n if (${y}_present) {\n if (${y}.value === undefined) {\n newResult[${S}] = undefined;\n } else {\n newResult[${S}] = ${y}.value;\n }\n }\n\n `)}d.write("payload.value = newResult;"),d.write("return payload;");const Wo=d.compile();return(O,y)=>Wo(p,O,y)};let o;const s=V,a=!se.jitless,l=a&&Ft.value,h=t.catchall;let m;e._zod.parse=(p,d)=>{m??(m=r.value);const _=p.value;return s(_)?a&&l&&d?.async===!1&&d.jitless!==!0?(o||(o=i(t.shape)),p=o(p,d),h?We([],_,p,d,m,e):p):n(p,d):(p.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),p)}});function Be(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const i=e.filter(o=>!R(o));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(o=>o.issues.map(s=>M(s,r,A())))}),t)}const Er=c("$ZodUnion",(e,t)=>{w.init(e,t),g(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),g(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),g(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),g(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>ue(i.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 o=!1;const s=[];for(const a of t.options){const u=a._zod.run({value:r.value,issues:[]},i);if(u instanceof Promise)s.push(u),o=!0;else{if(u.issues.length===0)return u;s.push(u)}}return o?Promise.all(s).then(a=>Be(a,r,e,i)):Be(s,r,e,i)}}),Ir=c("$ZodIntersection",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,o=t.left._zod.run({value:i,issues:[]},r),s=t.right._zod.run({value:i,issues:[]},r);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([u,l])=>Ge(n,u,l)):Ge(n,o,s)}});function pe(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(F(e)&&F(t)){const n=Object.keys(t),r=Object.keys(e).filter(o=>n.indexOf(o)!==-1),i={...e,...t};for(const o of r){const s=pe(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.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;ra.l&&a.r).map(([a])=>a);if(o.length&&i&&e.issues.push({...i,keys:o}),R(e))return e;const s=pe(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Or=c("$ZodEnum",(e,t)=>{w.init(e,t);const n=Ze(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(i=>xt.has(typeof i)).map(i=>typeof i=="string"?W(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{const s=i.value;return r.has(s)||i.issues.push({code:"invalid_value",values:n,input:s,inst:e}),i}}),Tr=c("$ZodTransform",(e,t)=>{w.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Se(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(n.value=s,n.fallback=!0,n));if(i instanceof Promise)throw new j;return n.value=i,n.fallback=!0,n}});function qe(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const He=c("$ZodOptional",(e,t)=>{w.init(e,t),e._zod.optin="optional",e._zod.optout="optional",g(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),g(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ue(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const i=n.value,o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>qe(s,i)):qe(o,i)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Nr=c("$ZodExactOptional",(e,t)=>{He.init(e,t),g(e._zod,"values",()=>t.innerType._zod.values),g(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Ar=c("$ZodNullable",(e,t)=>{w.init(e,t),g(e._zod,"optin",()=>t.innerType._zod.optin),g(e._zod,"optout",()=>t.innerType._zod.optout),g(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ue(n.source)}|null)$`):void 0}),g(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Pr=c("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"values",()=>t.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(o=>Ye(o,t)):Ye(i,t)}});function Ye(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Mr=c("$ZodPrefault",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"values",()=>t.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))}),jr=c("$ZodNonOptional",(e,t)=>{w.init(e,t),g(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Xe(o,e)):Xe(i,e)}});function Xe(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Rr=c("$ZodCatch",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"optout",()=>t.innerType._zod.optout),g(e._zod,"values",()=>t.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(n,r);return i instanceof Promise?i.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>M(s,r,A()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(o=>M(o,r,A()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Lr=c("$ZodPipe",(e,t)=>{w.init(e,t),g(e._zod,"values",()=>t.in._zod.values),g(e._zod,"optin",()=>t.in._zod.optin),g(e._zod,"optout",()=>t.out._zod.optout),g(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const o=t.out._zod.run(n,r);return o instanceof Promise?o.then(s=>X(s,t.in,r)):X(o,t.in,r)}const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(o=>X(o,t.out,r)):X(i,t.out,r)}});function X(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.va)DELIM" -R"DELIM(lue,issues:e.issues,fallback:e.fallback},n)}const Cr=c("$ZodReadonly",(e,t)=>{w.init(e,t),g(e._zod,"propValues",()=>t.innerType._zod.propValues),g(e._zod,"values",()=>t.innerType._zod.values),g(e._zod,"optin",()=>t.innerType?._zod?.optin),g(e._zod,"optout",()=>t.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(Qe):Qe(i)}});function Qe(e){return e.value=Object.freeze(e.value),e}const Fr=c("$ZodCustom",(e,t)=>{E.init(e,t),w.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(o=>et(o,n,r,e));et(i,n,r,e)}});function et(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(x(i))}}var tt;class xr{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 Dr(){return new xr}(tt=globalThis).__zod_globalRegistry??(tt.__zod_globalRegistry=Dr());const D=globalThis.__zod_globalRegistry;function Ur(e,t){return new e({type:"string",...f(t)})}function Jr(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...f(t)})}function nt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...f(t)})}function Kr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...f(t)})}function Vr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f(t)})}function Wr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f(t)})}function Br(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f(t)})}function Gr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...f(t)})}function qr(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...f(t)})}function Hr(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...f(t)})}function Yr(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...f(t)})}function Xr(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...f(t)})}function Qr(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...f(t)})}function ei(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...f(t)})}function ti(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...f(t)})}function ni(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...f(t)})}function ri(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...f(t)})}function ii(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f(t)})}function si(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f(t)})}function oi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...f(t)})}function ai(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...f(t)})}function ci(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...f(t)})}function ui(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...f(t)})}function li(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(t)})}function hi(e,t){return new e({type:"string",format:"date",check:"string_format",...f(t)})}function fi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...f(t)})}function di(e,t){return new e({type:"string",format:"duration",check:"string_format",...f(t)})}function pi(e,t){return new e({type:"number",checks:[],...f(t)})}function mi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...f(t)})}function gi(e){return new e({type:"unknown"})}function _i(e,t){return new e({type:"never",...f(t)})}function rt(e,t){return new xe({check:"less_than",...f(t),value:e,inclusive:!1})}function me(e,t){return new xe({check:"less_than",...f(t),value:e,inclusive:!0})}function it(e,t){return new De({check:"greater_than",...f(t),value:e,inclusive:!1})}function ge(e,t){return new De({check:"greater_than",...f(t),value:e,inclusive:!0})}function st(e,t){return new Rn({check:"multiple_of",...f(t),value:e})}function ot(e,t){return new Cn({check:"max_length",...f(t),maximum:e})}function Q(e,t){return new Fn({check:"min_length",...f(t),minimum:e})}function at(e,t){return new xn({check:"length_equals",...f(t),length:e})}function vi(e,t){return new Dn({check:"string_format",format:"regex",...f(t),pattern:e})}function bi(e){return new Un({check:"string_format",format:"lowercase",...f(e)})}function yi(e){return new Jn({check:"string_format",format:"uppercase",...f(e)})}function wi(e,t){return new Kn({check:"string_format",format:"includes",...f(t),includes:e})}function zi(e,t){return new Vn({check:"string_format",format:"starts_with",...f(t),prefix:e})}function ki(e,t){return new Wn({check:"string_format",format:"ends_with",...f(t),suffix:e})}function L(e){return new Bn({check:"overwrite",tx:e})}function $i(e){return L(t=>t.normalize(e))}function Si(){return L(e=>e.trim())}function Zi(){return L(e=>e.toLowerCase())}function Ei(){return L(e=>e.toUpperCase())}function Ii(){return L(e=>Ct(e))}function Oi(e,t,n){return new e({type:"array",element:t,...f(n)})}function Ti(e,t,n){return new e({type:"custom",check:"custom",fn:t,...f(n)})}function Ni(e,t){const n=Ai(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(x(i,r.value,n._zod.def));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),r.issues.push(x(o))}},e(r.value,r)),t);return n}function Ai(e,t){const n=new E({check:"custom",...f(t)});return n._zod.check=e,n}function ct(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??D,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function $(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const h={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,h);else{const p=s.schema,d=t.processors[i.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);d(e,t,p,h)}const m=e._zod.parent;m&&(s.ref||(s.ref=m),$(m,t,h),t.seen.get(m).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&Z(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ut(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const s of e.seen.entries()){const a=e.metadataR)DELIM" -R"DELIM(egistry.get(s[0])?.id;if(a){const u=r.get(a);if(u&&u!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}const i=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const m=e.external.registry.get(s[0])?.id,p=e.external.uri??(_=>_);if(m)return{ref:p(m)};const d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${p("__shared")}#/${a}/${d}`}}if(s[1]===n)return{ref:"#"};const l=`#/${a}/`,h=s[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:l+h}},o=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:u,defId:l}=i(s);a.def={...a.schema},l&&(a.defId=l);const h=a.schema;for(const m in h)delete h[m];h.$ref=u};if(e.cycles==="throw")for(const s of e.seen.entries()){const a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/\n\nSet the \\`cycles\\` parameter to \\`"ref"\\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){o(s);continue}if(e.external){const l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}}function lt(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const u=e.seen.get(a);if(u.ref===null)return;const l=u.def??u.schema,h={...l},m=u.ref;if(u.ref=null,m){r(m);const d=e.seen.get(m),_=d.schema;if(_.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(_)):Object.assign(l,_),Object.assign(l,h),a._zod.parent===m)for(const k in l)k==="$ref"||k==="allOf"||k in h||delete l[k];if(_.$ref&&d.def)for(const k in l)k==="$ref"||k==="allOf"||k in d.def&&JSON.stringify(l[k])===JSON.stringify(d.def[k])&&delete l[k]}const p=a._zod.parent;if(p&&p!==m){r(p);const d=e.seen.get(p);if(d?.schema.$ref&&(l.$ref=d.schema.$ref,d.def))for(const _ in l)_==="$ref"||_==="allOf"||_ in d.def&&JSON.stringify(l[_])===JSON.stringify(d.def[_])&&delete l[_]}e.override({zodSchema:a,jsonSchema:l,path:u.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);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 a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;o!==void 0&&i.id===o&&delete i.id;const s=e.external?.defs??{};for(const a of e.seen.entries()){const u=a[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,s[u.defId]=u.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:ee(t,"input",e.processors),output:ee(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Z(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 Z(r.element,n);if(r.type==="set")return Z(r.valueType,n);if(r.type==="lazy")return Z(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")return Z(r.innerType,n);if(r.type==="intersection")return Z(r.left,n)||Z(r.right,n);if(r.type==="record"||r.type==="map")return Z(r.keyType,n)||Z(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Z(r.in,n)||Z(r.out,n);if(r.type==="object"){for(const i in r.shape)if(Z(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Z(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Z(i,n))return!0;return!!(r.rest&&Z(r.rest,n))}return!1}const Pi=(e,t={})=>n=>{const r=ct({...n,processors:t});return $(e,r),ut(r,e),lt(r,e)},ee=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=ct({...i??{},target:o,io:t,processors:n});return $(e,s),ut(s,e),lt(s,e)},Mi={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ji=(e,t,n,r)=>{const i=n;i.type="string";const{minimum:o,maximum:s,format:a,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=Mi[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),l&&(i.contentEncoding=l),u&&u.size>0){const h=[...u];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Ri=(e,t,n,r)=>{const i=n,{minimum:o,maximum:s,format:a,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:h}=e._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";const m=typeof h=="number"&&h>=(o??Number.NEGATIVE_INFINITY),p=typeof l=="number"&&l<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";m?d?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h:typeof o=="number"&&(i.minimum=o),p?d?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof s=="number"&&(i.maximum=s),typeof u=="number"&&(i.multipleOf=u)},Li=(e,t,n,r)=>{n.not={}},Ci=(e,t,n,r)=>{},Fi=(e,t,n,r)=>{const i=e._zod.def,o=Ze(i.entries);o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),n.enum=o},xi=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Di=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ui=(e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=$(o.element,t,{...r,path:[...r.path,"items"]})},Ji=(e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const l in s)i.properties[l]=$(s[l],t,{...r,path:[...r.path,"properties",l]});const a=new Set(Object.keys(s)),u=new Set([...a].filter(l=>{const h=o.shape[l]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));u.size>0&&(i.required=Array.from(u)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=$(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Ki=(e,t,n,r)=>{const i=e._zod.def,o=i.inclusive===!1,s=i.options.map((a,u)=>$(a,t,{...r,path:[...r.path,o?"oneOf":"anyOf",u]}));o?n.oneOf=s:n.anyOf=s},Vi=(e,t,n,r)=>{const i=e._zod.def,o=$(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=$(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,u=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=u},Wi=(e,t,n,r)=>{const i=e._zod.def,o=$(i.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Bi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType},Gi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},qi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Hi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},Yi=(e,t)DELIM" -R"DELIM(,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?i.out:i.in:i.out;$(s,t,r);const a=t.seen.get(e);a.ref=s},Xi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,n.readOnly=!0},ht=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType},Qi=c("ZodISODateTime",(e,t)=>{ar.init(e,t),b.init(e,t)});function es(e){return li(Qi,e)}const ts=c("ZodISODate",(e,t)=>{cr.init(e,t),b.init(e,t)});function ns(e){return hi(ts,e)}const rs=c("ZodISOTime",(e,t)=>{ur.init(e,t),b.init(e,t)});function is(e){return fi(rs,e)}const ss=c("ZodISODuration",(e,t)=>{lr.init(e,t),b.init(e,t)});function os(e){return di(ss,e)}const I=c("ZodError",(e,t)=>{Pe.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Xt(e,n)},flatten:{value:n=>Yt(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,oe,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,oe,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),as=he(I),cs=fe(I),us=G(I),ls=q(I),hs=tn(I),fs=nn(I),ds=rn(I),ps=sn(I),ms=on(I),gs=an(I),_s=cn(I),vs=un(I),ft=new WeakMap;function U(e,t,n){const r=Object.getPrototypeOf(e);let i=ft.get(r);if(i||(i=new Set,ft.set(r,i)),!i.has(t)){i.add(t);for(const o in n){const s=n[o];Object.defineProperty(r,o,{configurable:!0,enumerable:!1,get(){const a=s.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const z=c("ZodType",(e,t)=>(w.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ee(e,"input"),output:ee(e,"output")}}),e.toJSONSchema=Pi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>as(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>us(e,n,r),e.parseAsync=async(n,r)=>cs(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>ls(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>hs(e,n,r),e.decode=(n,r)=>fs(e,n,r),e.encodeAsync=async(n,r)=>ds(e,n,r),e.decodeAsync=async(n,r)=>ps(e,n,r),e.safeEncode=(n,r)=>ms(e,n,r),e.safeDecode=(n,r)=>gs(e,n,r),e.safeEncodeAsync=async(n,r)=>_s(e,n,r),e.safeDecodeAsync=async(n,r)=>vs(e,n,r),U(e,"ZodType",{check(...n){const r=this.def;return this.clone(T(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return N(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(ho(n,r))},superRefine(n,r){return this.check(fo(n,r))},overwrite(n){return this.check(L(n))},optional(){return yt(this)},exactOptional(){return Xs(this)},nullable(){return wt(this)},nullish(){return yt(wt(this))},nonoptional(n){return io(this,n)},array(){return Js(this)},or(n){return vt([this,n])},and(n){return Bs(this,n)},transform(n){return kt(this,Hs(n))},default(n){return to(this,n)},prefault(n){return ro(this,n)},catch(n){return oo(this,n)},pipe(n){return kt(this,n)},readonly(){return uo(this)},describe(n){const r=this.clone();return D.add(r,{description:n}),r},meta(...n){if(n.length===0)return D.get(this);const r=this.clone();return D.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return D.get(e)?.description},configurable:!0}),e)),dt=c("_ZodString",(e,t)=>{de.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>ji(e,r,i);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,U(e,"_ZodString",{regex(...r){return this.check(vi(...r))},includes(...r){return this.check(wi(...r))},startsWith(...r){return this.check(zi(...r))},endsWith(...r){return this.check(ki(...r))},min(...r){return this.check(Q(...r))},max(...r){return this.check(ot(...r))},length(...r){return this.check(at(...r))},nonempty(...r){return this.check(Q(1,...r))},lowercase(r){return this.check(bi(r))},uppercase(r){return this.check(yi(r))},trim(){return this.check(Si())},normalize(...r){return this.check($i(...r))},toLowerCase(){return this.check(Zi())},toUpperCase(){return this.check(Ei())},slugify(){return this.check(Ii())}})}),bs=c("ZodString",(e,t)=>{de.init(e,t),dt.init(e,t),e.email=n=>e.check(Jr(ws,n)),e.url=n=>e.check(Gr(zs,n)),e.jwt=n=>e.check(ui(Ls,n)),e.emoji=n=>e.check(qr(ks,n)),e.guid=n=>e.check(nt(pt,n)),e.uuid=n=>e.check(Kr(te,n)),e.uuidv4=n=>e.check(Vr(te,n)),e.uuidv6=n=>e.check(Wr(te,n)),e.uuidv7=n=>e.check(Br(te,n)),e.nanoid=n=>e.check(Hr($s,n)),e.guid=n=>e.check(nt(pt,n)),e.cuid=n=>e.check(Yr(Ss,n)),e.cuid2=n=>e.check(Xr(Zs,n)),e.ulid=n=>e.check(Qr(Es,n)),e.base64=n=>e.check(oi(Ms,n)),e.base64url=n=>e.check(ai(js,n)),e.xid=n=>e.check(ei(Is,n)),e.ksuid=n=>e.check(ti(Os,n)),e.ipv4=n=>e.check(ni(Ts,n)),e.ipv6=n=>e.check(ri(Ns,n)),e.cidrv4=n=>e.check(ii(As,n)),e.cidrv6=n=>e.check(si(Ps,n)),e.e164=n=>e.check(ci(Rs,n)),e.datetime=n=>e.check(es(n)),e.date=n=>e.check(ns(n)),e.time=n=>e.check(is(n)),e.duration=n=>e.check(os(n))});function ys(e){return Ur(bs,e)}const b=c("ZodStringFormat",(e,t)=>{v.init(e,t),dt.init(e,t)}),ws=c("ZodEmail",(e,t)=>{Xn.init(e,t),b.init(e,t)}),pt=c("ZodGUID",(e,t)=>{Hn.init(e,t),b.init(e,t)}),te=c("ZodUUID",(e,t)=>{Yn.init(e,t),b.init(e,t)}),zs=c("ZodURL",(e,t)=>{Qn.init(e,t),b.init(e,t)}),ks=c("ZodEmoji",(e,t)=>{er.init(e,t),b.init(e,t)}),$s=c("ZodNanoID",(e,t)=>{tr.init(e,t),b.init(e,t)}),Ss=c("ZodCUID",(e,t)=>{nr.init(e,t),b.init(e,t)}),Zs=c("ZodCUID2",(e,t)=>{rr.init(e,t),b.init(e,t)}),Es=c("ZodULID",(e,t)=>{ir.init(e,t),b.init(e,t)}),Is=c("ZodXID",(e,t)=>{sr.init(e,t),b.init(e,t)}),Os=c("ZodKSUID",(e,t)=>{or.init(e,t),b.init(e,t)}),Ts=c("ZodIPv4",(e,t)=>{hr.init(e,t),b.init(e,t)}),Ns=c("ZodIPv6",(e,t)=>{fr.init(e,t),b.init(e,t)}),As=c("ZodCIDRv4",(e,t)=>{dr.init(e,t),b.init(e,t)}),Ps=c("ZodCIDRv6",(e,t)=>{pr.init(e,t),b.init(e,t)}),Ms=c("ZodBase64",(e,t)=>{mr.init(e,t),b.init(e,t)}),js=c("ZodBase64URL",(e,t)=>{_r.init(e,t),b.init(e,t)}),Rs=c("ZodE164",(e,t)=>{vr.init(e,t),b.init(e,t)}),Ls=c("ZodJWT",(e,t)=>{yr.init(e,t),b.init(e,t)}),mt=c("ZodNumber",(e,t)=>{Je.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>Ri(e,r,i),U(e,"ZodNumber",{gt(r,i){return this.check(it(r,i))},gte(r,i){return this.check(ge(r,i))},min(r,i){return this.check(ge(r,i))},lt(r,i){return this.check(rt(r,i))},lte(r,i){return this.check(me(r,i))},max(r,i){return this.check(me(r,i))},int(r){return this.check(gt(r))},safe(r){return this.check(gt(r))},positive(r){return this.check(it(0,r))},nonnegative(r){return this.check(ge(0,r))},negative(r){return this.check(rt(0,r))},nonpositive(r){return this.check(me(0,r))},multipleOf(r,i){return this.check(st(r,i))},step(r,i){return this.check(st(r,i))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function C(e){return pi(mt,e)}const Cs=c("ZodNumberFormat",(e,t)=>{wr.init(e,t),mt.init(e,t)});function gt(e){return mi(Cs,e)}const Fs=c("ZodUnknown",(e,t)=>{zr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ci()});function _t(){return gi(Fs)}const xs=c("ZodNever",(e,t)=>{kr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Li(e,n,r)});function Ds(e){return _i(xs,e)}const Us=c("ZodArray",(e,t)=>{$r.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ui(e,n,r,i),e.element=t.element,U(e,"ZodArray",{min(n,r){return this.check(Q(n,r))},nonempty(n){return this.check(Q(1,n))},max(n,r){return this.check(ot(n,r))},length(n,r){return this.check(at(n,r))},unwrap(){return this.element}})});function Js(e,t){return Oi(Us,e,t)}const)DELIM" -R"DELIM( Ks=c("ZodObject",(e,t)=>{Zr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ji(e,n,r,i),g(e,"shape",()=>t.shape),U(e,"ZodObject",{keyof(){return Gs(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:_t()})},loose(){return this.clone({...this._zod.def,catchall:_t()})},strict(){return this.clone({...this._zod.def,catchall:Ds()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Vt(this,n)},safeExtend(n){return Wt(this,n)},merge(n){return Bt(this,n)},pick(n){return Jt(this,n)},omit(n){return Kt(this,n)},partial(...n){return Gt(bt,this,n[0])},required(...n){return qt(zt,this,n[0])}})});function _e(e,t){const n={type:"object",shape:e??{},...f(t)};return new Ks(n)}const Vs=c("ZodUnion",(e,t)=>{Er.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ki(e,n,r,i),e.options=t.options});function vt(e,t){return new Vs({type:"union",options:e,...f(t)})}const Ws=c("ZodIntersection",(e,t)=>{Ir.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Vi(e,n,r,i)});function Bs(e,t){return new Ws({type:"intersection",left:e,right:t})}const ve=c("ZodEnum",(e,t)=>{Or.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>Fi(e,r,i),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const o={};for(const s of r)if(n.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new ve({...t,checks:[],...f(i),entries:o})},e.exclude=(r,i)=>{const o={...t.entries};for(const s of r)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new ve({...t,checks:[],...f(i),entries:o})}});function Gs(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ve({type:"enum",entries:n,...f(t)})}const qs=c("ZodTransform",(e,t)=>{Tr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Di(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Se(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(x(o,n.value,t));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(x(s))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(o=>(n.value=o,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Hs(e){return new qs({type:"transform",transform:e})}const bt=c("ZodOptional",(e,t)=>{He.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ht(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function yt(e){return new bt({type:"optional",innerType:e})}const Ys=c("ZodExactOptional",(e,t)=>{Nr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ht(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Xs(e){return new Ys({type:"optional",innerType:e})}const Qs=c("ZodNullable",(e,t)=>{Ar.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Wi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function wt(e){return new Qs({type:"nullable",innerType:e})}const eo=c("ZodDefault",(e,t)=>{Pr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Gi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function to(e,t){return new eo({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Te(t)}})}const no=c("ZodPrefault",(e,t)=>{Mr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>qi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function ro(e,t){return new no({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Te(t)}})}const zt=c("ZodNonOptional",(e,t)=>{jr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Bi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function io(e,t){return new zt({type:"nonoptional",innerType:e,...f(t)})}const so=c("ZodCatch",(e,t)=>{Rr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Hi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function oo(e,t){return new so({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const ao=c("ZodPipe",(e,t)=>{Lr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Yi(e,n,r,i),e.in=t.in,e.out=t.out});function kt(e,t){return new ao({type:"pipe",in:e,out:t})}const co=c("ZodReadonly",(e,t)=>{Cr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Xi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function uo(e){return new co({type:"readonly",innerType:e})}const lo=c("ZodCustom",(e,t)=>{Fr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>xi(e,n)});function ho(e,t={}){return Ti(lo,e,t)}function fo(e,t){return Ni(e,t)}const ne=[{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"}],be=[{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:"count"},{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:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],$t=_e({level:C().int().nonnegative(),time:C().int().nonnegative(),message:ys()}),St=_e({event:C().int().nonnegative(),value:C().nonnegative(),time:C().int().nonnegative()}),Zt=_e({previous:C().nonnegative()});vt([$t,St,Zt]);const po=2**ne.length-1,Et=2**be.length-1;function It(e,t){return Number.isInteger(t)&&t>=0&&tnew WebSocket(n))},this.#c=this.#e.retryMinimumMs}getStatus=()=>this.#t;subscribeStatus=t=>(this.#r.add(t),()=>{this.#r.delete(t)});start(){this.#o||(this.#o=!0,this.#c=this.#e.retryMinimumMs,this.#h())}stop(){this.#o=!1,this.#g();const t=this.#n;if(this.#n=null,t)try{t.readyState===1&&this.#e.onBeforeStop?.(t),t.close()}catch{}this.#u(Tt)}send(t){if(this.#n?.readyState!==1)return!1;try{return this.#n.send(t),!0}catch{return!1}}#h(){if(!this.#o||this.#n)return;const t=this.#t.reconnects>0;this.#u({...this.#t,phase:t?"reconnecting":"connecting",attempt:this.#t.attempt+1,error:null});let n;try{n=this.#e.webSocketFactory(this.#e.url),this.#n=n}catch(r){this.#u({...this.#t,error:$o(r)}),this.#d();return}this.#s=setTimeout(()=>{if(this.#n===n){this.#u({...this.#t,error:"Connection timed out"});try{n.close()}catch{this.#n=null,this.#d()}}},this.#e.connectTimeoutMs),n.addEventListener("open",()=>{this.#n!==n||!this.#o||(this.#p(),this.#c=this.#e.retryMinimumMs,this.#u({...this.#t,phase:"connected",connectedAt:this.#e.now(),error:null}),this.#e.onOpen?.(n),this.#m(n))}),n.addEventListener("message",r=>{if(this.#n!==n||!this.#o)return;const i=ko(r.data);if(i===null)return;const o=this.#e.now();(this.#t.lastMessageAt===null||o-this.#t.lastMessageAt>=1e3)&&this.#u({...this.#t,lastMessageAt:o}),this.#e.onMessage(i)}),n.addEventListener("error",()=>{if(!(this.#n!==n||!this.#o)){this.#u({...this.#t,error:"WebSocket connection failed"});try{n.close()}catch{this.#n=null,this.#d()}}}),n.addEventListener("close",()=>{this.#n===n&&(this.#n=null,this.#p(),this.#l(),this.#o&&this.#d())})}#d(){if(!this.#o||this.#i)return;const t=1+(this.#e.random()*2-1)*this.#e.jitterRatio,n=Math.max(0,Math.round(this.#c*t));this.#c=Math.min(this.#c*2,this.#e.retryMaximumMs),this.#u({...this.#t,phase:"reconnecting",reconnects:this.#t.reconnects+1,connectedAt:null}),this.#i=setTimeout(()=>{this.#i=null,this.#h()},n)}#m(t){this.#l(),!(!this.#e.onHeartbeat||this.#e.heartbeatMs<=0)&&(this.#a=setInterval(()=>{this.#n===t&&t.readyState===1&&this.#e.onHeartbeat?.(t)},this.#e.heartbeatMs))}#p(){this.#s&&(clearTimeout(this.#s),this.#s=null)}#l(){this.#a&&(clearInterval(this.#a),this.#a=null)}#g(){this.#p(),this.#l(),this.#i&&(clearTimeout(this.#i),this.#i=null)}#u(t){this.#t=t;for(const n of this.#r)n()}}function ko(e){return typeof e=="string"?e:e instanceof ArrayBuffer?new TextDecoder().decode(e):null}function $o(e){return e instanceof Error?e.message:"Unable to create WebSocket"}class So{#e;#t;#n=new Set;#r=new Set;#s;constructor(t,n={}){this.#e=n.logFilter??po,this.#t=n.eventFilter??Et,this.#s=new zo({url:wo(t),webSocketFactory:n.webSocketFactory,retryMinimumMs:n.retryMinimumMs,retryMaximumMs:n.retryMaximumMs,jitterRatio:n.jitterRatio,onOpen:r=>{this.#i(r)},onHeartbeat:r=>{this.#i(r)},onBeforeStop:r=>{r.send("/v1/log/subscribe?filter=0"),r.send("/v1/event/subscribe?filter=0")},onMessage:r=>{const i=_o(r);if(!i){for(const o of this.#r)o(r);return}if(!(Ot(i)&&!It(this.#e,i.level)))for(const o of this.#n)o(i)}})}getStatus=()=>this.#s.getStatus();subscribeStatus=t=>this.#s.subscribeStatus(t);start(){this.#s.start()}stop(){this.#s.stop()}subscribeFrames(t){return this.#n.add(t),()=>{this.#n.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.#t!==n&&(this.#t=n,this.#s.send(`/v1/event/subscribe?filter=${String(n)}`))}#i(t){t.send(`/v1/log/subscribe?filter=${String(this.#e)}`),t.send(`/v1/event/subscribe?filter=${String(this.#t)}`)}}const J=["occurrence-rate","occurrence-count","cumulative-occurrences"],Zo=["payload-latest","payload-maximum","payload-change-rate",...J],Eo=["payload-average","payload-latest","payload-minimum","payload-maximum",...J],Io=["payload-sum","payload-cumulative","payload-latest","payload-average",...J];function Nt(e){return`event:${String(e)}`}function At(e){return`log:${String(e)}`}const we="native:top";function Oo(e){switch(e){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";default:return"unknown"}}function To(e){switch(e){case"height":return Zo;case"duration":return Eo;case"count":return Io;default:return J}}function No(e){switch(e){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function Ao(e){const t=ye(e),n=Oo(t.valueKind);return{id:Nt(e),source:"event",sourceId:e,name:t.name,label:t.label,category:t.category,payloadKind:n,allowedMeasures:To(n),defaultMeasure:No(n),description:n==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${t.label} event with a ${n} payload.`}}const Po=[...be.map(e=>Ao(e.id)),...ne.map(e=>({id:At(e.id),source:"log",sourceId:e.id,name:e.name,label:`${e.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:J,defaultMeasure:"occurrence-rate",description:`${e.label} log message volume. Message text is not interpreted as numeric data.`})),{id:we,source:"native",sourceId:"top",name:"canonical_top",label:"Canonical 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(Po.map(e=>[e.id,e]));function Mo(e,t){return bo(e,t)??t}const jo=3600*1e3,Ro=1e3,Lo=1e3,Co=1e3;class Pt{constructor(t){this.capacity=t,this.#e=Array.from({length:t})}capacity;#e;#t=0;#n=0;#r=null;get size(){return this.#n}push(t){const n=this.#n===this.capacity;return this.#r=null,this.#e[this.#t]=t,this.#t=(this.#t+1)%this.capacity,this.#n=Math.min(this.#n+1,this.capacity),n}clear(){this.#r=null,this.#e.fill(void 0),this.#t=0,this.#n=0}newestFirst(){if(this.#r)return this.#r;const t=[];for(let n=0;nthis.#T;getRecentLogs=()=>this.#r.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=t=>(this.#n.add(t),()=>{this.#n.delete(t)});start(){this.#v||(this.tick(),this.#v=setInterval(()=>{this.tick()},1e3))}stop(){this.#v&&(clearInterval(this.#v),this.#v=null),this.#f&&(clearTimeout(this.#f),this.#f=null)}ingest(t,n=this.#e()){const r=this.#b(n);this.#u+=1,Ot(t)?this.#M(t,r):mo(t)?this.#j(t,r):go(t)&&(this.#Z+=1),this.#w()}recordInvalidFrame(){this.#E+=1,this.#w()}recordNativeTop(t,n=this.#e()){const r=this.#b(n),i=this.#m[we];i?.value===t&&r-i.time<15e3||(this.#N(we,r,t),this.#A(r),this.#w())}clearLogs(){this.#$+=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.#a={},this.#c={},this.#o={},this.#h={},this.#d={},this.#m={},this.#p={},this.#l=this.#b(this.#e()),this.#u=0,this.#z=0,this.#k=0,this.#$=0,this.#S=0,this.#Z=0,this.#E=0,this.#I=null,this.#O=null,this.#_=0,this.#y(this.#l),this.flush()}tick(){const t=this.#b(this.#e());this.#y(t),this.#A(t),this.#w()}flush(){this.#f&&(clearTimeout(this.#f),this.#f=null),this.#T=this.#P();for(const t of this.#n)t()}#M(t,n){this.#z+=1,this.#I=n,this.#_+=1,this.#r.push({...t,id:this.#_,receivedAt:n})&&(this.#k+=1),this.#N(At(t.level),n,null)}#j(t,n){this.#S+=1,this.#O=n,this.#_+=1,this.#s.push({...t,id:this.#_,receivedAt:n}),this.#N(Nt(t.event),n,Mo(t.event,t.value))}#b(t){return Number.isFinite(t)?(this.#g=Math.max(this.#g,t),this.#g):this.#g}#N(t,n,r){const i=this.#y(n);i.snapshot=null;const o=i.signals.get(t)??Fo();if(o.count+=1,re(this.#h,t,1),r!==null){o.samples+=1,o.sum+=r,o.minimum=o.minimum===null?r:Math.min(o.minimum,r),o.maximum=o.maximum===null?r:Math.max(o.maximum,r),(o.firstAt===null||n=o.lastAt)&&(o.last=r,o.lastAt=n),re(this.#d,t,r);const s=this.#m[t];(!s||n>=s.time)&&(this.#m[t]={value:r,time:n}),this.#p[t]=Math.max(this.#p[t]??r,r)}i.signals.set(t,o)}#y(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};return this.#i.set(n,i),i}#A(t){const n=t-jo;for(const[r,i]of this.#i){if(r>=n)break;for(const[o,s]of i.signals)if(re(this.#a,o,s.count),re(this.#c,o,s.sum),s.last!==null&&s.lastAt!==null){const a=this.#o[o];(!a||s.lastAt>=a.time)&&(this.#o[o]={value:s.last,time:s.lastAt})}this.#i.delete(r)}}#w(){!this.#t||this.#f||(this.#f=setTimeout(()=>{this.#f=null,this.flush()},Ro))}#P(){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.#b(this.#e()),sessionStartedAt:this.#l,totalFrames:this.#u,totalLogs:this.#z,evictedLogs:this.#k,clearedLogs:this.#$,totalEvents:this.#S,totalAcks:this.#Z,invalidFrames:this.#E,buckets:t,priorSignalCounts:{...this.#a},priorSignalSums:{...this.#c},priorSignalLatest:Mt(this.#o),signalTotals:{...this.#h},signalSums:{...this.#d},signalLatest:Mt(this.#m),signalMaximums:{...this.#p},recentLogs:this.#r.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#I,lastEventAt:this.#O}}}const ie=40;function Do(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(s=>It(t.filter,s.level)&&(!n||s.message.toLowerCase().includes(n)||vo(s.level).name.includes(n))),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,o=Math.min(i,Math.max(0,r.length-ie));return{logs:r.slice(o,o+ie),retained:e.length,matched:r.length,offset:o}}function Uo(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(s=>{const a=ye(s.event);return(t.category==="all"||a.category===t.category)&&(!n||a.name.includes(n)||a.label.toLowerCase().includes(n)||String(s.value).includes(n))}),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,o=Math.min(i,Math.max(0,r.length-ie));return{events:r.slice(o,o+ie),retained:e.length,matched:r.length,offset:o}}function Jo(e,t){const{buckets:n,recentLogs:r,recentEvents:i,...o}=e,s=new Map(t?.buckets.map(a=>[a.time,a]));return{summary:o,reset:t===null,firstBucketTime:n[0]?.time??e.now,buckets:n.filter(a=>s.get(a.time)!==a),recentLogs:r===t?.recentLogs?null:r,recentEvents:i===t?.recentEvents?null:i}}class Ko{constructor(t,n=(i,o)=>new So(i,{logFilter:o}),r=Date.now){this.send=t,this.createClient=n,this.#e=new xo(r,!1)}send;createClient;#e;#t=null;#n=null;#r=0;#s=null;#i=null;#a=null;#c=[];handle(t){if(t.type==="stop"){this.#h(),this.#e.stop(),this.send({type:"stopped"});return}if(t.type==="configure"){if(t.generation{this.#e.ingest(n)}),this.#t.subscribeInvalidFrames(()=>{this.#e.recordInvalidFrame()})],this.#t.start(),this.#e.start()):this.#t.setFilters(t.logFilter,Et);return}if(t.type==="reset"){t.generation>=this.#r&&this.#o(t.generation);return}if(t.generation===this.#r)switch(t.type){case"pause-display":{t.stream==="logs"?this.#i=t.paused?this.#i??this.#e.getRecentLogs():null:this.#a=t.paused?this.#a??this.#e.getRecentEvents():null;break}case"poll-events":{this.send({type:"events",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Uo(this.#a??this.#e.getRecentEvents(),t.query)});break}case"poll-logs":{this.send({type:"logs",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Do(this.#i??this.#e.getRecentLogs(),t.query)});break}case"native-top":{this.#e.recordNativeTop(t.height,t.receivedAt);break}case"clear-logs":{this.#e.clearLogs(),this.#i!==null&&(this.#i=[]);break}case"clear-events":{this.#e.clearEvents(),this.#a!==null&&(this.#a=[]);break}case"poll":{if(!this.#t)return;this.#e.flush();const n=this.#e.getSnapshot();this.send({type:"snapshot",generation:this.#r,requestId:t.requestId,status:this.#t.getStatus(),update:Jo(n,this.#s)}),this.#s=n;break}}}#o(t){this.#r=t,this.#s=null,this.#i!==null&&(this.#i=[]),this.#a!==null&&(this.#a=[]),this.#e.reset()}#h(){for(const t of this.#c)t();this.#c=[],this.#t?.stop(),this.#t=null}}const ze=globalThis,Vo=new Ko(e=>{ze.postMessage(e)});ze.addEventListener("message",e=>{Vo.handle(e.data),e.data.type==="stop"&&ze.close()})})();\n',Wy=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Qb],{type:"text/javascript;charset=utf-8"});function fN(n){let i;try{if(i=Wy&&(self.URL||self.webkitURL).createObjectURL(Wy),!i)throw"";const l=new Worker(i,{name:n?.name});return l.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(i)}),l}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Qb),{name:n?.name})}}const e0=100;function dN(n,i){const l=new Map((i.reset?[]:n.buckets).filter(r=>r.time>=i.firstBucketTime).map(r=>[r.time,r]));for(const r of i.buckets)l.set(r.time,r);return{...i.summary,buckets:[...l.values()],recentLogs:Cc(i.reset?[]:n.recentLogs,i.recentLogs),recentEvents:Cc(i.reset?[]:n.recentEvents,i.recentEvents)}}function Cc(n,i){if(i===null)return n;const l=new Map(n.map(r=>[r.id,r]));return i.map(r=>l.get(r.id)??r)}const To={phase:"idle",attempt:0,reconnects:0,connectedAt:null,lastMessageAt:null,error:null};class hN{constructor(i=()=>new fN){this.createWorker=i}createWorker;#e=null;#t=new oy().getSnapshot();#n=To;#i=new Set;#s=new Set;#a=null;#r=ur;#l=0;#u=0;#o=null;#m=null;#c=null;#d=new Set;#h={logs:[],retained:0,matched:0,offset:0};#p={search:"",filter:ur,offset:0};#f=0;#y=null;#x=null;#g=new Set;#w={events:[],retained:0,matched:0,offset:0};#E={search:"",category:"all",offset:0};#z=0;#b=null;#T=!1;#A=!1;getSnapshot=()=>this.#t;getStatus=()=>this.#n;getLogWindow=()=>this.#h;getEvent)DELIM" -R"DELIM(Window=()=>this.#w;subscribeEvents=i=>(this.#g.add(i),this.#S(),this.#_(),()=>{this.#g.delete(i),this.#g.size===0&&this.#M()});subscribeLogs=i=>(this.#d.add(i),this.#N(),this.#D(),()=>{this.#d.delete(i),this.#d.size===0&&this.#O()});subscribe=i=>(this.#i.add(i),()=>{this.#i.delete(i)});subscribeStatus=i=>(this.#s.add(i),()=>{this.#s.delete(i)});configure(i,l){i===this.#a&&l===this.#r||(this.#a!==null&&i!==this.#a&&(this.reset(),this.#U({...To,phase:"connecting"})),this.#a=i,this.#r=l,this.#C())}start(){if(!(this.#e||this.#a===null))try{const i=this.createWorker();this.#e=i,this.#h={logs:[],retained:0,matched:0,offset:0},this.#w={events:[],retained:0,matched:0,offset:0};for(const l of this.#d)l();for(const l of this.#g)l();this.#U({...To,phase:"connecting"}),i.onmessage=l=>{if(this.#e!==i)return;const r=l.data;if(r.type==="events"){if(r.requestId!==this.#b||(this.#b=null,r.generation!==this.#l))return;if(r.queryVersion!==this.#z){this.#S();return}this.#w={...r.window,events:Cc(this.#w.events,r.window.events)};for(const u of this.#g)u();return}if(r.type==="logs"){if(r.requestId!==this.#y||(this.#y=null,r.generation!==this.#l))return;if(r.queryVersion!==this.#f){this.#N();return}this.#h={...r.window,logs:Cc(this.#h.logs,r.window.logs)};for(const u of this.#d)u();return}if(r.type==="snapshot"&&r.requestId===this.#o&&(this.#o=null,r.generation===this.#l)){this.#t=dN(this.#t,r.update),this.#U(r.status);for(const u of this.#i)u()}},i.onerror=()=>{this.#R("Telemetry worker failed. Reload the dashboard to reconnect.")},i.onmessageerror=()=>{this.#R("Unable to read telemetry worker data. Reload the dashboard to reconnect.")},this.#C(),this.#T&&this.#v({type:"pause-display",generation:this.#l,stream:"logs",paused:!0}),this.#A&&this.#v({type:"pause-display",generation:this.#l,stream:"events",paused:!0}),this.#j(),this.getStatus().error===null&&(this.#m=setInterval(()=>{this.#j()},1e3)),this.#D(),this.#_()}catch(i){this.#R(`Unable to start telemetry worker: ${i instanceof Error?i.message:String(i)}`)}}stop(){this.#k();const i=this.#e;if(this.#e=null,i){const l=setTimeout(()=>{i.terminate()},500),r=()=>{clearTimeout(l),i.terminate()};i.onmessage=u=>{u.data.type==="stopped"&&r()},i.onerror=r,i.onmessageerror=r;try{i.postMessage({type:"stop"})}catch{r()}}this.#U(To)}recordNativeTop(i,l=Date.now()){this.#v({type:"native-top",generation:this.#l,height:i,receivedAt:l})}clearLogs(){this.#v({type:"clear-logs",generation:this.#l}),this.#f+=1,this.#N()}clearEvents(){this.#v({type:"clear-events",generation:this.#l}),this.#z+=1,this.#S()}setLogsPaused(i){i!==this.#T&&(this.#T=i,this.#O(),this.#v({type:"pause-display",generation:this.#l,stream:"logs",paused:i}),this.#f+=1,this.#N(),this.#D())}setEventsPaused(i){i!==this.#A&&(this.#A=i,this.#M(),this.#v({type:"pause-display",generation:this.#l,stream:"events",paused:i}),this.#z+=1,this.#S(),this.#_())}reset(){this.#l+=1,this.#o=null,this.#y=null,this.#b=null,this.#h={logs:[],retained:0,matched:0,offset:0},this.#w={events:[],retained:0,matched:0,offset:0},this.#t=new oy().getSnapshot(),this.#v({type:"reset",generation:this.#l});for(const i of this.#i)i();for(const i of this.#d)i();for(const i of this.#g)i()}setLogQuery(i){JSON.stringify(i)!==JSON.stringify(this.#p)&&(this.#p=i,this.#f+=1,this.#N())}setEventQuery(i){JSON.stringify(i)!==JSON.stringify(this.#E)&&(this.#E=i,this.#z+=1,this.#S())}#_(){!this.#e||this.#g.size===0||this.#x||this.#A||(this.#S(),this.getStatus().error===null&&(this.#x=setInterval(()=>{this.#S()},e0)))}#S(){this.#b!==null||!this.#e||this.#g.size===0||(this.#b=++this.#u,this.#v({type:"poll-events",generation:this.#l,requestId:this.#b,queryVersion:this.#z,query:this.#E}))}#M(){this.#x&&clearInterval(this.#x),this.#x=null,this.#b=null}#D(){!this.#e||this.#d.size===0||this.#c||this.#T||(this.#N(),this.getStatus().error===null&&(this.#c=setInterval(()=>{this.#N()},e0)))}#N(){this.#y!==null||!this.#e||this.#d.size===0||(this.#y=++this.#u,this.#v({type:"poll-logs",generation:this.#l,requestId:this.#y,queryVersion:this.#f,query:this.#p}))}#O(){this.#c&&clearInterval(this.#c),this.#c=null,this.#y=null}#C(){this.#a!==null&&this.#v({type:"configure",generation:this.#l,endpoint:this.#a,logFilter:this.#r})}#j(){this.#o!==null||!this.#e||(this.#o=++this.#u,this.#v({type:"poll",generation:this.#l,requestId:this.#o}))}#v(i){try{this.#e?.postMessage(i)}catch{this.#R("Unable to communicate with telemetry worker. Reload the dashboard to reconnect.")}}#k(){this.#O(),this.#M(),this.#m&&clearInterval(this.#m),this.#m=null,this.#o=null}#R(i){this.#k(),this.#e?.terminate(),this.#e=null,this.#U({...To,error:i})}#U(i){if(JSON.stringify(i)!==JSON.stringify(this.#n)){this.#n=i;for(const l of this.#s)l()}}}const Kb="libbitcoinAdminDashboardLogFilter";function Fb(){try{return globalThis.localStorage}catch{return null}}function mN(n=Fb()){try{const i=n?.getItem(Kb);if(!i)return ur;const l=JSON.parse(i);return typeof l=="number"&&Number.isInteger(l)&&l>=0&&l<=Jh?l:ur}catch{return ur}}function pN(n,i=Fb()){try{i?.setItem(Kb,String(n))}catch{}}var Bo=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(){}},gN=class extends Bo{#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"}},pm=new gN,vN={setTimeout:(n,i)=>setTimeout(n,i),clearTimeout:n=>clearTimeout(n),setInterval:(n,i)=>setInterval(n,i),clearInterval:n=>clearInterval(n)},yN=class{#e=vN;#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)}},us=new yN;function bN(n){setTimeout(n,0)}var _N=typeof window>"u"||"Deno"in globalThis;function Pn(){}function SN(n,i){return typeof n=="function"?n(i):n}function Th(n){return typeof n=="number"&&n>=0&&n!==1/0}function Jb(n,i){return Math.max(n+(i||0)-Date.now(),0)}function Tl(n,i){return typeof n=="function"?n(i):n}function di(n,i){return typeof n=="function"?n(i):n}function t0(n,i){const{type:l="all",exact:r,fetchStatus:u,predicate:d,queryKey:f,stale:p}=n;if(f){if(r){if(i.queryHash!==gm(f,i.options))return!1}else if(!vr(i.queryKey,f))return!1}if(l!=="all"){const m=i.isActive();if(l==="active"&&!m||l==="inactive"&&m)return!1}return!(typeof p=="boolean"&&i.isStale()!==p||u&&u!==i.state.fetchStatus||d&&!d(i))}function n0(n,i){const{exact:l,status:r,predicate:u,mutationKey:d}=n;if(d){if(!i.options.mutationKey)return!1;if(l){if(Zo(i.options.mutationKey)!==Zo(d))return!1}else if(!vr(i.options.mutationKey,d))return!1}return!(r&&i.state.status!==r||u&&!u(i))}function gm(n,i){return(i?.queryKeyHashFn||Zo)(n)}function Zo(n){return JSON.stringify(n,(i,l)=>Nh(l)?Object.keys(l).sort().reduce((r,u)=>(r[u]=l[u],r),{}):l)}function vr(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)){for(let r=0;r500)return i;const r=i0(n)&&i0(i);if(!r&&!(Nh(n)&&Nh(i)))return i;const d=(r)DELIM" -R"DELIM(?n:Object.keys(n)).length,f=r?i:Object.keys(i),p=f.length,m=r?new Array(p):{};let v=0;for(let w=0;w{us.setTimeout(i,n)})}function Oh(n,i,l){return typeof l.structuralSharing=="function"?l.structuralSharing(n,i):l.structuralSharing!==!1?Xb(n,i):i}function zN(n,i,l=0){const r=[...n,i];return l&&r.length>l?r.slice(1):r}function EN(n,i,l=0){const r=[i,...n];return l&&r.length>l?r.slice(0,-1):r}var vm=Symbol();function Ib(n,i){return!n.queryFn&&i?.initialPromise?()=>i.initialPromise:!n.queryFn||n.queryFn===vm?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function Pb(n,i){return typeof n=="function"?n(...i):!!n}function TN(n,i,l){let r=!1,u;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(u??=i(),r||(r=!0,u.aborted?l():u.addEventListener("abort",l,{once:!0})),u)}),n}var $o=(()=>{let n=()=>_N;return{isServer(){return n()},setIsServer(i){n=i}}})();function Mh(){let n,i;const l=new Promise((u,d)=>{n=u,i=d});l.status="pending",l.catch(()=>{});function r(u){Object.assign(l,u),delete l.resolve,delete l.reject}return l.resolve=u=>{r({status:"fulfilled",value:u}),n(u)},l.reject=u=>{r({status:"rejected",reason:u}),i(u)},l}var AN=bN;function NN(){let n=[],i=0,l=p=>{p()},r=p=>{p()},u=AN;const d=p=>{i?n.push(p):u(()=>{l(p)})},f=()=>{const p=n;n=[],p.length&&u(()=>{r(()=>{p.forEach(m=>{l(m)})})})};return{batch:p=>{let m;i++;try{m=p()}finally{i--,i||f()}return m},batchCalls:p=>(...m)=>{d(()=>{p(...m)})},schedule:d,setNotifyFunction:p=>{l=p},setBatchNotifyFunction:p=>{r=p},setScheduler:p=>{u=p}}}var _n=NN(),ON=class extends Bo{#e=!0;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n(!0),l=()=>n(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",l,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",l)}}}}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(l=>{l(n)}))}isOnline(){return this.#e}},Dc=new ON;function MN(n){return Math.min(1e3*2**n,3e4)}function Wb(n){return(n??"online")==="online"?Dc.isOnline():!0}var jh=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function e1(n){let i=!1,l=0,r;const u=Mh(),d=()=>u.status!=="pending",f=L=>{if(!d()){const V=new jh(L);z(V),n.onCancel?.(V)}},p=()=>{i=!0},m=()=>{i=!1},v=()=>pm.isFocused()&&(n.networkMode==="always"||Dc.isOnline())&&n.canRun(),w=()=>Wb(n.networkMode)&&n.canRun(),S=L=>{d()||(r?.(),u.resolve(L))},z=L=>{d()||(r?.(),u.reject(L))},T=()=>new Promise(L=>{r=V=>{(d()||v())&&L(V)},n.onPause?.()}).then(()=>{r=void 0,d()||n.onContinue?.()}),j=()=>{if(d())return;let L;const V=l===0?n.initialPromise:void 0;try{L=V??n.fn()}catch(H){L=Promise.reject(H)}Promise.resolve(L).then(S).catch(H=>{if(d())return;const G=n.retry??($o.isServer()?0:3),W=n.retryDelay??MN,B=typeof W=="function"?W(l,H):W,ne=G===!0||typeof G=="number"&&lv()?void 0:T()).then(()=>{i?z(H):j()})})};return{promise:u,status:()=>u.status,cancel:f,continue:()=>(r?.(),u),cancelRetry:p,continueRetry:m,canStart:w,start:()=>(w()?j():T().then(j),u)}}var t1=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Th(this.gcTime)&&(this.#e=us.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??($o.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(us.clearTimeout(this.#e),this.#e=void 0)}};function jN(n){return{onFetch:(i,l)=>{const r=i.options,u=i.fetchOptions?.meta?.fetchMore?.direction,d=i.state.data?.pages||[],f=i.state.data?.pageParams||[];let p={pages:[],pageParams:[]},m=0;const v=async()=>{let w=!1;const S=j=>{TN(j,()=>i.signal,()=>w=!0)},z=Ib(i.options,i.fetchOptions),T=async(j,L,V)=>{if(w)return Promise.reject(i.signal.reason);if(L==null&&j.pages.length)return Promise.resolve(j);const G=(()=>{const ee={client:i.client,queryKey:i.queryKey,pageParam:L,direction:V?"backward":"forward",meta:i.options.meta};return S(ee),ee})(),W=await z(G),{maxPages:B}=i.options,ne=V?EN:zN;return{pages:ne(j.pages,W,B),pageParams:ne(j.pageParams,L,B)}};if(u&&d.length){const j=u==="backward",L=j?kN:l0,V={pages:d,pageParams:f},H=L(r,V);p=await T(V,H,j)}else{const j=n??d.length;do{const L=m===0?f[0]??r.initialPageParam:l0(r,p);if(m>0&&L==null)break;p=await T(p,L),m++}while(mi.options.persister?.(v,{client:i.client,queryKey:i.queryKey,meta:i.options.meta,signal:i.signal},l):i.fetchFn=v}}}function l0(n,{pages:i,pageParams:l}){const r=i.length-1;return i.length>0?n.getNextPageParam(i[r],i,l[r],l):void 0}function kN(n,{pages:i,pageParams:l}){return i.length>0?n.getPreviousPageParam?.(i[0],i,l[0],l):void 0}var RN=class extends t1{#e;#t;#n;#i;#s;#a;#r;#l;constructor(n){super(),this.#l=!1,this.#r=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=r0(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.#a?.promise}setOptions(n){if(this.options={...this.#r,...n},n?._type&&(this.#e=n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=r0(this.options);i.data!==void 0&&(this.setState(s0(i.data,i.dataUpdatedAt)),this.#t=i)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(n,i){const l=Oh(this.state.data,n,this.options);return this.#o({data:l,type:"success",dataUpdatedAt:i?.updatedAt,manual:i?.manual}),l}setState(n){this.#o({type:"setState",state:n})}cancel(n){const i=this.#a?.promise;return this.#a?.cancel(n),i?i.then(Pn).catch(Pn):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=>di(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vm||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(n=>Tl(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:!Jb(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(i=>i.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(i=>i.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){this.observers.includes)DELIM" -R"DELIM((n)&&(this.observers=this.observers.filter(i=>i!==n),this.observers.length||(this.#a&&(this.#l||this.#u()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(n,i){if(this.state.fetchStatus!=="idle"&&this.#a?.status()!=="rejected"){if(this.state.data!==void 0&&i?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(n&&this.setOptions(n),!this.options.queryFn){const m=this.observers.find(v=>v.options.queryFn);m&&this.setOptions(m.options)}const l=new AbortController,r=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(this.#l=!0,l.signal)})},u=()=>{const m=Ib(this.options,i),w=(()=>{const S={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(S),S})();return this.#l=!1,this.options.persister?this.options.persister(m,w,this):m(w)},f=(()=>{const m={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:u};return r(m),m})();(this.#e==="infinite"?jN(this.options.pages):this.options.behavior)?.onFetch(f,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==f.fetchOptions?.meta)&&this.#o({type:"fetch",meta:f.fetchOptions?.meta}),this.#a=e1({initialPromise:i?.initialPromise,fn:f.fetchFn,onCancel:m=>{m instanceof jh&&m.revert&&this.setState({...this.#n,fetchStatus:"idle"}),l.abort()},onFail:(m,v)=>{this.#o({type:"failed",failureCount:m,error:v})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0});try{const m=await this.#a.start();if(m===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(m),this.#i.config.onSuccess?.(m,this),this.#i.config.onSettled?.(m,this.state.error,this),m}catch(m){if(m instanceof jh){if(m.silent)return this.#a.promise;if(m.revert){if(this.state.data===void 0)throw m;return this.state.data}}throw this.#o({type:"error",error:m}),this.#i.config.onError?.(m,this),this.#i.config.onSettled?.(this.state.data,m,this),m}finally{this.scheduleGc()}}#o(n){const i=l=>{switch(n.type){case"failed":return{...l,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...l,fetchStatus:"paused"};case"continue":return{...l,fetchStatus:"fetching"};case"fetch":return{...l,...n1(l.data,this.options),fetchMeta:n.meta??null};case"success":const r={...l,...s0(n.data,n.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=n.manual?r:void 0,r;case"error":const u=n.error;return{...l,error:u,errorUpdateCount:l.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:l.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...l,isInvalidated:!0};case"setState":return{...l,...n.state}}};this.state=i(this.state),_n.batch(()=>{this.observers.forEach(l=>{l.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:n})})}};function n1(n,i){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wb(i.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function s0(n,i){return{data:n,dataUpdatedAt:i??Date.now(),error:null,isInvalidated:!1,status:"success"}}function r0(n){const i=typeof n.initialData=="function"?n.initialData():n.initialData,l=i!==void 0,r=l?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:i,dataUpdateCount:0,dataUpdatedAt:l?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:l?"success":"pending",fetchStatus:"idle"}}var CN=class extends Bo{constructor(n,i){super(),this.options=i,this.#e=n,this.#l=null,this.#r=Mh(),this.bindMethods(),this.setOptions(i)}#e;#t=void 0;#n=void 0;#i=void 0;#s;#a;#r;#l;#u;#o;#m;#c;#d;#h;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),o0(this.#t,this.options)?this.#f():this.updateResult(),this.#w())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return kh(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return kh(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#E(),this.#z(),this.#t.removeObserver(this)}setOptions(n){const i=this.options,l=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 di(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#b(),this.#t.setOptions(this.options),i._defaulted&&!Ah(this.options,i)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&u0(this.#t,l,this.options,i)&&this.#f(),this.updateResult(),r&&(this.#t!==l||di(this.options.enabled,this.#t)!==di(i.enabled,this.#t)||Tl(this.options.staleTime,this.#t)!==Tl(i.staleTime,this.#t))&&this.#y();const u=this.#x();r&&(this.#t!==l||di(this.options.enabled,this.#t)!==di(i.enabled,this.#t)||u!==this.#h)&&this.#g(u)}getOptimisticResult(n){const i=this.#e.getQueryCache().build(this.#e,n),l=this.createResult(i,n);return UN(this,l)&&(this.#i=l,this.#a=this.options,this.#s=this.#t.state),l}getCurrentResult(){return this.#i}trackResult(n,i){return new Proxy(n,{get:(l,r)=>(this.trackProp(r),i?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(l,r))})}trackProp(n){this.#p.add(n)}getCurrentQuery(){return this.#t}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const i=this.#e.defaultQueryOptions(n),l=this.#e.getQueryCache().build(this.#e,i);return l.fetch().then(()=>this.createResult(l,i))}fetch(n){return this.#f({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#f(n){this.#b();let i=this.#t.fetch(this.options,n);return n?.throwOnError||(i=i.catch(Pn)),i}#y(){this.#E();const n=Tl(this.options.staleTime,this.#t);if($o.isServer()||this.#i.isStale||!Th(n))return;const l=Jb(this.#i.dataUpdatedAt,n)+1;this.#c=us.setTimeout(()=>{this.#i.isStale||this.updateResult()},l)}#x(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#g(n){this.#z(),this.#h=n,!($o.isServer()||di(this.options.enabled,this.#t)===!1||!Th(this.#h)||this.#h===0)&&(this.#d=us.setInterval(()=>{(this.options.refetchIntervalInBackground||pm.isFocused())&&this.#f()},this.#h))}#w(){this.#y(),this.#g(this.#x())}#E(){this.#c!==void 0&&(us.clearTimeout(this.#c),this.#c=void 0)}#z(){this.#d!==void 0&&(us.clearInterval(this.#d),this.#d=void 0)}createResult(n,i){const l=this.#t,r=this.options,u=this.#i,d=this.#s,f=this.#a,m=n!==l?n.state:this.#n,{state:v}=n;let w={...v},S=!1,z;if(i._optimisticResults){const le=this.hasListeners(),ze=!le&&o0(n,i),ve=le&&u0(n,l,i,r);(ze||ve)&&(w={...w,...n1(v.data,n.options)}),i._optimisticResults==="isRestoring"&&(w.fetchStatus="idle")}let{error:T,errorUpdatedAt:j,status:L}=w;z=w.data;let V=!1;if(i.placeholderData!==void 0&&z===void 0&&L==="pending"){let le;u?.isPlaceholderData&&i.placeholderData===f?.placeholderData?(le=u.data,V=!0):le=typeof i.placeholderData=="function"?i.placeholderData(this.#m?.state.data,this.#m):i.placeholderData,le!==void 0&&(L="success",z=Oh(u?.data,le,i),S=!0)}if(i.se)DELIM" -R"DELIM(lect&&z!==void 0&&!V)if(u&&z===d?.data&&i.select===this.#u)z=this.#o;else try{this.#u=i.select,z=i.select(z),z=Oh(u?.data,z,i),this.#o=z,this.#l=null}catch(le){this.#l=le}this.#l&&(T=this.#l,z=this.#o,j=Date.now(),L="error");const H=w.fetchStatus==="fetching",G=L==="pending",W=L==="error",B=G&&H,ne=z!==void 0,K={status:L,fetchStatus:w.fetchStatus,isPending:G,isSuccess:L==="success",isError:W,isInitialLoading:B,isLoading:B,data:z,dataUpdatedAt:w.dataUpdatedAt,error:T,errorUpdatedAt:j,failureCount:w.fetchFailureCount,failureReason:w.fetchFailureReason,errorUpdateCount:w.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:w.dataUpdateCount>m.dataUpdateCount||w.errorUpdateCount>m.errorUpdateCount,isFetching:H,isRefetching:H&&!G,isLoadingError:W&&!ne,isPaused:w.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:W&&ne,isStale:ym(n,i),refetch:this.refetch,promise:this.#r,isEnabled:di(i.enabled,n)!==!1};if(this.options.experimental_prefetchInRender){const le=K.data!==void 0,ze=K.status==="error"&&!le,ve=ce=>{ze?ce.reject(K.error):le&&ce.resolve(K.data)},ie=()=>{const ce=this.#r=K.promise=Mh();ve(ce)},_e=this.#r;switch(_e.status){case"pending":n.queryHash===l.queryHash&&ve(_e);break;case"fulfilled":(ze||K.data!==_e.value)&&ie();break;case"rejected":(!ze||K.error!==_e.reason)&&ie();break}}return K}updateResult(){const n=this.#i,i=this.createResult(this.#t,this.options);if(this.#s=this.#t.state,this.#a=this.options,this.#s.data!==void 0&&(this.#m=this.#t),Ah(i,n))return;this.#i=i;const l=()=>{if(!n)return!0;const{notifyOnChangeProps:r}=this.options,u=typeof r=="function"?r():r;if(u==="all"||!u&&!this.#p.size)return!0;const d=new Set(u??this.#p);return this.options.throwOnError&&d.add("error"),Object.keys(this.#i).some(f=>{const p=f;return this.#i[p]!==n[p]&&d.has(p)})};this.#T({listeners:l()})}#b(){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.#w()}#T(n){_n.batch(()=>{n.listeners&&this.listeners.forEach(i=>{i(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function DN(n,i){return di(i.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&di(i.retryOnMount,n)===!1)}function o0(n,i){return DN(n,i)||n.state.data!==void 0&&kh(n,i,i.refetchOnMount)}function kh(n,i,l){if(di(i.enabled,n)!==!1&&Tl(i.staleTime,n)!=="static"){const r=typeof l=="function"?l(n):l;return r==="always"||r!==!1&&ym(n,i)}return!1}function u0(n,i,l,r){return(n!==i||di(r.enabled,n)===!1)&&(!l.suspense||n.state.status!=="error")&&ym(n,l)}function ym(n,i){return di(i.enabled,n)!==!1&&n.isStaleByTime(Tl(i.staleTime,n))}function UN(n,i){return!Ah(n.getCurrentResult(),i)}var ZN=class extends t1{#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||$N(),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.execute(this.state.variables)}async execute(n){const i=()=>{this.#s({type:"continue"})},l={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=e1({fn:()=>this.options.mutationFn?this.options.mutationFn(n,l):Promise.reject(new Error("No mutationFn found")),onFail:(d,f)=>{this.#s({type:"failed",failureCount:d,error:f})},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)});const r=this.state.status==="pending",u=!this.#i.canStart();try{if(r)i();else{this.#s({type:"pending",variables:n,isPaused:u}),this.#n.config.onMutate&&await this.#n.config.onMutate(n,this,l);const f=await this.options.onMutate?.(n,l);f!==this.state.context&&this.#s({type:"pending",context:f,variables:n,isPaused:u})}const d=await this.#i.start();return await this.#n.config.onSuccess?.(d,n,this.state.context,this,l),await this.options.onSuccess?.(d,n,this.state.context,l),await this.#n.config.onSettled?.(d,null,this.state.variables,this.state.context,this,l),await this.options.onSettled?.(d,null,n,this.state.context,l),this.#s({type:"success",data:d}),d}catch(d){try{await this.#n.config.onError?.(d,n,this.state.context,this,l)}catch(f){Promise.reject(f)}try{await this.options.onError?.(d,n,this.state.context,l)}catch(f){Promise.reject(f)}try{await this.#n.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,l)}catch(f){Promise.reject(f)}try{await this.options.onSettled?.(void 0,d,n,this.state.context,l)}catch(f){Promise.reject(f)}throw this.#s({type:"error",error:d}),d}finally{this.#n.runNext(this)}}#s(n){const i=l=>{switch(n.type){case"failed":return{...l,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...l,isPaused:!0};case"continue":return{...l,isPaused:!1};case"pending":return{...l,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{...l,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...l,data:void 0,error:n.error,failureCount:l.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=i(this.state),_n.batch(()=>{this.#t.forEach(l=>{l.onMutationUpdate(n)}),this.#n.notify({mutation:this,type:"updated",action:n})})}};function $N(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var LN=class extends Bo{constructor(n={}){super(),this.config=n,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(n,i,l){const r=new ZN({client:n,mutationCache:this,mutationId:++this.#n,options:n.defaultMutationOptions(i),state:l});return this.add(r),r}add(n){this.#e.add(n);const i=vc(n);if(typeof i=="string"){const l=this.#t.get(i);l?l.push(n):this.#t.set(i,[n])}this.notify({type:"added",mutation:n})}remove(n){if(this.#e.delete(n)){const i=vc(n);if(typeof i=="string"){const l=this.#t.get(i);if(l)if(l.length>1){const r=l.indexOf(n);r!==-1&&l.splice(r,1)}else l[0]===n&&this.#t.delete(i)}}this.notify({type:"removed",mutation:n})}canRun(n){const i=vc(n);if(typeof i=="string"){const r=this.#t.get(i)?.find(u=>u.state.status==="pending");return!r||r===n}else return!0}runNext(n){const i=vc(n);return typeof i=="string"?this.#t.get(i)?.find(r=>r!==n&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){_n.batch(()=>{this.#e.forEach(n=>{this.notify({type:"removed",mutation:n})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(n){const i={exact:!0,...n};return this.getAll().find(l=>n0(i,l))}findAll(n={}){return this.getAll().filter(i=>n0(n,i))}notify(n){_n.batch(()=>{this.listeners.forEach(i=>{i(n)})})}resumePausedMutations(){const n=this.getAll().filter(i=>i.state.isPaused);return _n.batch(()=>Promise.all(n.map(i=>i.continue().catch(Pn))))}};function vc(n){return n.options.scope?.id}var HN=class extends Bo{constructor(n={}){super(),this.config=n,this.#e=new Map}#e;build(n,i,l){const r=i.queryKey,u=i.queryHash??gm(r,i);let d=this.get(u);return d||(d=new RN({client:n,queryKey:r,queryHash:u,options:n.defaultQueryOptions(i),state:l,defaultOptions:n.getQueryDefaults(r)}),this.add(d)),d}add(n){this.#e.has(n.queryHash)||(this.#e.set(n.queryHash,n),this.notify({typ)DELIM" -R"DELIM(e:"added",query:n}))}remove(n){const i=this.#e.get(n.queryHash);i&&(n.destroy(),i===n&&this.#e.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){_n.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(l=>t0(i,l))}findAll(n={}){const i=this.getAll();return Object.keys(n).length>0?i.filter(l=>t0(n,l)):i}notify(n){_n.batch(()=>{this.listeners.forEach(i=>{i(n)})})}onFocus(){_n.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){_n.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},qN=class{#e;#t;#n;#i;#s;#a;#r;#l;constructor(n={}){this.#e=n.queryCache||new HN,this.#t=n.mutationCache||new LN,this.#n=n.defaultOptions||{},this.#i=new Map,this.#s=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#r=pm.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#l=Dc.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#r?.(),this.#r=void 0,this.#l?.(),this.#l=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),l=this.#e.build(this,i),r=l.state.data;return r===void 0?this.fetchQuery(n):(n.revalidateIfStale&&l.isStaleByTime(Tl(i.staleTime,l))&&this.prefetchQuery(i),Promise.resolve(r))}getQueriesData(n){return this.#e.findAll(n).map(({queryKey:i,state:l})=>{const r=l.data;return[i,r]})}setQueryData(n,i,l){const r=this.defaultQueryOptions({queryKey:n}),d=this.#e.get(r.queryHash)?.state.data,f=SN(i,d);if(f!==void 0)return this.#e.build(this,r).setData(f,{...l,manual:!0})}setQueriesData(n,i,l){return _n.batch(()=>this.#e.findAll(n).map(({queryKey:r})=>[r,this.setQueryData(r,i,l)]))}getQueryState(n){const i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state}removeQueries(n){const i=this.#e;_n.batch(()=>{i.findAll(n).forEach(l=>{i.remove(l)})})}resetQueries(n,i){const l=this.#e;return _n.batch(()=>(l.findAll(n).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...n},i)))}cancelQueries(n,i={}){const l={revert:!0,...i},r=_n.batch(()=>this.#e.findAll(n).map(u=>u.cancel(l)));return Promise.all(r).then(Pn).catch(Pn)}invalidateQueries(n,i={}){return _n.batch(()=>(this.#e.findAll(n).forEach(l=>{l.invalidate()}),n?.refetchType==="none"?Promise.resolve():this.refetchQueries({...n,type:n?.refetchType??n?.type??"active"},i)))}refetchQueries(n,i={}){const l={...i,cancelRefetch:i.cancelRefetch??!0},r=_n.batch(()=>this.#e.findAll(n).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let d=u.fetch(void 0,l);return l.throwOnError||(d=d.catch(Pn)),u.state.fetchStatus==="paused"?Promise.resolve():d}));return Promise.all(r).then(Pn)}fetchQuery(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const l=this.#e.build(this,i);return l.isStaleByTime(Tl(i.staleTime,l))?l.fetch(i):Promise.resolve(l.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(Pn).catch(Pn)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(Pn).catch(Pn)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return Dc.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(Zo(n),{queryKey:n,defaultOptions:i})}getQueryDefaults(n){const i=[...this.#i.values()],l={};return i.forEach(r=>{vr(n,r.queryKey)&&Object.assign(l,r.defaultOptions)}),l}setMutationDefaults(n,i){this.#s.set(Zo(n),{mutationKey:n,defaultOptions:i})}getMutationDefaults(n){const i=[...this.#s.values()],l={};return i.forEach(r=>{vr(n,r.mutationKey)&&Object.assign(l,r.defaultOptions)}),l}defaultQueryOptions(n){if(n._defaulted)return n;const i={...this.#n.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return i.queryHash||(i.queryHash=gm(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===vm&&(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()}},i1=re.createContext(void 0),BN=n=>{const i=re.useContext(i1);if(!i)throw new Error("No QueryClient set, use QueryClientProvider to set one");return i},VN=({client:n,children:i})=>(re.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),_.jsx(i1.Provider,{value:n,children:i})),a1=re.createContext(!1),GN=()=>re.useContext(a1);a1.Provider;function YN(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var QN=re.createContext(YN()),KN=()=>re.useContext(QN),FN=(n,i,l)=>{const r=l?.state.error&&typeof n.throwOnError=="function"?Pb(n.throwOnError,[l.state.error,l]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||r)&&(i.isReset()||(n.retryOnMount=!1))},JN=n=>{re.useEffect(()=>{n.clearReset()},[n])},XN=({result:n,errorResetBoundary:i,throwOnError:l,query:r,suspense:u})=>n.isError&&!i.isReset()&&!n.isFetching&&r&&(u&&n.data===void 0||Pb(l,[n.error,r])),IN=n=>{if(n.suspense){const l=u=>u==="static"?u:Math.max(u??1e3,1e3),r=n.staleTime;n.staleTime=typeof r=="function"?(...u)=>l(r(...u)):l(r),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},PN=(n,i)=>n.isLoading&&n.isFetching&&!i,WN=(n,i)=>n?.suspense&&i.isPending,c0=(n,i,l)=>i.fetchOptimistic(n).catch(()=>{l.clearReset()});function eO(n,i,l){const r=GN(),u=KN(),d=BN(),f=d.defaultQueryOptions(n);d.getDefaultOptions().queries?._experimental_beforeQuery?.(f);const p=d.getQueryCache().get(f.queryHash),m=n.subscribed!==!1;f._optimisticResults=r?"isRestoring":m?"optimistic":void 0,IN(f),FN(f,u,p),JN(u);const v=!d.getQueryCache().get(f.queryHash),[w]=re.useState(()=>new i(d,f)),S=w.getOptimisticResult(f),z=!r&&m;if(re.useSyncExternalStore(re.useCallback(T=>{const j=z?w.subscribe(_n.batchCalls(T)):Pn;return w.updateResult(),j},[w,z]),()=>w.getCurrentResult(),()=>w.getCurrentResult()),re.useEffect(()=>{w.setOptions(f)},[f,w]),WN(f,S))throw c0(f,w,u);if(XN({result:S,errorResetBoundary:u,throwOnError:f.throwOnError,query:p,suspense:f.suspense}))throw S.error;return d.getDefaultOptions().queries?._experimental_afterQuery?.(f,S),f.experimental_prefetchInRender&&!$o.isServer()&&PN(S,r)&&(v?c0(f,w,u):p?.promise)?.catch(Pn).finally(()=>{w.updateResult()}),f.notifyOnChangeProps?S:w.trackResult(S)}function tO(n,i){return eO(n,CN)}const l1=Ml({address:nr(),filter:nr(),turbo:nr(),witness:nr(),retarget:nr(),difficult:nr(),pruned:ra().int().nonnegative()}),s1=Ml({height:ra().int().nonnegative(),timestamp:ra().int().positive().max(4294967295)}),r1=ra().int().nonnegative();function nO(n){try{const i=JSON.parse(n),l=l1.safeParse(i);if(l.success)return{type:"configuration",payload:l.data};const r=s1.safeParse(i);if(r.success)return{type:"header",payload:r.data};const u=r1.safeParse(i);return u.success?{type:"top",payload:u.data}:null}catch{return null}}function rh(n,i){return new URL(i,`${n.replace(/\/+$/u,"")}/`).toString()}async function oh(n,i){const l=await fetch(n,{headers:{Accept:"application/json"},signal:i});if(!l.ok)throw new Error(`Native API request failed with status ${String(l.status)}`);return await l.json()}async function iO(n,i){const[l,r]=await Promise.all([oh(rh(n,"/v1/configuration?format=json"),i),oh(rh(n,"/v1/top?format=json"),i)]),u=l1.parse(l),d=r1.parse(r),f=Date.now();let p=null;try{const m=s1.parse(await oh(rh(n,o1(d)),i));m.height===d&&)DELIM" -R"DELIM((p=m)}catch{i?.throwIfAborted()}return{configuration:u,top:d,topHeader:p,receivedAt:f}}function o1(n){return`/v1/block/height/${String(n)}/header?format=json`}const f0={phase:"idle",attempt:0,reconnects:0,connectedAt:null,lastMessageAt:null,error:null};class aO{#e;#t=f0;#n=null;#i=new Set;#s=null;#a=null;#r=null;#l;#u=!1;constructor(i){this.#e={...i,connectTimeoutMs:i.connectTimeoutMs??5e3,retryMinimumMs:i.retryMinimumMs??1e3,retryMaximumMs:i.retryMaximumMs??3e4,heartbeatMs:i.heartbeatMs??24e4,jitterRatio:i.jitterRatio??.2,now:i.now??Date.now,random:i.random??Math.random,webSocketFactory:i.webSocketFactory??(l=>new WebSocket(l))},this.#l=this.#e.retryMinimumMs}getStatus=()=>this.#t;subscribeStatus=i=>(this.#i.add(i),()=>{this.#i.delete(i)});start(){this.#u||(this.#u=!0,this.#l=this.#e.retryMinimumMs,this.#o())}stop(){this.#u=!1,this.#p();const i=this.#n;if(this.#n=null,i)try{i.readyState===1&&this.#e.onBeforeStop?.(i),i.close()}catch{}this.#f(f0)}send(i){if(this.#n?.readyState!==1)return!1;try{return this.#n.send(i),!0}catch{return!1}}#o(){if(!this.#u||this.#n)return;const i=this.#t.reconnects>0;this.#f({...this.#t,phase:i?"reconnecting":"connecting",attempt:this.#t.attempt+1,error:null});let l;try{l=this.#e.webSocketFactory(this.#e.url),this.#n=l}catch(r){this.#f({...this.#t,error:sO(r)}),this.#m();return}this.#s=setTimeout(()=>{if(this.#n===l){this.#f({...this.#t,error:"Connection timed out"});try{l.close()}catch{this.#n=null,this.#m()}}},this.#e.connectTimeoutMs),l.addEventListener("open",()=>{this.#n!==l||!this.#u||(this.#d(),this.#l=this.#e.retryMinimumMs,this.#f({...this.#t,phase:"connected",connectedAt:this.#e.now(),error:null}),this.#e.onOpen?.(l),this.#c(l))}),l.addEventListener("message",r=>{if(this.#n!==l||!this.#u)return;const u=lO(r.data);if(u===null)return;const d=this.#e.now();(this.#t.lastMessageAt===null||d-this.#t.lastMessageAt>=1e3)&&this.#f({...this.#t,lastMessageAt:d}),this.#e.onMessage(u)}),l.addEventListener("error",()=>{if(!(this.#n!==l||!this.#u)){this.#f({...this.#t,error:"WebSocket connection failed"});try{l.close()}catch{this.#n=null,this.#m()}}}),l.addEventListener("close",()=>{this.#n===l&&(this.#n=null,this.#d(),this.#h(),this.#u&&this.#m())})}#m(){if(!this.#u||this.#a)return;const i=1+(this.#e.random()*2-1)*this.#e.jitterRatio,l=Math.max(0,Math.round(this.#l*i));this.#l=Math.min(this.#l*2,this.#e.retryMaximumMs),this.#f({...this.#t,phase:"reconnecting",reconnects:this.#t.reconnects+1,connectedAt:null}),this.#a=setTimeout(()=>{this.#a=null,this.#o()},l)}#c(i){this.#h(),!(!this.#e.onHeartbeat||this.#e.heartbeatMs<=0)&&(this.#r=setInterval(()=>{this.#n===i&&i.readyState===1&&this.#e.onHeartbeat?.(i)},this.#e.heartbeatMs))}#d(){this.#s&&(clearTimeout(this.#s),this.#s=null)}#h(){this.#r&&(clearInterval(this.#r),this.#r=null)}#p(){this.#d(),this.#h(),this.#a&&(clearTimeout(this.#a),this.#a=null)}#f(i){this.#t=i;for(const l of this.#i)l()}}function lO(n){return typeof n=="string"?n:n instanceof ArrayBuffer?new TextDecoder().decode(n):null}function sO(n){return n instanceof Error?n.message:"Unable to create WebSocket"}const bm=15e3,Rh=3*bm,d0={configuration:null,configurationReceivedAt:null,top:null,topReceivedAt:null,topHeader:null,headerReceivedAt:null,invalidFrames:0};class rO{#e=d0;#t=new Set;#n;#i;#s=null;#a=null;#r=null;#l;constructor(i,l={}){this.#i=l.now??Date.now,this.#l=l.pollIntervalMs??bm,this.#n=new aO({url:Q_(i),webSocketFactory:l.webSocketFactory,retryMinimumMs:l.retryMinimumMs,retryMaximumMs:l.retryMaximumMs,jitterRatio:l.jitterRatio,heartbeatMs:this.#l,now:this.#i,onOpen:r=>{this.#s=this.#i(),r.send("/v1/configuration?format=json"),r.send("/v1/top/subscribe?format=json")},onHeartbeat:r=>{const u=this.#e.topReceivedAt??this.#s;if(u!==null&&this.#i()-u>=Rh){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 u=nO(r);if(!u){this.#c({...this.#e,invalidFrames:this.#e.invalidFrames+1});return}this.#u(u)}}),this.#n.subscribeStatus(()=>{this.#n.getStatus().phase!=="connected"&&(this.#s=null,this.#a=null,this.#r=null,this.#m())})}getStatus=()=>this.#n.getStatus();subscribeStatus=i=>this.#n.subscribeStatus(i);getState=()=>this.#e;subscribeState=i=>(this.#t.add(i),()=>{this.#t.delete(i)});start(){this.#n.start()}stop(){this.#n.stop()}#u(i){const l=this.#i();if(i.type==="top"){const r=this.#e.top!==null&&i.payload{i.configure(n,l)},[n,i,l]),re.useEffect(()=>(i.start(),()=>{i.stop()}),[i]),r}function uO(n,i,l){const r=re.useMemo(()=>new rO(n),[n]),u=re.useMemo(()=>K_(n),[n]),d=re.useSyncExternalStore(r.subscribeStatus,r.getStatus,r.getStatus),f=re.useSyncExternalStore(r.subscribeState,r.getState,r.getState),p=u1(d,f,l);re.useEffect(()=>(r.start(),()=>{r.stop()}),[r]);const m=tO({queryKey:["native-snapshot",n],queryFn:({signal:w})=>iO(n,w),enabled:u&&!p,refetchInterval:bm,retry:!1}),v=cO(d,f,m.data??null,l);return re.useEffect(()=>{v.top!==null&&i.recordNativeTop(v.top,v.receivedAt??Date.now())},[i,v.receivedAt,v.top]),{status:d,live:f,...v,restError:m.error instanceof Error?m.error.message:null}}function u1(n,i,l){return n.phase==="connected"&&i.top!==null&&i.topReceivedAt!==null&&i.configuration!==null&&i.configurationReceivedAt!==null&&Ch(i.topReceivedAt,l)}function cO(n,i,l,r){return u1(n,i,r)?{top:i.top,topHeader:i.headerReceivedAt!==null&&Ch(i.headerReceivedAt,r)?i.topHeader:null,configuration:i.configuration,receivedAt:i.topReceivedAt,transport:"websocket"}:l&&Ch(l.receivedAt,r)?{top:l.top,topHeader:l.topHeader,configuration:l.configuration,receivedAt:l.receivedAt,transport:"rest"}:{top:null,topHeader:null,configuration:null,receivedAt:null,transport:"none"}}function Ch(n,i){return i-n<=Rh}const fO=[{id:"overview",label:"Overview"},{id:"logs",label:"Logs"},{id:"events",label:"Events"}];function dO(){const n=re.useMemo(()=>new hN,[]),[i,l]=re.useState(F_),[r,u]=re.useState("overview"),[d,f]=re.useState(!1),[p,m]=re.useState(mN),[v,w]=re.useState(!1),[S,z]=re.useState(!1),[T,j]=re.useState(B_),L=re.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot),V=oO(i.adminUrl,n,p),H=uO(i.nativeUrl,n,L.now),G=_E(H.top,H.topHeader,L.now);function W(K){J_(K),(K.adminUrl!==i.adminUrl||K.nativeUrl!==i.nativeUrl)&&n.reset(),l(K),f(!1)}function B(){X_();const K=y0();(K.adminUrl!==i.adminUrl||K.nativeUrl!==i.nativeUrl)&&n.reset(),l(K),f(!1)}function ne(K){V_(K),j(K)}function ee(K){pN(K),m(K)}return _.jsxs("div",{className:"bg-background text-textPrimary min-h-screen",children:[_.jsx("header",{className:"border-accent/25 bg-surface/95 sticky top-0 z-40 border-b backdrop-blur",children:_.jsx("div",{className:"mx-auto max-w-[96rem] px-4 sm:px-6",children:_.jsxs("div",{className:"flex min-h-16 flex-wrap items-center gap-x-6 gap-y-2 py-3",children:[_.jsxs("button",{type:"button",onClick:()=>{u("overview")},className:"mr-auto text-left",children:[_.jsx("p",{className:"text-accentSecondary text-[10px] font-medium tracking-[0.2em)DELIM" -R"DELIM(] uppercase",children:"Libbitcoin Server"}),_.jsx("h1",{className:"text-accent text-lg font-semibold tracking-tight",children:"Admin Dashboard"})]}),_.jsx("nav",{className:"order-3 flex w-full items-center gap-1 sm:order-none sm:w-auto",children:fO.map(K=>_.jsxs("button",{type:"button",onClick:()=>{u(K.id)},className:`rounded-lg px-3 py-2 text-sm transition ${r===K.id?"bg-accent/15 text-accent":"text-textMuted hover:text-textPrimary hover:bg-white/5"}`,children:[K.label,K.id==="logs"&&L.totalLogs>0&&_.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:L.totalLogs>999?"999+":String(L.totalLogs)}),K.id==="events"&&L.totalEvents>0&&_.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:L.totalEvents>999?"999+":String(L.totalEvents)})]},K.id))}),_.jsxs("div",{className:"flex items-center gap-3",children:[_.jsxs("div",{className:"hidden items-center gap-2 lg:flex","aria-label":"Connection summary",children:[_.jsx(h0,{connected:V.phase==="connected",label:"Admin"}),_.jsx(h0,{connected:H.transport!=="none",label:"Native"})]}),_.jsx("button",{type:"button",onClick:()=>{f(!0)},className:"border-accent/30 text-textMuted hover:border-accent hover:text-accent rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Endpoints"})]})]})})}),_.jsxs("main",{className:"mx-auto max-w-[96rem] min-w-0 px-4 py-8 sm:px-6",children:[r==="overview"&&_.jsx(aN,{adminStatus:V,endpoints:i,metrics:L,native:H,syncEstimate:G}),r==="logs"&&_.jsx(P2,{metrics:n,delivery:L,status:V,logFilter:p,paused:v,onLogFilterChange:ee,onPausedChange:K=>{n.setLogsPaused(K),w(K)},onClear:()=>{n.clearLogs()}}),r==="events"&&_.jsx(X2,{metrics:n,paused:S,onPausedChange:K=>{n.setEventsPaused(K),z(K)},onClear:()=>{n.clearEvents()}})]}),_.jsx(oN,{estimate:G,browserNotificationsEnabled:T},i.nativeUrl),d&&_.jsx(I_,{configuration:i,browserNotificationsEnabled:T,onClose:()=>{f(!1)},onReset:B,onSave:W,onBrowserNotificationsEnabledChange:ne},`${i.adminUrl}|${i.nativeUrl}`)]})}function h0({connected:n,label:i}){return _.jsxs("span",{className:"text-textMuted inline-flex items-center gap-1.5 text-xs",children:[_.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-400":"bg-amber-400"}`,"aria-hidden":"true"}),i]})}function hO({children:n}){const[i]=re.useState(()=>new qN({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:1}}}));return _.jsxs(VN,{client:i,children:[n,null]})}const c1=document.querySelector("#root");if(!c1)throw new Error("Root element not found");H_.createRoot(c1).render(_.jsx(k_.StrictMode,{children:_.jsx(hO,{children:_.jsx(dO,{})})})); +R"DELIM(=f[0]&&v){d(f);continue}}if(n.metadataRegistry.get(f[0])?.id){d(f);continue}if(p.cycle){d(f);continue}if(p.count>1&&n.reused==="ref"){d(f);continue}}}function V0(n,i){const l=n.seen.get(i);if(!l)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const m=n.seen.get(p);if(m.ref===null)return;const v=m.def??m.schema,w={...v},S=m.ref;if(m.ref=null,S){r(S);const T=n.seen.get(S),j=T.schema;if(j.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(v.allOf=v.allOf??[],v.allOf.push(j)):Object.assign(v,j),Object.assign(v,w),p._zod.parent===S)for(const V in v)V==="$ref"||V==="allOf"||V in w||delete v[V];if(j.$ref&&T.def)for(const V in v)V==="$ref"||V==="allOf"||V in T.def&&JSON.stringify(v[V])===JSON.stringify(T.def[V])&&delete v[V]}const z=p._zod.parent;if(z&&z!==S){r(z);const T=n.seen.get(z);if(T?.schema.$ref&&(v.$ref=T.schema.$ref,T.def))for(const j in v)j==="$ref"||j==="allOf"||j in T.def&&JSON.stringify(v[j])===JSON.stringify(T.def[j])&&delete v[j]}n.override({zodSchema:p,jsonSchema:v,path:m.path??[]})};for(const p of[...n.seen.entries()].reverse())r(p[0]);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 p=n.external.registry.get(i)?.id;if(!p)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(p)}Object.assign(u,l.def??l.schema);const d=n.metadataRegistry.get(i)?.id;d!==void 0&&u.id===d&&delete u.id;const f=n.external?.defs??{};for(const p of n.seen.entries()){const m=p[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,f[m.defId]=m.def)}n.external||Object.keys(f).length>0&&(n.target==="draft-2020-12"?u.$defs=f:u.definitions=f);try{const p=JSON.parse(JSON.stringify(u));return Object.defineProperty(p,"~standard",{value:{...i["~standard"],jsonSchema:{input:zc(i,"input",n.processors),output:zc(i,"output",n.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function Ln(n,i){const l=i??{seen:new Set};if(l.seen.has(n))return!1;l.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ln(r.element,l);if(r.type==="set")return Ln(r.valueType,l);if(r.type==="lazy")return Ln(r.getter(),l);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ln(r.innerType,l);if(r.type==="intersection")return Ln(r.left,l)||Ln(r.right,l);if(r.type==="record"||r.type==="map")return Ln(r.keyType,l)||Ln(r.valueType,l);if(r.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:Ln(r.in,l)||Ln(r.out,l);if(r.type==="object"){for(const u in r.shape)if(Ln(r.shape[u],l))return!0;return!1}if(r.type==="union"){for(const u of r.options)if(Ln(u,l))return!0;return!1}if(r.type==="tuple"){for(const u of r.items)if(Ln(u,l))return!0;return!!(r.rest&&Ln(r.rest,l))}return!1}const tz=(n,i={})=>l=>{const r=q0({...l,processors:i});return Sn(n,r),B0(r,n),V0(r,n)},zc=(n,i,l={})=>r=>{const{libraryOptions:u,target:d}=r??{},f=q0({...u??{},target:d,io:i,processors:l});return Sn(n,f),B0(f,n),V0(f,n)},nz={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},iz=(n,i,l,r)=>{const u=l;u.type="string";const{minimum:d,maximum:f,format:p,patterns:m,contentEncoding:v}=n._zod.bag;if(typeof d=="number"&&(u.minLength=d),typeof f=="number"&&(u.maxLength=f),p&&(u.format=nz[p]??p,u.format===""&&delete u.format,p==="time"&&delete u.format),v&&(u.contentEncoding=v),m&&m.size>0){const w=[...m];w.length===1?u.pattern=w[0].source:w.length>1&&(u.allOf=[...w.map(S=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:S.source}))])}},az=(n,i,l,r)=>{const u=l,{minimum:d,maximum:f,format:p,multipleOf:m,exclusiveMaximum:v,exclusiveMinimum:w}=n._zod.bag;typeof p=="string"&&p.includes("int")?u.type="integer":u.type="number";const S=typeof w=="number"&&w>=(d??Number.NEGATIVE_INFINITY),z=typeof v=="number"&&v<=(f??Number.POSITIVE_INFINITY),T=i.target==="draft-04"||i.target==="openapi-3.0";S?T?(u.minimum=w,u.exclusiveMinimum=!0):u.exclusiveMinimum=w:typeof d=="number"&&(u.minimum=d),z?T?(u.maximum=v,u.exclusiveMaximum=!0):u.exclusiveMaximum=v:typeof f=="number"&&(u.maximum=f),typeof m=="number"&&(u.multipleOf=m)},lz=(n,i,l,r)=>{l.type="boolean"},sz=(n,i,l,r)=>{l.not={}},rz=(n,i,l,r)=>{},oz=(n,i,l,r)=>{const u=n._zod.def,d=S0(u.entries);d.every(f=>typeof f=="number")&&(l.type="number"),d.every(f=>typeof f=="string")&&(l.type="string"),l.enum=d},uz=(n,i,l,r)=>{const u=n._zod.def,d=[];for(const f of u.values)if(f===void 0){if(i.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof f=="bigint"){if(i.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");d.push(Number(f))}else d.push(f);if(d.length!==0)if(d.length===1){const f=d[0];l.type=f===null?"null":typeof f,i.target==="draft-04"||i.target==="openapi-3.0"?l.enum=[f]:l.const=f}else d.every(f=>typeof f=="number")&&(l.type="number"),d.every(f=>typeof f=="string")&&(l.type="string"),d.every(f=>typeof f=="boolean")&&(l.type="boolean"),d.every(f=>f===null)&&(l.type="null"),l.enum=d},cz=(n,i,l,r)=>{if(i.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},fz=(n,i,l,r)=>{if(i.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},dz=(n,i,l,r)=>{const u=l,d=n._zod.def,{minimum:f,maximum:p}=n._zod.bag;typeof f=="number"&&(u.minItems=f),typeof p=="number"&&(u.maxItems=p),u.type="array",u.items=Sn(d.element,i,{...r,path:[...r.path,"items"]})},hz=(n,i,l,r)=>{const u=l,d=n._zod.def;u.type="object",u.properties={};const f=d.shape;for(const v in f)u.properties[v]=Sn(f[v],i,{...r,path:[...r.path,"properties",v]});const p=new Set(Object.keys(f)),m=new Set([...p].filter(v=>{const w=d.shape[v]._zod;return i.io==="input"?w.optin===void 0:w.optout===void 0}));m.size>0&&(u.required=Array.from(m)),d.catchall?._zod.def.type==="never"?u.additionalProperties=!1:d.catchall?d.catchall&&(u.additionalProperties=Sn(d.catchall,i,{...r,path:[...r.path,"additionalProperties"]})):i.io==="output"&&(u.additionalProperties=!1)},mz=(n,i,l,r)=>{const u=n._zod.def,d=u.inclusive===!1,f=u.options.map((p,m)=>Sn(p,i,{...r,path:[...r.path,d?"oneOf":"anyOf",m]}));d?l.oneOf=f:l.anyOf=f},pz=(n,i,l,r)=>{const u=n._zod.def,d=Sn(u.left,i,{...r,path:[...r.path,"allOf",0]}),f=Sn(u.right,i,{...r,path:[...r.path,"allOf",1]}),p=v=>"allOf"in v&&Object.keys(v).length===1,m=[...p(d)?d.allOf:[d],...p(f)?f.allOf:[f]];l.allOf=m},gz=(n,i,l,r)=>{const u=n._zod.def,d=Sn(u.innerType,i,r),f=i.seen.get(n);i.target==="openapi-3.0"?(f.ref=u.innerType,l.nullable=!0):l.anyOf=[d,{type:"null"}]},vz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType},yz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType,l.default=JSON.parse(JSON.stringify(u.defaultValue))},bz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType,i.io==="input"&&(l._prefault=JSON.parse(JSON.stringify(u.defaultValue)))},_z=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType;let f;try{f=u.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}l.default=f},Sz=(n,i,l,r)=>{const u=n._zod.def,d=u.in._zod.traits.has("$ZodTransform"),f=i.io==="input"?d?u.out:u.in:u.out;Sn(f,i,r);const p=i.seen.get(n);p.ref=f},xz=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType,l.readOnly=!0},G0=(n,i,l,r)=>{const u=n._zod.def;Sn(u.innerType,i,r);const d=i.seen.get(n);d.ref=u.innerType},wz=I("ZodISODateTime",(n,i)=>{Tx.init(n,i),Mt.init(n,i)});fu)DELIM" +R"DELIM(nction zz(n){return jw(wz,n)}const Ez=I("ZodISODate",(n,i)=>{Ax.init(n,i),Mt.init(n,i)});function Tz(n){return kw(Ez,n)}const Az=I("ZodISOTime",(n,i)=>{Nx.init(n,i),Mt.init(n,i)});function Nz(n){return Rw(Az,n)}const Mz=I("ZodISODuration",(n,i)=>{Mx.init(n,i),Mt.init(n,i)});function Oz(n){return Cw(Mz,n)}const jz=(n,i)=>{T0.init(n,i),n.name="ZodError",Object.defineProperties(n,{format:{value:l=>vS(n,l)},flatten:{value:l=>gS(n,l)},addIssue:{value:l=>{n.issues.push(l),n.message=JSON.stringify(n.issues,uh,2)}},addIssues:{value:l=>{n.issues.push(...l),n.message=JSON.stringify(n.issues,uh,2)}},isEmpty:{get(){return n.issues.length===0}}})},Oi=I("ZodError",jz,{Parent:Error}),kz=Gh(Oi),Rz=Yh(Oi),Cz=Uc(Oi),Dz=Zc(Oi),Uz=_S(Oi),Zz=SS(Oi),$z=xS(Oi),Lz=wS(Oi),Hz=zS(Oi),qz=ES(Oi),Bz=TS(Oi),Vz=AS(Oi),Pv=new WeakMap;function Lo(n,i,l){const r=Object.getPrototypeOf(n);let u=Pv.get(r);if(u||(u=new Set,Pv.set(r,u)),!u.has(i)){u.add(i);for(const d in l){const f=l[d];Object.defineProperty(r,d,{configurable:!0,enumerable:!1,get(){const p=f.bind(this);return Object.defineProperty(this,d,{configurable:!0,writable:!0,enumerable:!0,value:p}),p},set(p){Object.defineProperty(this,d,{configurable:!0,writable:!0,enumerable:!0,value:p})}})}}}const Zt=I("ZodType",(n,i)=>(Ut.init(n,i),Object.assign(n["~standard"],{jsonSchema:{input:zc(n,"input"),output:zc(n,"output")}}),n.toJSONSchema=tz(n,{}),n.def=i,n.type=i.type,Object.defineProperty(n,"_def",{value:i}),n.parse=(l,r)=>kz(n,l,r,{callee:n.parse}),n.safeParse=(l,r)=>Cz(n,l,r),n.parseAsync=async(l,r)=>Rz(n,l,r,{callee:n.parseAsync}),n.safeParseAsync=async(l,r)=>Dz(n,l,r),n.spa=n.safeParseAsync,n.encode=(l,r)=>Uz(n,l,r),n.decode=(l,r)=>Zz(n,l,r),n.encodeAsync=async(l,r)=>$z(n,l,r),n.decodeAsync=async(l,r)=>Lz(n,l,r),n.safeEncode=(l,r)=>Hz(n,l,r),n.safeDecode=(l,r)=>qz(n,l,r),n.safeEncodeAsync=async(l,r)=>Bz(n,l,r),n.safeDecodeAsync=async(l,r)=>Vz(n,l,r),Lo(n,"ZodType",{check(...l){const r=this.def;return this.clone(Nl(r,{checks:[...r.checks??[],...l.map(u=>typeof u=="function"?{_zod:{check:u,def:{check:"custom"},onattach:[]}}:u)]}),{parent:!0})},with(...l){return this.check(...l)},clone(l,r){return Ml(this,l,r)},brand(){return this},register(l,r){return l.add(this,r),this},refine(l,r){return this.check(D2(l,r))},superRefine(l,r){return this.check(U2(l,r))},overwrite(l){return this.check(yr(l))},optional(){return ny(this)},exactOptional(){return x2(this)},nullable(){return iy(this)},nullish(){return ny(iy(this))},nonoptional(l){return N2(this,l)},array(){return Kh(this)},or(l){return Fh([this,l])},and(l){return v2(this,l)},transform(l){return ay(this,_2(l))},default(l){return E2(this,l)},prefault(l){return A2(this,l)},catch(l){return O2(this,l)},pipe(l){return ay(this,l)},readonly(){return R2(this)},describe(l){const r=this.clone();return Ao.add(r,{description:l}),r},meta(...l){if(l.length===0)return Ao.get(this);const r=this.clone();return Ao.add(r,l[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(l){return l(this)}}),Object.defineProperty(n,"description",{get(){return Ao.get(n)?.description},configurable:!0}),n)),Y0=I("_ZodString",(n,i)=>{Qh.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,u,d)=>iz(n,r,u);const l=n._zod.bag;n.format=l.format??null,n.minLength=l.minimum??null,n.maxLength=l.maximum??null,Lo(n,"_ZodString",{regex(...r){return this.check(Hw(...r))},includes(...r){return this.check(Vw(...r))},startsWith(...r){return this.check(Gw(...r))},endsWith(...r){return this.check(Yw(...r))},min(...r){return this.check(wc(...r))},max(...r){return this.check(L0(...r))},length(...r){return this.check(H0(...r))},nonempty(...r){return this.check(wc(1,...r))},lowercase(r){return this.check(qw(r))},uppercase(r){return this.check(Bw(r))},trim(){return this.check(Kw())},normalize(...r){return this.check(Qw(...r))},toLowerCase(){return this.check(Fw())},toUpperCase(){return this.check(Jw())},slugify(){return this.check(Xw())}})}),Gz=I("ZodString",(n,i)=>{Qh.init(n,i),Y0.init(n,i),n.email=l=>n.check(cw(Yz,l)),n.url=l=>n.check(pw(Qz,l)),n.jwt=l=>n.check(Ow(r2,l)),n.emoji=l=>n.check(gw(Kz,l)),n.guid=l=>n.check(Fv(Wv,l)),n.uuid=l=>n.check(fw(fc,l)),n.uuidv4=l=>n.check(dw(fc,l)),n.uuidv6=l=>n.check(hw(fc,l)),n.uuidv7=l=>n.check(mw(fc,l)),n.nanoid=l=>n.check(vw(Fz,l)),n.guid=l=>n.check(Fv(Wv,l)),n.cuid=l=>n.check(yw(Jz,l)),n.cuid2=l=>n.check(bw(Xz,l)),n.ulid=l=>n.check(_w(Iz,l)),n.base64=l=>n.check(Aw(a2,l)),n.base64url=l=>n.check(Nw(l2,l)),n.xid=l=>n.check(Sw(Pz,l)),n.ksuid=l=>n.check(xw(Wz,l)),n.ipv4=l=>n.check(ww(e2,l)),n.ipv6=l=>n.check(zw(t2,l)),n.cidrv4=l=>n.check(Ew(n2,l)),n.cidrv6=l=>n.check(Tw(i2,l)),n.e164=l=>n.check(Mw(s2,l)),n.datetime=l=>n.check(zz(l)),n.date=l=>n.check(Tz(l)),n.time=l=>n.check(Nz(l)),n.duration=l=>n.check(Oz(l))});function os(n){return uw(Gz,n)}const Mt=I("ZodStringFormat",(n,i)=>{Tt.init(n,i),Y0.init(n,i)}),Yz=I("ZodEmail",(n,i)=>{vx.init(n,i),Mt.init(n,i)}),Wv=I("ZodGUID",(n,i)=>{px.init(n,i),Mt.init(n,i)}),fc=I("ZodUUID",(n,i)=>{gx.init(n,i),Mt.init(n,i)}),Qz=I("ZodURL",(n,i)=>{yx.init(n,i),Mt.init(n,i)}),Kz=I("ZodEmoji",(n,i)=>{bx.init(n,i),Mt.init(n,i)}),Fz=I("ZodNanoID",(n,i)=>{_x.init(n,i),Mt.init(n,i)}),Jz=I("ZodCUID",(n,i)=>{Sx.init(n,i),Mt.init(n,i)}),Xz=I("ZodCUID2",(n,i)=>{xx.init(n,i),Mt.init(n,i)}),Iz=I("ZodULID",(n,i)=>{wx.init(n,i),Mt.init(n,i)}),Pz=I("ZodXID",(n,i)=>{zx.init(n,i),Mt.init(n,i)}),Wz=I("ZodKSUID",(n,i)=>{Ex.init(n,i),Mt.init(n,i)}),e2=I("ZodIPv4",(n,i)=>{Ox.init(n,i),Mt.init(n,i)}),t2=I("ZodIPv6",(n,i)=>{jx.init(n,i),Mt.init(n,i)}),n2=I("ZodCIDRv4",(n,i)=>{kx.init(n,i),Mt.init(n,i)}),i2=I("ZodCIDRv6",(n,i)=>{Rx.init(n,i),Mt.init(n,i)}),a2=I("ZodBase64",(n,i)=>{Cx.init(n,i),Mt.init(n,i)}),l2=I("ZodBase64URL",(n,i)=>{Ux.init(n,i),Mt.init(n,i)}),s2=I("ZodE164",(n,i)=>{Zx.init(n,i),Mt.init(n,i)}),r2=I("ZodJWT",(n,i)=>{Lx.init(n,i),Mt.init(n,i)}),Q0=I("ZodNumber",(n,i)=>{D0.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,u,d)=>az(n,r,u),Lo(n,"ZodNumber",{gt(r,u){return this.check(Xv(r,u))},gte(r,u){return this.check(Id(r,u))},min(r,u){return this.check(Id(r,u))},lt(r,u){return this.check(Jv(r,u))},lte(r,u){return this.check(Xd(r,u))},max(r,u){return this.check(Xd(r,u))},int(r){return this.check(ey(r))},safe(r){return this.check(ey(r))},positive(r){return this.check(Xv(0,r))},nonnegative(r){return this.check(Id(0,r))},negative(r){return this.check(Jv(0,r))},nonpositive(r){return this.check(Xd(0,r))},multipleOf(r,u){return this.check(Iv(r,u))},step(r,u){return this.check(Iv(r,u))},finite(){return this}});const l=n._zod.bag;n.minValue=Math.max(l.minimum??Number.NEGATIVE_INFINITY,l.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(l.maximum??Number.POSITIVE_INFINITY,l.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(l.format??"").includes("int")||Number.isSafeInteger(l.multipleOf??.5),n.isFinite=!0,n.format=l.format??null});function Ha(n){return Dw(Q0,n)}const o2=I("ZodNumberFormat",(n,i)=>{Hx.init(n,i),Q0.init(n,i)});function ey(n){return Uw(o2,n)}const u2=I("ZodBoolean",(n,i)=>{qx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>lz(n,l,r)});function nr(n){return Zw(u2,n)}const c2=I("ZodUnknown",(n,i)=>{Bx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>rz()});function ty(){return $w(c2)}const f2=I("ZodNever",(n,i)=>{Vx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>sz(n,l,r)});function d2(n){return Lw(f2,n)}const h2=I("ZodArray",(n,i)=>{Gx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>dz(n,l,r,u),n.element=i.element,Lo(n,"ZodArray",{min(l,r){return this.check(wc(l,r))},nonempty(l){return this.check(wc(1,l))},max(l,r){return this.check(L0(l,r))},length(l,r){return this.check(H0(l,r))},unwrap(){return this.element}})});function Kh(n,i){return Iw(h2,n,i)}const m2=I("ZodObject",(n,i)=>{Qx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>hz(n,l,r,u),ht(n,"shape",()=>i.shape),Lo(n,"ZodObject",{keyof(){return Ec(Object.keys(this._zod.def.shape))},catch)DELIM" +R"DELIM(all(l){return this.clone({...this._zod.def,catchall:l})},passthrough(){return this.clone({...this._zod.def,catchall:ty()})},loose(){return this.clone({...this._zod.def,catchall:ty()})},strict(){return this.clone({...this._zod.def,catchall:d2()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(l){return cS(this,l)},safeExtend(l){return fS(this,l)},merge(l){return dS(this,l)},pick(l){return oS(this,l)},omit(l){return uS(this,l)},partial(...l){return hS(K0,this,l[0])},required(...l){return mS(F0,this,l[0])}})});function Ol(n,i){const l={type:"object",shape:n??{},...Ne(i)};return new m2(l)}const p2=I("ZodUnion",(n,i)=>{Kx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>mz(n,l,r,u),n.options=i.options});function Fh(n,i){return new p2({type:"union",options:n,...Ne(i)})}const g2=I("ZodIntersection",(n,i)=>{Fx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>pz(n,l,r,u)});function v2(n,i){return new g2({type:"intersection",left:n,right:i})}const fh=I("ZodEnum",(n,i)=>{Jx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(r,u,d)=>oz(n,r,u),n.enum=i.entries,n.options=Object.values(i.entries);const l=new Set(Object.keys(i.entries));n.extract=(r,u)=>{const d={};for(const f of r)if(l.has(f))d[f]=i.entries[f];else throw new Error(`Key ${f} not found in enum`);return new fh({...i,checks:[],...Ne(u),entries:d})},n.exclude=(r,u)=>{const d={...i.entries};for(const f of r)if(l.has(f))delete d[f];else throw new Error(`Key ${f} not found in enum`);return new fh({...i,checks:[],...Ne(u),entries:d})}});function Ec(n,i){const l=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new fh({type:"enum",entries:l,...Ne(i)})}const y2=I("ZodLiteral",(n,i)=>{Xx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>uz(n,l,r),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 yc(n,i){return new y2({type:"literal",values:Array.isArray(n)?n:[n],...Ne(i)})}const b2=I("ZodTransform",(n,i)=>{Ix.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>fz(n,l),n._zod.parse=(l,r)=>{if(r.direction==="backward")throw new _0(n.constructor.name);l.addIssue=d=>{if(typeof d=="string")l.issues.push(Do(d,l.value,i));else{const f=d;f.fatal&&(f.continue=!1),f.code??(f.code="custom"),f.input??(f.input=l.value),f.inst??(f.inst=n),l.issues.push(Do(f))}};const u=i.transform(l.value,l);return u instanceof Promise?u.then(d=>(l.value=d,l.fallback=!0,l)):(l.value=u,l.fallback=!0,l)}});function _2(n){return new b2({type:"transform",transform:n})}const K0=I("ZodOptional",(n,i)=>{$0.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>G0(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function ny(n){return new K0({type:"optional",innerType:n})}const S2=I("ZodExactOptional",(n,i)=>{Px.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>G0(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function x2(n){return new S2({type:"optional",innerType:n})}const w2=I("ZodNullable",(n,i)=>{Wx.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>gz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function iy(n){return new w2({type:"nullable",innerType:n})}const z2=I("ZodDefault",(n,i)=>{ew.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>yz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function E2(n,i){return new z2({type:"default",innerType:n,get defaultValue(){return typeof i=="function"?i():w0(i)}})}const T2=I("ZodPrefault",(n,i)=>{tw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>bz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function A2(n,i){return new T2({type:"prefault",innerType:n,get defaultValue(){return typeof i=="function"?i():w0(i)}})}const F0=I("ZodNonOptional",(n,i)=>{nw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>vz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function N2(n,i){return new F0({type:"nonoptional",innerType:n,...Ne(i)})}const M2=I("ZodCatch",(n,i)=>{iw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>_z(n,l,r,u),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function O2(n,i){return new M2({type:"catch",innerType:n,catchValue:typeof i=="function"?i:()=>i})}const j2=I("ZodPipe",(n,i)=>{aw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>Sz(n,l,r,u),n.in=i.in,n.out=i.out});function ay(n,i){return new j2({type:"pipe",in:n,out:i})}const k2=I("ZodReadonly",(n,i)=>{lw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>xz(n,l,r,u),n.unwrap=()=>n._zod.def.innerType});function R2(n){return new k2({type:"readonly",innerType:n})}const C2=I("ZodCustom",(n,i)=>{sw.init(n,i),Zt.init(n,i),n._zod.processJSONSchema=(l,r,u)=>cz(n,l)});function D2(n,i={}){return Pw(C2,n,i)}function U2(n,i){return Ww(n,i)}const Ho=[{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"}],Tc=[{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:"count"},{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:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],J0=Ha().int().nonnegative().max(864e13),Z2=Ol({level:Ha().int().nonnegative(),time:J0,message:os()}),$2=Ol({event:Ha().int().nonnegative)DELIM" +R"DELIM((),value:Ha().nonnegative(),time:J0}),L2=Ol({previous:Ha().nonnegative()});Fh([Z2,$2,L2]);const Jh=2**Ho.length-1,ur=Jh,H2=2**0+2**1+2**2+2**6+2**7;function q2(n,i){return Number.isInteger(i)&&i>=0&&i0?`${String(l)}d ${String(r)}h`:r>0?`${String(r)}h ${String(u)}m`:u>0?`${String(u)}m ${String(d)}s`:`${String(d)}s`}function I0(n,i){switch(qo(n).valueKind){case"height":return`height ${Hn(i)}`;case"seconds":return`${cr(i)} s`;case"milliseconds":return`${cr(i)} ms`;case"microseconds":return`${cr(i)} µs`;case"count":return Hn(i);default:return String(i)}}function F2(n){return n>=100?`${cr(n,0)}/s`:n>=10?`${cr(n,1)}/s`:`${cr(n,2)}/s`}function J2(n){try{const i=new URL(n),l=i.pathname==="/"?"":i.pathname.replace(/\/$/u,"");return`${i.host}${l}`}catch{return n}}const Ac=32,X2=[{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"}],I2={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 P2({metrics:n,paused:i,onPausedChange:l,onClear:r}){const[u,d]=re.useState(""),[f,p]=re.useState("all"),[m,v]=re.useState({offset:0,search:u,category:f}),w=m.search===u&&m.category===f?m.offset:0,S=re.useRef(null),z=re.useSyncExternalStore(n.subscribeEvents,n.getEventWindow,n.getEventWindow);return re.useEffect(()=>{n.setEventQuery({search:u,category:f,offset:w})},[n,u,f,w]),re.useEffect(()=>{S.current&&(S.current.scrollTop=0)},[u,f]),_.jsxs("section",{className:"space-y-4",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Node lifecycle"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Live events"}),_.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"Heights are event payloads; timing values retain their source units."}),_.jsx("p",{className:"text-textMuted mt-1 text-xs",children:"Pause freezes this view; collection and charts continue."})]}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{i&&(S.current&&(S.current.scrollTop=0),v({offset:0,search:u,category:f})),l(!i)},className:"border-accent/35 text-accent hover:bg-accent/10 rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:i?"Resume display":"Pause display"}),_.jsx("button",{type:"button",onClick:r,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Clear"})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 flex flex-wrap gap-3 rounded-xl border p-4",children:[_.jsxs("label",{className:"min-w-56 flex-1",children:[_.jsx("span",{className:"sr-only",children:"Search events"}),_.jsx("input",{type:"search",value:u,onChange:T=>{d(T.target.value)},placeholder:"Search event names or values…",className:"border-accent/25 bg-background/70 text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{children:[_.jsx("span",{className:"sr-only",children:"Filter event category"}),_.jsx("select",{value:f,onChange:T=>{p(T.target.value)},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent rounded-lg border px-3 py-2 text-sm focus:ring-0",children:X2.map(T=>_.jsx("option",{value:T.value,children:T.label},T.value))})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 overflow-hidden rounded-xl border",children:[_.jsxs("div",{className:"border-accent/15 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[_.jsx("span",{children:i?"Display paused · collection continues":"Live stream · newest first"}),_.jsxs("span",{children:[String(z.matched)," matching · ",String(z.retained)," retained"]})]}),_.jsx("div",{ref:S,role:"region","aria-label":"Scrollable event history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:T=>{v({offset:Math.max(0,Math.floor(T.currentTarget.scrollTop/Ac)-8),search:u,category:f})},children:z.matched===0?_.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching events."}):_.jsx("ol",{"aria-label":"Received events",className:"relative min-w-[32rem]",style:{height:z.matched*Ac},children:z.events.map((T,j)=>_.jsx(W2,{event:T,index:z.offset+j,total:z.matched},T.id))})})]}),_.jsxs("details",{className:"border-accent/20 bg-surface/50 rounded-xl border",children:[_.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-4 py-3 text-sm",children:["Event contract (",String(Tc.length)," identifiers)"]}),_.jsx("div",{className:"grid gap-2 border-t border-white/5 p-4 sm:grid-cols-2 lg:grid-cols-3",children:Tc.map(T=>_.jsxs("div",{className:"text-xs",children:[_.jsx("span",{className:"text-textMuted font-mono",children:String(T.id).padStart(2,"0")}),_.jsx("span",{className:"text-textPrimary ml-2",children:T.name})]},T.id))})]})]})}const W2=re.memo(function({event:i,index:l,total:r}){const u=qo(i.event);return _.jsxs("li",{"aria-setsize":r,"aria-posinset":l+1,className:"absolute inset-x-0 grid grid-cols-[8.5rem_10rem_minmax(0,1fr)] items-center gap-2 border-b border-white/5 px-4 text-xs",style:{top:l*Ac,height:Ac},children:[_.jsx("time",{dateTime:Xh(i.time),className:"text-textMuted font-mono tabular-nums",children:jo(i.time)}),_.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${I2[u.category]}`,children:u.name}),_.jsx("span",{className:"text-textPrimary font-mono tabular-nums",children:I0(i.event,i.value)})]})}),Nc=32,ly={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 eE({metrics:n,delivery:i,status:l,logFilter:r,paused:u,onLogFilterChange:d,onPausedChange:f,onClear:p}){const[m,v]=re.useState(""),[w,S]=re.useState({offset:0,search:m,filter:r}),z=w.search===m&&w.filter===r?w.offset:0,[T,j]=re.useState(null),L=re.useRef(null),V=re.useSyncExternalStore(n.subscribeLogs,n.getLogWindow,n.getLogWindow);return re.useEffect(()=>{n.setLogQuery({search:m,filter:r,offset:z})},[)DELIM" +R"DELIM(n,m,r,z]),re.useEffect(()=>{L.current&&(L.current.scrollTop=0)},[m,r]),_.jsxs("section",{className:"space-y-4",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Diagnostic stream"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Node logs"}),_.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"The newest 1,000 messages are retained in this browser session."})]}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{u&&(L.current&&(L.current.scrollTop=0),S({offset:0,search:m,filter:r})),f(!u)},className:"border-accent/35 text-accent hover:bg-accent/10 rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:u?"Resume display":"Pause display"}),_.jsx("button",{type:"button",onClick:p,className:"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Clear"})]})]}),_.jsxs("fieldset",{className:"border-accent/20 bg-surface/70 space-y-3 rounded-xl border p-4",children:[_.jsx("legend",{className:"text-textPrimary px-1 text-sm font-medium",children:"Requested log levels"}),_.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."}),_.jsx("div",{className:"flex flex-wrap gap-x-5 gap-y-3",children:Ho.map(H=>_.jsxs("label",{className:"text-textPrimary flex items-center gap-2 text-sm",children:[_.jsx("input",{type:"checkbox",checked:q2(r,H.id),onChange:()=>{d(r^1<{d(H2)},className:"text-accent hover:underline",children:"Operational levels"}),_.jsx("button",{type:"button",onClick:()=>{d(Jh)},className:"text-accent hover:underline",children:"All levels"}),_.jsx("button",{type:"button",onClick:()=>{d(0)},className:"text-accent hover:underline",children:"No levels"}),_.jsx("span",{className:"text-textMuted",children:"Selection is saved in this browser."})]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 space-y-2 rounded-xl border p-4 text-xs",children:[_.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",l.reconnects]].map(([H,G])=>_.jsxs("div",{children:[_.jsx("dt",{className:"text-textMuted",children:H}),_.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:G.toLocaleString()})]},H))}),_.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."}),_.jsxs("p",{className:"text-textMuted",role:"status",children:["Admin connection: ",l.phase,l.error?` · ${l.error}`:""]})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 flex flex-wrap gap-3 rounded-xl border p-4",children:[_.jsxs("label",{className:"min-w-56 flex-1",children:[_.jsx("span",{className:"sr-only",children:"Search logs"}),_.jsx("input",{type:"search",value:m,onChange:H=>{v(H.target.value)},placeholder:"Search received messages…",className:"border-accent/25 bg-background/70 text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsx("p",{className:"text-textMuted self-center text-xs",children:"Search filters received messages only."})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 overflow-hidden rounded-xl border",children:[_.jsxs("div",{className:"border-accent/15 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[_.jsx("span",{children:u?"Display paused · collection continues":r===0?"Log delivery disabled":z>0?"Viewing older rows · collection continues":"Live stream · newest first"}),_.jsxs("span",{children:[String(V.matched)," matching · ",String(V.retained)," retained"]})]}),_.jsx("div",{ref:L,role:"region","aria-label":"Scrollable log history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:H=>{S({offset:Math.max(0,Math.floor(H.currentTarget.scrollTop/Nc)-8),search:m,filter:r})},children:V.matched===0?_.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching log messages."}):_.jsx("ol",{"aria-label":"Received logs",className:"relative",style:{height:V.matched*Nc},children:V.logs.map((H,G)=>_.jsx(tE,{log:H,index:V.offset+G,total:V.matched,onSelect:j},H.id))})})]}),_.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[_.jsx("p",{className:"text-textMuted",children:"Select a row to read its full message."}),!u&&_.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{L.current&&(L.current.scrollTop=0),S({offset:0,search:m,filter:r})},children:"Jump to latest"})]}),T&&_.jsx(nE,{log:T,onClose:()=>{j(null)}})]})}const tE=re.memo(function({log:i,index:l,total:r,onSelect:u}){return _.jsx("li",{"aria-setsize":r,"aria-posinset":l+1,className:"absolute inset-x-0 border-b border-white/5",style:{top:l*Nc,height:Nc},children:_.jsxs("button",{type:"button",onClick:()=>{u(i)},className:"grid h-full w-full grid-cols-[5.5rem_4.5rem_minmax(0,1fr)] items-center gap-2 px-4 text-left text-xs hover:bg-white/5 focus-visible:bg-white/10 sm:grid-cols-[7.5rem_7.5rem_minmax(0,1fr)]",children:[_.jsx("time",{dateTime:Xh(i.time),className:"text-textMuted font-mono tabular-nums",children:jo(i.time,!1)}),_.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${ly[i.level]??ly[8]}`,children:X0(i.level).name}),_.jsx("span",{className:"text-textPrimary min-w-0 truncate font-mono",children:i.message.replaceAll(` +`," ↵ ")})]})})});function nE({log:n,onClose:i}){const l=re.useRef(null);return re.useEffect(()=>{const r=l.current;return r?.showModal(),()=>{r?.close()}},[]),_.jsxs("dialog",{ref:l,onClose:i,"aria-labelledby":"log-detail-title",className:"border-accent/30 bg-surface text-textPrimary fixed inset-0 m-auto max-h-[80vh] w-[min(60rem,90vw)] rounded-xl border p-5 shadow-xl backdrop:bg-black/70",children:[_.jsxs("header",{className:"mb-4 flex items-center justify-between gap-4",children:[_.jsxs("h3",{id:"log-detail-title",className:"font-semibold",children:[X0(n.level).label," · ",Xh(n.time)??"Invalid time"]}),_.jsx("button",{type:"button",onClick:i,className:"text-accent rounded px-3 py-2",children:"Close"})]}),_.jsx("pre",{className:"text-sm break-words whitespace-pre-wrap",children:n.message})]})}const Pd=["line","area","bar"],sy=["line","step","area"],iE=["line","step","area"],P0={"occurrence-count":{id:"occurrence-count",label:"Occurrences per bucket",description:"Number of frames observed in each one-second bucket.",unit:"occurrences",chartTypes:Pd},"occurrence-rate":{id:"occurrence-rate",label:"Occurrence rate",description:"Frames observed per second.",unit:"occurrences-per-second",chartTypes:Pd},"cumulative-occurrences":{id:"cumulative-occurrences",label:"Cumulative occurrences",description:"Running number of frames observed during this browser session.",unit:"occurrences",chartTypes:sy},"payload-latest":{id:"payload-latest",label:"Latest value",description:"Most recently observed payload value.",unit:"count",chartTypes:iE},"payload-average":{id:"payload-average",label:"Average value",des)DELIM" +R"DELIM(cription:"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:sy},"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:Pd}},br=["occurrence-rate","occurrence-count","cumulative-occurrences"],aE=["payload-latest","payload-maximum","payload-change-rate",...br],lE=["payload-average","payload-latest","payload-minimum","payload-maximum",...br],sE=["payload-sum","payload-cumulative","payload-latest","payload-average",...br];function Mi(n){return`event:${String(n)}`}function wl(n){return`log:${String(n)}`}const Mc="native:top";function rE(n){switch(n){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";default:return"unknown"}}function oE(n){switch(n){case"height":return aE;case"duration":return lE;case"count":return sE;default:return br}}function uE(n){switch(n){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function W0(n){const i=qo(n),l=rE(i.valueKind);return{id:Mi(n),source:"event",sourceId:n,name:i.name,label:i.label,category:i.category,payloadKind:l,allowedMeasures:oE(l),defaultMeasure:uE(l),description:l==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${i.label} event with a ${l} payload.`}}const cE=[...Tc.map(n=>W0(n.id)),...Ho.map(n=>({id:wl(n.id),source:"log",sourceId:n.id,name:n.name,label:`${n.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:br,defaultMeasure:"occurrence-rate",description:`${n.label} log message volume. Message text is not interpreted as numeric data.`})),{id:Mc,source:"native",sourceId:"top",name:"canonical_top",label:"Canonical 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."}],Ih=cE,fE=new Map(Ih.map(n=>[n.id,n]));function Za(n){const i=fE.get(n);if(i)return i;const l=/^event:(\d+)$/u.exec(n);return l?W0(Number(l[1])):{id:n,source:"event",sourceId:-1,name:n,label:n,category:"unknown",payloadKind:"unknown",allowedMeasures:br,defaultMeasure:"occurrence-rate",description:"Unknown signal; only occurrence measurements are available."}}function El(n,i){const l=P0[i];if(i.startsWith("occurrence")||i==="cumulative-occurrences")return l;const r=i==="payload-change-rate"?"height-per-second":n.payloadKind==="height"?"height":n.payloadKind==="duration"?"milliseconds":"count";return{...l,unit:r}}function dE(n,i){return n.allowedMeasures.includes(i)}function hE(n,i){return Y2(n,i)??i}const mE=3600*1e3,pE=1e3,gE=1e3,vE=1e3;class ry{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 l=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),l}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 l=0;lthis.#O;getRecentLogs=()=>this.#i.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=i=>(this.#n.add(i),()=>{this.#n.delete(i)});start(){this.#S||(this.tick(),this.#S=setInterval(()=>{this.tick()},1e3))}stop(){this.#S&&(clearInterval(this.#S),this.#S=null),this.#_&&(clearTimeout(this.#_),this.#_=null)}ingest(i,l=this.#e()){const r=this.#M(l);this.#f+=1,B2(i)?this.#D(i,r):V2(i)?this.#N(i,r):G2(i)&&(this.#E+=1),this.#k()}recordInvalidFrame(){this.#z+=1,this.#k()}recordNativeTop(i,l=this.#e()){const r=this.#M(l),u=this.#c[Mc];u?.value===i&&r-u.time<15e3||(this.#C(Mc,r,i),this.#v(r),this.#k())}clearLogs(){this.#g+=this.#i.size,this.#i.clear(),this.flush()}clearEvents(){this.#s.clear(),this.flush()}reset(){this.#i.clear(),this.#s.clear(),this.#a.clear(),this.#r={},this.#l={},this.#u={},this.#o={},this.#m={},this.#c={},this.#d={},this.#h=this.#M(this.#e()),this.#f=0,this.#y=0,this.#x=0,this.#g=0,this.#w=0,this.#E=0,this.#z=0,this.#b=null,this.#T=null,this.#A=0,this.#j(this.#h),this.flush()}tick(){const i=this.#M(this.#e());this.#j(i),this.#v(i),this.#k()}flush(){this.#_&&(clearTimeout(this.#_),this.#_=null),this.#O=this.#R();for(const i of this.#n)i()}#D(i,l){this.#y+=1,this.#b=l,this.#A+=1,this.#i.push({...i,id:this.#A,receivedAt:l})&&(this.#x+=1),this.#C(wl(i.level),l,null)}#N(i,l){this.#w+=1,this.#T=l,this.#A+=1,this.#s.push({...i,id:this.#A,receivedAt:l}),this.#C(Mi(i.event),l,hE(i.event,i.value))}#M(i){return Number.isFinite(i)?(this.#p=Math.max(this.#p,i),this.#p):this.#p}#C(i,l,r){const u=this.#j(l);u.snapshot=null;const d=u.signals.get(i)??yE();if(d.count+=1,dc(this.#o,i,1),r!==null){d.samples+=1,d.sum+=r,d.minimum=d.minimum===null?r:Math.min(d.minimum,r),d.maximum=d.maximum===null?r:Math.max(d.maximum,r),(d.firstAt===null||l=d.lastAt)&&(d.last=r,d.lastAt=l),dc(this.#m,i,r);const f=this.#c[i];(!f||l>=f.time)&&(this.#c[i]={value:r,time:l}),this.#d[i]=Math.max(this.#d[i]??r,r)}u.signals.set(i,d)}#j(i){const l=Math.floor(i/1e3)*1e3,r=this.#a.get(l);if(r)return r;const u={time:l,signals:new Map,snapshot:null};return this.#a.set(l,u),u}#v(i){const l=i-mE;for(const[r,u]of this.#a){if(r>=l)break;for(const[d,f]of u.signals)if(dc(this.#r,d,f.count),dc(this.#l,d,f.sum),f.last!==null&&f.lastAt!==null){const p=this.#u[d];(!p||f.lastAt>=p.time)&&(this.#u[d]={value:f.last,time:f.lastAt})}this.#a.delete(r)}}#k(){!this.#t||this.#_||(this.#_=setTimeout(()=>{this.#_=null,this.flush()},pE))}#R(){const i=[...this.#a.values()].map(l=>(l.snapshot??={time:l.time,signals:Object.fromEntries([...l.signals].map(([r,u])=>[r,{...u}]))},l.snapshot));return{now:this.#M(this.#e()),sessionStartedAt:this.#h,totalFrames:this.#f,totalLogs:this.#y,evictedLogs:this.#x,clearedLogs:this.#g,totalEvents:this.#w,totalAcks:this.#E,invalidFrames:this.#z,buckets:i,priorSignalCounts:{...this.#r},priorSignalSums:{...this.#l},priorSignalLatest:oy(this.#u),signalTotals:{...this.#o},signalSums:{...this.#m},signalLatest:oy(this.#c),signalMaximums:{...this.#d},recentLogs:this.#i.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#b,lastEventAt:this.#T}}}function bE(n,i,l,r,u=n[0]?.time??l){const d=l-r*1e3,f=d<=u,p=f?Math.floor(u/1e3)*1e3:Math.ceil(d/1e3)*1e3,m=f?u:p,v=Math.floor(l/1e3)*1e3,S=n.filter(T=>T.time>=p&&T.time<=v).reduce((T,j)=>T+(j.signals[i]?.count??0),0),z=Math.max(0,(l-m)/1e3);return z>0?S/z:0}fun)DELIM" +R"DELIM(ction _E(n,i){const l=f=>bE(n.buckets,Mi(f),n.now,i,n.sessionStartedAt),r=l(2)+l(14);if(r>0)return{label:"Reorganizing",rate:r};const d=[{label:"Confirming blocks",rate:l(6)},{label:"Validating blocks",rate:l(5)},{label:"Archiving blocks",rate:l(3)},{label:"Synchronizing headers",rate:Math.max(l(0),l(1))}].reduce((f,p)=>p.rate>f.rate?p:f);return d.rate>0?d:{label:"Idle",rate:0}}const Lc=18,SE=600*1e3;function xE(n,i,l){if(n===null||!Number.isSafeInteger(n)||n<0||i===null||!Number.isSafeInteger(i.height)||i.height<0||i.height>n||!Number.isFinite(i.timestamp)||i.timestamp<=0||!Number.isFinite(l)||l<0)return null;const r=Math.max(0,l-i.timestamp*1e3),u=Math.max(n,i.height+Math.ceil(r/SE));return{blocksRemaining:u-n,estimatedTop:u,progress:u===0?100:n/u*100}}const wE={idle:"border-slate-500/40 bg-slate-500/10 text-slate-300",connecting:"border-amber-500/40 bg-amber-500/10 text-amber-300",connected:"border-emerald-500/40 bg-emerald-500/10 text-emerald-300",reconnecting:"border-orange-500/40 bg-orange-500/10 text-orange-300"};function zE({phase:n,label:i}){return _.jsxs("span",{className:`inline-flex items-center gap-2 rounded-full border px-3 py-1 text-xs tracking-wide uppercase ${wE[n]}`,children:[_.jsx("span",{className:"h-2 w-2 rounded-full bg-current","aria-hidden":"true"}),i]})}function hc({label:n,value:i,detail:l,numeric:r=!0,emphasized:u=!1}){return _.jsxs("div",{className:"min-w-0 border-white/10 px-4 py-3 even:border-l lg:border-l lg:first:border-l-0 [&:nth-child(n+3)]:border-t lg:[&:nth-child(n+3)]:border-t-0",children:[_.jsx("dt",{className:"text-textMuted text-xs",children:n}),_.jsx("dd",{className:`mt-1 leading-7 font-medium break-words ${r?"font-mono text-xl tracking-tight tabular-nums":"text-base"} ${u?"text-accent":"text-textPrimary"}`,children:i}),_.jsx("dd",{className:"text-textMuted mt-0.5 text-xs leading-4 break-words",children:l})]})}function EE({confirmed:n,estimate:i}){if(n===null||i===null||i.blocksRemaining<=Lc)return null;const l=Math.min(99.99,Math.max(0,i.progress)),r=`${l.toFixed(2)}%`;return _.jsxs("section",{className:"border-accent/25 bg-surface/70 overflow-hidden rounded-xl border","aria-labelledby":"node-sync-progress-title",children:[_.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-3 px-5 pt-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Node synchronization"}),_.jsx("h2",{id:"node-sync-progress-title",className:"mt-1 font-semibold",children:"Catching up to estimated chain tip"})]}),_.jsx("p",{className:"text-accent font-mono text-xl font-semibold tabular-nums",children:r})]}),_.jsx("div",{className:"px-5 pt-4",children:_.jsx("div",{role:"progressbar","aria-label":"Node synchronization progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Number(l.toFixed(2)),"aria-valuetext":`Approximately ${Hn(i.blocksRemaining)} blocks remaining`,className:"bg-background h-3 overflow-hidden rounded-full border border-white/5",children:_.jsx("div",{className:"bg-accent h-full rounded-full transition-[width] duration-700",style:{width:`${String(l)}%`}})})}),_.jsxs("dl",{className:"mt-5 grid gap-px bg-white/5 text-sm sm:grid-cols-3",children:[_.jsx(Wd,{label:"Confirmed top",value:Hn(n)}),_.jsx(Wd,{label:"Estimated chain tip",value:Hn(i.estimatedTop)}),_.jsx(Wd,{label:"Estimated blocks remaining",value:Hn(i.blocksRemaining)})]}),_.jsx("p",{className:"bg-surface text-textMuted border-t border-white/5 px-5 py-2 text-[11px]",children:"Estimated from the confirmed block timestamp and your browser clock, assuming one block every 10 minutes. Actual block counts may differ."})]})}function Wd({label:n,value:i}){return _.jsxs("div",{className:"bg-surface px-5 py-3",children:[_.jsx("dt",{className:"text-textMuted text-xs",children:n}),_.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:i})]})}const lr=16,dh=8,Ph=80,TE=[300,900,3600],hh=["line","step","area","bar"],AE=["linear","compressed"],bn=["#ffa022","#38bdf8","#34d399","#c084fc","#fb7185","#e879f9","#facc15","#60a5fa"],NE=Ec(["occurrence-count","occurrence-rate","cumulative-occurrences","payload-latest","payload-average","payload-minimum","payload-maximum","payload-sum","payload-cumulative","payload-change-rate"]),ME=Ol({id:os().min(1).max(100),signalId:os().min(1).max(100),measure:NE,color:os().regex(/^#[\da-f]{6}$/iu),label:os().max(80).optional()}).strict(),eb=Ol({id:os().min(1).max(100),title:os().trim().min(1).max(Ph),visualization:Ec(hh),scale:Ec(AE).default("linear"),range:Fh([yc(300),yc(900),yc(3600)]),series:Kh(ME).min(1).max(dh)}).strict(),OE=Ol({version:yc(1),charts:Kh(eb).max(lr)}).strict(),tb={id:"default-sync-pipeline",title:"Sync pipeline",visualization:"line",scale:"linear",range:900,series:[hi("sync-header",Mi(0),"occurrence-rate",bn[3]),hi("sync-archive",Mi(3),"occurrence-rate",bn[0]),hi("sync-validate",Mi(5),"occurrence-rate",bn[1]),hi("sync-confirm",Mi(6),"occurrence-rate",bn[2])]},jE={id:"default-chain-progress",title:"Chain progress",visualization:"step",scale:"linear",range:900,series:[hi("progress-top",Mc,"payload-latest",bn[0]),hi("progress-organized",Mi(13),"payload-latest",bn[2]),hi("progress-confirmed",Mi(6),"payload-latest",bn[1])]},kE={id:"default-log-volume",title:"Log volume",visualization:"bar",scale:"linear",range:900,series:[hi("logs-news",wl(1),"occurrence-rate",bn[2]),hi("logs-session",wl(2),"occurrence-rate",bn[3]),hi("logs-protocol",wl(3),"occurrence-rate",bn[1]),hi("logs-remote",wl(5),"occurrence-rate",bn[7]),hi("logs-fault",wl(6),"occurrence-rate",bn[4]),hi("logs-quitting",wl(7),"occurrence-rate",bn[0])]},Wh=[{id:"sync-pipeline",label:"Sync pipeline",description:"Header and block lifecycle throughput.",chart:tb},{id:"chain-progress",label:"Chain progress",description:"Canonical, organized, and confirmed heights.",chart:jE},{id:"log-volume",label:"Log volume",description:"Message rates grouped by log level.",chart:kE}],nb="libbitcoinAdminDashboardCharts";let cy=0;function hi(n,i,l,r){return{id:n,signalId:i,measure:l,color:r}}function Oc(n){return cy+=1,`${n}-${Date.now().toString(36)}-${String(cy)}`}function em(n,i=!1){return{...n,id:i?Oc("chart"):n.id,series:n.series.map(l=>({...l,id:i?Oc("series"):l.id}))}}function bc(){return Wh.map(n=>em(n.chart))}function RE(n){const i=Wh.find(l=>l.id===n);return em(i?.chart??tb,!0)}function ib(){return{id:Oc("chart"),title:"Custom chart",visualization:"line",scale:"linear",range:900,series:[{id:Oc("series"),signalId:Mi(3),measure:"occurrence-rate",color:bn[0]}]}}function CE(n){const i=" copy",l=`${n.title.slice(0,Ph-i.length).trimEnd()}${i}`;return{...em(n,!0),title:l}}function mh(n){const i=new Set(n.series.map(l=>El(Za(l.signalId),l.measure).unit));return i.size===1?[...i][0]??null:null}function ab(n){const i=eb.safeParse(n);if(!i.success)return i.error.issues[0]?.message??"Invalid chart configuration";for(const l of n.series){const r=Za(l.signalId);if(!dE(r,l.measure))return`${P0[l.measure].label} is not valid for ${r.label}.`;const u=El(r,l.measure);if(!u.chartTypes.includes(n.visualization))return`${u.label} cannot be displayed as a ${n.visualization} chart.`}return mh(n)===null?"All series on a chart must use compatible units.":null}function lb(n){const i=OE.safeParse(n);return!i.success||new Set(i.data.charts.map(l=>l.id)).size!==i.data.charts.length||i.data.charts.some(l=>new Set(l.series.map(r=>r.id)).size!==l.series.length)?null:i.data.charts.every(l=>ab(l)===null)?i.data.charts:null}function sb(){try{return globalThis.window?.localStorage??null}catch{return null}}function DE(n=sb()){try{const i=n?.getItem(nb);return i?lb(JSON.parse(i))??bc():bc()}catch{return bc()}}function UE(n,i=sb()){try{const l={version:1,charts:n};if(!lb(l))return;i?.setItem(nb,JSON.stringify(l))}catch{}}function tm(n,i){return n.signals[i]}function fy(n,i,l,r){let u=r==="count"?n.priorSignalCounts[i]??0:n.priorSignalSums[i]??0;for(const d of n.buckets){if(d.time>=l)break;const f=tm(d,i);u+=r===")DELIM" +R"DELIM(count"?f?.count??0:f?.sum??0}return u}function ZE(n,i,l){let r=n.priorSignalLatest[i]??null;for(const u of n.buckets){if(u.time>=l)break;const d=tm(u,i);d?.last!==null&&d?.last!==void 0&&d.lastAt!==null&&(r={value:d.last,time:d.lastAt})}return r}function $E(n,i){const l=i<=n.sessionStartedAt?Math.floor(n.sessionStartedAt/1e3)*1e3:Math.ceil(i/1e3)*1e3,r=Math.floor(n.now/1e3)*1e3,u=new Map(n.buckets.map(f=>[f.time,f])),d=[];for(let f=l;f<=r;f+=1e3)d.push(u.get(f)??{time:f,signals:{}});return d}function LE(n,i,l){const r=Math.max(n.time,l),u=Math.min(i,n.time+1e3);return Math.max(0,(u-r)/1e3)}function HE(n,i,l,r){const u=Za(r.signalId);let d=r.measure==="cumulative-occurrences"?fy(n,r.signalId,l,"count"):r.measure==="payload-cumulative"?fy(n,r.signalId,l,"sum"):0,f=ZE(n,r.signalId,l);return i.map(p=>{const m=tm(p,r.signalId);switch(r.measure){case"occurrence-count":return m?.count??0;case"occurrence-rate":{const v=LE(p,n.now,n.sessionStartedAt);return v>0?(m?.count??0)/v:0}case"cumulative-occurrences":return d+=m?.count??0,d;case"payload-sum":return m&&m.samples>0?m.sum:null;case"payload-cumulative":return d+=m?.sum??0,d;case"payload-average":return m&&m.samples>0?m.sum/m.samples:null;case"payload-minimum":return m?.minimum??null;case"payload-maximum":return m?.maximum??null;case"payload-latest":return m?.last!==null&&m?.last!==void 0&&m.lastAt!==null?(f={value:m.last,time:m.lastAt},m.last):u.payloadKind==="height"?f?.value??null:null;case"payload-change-rate":{if(m?.last===null||m?.last===void 0||m.lastAt===null)return null;const v=f??(m.first!==null&&m.firstAt!==null?{value:m.first,time:m.firstAt}:null);if(f={value:m.last,time:m.lastAt},!v)return null;const w=(m.lastAt-v.time)/1e3;return w>0?(m.last-v.value)/w:null}}})}function qE(n,i){const l=n.now-i.range*1e3,r=$E(n,l),u=r[0]?.time??Math.floor(n.now/1e3)*1e3,d=i.series[0],f=El(Za(d.signalId),d.measure).unit,p=i.series.filter(m=>(n.signalTotals[m.signalId]??0)===0).map(m=>m.label??Za(m.signalId).label);return{data:[r.map(m=>m.time/1e3),...i.series.map(m=>HE(n,r,u,m))],unit:f,hasObservedData:p.length({...i}))}}function KE(){const n=new Map;for(const i of Ih){const l=n.get(i.category)??[];l.push(i),n.set(i.category,l)}return[...n]}const FE=KE();function JE({chart:n,mode:i,onCancel:l,onSave:r}){const[u,d]=re.useState(()=>QE(n)),f=ab(u),p=mh(u);re.useEffect(()=>{function T(j){j.key==="Escape"&&l()}return globalThis.addEventListener("keydown",T),()=>{globalThis.removeEventListener("keydown",T)}},[l]);const m=re.useMemo(()=>new Set(hh.filter(T=>u.series.every(j=>El(Za(j.signalId),j.measure).chartTypes.includes(T)))),[u.series]);function v(T,j){d(L=>({...L,series:L.series.map((V,H)=>H===T?j:V)}))}function w(T,j){const L=u.series[T],V=Za(j);v(T,{...L,signalId:j,measure:V.defaultMeasure})}function S(){if(u.series.length>=dh)return;const T=mh(u),j=Ih.find(H=>H.allowedMeasures.some(G=>T===null||El(H,G).unit===T));if(!j)return;const L=j.allowedMeasures.find(H=>T===null||El(j,H).unit===T)??j.defaultMeasure,V={id:`series-${Date.now().toString(36)}-${String(u.series.length+1)}`,signalId:j.id,measure:L,color:bn[u.series.length%bn.length]??bn[0]};d(H=>({...H,series:[...H.series,V]}))}function z(T){T.preventDefault(),!f&&r({...u,title:u.title.trim()})}return _.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/75 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:T=>{T.target===T.currentTarget&&l()},children:_.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"chart-editor-title",className:"border-accent/30 bg-surface max-h-[92vh] w-full max-w-4xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/60",children:[_.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Dashboard builder"}),_.jsx("h2",{id:"chart-editor-title",className:"mt-1 text-xl font-semibold",children:i==="add"?"Add chart":"Edit chart"})]}),_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close chart editor",children:"×"})]}),i==="add"&&_.jsxs("div",{className:"border-accent/15 border-b p-5",children:[_.jsx("p",{className:"text-textMuted mb-3 text-xs font-medium tracking-wide uppercase",children:"Start from a template"}),_.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-5",children:[Wh.map(T=>_.jsxs("button",{type:"button",onClick:()=>{d(RE(T.id))},className:"border-accent/20 bg-background/50 hover:border-accent/60 rounded-lg border p-3 text-left",children:[_.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:T.label}),_.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:T.description})]},T.id)),_.jsxs("button",{type:"button",onClick:()=>{d(ib())},className:"border-accent/20 bg-background/50 hover:border-accent/60 rounded-lg border p-3 text-left",children:[_.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:"Custom"}),_.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:"Begin with one editable series."})]})]})]}),_.jsxs("form",{onSubmit:z,className:"space-y-6 p-5",children:[_.jsxs("div",{className:"grid gap-4 md:grid-cols-[minmax(0,1fr)_11rem_11rem]",children:[_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Chart title"}),_.jsx("input",{value:u.title,maxLength:Ph,onChange:T=>{d(j=>({...j,title:T.target.value}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Chart type"}),_.jsx("select",{value:u.visualization,onChange:T=>{d(j=>({...j,visualization:T.target.value}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0",children:hh.map(T=>_.jsx("option",{value:T,disabled:!m.has(T),children:YE[T]},T))})]}),_.jsxs("label",{className:"space-y-2",children:[_.jsx("span",{className:"text-sm font-medium",children:"Time range"}),_.jsx("select",{value:u.range,onChange:T=>{d(j=>({...j,range:Number(T.target.value)}))},className:"border-accent/25 bg-background/70 text-textPrimary focus:border-accent w-full rounded-lg border px-3 py-2 text-sm focus:ring-0",children:TE.map(T=>_.jsx("option",{value:T,children:GE[T]},T))})]})]}),_.jsxs("section",{className:"space-y-3",children:[_.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[_.jsxs("div",{children:[_.jsx("h3",{className:"font-semibold",children:"Series"}),_.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:["One chart uses one axis unit",p===null?".":`: ${rb(p)}.`]})]}),_.jsx("button",{type:"button",onClick:S,disabled:u.series.length>=dh,className:"border-accent/35 text-accent hover:bg-accent/10 disabled:text-textMuted rounded-lg border px-3 py-2 text-xs font-medium uppercase disabled:cursor-not-allowed disabled:opacity-50",children:"Add series"})]}),_.jsx("div",{className:"space-y-3",children:u.series.map((T,j)=>{const L=Za(T.signalId),V=El(L,T.measure);return _.jsxs("article",{c)DELIM" +R"DELIM(lassName:"border-accent/15 bg-background/35 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:[_.jsxs("label",{className:"space-y-1.5",children:[_.jsxs("span",{className:"text-textMuted text-xs",children:["Signal ",String(j+1)]}),_.jsx("select",{"aria-label":`Signal ${String(j+1)}`,value:T.signalId,onChange:H=>{w(j,H.target.value)},className:"border-accent/25 bg-surface text-textPrimary focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0",children:FE.map(([H,G])=>_.jsx("optgroup",{label:H,children:G.map(W=>_.jsx("option",{value:W.id,children:W.label},W.id))},H))})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Measurement"}),_.jsx("select",{"aria-label":`Measurement ${String(j+1)}`,value:T.measure,onChange:H=>{v(j,{...T,measure:H.target.value})},className:"border-accent/25 bg-surface text-textPrimary focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0",title:V.description,children:L.allowedMeasures.map(H=>_.jsx("option",{value:H,children:El(L,H).label},H))})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Display label"}),_.jsx("input",{"aria-label":`Display label ${String(j+1)}`,value:T.label??"",onChange:H=>{v(j,{...T,label:H.target.value||void 0})},placeholder:L.label,className:"border-accent/25 bg-surface text-textPrimary placeholder:text-textMuted/50 focus:border-accent w-full rounded-lg border px-2 py-2 text-sm focus:ring-0"})]}),_.jsxs("label",{className:"space-y-1.5",children:[_.jsx("span",{className:"text-textMuted text-xs",children:"Color"}),_.jsx("input",{"aria-label":`Series color ${String(j+1)}`,type:"color",value:T.color,onChange:H=>{v(j,{...T,color:H.target.value})},className:"border-accent/25 bg-surface h-10 w-full rounded-lg border p-1"})]}),_.jsx("button",{type:"button",onClick:()=>{d(H=>({...H,series:H.series.filter((G,W)=>W!==j)}))},disabled:u.series.length===1,"aria-label":`Remove series ${String(j+1)}`,className:"text-textMuted self-end rounded-lg px-3 py-2 text-sm hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-30",children:"Remove"})]},T.id)})})]}),f&&_.jsx("p",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-200",children:f}),_.jsxs("div",{className:"flex justify-end gap-2 border-t border-white/5 pt-4",children:[_.jsx("button",{type:"button",onClick:l,className:"text-textMuted hover:text-textPrimary rounded-lg px-4 py-2 text-sm",children:"Cancel"}),_.jsx("button",{type:"submit",disabled:f!==null,className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold disabled:cursor-not-allowed disabled:opacity-40",children:i==="add"?"Add chart":"Save changes"})]})]})]})})}const XE=!0,tn="u-",IE="uplot",PE=tn+"hz",WE=tn+"vt",eT=tn+"title",tT=tn+"wrap",nT=tn+"under",iT=tn+"over",aT=tn+"axis",rs=tn+"off",lT=tn+"select",sT=tn+"cursor-x",rT=tn+"cursor-y",oT=tn+"cursor-pt",uT=tn+"legend",cT=tn+"live",fT=tn+"inline",dT=tn+"series",hT=tn+"marker",dy=tn+"label",mT=tn+"value",No="width",Mo="height",zo="top",hy="bottom",ir="left",eh="right",nm="#000",my=nm+"0",th="mousemove",py="mousedown",nh="mouseup",gy="mouseenter",vy="mouseleave",yy="dblclick",pT="resize",gT="scroll",by="change",jc="dppxchange",im="--",_r=typeof window<"u",ph=_r?document:null,fr=_r?window:null,vT=_r?navigator:null;let Pe,mc;function gh(){let n=devicePixelRatio;Pe!=n&&(Pe=n,mc&&yh(by,mc,gh),mc=matchMedia(`(min-resolution: ${Pe-.001}dppx) and (max-resolution: ${Pe+.001}dppx)`),cs(by,mc,gh),fr.dispatchEvent(new CustomEvent(jc)))}function fi(n,i){if(i!=null){let l=n.classList;!l.contains(i)&&l.add(i)}}function vh(n,i){let l=n.classList;l.contains(i)&&l.remove(i)}function wt(n,i,l){n.style[i]=l+"px"}function Bi(n,i,l,r){let u=ph.createElement(n);return i!=null&&fi(u,i),l?.insertBefore(u,r),u}function Ai(n,i){return Bi("div",n,i)}const _y=new WeakMap;function sa(n,i,l,r,u){let d="translate("+i+"px,"+l+"px)",f=_y.get(n);d!=f&&(n.style.transform=d,_y.set(n,d),i<0||l<0||i>r||l>u?fi(n,rs):vh(n,rs))}const Sy=new WeakMap;function xy(n,i,l){let r=i+l,u=Sy.get(n);r!=u&&(Sy.set(n,r),n.style.background=i,n.style.borderColor=l)}const wy=new WeakMap;function zy(n,i,l,r){let u=i+""+l,d=wy.get(n);u!=d&&(wy.set(n,u),n.style.height=l+"px",n.style.width=i+"px",n.style.marginLeft=r?-i/2+"px":0,n.style.marginTop=r?-l/2+"px":0)}const am={passive:!0},yT={...am,capture:!0};function cs(n,i,l,r){i.addEventListener(n,l,r?yT:am)}function yh(n,i,l,r){i.removeEventListener(n,l,am)}_r&&gh();function Vi(n,i,l,r){let u;l=l||0,r=r||i.length-1;let d=r<=2147483647;for(;r-l>1;)u=d?l+r>>1:mi((l+r)/2),i[u]{let d=-1,f=-1;for(let p=r;p<=u;p++)if(n(l[p])){d=p;break}for(let p=u;p>=r;p--)if(n(l[p])){f=p;break}return[d,f]}}const ub=n=>n!=null,cb=n=>n!=null&&n>0,Hc=ob(ub),bT=ob(cb);function _T(n,i,l,r=0,u=!1){let d=u?bT:Hc,f=u?cb:ub;[i,l]=d(n,i,l);let p=n[i],m=n[i];if(i>-1)if(r==1)p=n[i],m=n[l];else if(r==-1)p=n[l],m=n[i];else for(let v=i;v<=l;v++){let w=n[v];f(w)&&(wm&&(m=w))}return[p??gt,m??-gt]}function qc(n,i,l,r){let u=Ay(n),d=Ay(i);n==i&&(u==-1?(n*=l,i/=l):(n/=l,i*=l));let f=l==10?$a:fb,p=u==1?mi:Ni,m=d==1?Ni:mi,v=p(f(en(n))),w=m(f(en(i))),S=hr(l,v),z=hr(l,w);return l==10&&(v<0&&(S=vt(S,-v)),w<0&&(z=vt(z,-w))),r||l==2?(n=S*u,i=z*d):(n=pb(n,S),i=Bc(i,z)),[n,i]}function lm(n,i,l,r){let u=qc(n,i,l,r);return n==0&&(u[0]=0),i==0&&(u[1]=0),u}const sm=.1,Ey={mode:3,pad:sm},ko={pad:0,soft:null,mode:0},ST={min:ko,max:ko};function kc(n,i,l,r){return Vc(l)?Ty(n,i,l):(ko.pad=l,ko.soft=r?0:null,ko.mode=r?3:0,Ty(n,i,ST))}function Je(n,i){return n??i}function xT(n,i,l){for(i=Je(i,0),l=Je(l,n.length-1);i<=l;){if(n[i]!=null)return!0;i++}return!1}function Ty(n,i,l){let r=l.min,u=l.max,d=Je(r.pad,0),f=Je(u.pad,0),p=Je(r.hard,-gt),m=Je(u.hard,gt),v=Je(r.soft,gt),w=Je(u.soft,-gt),S=Je(r.mode,0),z=Je(u.mode,0),T=i-n,j=$a(T),L=qn(en(n),en(i)),V=$a(L),H=en(V-j);(T<1e-24||H>10)&&(T=0,(n==0||i==0)&&(T=1e-24,S==2&&v!=gt&&(d=0),z==2&&w!=-gt&&(f=0)));let G=T||L||1e3,W=$a(G),B=hr(10,mi(W)),ne=G*(T==0?n==0?.1:1:d),ee=vt(pb(n-ne,B/10),24),K=n>=v&&(S==1||S==3&&ee<=v||S==2&&ee>=v)?v:gt,le=qn(p,ee=K?K:Gi(K,ee)),ze=G*(T==0?i==0?.1:1:f),ve=vt(Bc(i+ze,B/10),24),ie=i<=w&&(z==1||z==3&&ve>=w||z==2&&ve<=w)?w:-gt,_e=Gi(m,ve>ie&&i<=ie?ie:qn(ie,ve));return le==_e&&le==0&&(_e=100),[le,_e]}const wT=new Intl.NumberFormat(_r?vT.language:"en-US"),rm=n=>wT.format(n),pi=Math,_c=pi.PI,en=pi.abs,mi=pi.floor,Wt=pi.round,Ni=pi.ceil,Gi=pi.min,qn=pi.max,hr=pi.pow,Ay=pi.sign,$a=pi.log10,fb=pi.log2,zT=(n,i=1)=>pi.sinh(n)*i,ih=(n,i=1)=>pi.asinh(n/i),gt=1/0;function Ny(n){return($a((n^n>>31)-(n>>31))|0)+1}function bh(n,i,l){return Gi(qn(n,i),l)}function db(n){return typeof n=="function"}function Be(n){return db(n)?n:()=>n}const ET=()=>{},hb=n=>n,mb=(n,i)=>i,TT=n=>null,My=n=>!0,Oy=(n,i)=>n==i,AT=/\.\d*?(?=9{6,}|0{6,})/gm,hs=n=>{if(vb(n)||Al.has(n))return n;const i=`${n}`,l=i.match(AT);if(l==null)return n;let r=l[0].length-1;if(i.indexOf("e-")!=-1){let[u,d]=i.split("e");return+`${hs(u)}e${d}`}return vt(n,r)};function ls(n,i){return hs(vt(hs(n/i))*i)}function Bc(n,i){return hs(Ni(hs(n/i))*i)}function pb(n,i){return hs(mi(hs(n/i))*i)}function vt(n,i=0){if(vb(n))return n;let l=10**i,r=n*l*(1+Number.EPSILON);return Wt(r)/l}const Al=new Map;function gb(n){return((""+n).split(".")[1]||"").length}function Uo(n,i,l,r){let u=[],d=r.map(gb);for(let f=i;f=0?0:p)+(f>=d[v]?0:d[v]),z=n==10?w:vt(w,S);u.push(z),Al.set(z,S)}}return u}const Ro={},om=[],mr=[null,null],zl=Array.isArray,vb=Number.isInteger,NT=n=>n===void 0;function jy(n){return typeof n=="string"}function Vc(n){let i=!1;if(n!=null){let l=n.constructor;i=l==null||l==Object}return i}function MT(n){return n!)DELIM" +R"DELIM(=null&&typeof n=="object"}const OT=Object.getPrototypeOf(Uint8Array),yb="__proto__";function pr(n,i=Vc){let l;if(zl(n)){let r=n.find(u=>u!=null);if(zl(r)||i(r)){l=Array(n.length);for(let u=0;ud){for(u=f-1;u>=0&&n[u]==null;)n[u--]=null;for(u=f+1;uf-p)],u=r[0].length,d=new Map;for(let f=0;f"u"?n=>Promise.resolve().then(n):queueMicrotask;function ZT(n){let i=n[0],l=i.length,r=Array(l);for(let d=0;di[d]-i[f]);let u=[];for(let d=0;d=r&&n[u]==null;)u--;if(u<=r)return!0;const d=qn(1,mi((u-r+1)/i));for(let f=n[r],p=r+d;p<=u;p+=d){const m=n[p];if(m!=null){if(m<=f)return!1;f=m}}return!0}const bb=["January","February","March","April","May","June","July","August","September","October","November","December"],_b=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Sb(n){return n.slice(0,3)}const HT=_b.map(Sb),qT=bb.map(Sb),BT={MMMM:bb,MMM:qT,WWWW:_b,WWW:HT};function Eo(n){return(n<10?"0":"")+n}function VT(n){return(n<10?"00":n<100?"0":"")+n}const GT={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=>Eo(n.getMonth()+1),M:n=>n.getMonth()+1,DD:n=>Eo(n.getDate()),D:n=>n.getDate(),WWWW:(n,i)=>i.WWWW[n.getDay()],WWW:(n,i)=>i.WWW[n.getDay()],HH:n=>Eo(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=>Eo(n.getMinutes()),m:n=>n.getMinutes(),ss:n=>Eo(n.getSeconds()),s:n=>n.getSeconds(),fff:n=>VT(n.getMilliseconds())};function um(n,i){i=i||BT;let l=[],r=/\{([a-z]+)\}|[^{]+/gi,u;for(;u=r.exec(n);)l.push(u[0][0]=="{"?GT[u[1]]:u[0]);return d=>{let f="";for(let p=0;pn%1==0,Rc=[1,2,2.5,5],KT=Uo(10,-32,0,Rc),wb=Uo(10,0,32,Rc),FT=wb.filter(xb),ss=KT.concat(wb),cm=` +`,zb="{YYYY}",ky=cm+zb,Eb="{M}/{D}",Oo=cm+Eb,pc=Oo+"/{YY}",Tb="{aa}",JT="{h}:{mm}",sr=JT+Tb,Ry=cm+sr,Cy=":{ss}",tt=null;function Ab(n){let i=n*1e3,l=i*60,r=l*60,u=r*24,d=u*30,f=u*365,m=(n==1?Uo(10,0,3,Rc).filter(xb):Uo(10,-3,0,Rc)).concat([i,i*5,i*10,i*15,i*30,l,l*5,l*10,l*15,l*30,r,r*2,r*3,r*4,r*6,r*8,r*12,u,u*2,u*3,u*4,u*5,u*6,u*7,u*8,u*9,u*10,u*15,d,d*2,d*3,d*4,d*6,f,f*2,f*5,f*10,f*25,f*50,f*100]);const v=[[f,zb,tt,tt,tt,tt,tt,tt,1],[u*28,"{MMM}",ky,tt,tt,tt,tt,tt,1],[u,Eb,ky,tt,tt,tt,tt,tt,1],[r,"{h}"+Tb,pc,tt,Oo,tt,tt,tt,1],[l,sr,pc,tt,Oo,tt,tt,tt,1],[i,Cy,pc+" "+sr,tt,Oo+" "+sr,tt,Ry,tt,1],[n,Cy+".{fff}",pc+" "+sr,tt,Oo+" "+sr,tt,Ry,tt,1]];function w(S){return(z,T,j,L,V,H)=>{let G=[],W=V>=f,B=V>=d&&V=u?u:V,ve=mi(j)-mi(ee),ie=le+ve+Bc(ee-le,ze);G.push(ie);let _e=S(ie),ce=_e.getHours()+_e.getMinutes()/l+_e.getSeconds()/r,Ee=V/r,he=z.axes[T]._space,D=H/he;for(;ie=vt(ie+V,n==1?0:3),!(ie>L);)if(Ee>1){let Q=mi(vt(ce+Ee,6))%24,Se=S(ie).getHours()-Q;Se>1&&(Se=-1),ie-=Se*r,ce=(ce+Ee)%24;let N=G[G.length-1];vt((ie-N)/V,3)*D>=.7&&G.push(ie)}else G.push(ie)}return G}}return[m,v,w]}const[XT,IT,PT]=Ab(1),[WT,eA,tA]=Ab(.001);Uo(2,-53,53,[1]);function Dy(n,i){return n.map(l=>l.map((r,u)=>u==0||u==8||r==null?r:i(u==1||l[8]==0?r:l[1]+r)))}function Uy(n,i){return(l,r,u,d,f)=>{let p=i.find(j=>f>=j[0])||i[i.length-1],m,v,w,S,z,T;return r.map(j=>{let L=n(j),V=L.getFullYear(),H=L.getMonth(),G=L.getDate(),W=L.getHours(),B=L.getMinutes(),ne=L.getSeconds(),ee=V!=m&&p[2]||H!=v&&p[3]||G!=w&&p[4]||W!=S&&p[5]||B!=z&&p[6]||ne!=T&&p[7]||p[1];return m=V,v=H,w=G,S=W,z=B,T=ne,ee(L)})}}function nA(n,i){let l=um(i);return(r,u,d,f,p)=>u.map(m=>l(n(m)))}function ah(n,i,l){return new Date(n,i,l)}function Zy(n,i){return i(n)}const iA="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function $y(n,i){return(l,r,u,d)=>d==null?im:i(n(r))}function aA(n,i){let l=n.series[i];return l.width?l.stroke(n,i):l.points.width?l.points.stroke(n,i):null}function lA(n,i){return n.series[i].fill(n,i)}const sA={show:!0,live:!0,isolate:!1,mount:ET,markers:{show:!0,width:2,stroke:aA,fill:lA,dash:"solid"},idx:null,idxs:null,values:[]};function rA(n,i){let l=n.cursor.points,r=Ai(),u=l.size(n,i);wt(r,No,u),wt(r,Mo,u);let d=u/-2;wt(r,"marginLeft",d),wt(r,"marginTop",d);let f=l.width(n,i,u);return f&&wt(r,"borderWidth",f),r}function oA(n,i){let l=n.series[i].points;return l._fill||l._stroke}function uA(n,i){let l=n.series[i].points;return l._stroke||l._fill}function cA(n,i){return n.series[i].points.size}const lh=[0,0];function fA(n,i,l){return lh[0]=i,lh[1]=l,lh}function gc(n,i,l,r=!0){return u=>{u.button==0&&(!r||u.target==i)&&l(u)}}function sh(n,i,l,r=!0){return u=>{(!r||u.target==i)&&l(u)}}const dA={show:!0,x:!0,y:!0,lock:!1,move:fA,points:{one:!1,show:rA,size:cA,width:0,stroke:uA,fill:oA},bind:{mousedown:gc,mouseup:gc,click:gc,dblclick:gc,mousemove:sh,mouseleave:sh,mouseenter:sh},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,l,r,u)=>r-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},Nb={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},fm=Jt({},Nb,{filter:mb}),Mb=Jt({},fm,{size:10}),Ob=Jt({},Nb,{show:!1}),dm='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"',jb="bold "+dm,kb=1.5,Ly={show:!0,scale:"x",stroke:nm,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:jb,side:2,grid:fm,ticks:Mb,border:Ob,font:dm,lineGap:kb,rotate:0},hA="Value",mA="Time",Hy={show:!0,scale:"x",auto:!1,sorted:1,min:gt,max:-gt,idxs:[]};function pA(n,i,l,r,u){return i.map(d=>d==null?"":rm(d))}function gA(n,i,l,r,u,d,f){let p=[],m=Al.get(u)||0;l=f?l:vt(Bc(l,u),m);for(let v=l;v<=r;v=vt(v+u,m))p.push(Object.is(v,-0)?0:v);return p}function _h(n,i,l,r,u,d,f){const p=[],m=n.scales[n.axes[i].scale].log,v=m==10?$a:fb,w=mi(v(l));u=hr(m,w),m==10&&(u=ss[Vi(u,ss)]);let S=l,z=u*m;m==10&&(z=ss[Vi(z,ss)]);do p.push(S),S=S+u,m==10&&!)DELIM" +R"DELIM(Al.has(S)&&(S=vt(S,Al.get(u))),S>=z&&(u=S,z=u*m,m==10&&(z=ss[Vi(z,ss)]));while(S<=r);return p}function vA(n,i,l,r,u,d,f){let m=n.scales[n.axes[i].scale].asinh,v=r>m?_h(n,i,qn(m,l),r,u):[m],w=r>=0&&l<=0?[0]:[];return(l<-m?_h(n,i,qn(m,-r),-l,u):[m]).reverse().map(z=>-z).concat(w,v)}const Rb=/./,yA=/[12357]/,bA=/[125]/,qy=/1/,Sh=(n,i,l,r)=>n.map((u,d)=>i==4&&u==0||d%r==0&&l.test(u.toExponential()[u<0?1:0])?u:null);function _A(n,i,l,r,u){let d=n.axes[l],f=d.scale,p=n.scales[f],m=n.valToPos,v=d._space,w=m(10,f),S=m(9,f)-w>=v?Rb:m(7,f)-w>=v?yA:m(5,f)-w>=v?bA:qy;if(S==qy){let z=en(m(1,f)-w);if(zu,Gy={show:!0,auto:!0,sorted:0,gaps:Cb,alpha:1,facets:[Jt({},Vy,{scale:"x"}),Jt({},Vy,{scale:"y"})]},Yy={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:Cb,alpha:1,points:{show:zA,filter:null},values:null,min:gt,max:-gt,idxs:[],path:null,clip:null};function EA(n,i,l,r,u){return l/10}const Db={time:XE,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},TA=Jt({},Db,{time:!1,ori:1}),Qy={};function Ub(n,i){let l=Qy[n];return l||(l={key:n,plots:[],sub(r){l.plots.push(r)},unsub(r){l.plots=l.plots.filter(u=>u!=r)},pub(r,u,d,f,p,m,v){for(let w=0;w{let H=f.pxRound;const G=v.dir*(v.ori==0?1:-1),W=v.ori==0?Sr:xr;let B,ne;G==1?(B=l,ne=r):(B=r,ne=l);let ee=H(S(p[B],v,L,T)),K=H(z(m[B],w,V,j)),le=H(S(p[ne],v,L,T)),ze=H(z(d==1?w.max:w.min,w,V,j)),ve=new Path2D(u);return W(ve,le,ze),W(ve,ee,ze),W(ve,ee,K),ve})}function Gc(n,i,l,r,u,d){let f=null;if(n.length>0){f=new Path2D;const p=i==0?Kc:pm;let m=l;for(let S=0;Sz[0]){let T=z[0]-m;T>0&&p(f,m,r,T,r+d),m=z[1]}}let v=l+u-m,w=10;v>0&&p(f,m,r-w/2,v,r+d+w)}return f}function NA(n,i,l){let r=n[n.length-1];r&&r[0]==i?r[1]=l:n.push([i,l])}function mm(n,i,l,r,u,d,f){let p=[],m=n.length;for(let v=u==1?l:r;v>=l&&v<=r;v+=u)if(i[v]===null){let S=v,z=v;if(u==1)for(;++v<=r&&i[v]===null;)z=v;else for(;--v>=l&&i[v]===null;)z=v;let T=d(n[S]),j=z==S?T:d(n[z]),L=S-u;T=f<=0&&L>=0&&L=0&&H>=0&&H=T&&p.push([T,j])}return p}function Ky(n){return n==0?hb:n==1?Wt:i=>ls(i,n)}function Zb(n){let i=n==0?Yc:Qc,l=n==0?(u,d,f,p,m,v)=>{u.arcTo(d,f,p,m,v)}:(u,d,f,p,m,v)=>{u.arcTo(f,d,m,p,v)},r=n==0?(u,d,f,p,m)=>{u.rect(d,f,p,m)}:(u,d,f,p,m)=>{u.rect(f,d,m,p)};return(u,d,f,p,m,v=0,w=0)=>{v==0&&w==0?r(u,d,f,p,m):(v=Gi(v,p/2,m/2),w=Gi(w,p/2,m/2),i(u,d+v,f),l(u,d+p,f,d+p,f+m,v),l(u,d+p,f+m,d,f+m,w),l(u,d,f+m,d,f,w),l(u,d,f,d+p,f,v),u.closePath())}}const Yc=(n,i,l)=>{n.moveTo(i,l)},Qc=(n,i,l)=>{n.moveTo(l,i)},Sr=(n,i,l)=>{n.lineTo(i,l)},xr=(n,i,l)=>{n.lineTo(l,i)},Kc=Zb(0),pm=Zb(1),$b=(n,i,l,r,u,d)=>{n.arc(i,l,r,u,d)},Lb=(n,i,l,r,u,d)=>{n.arc(l,i,r,u,d)},Hb=(n,i,l,r,u,d,f)=>{n.bezierCurveTo(i,l,r,u,d,f)},qb=(n,i,l,r,u,d,f)=>{n.bezierCurveTo(l,i,u,r,f,d)};function Bb(n){return(i,l,r,u,d)=>ps(i,l,(f,p,m,v,w,S,z,T,j,L,V)=>{let{pxRound:H,points:G}=f,W,B;v.ori==0?(W=Yc,B=$b):(W=Qc,B=Lb);const ne=vt(G.width*Pe,3);let ee=(G.size-G.width)/2*Pe,K=vt(ee*2,3),le=new Path2D,ze=new Path2D,{left:ve,top:ie,width:_e,height:ce}=i.bbox;Kc(ze,ve-K,ie-K,_e+K*2,ce+K*2);const Ee=he=>{if(m[he]!=null){let D=H(S(p[he],v,L,T)),Q=H(z(m[he],w,V,j));W(le,D+ee,Q),B(le,D,Q,ee,0,_c*2)}};if(d)d.forEach(Ee);else for(let he=r;he<=u;he++)Ee(he);return{stroke:ne>0?le:null,fill:le,clip:ze,flags:gr|xh}})}function Vb(n){return(i,l,r,u,d,f)=>{r!=u&&(d!=r&&f!=r&&n(i,l,r),d!=u&&f!=u&&n(i,l,u),n(i,l,f))}}const MA=Vb(Sr),OA=Vb(xr);function Gb(n){const i=Je(n?.alignGaps,0);return(l,r,u,d)=>ps(l,r,(f,p,m,v,w,S,z,T,j,L,V)=>{[u,d]=Hc(m,u,d);let H=f.pxRound,G=ce=>H(S(ce,v,L,T)),W=ce=>H(z(ce,w,V,j)),B,ne;v.ori==0?(B=Sr,ne=MA):(B=xr,ne=OA);const ee=v.dir*(v.ori==0?1:-1),K={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:gr},le=K.stroke;let ze=!1;if(d-u>=L*4){let ce=Y=>l.posToVal(Y,v.key,!0),Ee=null,he=null,D,Q,pe,Me=G(p[ee==1?u:d]),Se=G(p[u]),N=G(p[d]),$=ce(ee==1?Se+1:N-1);for(let Y=ee==1?u:d;Y>=u&&Y<=d;Y+=ee){let se=p[Y],ge=(ee==1?se<$:se>$)?Me:G(se),ye=m[Y];ge==Me?ye!=null?(Q=ye,Ee==null?(B(le,ge,W(Q)),D=Ee=he=Q):Qhe&&(he=Q)):ye===null&&(ze=!0):(Ee!=null&&ne(le,Me,W(Ee),W(he),W(D),W(Q)),ye!=null?(Q=ye,B(le,ge,W(Q)),Ee=he=D=Q):(Ee=he=null,ye===null&&(ze=!0)),Me=ge,$=ce(Me+ee))}Ee!=null&&Ee!=he&&pe!=Me&&ne(le,Me,W(Ee),W(he),W(D),W(Q))}else for(let ce=ee==1?u:d;ce>=u&&ce<=d;ce+=ee){let Ee=m[ce];Ee===null?ze=!0:Ee!=null&&B(le,G(p[ce]),W(Ee))}let[ie,_e]=hm(l,r);if(f.fill!=null||ie!=0){let ce=K.fill=new Path2D(le),Ee=f.fillTo(l,r,f.min,f.max,ie),he=W(Ee),D=G(p[u]),Q=G(p[d]);ee==-1&&([Q,D]=[D,Q]),B(ce,Q,he),B(ce,D,he)}if(!f.spanGaps){let ce=[];ze&&ce.push(...mm(p,m,u,d,ee,G,i)),K.gaps=ce=f.gaps(l,r,u,d,ce),K.clip=Gc(ce,v.ori,T,j,L,V)}return _e!=0&&(K.band=_e==2?[La(l,r,u,d,le,-1),La(l,r,u,d,le,1)]:La(l,r,u,d,le,_e)),K})}function jA(n){const i=Je(n.align,1),l=Je(n.ascDesc,!1),r=Je(n.alignGaps,0),u=Je(n.extend,!1);return(d,f,p,m)=>ps(d,f,(v,w,S,z,T,j,L,V,H,G,W)=>{[p,m]=Hc(S,p,m);let B=v.pxRound,{left:ne,width:ee}=d.bbox,K=Se=>B(j(Se,z,G,V)),le=Se=>B(L(Se,T,W,H)),ze=z.ori==0?Sr:xr;const ve={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:gr},ie=ve.stroke,_e=z.dir*(z.ori==0?1:-1);let ce=le(S[_e==1?p:m]),Ee=K(w[_e==1?p:m]),he=Ee,D=Ee;u&&i==-1&&(D=ne,ze(ie,D,ce)),ze(ie,Ee,ce);for(let Se=_e==1?p:m;Se>=p&&Se<=m;Se+=_e){let N=S[Se];if(N==null)continue;let $=K(w[Se]),Y=le(N);i==1?ze(ie,$,ce):ze(ie,he,Y),ze(ie,$,Y),ce=Y,he=$}let Q=he;u&&i==1&&(Q=ne+ee,ze(ie,Q,ce));let[pe,Me]=hm(d,f);if(v.fill!=null||pe!=0){let Se=ve.fill=new Path2D(ie),N=v.fillTo(d,f,v.min,v.max,pe),$=le(N);ze(Se,Q,$),ze(Se,D,$)}if(!v.spanGaps){let Se=[];Se.push(...mm(w,S,p,m,_e,K,r));let N=v.width*Pe/2,$=l||i==1?N:-N,Y=l||i==-1?-N:N;Se.forEach(se=>{se[0]+=$,se[1]+=Y}),ve.gaps=Se=v.gaps(d,f,p,m,Se),ve.clip=Gc(Se,z.ori,V,H,G,W)}return Me!=0&&(ve.band=Me==2?[La(d,f,p,m,ie,-1),La(d,f,p,m,ie,1)]:La(d,f,p,m,ie,Me)),ve})}function Fy(n,i,l,r,u,d,f=gt){if(n.length>1){let p=null;for(let m=0,v=1/0;m{}),{fill:S,stroke:z}=v;return(T,j,L,V)=>ps(T,j,(H,G,W,B,ne,ee,K,le,ze,ve,ie)=>{let _e=H.pxRound,ce=l,Ee=)DELIM" +R"DELIM(r*Pe,he=p*Pe,D=m*Pe,Q,pe;B.ori==0?[Q,pe]=d(T,j):[pe,Q]=d(T,j);const Me=B.dir*(B.ori==0?1:-1);let Se=B.ori==0?Kc:pm,N=B.ori==0?w:(fe,it,Ot,Ri,ua,ti,ca)=>{w(fe,it,Ot,ua,Ri,ca,ti)},$=Je(T.bands,om).find(fe=>fe.series[0]==j),Y=$!=null?$.dir:0,se=H.fillTo(T,j,H.min,H.max,Y),we=_e(K(se,ne,ie,ze)),ge,ye,mt,Ve=ve,nt=_e(H.width*Pe),On=!1,ei=null,jn=null,xn=null,Yi=null;S!=null&&(nt==0||z!=null)&&(On=!0,ei=S.values(T,j,L,V),jn=new Map,new Set(ei).forEach(fe=>{fe!=null&&jn.set(fe,new Path2D)}),nt>0&&(xn=z.values(T,j,L,V),Yi=new Map,new Set(xn).forEach(fe=>{fe!=null&&Yi.set(fe,new Path2D)})));let{x0:Qi,size:jl}=v;if(Qi!=null&&jl!=null){ce=1,G=Qi.values(T,j,L,V),Qi.unit==2&&(G=G.map(Ot=>T.posToVal(le+Ot*ve,B.key,!0)));let fe=jl.values(T,j,L,V);jl.unit==2?ye=fe[0]*ve:ye=ee(fe[0],B,ve,le)-ee(0,B,ve,le),Ve=Fy(G,W,ee,B,ve,le,Ve),mt=Ve-ye+Ee}else Ve=Fy(G,W,ee,B,ve,le,Ve),mt=Ve*f+Ee,ye=Ve-mt;mt<1&&(mt=0),nt>=ye/2&&(nt=0),mt<5&&(_e=hb);let kl=mt>0,ji=Ve-mt-(kl?nt:0);ye=_e(bh(ji,D,he)),ge=(ce==0?ye/2:ce==Me?0:ye)-ce*Me*((ce==0?Ee/2:0)+(kl?nt/2:0));const Xt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Ki=On?null:new Path2D;let ki=null;if($!=null)ki=T.data[$.series[1]];else{let{y0:fe,y1:it}=v;fe!=null&&it!=null&&(W=it.values(T,j,L,V),ki=fe.values(T,j,L,V))}let oa=Q*ye,Te=pe*ye;for(let fe=Me==1?L:V;fe>=L&&fe<=V;fe+=Me){let it=W[fe];if(it==null)continue;if(ki!=null){let ot=ki[fe]??0;if(it-ot==0)continue;we=K(ot,ne,ie,ze)}let Ot=B.distr!=2||v!=null?G[fe]:fe,Ri=ee(Ot,B,ve,le),ua=K(Je(it,se),ne,ie,ze),ti=_e(Ri-ge),ca=_e(qn(ua,we)),kn=_e(Gi(ua,we)),nn=ca-kn;if(it!=null){let ot=it<0?Te:oa,Vt=it<0?oa:Te;On?(nt>0&&xn[fe]!=null&&Se(Yi.get(xn[fe]),ti,kn+mi(nt/2),ye,qn(0,nn-nt),ot,Vt),ei[fe]!=null&&Se(jn.get(ei[fe]),ti,kn+mi(nt/2),ye,qn(0,nn-nt),ot,Vt)):Se(Ki,ti,kn+mi(nt/2),ye,qn(0,nn-nt),ot,Vt),N(T,j,fe,ti-nt/2,kn,ye+nt,nn)}}return nt>0?Xt.stroke=On?Yi:Ki:On||(Xt._fill=H.width==0?H._fill:H._stroke??H._fill,Xt.width=0),Xt.fill=On?jn:Ki,Xt})}function RA(n,i){const l=Je(i?.alignGaps,0);return(r,u,d,f)=>ps(r,u,(p,m,v,w,S,z,T,j,L,V,H)=>{[d,f]=Hc(v,d,f);let G=p.pxRound,W=Q=>G(z(Q,w,V,j)),B=Q=>G(T(Q,S,H,L)),ne,ee,K;w.ori==0?(ne=Yc,K=Sr,ee=Hb):(ne=Qc,K=xr,ee=qb);const le=w.dir*(w.ori==0?1:-1);let ze=W(m[le==1?d:f]),ve=ze,ie=[],_e=[];for(let Q=le==1?d:f;Q>=d&&Q<=f;Q+=le)if(v[Q]!=null){let Me=m[Q],Se=W(Me);ie.push(ve=Se),_e.push(B(v[Q]))}const ce={stroke:n(ie,_e,ne,K,ee,G),fill:null,clip:null,band:null,gaps:null,flags:gr},Ee=ce.stroke;let[he,D]=hm(r,u);if(p.fill!=null||he!=0){let Q=ce.fill=new Path2D(Ee),pe=p.fillTo(r,u,p.min,p.max,he),Me=B(pe);K(Q,ve,Me),K(Q,ze,Me)}if(!p.spanGaps){let Q=[];Q.push(...mm(m,v,d,f,le,W,l)),ce.gaps=Q=p.gaps(r,u,d,f,Q),ce.clip=Gc(Q,w.ori,j,L,V,H)}return D!=0&&(ce.band=D==2?[La(r,u,d,f,Ee,-1),La(r,u,d,f,Ee,1)]:La(r,u,d,f,Ee,D)),ce})}function CA(n){return RA(DA,n)}function DA(n,i,l,r,u,d){const f=n.length;if(f<2)return null;const p=new Path2D;if(l(p,n[0],i[0]),f==2)r(p,n[1],i[1]);else{let m=Array(f),v=Array(f-1),w=Array(f-1),S=Array(f-1);for(let z=0;z0!=v[z]>0?m[z]=0:(m[z]=3*(S[z-1]+S[z])/((2*S[z]+S[z-1])/v[z-1]+(S[z]+2*S[z-1])/v[z]),isFinite(m[z])||(m[z]=0));m[f-1]=v[f-2];for(let z=0;z{un.pxRatio=Pe}));const UA=Gb(),ZA=Bb();function Xy(n,i,l,r){return(r?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map((d,f)=>zh(d,f,i,l))}function $A(n,i){return n.map((l,r)=>r==0?{}:Jt({},i,l))}function zh(n,i,l,r){return Jt({},i==0?l:r,n)}function Yb(n,i,l){return i==null?mr:[i,l]}const LA=Yb;function HA(n,i,l){return i==null?mr:kc(i,l,sm,!0)}function Qb(n,i,l,r){return i==null?mr:qc(i,l,n.scales[r].log,!1)}const qA=Qb;function Kb(n,i,l,r){return i==null?mr:lm(i,l,n.scales[r].log,!1)}const BA=Kb;function VA(n,i,l,r,u){let d=qn(Ny(n),Ny(i)),f=i-n,p=Vi(u/r*f,l);do{let m=l[p],v=r*m/f;if(v>=u&&d+(m<5?Al.get(m):0)<=17)return[m,v]}while(++p(i=Wt((l=+u)*Pe))+"px"),[n,i,l]}function GA(n){n.show&&[n.font,n.labelFont].forEach(i=>{let l=vt(i[2]*Pe,1);i[0]=i[0].replace(/[0-9.]+px/,l+"px"),i[1]=l})}function un(n,i,l){const r={mode:Je(n.mode,1)},u=r.mode;function d(g,y,x,E){let M=y.valToPct(g);return E+x*(y.dir==-1?1-M:M)}function f(g,y,x,E){let M=y.valToPct(g);return E+x*(y.dir==-1?M:1-M)}function p(g,y,x,E){return y.ori==0?d(g,y,x,E):f(g,y,x,E)}r.valToPosH=d,r.valToPosV=f;let m=!1;r.status=0;const v=r.root=Ai(IE);if(n.id!=null&&(v.id=n.id),fi(v,n.class),n.title){let g=Ai(eT,v);g.textContent=n.title}const w=Bi("canvas"),S=r.ctx=w.getContext("2d"),z=Ai(tT,v);cs("click",z,g=>{g.target===j&&(We!=Un||at!=Wi)&&Qe.click(r,g)},!0);const T=r.under=Ai(nT,z);z.appendChild(w);const j=r.over=Ai(iT,z);n=pr(n);const L=+Je(n.pxAlign,1),V=Ky(L);(n.plugins||[]).forEach(g=>{g.opts&&(n=g.opts(r,n)||n)});const H=n.ms||.001,G=r.series=u==1?Xy(n.series||[],Hy,Yy,!1):$A(n.series||[null],Gy),W=r.axes=Xy(n.axes||[],Ly,By,!0),B=r.scales={},ne=r.bands=n.bands||[];ne.forEach(g=>{g.fill=Be(g.fill||null),g.dir=Je(g.dir,-1)});const ee=u==2?G[1].facets[0].scale:G[0].scale,K={axes:jr,series:Jc},le=(n.drawOrder||["axes","series"]).map(g=>K[g]);function ze(g){const y=g.distr==3?x=>$a(x>0?x:g.clamp(r,x,g.min,g.max,g.key)):g.distr==4?x=>ih(x,g.asinh):g.distr==100?x=>g.fwd(x):x=>x;return x=>{let E=y(x),{_min:M,_max:R}=g,J=R-M;return(E-M)/J}}function ve(g){let y=B[g];if(y==null){let x=(n.scales||Ro)[g]||Ro;if(x.from!=null){ve(x.from);let E=Jt({},B[x.from],x,{key:g});E.valToPct=ze(E),B[g]=E}else{y=B[g]=Jt({},g==ee?Db:TA,x),y.key=g;let E=y.time,M=y.range,R=zl(M);if((g!=ee||u==2&&!E)&&(R&&(M[0]==null||M[1]==null)&&(M={min:M[0]==null?Ey:{mode:1,hard:M[0],soft:M[0]},max:M[1]==null?Ey:{mode:1,hard:M[1],soft:M[1]}},R=!1),!R&&Vc(M))){let J=M;M=(te,ae,oe)=>ae==null?mr:kc(ae,oe,J)}y.range=Be(M||(E?LA:g==ee?y.distr==3?qA:y.distr==4?BA:Yb:y.distr==3?Qb:y.distr==4?Kb:HA)),y.auto=Be(R?!1:y.auto),y.clamp=Be(y.clamp||EA),y._min=y._max=null,y.valToPct=ze(y)}}}ve("x"),ve("y"),u==1&&G.forEach(g=>{ve(g.scale)}),W.forEach(g=>{ve(g.scale)});for(let g in n.scales)ve(g);const ie=B[ee],_e=ie.distr;let ce,Ee;ie.ori==0?(fi(v,PE),ce=d,Ee=f):(fi(v,WE),ce=f,Ee=d);const he={};for(let g in B){let y=B[g];(y.min!=null||y.max!=null)&&(he[g]={min:y.min,max:y.max},y.min=y.max=null)}const D=n.tzDate||(g=>new Date(Wt(g/H))),Q=n.fmtDate||um,pe=H==1?PT(D):tA(D),Me=Uy(D,Dy(H==1?IT:eA,Q)),Se=$y(D,Zy(iA,Q)),N=[],$=r.legend=Jt({},sA,n.legend),Y=r.cursor=Jt({},dA,{drag:{y:u==2}},n.cursor),se=$.show,we=Y.show,ge=$.markers;$.idxs=N,ge.width=Be(ge.width),ge.dash=Be(ge.dash),ge.stroke=Be(ge.stroke),ge.fill=Be(ge.fill);let ye,mt,Ve,nt=[],On=[],ei,jn=!1,xn={};if($.live){const g=G[1]?G[1].values:null;jn=g!=null,ei=jn?g(r,1,0):{_:0};for(let y in ei)xn[y]=im}if(se)if(ye=Bi("table",uT,v),Ve=Bi("tbody",null,ye),$.mount(r,ye),jn){mt=Bi("thead",null,ye,Ve);let g=Bi("tr",null,mt);Bi("th",null,g);for(var Yi in ei)Bi("th",dy,g).textContent=Yi}else fi(ye,fT),$.live&&fi(ye,cT);const Qi={show:!0},jl={show:!1};function kl(g,y){if(y==0&&(jn||!$.live||u==2))return mr;let x=[],E=Bi("tr",dT,Ve,Ve.childNodes[y]);fi(E,g.class),g.show||fi(E,rs);let M=Bi("th",null,E);if(ge.show){let te=Ai(hT,M);if(y>0){let ae=ge.width(r,y);ae&&(te.style.border=ae+"px "+ge.dash(r,y)+" "+ge.stroke(r,y)),te.style.background=ge.fill(r,y)}}let R=Ai(dy,M);g.label instanceof HTMLElement?R.appendChild(g.label):R.textContent=g.label,y>0&&(ge.show||(R.style.color=g.width>0?ge.stroke(r,y):ge.fill(r,y)),Xt("click",M,te=>{if(Y._lock)return;ni(te);let ae=G.indexOf(g);if((te.ctrlKey||te.metaKey)!=$.isolate){let oe=G.some((ue,de)=>de>0&&de!=ae&&ue.show);G.forEach((ue,de)=>{de>0&&Zn(de,oe?de==ae?Qi:jl:Qi,!0,kt.setSeries)})}else Zn(ae,{show:!g.show},!0,kt.setSeries)},!1),ha&&Xt(gy,M,te=>{Y._lock||(ni(te),Z)DELIM" +R"DELIM(n(G.indexOf(g),Pa,!0,kt.setSeries))},!1));for(var J in ei){let te=Bi("td",mT,E);te.textContent="--",x.push(te)}return[E,x]}const ji=new Map;function Xt(g,y,x,E=!0){const M=ji.get(y)||{},R=Y.bind[g](r,y,x,E);R&&(cs(g,y,M[g]=R),ji.set(y,M))}function Ki(g,y,x){const E=ji.get(y)||{};for(let M in E)(g==null||M==g)&&(yh(M,y,E[M]),delete E[M]);g==null&&ji.delete(y)}let ki=0,oa=0,Te=0,fe=0,it=0,Ot=0,Ri=it,ua=Ot,ti=Te,ca=fe,kn=0,nn=0,ot=0,Vt=0;r.bbox={};let cn=!1,gs=!1,qa=!1,fa=!1,da=!1,fn=!1;function Ba(g,y,x){(x||g!=r.width||y!=r.height)&&Fi(g,y),Qa(!1),qa=!0,gs=!0,Pi()}function Fi(g,y){r.width=ki=Te=g,r.height=oa=fe=y,it=Ot=0,Vo(),wr();let x=r.bbox;kn=x.left=ls(it*Pe,.5),nn=x.top=ls(Ot*Pe,.5),ot=x.width=ls(Te*Pe,.5),Vt=x.height=ls(fe*Pe,.5)}const vs=3;function Rl(){let g=!1,y=0;for(;!g;){y++;let x=Ko(y),E=Fo(y);g=y==vs||x&&E,g||(Fi(r.width,r.height),gs=!0)}}function Fc({width:g,height:y}){Ba(g,y)}r.setSize=Fc;function Vo(){let g=!1,y=!1,x=!1,E=!1;W.forEach((M,R)=>{if(M.show&&M._show){let{side:J,_size:te}=M,ae=J%2,oe=M.label!=null?M.labelSize:0,ue=te+oe;ue>0&&(ae?(Te-=ue,J==3?(it+=ue,E=!0):x=!0):(fe-=ue,J==0?(Ot+=ue,g=!0):y=!0))}}),Bn[0]=g,Bn[1]=x,Bn[2]=y,Bn[3]=E,Te-=Di[1]+Di[3],it+=Di[3],fe-=Di[2]+Di[0],Ot+=Di[0]}function wr(){let g=it+Te,y=Ot+fe,x=it,E=Ot;function M(R,J){switch(R){case 1:return g+=J,g-J;case 2:return y+=J,y-J;case 3:return x-=J,x+J;case 0:return E-=J,E+J}}W.forEach((R,J)=>{if(R.show&&R._show){let te=R.side;R._pos=M(te,R._size),R.label!=null&&(R._lpos=M(te,R.labelSize))}})}if(Y.dataIdx==null){let g=Y.hover,y=g.skip=new Set(g.skip??[]);y.add(void 0);let x=g.prox=Be(g.prox),E=g.bias??=0;Y.dataIdx=(M,R,J,te)=>{if(R==0)return J;let ae=J,oe=x(M,R,J,te)??gt,ue=oe>=0&&oe0;)y.has(Re[xe])||(De=xe);if(E==0||E==1)for(xe=J;Oe==null&&xe++oe&&(ae=null);return ae}}const ni=g=>{Y.event=g};Y.idxs=N,Y._lock=!1;let an=Y.points;an.show=Be(an.show),an.size=Be(an.size),an.stroke=Be(an.stroke),an.width=Be(an.width),an.fill=Be(an.fill);const ii=r.focus=Jt({},n.focus||{alpha:.3},Y.focus),ha=ii.prox>=0,ma=ha&&an.one;let wn=[],Ji=[],pa=[];function zr(g,y){let x=an.show(r,y);if(x instanceof HTMLElement)return fi(x,oT),fi(x,g.class),sa(x,-10,-10,Te,fe),j.insertBefore(x,wn[y]),x}function Ci(g,y){if(u==1||y>0){let x=u==1&&B[g.scale].time,E=g.value;g.value=x?jy(E)?$y(D,Zy(E,Q)):E||Se:E||xA,g.label=g.label||(x?mA:hA)}if(ma||y>0){g.width=g.width==null?1:g.width,g.paths=g.paths||UA||TT,g.fillTo=Be(g.fillTo||AA),g.pxAlign=+Je(g.pxAlign,L),g.pxRound=Ky(g.pxAlign),g.stroke=Be(g.stroke||null),g.fill=Be(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let x=wA(qn(1,g.width),1),E=g.points=Jt({},{size:x,width:qn(1,x*.2),stroke:g.stroke,space:x*2,paths:ZA,_stroke:null,_fill:null},g.points);E.show=Be(E.show),E.filter=Be(E.filter),E.fill=Be(E.fill),E.stroke=Be(E.stroke),E.paths=Be(E.paths),E.pxAlign=g.pxAlign}if(se){let x=kl(g,y);nt.splice(y,0,x[0]),On.splice(y,0,x[1]),$.values.push(null)}if(we){N.splice(y,0,null);let x=null;ma?y==0&&(x=zr(g,y)):y>0&&(x=zr(g,y)),wn.splice(y,0,x),Ji.splice(y,0,0),pa.splice(y,0,0)}Lt("addSeries",y)}function It(g,y){y=y??G.length,g=u==1?zh(g,y,Hy,Yy):zh(g,y,{},Gy),G.splice(y,0,g),Ci(G[y],y)}r.addSeries=It;function zn(g){if(G.splice(g,1),se){$.values.splice(g,1),On.splice(g,1);let y=nt.splice(g,1)[0];Ki(null,y.firstChild),y.remove()}we&&(N.splice(g,1),wn.splice(g,1)[0].remove(),Ji.splice(g,1),pa.splice(g,1)),Lt("delSeries",g)}r.delSeries=zn;const Bn=[!1,!1,!1,!1];function Er(g,y){if(g._show=g.show,g.show){let x=g.side%2,E=B[g.scale];E==null&&(g.scale=x?G[1].scale:ee,E=B[g.scale]);let M=E.time;g.size=Be(g.size),g.space=Be(g.space),g.rotate=Be(g.rotate),zl(g.incrs)&&g.incrs.forEach(J=>{!Al.has(J)&&Al.set(J,gb(J))}),g.incrs=Be(g.incrs||(E.distr==2?FT:M?H==1?XT:WT:ss)),g.splits=Be(g.splits||(M&&E.distr==1?pe:E.distr==3?_h:E.distr==4?vA:gA)),g.stroke=Be(g.stroke),g.grid.stroke=Be(g.grid.stroke),g.ticks.stroke=Be(g.ticks.stroke),g.border.stroke=Be(g.border.stroke);let R=g.values;g.values=zl(R)&&!zl(R[0])?Be(R):M?zl(R)?Uy(D,Dy(R,Q)):jy(R)?nA(D,R):R||Me:R||pA,g.filter=Be(g.filter||(E.distr>=3&&E.log==10?_A:E.distr==3&&E.log==2?SA:mb)),g.font=Iy(g.font),g.labelFont=Iy(g.labelFont),g._size=g.size(r,null,y,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&(Bn[y]=!0,g._el=Ai(aT,z))}}function Cl(g,y,x,E){let[M,R,J,te]=x,ae=y%2,oe=0;return ae==0&&(te||R)&&(oe=y==0&&!M||y==2&&!J?Wt(Ly.size/3):0),ae==1&&(M||J)&&(oe=y==1&&!R||y==3&&!te?Wt(By.size/2):0),oe}const Go=r.padding=(n.padding||[Cl,Cl,Cl,Cl]).map(g=>Be(Je(g,Cl))),Di=r._padding=Go.map((g,y)=>g(r,y,Bn,0));let At,jt=null,bt=null;const Ui=u==1?G[0].idxs:null;let dn=null,gi=!1;function $t(g,y){if(i=g??[],r.data=r._data=i,u==2){At=0;for(let x=1;x=0,fn=!0,Pi()}}r.setData=$t;function ys(){gi=!0;let g,y;u==1&&(At>0?(jt=Ui[0]=0,bt=Ui[1]=At-1,g=i[0][jt],y=i[0][bt],_e==2?(g=jt,y=bt):g==y&&(_e==3?[g,y]=qc(g,g,ie.log,!1):_e==4?[g,y]=lm(g,g,ie.log,!1):ie.time?y=g+Wt(86400/H):[g,y]=kc(g,y,sm,!0))):(jt=Ui[0]=g=null,bt=Ui[1]=y=null)),Gn(ee,g,y)}let Dl,Vn,Xi,Tr,bs,_s,Ar,Va,Ga,zt;function Rn(g,y,x,E,M,R){g??=my,x??=om,E??="butt",M??=my,R??="round",g!=Dl&&(S.strokeStyle=Dl=g),M!=Vn&&(S.fillStyle=Vn=M),y!=Xi&&(S.lineWidth=Xi=y),R!=bs&&(S.lineJoin=bs=R),E!=_s&&(S.lineCap=_s=E),x!=Tr&&S.setLineDash(Tr=x)}function Nr(g,y,x,E){y!=Vn&&(S.fillStyle=Vn=y),g!=Ar&&(S.font=Ar=g),x!=Va&&(S.textAlign=Va=x),E!=Ga&&(S.textBaseline=Ga=E)}function Mr(g,y,x,E,M=0){if(E.length>0&&g.auto(r,gi)&&(y==null||y.min==null)){let R=Je(jt,0),J=Je(bt,E.length-1),te=x.min==null?_T(E,R,J,M,g.distr==3):[x.min,x.max];g.min=Gi(g.min,x.min=te[0]),g.max=qn(g.max,x.max=te[1])}}const Ss={min:null,max:null};function Yo(){for(let E in B){let M=B[E];he[E]==null&&(M.min==null||he[ee]!=null&&M.auto(r,gi))&&(he[E]=Ss)}for(let E in B){let M=B[E];he[E]==null&&M.from!=null&&he[M.from]!=null&&(he[E]=Ss)}he[ee]!=null&&Qa(!0);let g={};for(let E in he){let M=he[E];if(M!=null){let R=g[E]=pr(B[E],MT);if(M.min!=null)Jt(R,M);else if(E!=ee||u==2)if(At==0&&R.from==null){let J=R.range(r,null,null,E);R.min=J[0],R.max=J[1]}else R.min=gt,R.max=-gt}}if(At>0){G.forEach((E,M)=>{if(u==1){let R=E.scale,J=he[R];if(J==null)return;let te=g[R];if(M==0){let ae=te.range(r,te.min,te.max,R);te.min=ae[0],te.max=ae[1],jt=Vi(te.min,i[0]),bt=Vi(te.max,i[0]),bt-jt>1&&(i[0][jt]te.max&&bt--),E.min=dn[jt],E.max=dn[bt]}else E.show&&E.auto&&Mr(te,J,E,i[M],E.sorted);E.idxs[0]=jt,E.idxs[1]=bt}else if(M>0&&E.show&&E.auto){let[R,J]=E.facets,te=R.scale,ae=J.scale,[oe,ue]=i[M],de=g[te],ke=g[ae];de!=null&&Mr(de,he[te],R,oe,R.sorted),ke!=null&&Mr(ke,he[ae],J,ue,J.sorted),E.min=J.min,E.max=J.max}});for(let E in g){let M=g[E],R=he[E];if(M.from==null&&(R==null||R.min==null)){let J=M.range(r,M.min==gt?null:M.min,M.max==-gt?null:M.max,E);M.min=J[0],M.max=J[1]}}}for(let E in g){let M=g[E];if(M.from!=null){let R=g[M.from];if(R.min==null)M.min=M.max=null;else{let J=M.range(r,R.min,R.max,E);M.min=J[0],M.max=J[1]}}}let y={},x=!1;for(let E in g){let M=g[E],R=B[E];if(R.min!=M.min||R.max!=M.max){R.min=M.min,R.max=M.max;let J=R.distr;R._min=J==3?$a(R.min):J==4?ih(R.min,R.asinh):J==100?R.fwd(R.min):R.min,R._max=J==3?$a(R.max):J==4?ih(R.max,R.asinh):J==100?R.fwd(R.max):R.max,y[E]=x=!0}}if(x){G.forEach((E,M)=>{u==2?M>0&&y.y&&(E._paths=null):y[E.scale]&&(E._paths=null)});for(let E in y)qa=!)DELIM" +R"DELIM(0,Lt("setScale",E);we&&Y.left>=0&&(fa=fn=!0)}for(let E in he)he[E]=null}function xs(g){let y=bh(jt-1,0,At-1),x=bh(bt+1,0,At-1);for(;g[y]==null&&y>0;)y--;for(;g[x]==null&&x0){let g=G.some(y=>y._focus)&&zt!=ii.alpha;g&&(S.globalAlpha=zt=ii.alpha),G.forEach((y,x)=>{if(x>0&&y.show&&(Cn(x,!1),Cn(x,!0),y._paths==null)){let E=zt;zt!=y.alpha&&(S.globalAlpha=zt=y.alpha);let M=u==2?[0,i[x][0].length-1]:xs(i[x]);y._paths=y.paths(r,x,M[0],M[1]),zt!=E&&(S.globalAlpha=zt=E)}}),G.forEach((y,x)=>{if(x>0&&y.show){let E=zt;zt!=y.alpha&&(S.globalAlpha=zt=y.alpha),y._paths!=null&&ws(x,!1);{let M=y._paths!=null?y._paths.gaps:null,R=y.points.show(r,x,jt,bt,M),J=y.points.filter(r,x,R,M);(R||J)&&(y.points._paths=y.points.paths(r,x,jt,bt,J),ws(x,!0))}zt!=E&&(S.globalAlpha=zt=E),Lt("drawSeries",x)}}),g&&(S.globalAlpha=zt=1)}}function Cn(g,y){let x=y?G[g].points:G[g];x._stroke=x.stroke(r,g),x._fill=x.fill(r,g)}function ws(g,y){let x=y?G[g].points:G[g],{stroke:E,fill:M,clip:R,flags:J,_stroke:te=x._stroke,_fill:ae=x._fill,_width:oe=x.width}=x._paths;oe=vt(oe*Pe,3);let ue=null,de=oe%2/2;y&&ae==null&&(ae=oe>0?"#fff":te);let ke=x.pxAlign==1&&de>0;if(ke&&S.translate(de,de),!y){let Ye=kn-oe/2,Re=nn-oe/2,De=ot+oe,Oe=Vt+oe;ue=new Path2D,ue.rect(Ye,Re,De,Oe)}y?Ii(te,oe,x.dash,x.cap,ae,E,M,J,R):Qo(g,te,oe,x.dash,x.cap,ae,E,M,J,ue,R),ke&&S.translate(-de,-de)}function Qo(g,y,x,E,M,R,J,te,ae,oe,ue){let de=!1;ae!=0&&ne.forEach((ke,Ye)=>{if(ke.series[0]==g){let Re=G[ke.series[1]],De=i[ke.series[1]],Oe=(Re._paths||Ro).band;zl(Oe)&&(Oe=ke.dir==1?Oe[0]:Oe[1]);let xe,ut=null;Re.show&&Oe&&xT(De,jt,bt)?(ut=ke.fill(r,Ye)||R,xe=Re._paths.clip):Oe=null,Ii(y,x,E,M,ut,J,te,ae,oe,ue,xe,Oe),de=!0}}),de||Ii(y,x,E,M,R,J,te,ae,oe,ue)}const zs=gr|xh;function Ii(g,y,x,E,M,R,J,te,ae,oe,ue,de){Rn(g,y,x,E,M),(ae||oe||de)&&(S.save(),ae&&S.clip(ae),oe&&S.clip(oe)),de?(te&zs)==zs?(S.clip(de),ue&&S.clip(ue),Zl(M,J),Ul(g,R,y)):te&xh?(Zl(M,J),S.clip(de),Ul(g,R,y)):te&gr&&(S.save(),S.clip(de),ue&&S.clip(ue),Zl(M,J),S.restore(),Ul(g,R,y)):(Zl(M,J),Ul(g,R,y)),(ae||oe||de)&&S.restore()}function Ul(g,y,x){x>0&&(y instanceof Map?y.forEach((E,M)=>{S.strokeStyle=Dl=M,S.stroke(E)}):y!=null&&g&&S.stroke(y))}function Zl(g,y){y instanceof Map?y.forEach((x,E)=>{S.fillStyle=Vn=E,S.fill(x)}):y!=null&&g&&S.fill(y)}function Ya(g,y,x,E){let M=W[g],R;if(E<=0)R=[0,0];else{let J=M._space=M.space(r,g,y,x,E),te=M._incrs=M.incrs(r,g,y,x,E,J);R=VA(y,x,te,E,J)}return M._found=R}function Or(g,y,x,E,M,R,J,te,ae,oe){let ue=J%2/2;L==1&&S.translate(ue,ue),Rn(te,J,ae,oe,te),S.beginPath();let de,ke,Ye,Re,De=M+(E==0||E==3?-R:R);x==0?(ke=M,Re=De):(de=M,Ye=De);for(let Oe=0;Oe{if(!x.show)return;let M=B[x.scale];if(M.min==null){x._show&&(y=!1,x._show=!1,Qa(!1));return}else x._show||(y=!1,x._show=!0,Qa(!1));let R=x.side,J=R%2,{min:te,max:ae}=M,[oe,ue]=Ya(E,te,ae,J==0?Te:fe);if(ue==0)return;let de=M.distr==2,ke=x._splits=x.splits(r,E,te,ae,oe,ue,de),Ye=M.distr==2?ke.map(xe=>dn[xe]):ke,Re=M.distr==2?dn[ke[1]]-dn[ke[0]]:oe,De=x._values=x.values(r,x.filter(r,Ye,E,ue,Re),E,ue,Re);x._rotate=R==2?x.rotate(r,De,E,ue):0;let Oe=x._size;x._size=Ni(x.size(r,De,E,g)),Oe!=null&&x._size!=Oe&&(y=!1)}),y}function Fo(g){let y=!0;return Go.forEach((x,E)=>{let M=x(r,E,Bn,g);M!=Di[E]&&(y=!1),Di[E]=M}),y}function jr(){for(let g=0;gdn[rn]):Ye,De=ue.distr==2?dn[Ye[1]]-dn[Ye[0]]:ae,Oe=y.ticks,xe=y.border,ut=Oe.show?Oe.size:0,_t=Wt(ut*Pe),Rt=Wt((y.alignTo==2?y._size-ut-y.gap:y.gap)*Pe),et=y._rotate*-_c/180,lt=V(y._pos*Pe),hn=(_t+Rt)*te,Ht=lt+hn;R=E==0?Ht:0,M=E==1?Ht:0;let Tn=y.font[0],Yn=y.align==1?ir:y.align==2?eh:et>0?ir:et<0?eh:E==0?"center":x==3?eh:ir,ln=et||E==1?"middle":x==2?zo:hy;Nr(Tn,J,Yn,ln);let Gt=y.font[1]*y.lineGap,An=Ye.map(rn=>V(p(rn,ue,de,ke))),Qn=y._values;for(let rn=0;rn{x>0&&(y._paths=null,g&&(u==1?(y.min=null,y.max=null):y.facets.forEach(E=>{E.min=null,E.max=null})))})}let Es=!1,Ka=!1,Dn=[];function kr(){Ka=!1;for(let g=0;g0&&queueMicrotask(kr)}r.batch=Fa;function ga(){if(cn&&(Yo(),cn=!1),qa&&(Rl(),qa=!1),gs){if(wt(T,ir,it),wt(T,zo,Ot),wt(T,No,Te),wt(T,Mo,fe),wt(j,ir,it),wt(j,zo,Ot),wt(j,No,Te),wt(j,Mo,fe),wt(z,No,ki),wt(z,Mo,oa),w.width=Wt(ki*Pe),w.height=Wt(oa*Pe),W.forEach(({_el:g,_show:y,_size:x,_pos:E,side:M})=>{if(g!=null)if(y){let R=M===3||M===0?x:0,J=M%2==1;wt(g,J?"left":"top",E-R),wt(g,J?"width":"height",x),wt(g,J?"top":"left",J?Ot:it),wt(g,J?"height":"width",J?fe:Te),vh(g,rs)}else fi(g,rs)}),Dl=Vn=Xi=bs=_s=Ar=Va=Ga=Tr=null,zt=1,Bl(!0),it!=Ri||Ot!=ua||Te!=ti||fe!=ca){Qa(!1);let g=Te/ti,y=fe/ca;if(we&&!fa&&Y.left>=0){Y.left*=g,Y.top*=y,vi&&sa(vi,Wt(Y.left),0,Te,fe),En&&sa(En,0,Wt(Y.top),Te,fe);for(let x=0;x=0&&Xe.width>0){Xe.left*=g,Xe.width*=g,Xe.top*=y,Xe.height*=y;for(let x in $r)wt(Xa,x,Xe[x])}Ri=it,ua=Ot,ti=Te,ca=fe}Lt("setSize"),gs=!1}ki>0&&oa>0&&(S.clearRect(0,0,w.width,w.height),Lt("drawClear"),le.forEach(g=>g()),Lt("draw")),Xe.show&&da&&(Ia(Xe),da=!1),we&&fa&&(ya(null,!0,!1),fa=!1),$.show&&$.live&&fn&&(Ur(),fn=!1),m||(m=!0,r.status=1,Lt("ready")),gi=!1,Es=!1}r.redraw=(g,y)=>{qa=y||!1,g!==!1?Gn(ee,ie.min,ie.max):Pi()};function Ts(g,y){let x=B[g];if(x.from==null){if(At==0){let E=x.range(r,y.min,y.max,g);y.min=E[0],y.max=E[1]}if(y.min>y.max){let E=y.min;y.min=y.max,y.max=E}if(At>1&&y.min!=null&&y.max!=null&&y.max-y.min<1e-16)return;g==ee&&x.distr==2&&At>0&&(y.min=Vi(y.min,i[0]),y.max=Vi(y.max,i[0]),y.min==y.max&&y.max++),he[g]=y,cn=!0,Pi()}}r.setScale=Ts;let $l,As,vi,En,Ns,Ja,Un,Wi,Ll,Rr,We,at,Zi=!1;const Qe=Y.drag;let yt=Qe.x,Nt=Qe.y;we&&(Y.x&&($l=Ai(sT,j)),Y.y&&(As=Ai(rT,j)),ie.ori==0?(vi=$l,En=As):(vi=As,En=$l),We=Y.left,at=Y.top);const Xe=r.select=Jt({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),Xa=Xe.show?Ai(lT,Xe.over?j:T):null;function Ia(g,y){if(Xe.show){for(let x in g)Xe[x]=g[x],x in $r&&wt(Xa,x,g[x]);y!==!1&&Lt("setSelect")}}r.setSelect=Ia;function Cr(g){if(G[g].show)se&&vh(nt[g],rs);else if(se&&fi(nt[g],rs),we){let x=ma?wn[0]:wn[g];x!=null&&sa(x,-10,-10,Te,fe)}}function Gn(g,y,x){Ts(g,{min:y,max:x})}function Zn(g,y,x,E){y.focus!=null&&Wc(g),y.show!=null&&G.forEach((M,R)=>{R>0&&(g==R||g==null)&&(M.show=y.show,Cr(R),u==2?(Gn(M.facets[0].scale,null,null),Gn(M.facets[1].scale,null,null)):Gn(M.scale,null,null),Pi())}),x!==!1&&Lt("setSeries",g,y),E&&el("setSeries",r,g,y)}r.setSeries=Zn;function Jo(g,y){Jt(ne[g],y)}function Xc(g,y){g.fill=Be(g.fill||null),g.dir=Je(g.dir,-1),y=y??ne.length,ne.splice(y,0,g)}function Ic(g){g)DELIM" +R"DELIM(==null?ne.length=0:ne.splice(g,1)}r.addBand=Xc,r.setBand=Jo,r.delBand=Ic;function Pc(g,y){G[g].alpha=y,we&&wn[g]!=null&&(wn[g].style.opacity=y),se&&nt[g]&&(nt[g].style.opacity=y)}let ai,ea,va;const Pa={focus:!0};function Wc(g){if(g!=va){let y=g==null,x=ii.alpha!=1;G.forEach((E,M)=>{if(u==1||M>0){let R=y||M==0||M==g;E._focus=y?null:R,x&&Pc(M,R?1:ii.alpha)}}),va=g,x&&Pi()}}se&&ha&&Xt(vy,ye,g=>{Y._lock||(ni(g),va!=null&&Zn(null,Pa,!0,kt.setSeries))});function yi(g,y,x){let E=B[y];x&&(g=g/Pe-(E.ori==1?Ot:it));let M=Te;E.ori==1&&(M=fe,g=M-g),E.dir==-1&&(g=M-g);let R=E._min,J=E._max,te=g/M,ae=R+(J-R)*te,oe=E.distr;return oe==3?hr(10,ae):oe==4?zT(ae,E.asinh):oe==100?E.bwd(ae):ae}function Xo(g,y){let x=yi(g,ee,y);return Vi(x,i[0],jt,bt)}r.valToIdx=g=>Vi(g,i[0]),r.posToIdx=Xo,r.posToVal=yi,r.valToPos=(g,y,x)=>B[y].ori==0?d(g,B[y],x?ot:Te,x?kn:0):f(g,B[y],x?Vt:fe,x?nn:0),r.setCursor=(g,y,x)=>{We=g.left,at=g.top,ya(null,y,x)};function Io(g,y){wt(Xa,ir,Xe.left=g),wt(Xa,No,Xe.width=y)}function Po(g,y){wt(Xa,zo,Xe.top=g),wt(Xa,Mo,Xe.height=y)}let Hl=ie.ori==0?Io:Po,ql=ie.ori==1?Io:Po;function Dr(){if(se&&$.live)for(let g=u==2?1:0;g{N[E]=x}):NT(g.idx)||N.fill(g.idx),$.idx=N[0]),se&&$.live){for(let x=0;x0||u==1&&!jn)&&ef(x,N[x]);Dr()}fn=!1,y!==!1&&Lt("setLegend")}r.setLegend=Ur;function ef(g,y){let x=G[g],E=g==0&&_e==2?dn:i[g],M;jn?M=x.values(r,g,y)??xn:(M=x.value(r,y==null?null:E[y],g,y),M=M==null?xn:{_:M}),$.values[g]=M}function ya(g,y,x){Ll=We,Rr=at,[We,at]=Y.move(r,We,at),Y.left=We,Y.top=at,we&&(vi&&sa(vi,Wt(We),0,Te,fe),En&&sa(En,0,Wt(at),Te,fe));let E,M=jt>bt;ai=gt,ea=null;let R=ie.ori==0?Te:fe,J=ie.ori==1?Te:fe;if(We<0||At==0||M){E=Y.idx=null;for(let te=0;te0&&ut.show){let hn=et==null?-10:et==E?oe:ce(u==1?i[0][et]:i[xe][0][et],ie,R,0),Ht=lt==null?-10:Ee(lt,u==1?B[ut.scale]:B[ut.facets[1].scale],J,0);if(ha&<!=null){let Tn=ie.ori==1?We:at,Yn=en(ii.dist(r,xe,et,Ht,Tn));if(Yn=0?1:-1,Qn=Gt>=0?1:-1;Qn==An&&(Qn==1?ln==1?lt>=Gt:lt<=Gt:ln==1?lt<=Gt:lt>=Gt)&&(ai=Yn,ea=xe)}else ai=Yn,ea=xe}}if(fn||ma){let Tn,Yn;ie.ori==0?(Tn=hn,Yn=Ht):(Tn=Ht,Yn=hn);let ln,Gt,An,Qn,sn,rn,Nn=!0,ta=an.bbox;if(ta!=null){Nn=!1;let mn=ta(r,xe);An=mn.left,Qn=mn.top,ln=mn.width,Gt=mn.height}else An=Tn,Qn=Yn,ln=Gt=an.size(r,xe);if(rn=an.fill(r,xe),sn=an.stroke(r,xe),ma)xe==ea&&ai<=ii.prox&&(ue=An,de=Qn,ke=ln,Ye=Gt,Re=Nn,De=rn,Oe=sn);else{let mn=wn[xe];mn!=null&&(Ji[xe]=An,pa[xe]=Qn,zy(mn,ln,Gt,Nn),xy(mn,rn,sn),sa(mn,Ni(An),Ni(Qn),Te,fe))}}}}if(ma){let xe=ii.prox,ut=va==null?ai<=xe:ai>xe||ea!=va;if(fn||ut){let _t=wn[0];_t!=null&&(Ji[0]=ue,pa[0]=de,zy(_t,ke,Ye,Re),xy(_t,De,Oe),sa(_t,Ni(ue),Ni(de),Te,fe))}}}if(Xe.show&&Zi)if(g!=null){let[te,ae]=kt.scales,[oe,ue]=kt.match,[de,ke]=g.cursor.sync.scales,Ye=g.cursor.drag;if(yt=Ye._x,Nt=Ye._y,yt||Nt){let{left:Re,top:De,width:Oe,height:xe}=g.select,ut=g.scales[de].ori,_t=g.posToVal,Rt,et,lt,hn,Ht,Tn=te!=null&&oe(te,de),Yn=ae!=null&&ue(ae,ke);Tn&&yt?(ut==0?(Rt=Re,et=Oe):(Rt=De,et=xe),lt=B[te],hn=ce(_t(Rt,de),lt,R,0),Ht=ce(_t(Rt+et,de),lt,R,0),Hl(Gi(hn,Ht),en(Ht-hn))):Hl(0,R),Yn&&Nt?(ut==1?(Rt=Re,et=Oe):(Rt=De,et=xe),lt=B[ae],hn=Ee(_t(Rt,ke),lt,J,0),Ht=Ee(_t(Rt+et,ke),lt,J,0),ql(Gi(hn,Ht),en(Ht-hn))):ql(0,J)}else Lr()}else{let te=en(Ll-Ns),ae=en(Rr-Ja);if(ie.ori==1){let ke=te;te=ae,ae=ke}yt=Qe.x&&te>=Qe.dist,Nt=Qe.y&&ae>=Qe.dist;let oe=Qe.uni;oe!=null?yt&&Nt&&(yt=te>=oe,Nt=ae>=oe,!yt&&!Nt&&(ae>te?Nt=!0:yt=!0)):Qe.x&&Qe.y&&(yt||Nt)&&(yt=Nt=!0);let ue,de;yt&&(ie.ori==0?(ue=Un,de=We):(ue=Wi,de=at),Hl(Gi(ue,de),en(de-ue)),Nt||ql(0,J)),Nt&&(ie.ori==1?(ue=Un,de=We):(ue=Wi,de=at),ql(Gi(ue,de),en(de-ue)),yt||Hl(0,R)),!yt&&!Nt&&(Hl(0,0),ql(0,0))}if(Qe._x=yt,Qe._y=Nt,g==null){if(x){if(au!=null){let[te,ae]=kt.scales;kt.values[0]=te!=null?yi(ie.ori==0?We:at,te):null,kt.values[1]=ae!=null?yi(ie.ori==1?We:at,ae):null}el(th,r,We,at,Te,fe,E)}if(ha){let te=x&&kt.setSeries,ae=ii.prox;va==null?ai<=ae&&Zn(ea,Pa,!0,te):ai>ae?Zn(null,Pa,!0,te):ea!=va&&Zn(ea,Pa,!0,te)}}fn&&($.idx=E,Ur()),y!==!1&&Lt("setCursor")}let $i=null;Object.defineProperty(r,"rect",{get(){return $i==null&&Bl(!1),$i}});function Bl(g=!1){g?$i=null:($i=j.getBoundingClientRect(),Lt("syncRect",$i))}function Wo(g,y,x,E,M,R,J){Y._lock||Zi&&g!=null&&g.movementX==0&&g.movementY==0||(Zr(g,y,x,E,M,R,J,!1,g!=null),g!=null?ya(null,!0,!0):ya(y,!0,!1))}function Zr(g,y,x,E,M,R,J,te,ae){if($i==null&&Bl(!1),ni(g),g!=null)x=g.clientX-$i.left,E=g.clientY-$i.top;else{if(x<0||E<0){We=-10,at=-10;return}let[oe,ue]=kt.scales,de=y.cursor.sync,[ke,Ye]=de.values,[Re,De]=de.scales,[Oe,xe]=kt.match,ut=y.axes[0].side%2==1,_t=ie.ori==0?Te:fe,Rt=ie.ori==1?Te:fe,et=ut?R:M,lt=ut?M:R,hn=ut?E:x,Ht=ut?x:E;if(Re!=null?x=Oe(oe,Re)?p(ke,B[oe],_t,0):-10:x=_t*(hn/et),De!=null?E=xe(ue,De)?p(Ye,B[ue],Rt,0):-10:E=Rt*(Ht/lt),ie.ori==1){let Tn=x;x=E,E=Tn}}ae&&(y==null||y.cursor.event.type==th)&&((x<=1||x>=Te-1)&&(x=ls(x,Te)),(E<=1||E>=fe-1)&&(E=ls(E,fe))),te?(Ns=x,Ja=E,[Un,Wi]=Y.move(r,x,E)):(We=x,at=E)}const $r={width:0,height:0,left:0,top:0};function Lr(){Ia($r,!1)}let eu,tu,nu,iu;function Ms(g,y,x,E,M,R,J){Zi=!0,yt=Nt=Qe._x=Qe._y=!1,Zr(g,y,x,E,M,R,J,!0,!1),g!=null&&(Xt(nh,ph,Wa,!1),el(py,r,Un,Wi,Te,fe,null));let{left:te,top:ae,width:oe,height:ue}=Xe;eu=te,tu=ae,nu=oe,iu=ue}function Wa(g,y,x,E,M,R,J){Zi=Qe._x=Qe._y=!1,Zr(g,y,x,E,M,R,J,!1,!0);let{left:te,top:ae,width:oe,height:ue}=Xe,de=oe>0||ue>0,ke=eu!=te||tu!=ae||nu!=oe||iu!=ue;if(de&&ke&&Ia(Xe),Qe.setScale&&de&&ke){let Ye=te,Re=oe,De=ae,Oe=ue;if(ie.ori==1&&(Ye=ae,Re=ue,De=te,Oe=oe),yt&&Gn(ee,yi(Ye,ee),yi(Ye+Re,ee)),Nt)for(let xe in B){let ut=B[xe];xe!=ee&&ut.from==null&&ut.min!=gt&&Gn(xe,yi(De+Oe,xe),yi(De,xe))}Lr()}else Y.lock&&(Y._lock=!Y._lock,ya(y,!0,g!=null));g!=null&&(Ki(nh,ph),el(nh,r,We,at,Te,fe,null))}function tf(g,y,x,E,M,R,J){if(Y._lock)return;ni(g);let te=Zi;if(Zi){let ae=!0,oe=!0,ue=10,de,ke;ie.ori==0?(de=yt,ke=Nt):(de=Nt,ke=yt),de&&ke&&(ae=We<=ue||We>=Te-ue,oe=at<=ue||at>=fe-ue),de&&ae&&(We=We{let M=kt.match[2];x=M(r,y,x),x!=-1&&Zn(x,E,!0,!1)},we&&(Xt(py,j,Ms),Xt(th,j,Wo),Xt(gy,j,g=>{ni(g),Bl(!1)}),Xt(vy,j,tf),Xt(yy,j,Hr),wh.add(r),r.syncRect=Bl);const Vl=r.hooks=n.hooks||{};function Lt(g,y,x){Ka?Dn.push([g,y,x]):g in Vl&&Vl[g].forEach(E=>{E.call(null,r,y,x)})}(n.plugins||[]).forEach(g=>{for(let y in g.hooks)Vl[y]=(Vl[y]||[]).concat(g.hooks[y])});const _a=(g,y,x)=>x,kt=Jt({key:null,setSeries:!1,filters:{pub:My,sub:My},scales:[ee,G[1]?G[1].scale:null],match:[Oy,Oy,_a],values:[null,null]},Y.sync);kt.match.length==2&&kt.match.push(_a),Y.sync=kt;const au=kt.key,Br=Ub(au);function el(g,y,x,E,M,R,J){kt.filters.pub(g,y,x,E,M,R,J)&&Br.pub(g,y,x,E,M,R,J)}Br.sub(r);function lu(g,y,x,E,M,R,J){kt.filters.sub(g,y,x,E,M,R,J)&&ba[g](null,y,x,E,M,R,J)}r.pub=lu;function Gl(){Br.unsub(r),wh.delete(r),ji.clear(),yh(jc,fr,qr),v.remove(),ye?.remove(),Lt("destroy")}r.destroy=Gl;function Sa(){Lt("init",n,i),$t(i||n.data,!1),he[ee]?Ts(ee,he[ee]):ys(),da=Xe.show&&(Xe.width>0||Xe.height>0),fa=fn=!0,Ba(n.width,n.height)}return G.forE)DELIM" +R"DELIM(ach(Ci),W.forEach(Er),l?l instanceof HTMLElement?(l.appendChild(v),Sa()):l(r,Sa):Sa(),r}un.assign=Jt;un.fmtNum=rm;un.rangeNum=kc;un.rangeLog=qc;un.rangeAsinh=lm;un.orient=ps;un.pxRatio=Pe;un.join=DT;un.fmtDate=um,un.tzDate=QT;un.sync=Ub;{un.addGap=NA,un.clipGaps=Gc;let n=un.paths={points:Bb};n.linear=Gb,n.stepped=jA,n.bars=kA,n.spline=CA}const YA=(n,i,l,r,u)=>{if(!Number.isFinite(l)||!Number.isFinite(r)||r<=l)return[];const d=[];if(Math.asinh(r)-Math.asinh(l)<1.5){const m=Number.isFinite(u)&&u>0?u:(r-l)/4,v=Math.ceil(l/m)*m;for(let w=0;w<100;w++){const S=Number((v+w*m).toPrecision(14));if(S>r)break;d.push({value:S,priority:S===0?0:1})}}else{const m=Math.ceil(Math.log10(Math.max(Math.abs(l),Math.abs(r))));for(let v=Math.min(-1,m-1);v<=m;v++)for(const w of[1,2,5]){const S=w*10**v;for(const z of[-S,S])Number.isFinite(z)&&z>=l&&z<=r&&d.push({value:z,priority:w===1?1:2})}l<=0&&r>=0&&d.push({value:0,priority:0})}d.sort((m,v)=>m.priority-v.priority||m.value-v.value);const f=[],p=[];for(const{value:m}of d){const v=n.valToPos(m,"y");Number.isFinite(v)&&p.every(w=>Math.abs(v-w)>=36)&&(f.push(m),p.push(v))}return f.sort((m,v)=>m-v),f};function QA({data:n,series:i,height:l=280,emptyMessage:r="Waiting for live data…",valueSuffix:u="",zeroBased:d=!0,valueFormatter:f=XA,visualization:p="line",scale:m="linear",forceEmpty:v=!1}){const w=re.useRef(null),S=re.useRef(null),z=re.useRef(!1),T=re.useRef(null),j=re.useMemo(()=>JA(n),[n]),L=re.useRef(j),V=!v&&n[0]?.length>0;return re.useLayoutEffect(()=>{L.current=j},[j]),re.useLayoutEffect(()=>{const H=w.current;if(!H)return;const G={width:Math.max(240,H.clientWidth),height:l,padding:[12,8,0,0],cursor:{drag:{x:!0,y:!1,setScale:!0},focus:{prox:24}},hooks:{setSelect:[ee=>{ee.select.width>0&&(z.current=!0)}]},legend:{show:!0,live:!0},scales:{x:{time:!0},y:{auto:!0,distr:m==="compressed"?4:1,asinh:1,...d?{range:(ee,K,le)=>[Math.min(0,K),le===0?1:le*1.08]}:{range:(ee,K,le)=>{const ze=le-K,ve=ze===0?Math.max(1,Math.abs(le)*5e-4):ze*.08;return[K-ve,le+ve]}}}},axes:[{stroke:"#9f9f98",grid:{stroke:"#ffffff12",width:1},ticks:{stroke:"#ffffff20",width:1},font:"11px system-ui"},{size:72,stroke:"#9f9f98",grid:{stroke:"#ffffff12",width:1},ticks:{stroke:"#ffffff20",width:1},font:"11px system-ui",values:(ee,K)=>K.map(le=>le===null?null:`${f(le)}${u}`),...m==="compressed"?{splits:YA,filter:(ee,K)=>K}:{}}],series:[{},...i.map((ee,K)=>{const le=p==="step"?un.paths.stepped?.({align:1}):p==="bar"?KA(K,i.length):void 0;return{label:ee.label,stroke:ee.color,fill:p==="area"||p==="bar"?ee.fill??`${ee.color}24`:ee.fill,width:ee.width??2,paths:le,points:{show:p==="line"?ee.points??!1:!1},value:(ze,ve)=>ve===null?"—":`${f(ve)}${u}`}})]},W=new un(G,L.current,H),B=T.current;B&&W.setScale("x",B),S.current=W;const ne=new ResizeObserver(ee=>{const K=ee[0]?.contentRect.width;K&&K>0&&W.setSize({width:Math.round(K),height:l})});return ne.observe(H),()=>{T.current=z.current&&W.scales.x.min!=null&&W.scales.x.max!=null?{min:W.scales.x.min,max:W.scales.x.max}:null,ne.disconnect(),W.destroy(),S.current=null}},[l,i,f,u,p,d,m]),re.useEffect(()=>{const H=S.current;if(!H)return;const G=!z.current;H.setData(j,G),G||H.redraw()},[j]),_.jsxs("div",{className:"relative min-w-0",children:[_.jsx("div",{ref:w,className:"min-w-0 overflow-hidden"}),!V&&_.jsx("div",{className:"bg-surface text-textMuted pointer-events-none absolute inset-0 z-10 flex items-center justify-center text-sm",children:r})]})}function KA(n,i){const l=Math.max(1,i);return un.paths.bars?.({size:[1,48/l,0],disp:{x0:{unit:1,values:r=>{const u=Py(r,l),d=-u.groupWidth/2+u.barWidth*n;return Array.from(r.data[0],f=>f+d)}},size:{unit:1,values:r=>[Py(r,l).barWidth]}}})}function Py(n,i){const l=FA(n.data[0]),r=Math.abs(n.posToVal(48,"x")-n.posToVal(0,"x")),u=Math.min(l*.72,r);return{groupWidth:u,barWidth:u/i}}function FA(n){let i=Number.POSITIVE_INFINITY,l;for(const r of n)if(Number.isFinite(r)){if(l!==void 0){const u=Math.abs(r-l);u>0&&u=2)return n;const l=Date.now()/1e3,r=i[0]??l,u=[r-1,r],d=n.slice(1).map(f=>{const p=f[0]??null;return[p,p]});return[u,...d]}function XA(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 IA={300:"5m",900:"15m",3600:"1h"},PA=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),WA=new Intl.NumberFormat(void 0,{maximumFractionDigits:2});function eN(n){return PA.format(n)}function tN(n){return WA.format(n)}function nN(n){return n==="height"||n==="occurrences"?eN:tN}function iN({metrics:n}){const[i,l]=re.useState(DE),[r,u]=re.useState(null),[d,f]=re.useState(!1);re.useEffect(()=>{UE(i)},[i]);function p(w){l(S=>r?.mode==="add"?S.length>=lr?S:[...S,w]:S.map(z=>z.id===w.id?w:z)),u(null)}function m(w,S){l(z=>{const T=w+S;if(T<0||T>=z.length)return z;const j=[...z],L=j[w],V=j[T];return j[w]=V,j[T]=L,j})}function v(){if(!d){f(!0);return}l(bc()),f(!1)}return _.jsxs("section",{className:"space-y-4",children:[_.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-accentSecondary text-xs font-medium tracking-[0.16em] uppercase",children:"Live telemetry"}),_.jsx("h2",{className:"mt-1 text-2xl font-semibold",children:"Custom charts"}),_.jsxs("p",{className:"text-textMuted mt-1 text-sm",children:["Session data only · ",String(i.length)," of ",String(lr)," charts"]})]}),_.jsxs("div",{className:"flex flex-wrap gap-2",children:[_.jsx("button",{type:"button",onClick:()=>{f(!1),u({mode:"add",chart:ib()})},disabled:i.length>=lr,className:"bg-accent text-background hover:bg-accent/90 rounded-lg px-4 py-2 text-sm font-semibold disabled:cursor-not-allowed disabled:opacity-40",children:"Add chart"}),_.jsx("button",{type:"button",onClick:v,onBlur:()=>{f(!1)},className:`rounded-lg border px-4 py-2 text-sm ${d?"border-amber-400/60 text-amber-200":"border-textMuted/25 text-textMuted hover:border-accentSecondary hover:text-accentSecondary"}`,children:d?"Confirm reset":"Reset defaults"})]})]}),i.length===0?_.jsxs("div",{className:"border-accent/20 bg-surface/60 rounded-xl border border-dashed px-6 py-16 text-center",children:[_.jsx("p",{className:"text-textPrimary font-medium",children:"No charts in this dashboard."}),_.jsx("p",{className:"text-textMuted mt-2 text-sm",children:"Add a custom chart or start from a template."})]}):_.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:i.map((w,S)=>_.jsx(aN,{chart:w,metrics:n,canMoveEarlier:S>0,canMoveLater:S{l(z=>z.map(T=>T.id===w.id?{...T,scale:T.scale==="compressed"?"linear":"compressed"}:T))},onDelete:()=>{l(z=>z.filter(T=>T.id!==w.id))},onDuplicate:()=>{l(z=>z.length>=lr?z:[...z,CE(w)])},onEdit:()=>{u({mode:"edit",chart:w})},onMoveEarlier:()=>{m(S,-1)},onMoveLater:()=>{m(S,1)}},w.id))}),r&&_.jsx(JE,{chart:r.chart,mode:r.mode,onCancel:()=>{u(null)},onSave:p},`${r.mode}-${r.chart.id}`)]})}function aN({chart:n,metrics:i,canMoveEarlier:l,canMoveLater:r,canDuplicate:u,onDelete:d,onDuplicate:f,onEdit:p,onMoveEarlier:m,onMoveLater:v,onToggleScale:w}){const[S,z]=re.useState(null),[T,j]=re.useState(0),L=S??i,V=re.useMemo(()=>qE(L,n),[n,L]),H=re.useMemo(()=>n.series.map(B=>({label:B.label??Za(B.signalId).label,color:B.color})),[n.series]),G=nN(V.unit),W=`Waiting for ${n.series.length===1?H[0]?.label?.toLowerCase():"the selected signals"}…`;return _.jsxs("article",{className:"border-accent/20 bg-surface/70 min-w-0 overflow-hidden rounded-xl border",children:[_.jsx("header",{className:"border-accent/15 space-y-3 border-b px-4 py-4 sm:px-5",children:_.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[_.jsxs("div",{className:"min-w-0",children:[_.jsx("h3",{className:"truncate font-semibold",title:n.title,children:n.title}),_.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:[rb(V.unit)," )DELIM" +R"DELIM(· ",IA[n.range]," · ",n.visualization,n.scale==="compressed"?" · compressed scale":"",S?" · paused":""]})]}),_.jsxs("div",{className:"flex flex-wrap justify-end gap-1 text-xs",children:[_.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:w,className:`rounded border px-2 py-1.5 ${n.scale==="compressed"?"border-accent/40 bg-accent/10 text-accent":"text-textMuted hover:text-textPrimary border-white/10 hover:bg-white/5"}`,children:"Compress peaks"}),_.jsx(as,{label:S?"Resume chart":"Pause chart",onClick:()=>{z(B=>B?null:i)},children:S?"Resume":"Pause"}),_.jsx(as,{label:"Reset chart zoom",onClick:()=>{j(B=>B+1)},children:"Reset zoom"}),_.jsx(as,{label:"Edit chart",onClick:p,children:"Edit"}),_.jsx(as,{label:"Duplicate chart",onClick:f,disabled:!u,children:"Duplicate"}),_.jsx(as,{label:`Move ${n.title} earlier`,onClick:m,disabled:!l,children:"←"}),_.jsx(as,{label:`Move ${n.title} later`,onClick:v,disabled:!r,children:"→"}),_.jsx(as,{label:"Delete chart",onClick:d,danger:!0,children:"Delete"})]})]})}),_.jsx("div",{className:"min-w-0 p-3 sm:p-5",children:_.jsx(QA,{data:V.data,series:H,visualization:n.visualization,scale:n.scale,zeroBased:VE(V.unit),valueFormatter:G,valueSuffix:BE(V.unit),forceEmpty:!V.hasObservedData,emptyMessage:W},T)}),n.scale==="compressed"&&_.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."}),V.unobservedLabels.length>0&&V.hasObservedData&&_.jsxs("footer",{className:"border-accent/10 text-textMuted border-t px-5 py-2 text-[11px]",children:["Not observed this session: ",V.unobservedLabels.join(", ")]})]})}function as({label:n,children:i,onClick:l,disabled:r=!1,danger:u=!1}){return _.jsx("button",{type:"button","aria-label":n,onClick:l,disabled:r,className:`rounded 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-textPrimary hover:bg-white/5"}`,children:i})}const lN=[{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 sN({adminStatus:n,endpoints:i,metrics:l,native:r,syncEstimate:u}){const d=_E(l,10),f=r.configuration,p=Mi(6),m=[n.error?`Admin: ${n.error}`:null,r.status.error?`Native: ${r.status.error}`:null,r.transport==="none"&&r.restError?`Native REST: ${r.restError}`:null,l.invalidFrames>0?`${String(l.invalidFrames)} malformed admin frame${l.invalidFrames===1?"":"s"} ignored`:null,r.live.invalidFrames>0?`${String(r.live.invalidFrames)} malformed native frame${r.live.invalidFrames===1?"":"s"} ignored`:null,r.status.phase==="connected"&&r.transport==="none"?"Native: Connected, but no fresh valid state has been received":null].filter(v=>v!==null);return _.jsxs("div",{className:"space-y-8",children:[m.length>0&&_.jsxs("section",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3",children:[_.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Transport notice"}),_.jsx("ul",{className:"text-textMuted mt-1 space-y-1 text-xs",children:m.map(v=>_.jsx("li",{children:v},v))})]}),_.jsx(EE,{confirmed:r.top,estimate:u}),_.jsxs("dl",{"aria-label":"Node summary",className:"grid grid-cols-2 border-y border-white/10 lg:grid-cols-[1fr_1.15fr_1fr_1fr]",children:[_.jsx(hc,{label:"Canonical top",value:r.top===null?"—":Hn(r.top),detail:r.transport==="none"?"Waiting for native API":`${oN(u)} · via ${r.transport==="websocket"?"native WebSocket":"REST fallback"}`,emphasized:!0}),_.jsx(hc,{label:"Current activity",value:d.label,detail:d.rate>0?`${F2(d.rate)} over the last 10 seconds`:"No lifecycle events in the last 10 seconds",numeric:!1}),_.jsx(hc,{label:"Highest confirmed",value:l.signalMaximums[p]===void 0?"—":Hn(l.signalMaximums[p]),detail:`${Hn(l.signalTotals[p]??0)} confirmations observed`}),_.jsx(hc,{label:"Collection uptime",value:K2(l.now-l.sessionStartedAt),detail:`${Hn(l.totalEvents)} events · ${Hn(l.totalLogs)} logs`})]}),_.jsxs("section",{className:"grid gap-4 lg:grid-cols-2",children:[_.jsx(Wy,{title:"Admin stream",endpoint:i.adminUrl,status:n,detail:n.lastMessageAt?`Last frame ${jo(n.lastMessageAt)}`:"Waiting for the first frame"}),_.jsx(Wy,{title:"Native interface",endpoint:i.nativeUrl,status:r.status,detail:r.receivedAt?`Last state ${jo(r.receivedAt)} · ${r.transport}`:"Waiting for node state"})]}),_.jsx(iN,{metrics:l}),_.jsxs("section",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsxs("header",{className:"border-accent/15 border-b px-5 py-4",children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Lifecycle heights"}),_.jsx("h2",{className:"mt-1 font-semibold",children:"Highest observed event values"})]}),_.jsx("div",{className:"grid gap-px bg-white/5 sm:grid-cols-2 lg:grid-cols-3",children:lN.map(({event:v,label:w})=>{const S=l.signalMaximums[Mi(v)];return _.jsxs("div",{className:"bg-surface px-5 py-4",children:[_.jsx("p",{className:"text-textMuted text-xs",children:w}),_.jsx("p",{className:"text-textPrimary mt-2 font-mono text-lg tabular-nums",children:S===void 0?"—":Hn(S)})]},v)})})]}),_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsxs("header",{className:"border-accent/15 border-b px-5 py-4",children:[_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Capabilities"}),_.jsx("h2",{className:"mt-1 font-semibold",children:"Native configuration"})]}),f?_.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-4 p-5 text-sm",children:[_.jsx(ar,{label:"Address index",enabled:f.address}),_.jsx(ar,{label:"Client filters",enabled:f.filter}),_.jsx(ar,{label:"Turbo",enabled:f.turbo}),_.jsx(ar,{label:"Witness",enabled:f.witness}),_.jsx(ar,{label:"Retarget",enabled:f.retarget}),_.jsx(ar,{label:"Difficulty",enabled:f.difficult}),_.jsxs("div",{className:"col-span-2 border-t border-white/5 pt-3",children:[_.jsx("span",{className:"text-textMuted",children:"Pruned below"}),_.jsx("span",{className:"text-textPrimary float-right font-mono",children:f.pruned>0?Hn(f.pruned):"Not pruned"})]})]}):_.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:"Waiting for native configuration."})]})]}),_.jsx("section",{children:_.jsxs("div",{className:"border-accent/20 bg-surface/70 rounded-xl border",children:[_.jsx("header",{className:"border-accent/15 border-b px-5 py-4",children:_.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Recent events"})}),l.recentEvents.length===0?_.jsx(rN,{text:"No events observed yet."}):_.jsx("ul",{className:"divide-y divide-white/5",children:l.recentEvents.slice(0,6).map(v=>_.jsxs("li",{className:"flex items-center gap-3 px-5 py-3 text-xs",children:[_.jsx("time",{className:"text-textMuted w-24 shrink-0 font-mono",children:jo(v.time)}),_.jsx("span",{className:"text-textPrimary min-w-0 flex-1 truncate font-mono",children:qo(v.event).name}),_.jsx("span",{className:"text-accent tabular-nums",children:I0(v.event,v.value)})]},v.id))})]})})]})}function Wy({title:n,endpoint:i,status:l,detail:r}){return _.jsxs("article",{className:"border-accent/20 bg-surface/70 min-w-0 rounded-xl border p-5",children:[_.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-textMuted text-xs tracking-wide uppercase",children:n}),_.jsx("p",{className:"text-textPrimary mt-2 font-mono text-sm break-all",children:J2(i)})]}),_.jsx(zE,{phase:l.phase,label:l.phase})]}),_.jsxs("div",{className:"text-textMuted mt-4 flex)DELIM" +R"DELIM( flex-wrap justify-between gap-2 border-t border-white/5 pt-3 text-xs",children:[_.jsx("span",{children:r}),_.jsxs("span",{children:[String(l.reconnects)," reconnect",l.reconnects===1?"":"s"]})]})]})}function ar({label:n,enabled:i}){return _.jsxs("div",{className:"flex items-center justify-between gap-3",children:[_.jsx("span",{className:"text-textMuted",children:n}),_.jsx("span",{className:i?"text-emerald-300":"text-textMuted",children:i?"Enabled":"Disabled"})]})}function rN({text:n}){return _.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:n})}function oN(n){return n?n.blocksRemaining<=Lc?"Near current (estimated)":`${Hn(n.blocksRemaining)} blocks remaining (estimated)`:"Waiting for confirmed block timestamp"}const uN=8e3;function cN({estimate:n,browserNotificationsEnabled:i}){const l=re.useRef(null),[r,u]=re.useState(null),d=n?.blocksRemaining??null;if(re.useEffect(()=>{const p=dN(d);if(!p)return;const m=l.current;if(l.current=p.state,!(m===null||m===p.state)&&(u(p),i)){const v=fN(p);Q_(v.title,{body:v.body,tag:"libbitcoin-sync-status"})}},[i,d]),re.useEffect(()=>{if(!r)return;const p=setTimeout(()=>{u(m=>m===r?null:m)},uN);return()=>{clearTimeout(p)}},[r]),!r)return null;const f=r.state==="near-current";return _.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 ${f?"border-emerald-400/35 bg-emerald-950/95":"border-amber-400/35 bg-amber-950/95"}`,children:_.jsxs("div",{className:"flex items-start gap-4",children:[_.jsxs("div",{className:"min-w-0 flex-1",children:[_.jsx("p",{className:f?"font-semibold text-emerald-200":"font-semibold text-amber-200",children:f?"Node near current (estimated)":"Node fell behind (estimated)"}),_.jsx("p",{className:"mt-1 text-sm text-white/75",children:Eh(r)})]}),_.jsx("button",{type:"button","aria-label":"Dismiss synchronization notification",onClick:()=>{u(null)},className:"text-lg leading-none text-white/60 hover:text-white",children:"×"})]})})}function fN(n){return n.state==="near-current"?{title:"Libbitcoin node near current (estimated)",body:Eh(n)}:{title:"Libbitcoin node fell behind (estimated)",body:Eh(n)}}function dN(n){return n===null?null:{state:n<=Lc?"near-current":"behind",blocksBehind:n}}function Eh(n){return n.state==="near-current"?`Confirmed top is estimated to be within ${String(Lc)} blocks of the chain tip, based on block time.`:`Confirmed top is estimated to be ${Hn(n.blocksBehind)} blocks behind the chain tip, based on block time.`}const Fb='(function(){"use strict";var $e;function c(e,t,n){function r(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,u);const l=s.prototype,h=Object.keys(l);for(let m=0;mn?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class j extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Se extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}($e=globalThis).__zod_globalConfig??($e.__zod_globalConfig={});const se=globalThis.__zod_globalConfig;function A(e){return se}function Ze(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 oe(e,t){return typeof t=="bigint"?t.toString():t}function ae(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ce(e){return e==null}function ue(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ct(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r){};function V(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const xt=ae(()=>{if(se.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function C(e){if(V(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(V(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Te(e){return C(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Dt=new Set(["string","number","symbol"]);function W(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function N(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function f(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 Ut(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Jt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Kt(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 o=T(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return P(this,"shape",s),s},checks:[]});return N(e,o)}function Vt(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 o=T(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return P(this,"shape",s),s},checks:[]});return N(e,o)}function Wt(e,t){if(!C(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=T(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return P(this,"shape",o),o}});return N(e,i)}function Bt(e,t){if(!C(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=T(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return P(this,"shape",r),r}});return N(e,n)}function Gt(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=T(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return P(this,"shape",r),r)DELIM" +R"DELIM(},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return N(e,n)}function qt(e,t,n){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=T(t._zod.def,{get shape(){const a=t._zod.def.shape,u={...a};if(n)for(const l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(u[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(const l in a)u[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return P(this,"shape",u),u},checks:[]});return N(t,s)}function Ht(e,t,n){const r=T(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:i[s]}))}else for(const s in i)o[s]=new e({type:"nonoptional",innerType:i[s]});return P(this,"shape",o),o}});return N(t,r)}function R(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 B(e){return typeof e=="string"?e:e?.message}function M(e,t,n){const r=e.message?e.message:B(e.inst?._zod.def?.error?.(e))??B(t?.error?.(e))??B(n.customError?.(e))??B(n.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=s),a}function le(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function F(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Ae=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,oe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Pe=c("$ZodError",Ae),Me=c("$ZodError",Ae,{Parent:Error});function Xt(e,t=n=>n.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Qt(e,t=n=>n.message){const n={_errors:[]},r=(i,o=[])=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...o,...s.path]);else{const a=[...o,...s.path];if(a.length===0)n._errors.push(t(s));else{let u=n,l=0;for(;l(t,n,r,i)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new j;if(s.issues.length){const a=new(i?.Err??e)(s.issues.map(u=>M(u,o,A())));throw Oe(a,i?.callee),a}return s.value},fe=e=>async(t,n,r,i)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(i?.Err??e)(s.issues.map(u=>M(u,o,A())));throw Oe(a,i?.callee),a}return s.value},G=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new j;return o.issues.length?{success:!1,error:new(e??Pe)(o.issues.map(s=>M(s,i,A())))}:{success:!0,data:o.value}},en=G(Me),q=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>M(s,i,A())))}:{success:!0,data:o.value}},tn=q(Me),nn=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return he(e)(t,n,i)},rn=e=>(t,n,r)=>he(e)(t,n,r),sn=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return fe(e)(t,n,i)},on=e=>async(t,n,r)=>fe(e)(t,n,r),an=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return G(e)(t,n,i)},cn=e=>(t,n,r)=>G(e)(t,n,r),un=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return q(e)(t,n,i)},ln=e=>async(t,n,r)=>q(e)(t,n,r),hn=/^[cC][0-9a-z]{6,}$/,fn=/^[0-9a-z]+$/,dn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pn=/^[0-9a-vA-V]{20}$/,mn=/^[A-Za-z0-9]{27}$/,gn=/^[a-zA-Z0-9_-]{21}$/,_n=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,vn=/^([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})$/,je=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)$/,bn=/^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_\'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,yn="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$";function wn(){return new RegExp(yn,"u")}const zn=/^(?:(?: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])$/,kn=/^(([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}|:))$/,$n=/^((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])$/,Sn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Zn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Re=/^[A-Za-z0-9_-]*$/,En=/^https?$/,In=/^\\+[1-9]\\d{6,14}$/,Le="(?:(?:\\\\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])))",On=new RegExp(`^${Le}$`);function Ce(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}}`:`${t}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`}function Tn(e){return new RegExp(`^${Ce(e)}$`)}function Nn(e){const t=Ce({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Le}T(?:${r})$`)}const An=e=>{const t=e?`[\\\\s\\\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\\\s\\\\S]*";return new RegExp(`^${t}$`)},Pn=/^-?\\d+$/,Mn=/^-?\\d+(?:\\.\\d+)?$/,jn=/^[^A-Z]*$/,Rn=/^[^a-z]*$/,E=c("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Fe={number:"number",bigint:"bigint",object:"date"},xe=c("$ZodCheckLessThan",(e,t)=>{E.init(e,t);const n=Fe[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?r.value<=t.value:r.value{E.init(e,t);const n=Fe[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.valu)DELIM" +R"DELIM(e>t.value)||r.issues.push({origin: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})}}),Ln=c("$ZodCheckMultipleOf",(e,t)=>{E.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Ct(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})}}),Cn=c("$ZodCheckNumberFormat",(e,t)=>{E.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=Jt[t.format];e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,a.minimum=i,a.maximum=o,n&&(a.pattern=Pn)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}ao&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Fn=c("$ZodCheckMaxLength",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const i=r.value;if(i.length<=t.maximum)return;const s=le(i);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),xn=c("$ZodCheckMinLength",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const s=le(i);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Dn=c("$ZodCheckLengthEquals",(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!ce(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=r=>{const i=r.value,o=i.length;if(o===t.length)return;const s=le(i),a=o>t.length;r.issues.push({origin:s,...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})}}),H=c("$ZodCheckStringFormat",(e,t)=>{var n,r;E.init(e,t),e._zod.onattach.push(i=>{const o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),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=()=>{})}),Un=c("$ZodCheckRegex",(e,t)=>{H.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})}}),Jn=c("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=jn),H.init(e,t)}),Kn=c("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Rn),H.init(e,t)}),Vn=c("$ZodCheckIncludes",(e,t)=>{E.init(e,t);const n=W(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(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})}}),Wn=c("$ZodCheckStartsWith",(e,t)=>{E.init(e,t);const n=new RegExp(`^${W(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(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})}}),Bn=c("$ZodCheckEndsWith",(e,t)=>{E.init(e,t);const n=new RegExp(`.*${W(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(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})}}),Gn=c("$ZodCheckOverwrite",(e,t)=>{E.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class qn{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`\n`).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),o=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of o)this.content.push(s)}compile(){const t=Function,n=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,i.join(`\n`))}}const Hn={major:4,minor:4,patch:3},w=c("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Hn;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const o of i._zod.onattach)o(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,a,u)=>{let l=R(s),h;for(const m of a){if(m._zod.def.when){if(Yt(s)||!m._zod.def.when(s))continue}else if(l)continue;const p=s.issues.length,d=m._zod.check(s);if(d instanceof Promise&&u?.async===!1)throw new j;if(h||d instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await d,s.issues.length!==p&&(l||(l=R(s,p)))});else{if(s.issues.length===p)continue;l||(l=R(s,p))}}return h?h.then(()=>s):s},o=(s,a,u)=>{if(R(s))return s.aborted=!0,s;const l=i(a,r,u);if(l instanceof Promise){if(u.async===!1)throw new j;return l.then(h=>e._zod.parse(h,u))}return e._zod.parse(l,u)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const l=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(h=>o(h,s,a)):o(l,s,a)}const u=e._zod.parse(s,a);if(u instanceof Promise){if(a.async===!1)throw new j;return u.then(l=>i(l,r,a))}return i(u,r,a)}}g(e,"~standard",()=>({validate:i=>{try{const o=en(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return tn(e,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),de=c("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??An(e._zod.bag),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}}),v=c("$ZodStringFormat",(e,t)=>{H.init(e,t),de.init(e,t)}),Yn=c("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=vn),v.init(e,t)}),Xn=c("$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=je(r))}else t.pattern??(t.pattern=je());v.init(e,t)}),Qn=c("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=bn),v.init(e,t)}),er=c("$Z)DELIM" +R"DELIM(odURL",(e,t)=>{v.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===En.source&&!/^https?:\\/\\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),tr=c("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=wn()),v.init(e,t)}),nr=c("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=gn),v.init(e,t)}),rr=c("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hn),v.init(e,t)}),ir=c("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=fn),v.init(e,t)}),sr=c("$ZodULID",(e,t)=>{t.pattern??(t.pattern=dn),v.init(e,t)}),or=c("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pn),v.init(e,t)}),ar=c("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=mn),v.init(e,t)}),cr=c("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Nn(t)),v.init(e,t)}),ur=c("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=On),v.init(e,t)}),lr=c("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Tn(t)),v.init(e,t)}),hr=c("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=_n),v.init(e,t)}),fr=c("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=zn),v.init(e,t),e._zod.bag.format="ipv4"}),dr=c("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=kn),v.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),pr=c("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=$n),v.init(e,t)}),mr=c("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Sn),v.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[i,o]=r;if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Ue(e){if(e==="")return!0;if(/\\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const gr=c("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Zn),v.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Ue(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function _r(e){if(!Re.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ue(n)}const vr=c("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Re),v.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{_r(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),br=c("$ZodE164",(e,t)=>{t.pattern??(t.pattern=In),v.init(e,t)});function yr(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 wr=c("$ZodJWT",(e,t)=>{v.init(e,t),e._zod.check=n=>{yr(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Je=c("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=e._zod.bag.pattern??Mn,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 o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),zr=c("$ZodNumberFormat",(e,t)=>{Cn.init(e,t),Je.init(e,t)}),kr=c("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=n=>n}),$r=c("$ZodNever",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ke(e,t,n){e.issues.length&&t.issues.push(...Ne(n,e.issues)),t.value[n]=e.value}const Sr=c("$ZodArray",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let s=0;sKe(l,n,s))):Ke(u,n,s)}return o.length?Promise.all(o).then(()=>n):n}});function Y(e,t,n,r,i,o){const s=n in r;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...Ne(n,e.issues))}if(!s&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?s&&(t.value[n]=void 0):t.value[n]=e.value}function Ve(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=Ut(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function We(e,t,n,r,i,o){const s=[],a=i.keySet,u=i.catchall._zod,l=u.def.type,h=u.optin==="optional",m=u.optout==="optional";for(const p in t){if(p==="__proto__"||a.has(p))continue;if(l==="never"){s.push(p);continue}const d=u.run({value:t[p],issues:[]},r);d instanceof Promise?e.push(d.then(_=>Y(_,n,p,t,h,m))):Y(d,n,p,t,h,m)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const Zr=c("$ZodObject",(e,t)=>{if(w.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...a};return Object.defineProperty(t,"shape",{value:u}),u}})}const r=ae(()=>Ve(t));g(e._zod,"propValues",()=>{const a=t.shape,u={};for(const l in a){const h=a[l]._zod;if(h.values){u[l]??(u[l]=new Set);for(const m of h.values)u[l].add(m)}}return u});const i=V,o=t.catchall;let s;e._zod.parse=(a,u)=>{s??(s=r.value);const l=a.value;if(!i(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};const h=[],m=s.shape;for(const p of s.keys){const d=m[p],_=d._zod.optin==="optional",K=d._zod.optout==="optional",k=d._zod.run({value:l[p],issues:[]},u);k instanceof Promise?h.push(k.then(ke=>Y(ke,a,p,l,_,K))):Y(k,a,p,l,_,K)}return o?We(h,l,a,u,r.value,e):h.length?Promise.all(h).then(()=>a):a}}),Er=c("$ZodObjectJIT",(e,t)=>{Zr.init(e,t);const n=e._zod.parse,r=ae(()=>Ve(t)),i=p=>{const d=new qn(["shape","payload","ctx"]),_=r.value,K=O=>{const y=Ie(O);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};d.write("const input = payload.value;");const k=Object.create(null);let ke=0;for(const O of _.keys)k[O]=`key_${ke++}`;d.write("const newResult = {};");for(const O of _.keys){const y=k[O],S=Ie(O),Rt=p[O],Lt=Rt?._zod?.optin==="optional",Go=Rt?._zod?.optout==="optional";d.write(`const ${y} = ${K(O)};`),Lt&&Go?d.write(`\n if (${y}.issues.length) {\n if (${S} in input) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n }\n \n if (${y}.value === undefined) {\n if (${S} in input) {\n newResult[${S}] = undefined;\n }\n } else {\n newResult[${S}] = ${y}.value;\n }\n \n `):Lt?d.write(`\n if (${y}.issues.length) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n \n if (${y}.value === undefined) {)DELIM" +R"DELIM(\n if (${S} in input) {\n newResult[${S}] = undefined;\n }\n } else {\n newResult[${S}] = ${y}.value;\n }\n \n `):d.write(`\n const ${y}_present = ${S} in input;\n if (${y}.issues.length) {\n payload.issues = payload.issues.concat(${y}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${S}, ...iss.path] : [${S}]\n })));\n }\n if (!${y}_present && !${y}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${S}]\n });\n }\n\n if (${y}_present) {\n if (${y}.value === undefined) {\n newResult[${S}] = undefined;\n } else {\n newResult[${S}] = ${y}.value;\n }\n }\n\n `)}d.write("payload.value = newResult;"),d.write("return payload;");const Bo=d.compile();return(O,y)=>Bo(p,O,y)};let o;const s=V,a=!se.jitless,l=a&&xt.value,h=t.catchall;let m;e._zod.parse=(p,d)=>{m??(m=r.value);const _=p.value;return s(_)?a&&l&&d?.async===!1&&d.jitless!==!0?(o||(o=i(t.shape)),p=o(p,d),h?We([],_,p,d,m,e):p):n(p,d):(p.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),p)}});function Be(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const i=e.filter(o=>!R(o));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(o=>o.issues.map(s=>M(s,r,A())))}),t)}const Ir=c("$ZodUnion",(e,t)=>{w.init(e,t),g(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),g(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),g(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),g(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>ue(i.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 o=!1;const s=[];for(const a of t.options){const u=a._zod.run({value:r.value,issues:[]},i);if(u instanceof Promise)s.push(u),o=!0;else{if(u.issues.length===0)return u;s.push(u)}}return o?Promise.all(s).then(a=>Be(a,r,e,i)):Be(s,r,e,i)}}),Or=c("$ZodIntersection",(e,t)=>{w.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,o=t.left._zod.run({value:i,issues:[]},r),s=t.right._zod.run({value:i,issues:[]},r);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([u,l])=>Ge(n,u,l)):Ge(n,o,s)}});function pe(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(C(e)&&C(t)){const n=Object.keys(t),r=Object.keys(e).filter(o=>n.indexOf(o)!==-1),i={...e,...t};for(const o of r){const s=pe(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.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;ra.l&&a.r).map(([a])=>a);if(o.length&&i&&e.issues.push({...i,keys:o}),R(e))return e;const s=pe(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Tr=c("$ZodEnum",(e,t)=>{w.init(e,t);const n=Ze(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(i=>Dt.has(typeof i)).map(i=>typeof i=="string"?W(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{const s=i.value;return r.has(s)||i.issues.push({code:"invalid_value",values:n,input:s,inst:e}),i}}),Nr=c("$ZodTransform",(e,t)=>{w.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Se(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(n.value=s,n.fallback=!0,n));if(i instanceof Promise)throw new j;return n.value=i,n.fallback=!0,n}});function qe(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const He=c("$ZodOptional",(e,t)=>{w.init(e,t),e._zod.optin="optional",e._zod.optout="optional",g(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),g(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ue(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const i=n.value,o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>qe(s,i)):qe(o,i)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Ar=c("$ZodExactOptional",(e,t)=>{He.init(e,t),g(e._zod,"values",()=>t.innerType._zod.values),g(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Pr=c("$ZodNullable",(e,t)=>{w.init(e,t),g(e._zod,"optin",()=>t.innerType._zod.optin),g(e._zod,"optout",()=>t.innerType._zod.optout),g(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ue(n.source)}|null)$`):void 0}),g(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Mr=c("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"values",()=>t.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(o=>Ye(o,t)):Ye(i,t)}});function Ye(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const jr=c("$ZodPrefault",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"values",()=>t.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))}),Rr=c("$ZodNonOptional",(e,t)=>{w.init(e,t),g(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Xe(o,e)):Xe(i,e)}});function Xe(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Lr=c("$ZodCatch",(e,t)=>{w.init(e,t),e._zod.optin="optional",g(e._zod,"optout",()=>t.innerType._zod.optout),g(e._zod,"values",()=>t.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(n,r);return i instanceof Promise?i.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>M(s,r,A()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(o=>M(o,r,A()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Cr=c("$ZodPipe",(e,t)=>{w.init(e,t),g(e._zod,"values",()=>t.in._zod.values),g(e._zod,"optin",()=>t.in._zod.optin),g(e._zod,"optout",()=>t.out._zod.optout),g(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const o=t.out._zod.run(n,r);return o instanceof Promise?o.then(s=>X(s,t.in,r)):X(o,t.in,r)}const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(o=>X(o,t.out,r)):X(i,t.out,r)}});function X(e,t,n){return e.issues)DELIM" +R"DELIM(.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Fr=c("$ZodReadonly",(e,t)=>{w.init(e,t),g(e._zod,"propValues",()=>t.innerType._zod.propValues),g(e._zod,"values",()=>t.innerType._zod.values),g(e._zod,"optin",()=>t.innerType?._zod?.optin),g(e._zod,"optout",()=>t.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(Qe):Qe(i)}});function Qe(e){return e.value=Object.freeze(e.value),e}const xr=c("$ZodCustom",(e,t)=>{E.init(e,t),w.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(o=>et(o,n,r,e));et(i,n,r,e)}});function et(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(F(i))}}var tt;class Dr{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 Ur(){return new Dr}(tt=globalThis).__zod_globalRegistry??(tt.__zod_globalRegistry=Ur());const x=globalThis.__zod_globalRegistry;function Jr(e,t){return new e({type:"string",...f(t)})}function Kr(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...f(t)})}function nt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...f(t)})}function Vr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...f(t)})}function Wr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f(t)})}function Br(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f(t)})}function Gr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f(t)})}function qr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...f(t)})}function Hr(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...f(t)})}function Yr(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...f(t)})}function Xr(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...f(t)})}function Qr(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...f(t)})}function ei(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...f(t)})}function ti(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...f(t)})}function ni(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...f(t)})}function ri(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...f(t)})}function ii(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...f(t)})}function si(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f(t)})}function oi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f(t)})}function ai(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...f(t)})}function ci(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...f(t)})}function ui(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...f(t)})}function li(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...f(t)})}function hi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(t)})}function fi(e,t){return new e({type:"string",format:"date",check:"string_format",...f(t)})}function di(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...f(t)})}function pi(e,t){return new e({type:"string",format:"duration",check:"string_format",...f(t)})}function mi(e,t){return new e({type:"number",checks:[],...f(t)})}function gi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...f(t)})}function _i(e){return new e({type:"unknown"})}function vi(e,t){return new e({type:"never",...f(t)})}function rt(e,t){return new xe({check:"less_than",...f(t),value:e,inclusive:!1})}function me(e,t){return new xe({check:"less_than",...f(t),value:e,inclusive:!0})}function it(e,t){return new De({check:"greater_than",...f(t),value:e,inclusive:!1})}function ge(e,t){return new De({check:"greater_than",...f(t),value:e,inclusive:!0})}function st(e,t){return new Ln({check:"multiple_of",...f(t),value:e})}function ot(e,t){return new Fn({check:"max_length",...f(t),maximum:e})}function Q(e,t){return new xn({check:"min_length",...f(t),minimum:e})}function at(e,t){return new Dn({check:"length_equals",...f(t),length:e})}function bi(e,t){return new Un({check:"string_format",format:"regex",...f(t),pattern:e})}function yi(e){return new Jn({check:"string_format",format:"lowercase",...f(e)})}function wi(e){return new Kn({check:"string_format",format:"uppercase",...f(e)})}function zi(e,t){return new Vn({check:"string_format",format:"includes",...f(t),includes:e})}function ki(e,t){return new Wn({check:"string_format",format:"starts_with",...f(t),prefix:e})}function $i(e,t){return new Bn({check:"string_format",format:"ends_with",...f(t),suffix:e})}function L(e){return new Gn({check:"overwrite",tx:e})}function Si(e){return L(t=>t.normalize(e))}function Zi(){return L(e=>e.trim())}function Ei(){return L(e=>e.toLowerCase())}function Ii(){return L(e=>e.toUpperCase())}function Oi(){return L(e=>Ft(e))}function Ti(e,t,n){return new e({type:"array",element:t,...f(n)})}function Ni(e,t,n){return new e({type:"custom",check:"custom",fn:t,...f(n)})}function Ai(e,t){const n=Pi(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(F(i,r.value,n._zod.def));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),r.issues.push(F(o))}},e(r.value,r)),t);return n}function Pi(e,t){const n=new E({check:"custom",...f(t)});return n._zod.check=e,n}function ct(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??x,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function $(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const h={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,h);else{const p=s.schema,d=t.processors[i.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);d(e,t,p,h)}const m=e._zod.parent;m&&(s.ref||(s.ref=m),$(m,t,h),t.seen.get(m).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&Z(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ut(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(c)DELIM" +R"DELIM(onst s of e.seen.entries()){const a=e.metadataRegistry.get(s[0])?.id;if(a){const u=r.get(a);if(u&&u!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}const i=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const m=e.external.registry.get(s[0])?.id,p=e.external.uri??(_=>_);if(m)return{ref:p(m)};const d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${p("__shared")}#/${a}/${d}`}}if(s[1]===n)return{ref:"#"};const l=`#/${a}/`,h=s[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:l+h}},o=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:u,defId:l}=i(s);a.def={...a.schema},l&&(a.defId=l);const h=a.schema;for(const m in h)delete h[m];h.$ref=u};if(e.cycles==="throw")for(const s of e.seen.entries()){const a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/\n\nSet the \\`cycles\\` parameter to \\`"ref"\\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){o(s);continue}if(e.external){const l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}}function lt(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const u=e.seen.get(a);if(u.ref===null)return;const l=u.def??u.schema,h={...l},m=u.ref;if(u.ref=null,m){r(m);const d=e.seen.get(m),_=d.schema;if(_.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(_)):Object.assign(l,_),Object.assign(l,h),a._zod.parent===m)for(const k in l)k==="$ref"||k==="allOf"||k in h||delete l[k];if(_.$ref&&d.def)for(const k in l)k==="$ref"||k==="allOf"||k in d.def&&JSON.stringify(l[k])===JSON.stringify(d.def[k])&&delete l[k]}const p=a._zod.parent;if(p&&p!==m){r(p);const d=e.seen.get(p);if(d?.schema.$ref&&(l.$ref=d.schema.$ref,d.def))for(const _ in l)_==="$ref"||_==="allOf"||_ in d.def&&JSON.stringify(l[_])===JSON.stringify(d.def[_])&&delete l[_]}e.override({zodSchema:a,jsonSchema:l,path:u.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);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 a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;o!==void 0&&i.id===o&&delete i.id;const s=e.external?.defs??{};for(const a of e.seen.entries()){const u=a[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,s[u.defId]=u.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:ee(t,"input",e.processors),output:ee(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Z(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 Z(r.element,n);if(r.type==="set")return Z(r.valueType,n);if(r.type==="lazy")return Z(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")return Z(r.innerType,n);if(r.type==="intersection")return Z(r.left,n)||Z(r.right,n);if(r.type==="record"||r.type==="map")return Z(r.keyType,n)||Z(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Z(r.in,n)||Z(r.out,n);if(r.type==="object"){for(const i in r.shape)if(Z(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Z(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Z(i,n))return!0;return!!(r.rest&&Z(r.rest,n))}return!1}const Mi=(e,t={})=>n=>{const r=ct({...n,processors:t});return $(e,r),ut(r,e),lt(r,e)},ee=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=ct({...i??{},target:o,io:t,processors:n});return $(e,s),ut(s,e),lt(s,e)},ji={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ri=(e,t,n,r)=>{const i=n;i.type="string";const{minimum:o,maximum:s,format:a,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=ji[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),l&&(i.contentEncoding=l),u&&u.size>0){const h=[...u];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Li=(e,t,n,r)=>{const i=n,{minimum:o,maximum:s,format:a,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:h}=e._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";const m=typeof h=="number"&&h>=(o??Number.NEGATIVE_INFINITY),p=typeof l=="number"&&l<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";m?d?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h:typeof o=="number"&&(i.minimum=o),p?d?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof s=="number"&&(i.maximum=s),typeof u=="number"&&(i.multipleOf=u)},Ci=(e,t,n,r)=>{n.not={}},Fi=(e,t,n,r)=>{},xi=(e,t,n,r)=>{const i=e._zod.def,o=Ze(i.entries);o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),n.enum=o},Di=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ui=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ji=(e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=$(o.element,t,{...r,path:[...r.path,"items"]})},Ki=(e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const l in s)i.properties[l]=$(s[l],t,{...r,path:[...r.path,"properties",l]});const a=new Set(Object.keys(s)),u=new Set([...a].filter(l=>{const h=o.shape[l]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));u.size>0&&(i.required=Array.from(u)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=$(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Vi=(e,t,n,r)=>{const i=e._zod.def,o=i.inclusive===!1,s=i.options.map((a,u)=>$(a,t,{...r,path:[...r.path,o?"oneOf":"anyOf",u]}));o?n.oneOf=s:n.anyOf=s},Wi=(e,t,n,r)=>{const i=e._zod.def,o=$(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=$(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,u=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=u},Bi=(e,t,n,r)=>{const i=e._zod.def,o=$(i.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Gi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType},qi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Hi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Yi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not )DELIM" +R"DELIM(supported in JSON Schema")}n.default=s},Xi=(e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?i.out:i.in:i.out;$(s,t,r);const a=t.seen.get(e);a.ref=s},Qi=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,n.readOnly=!0},ht=(e,t,n,r)=>{const i=e._zod.def;$(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType},es=c("ZodISODateTime",(e,t)=>{cr.init(e,t),b.init(e,t)});function ts(e){return hi(es,e)}const ns=c("ZodISODate",(e,t)=>{ur.init(e,t),b.init(e,t)});function rs(e){return fi(ns,e)}const is=c("ZodISOTime",(e,t)=>{lr.init(e,t),b.init(e,t)});function ss(e){return di(is,e)}const os=c("ZodISODuration",(e,t)=>{hr.init(e,t),b.init(e,t)});function as(e){return pi(os,e)}const I=c("ZodError",(e,t)=>{Pe.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Qt(e,n)},flatten:{value:n=>Xt(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,oe,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,oe,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),cs=he(I),us=fe(I),ls=G(I),hs=q(I),fs=nn(I),ds=rn(I),ps=sn(I),ms=on(I),gs=an(I),_s=cn(I),vs=un(I),bs=ln(I),ft=new WeakMap;function D(e,t,n){const r=Object.getPrototypeOf(e);let i=ft.get(r);if(i||(i=new Set,ft.set(r,i)),!i.has(t)){i.add(t);for(const o in n){const s=n[o];Object.defineProperty(r,o,{configurable:!0,enumerable:!1,get(){const a=s.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const z=c("ZodType",(e,t)=>(w.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ee(e,"input"),output:ee(e,"output")}}),e.toJSONSchema=Mi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>cs(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>ls(e,n,r),e.parseAsync=async(n,r)=>us(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>hs(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>fs(e,n,r),e.decode=(n,r)=>ds(e,n,r),e.encodeAsync=async(n,r)=>ps(e,n,r),e.decodeAsync=async(n,r)=>ms(e,n,r),e.safeEncode=(n,r)=>gs(e,n,r),e.safeDecode=(n,r)=>_s(e,n,r),e.safeEncodeAsync=async(n,r)=>vs(e,n,r),e.safeDecodeAsync=async(n,r)=>bs(e,n,r),D(e,"ZodType",{check(...n){const r=this.def;return this.clone(T(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return N(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(fo(n,r))},superRefine(n,r){return this.check(po(n,r))},overwrite(n){return this.check(L(n))},optional(){return yt(this)},exactOptional(){return Qs(this)},nullable(){return wt(this)},nullish(){return yt(wt(this))},nonoptional(n){return so(this,n)},array(){return Ks(this)},or(n){return vt([this,n])},and(n){return Gs(this,n)},transform(n){return kt(this,Ys(n))},default(n){return no(this,n)},prefault(n){return io(this,n)},catch(n){return ao(this,n)},pipe(n){return kt(this,n)},readonly(){return lo(this)},describe(n){const r=this.clone();return x.add(r,{description:n}),r},meta(...n){if(n.length===0)return x.get(this);const r=this.clone();return x.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return x.get(e)?.description},configurable:!0}),e)),dt=c("_ZodString",(e,t)=>{de.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>Ri(e,r,i);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,D(e,"_ZodString",{regex(...r){return this.check(bi(...r))},includes(...r){return this.check(zi(...r))},startsWith(...r){return this.check(ki(...r))},endsWith(...r){return this.check($i(...r))},min(...r){return this.check(Q(...r))},max(...r){return this.check(ot(...r))},length(...r){return this.check(at(...r))},nonempty(...r){return this.check(Q(1,...r))},lowercase(r){return this.check(yi(r))},uppercase(r){return this.check(wi(r))},trim(){return this.check(Zi())},normalize(...r){return this.check(Si(...r))},toLowerCase(){return this.check(Ei())},toUpperCase(){return this.check(Ii())},slugify(){return this.check(Oi())}})}),ys=c("ZodString",(e,t)=>{de.init(e,t),dt.init(e,t),e.email=n=>e.check(Kr(zs,n)),e.url=n=>e.check(qr(ks,n)),e.jwt=n=>e.check(li(Cs,n)),e.emoji=n=>e.check(Hr($s,n)),e.guid=n=>e.check(nt(pt,n)),e.uuid=n=>e.check(Vr(te,n)),e.uuidv4=n=>e.check(Wr(te,n)),e.uuidv6=n=>e.check(Br(te,n)),e.uuidv7=n=>e.check(Gr(te,n)),e.nanoid=n=>e.check(Yr(Ss,n)),e.guid=n=>e.check(nt(pt,n)),e.cuid=n=>e.check(Xr(Zs,n)),e.cuid2=n=>e.check(Qr(Es,n)),e.ulid=n=>e.check(ei(Is,n)),e.base64=n=>e.check(ai(js,n)),e.base64url=n=>e.check(ci(Rs,n)),e.xid=n=>e.check(ti(Os,n)),e.ksuid=n=>e.check(ni(Ts,n)),e.ipv4=n=>e.check(ri(Ns,n)),e.ipv6=n=>e.check(ii(As,n)),e.cidrv4=n=>e.check(si(Ps,n)),e.cidrv6=n=>e.check(oi(Ms,n)),e.e164=n=>e.check(ui(Ls,n)),e.datetime=n=>e.check(ts(n)),e.date=n=>e.check(rs(n)),e.time=n=>e.check(ss(n)),e.duration=n=>e.check(as(n))});function ws(e){return Jr(ys,e)}const b=c("ZodStringFormat",(e,t)=>{v.init(e,t),dt.init(e,t)}),zs=c("ZodEmail",(e,t)=>{Qn.init(e,t),b.init(e,t)}),pt=c("ZodGUID",(e,t)=>{Yn.init(e,t),b.init(e,t)}),te=c("ZodUUID",(e,t)=>{Xn.init(e,t),b.init(e,t)}),ks=c("ZodURL",(e,t)=>{er.init(e,t),b.init(e,t)}),$s=c("ZodEmoji",(e,t)=>{tr.init(e,t),b.init(e,t)}),Ss=c("ZodNanoID",(e,t)=>{nr.init(e,t),b.init(e,t)}),Zs=c("ZodCUID",(e,t)=>{rr.init(e,t),b.init(e,t)}),Es=c("ZodCUID2",(e,t)=>{ir.init(e,t),b.init(e,t)}),Is=c("ZodULID",(e,t)=>{sr.init(e,t),b.init(e,t)}),Os=c("ZodXID",(e,t)=>{or.init(e,t),b.init(e,t)}),Ts=c("ZodKSUID",(e,t)=>{ar.init(e,t),b.init(e,t)}),Ns=c("ZodIPv4",(e,t)=>{fr.init(e,t),b.init(e,t)}),As=c("ZodIPv6",(e,t)=>{dr.init(e,t),b.init(e,t)}),Ps=c("ZodCIDRv4",(e,t)=>{pr.init(e,t),b.init(e,t)}),Ms=c("ZodCIDRv6",(e,t)=>{mr.init(e,t),b.init(e,t)}),js=c("ZodBase64",(e,t)=>{gr.init(e,t),b.init(e,t)}),Rs=c("ZodBase64URL",(e,t)=>{vr.init(e,t),b.init(e,t)}),Ls=c("ZodE164",(e,t)=>{br.init(e,t),b.init(e,t)}),Cs=c("ZodJWT",(e,t)=>{wr.init(e,t),b.init(e,t)}),mt=c("ZodNumber",(e,t)=>{Je.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>Li(e,r,i),D(e,"ZodNumber",{gt(r,i){return this.check(it(r,i))},gte(r,i){return this.check(ge(r,i))},min(r,i){return this.check(ge(r,i))},lt(r,i){return this.check(rt(r,i))},lte(r,i){return this.check(me(r,i))},max(r,i){return this.check(me(r,i))},int(r){return this.check(gt(r))},safe(r){return this.check(gt(r))},positive(r){return this.check(it(0,r))},nonnegative(r){return this.check(ge(0,r))},negative(r){return this.check(rt(0,r))},nonpositive(r){return this.check(me(0,r))},multipleOf(r,i){return this.check(st(r,i))},step(r,i){return this.check(st(r,i))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function U(e){return mi(mt,e)}const Fs=c("ZodNumberFormat",(e,t)=>{zr.init(e,t),mt.init(e,t)});function gt(e){return gi(Fs,e)}const xs=c("ZodUnknown",(e,t)=>{kr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Fi()});function _t(){return _i(xs)}const Ds=c("ZodNever",(e,t)=>{$r.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ci(e,n,r)});function Us(e){return vi(Ds,e)}const Js=c("ZodArray",(e,t)=>{Sr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ji(e,n,r,i),e.element=t.element,D(e,"ZodArray",{min(n,r){return this.check(Q(n,r))},nonempty(n){return this.check(Q(1,n))},max(n,r){return this.check(ot(n,r))},length(n,r){return this.check(at(n,r))},unwrap(){return this.elemen)DELIM" +R"DELIM(t}})});function Ks(e,t){return Ti(Js,e,t)}const Vs=c("ZodObject",(e,t)=>{Er.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ki(e,n,r,i),g(e,"shape",()=>t.shape),D(e,"ZodObject",{keyof(){return qs(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:_t()})},loose(){return this.clone({...this._zod.def,catchall:_t()})},strict(){return this.clone({...this._zod.def,catchall:Us()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Wt(this,n)},safeExtend(n){return Bt(this,n)},merge(n){return Gt(this,n)},pick(n){return Kt(this,n)},omit(n){return Vt(this,n)},partial(...n){return qt(bt,this,n[0])},required(...n){return Ht(zt,this,n[0])}})});function _e(e,t){const n={type:"object",shape:e??{},...f(t)};return new Vs(n)}const Ws=c("ZodUnion",(e,t)=>{Ir.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Vi(e,n,r,i),e.options=t.options});function vt(e,t){return new Ws({type:"union",options:e,...f(t)})}const Bs=c("ZodIntersection",(e,t)=>{Or.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Wi(e,n,r,i)});function Gs(e,t){return new Bs({type:"intersection",left:e,right:t})}const ve=c("ZodEnum",(e,t)=>{Tr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>xi(e,r,i),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const o={};for(const s of r)if(n.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new ve({...t,checks:[],...f(i),entries:o})},e.exclude=(r,i)=>{const o={...t.entries};for(const s of r)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new ve({...t,checks:[],...f(i),entries:o})}});function qs(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ve({type:"enum",entries:n,...f(t)})}const Hs=c("ZodTransform",(e,t)=>{Nr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ui(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Se(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(F(o,n.value,t));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(F(s))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(o=>(n.value=o,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Ys(e){return new Hs({type:"transform",transform:e})}const bt=c("ZodOptional",(e,t)=>{He.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ht(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function yt(e){return new bt({type:"optional",innerType:e})}const Xs=c("ZodExactOptional",(e,t)=>{Ar.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ht(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Qs(e){return new Xs({type:"optional",innerType:e})}const eo=c("ZodNullable",(e,t)=>{Pr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Bi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function wt(e){return new eo({type:"nullable",innerType:e})}const to=c("ZodDefault",(e,t)=>{Mr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>qi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function no(e,t){return new to({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Te(t)}})}const ro=c("ZodPrefault",(e,t)=>{jr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Hi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function io(e,t){return new ro({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Te(t)}})}const zt=c("ZodNonOptional",(e,t)=>{Rr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Gi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function so(e,t){return new zt({type:"nonoptional",innerType:e,...f(t)})}const oo=c("ZodCatch",(e,t)=>{Lr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Yi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ao(e,t){return new oo({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const co=c("ZodPipe",(e,t)=>{Cr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Xi(e,n,r,i),e.in=t.in,e.out=t.out});function kt(e,t){return new co({type:"pipe",in:e,out:t})}const uo=c("ZodReadonly",(e,t)=>{Fr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Qi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function lo(e){return new uo({type:"readonly",innerType:e})}const ho=c("ZodCustom",(e,t)=>{xr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Di(e,n)});function fo(e,t={}){return Ni(ho,e,t)}function po(e,t){return Ai(e,t)}const ne=[{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"}],be=[{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:"count"},{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:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],$t=U().int().nonnegative().max(864e13),St=_e({level:U().int().nonnegative(),time:$t,message:ws()}),Zt=_e({event:U().int().nonnegative(),value:U().nonnegative(),time:$t}),Et=_e({previous:U().nonnegative()});vt([St,Zt,Et]);const mo=2**ne.length-1,It=2**be.length-1;function Ot(e,t){return Number.isInteger(t)&&t)DELIM" +R"DELIM(>=0&&tnew WebSocket(n))},this.#c=this.#e.retryMinimumMs}getStatus=()=>this.#t;subscribeStatus=t=>(this.#r.add(t),()=>{this.#r.delete(t)});start(){this.#o||(this.#o=!0,this.#c=this.#e.retryMinimumMs,this.#h())}stop(){this.#o=!1,this.#g();const t=this.#n;if(this.#n=null,t)try{t.readyState===1&&this.#e.onBeforeStop?.(t),t.close()}catch{}this.#u(Nt)}send(t){if(this.#n?.readyState!==1)return!1;try{return this.#n.send(t),!0}catch{return!1}}#h(){if(!this.#o||this.#n)return;const t=this.#t.reconnects>0;this.#u({...this.#t,phase:t?"reconnecting":"connecting",attempt:this.#t.attempt+1,error:null});let n;try{n=this.#e.webSocketFactory(this.#e.url),this.#n=n}catch(r){this.#u({...this.#t,error:So(r)}),this.#d();return}this.#s=setTimeout(()=>{if(this.#n===n){this.#u({...this.#t,error:"Connection timed out"});try{n.close()}catch{this.#n=null,this.#d()}}},this.#e.connectTimeoutMs),n.addEventListener("open",()=>{this.#n!==n||!this.#o||(this.#p(),this.#c=this.#e.retryMinimumMs,this.#u({...this.#t,phase:"connected",connectedAt:this.#e.now(),error:null}),this.#e.onOpen?.(n),this.#m(n))}),n.addEventListener("message",r=>{if(this.#n!==n||!this.#o)return;const i=$o(r.data);if(i===null)return;const o=this.#e.now();(this.#t.lastMessageAt===null||o-this.#t.lastMessageAt>=1e3)&&this.#u({...this.#t,lastMessageAt:o}),this.#e.onMessage(i)}),n.addEventListener("error",()=>{if(!(this.#n!==n||!this.#o)){this.#u({...this.#t,error:"WebSocket connection failed"});try{n.close()}catch{this.#n=null,this.#d()}}}),n.addEventListener("close",()=>{this.#n===n&&(this.#n=null,this.#p(),this.#l(),this.#o&&this.#d())})}#d(){if(!this.#o||this.#i)return;const t=1+(this.#e.random()*2-1)*this.#e.jitterRatio,n=Math.max(0,Math.round(this.#c*t));this.#c=Math.min(this.#c*2,this.#e.retryMaximumMs),this.#u({...this.#t,phase:"reconnecting",reconnects:this.#t.reconnects+1,connectedAt:null}),this.#i=setTimeout(()=>{this.#i=null,this.#h()},n)}#m(t){this.#l(),!(!this.#e.onHeartbeat||this.#e.heartbeatMs<=0)&&(this.#a=setInterval(()=>{this.#n===t&&t.readyState===1&&this.#e.onHeartbeat?.(t)},this.#e.heartbeatMs))}#p(){this.#s&&(clearTimeout(this.#s),this.#s=null)}#l(){this.#a&&(clearInterval(this.#a),this.#a=null)}#g(){this.#p(),this.#l(),this.#i&&(clearTimeout(this.#i),this.#i=null)}#u(t){this.#t=t;for(const n of this.#r)n()}}function $o(e){return typeof e=="string"?e:e instanceof ArrayBuffer?new TextDecoder().decode(e):null}function So(e){return e instanceof Error?e.message:"Unable to create WebSocket"}class Zo{#e;#t;#n=new Set;#r=new Set;#s;constructor(t,n={}){this.#e=n.logFilter??mo,this.#t=n.eventFilter??It,this.#s=new ko({url:zo(t),webSocketFactory:n.webSocketFactory,retryMinimumMs:n.retryMinimumMs,retryMaximumMs:n.retryMaximumMs,jitterRatio:n.jitterRatio,onOpen:r=>{this.#i(r)},onHeartbeat:r=>{this.#i(r)},onBeforeStop:r=>{r.send("/v1/log/subscribe?filter=0"),r.send("/v1/event/subscribe?filter=0")},onMessage:r=>{const i=vo(r);if(!i){for(const o of this.#r)o(r);return}if(!(Tt(i)&&!Ot(this.#e,i.level)))for(const o of this.#n)o(i)}})}getStatus=()=>this.#s.getStatus();subscribeStatus=t=>this.#s.subscribeStatus(t);start(){this.#s.start()}stop(){this.#s.stop()}subscribeFrames(t){return this.#n.add(t),()=>{this.#n.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.#t!==n&&(this.#t=n,this.#s.send(`/v1/event/subscribe?filter=${String(n)}`))}#i(t){t.send(`/v1/log/subscribe?filter=${String(this.#e)}`),t.send(`/v1/event/subscribe?filter=${String(this.#t)}`)}}const J=["occurrence-rate","occurrence-count","cumulative-occurrences"],Eo=["payload-latest","payload-maximum","payload-change-rate",...J],Io=["payload-average","payload-latest","payload-minimum","payload-maximum",...J],Oo=["payload-sum","payload-cumulative","payload-latest","payload-average",...J];function At(e){return`event:${String(e)}`}function Pt(e){return`log:${String(e)}`}const we="native:top";function To(e){switch(e){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";default:return"unknown"}}function No(e){switch(e){case"height":return Eo;case"duration":return Io;case"count":return Oo;default:return J}}function Ao(e){switch(e){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function Po(e){const t=ye(e),n=To(t.valueKind);return{id:At(e),source:"event",sourceId:e,name:t.name,label:t.label,category:t.category,payloadKind:n,allowedMeasures:No(n),defaultMeasure:Ao(n),description:n==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${t.label} event with a ${n} payload.`}}const Mo=[...be.map(e=>Po(e.id)),...ne.map(e=>({id:Pt(e.id),source:"log",sourceId:e.id,name:e.name,label:`${e.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:J,defaultMeasure:"occurrence-rate",description:`${e.label} log message volume. Message text is not interpreted as numeric data.`})),{id:we,source:"native",sourceId:"top",name:"canonical_top",label:"Canonical 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(Mo.map(e=>[e.id,e]));function jo(e,t){return yo(e,t)??t}const Ro=3600*1e3,Lo=1e3,Co=1e3,Fo=1e3;class Mt{constructor(t){this.capacity=t,this.#e=Array.from({length:t})}capacity;#e;#t=0;#n=0;#r=null;get size(){return this.#n}push(t){const n=this.#n===this.capacity;return this.#r=null,this.#e[this.#t]=t,this.#t=(this.#t+1)%this.capacity,this.#n=Math.min(this.#n+1,this.capacity),n}clear(){this.#r=null,this.#e.fill(void 0),this.#t=0,this.#n=0}newestFirst(){if(this.#r)return this.#r;const t=[];for(let n=0;nthis.#T;getRecentLogs=()=>this.#r.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=t=>(this.#n.add(t),()=>{this.#n.delete(t)});start(){this.#v||(this.tick(),this.#v=setInterval(()=>{this.tick()},1e3))}stop(){this.#v&&(clearInterval(this.#v),this.#v=null),this.#f&&(clearTimeout(this.#f),this.#f=null)}ingest(t,n=this.#e()){const r=this.#b(n);this.#u+=1,Tt(t)?this.#M(t,r):go(t)?this.#j(t,r):_o(t)&&(this.#Z+=1),this.#w()}recordInvalidFrame(){this.#E+=1,this.#w()}recordNativeTop(t,n=this.#e()){const r=this.#b(n),i=this.#m[we];i?.value===t&&r-i.time<15e3||(this.#N(we,r,t),this.#A(r),this.#w())}clearLogs(){this.#$+=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.#a={},this.#c={},this.#o={},this.#h={},this.#d={},this.#m={},this.#p={},this.#l=this.#b(this.#e()),this.#u=0,this.#z=0,this.#k=0,this.#$=0,this.#S=0,this.#Z=0,this.#E=0,this.#I=null,this.#O=null,this.#_=0,this.#y(this.#l),this.flush()}tick(){const t=this.#b(this.#e());this.#y(t),this.#A(t),this.#w()}flush(){this.#f&&(clearTimeout(this.#f),this.#f=null),this.#T=this.#P();for(const t of this.#n)t()}#M(t,n){this.#z+=1,this.#I=n,this.#_+=1,this.#r.push({...t,id:this.#_,receivedAt:n})&&(this.#k+=1),this.#N(Pt(t.level),n,null)}#j(t,n){this.#S+=1,this.#O=n,this.#_+=1,this.#s.push({...t,id:this.#_,receivedAt:n}),this.#N(At(t.event),n,jo(t.event,t.value))}#b(t){return Number.isFinite(t)?(this.#g=Math.max(this.#g,t),this.#g):this.#g}#N(t,n,r){const i=this.#y(n);i.snapshot=null;const o=i.signals.get(t)??xo();if(o.count+=1,re(this.#h,t,1),r!==null){o.samples+=1,o.sum+=r,o.minimum=o.minimum===null?r:Math.min(o.minimum,r),o.maximum=o.maximum===null?r:Math.max(o.maximum,r),(o.firstAt===null||n=o.lastAt)&&(o.last=r,o.lastAt=n),re(this.#d,t,r);const s=this.#m[t];(!s||n>=s.time)&&(this.#m[t]={value:r,time:n}),this.#p[t]=Math.max(this.#p[t]??r,r)}i.signals.set(t,o)}#y(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};return this.#i.set(n,i),i}#A(t){const n=t-Ro;for(const[r,i]of this.#i){if(r>=n)break;for(const[o,s]of i.signals)if(re(this.#a,o,s.count),re(this.#c,o,s.sum),s.last!==null&&s.lastAt!==null){const a=this.#o[o];(!a||s.lastAt>=a.time)&&(this.#o[o]={value:s.last,time:s.lastAt})}this.#i.delete(r)}}#w(){!this.#t||this.#f||(this.#f=setTimeout(()=>{this.#f=null,this.flush()},Lo))}#P(){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.#b(this.#e()),sessionStartedAt:this.#l,totalFrames:this.#u,totalLogs:this.#z,evictedLogs:this.#k,clearedLogs:this.#$,totalEvents:this.#S,totalAcks:this.#Z,invalidFrames:this.#E,buckets:t,priorSignalCounts:{...this.#a},priorSignalSums:{...this.#c},priorSignalLatest:jt(this.#o),signalTotals:{...this.#h},signalSums:{...this.#d},signalLatest:jt(this.#m),signalMaximums:{...this.#p},recentLogs:this.#r.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#I,lastEventAt:this.#O}}}const ie=40;function Uo(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(s=>Ot(t.filter,s.level)&&(!n||s.message.toLowerCase().includes(n)||bo(s.level).name.includes(n))),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,o=Math.min(i,Math.max(0,r.length-ie));return{logs:r.slice(o,o+ie),retained:e.length,matched:r.length,offset:o}}function Jo(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(s=>{const a=ye(s.event);return(t.category==="all"||a.category===t.category)&&(!n||a.name.includes(n)||a.label.toLowerCase().includes(n)||String(s.value).includes(n))}),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,o=Math.min(i,Math.max(0,r.length-ie));return{events:r.slice(o,o+ie),retained:e.length,matched:r.length,offset:o}}function Ko(e,t){const{buckets:n,recentLogs:r,recentEvents:i,...o}=e,s=new Map(t?.buckets.map(a=>[a.time,a]));return{summary:o,reset:t===null,firstBucketTime:n[0]?.time??e.now,buckets:n.filter(a=>s.get(a.time)!==a),recentLogs:r===t?.recentLogs?null:r,recentEvents:i===t?.recentEvents?null:i}}class Vo{constructor(t,n=(i,o)=>new Zo(i,{logFilter:o}),r=Date.now){this.send=t,this.createClient=n,this.#e=new Do(r,!1)}send;createClient;#e;#t=null;#n=null;#r=0;#s=null;#i=null;#a=null;#c=[];handle(t){if(t.type==="stop"){this.#h(),this.#e.stop(),this.send({type:"stopped"});return}if(t.type==="configure"){if(t.generation{this.#e.ingest(n)}),this.#t.subscribeInvalidFrames(()=>{this.#e.recordInvalidFrame()})],this.#t.start(),this.#e.start()):this.#t.setFilters(t.logFilter,It);return}if(t.type==="reset"){t.generation>=this.#r&&this.#o(t.generation);return}if(t.generation===this.#r)switch(t.type){case"pause-display":{t.stream==="logs"?this.#i=t.paused?this.#i??this.#e.getRecentLogs():null:this.#a=t.paused?this.#a??this.#e.getRecentEvents():null;break}case"poll-events":{this.send({type:"events",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Jo(this.#a??this.#e.getRecentEvents(),t.query)});break}case"poll-logs":{this.send({type:"logs",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Uo(this.#i??this.#e.getRecentLogs(),t.query)});break}case"native-top":{this.#e.recordNativeTop(t.height,t.receivedAt);break}case"clear-logs":{this.#e.clearLogs(),this.#i!==null&&(this.#i=[]);break}case"clear-events":{this.#e.clearEvents(),this.#a!==null&&(this.#a=[]);break}case"poll":{if(!this.#t)return;this.#e.flush();const n=this.#e.getSnapshot();this.send({type:"snapshot",generation:this.#r,requestId:t.requestId,status:this.#t.getStatus(),update:Ko(n,this.#s)}),this.#s=n;break}}}#o(t){this.#r=t,this.#s=null,this.#i!==null&&(this.#i=[]),this.#a!==null&&(this.#a=[]),this.#e.reset()}#h(){for(const t of this.#c)t();this.#c=[],this.#t?.stop(),this.#t=null}}const ze=globalThis,Wo=new Vo(e=>{ze.postMessage(e)});ze.addEventListener("message",e=>{Wo.handle(e.data),e.data.type==="stop"&&ze.close()})})();\n',e0=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Fb],{type:"text/javascript;charset=utf-8"});function hN(n){let i;try{if(i=e0&&(self.URL||self.webkitURL).createObjectURL(e0),!i)throw"";const l=new Worker(i,{name:n?.name});return l.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(i)}),l}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Fb),{name:n?.name})}}const t0=100;function mN(n,i){const l=new Map((i.reset?[]:n.buckets).filter(r=>r.time>=i.firstBucketTime).map(r=>[r.time,r]));for(const r of i.buckets)l.set(r.time,r);return{...i.summary,buckets:[...l.values()],recentLogs:Cc(i.reset?[]:n.recentLogs,i.recentLogs),recentEvents:Cc(i.reset?[]:n.recentEvents,i.recentEvents)}}function Cc(n,i){if(i===null)return n;const l=new Map(n.map(r=>[r.id,r]));return i.map(r=>l.get(r.id)??r)}const To={phase:"idle",attempt:0,reconnects:0,connectedAt:null,lastMessageAt:null,error:null};class pN{constructor(i=()=>new hN){this.createWorker=i}createWorker;#e=null;#t=new uy().getSnapshot();#n=To;#i=new Set;#s=new Set;#a=null;#r=ur;#l=0;#u=0;#o=null;#m=null;#c=null;#d=new Set;#h={logs:[],retained:0,matched:0,offset:0};#p={search:"",filter:ur,offset:0};#f=0;#y=null;#x=null;#g=new Set;#w={events:[],retained:0,matched:0,offset:0};#E={search:"",category:"all",offset:0};#z=0;#b=null;#T=!1;#A=!1;getSnapshot=()=>this.#t;getStatus=()DELIM" +R"DELIM()=>this.#n;getLogWindow=()=>this.#h;getEventWindow=()=>this.#w;subscribeEvents=i=>(this.#g.add(i),this.#S(),this.#_(),()=>{this.#g.delete(i),this.#g.size===0&&this.#O()});subscribeLogs=i=>(this.#d.add(i),this.#N(),this.#D(),()=>{this.#d.delete(i),this.#d.size===0&&this.#M()});subscribe=i=>(this.#i.add(i),()=>{this.#i.delete(i)});subscribeStatus=i=>(this.#s.add(i),()=>{this.#s.delete(i)});configure(i,l){i===this.#a&&l===this.#r||(this.#a!==null&&i!==this.#a&&(this.reset(),this.#U({...To,phase:"connecting"})),this.#a=i,this.#r=l,this.#C())}start(){if(!(this.#e||this.#a===null))try{const i=this.createWorker();this.#e=i,this.#h={logs:[],retained:0,matched:0,offset:0},this.#w={events:[],retained:0,matched:0,offset:0};for(const l of this.#d)l();for(const l of this.#g)l();this.#U({...To,phase:"connecting"}),i.onmessage=l=>{if(this.#e!==i)return;const r=l.data;if(r.type==="events"){if(r.requestId!==this.#b||(this.#b=null,r.generation!==this.#l))return;if(r.queryVersion!==this.#z){this.#S();return}this.#w={...r.window,events:Cc(this.#w.events,r.window.events)};for(const u of this.#g)u();return}if(r.type==="logs"){if(r.requestId!==this.#y||(this.#y=null,r.generation!==this.#l))return;if(r.queryVersion!==this.#f){this.#N();return}this.#h={...r.window,logs:Cc(this.#h.logs,r.window.logs)};for(const u of this.#d)u();return}if(r.type==="snapshot"&&r.requestId===this.#o&&(this.#o=null,r.generation===this.#l)){this.#t=mN(this.#t,r.update),this.#U(r.status);for(const u of this.#i)u()}},i.onerror=()=>{this.#R("Telemetry worker failed. Reload the dashboard to reconnect.")},i.onmessageerror=()=>{this.#R("Unable to read telemetry worker data. Reload the dashboard to reconnect.")},this.#C(),this.#T&&this.#v({type:"pause-display",generation:this.#l,stream:"logs",paused:!0}),this.#A&&this.#v({type:"pause-display",generation:this.#l,stream:"events",paused:!0}),this.#j(),this.getStatus().error===null&&(this.#m=setInterval(()=>{this.#j()},1e3)),this.#D(),this.#_()}catch(i){this.#R(`Unable to start telemetry worker: ${i instanceof Error?i.message:String(i)}`)}}stop(){this.#k();const i=this.#e;if(this.#e=null,i){const l=setTimeout(()=>{i.terminate()},500),r=()=>{clearTimeout(l),i.terminate()};i.onmessage=u=>{u.data.type==="stopped"&&r()},i.onerror=r,i.onmessageerror=r;try{i.postMessage({type:"stop"})}catch{r()}}this.#U(To)}recordNativeTop(i,l=Date.now()){this.#v({type:"native-top",generation:this.#l,height:i,receivedAt:l})}clearLogs(){this.#v({type:"clear-logs",generation:this.#l}),this.#f+=1,this.#N()}clearEvents(){this.#v({type:"clear-events",generation:this.#l}),this.#z+=1,this.#S()}setLogsPaused(i){i!==this.#T&&(this.#T=i,this.#M(),this.#v({type:"pause-display",generation:this.#l,stream:"logs",paused:i}),this.#f+=1,this.#N(),this.#D())}setEventsPaused(i){i!==this.#A&&(this.#A=i,this.#O(),this.#v({type:"pause-display",generation:this.#l,stream:"events",paused:i}),this.#z+=1,this.#S(),this.#_())}reset(){this.#l+=1,this.#o=null,this.#y=null,this.#b=null,this.#h={logs:[],retained:0,matched:0,offset:0},this.#w={events:[],retained:0,matched:0,offset:0},this.#t=new uy().getSnapshot(),this.#v({type:"reset",generation:this.#l});for(const i of this.#i)i();for(const i of this.#d)i();for(const i of this.#g)i()}setLogQuery(i){JSON.stringify(i)!==JSON.stringify(this.#p)&&(this.#p=i,this.#f+=1,this.#N())}setEventQuery(i){JSON.stringify(i)!==JSON.stringify(this.#E)&&(this.#E=i,this.#z+=1,this.#S())}#_(){!this.#e||this.#g.size===0||this.#x||this.#A||(this.#x=setInterval(()=>{this.#S()},t0),this.#S())}#S(){this.#b!==null||!this.#e||this.#g.size===0||(this.#b=++this.#u,this.#v({type:"poll-events",generation:this.#l,requestId:this.#b,queryVersion:this.#z,query:this.#E}))}#O(){this.#x&&clearInterval(this.#x),this.#x=null,this.#b=null}#D(){!this.#e||this.#d.size===0||this.#c||this.#T||(this.#c=setInterval(()=>{this.#N()},t0),this.#N())}#N(){this.#y!==null||!this.#e||this.#d.size===0||(this.#y=++this.#u,this.#v({type:"poll-logs",generation:this.#l,requestId:this.#y,queryVersion:this.#f,query:this.#p}))}#M(){this.#c&&clearInterval(this.#c),this.#c=null,this.#y=null}#C(){this.#a!==null&&this.#v({type:"configure",generation:this.#l,endpoint:this.#a,logFilter:this.#r})}#j(){this.#o!==null||!this.#e||(this.#o=++this.#u,this.#v({type:"poll",generation:this.#l,requestId:this.#o}))}#v(i){try{this.#e?.postMessage(i)}catch{this.#R("Unable to communicate with telemetry worker. Reload the dashboard to reconnect.")}}#k(){this.#M(),this.#O(),this.#m&&clearInterval(this.#m),this.#m=null,this.#o=null}#R(i){this.#k(),this.#e?.terminate(),this.#e=null,this.#U({...To,error:i})}#U(i){if(JSON.stringify(i)!==JSON.stringify(this.#n)){this.#n=i;for(const l of this.#s)l()}}}const Jb="libbitcoinAdminDashboardLogFilter";function Xb(){try{return globalThis.localStorage}catch{return null}}function gN(n=Xb()){try{const i=n?.getItem(Jb);if(!i)return ur;const l=JSON.parse(i);return typeof l=="number"&&Number.isInteger(l)&&l>=0&&l<=Jh?l:ur}catch{return ur}}function vN(n,i=Xb()){try{i?.setItem(Jb,String(n))}catch{}}var Bo=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(){}},yN=class extends Bo{#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"}},gm=new yN,bN={setTimeout:(n,i)=>setTimeout(n,i),clearTimeout:n=>clearTimeout(n),setInterval:(n,i)=>setInterval(n,i),clearInterval:n=>clearInterval(n)},_N=class{#e=bN;#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)}},us=new _N;function SN(n){setTimeout(n,0)}var xN=typeof window>"u"||"Deno"in globalThis;function Pn(){}function wN(n,i){return typeof n=="function"?n(i):n}function Th(n){return typeof n=="number"&&n>=0&&n!==1/0}function Ib(n,i){return Math.max(n+(i||0)-Date.now(),0)}function Tl(n,i){return typeof n=="function"?n(i):n}function di(n,i){return typeof n=="function"?n(i):n}function n0(n,i){const{type:l="all",exact:r,fetchStatus:u,predicate:d,queryKey:f,stale:p}=n;if(f){if(r){if(i.queryHash!==vm(f,i.options))return!1}else if(!vr(i.queryKey,f))return!1}if(l!=="all"){const m=i.isActive();if(l==="active"&&!m||l==="inactive"&&m)return!1}return!(typeof p=="boolean"&&i.isStale()!==p||u&&u!==i.state.fetchStatus||d&&!d(i))}function i0(n,i){const{exact:l,status:r,predicate:u,mutationKey:d}=n;if(d){if(!i.options.mutationKey)return!1;if(l){if(Zo(i.options.mutationKey)!==Zo(d))return!1}else if(!vr(i.options.mutationKey,d))return!1}return!(r&&i.state.status!==r||u&&!u(i))}function vm(n,i){return(i?.queryKeyHashFn||Zo)(n)}function Zo(n){return JSON.stringify(n,(i,l)=>Nh(l)?Object.keys(l).sort().reduce((r,u)=>(r[u]=l[u],r),{}):l)}function vr(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)){for(let r=0;r500)return i;const r=a0(n)&&a0(i);if(!r&&!(Nh(n)&&Nh(i)))return i;const d=(r?n:Object.keys(n)).len)DELIM" +R"DELIM(gth,f=r?i:Object.keys(i),p=f.length,m=r?new Array(p):{};let v=0;for(let w=0;w{us.setTimeout(i,n)})}function Mh(n,i,l){return typeof l.structuralSharing=="function"?l.structuralSharing(n,i):l.structuralSharing!==!1?Pb(n,i):i}function TN(n,i,l=0){const r=[...n,i];return l&&r.length>l?r.slice(1):r}function AN(n,i,l=0){const r=[i,...n];return l&&r.length>l?r.slice(0,-1):r}var ym=Symbol();function Wb(n,i){return!n.queryFn&&i?.initialPromise?()=>i.initialPromise:!n.queryFn||n.queryFn===ym?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function e1(n,i){return typeof n=="function"?n(...i):!!n}function NN(n,i,l){let r=!1,u;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(u??=i(),r||(r=!0,u.aborted?l():u.addEventListener("abort",l,{once:!0})),u)}),n}var $o=(()=>{let n=()=>xN;return{isServer(){return n()},setIsServer(i){n=i}}})();function Oh(){let n,i;const l=new Promise((u,d)=>{n=u,i=d});l.status="pending",l.catch(()=>{});function r(u){Object.assign(l,u),delete l.resolve,delete l.reject}return l.resolve=u=>{r({status:"fulfilled",value:u}),n(u)},l.reject=u=>{r({status:"rejected",reason:u}),i(u)},l}var MN=SN;function ON(){let n=[],i=0,l=p=>{p()},r=p=>{p()},u=MN;const d=p=>{i?n.push(p):u(()=>{l(p)})},f=()=>{const p=n;n=[],p.length&&u(()=>{r(()=>{p.forEach(m=>{l(m)})})})};return{batch:p=>{let m;i++;try{m=p()}finally{i--,i||f()}return m},batchCalls:p=>(...m)=>{d(()=>{p(...m)})},schedule:d,setNotifyFunction:p=>{l=p},setBatchNotifyFunction:p=>{r=p},setScheduler:p=>{u=p}}}var _n=ON(),jN=class extends Bo{#e=!0;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n(!0),l=()=>n(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",l,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",l)}}}}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(l=>{l(n)}))}isOnline(){return this.#e}},Dc=new jN;function kN(n){return Math.min(1e3*2**n,3e4)}function t1(n){return(n??"online")==="online"?Dc.isOnline():!0}var jh=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function n1(n){let i=!1,l=0,r;const u=Oh(),d=()=>u.status!=="pending",f=L=>{if(!d()){const V=new jh(L);z(V),n.onCancel?.(V)}},p=()=>{i=!0},m=()=>{i=!1},v=()=>gm.isFocused()&&(n.networkMode==="always"||Dc.isOnline())&&n.canRun(),w=()=>t1(n.networkMode)&&n.canRun(),S=L=>{d()||(r?.(),u.resolve(L))},z=L=>{d()||(r?.(),u.reject(L))},T=()=>new Promise(L=>{r=V=>{(d()||v())&&L(V)},n.onPause?.()}).then(()=>{r=void 0,d()||n.onContinue?.()}),j=()=>{if(d())return;let L;const V=l===0?n.initialPromise:void 0;try{L=V??n.fn()}catch(H){L=Promise.reject(H)}Promise.resolve(L).then(S).catch(H=>{if(d())return;const G=n.retry??($o.isServer()?0:3),W=n.retryDelay??kN,B=typeof W=="function"?W(l,H):W,ne=G===!0||typeof G=="number"&&lv()?void 0:T()).then(()=>{i?z(H):j()})})};return{promise:u,status:()=>u.status,cancel:f,continue:()=>(r?.(),u),cancelRetry:p,continueRetry:m,canStart:w,start:()=>(w()?j():T().then(j),u)}}var i1=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Th(this.gcTime)&&(this.#e=us.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??($o.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(us.clearTimeout(this.#e),this.#e=void 0)}};function RN(n){return{onFetch:(i,l)=>{const r=i.options,u=i.fetchOptions?.meta?.fetchMore?.direction,d=i.state.data?.pages||[],f=i.state.data?.pageParams||[];let p={pages:[],pageParams:[]},m=0;const v=async()=>{let w=!1;const S=j=>{NN(j,()=>i.signal,()=>w=!0)},z=Wb(i.options,i.fetchOptions),T=async(j,L,V)=>{if(w)return Promise.reject(i.signal.reason);if(L==null&&j.pages.length)return Promise.resolve(j);const G=(()=>{const ee={client:i.client,queryKey:i.queryKey,pageParam:L,direction:V?"backward":"forward",meta:i.options.meta};return S(ee),ee})(),W=await z(G),{maxPages:B}=i.options,ne=V?AN:TN;return{pages:ne(j.pages,W,B),pageParams:ne(j.pageParams,L,B)}};if(u&&d.length){const j=u==="backward",L=j?CN:s0,V={pages:d,pageParams:f},H=L(r,V);p=await T(V,H,j)}else{const j=n??d.length;do{const L=m===0?f[0]??r.initialPageParam:s0(r,p);if(m>0&&L==null)break;p=await T(p,L),m++}while(mi.options.persister?.(v,{client:i.client,queryKey:i.queryKey,meta:i.options.meta,signal:i.signal},l):i.fetchFn=v}}}function s0(n,{pages:i,pageParams:l}){const r=i.length-1;return i.length>0?n.getNextPageParam(i[r],i,l[r],l):void 0}function CN(n,{pages:i,pageParams:l}){return i.length>0?n.getPreviousPageParam?.(i[0],i,l[0],l):void 0}var DN=class extends i1{#e;#t;#n;#i;#s;#a;#r;#l;constructor(n){super(),this.#l=!1,this.#r=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=o0(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.#a?.promise}setOptions(n){if(this.options={...this.#r,...n},n?._type&&(this.#e=n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=o0(this.options);i.data!==void 0&&(this.setState(r0(i.data,i.dataUpdatedAt)),this.#t=i)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(n,i){const l=Mh(this.state.data,n,this.options);return this.#o({data:l,type:"success",dataUpdatedAt:i?.updatedAt,manual:i?.manual}),l}setState(n){this.#o({type:"setState",state:n})}cancel(n){const i=this.#a?.promise;return this.#a?.cancel(n),i?i.then(Pn).catch(Pn):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=>di(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ym||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(n=>Tl(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:!Ib(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(i=>i.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(i=>i.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){this.observers.includes(n)&&(this.observers=t)DELIM" +R"DELIM(his.observers.filter(i=>i!==n),this.observers.length||(this.#a&&(this.#l||this.#u()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(n,i){if(this.state.fetchStatus!=="idle"&&this.#a?.status()!=="rejected"){if(this.state.data!==void 0&&i?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(n&&this.setOptions(n),!this.options.queryFn){const m=this.observers.find(v=>v.options.queryFn);m&&this.setOptions(m.options)}const l=new AbortController,r=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(this.#l=!0,l.signal)})},u=()=>{const m=Wb(this.options,i),w=(()=>{const S={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(S),S})();return this.#l=!1,this.options.persister?this.options.persister(m,w,this):m(w)},f=(()=>{const m={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:u};return r(m),m})();(this.#e==="infinite"?RN(this.options.pages):this.options.behavior)?.onFetch(f,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==f.fetchOptions?.meta)&&this.#o({type:"fetch",meta:f.fetchOptions?.meta}),this.#a=n1({initialPromise:i?.initialPromise,fn:f.fetchFn,onCancel:m=>{m instanceof jh&&m.revert&&this.setState({...this.#n,fetchStatus:"idle"}),l.abort()},onFail:(m,v)=>{this.#o({type:"failed",failureCount:m,error:v})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0});try{const m=await this.#a.start();if(m===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(m),this.#i.config.onSuccess?.(m,this),this.#i.config.onSettled?.(m,this.state.error,this),m}catch(m){if(m instanceof jh){if(m.silent)return this.#a.promise;if(m.revert){if(this.state.data===void 0)throw m;return this.state.data}}throw this.#o({type:"error",error:m}),this.#i.config.onError?.(m,this),this.#i.config.onSettled?.(this.state.data,m,this),m}finally{this.scheduleGc()}}#o(n){const i=l=>{switch(n.type){case"failed":return{...l,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...l,fetchStatus:"paused"};case"continue":return{...l,fetchStatus:"fetching"};case"fetch":return{...l,...a1(l.data,this.options),fetchMeta:n.meta??null};case"success":const r={...l,...r0(n.data,n.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=n.manual?r:void 0,r;case"error":const u=n.error;return{...l,error:u,errorUpdateCount:l.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:l.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...l,isInvalidated:!0};case"setState":return{...l,...n.state}}};this.state=i(this.state),_n.batch(()=>{this.observers.forEach(l=>{l.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:n})})}};function a1(n,i){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:t1(i.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function r0(n,i){return{data:n,dataUpdatedAt:i??Date.now(),error:null,isInvalidated:!1,status:"success"}}function o0(n){const i=typeof n.initialData=="function"?n.initialData():n.initialData,l=i!==void 0,r=l?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:i,dataUpdateCount:0,dataUpdatedAt:l?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:l?"success":"pending",fetchStatus:"idle"}}var UN=class extends Bo{constructor(n,i){super(),this.options=i,this.#e=n,this.#l=null,this.#r=Oh(),this.bindMethods(),this.setOptions(i)}#e;#t=void 0;#n=void 0;#i=void 0;#s;#a;#r;#l;#u;#o;#m;#c;#d;#h;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),u0(this.#t,this.options)?this.#f():this.updateResult(),this.#w())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return kh(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return kh(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#E(),this.#z(),this.#t.removeObserver(this)}setOptions(n){const i=this.options,l=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 di(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#b(),this.#t.setOptions(this.options),i._defaulted&&!Ah(this.options,i)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&c0(this.#t,l,this.options,i)&&this.#f(),this.updateResult(),r&&(this.#t!==l||di(this.options.enabled,this.#t)!==di(i.enabled,this.#t)||Tl(this.options.staleTime,this.#t)!==Tl(i.staleTime,this.#t))&&this.#y();const u=this.#x();r&&(this.#t!==l||di(this.options.enabled,this.#t)!==di(i.enabled,this.#t)||u!==this.#h)&&this.#g(u)}getOptimisticResult(n){const i=this.#e.getQueryCache().build(this.#e,n),l=this.createResult(i,n);return $N(this,l)&&(this.#i=l,this.#a=this.options,this.#s=this.#t.state),l}getCurrentResult(){return this.#i}trackResult(n,i){return new Proxy(n,{get:(l,r)=>(this.trackProp(r),i?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(l,r))})}trackProp(n){this.#p.add(n)}getCurrentQuery(){return this.#t}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const i=this.#e.defaultQueryOptions(n),l=this.#e.getQueryCache().build(this.#e,i);return l.fetch().then(()=>this.createResult(l,i))}fetch(n){return this.#f({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#f(n){this.#b();let i=this.#t.fetch(this.options,n);return n?.throwOnError||(i=i.catch(Pn)),i}#y(){this.#E();const n=Tl(this.options.staleTime,this.#t);if($o.isServer()||this.#i.isStale||!Th(n))return;const l=Ib(this.#i.dataUpdatedAt,n)+1;this.#c=us.setTimeout(()=>{this.#i.isStale||this.updateResult()},l)}#x(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#g(n){this.#z(),this.#h=n,!($o.isServer()||di(this.options.enabled,this.#t)===!1||!Th(this.#h)||this.#h===0)&&(this.#d=us.setInterval(()=>{(this.options.refetchIntervalInBackground||gm.isFocused())&&this.#f()},this.#h))}#w(){this.#y(),this.#g(this.#x())}#E(){this.#c!==void 0&&(us.clearTimeout(this.#c),this.#c=void 0)}#z(){this.#d!==void 0&&(us.clearInterval(this.#d),this.#d=void 0)}createResult(n,i){const l=this.#t,r=this.options,u=this.#i,d=this.#s,f=this.#a,m=n!==l?n.state:this.#n,{state:v}=n;let w={...v},S=!1,z;if(i._optimisticResults){const le=this.hasListeners(),ze=!le&&u0(n,i),ve=le&&c0(n,l,i,r);(ze||ve)&&(w={...w,...a1(v.data,n.options)}),i._optimisticResults==="isRestoring"&&(w.fetchStatus="idle")}let{error:T,errorUpdatedAt:j,status:L}=w;z=w.data;let V=!1;if(i.placeholderData!==void 0&&z===void 0&&L==="pending"){let le;u?.isPlaceholderData&&i.placeholderData===f?.placeholderData?(le=u.data,V=!0):le=typeof i.placeholderData=="function"?i.placeholderData(this.#m?.state.data,this.#m):i.placeholderData,le!==void 0&&(L="success",z=Mh(u?.data,le,i),S=!0)}if(i.select&&z!==void 0&&!V)i)DELIM" +R"DELIM(f(u&&z===d?.data&&i.select===this.#u)z=this.#o;else try{this.#u=i.select,z=i.select(z),z=Mh(u?.data,z,i),this.#o=z,this.#l=null}catch(le){this.#l=le}this.#l&&(T=this.#l,z=this.#o,j=Date.now(),L="error");const H=w.fetchStatus==="fetching",G=L==="pending",W=L==="error",B=G&&H,ne=z!==void 0,K={status:L,fetchStatus:w.fetchStatus,isPending:G,isSuccess:L==="success",isError:W,isInitialLoading:B,isLoading:B,data:z,dataUpdatedAt:w.dataUpdatedAt,error:T,errorUpdatedAt:j,failureCount:w.fetchFailureCount,failureReason:w.fetchFailureReason,errorUpdateCount:w.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:w.dataUpdateCount>m.dataUpdateCount||w.errorUpdateCount>m.errorUpdateCount,isFetching:H,isRefetching:H&&!G,isLoadingError:W&&!ne,isPaused:w.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:W&&ne,isStale:bm(n,i),refetch:this.refetch,promise:this.#r,isEnabled:di(i.enabled,n)!==!1};if(this.options.experimental_prefetchInRender){const le=K.data!==void 0,ze=K.status==="error"&&!le,ve=ce=>{ze?ce.reject(K.error):le&&ce.resolve(K.data)},ie=()=>{const ce=this.#r=K.promise=Oh();ve(ce)},_e=this.#r;switch(_e.status){case"pending":n.queryHash===l.queryHash&&ve(_e);break;case"fulfilled":(ze||K.data!==_e.value)&&ie();break;case"rejected":(!ze||K.error!==_e.reason)&&ie();break}}return K}updateResult(){const n=this.#i,i=this.createResult(this.#t,this.options);if(this.#s=this.#t.state,this.#a=this.options,this.#s.data!==void 0&&(this.#m=this.#t),Ah(i,n))return;this.#i=i;const l=()=>{if(!n)return!0;const{notifyOnChangeProps:r}=this.options,u=typeof r=="function"?r():r;if(u==="all"||!u&&!this.#p.size)return!0;const d=new Set(u??this.#p);return this.options.throwOnError&&d.add("error"),Object.keys(this.#i).some(f=>{const p=f;return this.#i[p]!==n[p]&&d.has(p)})};this.#T({listeners:l()})}#b(){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.#w()}#T(n){_n.batch(()=>{n.listeners&&this.listeners.forEach(i=>{i(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function ZN(n,i){return di(i.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&di(i.retryOnMount,n)===!1)}function u0(n,i){return ZN(n,i)||n.state.data!==void 0&&kh(n,i,i.refetchOnMount)}function kh(n,i,l){if(di(i.enabled,n)!==!1&&Tl(i.staleTime,n)!=="static"){const r=typeof l=="function"?l(n):l;return r==="always"||r!==!1&&bm(n,i)}return!1}function c0(n,i,l,r){return(n!==i||di(r.enabled,n)===!1)&&(!l.suspense||n.state.status!=="error")&&bm(n,l)}function bm(n,i){return di(i.enabled,n)!==!1&&n.isStaleByTime(Tl(i.staleTime,n))}function $N(n,i){return!Ah(n.getCurrentResult(),i)}var LN=class extends i1{#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||HN(),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.execute(this.state.variables)}async execute(n){const i=()=>{this.#s({type:"continue"})},l={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=n1({fn:()=>this.options.mutationFn?this.options.mutationFn(n,l):Promise.reject(new Error("No mutationFn found")),onFail:(d,f)=>{this.#s({type:"failed",failureCount:d,error:f})},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)});const r=this.state.status==="pending",u=!this.#i.canStart();try{if(r)i();else{this.#s({type:"pending",variables:n,isPaused:u}),this.#n.config.onMutate&&await this.#n.config.onMutate(n,this,l);const f=await this.options.onMutate?.(n,l);f!==this.state.context&&this.#s({type:"pending",context:f,variables:n,isPaused:u})}const d=await this.#i.start();return await this.#n.config.onSuccess?.(d,n,this.state.context,this,l),await this.options.onSuccess?.(d,n,this.state.context,l),await this.#n.config.onSettled?.(d,null,this.state.variables,this.state.context,this,l),await this.options.onSettled?.(d,null,n,this.state.context,l),this.#s({type:"success",data:d}),d}catch(d){try{await this.#n.config.onError?.(d,n,this.state.context,this,l)}catch(f){Promise.reject(f)}try{await this.options.onError?.(d,n,this.state.context,l)}catch(f){Promise.reject(f)}try{await this.#n.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,l)}catch(f){Promise.reject(f)}try{await this.options.onSettled?.(void 0,d,n,this.state.context,l)}catch(f){Promise.reject(f)}throw this.#s({type:"error",error:d}),d}finally{this.#n.runNext(this)}}#s(n){const i=l=>{switch(n.type){case"failed":return{...l,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...l,isPaused:!0};case"continue":return{...l,isPaused:!1};case"pending":return{...l,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{...l,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...l,data:void 0,error:n.error,failureCount:l.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=i(this.state),_n.batch(()=>{this.#t.forEach(l=>{l.onMutationUpdate(n)}),this.#n.notify({mutation:this,type:"updated",action:n})})}};function HN(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var qN=class extends Bo{constructor(n={}){super(),this.config=n,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(n,i,l){const r=new LN({client:n,mutationCache:this,mutationId:++this.#n,options:n.defaultMutationOptions(i),state:l});return this.add(r),r}add(n){this.#e.add(n);const i=vc(n);if(typeof i=="string"){const l=this.#t.get(i);l?l.push(n):this.#t.set(i,[n])}this.notify({type:"added",mutation:n})}remove(n){if(this.#e.delete(n)){const i=vc(n);if(typeof i=="string"){const l=this.#t.get(i);if(l)if(l.length>1){const r=l.indexOf(n);r!==-1&&l.splice(r,1)}else l[0]===n&&this.#t.delete(i)}}this.notify({type:"removed",mutation:n})}canRun(n){const i=vc(n);if(typeof i=="string"){const r=this.#t.get(i)?.find(u=>u.state.status==="pending");return!r||r===n}else return!0}runNext(n){const i=vc(n);return typeof i=="string"?this.#t.get(i)?.find(r=>r!==n&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){_n.batch(()=>{this.#e.forEach(n=>{this.notify({type:"removed",mutation:n})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(n){const i={exact:!0,...n};return this.getAll().find(l=>i0(i,l))}findAll(n={}){return this.getAll().filter(i=>i0(n,i))}notify(n){_n.batch(()=>{this.listeners.forEach(i=>{i(n)})})}resumePausedMutations(){const n=this.getAll().filter(i=>i.state.isPaused);return _n.batch(()=>Promise.all(n.map(i=>i.continue().catch(Pn))))}};function vc(n){return n.options.scope?.id}var BN=class extends Bo{constructor(n={}){super(),this.config=n,this.#e=new Map}#e;build(n,i,l){const r=i.queryKey,u=i.queryHash??vm(r,i);let d=this.get(u);return d||(d=new DN({client:n,queryKey:r,queryHash:u,options:n.defaultQueryOptions(i),state:l,defaultOptions:n.getQueryDefaults(r)}),this.add(d)),d}add(n){this.#e.has(n.queryHash)||(this.#e.set(n.queryHash,n),this.notify({type:"added",query:n}))}r)DELIM" +R"DELIM(emove(n){const i=this.#e.get(n.queryHash);i&&(n.destroy(),i===n&&this.#e.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){_n.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(l=>n0(i,l))}findAll(n={}){const i=this.getAll();return Object.keys(n).length>0?i.filter(l=>n0(n,l)):i}notify(n){_n.batch(()=>{this.listeners.forEach(i=>{i(n)})})}onFocus(){_n.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){_n.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},VN=class{#e;#t;#n;#i;#s;#a;#r;#l;constructor(n={}){this.#e=n.queryCache||new BN,this.#t=n.mutationCache||new qN,this.#n=n.defaultOptions||{},this.#i=new Map,this.#s=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#r=gm.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#l=Dc.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#r?.(),this.#r=void 0,this.#l?.(),this.#l=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),l=this.#e.build(this,i),r=l.state.data;return r===void 0?this.fetchQuery(n):(n.revalidateIfStale&&l.isStaleByTime(Tl(i.staleTime,l))&&this.prefetchQuery(i),Promise.resolve(r))}getQueriesData(n){return this.#e.findAll(n).map(({queryKey:i,state:l})=>{const r=l.data;return[i,r]})}setQueryData(n,i,l){const r=this.defaultQueryOptions({queryKey:n}),d=this.#e.get(r.queryHash)?.state.data,f=wN(i,d);if(f!==void 0)return this.#e.build(this,r).setData(f,{...l,manual:!0})}setQueriesData(n,i,l){return _n.batch(()=>this.#e.findAll(n).map(({queryKey:r})=>[r,this.setQueryData(r,i,l)]))}getQueryState(n){const i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state}removeQueries(n){const i=this.#e;_n.batch(()=>{i.findAll(n).forEach(l=>{i.remove(l)})})}resetQueries(n,i){const l=this.#e;return _n.batch(()=>(l.findAll(n).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...n},i)))}cancelQueries(n,i={}){const l={revert:!0,...i},r=_n.batch(()=>this.#e.findAll(n).map(u=>u.cancel(l)));return Promise.all(r).then(Pn).catch(Pn)}invalidateQueries(n,i={}){return _n.batch(()=>(this.#e.findAll(n).forEach(l=>{l.invalidate()}),n?.refetchType==="none"?Promise.resolve():this.refetchQueries({...n,type:n?.refetchType??n?.type??"active"},i)))}refetchQueries(n,i={}){const l={...i,cancelRefetch:i.cancelRefetch??!0},r=_n.batch(()=>this.#e.findAll(n).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let d=u.fetch(void 0,l);return l.throwOnError||(d=d.catch(Pn)),u.state.fetchStatus==="paused"?Promise.resolve():d}));return Promise.all(r).then(Pn)}fetchQuery(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const l=this.#e.build(this,i);return l.isStaleByTime(Tl(i.staleTime,l))?l.fetch(i):Promise.resolve(l.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(Pn).catch(Pn)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(Pn).catch(Pn)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return Dc.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(Zo(n),{queryKey:n,defaultOptions:i})}getQueryDefaults(n){const i=[...this.#i.values()],l={};return i.forEach(r=>{vr(n,r.queryKey)&&Object.assign(l,r.defaultOptions)}),l}setMutationDefaults(n,i){this.#s.set(Zo(n),{mutationKey:n,defaultOptions:i})}getMutationDefaults(n){const i=[...this.#s.values()],l={};return i.forEach(r=>{vr(n,r.mutationKey)&&Object.assign(l,r.defaultOptions)}),l}defaultQueryOptions(n){if(n._defaulted)return n;const i={...this.#n.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return i.queryHash||(i.queryHash=vm(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===ym&&(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()}},l1=re.createContext(void 0),GN=n=>{const i=re.useContext(l1);if(!i)throw new Error("No QueryClient set, use QueryClientProvider to set one");return i},YN=({client:n,children:i})=>(re.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),_.jsx(l1.Provider,{value:n,children:i})),s1=re.createContext(!1),QN=()=>re.useContext(s1);s1.Provider;function KN(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var FN=re.createContext(KN()),JN=()=>re.useContext(FN),XN=(n,i,l)=>{const r=l?.state.error&&typeof n.throwOnError=="function"?e1(n.throwOnError,[l.state.error,l]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||r)&&(i.isReset()||(n.retryOnMount=!1))},IN=n=>{re.useEffect(()=>{n.clearReset()},[n])},PN=({result:n,errorResetBoundary:i,throwOnError:l,query:r,suspense:u})=>n.isError&&!i.isReset()&&!n.isFetching&&r&&(u&&n.data===void 0||e1(l,[n.error,r])),WN=n=>{if(n.suspense){const l=u=>u==="static"?u:Math.max(u??1e3,1e3),r=n.staleTime;n.staleTime=typeof r=="function"?(...u)=>l(r(...u)):l(r),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},eM=(n,i)=>n.isLoading&&n.isFetching&&!i,tM=(n,i)=>n?.suspense&&i.isPending,f0=(n,i,l)=>i.fetchOptimistic(n).catch(()=>{l.clearReset()});function nM(n,i,l){const r=QN(),u=JN(),d=GN(),f=d.defaultQueryOptions(n);d.getDefaultOptions().queries?._experimental_beforeQuery?.(f);const p=d.getQueryCache().get(f.queryHash),m=n.subscribed!==!1;f._optimisticResults=r?"isRestoring":m?"optimistic":void 0,WN(f),XN(f,u,p),IN(u);const v=!d.getQueryCache().get(f.queryHash),[w]=re.useState(()=>new i(d,f)),S=w.getOptimisticResult(f),z=!r&&m;if(re.useSyncExternalStore(re.useCallback(T=>{const j=z?w.subscribe(_n.batchCalls(T)):Pn;return w.updateResult(),j},[w,z]),()=>w.getCurrentResult(),()=>w.getCurrentResult()),re.useEffect(()=>{w.setOptions(f)},[f,w]),tM(f,S))throw f0(f,w,u);if(PN({result:S,errorResetBoundary:u,throwOnError:f.throwOnError,query:p,suspense:f.suspense}))throw S.error;return d.getDefaultOptions().queries?._experimental_afterQuery?.(f,S),f.experimental_prefetchInRender&&!$o.isServer()&&eM(S,r)&&(v?f0(f,w,u):p?.promise)?.catch(Pn).finally(()=>{w.updateResult()}),f.notifyOnChangeProps?S:w.trackResult(S)}function iM(n,i){return nM(n,UN)}const r1=Ol({address:nr(),filter:nr(),turbo:nr(),witness:nr(),retarget:nr(),difficult:nr(),pruned:Ha().int().nonnegative()}),o1=Ol({height:Ha().int().nonnegative(),timestamp:Ha().int().positive().max(4294967295)}),u1=Ha().int().nonnegative();function aM(n){try{const i=JSON.parse(n),l=r1.safeParse(i);if(l.success)return{type:"configuration",payload:l.data};const r=o1.safeParse(i);if(r.success)return{type:"header",payload:r.data};const u=u1.safeParse(i);return u.success?{type:"top",payload:u.data}:null}catch{return null}}function rh(n,i){return new URL(i,`${n.replace(/\/+$/u,"")}/`).toString()}async function oh(n,i){const l=await fetch(n,{headers:{Accept:"application/json"},signal:i});if(!l.ok)throw new Error(`Native API request failed with status ${String(l.status)}`);return await l.json()}async function lM(n,i){const[l,r]=await Promise.all([oh(rh(n,"/v1/configuration?format=json"),i),oh(rh(n,"/v1/top?format=json"),i)]),u=r1.parse(l),d=u1.parse(r),f=Date.now();let p=null;try{const m=o1.parse(await oh(rh(n,c1(d)),i));m.height===d&&(p=m)}catch{i?.throwIf)DELIM" +R"DELIM(Aborted()}return{configuration:u,top:d,topHeader:p,receivedAt:f}}function c1(n){return`/v1/block/height/${String(n)}/header?format=json`}const d0={phase:"idle",attempt:0,reconnects:0,connectedAt:null,lastMessageAt:null,error:null};class sM{#e;#t=d0;#n=null;#i=new Set;#s=null;#a=null;#r=null;#l;#u=!1;constructor(i){this.#e={...i,connectTimeoutMs:i.connectTimeoutMs??5e3,retryMinimumMs:i.retryMinimumMs??1e3,retryMaximumMs:i.retryMaximumMs??3e4,heartbeatMs:i.heartbeatMs??24e4,jitterRatio:i.jitterRatio??.2,now:i.now??Date.now,random:i.random??Math.random,webSocketFactory:i.webSocketFactory??(l=>new WebSocket(l))},this.#l=this.#e.retryMinimumMs}getStatus=()=>this.#t;subscribeStatus=i=>(this.#i.add(i),()=>{this.#i.delete(i)});start(){this.#u||(this.#u=!0,this.#l=this.#e.retryMinimumMs,this.#o())}stop(){this.#u=!1,this.#p();const i=this.#n;if(this.#n=null,i)try{i.readyState===1&&this.#e.onBeforeStop?.(i),i.close()}catch{}this.#f(d0)}send(i){if(this.#n?.readyState!==1)return!1;try{return this.#n.send(i),!0}catch{return!1}}#o(){if(!this.#u||this.#n)return;const i=this.#t.reconnects>0;this.#f({...this.#t,phase:i?"reconnecting":"connecting",attempt:this.#t.attempt+1,error:null});let l;try{l=this.#e.webSocketFactory(this.#e.url),this.#n=l}catch(r){this.#f({...this.#t,error:oM(r)}),this.#m();return}this.#s=setTimeout(()=>{if(this.#n===l){this.#f({...this.#t,error:"Connection timed out"});try{l.close()}catch{this.#n=null,this.#m()}}},this.#e.connectTimeoutMs),l.addEventListener("open",()=>{this.#n!==l||!this.#u||(this.#d(),this.#l=this.#e.retryMinimumMs,this.#f({...this.#t,phase:"connected",connectedAt:this.#e.now(),error:null}),this.#e.onOpen?.(l),this.#c(l))}),l.addEventListener("message",r=>{if(this.#n!==l||!this.#u)return;const u=rM(r.data);if(u===null)return;const d=this.#e.now();(this.#t.lastMessageAt===null||d-this.#t.lastMessageAt>=1e3)&&this.#f({...this.#t,lastMessageAt:d}),this.#e.onMessage(u)}),l.addEventListener("error",()=>{if(!(this.#n!==l||!this.#u)){this.#f({...this.#t,error:"WebSocket connection failed"});try{l.close()}catch{this.#n=null,this.#m()}}}),l.addEventListener("close",()=>{this.#n===l&&(this.#n=null,this.#d(),this.#h(),this.#u&&this.#m())})}#m(){if(!this.#u||this.#a)return;const i=1+(this.#e.random()*2-1)*this.#e.jitterRatio,l=Math.max(0,Math.round(this.#l*i));this.#l=Math.min(this.#l*2,this.#e.retryMaximumMs),this.#f({...this.#t,phase:"reconnecting",reconnects:this.#t.reconnects+1,connectedAt:null}),this.#a=setTimeout(()=>{this.#a=null,this.#o()},l)}#c(i){this.#h(),!(!this.#e.onHeartbeat||this.#e.heartbeatMs<=0)&&(this.#r=setInterval(()=>{this.#n===i&&i.readyState===1&&this.#e.onHeartbeat?.(i)},this.#e.heartbeatMs))}#d(){this.#s&&(clearTimeout(this.#s),this.#s=null)}#h(){this.#r&&(clearInterval(this.#r),this.#r=null)}#p(){this.#d(),this.#h(),this.#a&&(clearTimeout(this.#a),this.#a=null)}#f(i){this.#t=i;for(const l of this.#i)l()}}function rM(n){return typeof n=="string"?n:n instanceof ArrayBuffer?new TextDecoder().decode(n):null}function oM(n){return n instanceof Error?n.message:"Unable to create WebSocket"}const _m=15e3,Rh=3*_m,h0={configuration:null,configurationReceivedAt:null,top:null,topReceivedAt:null,topHeader:null,headerReceivedAt:null,invalidFrames:0};class uM{#e=h0;#t=new Set;#n;#i;#s=null;#a=null;#r=null;#l;constructor(i,l={}){this.#i=l.now??Date.now,this.#l=l.pollIntervalMs??_m,this.#n=new sM({url:F_(i),webSocketFactory:l.webSocketFactory,retryMinimumMs:l.retryMinimumMs,retryMaximumMs:l.retryMaximumMs,jitterRatio:l.jitterRatio,heartbeatMs:this.#l,now:this.#i,onOpen:r=>{this.#s=this.#i(),r.send("/v1/configuration?format=json"),r.send("/v1/top/subscribe?format=json")},onHeartbeat:r=>{const u=this.#e.topReceivedAt??this.#s;if(u!==null&&this.#i()-u>=Rh){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 u=aM(r);if(!u){this.#c({...this.#e,invalidFrames:this.#e.invalidFrames+1});return}this.#u(u)}}),this.#n.subscribeStatus(()=>{this.#n.getStatus().phase!=="connected"&&(this.#s=null,this.#a=null,this.#r=null,this.#m())})}getStatus=()=>this.#n.getStatus();subscribeStatus=i=>this.#n.subscribeStatus(i);getState=()=>this.#e;subscribeState=i=>(this.#t.add(i),()=>{this.#t.delete(i)});start(){this.#n.start()}stop(){this.#n.stop()}#u(i){const l=this.#i();if(i.type==="top"){const r=this.#e.top!==null&&i.payload{i.configure(n,l)},[n,i,l]),re.useEffect(()=>(i.start(),()=>{i.stop()}),[i]),r}function fM(n,i,l){const r=re.useMemo(()=>new uM(n),[n]),u=re.useMemo(()=>J_(n),[n]),d=re.useSyncExternalStore(r.subscribeStatus,r.getStatus,r.getStatus),f=re.useSyncExternalStore(r.subscribeState,r.getState,r.getState),p=f1(d,f,l);re.useEffect(()=>(r.start(),()=>{r.stop()}),[r]);const m=iM({queryKey:["native-snapshot",n],queryFn:({signal:w})=>lM(n,w),enabled:u&&!p,refetchInterval:_m,retry:!1}),v=dM(d,f,m.data??null,l);return re.useEffect(()=>{v.top!==null&&i.recordNativeTop(v.top,v.receivedAt??Date.now())},[i,v.receivedAt,v.top]),{status:d,live:f,...v,restError:m.error instanceof Error?m.error.message:null}}function f1(n,i,l){return n.phase==="connected"&&i.top!==null&&i.topReceivedAt!==null&&i.configuration!==null&&i.configurationReceivedAt!==null&&Ch(i.topReceivedAt,l)}function dM(n,i,l,r){return f1(n,i,r)?{top:i.top,topHeader:i.headerReceivedAt!==null&&Ch(i.headerReceivedAt,r)?i.topHeader:null,configuration:i.configuration,receivedAt:i.topReceivedAt,transport:"websocket"}:l&&Ch(l.receivedAt,r)?{top:l.top,topHeader:l.topHeader,configuration:l.configuration,receivedAt:l.receivedAt,transport:"rest"}:{top:null,topHeader:null,configuration:null,receivedAt:null,transport:"none"}}function Ch(n,i){return i-n<=Rh}const hM=[{id:"overview",label:"Overview"},{id:"logs",label:"Logs"},{id:"events",label:"Events"}];function mM(){const n=re.useMemo(()=>new pN,[]),[i,l]=re.useState(X_),[r,u]=re.useState("overview"),[d,f]=re.useState(!1),[p,m]=re.useState(gN),[v,w]=re.useState(!1),[S,z]=re.useState(!1),[T,j]=re.useState(G_),L=re.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot),V=cM(i.adminUrl,n,p),H=fM(i.nativeUrl,n,L.now),G=xE(H.top,H.topHeader,L.now);function W(K){I_(K),(K.adminUrl!==i.adminUrl||K.nativeUrl!==i.nativeUrl)&&n.reset(),l(K),f(!1)}function B(){P_();const K=b0();(K.adminUrl!==i.adminUrl||K.nativeUrl!==i.nativeUrl)&&n.reset(),l(K),f(!1)}function ne(K){Y_(K),j(K)}function ee(K){vN(K),m(K)}return _.jsxs("div",{className:"bg-background text-textPrimary min-h-screen",children:[_.jsx("header",{className:"border-accent/25 bg-surface/95 sticky top-0 z-40 border-b backdrop-blur",children:_.jsx("div",{className:"mx-auto max-w-[96rem] px-4 sm:px-6",children:_.jsxs("div",{className:"flex min-h-16 flex-wrap items-center gap-x-6 gap-y-2 py-3",children:[_.jsxs("button",{type:"button",onClick:()=>{u("overview")},className:"mr-auto text-left",children:[_.jsx("p",{className:"text-accentSecondary text-[10px] font-medium tracking-[0.2em] uppercase",children:)DELIM" +R"DELIM("Libbitcoin Server"}),_.jsx("h1",{className:"text-accent text-lg font-semibold tracking-tight",children:"Admin Dashboard"})]}),_.jsx("nav",{className:"order-3 flex w-full items-center gap-1 sm:order-none sm:w-auto",children:hM.map(K=>_.jsxs("button",{type:"button",onClick:()=>{u(K.id)},className:`rounded-lg px-3 py-2 text-sm transition ${r===K.id?"bg-accent/15 text-accent":"text-textMuted hover:text-textPrimary hover:bg-white/5"}`,children:[K.label,K.id==="logs"&&L.totalLogs>0&&_.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:L.totalLogs>999?"999+":String(L.totalLogs)}),K.id==="events"&&L.totalEvents>0&&_.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:L.totalEvents>999?"999+":String(L.totalEvents)})]},K.id))}),_.jsxs("div",{className:"flex items-center gap-3",children:[_.jsxs("div",{className:"hidden items-center gap-2 lg:flex","aria-label":"Connection summary",children:[_.jsx(m0,{connected:V.phase==="connected",label:"Admin"}),_.jsx(m0,{connected:H.transport!=="none",label:"Native"})]}),_.jsx("button",{type:"button",onClick:()=>{f(!0)},className:"border-accent/30 text-textMuted hover:border-accent hover:text-accent rounded-lg border px-3 py-2 text-xs font-medium tracking-wide uppercase",children:"Endpoints"})]})]})})}),_.jsxs("main",{className:"mx-auto max-w-[96rem] min-w-0 px-4 py-8 sm:px-6",children:[r==="overview"&&_.jsx(sN,{adminStatus:V,endpoints:i,metrics:L,native:H,syncEstimate:G}),r==="logs"&&_.jsx(eE,{metrics:n,delivery:L,status:V,logFilter:p,paused:v,onLogFilterChange:ee,onPausedChange:K=>{n.setLogsPaused(K),w(K)},onClear:()=>{n.clearLogs()}}),r==="events"&&_.jsx(P2,{metrics:n,paused:S,onPausedChange:K=>{n.setEventsPaused(K),z(K)},onClear:()=>{n.clearEvents()}})]}),_.jsx(cN,{estimate:G,browserNotificationsEnabled:T},i.nativeUrl),d&&_.jsx(W_,{configuration:i,browserNotificationsEnabled:T,onClose:()=>{f(!1)},onReset:B,onSave:W,onBrowserNotificationsEnabledChange:ne},`${i.adminUrl}|${i.nativeUrl}`)]})}function m0({connected:n,label:i}){return _.jsxs("span",{className:"text-textMuted inline-flex items-center gap-1.5 text-xs",children:[_.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-400":"bg-amber-400"}`,"aria-hidden":"true"}),i]})}function pM({children:n}){const[i]=re.useState(()=>new VN({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:1}}}));return _.jsxs(YN,{client:i,children:[n,null]})}const d1=document.querySelector("#root");if(!d1)throw new Error("Root element not found");B_.createRoot(d1).render(_.jsx(C_.StrictMode,{children:_.jsx(pM,{children:_.jsx(mM,{})})})); )DELIM" )