otx-swap 1.2.21 → 1.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +17 -17
- package/dist/index.mjs +1274 -1342
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.optx-widget .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.optx-widget .fixed{position:fixed}.optx-widget .absolute{position:absolute}.optx-widget .relative{position:relative}.optx-widget .inset-0{inset:0}.optx-widget .inset-2{inset:.5rem}.optx-widget .inset-x-0{left:0;right:0}.optx-widget .-bottom-1{bottom:-.25rem}.optx-widget .-bottom-2{bottom:-.5rem}.optx-widget .-right-1{right:-.25rem}.optx-widget .-top-2{top:-.5rem}.optx-widget .bottom-0{bottom:0}.optx-widget .bottom-full{bottom:100%}.optx-widget .left-0{left:0}.optx-widget .left-1\\/2{left:50%}.optx-widget .left-3{left:.75rem}.optx-widget .left-4{left:1rem}.optx-widget .right-0{right:0}.optx-widget .right-3{right:.75rem}.optx-widget .right-4{right:1rem}.optx-widget .top-1\\/2{top:50%}.optx-widget .top-4{top:1rem}.optx-widget .top-full{top:100%}.optx-widget .z-10{z-index:10}.optx-widget .z-50{z-index:50}.optx-widget .z-\\[9999\\]{z-index:9999}.optx-widget .\\!m-0{margin:0!important}.optx-widget .-my-4{margin-top:-1rem;margin-bottom:-1rem}.optx-widget .mx-auto{margin-left:auto;margin-right:auto}.optx-widget .mb-1{margin-bottom:.25rem}.optx-widget .mb-2{margin-bottom:.5rem}.optx-widget .mb-3{margin-bottom:.75rem}.optx-widget .mb-4{margin-bottom:1rem}.optx-widget .mb-6{margin-bottom:1.5rem}.optx-widget .ml-2{margin-left:.5rem}.optx-widget .ml-3{margin-left:.75rem}.optx-widget .ml-auto{margin-left:auto}.optx-widget .mt-1{margin-top:.25rem}.optx-widget .mt-2{margin-top:.5rem}.optx-widget .mt-24{margin-top:6rem}.optx-widget .mt-3{margin-top:.75rem}.optx-widget .mt-4{margin-top:1rem}.optx-widget .mt-auto{margin-top:auto}.optx-widget .block{display:block}.optx-widget .inline-block{display:inline-block}.optx-widget .flex{display:flex}.optx-widget .size-10{width:2.5rem;height:2.5rem}.optx-widget .size-12{width:3rem;height:3rem}.optx-widget .size-2{width:.5rem;height:.5rem}.optx-widget .size-20{width:5rem;height:5rem}.optx-widget .size-3{width:.75rem;height:.75rem}.optx-widget .size-4{width:1rem;height:1rem}.optx-widget .size-5{width:1.25rem;height:1.25rem}.optx-widget .size-8{width:2rem;height:2rem}.optx-widget .h-1\\.5{height:.375rem}.optx-widget .h-10{height:2.5rem}.optx-widget .h-12{height:3rem}.optx-widget .h-14{height:3.5rem}.optx-widget .h-16{height:4rem}.optx-widget .h-2{height:.5rem}.optx-widget .h-3{height:.75rem}.optx-widget .h-3\\.5{height:.875rem}.optx-widget .h-4{height:1rem}.optx-widget .h-5{height:1.25rem}.optx-widget .h-6{height:1.5rem}.optx-widget .h-8{height:2rem}.optx-widget .h-auto{height:auto}.optx-widget .h-full{height:100%}.optx-widget .max-h-\\[2\\.5rem\\]{max-height:2.5rem}.optx-widget .max-h-\\[2rem\\]{max-height:2rem}.optx-widget .max-h-\\[3rem\\]{max-height:3rem}.optx-widget .max-h-\\[5rem\\]{max-height:5rem}.optx-widget .max-h-\\[600px\\]{max-height:600px}.optx-widget .max-h-\\[60vh\\]{max-height:60vh}.optx-widget .max-h-\\[85vh\\]{max-height:85vh}.optx-widget .max-h-\\[96vh\\]{max-height:96vh}.optx-widget .w-1\\/3{width:33.333333%}.optx-widget .w-10{width:2.5rem}.optx-widget .w-12{width:3rem}.optx-widget .w-14{width:3.5rem}.optx-widget .w-16{width:4rem}.optx-widget .w-20{width:5rem}.optx-widget .w-24{width:6rem}.optx-widget .w-28{width:7rem}.optx-widget .w-3{width:.75rem}.optx-widget .w-3\\.5{width:.875rem}.optx-widget .w-32{width:8rem}.optx-widget .w-4{width:1rem}.optx-widget .w-48{width:12rem}.optx-widget .w-5{width:1.25rem}.optx-widget .w-6{width:1.5rem}.optx-widget .w-72{width:18rem}.optx-widget .w-8{width:2rem}.optx-widget .w-96{width:24rem}.optx-widget .w-auto{width:auto}.optx-widget .w-full{width:100%}.optx-widget .min-w-0{min-width:0px}.optx-widget .min-w-\\[140px\\]{min-width:140px}.optx-widget .max-w-2xl{max-width:42rem}.optx-widget .max-w-\\[280px\\]{max-width:280px}.optx-widget .max-w-\\[calc\\(100\\%-2rem\\)\\]{max-width:calc(100% - 2rem)}.optx-widget .max-w-md{max-width:28rem}.optx-widget .flex-1{flex:1 1 0%}.optx-widget .flex-shrink-0,.optx-widget .shrink-0{flex-shrink:0}.optx-widget .-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.optx-widget .animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.optx-widget .animate-spin{animation:spin 1s linear infinite}.optx-widget .cursor-not-allowed{cursor:not-allowed}.optx-widget .cursor-pointer{cursor:pointer}.optx-widget .resize{resize:both}.optx-widget .flex-col{flex-direction:column}.optx-widget .flex-wrap{flex-wrap:wrap}.optx-widget .items-end{align-items:flex-end}.optx-widget .items-center{align-items:center}.optx-widget .justify-end{justify-content:flex-end}.optx-widget .justify-center{justify-content:center}.optx-widget .justify-between{justify-content:space-between}.optx-widget .gap-0\\.5{gap:.125rem}.optx-widget .gap-1{gap:.25rem}.optx-widget .gap-1\\.5{gap:.375rem}.optx-widget .gap-2{gap:.5rem}.optx-widget .gap-3{gap:.75rem}.optx-widget .gap-4{gap:1rem}.optx-widget :is(.space-y-1>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.optx-widget :is(.space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.optx-widget :is(.space-y-3>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.optx-widget :is(.divide-y>:not([hidden])~:not([hidden])){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.optx-widget :is(.divide-\\[var\\(--optimex-border\\)\\]>:not([hidden])~:not([hidden])){border-color:var(--optimex-border)}.optx-widget .overflow-auto{overflow:auto}.optx-widget .overflow-hidden{overflow:hidden}.optx-widget .overflow-y-auto{overflow-y:auto}.optx-widget .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.optx-widget .break-all{word-break:break-all}.optx-widget .rounded{border-radius:.25rem}.optx-widget .rounded-2xl{border-radius:1rem}.optx-widget .rounded-\\[0\\.25rem\\]{border-radius:.25rem}.optx-widget .rounded-\\[9999px\\]{border-radius:9999px}.optx-widget .rounded-\\[var\\(--optimex-overlay-radius\\)\\]{border-radius:var(--optimex-overlay-radius)}.optx-widget .rounded-\\[var\\(--optimex-radius-button\\)\\]{border-radius:var(--optimex-radius-button)}.optx-widget .rounded-\\[var\\(--optimex-radius-input\\)\\]{border-radius:var(--optimex-radius-input)}.optx-widget .rounded-\\[var\\(--optimex-radius-widget\\)\\]{border-radius:var(--optimex-radius-widget)}.optx-widget .rounded-full{border-radius:9999px}.optx-widget .rounded-lg{border-radius:.5rem}.optx-widget .rounded-md{border-radius:.375rem}.optx-widget .rounded-xl{border-radius:.75rem}.optx-widget .rounded-t-\\[var\\(--optimex-overlay-radius\\)\\]{border-top-left-radius:var(--optimex-overlay-radius);border-top-right-radius:var(--optimex-overlay-radius)}.optx-widget .rounded-t-sm{border-top-left-radius:.125rem;border-top-right-radius:.125rem}.optx-widget .border{border-width:1px}.optx-widget .border-2{border-width:2px}.optx-widget .border-4{border-width:4px}.optx-widget .border-b{border-bottom-width:1px}.optx-widget .border-l{border-left-width:1px}.optx-widget .border-r{border-right-width:1px}.optx-widget .border-t{border-top-width:1px}.optx-widget .border-none{border-style:none}.optx-widget .border-\\[var\\(--optimex-background\\)\\]{border-color:var(--optimex-background)}.optx-widget .border-\\[var\\(--optimex-border\\)\\]{border-color:var(--optimex-border)}.optx-widget .border-\\[var\\(--optimex-error\\)\\]{border-color:var(--optimex-error)}.optx-widget .border-\\[var\\(--optimex-primary\\)\\]{border-color:var(--optimex-primary)}.optx-widget .border-\\[var\\(--optimex-surface\\)\\]{border-color:var(--optimex-surface)}.optx-widget .border-current{border-color:currentColor}.optx-widget .border-transparent{border-color:transparent}.optx-widget .border-white\\/10{border-color:#ffffff1a}.optx-widget .border-white\\/5{border-color:#ffffff0d}.optx-widget .border-white\\/\\[0\\.02\\]{border-color:#ffffff05}.optx-widget .border-white\\/\\[0\\.05\\]{border-color:#ffffff0d}.optx-widget .border-t-transparent{border-top-color:transparent}.optx-widget .bg-\\[rgba\\(239\\,68\\,68\\,0\\.15\\)\\]{background-color:#ef444426}.optx-widget .bg-\\[rgba\\(34\\,197\\,94\\,0\\.15\\)\\]{background-color:#22c55e26}.optx-widget .bg-\\[rgba\\(59\\,130\\,246\\,0\\.15\\)\\]{background-color:#3b82f626}.optx-widget .bg-\\[var\\(--optimex-background\\)\\]{background-color:var(--optimex-background)}.optx-widget .bg-\\[var\\(--optimex-border\\)\\]{background-color:var(--optimex-border)}.optx-widget .bg-\\[var\\(--optimex-error\\)\\]{background-color:var(--optimex-error)}.optx-widget .bg-\\[var\\(--optimex-overlay-background\\)\\]{background-color:var(--optimex-overlay-background)}.optx-widget .bg-\\[var\\(--optimex-primary\\)\\]{background-color:var(--optimex-primary)}.optx-widget .bg-\\[var\\(--optimex-surface\\)\\]{background-color:var(--optimex-surface)}.optx-widget .bg-\\[var\\(--optimex-surface-hover\\)\\]{background-color:var(--optimex-surface-hover)}.optx-widget .bg-black\\/60{background-color:#0009}.optx-widget .bg-blue-500\\/20{background-color:#3b82f633}.optx-widget .bg-green-500\\/10{background-color:#22c55e1a}.optx-widget .bg-orange-500\\/20{background-color:#f9731633}.optx-widget .bg-purple-500\\/20{background-color:#a855f733}.optx-widget .bg-red-500\\/10{background-color:#ef44441a}.optx-widget .bg-transparent{background-color:transparent}.optx-widget .bg-white\\/10{background-color:#ffffff1a}.optx-widget .bg-white\\/20{background-color:#fff3}.optx-widget .bg-white\\/5{background-color:#ffffff0d}.optx-widget .bg-white\\/\\[0\\.02\\]{background-color:#ffffff05}.optx-widget .bg-yellow-500\\/10{background-color:#eab3081a}.optx-widget .bg-zinc-900\\/50{background-color:#18181b80}.optx-widget .stroke-\\[var\\(--optimex-error\\)\\]{stroke:var(--optimex-error)}.optx-widget .p-0{padding:0}.optx-widget .p-1{padding:.25rem}.optx-widget .p-1\\.5{padding:.375rem}.optx-widget .p-2{padding:.5rem}.optx-widget .p-3{padding:.75rem}.optx-widget .p-4{padding:1rem}.optx-widget .p-6{padding:1.5rem}.optx-widget .px-1\\.5{padding-left:.375rem;padding-right:.375rem}.optx-widget .px-2{padding-left:.5rem;padding-right:.5rem}.optx-widget .px-2\\.5{padding-left:.625rem;padding-right:.625rem}.optx-widget .px-3{padding-left:.75rem;padding-right:.75rem}.optx-widget .px-4{padding-left:1rem;padding-right:1rem}.optx-widget .px-6{padding-left:1.5rem;padding-right:1.5rem}.optx-widget .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.optx-widget .py-1{padding-top:.25rem;padding-bottom:.25rem}.optx-widget .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.optx-widget .py-12{padding-top:3rem;padding-bottom:3rem}.optx-widget .py-2{padding-top:.5rem;padding-bottom:.5rem}.optx-widget .py-3{padding-top:.75rem;padding-bottom:.75rem}.optx-widget .py-4{padding-top:1rem;padding-bottom:1rem}.optx-widget .py-8{padding-top:2rem;padding-bottom:2rem}.optx-widget .py-\\[6px\\]{padding-top:6px;padding-bottom:6px}.optx-widget .pb-3{padding-bottom:.75rem}.optx-widget .pb-4{padding-bottom:1rem}.optx-widget .pl-10{padding-left:2.5rem}.optx-widget .pl-2{padding-left:.5rem}.optx-widget .pr-10{padding-right:2.5rem}.optx-widget .pr-3{padding-right:.75rem}.optx-widget .pt-2{padding-top:.5rem}.optx-widget .pt-3{padding-top:.75rem}.optx-widget .text-left{text-align:left}.optx-widget .text-center{text-align:center}.optx-widget .text-2xl{font-size:1.5rem;line-height:2rem}.optx-widget .text-\\[10px\\]{font-size:10px}.optx-widget .text-base{font-size:1rem;line-height:1.5rem}.optx-widget .text-lg{font-size:1.125rem;line-height:1.75rem}.optx-widget .text-sm{font-size:.875rem;line-height:1.25rem}.optx-widget .text-xl{font-size:1.25rem;line-height:1.75rem}.optx-widget .text-xs{font-size:.75rem;line-height:1rem}.optx-widget .font-bold{font-weight:700}.optx-widget .font-medium{font-weight:500}.optx-widget .font-semibold{font-weight:600}.optx-widget .uppercase{text-transform:uppercase}.optx-widget .leading-none{line-height:1}.optx-widget .tracking-tight{letter-spacing:-.025em}.optx-widget .tracking-wider{letter-spacing:.05em}.optx-widget .text-\\[var\\(--optimex-error\\)\\]{color:var(--optimex-error)}.optx-widget .text-\\[var\\(--optimex-primary\\)\\]{color:var(--optimex-primary)}.optx-widget .text-\\[var\\(--optimex-success\\)\\]{color:var(--optimex-success)}.optx-widget .text-\\[var\\(--optimex-text\\)\\]{color:var(--optimex-text)}.optx-widget .text-\\[var\\(--optimex-text-secondary\\)\\]{color:var(--optimex-text-secondary)}.optx-widget .text-\\[var\\(--optimex-warning\\)\\]{color:var(--optimex-warning)}.optx-widget .text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.optx-widget .text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.optx-widget .text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.optx-widget .text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.optx-widget .text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.optx-widget .text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.optx-widget .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.optx-widget .text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.optx-widget .text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.optx-widget .text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.optx-widget .opacity-0{opacity:0}.optx-widget .opacity-50{opacity:.5}.optx-widget .opacity-70{opacity:.7}.optx-widget .shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_15px_rgba\\(235\\,98\\,0\\,0\\.1\\)\\]{--tw-shadow: 0 0 15px rgba(235,98,0,.1);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_15px_rgba\\(235\\,98\\,0\\,0\\.3\\)\\]{--tw-shadow: 0 0 15px rgba(235,98,0,.3);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_8px_rgba\\(235\\,98\\,0\\,0\\.8\\)\\]{--tw-shadow: 0 0 8px rgba(235,98,0,.8);--tw-shadow-colored: 0 0 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .outline-none{outline:2px solid transparent;outline-offset:2px}.optx-widget .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)}.optx-widget .backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-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)}.optx-widget .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .duration-200{transition-duration:.2s}.optx-widget .duration-300{transition-duration:.3s}.optx-widget{isolation:isolate;width:100%;min-width:0;max-width:100%;--optimex-primary: #ed6300;--optimex-background: hsla(0, 0%, 100%, .04);--optimex-surface: hsla(0, 0%, 0%, .2);--optimex-text: #ffffff;--optimex-text-secondary: hsla(0, 0%, 100%, .48);--optimex-error: #ff4d4f;--optimex-success: #52c41a;--optimex-overlay-background: #1a1a1a;--optimex-overlay-radius: .75rem;--optimex-radius-widget: 1rem;--optimex-radius-input: .75rem;--optimex-radius-button: .5rem;--optimex-font-family: "Inter", sans-serif;--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;font-family:var(--optimex-font-family);font-size:14px;line-height:1.5;color:var(--optimex-text);text-align:left;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.optx-widget .widget-container{background:var(--optimex-background);border:1px solid rgba(255,255,255,.05);border-radius:var(--optimex-radius-widget);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);width:100%;min-width:0;max-width:100%;box-sizing:border-box}.optx-widget *,.optx-widget *:before,.optx-widget *:after{box-sizing:border-box}.optx-widget button{font-family:inherit;line-height:inherit;margin:0;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.optx-widget input,.optx-widget select,.optx-widget textarea{font-family:inherit;line-height:inherit;margin:0}.optx-widget a{color:inherit;text-decoration:none}.optx-widget ul,.optx-widget ol{list-style:none;margin:0;padding:0}.optx-widget img{max-width:100%;height:auto}.optx-widget svg{display:inline-block;vertical-align:middle}.optx-widget .glow-orange{box-shadow:inset 0 0 15px #eb620026,0 0 20px #eb62001a}.optx-widget .glow-green{box-shadow:0 0 12px #22c55e33}.optx-widget .glow-red{box-shadow:0 0 12px #ef444433}@keyframes optx-status-pulse{0%,to{opacity:1}50%{opacity:.5}}.optx-widget .status-pulse{animation:optx-status-pulse 2s cubic-bezier(.4,0,.6,1) infinite}.optx-widget .placeholder\\:text-\\[var\\(--optimex-text-secondary\\)\\]::-moz-placeholder{color:var(--optimex-text-secondary)}.optx-widget .placeholder\\:text-\\[var\\(--optimex-text-secondary\\)\\]::placeholder{color:var(--optimex-text-secondary)}.optx-widget .focus-within\\:border-\\[var\\(--optimex-primary\\)\\]:focus-within{border-color:var(--optimex-primary)}.optx-widget .hover\\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .hover\\:border-\\[var\\(--optimex-primary\\)\\]:hover{border-color:var(--optimex-primary)}.optx-widget .hover\\:bg-\\[rgba\\(239\\,68\\,68\\,0\\.2\\)\\]:hover{background-color:#ef444433}.optx-widget .hover\\:bg-\\[var\\(--optimex-primary-hover\\)\\]:hover{background-color:var(--optimex-primary-hover)}.optx-widget .hover\\:bg-\\[var\\(--optimex-surface-hover\\)\\]:hover{background-color:var(--optimex-surface-hover)}.optx-widget .hover\\:bg-white\\/10:hover{background-color:#ffffff1a}.optx-widget .hover\\:bg-white\\/5:hover{background-color:#ffffff0d}.optx-widget .hover\\:bg-white\\/\\[0\\.02\\]:hover{background-color:#ffffff05}.optx-widget .hover\\:text-\\[var\\(--optimex-primary\\)\\]:hover{color:var(--optimex-primary)}.optx-widget .hover\\:text-\\[var\\(--optimex-text\\)\\]:hover{color:var(--optimex-text)}.optx-widget .hover\\:text-\\[var\\(--optimex-text-secondary\\)\\]:hover{color:var(--optimex-text-secondary)}.optx-widget .hover\\:opacity-100:hover{opacity:1}.optx-widget .hover\\:opacity-70:hover{opacity:.7}.optx-widget .hover\\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .hover\\:brightness-110:hover{--tw-brightness: brightness(1.1);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)}.optx-widget .focus\\:border-\\[var\\(--optimex-primary\\)\\]:focus{border-color:var(--optimex-primary)}.optx-widget .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.optx-widget .focus\\:ring-0:focus{--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(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.optx-widget .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .active\\:scale-\\[0\\.98\\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .disabled\\:pointer-events-none:disabled{pointer-events:none}.optx-widget .disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.optx-widget .disabled\\:opacity-50:disabled{opacity:.5}.optx-widget :is(.group:hover .group-hover\\:rotate-180){--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget :is(.group:hover .group-hover\\:opacity-100){opacity:1}@media(min-width:640px){.optx-widget .sm\\:max-w-lg{max-width:32rem}.optx-widget .sm\\:text-left{text-align:left}}@media(min-width:768px){.optx-widget .md\\:h-\\[70vh\\]{height:70vh}}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),p=require("react"),wn=require("react-dom");function Cn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const x=Cn(p),No=Cn(wn);var lt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},De=typeof window>"u"||"Deno"in globalThis;function ae(){}function To(e,t){return typeof e=="function"?e(t):e}function er(e){return typeof e=="number"&&e>=0&&e!==1/0}function kn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function qe(e,t){return typeof e=="function"?e(t):e}function ce(e,t){return typeof e=="function"?e(t):e}function Ir(e,t){const{type:r="all",exact:n,fetchStatus:o,predicate:a,queryKey:l,stale:i}=e;if(l){if(n){if(t.queryHash!==mr(l,t.options))return!1}else if(!ot(t.queryKey,l))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||o&&o!==t.state.fetchStatus||a&&!a(t))}function Lr(e,t){const{exact:r,status:n,predicate:o,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(st(t.options.mutationKey)!==st(a))return!1}else if(!ot(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||o&&!o(t))}function mr(e,t){return(t?.queryKeyHashFn||st)(e)}function st(e){return JSON.stringify(e,(t,r)=>nr(r)?Object.keys(r).sort().reduce((n,o)=>(n[o]=r[o],n),{}):r)}function ot(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(r=>!ot(e[r],t[r])):!1}function tr(e,t){if(e===t)return e;const r=Fr(e)&&Fr(t);if(r||nr(e)&&nr(t)){const n=r?e:Object.keys(e),o=n.length,a=r?t:Object.keys(t),l=a.length,i=r?[]:{};let c=0;for(let u=0;u<l;u++){const d=r?u:a[u];(!r&&n.includes(d)||r)&&e[d]===void 0&&t[d]===void 0?(i[d]=void 0,c++):(i[d]=tr(e[d],t[d]),i[d]===e[d]&&e[d]!==void 0&&c++)}return o===l&&c===o?e:i}return t}function rr(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Fr(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function nr(e){if(!$r(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!$r(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $r(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ro(e){return new Promise(t=>{setTimeout(t,e)})}function sr(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return tr(e,t)}catch(n){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`)}return tr(e,t)}return t}function Oo(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function _o(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var St=Symbol();function jn(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===St&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===St?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Ao=class extends lt{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!De&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},pr=new Ao,Po=class extends lt{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!De&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#t}},Et=new Po;function or(){let e,t;const r=new Promise((o,a)=>{e=o,t=a});r.status="pending",r.catch(()=>{});function n(o){Object.assign(r,o),delete r.resolve,delete r.reject}return r.resolve=o=>{n({status:"fulfilled",value:o}),e(o)},r.reject=o=>{n({status:"rejected",reason:o}),t(o)},r}function Mo(e){return Math.min(1e3*2**e,3e4)}function Sn(e){return(e??"online")==="online"?Et.isOnline():!0}var En=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Dt(e){return e instanceof En}function Nn(e){let t=!1,r=0,n=!1,o;const a=or(),l=h=>{n||(m(new En(h)),e.abort?.())},i=()=>{t=!0},c=()=>{t=!1},u=()=>pr.isFocused()&&(e.networkMode==="always"||Et.isOnline())&&e.canRun(),d=()=>Sn(e.networkMode)&&e.canRun(),f=h=>{n||(n=!0,e.onSuccess?.(h),o?.(),a.resolve(h))},m=h=>{n||(n=!0,e.onError?.(h),o?.(),a.reject(h))},b=()=>new Promise(h=>{o=y=>{(n||u())&&h(y)},e.onPause?.()}).then(()=>{o=void 0,n||e.onContinue?.()}),v=()=>{if(n)return;let h;const y=r===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(g){h=Promise.reject(g)}Promise.resolve(h).then(f).catch(g=>{if(n)return;const S=e.retry??(De?0:3),k=e.retryDelay??Mo,w=typeof k=="function"?k(r,g):k,N=S===!0||typeof S=="number"&&r<S||typeof S=="function"&&S(r,g);if(t||!N){m(g);return}r++,e.onFail?.(r,g),Ro(w).then(()=>u()?void 0:b()).then(()=>{t?m(g):v()})})};return{promise:a,cancel:l,continue:()=>(o?.(),a),cancelRetry:i,continueRetry:c,canStart:d,start:()=>(d()?v():b().then(v),a)}}function Do(){let e=[],t=0,r=i=>{i()},n=i=>{i()},o=i=>setTimeout(i,0);const a=i=>{t?e.push(i):o(()=>{r(i)})},l=()=>{const i=e;e=[],i.length&&o(()=>{n(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||l()}return c},batchCalls:i=>(...c)=>{a(()=>{i(...c)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{o=i}}}var te=Do(),Tn=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),er(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(De?1/0:300*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},Io=class extends Tn{#t;#e;#n;#r;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#n=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Lo(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const r=sr(this.state.data,e,this.options);return this.#s({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(ae).catch(ae):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>ce(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===St||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!kn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const i=this.observers.find(c=>c.options.queryFn);i&&this.setOptions(i.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,n=i=>{Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(this.#o=!0,r.signal)})},o=()=>{const i=jn(this.options,t),c={queryKey:this.queryKey,meta:this.meta};return n(c),this.#o=!1,this.options.persister?this.options.persister(i,c,this):i(c)},a={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};n(a),this.options.behavior?.onFetch(a,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:"fetch",meta:a.fetchOptions?.meta});const l=i=>{Dt(i)&&i.silent||this.#s({type:"error",error:i}),Dt(i)||(this.#n.config.onError?.(i,this),this.#n.config.onSettled?.(this.state.data,i,this)),this.scheduleGc()};return this.#r=Nn({initialPromise:t?.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:i=>{if(i===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(i)}catch(c){l(c);return}this.#n.config.onSuccess?.(i,this),this.#n.config.onSettled?.(i,this.state.error,this),this.scheduleGc()},onError:l,onFail:(i,c)=>{this.#s({type:"failed",failureCount:i,error:c})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),this.#r.start()}#s(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Rn(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return Dt(n)&&n.revert&&this.#e?{...this.#e,fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),te.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Rn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Sn(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Lo(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Fo=class extends lt{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,r){const n=t.queryKey,o=t.queryHash??mr(n,t);let a=this.get(o);return a||(a=new Io({cache:this,queryKey:n,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(a)),a}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){te.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>Ir(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>Ir(e,r)):t}notify(e){te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){te.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){te.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$o=class extends Tn{#t;#e;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||Bo(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){this.#n=Nn({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(n,o)=>{this.#r({type:"failed",failureCount:n,error:o})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const t=this.state.status==="pending",r=!this.#n.canStart();try{if(!t){this.#r({type:"pending",variables:e,isPaused:r}),await this.#e.config.onMutate?.(e,this);const o=await this.options.onMutate?.(e);o!==this.state.context&&this.#r({type:"pending",context:o,variables:e,isPaused:r})}const n=await this.#n.start();return await this.#e.config.onSuccess?.(n,e,this.state.context,this),await this.options.onSuccess?.(n,e,this.state.context),await this.#e.config.onSettled?.(n,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(n,null,e,this.state.context),this.#r({type:"success",data:n}),n}catch(n){try{throw await this.#e.config.onError?.(n,e,this.state.context,this),await this.options.onError?.(n,e,this.state.context),await this.#e.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,n,e,this.state.context),n}finally{this.#r({type:"error",error:n})}}finally{this.#e.runNext(this)}}#r(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),te.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function Bo(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zo=class extends lt{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(e,t,r){const n=new $o({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#t.add(e);const t=ht(e);if(typeof t=="string"){const r=this.#e.get(t);r?r.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=ht(e);if(typeof t=="string"){const r=this.#e.get(t);if(r)if(r.length>1){const n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=ht(e);if(typeof t=="string"){const n=this.#e.get(t)?.find(o=>o.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=ht(e);return typeof t=="string"?this.#e.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){te.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>Lr(t,r))}findAll(e={}){return this.getAll().filter(t=>Lr(e,t))}notify(e){te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return te.batch(()=>Promise.all(e.map(t=>t.continue().catch(ae))))}};function ht(e){return e.options.scope?.id}function Br(e){return{onFetch:(t,r)=>{const n=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],l=t.state.data?.pageParams||[];let i={pages:[],pageParams:[]},c=0;const u=async()=>{let d=!1;const f=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?d=!0:t.signal.addEventListener("abort",()=>{d=!0}),t.signal)})},m=jn(t.options,t.fetchOptions),b=async(v,h,y)=>{if(d)return Promise.reject();if(h==null&&v.pages.length)return Promise.resolve(v);const g={queryKey:t.queryKey,pageParam:h,direction:y?"backward":"forward",meta:t.options.meta};f(g);const S=await m(g),{maxPages:k}=t.options,w=y?_o:Oo;return{pages:w(v.pages,S,k),pageParams:w(v.pageParams,h,k)}};if(o&&a.length){const v=o==="backward",h=v?Wo:zr,y={pages:a,pageParams:l},g=h(n,y);i=await b(y,g,v)}else{const v=e??a.length;do{const h=c===0?l[0]??n.initialPageParam:zr(n,i);if(c>0&&h==null)break;i=await b(i,h),c++}while(c<v)}return i};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function zr(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Wo(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Vo=class{#t;#e;#n;#r;#a;#o;#s;#i;constructor(e={}){this.#t=e.queryCache||new Fo,this.#e=e.mutationCache||new zo,this.#n=e.defaultOptions||{},this.#r=new Map,this.#a=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#s=pr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#i=Et.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#s?.(),this.#s=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#t.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(qe(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),a=this.#t.get(n.queryHash)?.state.data,l=To(t,a);if(l!==void 0)return this.#t.build(this,n).setData(l,{...r,manual:!0})}setQueriesData(e,t,r){return te.batch(()=>this.#t.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;te.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#t,n={type:"active",...e};return te.batch(()=>(r.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(n,t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=te.batch(()=>this.#t.findAll(e).map(o=>o.cancel(r)));return Promise.all(n).then(ae).catch(ae)}invalidateQueries(e,t={}){return te.batch(()=>{if(this.#t.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none")return Promise.resolve();const r={...e,type:e?.refetchType??e?.type??"active"};return this.refetchQueries(r,t)})}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=te.batch(()=>this.#t.findAll(e).filter(o=>!o.isDisabled()).map(o=>{let a=o.fetch(void 0,r);return r.throwOnError||(a=a.catch(ae)),o.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(ae)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#t.build(this,t);return r.isStaleByTime(qe(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ae).catch(ae)}fetchInfiniteQuery(e){return e.behavior=Br(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ae).catch(ae)}ensureInfiniteQueryData(e){return e.behavior=Br(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Et.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(st(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],r={};return t.forEach(n=>{ot(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#a.set(st(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#a.values()];let r={};return t.forEach(n=>{ot(e,n.mutationKey)&&(r={...r,...n.defaultOptions})}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=mr(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===St&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},Uo=class extends lt{constructor(e,t){super(),this.options=t,this.#t=e,this.#i=null,this.#s=or(),this.options.experimental_prefetchInRender||this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#n=void 0;#r=void 0;#a;#o;#s;#i;#p;#f;#h;#c;#u;#l;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Wr(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ar(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ar(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#w(),this.#e.removeObserver(this)}setOptions(e,t){const r=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ce(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#e.setOptions(this.options),r._defaulted&&!rr(this.options,r)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const o=this.hasListeners();o&&Vr(this.#e,n,this.options,r)&&this.#d(),this.updateResult(t),o&&(this.#e!==n||ce(this.options.enabled,this.#e)!==ce(r.enabled,this.#e)||qe(this.options.staleTime,this.#e)!==qe(r.staleTime,this.#e))&&this.#x();const a=this.#v();o&&(this.#e!==n||ce(this.options.enabled,this.#e)!==ce(r.enabled,this.#e)||a!==this.#l)&&this.#g(a)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),r=this.createResult(t,e);return qo(this,r)&&(this.#r=r,this.#o=this.options,this.#a=this.#e.state),r}getCurrentResult(){return this.#r}trackResult(e,t){const r={};return Object.keys(e).forEach(n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(n),t?.(n),e[n])})}),r}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),r=this.#t.getQueryCache().build(this.#t,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#d(e){this.#C();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ae)),t}#x(){this.#y();const e=qe(this.options.staleTime,this.#e);if(De||this.#r.isStale||!er(e))return;const r=kn(this.#r.dataUpdatedAt,e)+1;this.#c=setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#g(e){this.#w(),this.#l=e,!(De||ce(this.options.enabled,this.#e)===!1||!er(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||pr.isFocused())&&this.#d()},this.#l))}#b(){this.#x(),this.#g(this.#v())}#y(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#e,n=this.options,o=this.#r,a=this.#a,l=this.#o,c=e!==r?e.state:this.#n,{state:u}=e;let d={...u},f=!1,m;if(t._optimisticResults){const C=this.hasListeners(),j=!C&&Wr(e,t),O=C&&Vr(e,r,t,n);(j||O)&&(d={...d,...Rn(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:b,errorUpdatedAt:v,status:h}=d;if(t.select&&d.data!==void 0)if(o&&d.data===a?.data&&t.select===this.#p)m=this.#f;else try{this.#p=t.select,m=t.select(d.data),m=sr(o?.data,m,t),this.#f=m,this.#i=null}catch(C){this.#i=C}else m=d.data;if(t.placeholderData!==void 0&&m===void 0&&h==="pending"){let C;if(o?.isPlaceholderData&&t.placeholderData===l?.placeholderData)C=o.data;else if(C=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,t.select&&C!==void 0)try{C=t.select(C),this.#i=null}catch(j){this.#i=j}C!==void 0&&(h="success",m=sr(o?.data,C,t),f=!0)}this.#i&&(b=this.#i,m=this.#f,v=Date.now(),h="error");const y=d.fetchStatus==="fetching",g=h==="pending",S=h==="error",k=g&&y,w=m!==void 0,A={status:h,fetchStatus:d.fetchStatus,isPending:g,isSuccess:h==="success",isError:S,isInitialLoading:k,isLoading:k,data:m,dataUpdatedAt:d.dataUpdatedAt,error:b,errorUpdatedAt:v,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:y,isRefetching:y&&!g,isLoadingError:S&&!w,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&w,isStale:xr(e,t),refetch:this.refetch,promise:this.#s};if(this.options.experimental_prefetchInRender){const C=L=>{A.status==="error"?L.reject(A.error):A.data!==void 0&&L.resolve(A.data)},j=()=>{const L=this.#s=A.promise=or();C(L)},O=this.#s;switch(O.status){case"pending":e.queryHash===r.queryHash&&C(O);break;case"fulfilled":(A.status==="error"||A.data!==O.value)&&j();break;case"rejected":(A.status!=="error"||A.error!==O.reason)&&j();break}}return A}updateResult(e){const t=this.#r,r=this.createResult(this.#e,this.options);if(this.#a=this.#e.state,this.#o=this.options,this.#a.data!==void 0&&(this.#h=this.#e),rr(r,t))return;this.#r=r;const n={},o=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,l=typeof a=="function"?a():a;if(l==="all"||!l&&!this.#m.size)return!0;const i=new Set(l??this.#m);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(c=>{const u=c;return this.#r[u]!==t[u]&&i.has(u)})};e?.listeners!==!1&&o()&&(n.listeners=!0),this.#k({...n,...e})}#C(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(e){te.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function Ho(e,t){return ce(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Wr(e,t){return Ho(e,t)||e.state.data!==void 0&&ar(e,t,t.refetchOnMount)}function ar(e,t,r){if(ce(t.enabled,e)!==!1){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&xr(e,t)}return!1}function Vr(e,t,r,n){return(e!==t||ce(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&xr(e,r)}function xr(e,t){return ce(t.enabled,e)!==!1&&e.isStaleByTime(qe(t.staleTime,e))}function qo(e,t){return!rr(e.getCurrentResult(),t)}var On=x.createContext(void 0),Qo=e=>{const t=x.useContext(On);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Go=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(On.Provider,{value:e,children:t})),_n=x.createContext(!1),Ko=()=>x.useContext(_n);_n.Provider;function Yo(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Zo=x.createContext(Yo()),Xo=()=>x.useContext(Zo);function Jo(e,t){return typeof e=="function"?e(...t):!!e}function Ur(){}var ea=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},ta=e=>{x.useEffect(()=>{e.clearReset()},[e])},ra=({result:e,errorResetBoundary:t,throwOnError:r,query:n})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&Jo(r,[e.error,n]),na=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...r)=>Math.max(t(...r),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},sa=(e,t)=>e.isLoading&&e.isFetching&&!t,oa=(e,t)=>e?.suspense&&t.isPending,Hr=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function aa(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Qo(),o=Ko(),a=Xo(),l=n.defaultQueryOptions(e);n.getDefaultOptions().queries?._experimental_beforeQuery?.(l),l._optimisticResults=o?"isRestoring":"optimistic",na(l),ea(l,a),ta(a);const i=!n.getQueryCache().get(l.queryHash),[c]=x.useState(()=>new t(n,l)),u=c.getOptimisticResult(l),d=!o&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(f=>{const m=d?c.subscribe(te.batchCalls(f)):Ur;return c.updateResult(),m},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),x.useEffect(()=>{c.setOptions(l,{listeners:!1})},[l,c]),oa(l,u))throw Hr(l,c,a);if(ra({result:u,errorResetBoundary:a,throwOnError:l.throwOnError,query:n.getQueryCache().get(l.queryHash)}))throw u.error;return n.getDefaultOptions().queries?._experimental_afterQuery?.(l,u),l.experimental_prefetchInRender&&!De&&sa(u,o)&&(i?Hr(l,c,a):n.getQueryCache().get(l.queryHash)?.promise)?.catch(Ur).finally(()=>{c.updateResult()}),l.notifyOnChangeProps?u:c.trackResult(u)}function Ge(e,t){return aa(e,Uo)}const ia={widget:"1rem",input:"0.75rem",button:"0.5rem"},la={primary:"#ffffff",secondary:"hsla(0, 0%, 100%, 0.48)"},ca={background:"#343b47",radius:"0.75rem"},oe={colors:{primary:"#ed6300",background:"hsla(0, 0%, 100%, 0.04)",surface:"hsla(0, 0%, 0%, 0.2)",text:la,error:"#ff4d4f",success:"#52c41a"},radius:ia,overlay:ca,fontFamily:"'Inter', sans-serif"},ua=p.createContext(null);function da({children:e,theme:t}){const r=p.useMemo(()=>t?{colors:{primary:t.colors?.primary??oe.colors.primary,background:t.colors?.background??oe.colors.background,surface:t.colors?.surface??oe.colors.surface,text:{primary:t.colors?.text?.primary??oe.colors.text.primary,secondary:t.colors?.text?.secondary??oe.colors.text.secondary},error:t.colors?.error??oe.colors.error,success:t.colors?.success??oe.colors.success},radius:{widget:t.radius?.widget??oe.radius.widget,input:t.radius?.input??oe.radius.input,button:t.radius?.button??oe.radius.button},overlay:{background:t.overlay?.background??oe.overlay.background,radius:t.overlay?.radius??oe.overlay.radius},fontFamily:t.fontFamily??oe.fontFamily}:oe,[t]),n=p.useMemo(()=>({"--optimex-primary":r.colors.primary,"--optimex-background":r.colors.background,"--optimex-surface":r.colors.surface,"--optimex-text":r.colors.text.primary,"--optimex-text-secondary":r.colors.text.secondary,"--optimex-error":r.colors.error,"--optimex-success":r.colors.success,"--optimex-radius-widget":r.radius.widget,"--optimex-radius-input":r.radius.input,"--optimex-radius-button":r.radius.button,"--optimex-overlay-background":r.overlay.background,"--optimex-overlay-radius":r.overlay.radius,"--optimex-font-family":r.fontFamily}),[r]);return s.jsx(ua.Provider,{value:{theme:r},children:s.jsx("div",{style:n,className:"w-full",children:e})})}const An=p.createContext(null);function fa({children:e,externalWalletClient:t,onRequestWallet:r}){const n=p.useMemo(()=>{const o=t?.evm?.address??null,a=t?.evm?.chain?.id??null,l=t?.btc?.address??null,i=t?.btc?.publicKey??null,c=t?.solana?.address??null,u=!!o,d=!!l,f=!!c;return{mode:"external",isExternalWallet:!0,isConnected:u||d||f,evmAddress:o,evmChainId:a,isEvmConnected:u,btcAddress:l,btcPublicKey:i,isBtcConnected:d,solanaAddress:c,isSolanaConnected:f,externalWalletClient:t,onRequestWallet:r,isConnecting:!1}},[t,r]);return s.jsx(An.Provider,{value:n,children:e})}class It extends Error{status;code;constructor(t,r,n){super(r),this.name="ApiError",this.status=t,this.code=n}}class Pn{baseUrl;headers;constructor(t){this.baseUrl=t.replace(/\/$/,""),this.headers={"Content-Type":"application/json"}}async request(t,r,n){const o=`${this.baseUrl}${r}`;try{const a=await fetch(o,{method:t,headers:this.headers,body:n?JSON.stringify(n):void 0});if(!a.ok){const i=await a.json().catch(()=>({}));throw new It(a.status,i.message||`Request failed with status ${a.status}`,i.code)}return(await a.json()).data}catch(a){throw a instanceof It?a:new It(0,a instanceof Error?a.message:"Network error","NETWORK_ERROR")}}async getTokens(){return this.request("GET","/v2/tokens")}async createQuote(t){return this.request("POST","/v2/trades/quote",t)}async submitTransaction(t,r){return this.request("POST","/v2/trades/submit-tx",{trade_id:t,tx_id:r})}async getTrade(t){return this.request("GET",`/v2/trades/${t}`)}async getTokenPrice(t){return this.request("GET",`/v2/tokens/${t}`)}async listTrades(t={}){const r=new URLSearchParams;t.limit&&r.set("limit",String(t.limit)),t.page&&r.set("page",String(t.page)),t.state&&r.set("state",t.state),t.from_user_address?.length&&t.from_user_address.forEach(a=>r.append("from_user_address",a)),t.to_user_address?.length&&t.to_user_address.forEach(a=>r.append("to_user_address",a));const n=r.toString(),o=n?`/v2/trades?${n}`:"/v2/trades";return this.request("GET",o)}}let He=null;function Ke(e){if(!He&&e&&(He=new Pn(e)),!He)throw new Error("API not initialized. Please provide baseUrl.");return He}function ha(e){return He=new Pn(e),He}const ma=["tokens"];function pa(e){return Ge({queryKey:ma,queryFn:async()=>Ke(e).getTokens(),staleTime:300*1e3,gcTime:1800*1e3,retry:3,retryDelay:t=>Math.min(1e3*2**t,3e4)})}const xa=15e3,va=1e4,K={EVM:"EVM",BTC:"BTC",SOLANA:"Solana"};function ga(e,t=4){return e?e.length<=t*2+3?e:`${e.slice(0,t+2)}...${e.slice(-t)}`:""}function ba(e,t,r=6){if(!e)return"0";let n;typeof e=="bigint"?n=e:typeof e=="string"?n=BigInt(e):n=BigInt(Math.floor(e));const o=BigInt(10**t),a=n/o,l=n%o;if(l===0n)return a.toString();const c=l.toString().padStart(t,"0").slice(0,r).replace(/0+$/,"");return c?`${a}.${c}`:a.toString()}function Mn(e,t){if(!e||e==="0")return 0n;const[r,n=""]=e.split("."),o=n.slice(0,t).padEnd(t,"0"),a=r+o;return BigInt(a)}function Te(e,t=18,r=6){if(!e)return"0";const n=String(e);if(n.includes(".")||!Number.isInteger(Number(n))){const o=parseFloat(n);return isNaN(o)?"0":o.toFixed(r).replace(/\.?0+$/,"")}return ba(n,t,r)}function ya(e){return/^0x[a-fA-F0-9]{40}$/.test(e)}function wa(e){return/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(bc1)[a-z0-9]{39,59}$/.test(e)}function Ca(e){return/^[mn2][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(tb1)[a-z0-9]{39,59}$/.test(e)}function ka(e){return/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)}function vr(e,t,r){const n=e.trim();if(!n)return{isValid:!1,error:"Address is required"};switch(t){case K.EVM:return ya(n)?{isValid:!0}:{isValid:!1,error:`Invalid ${r} wallet address`};case K.BTC:if(r==="bitcoin_testnet"){if(!Ca(n))return{isValid:!1,error:`Invalid ${r} wallet address`}}else if(!wa(n))return{isValid:!1,error:`Invalid ${r} wallet address`};return{isValid:!0};case K.SOLANA:return ka(n)?{isValid:!0}:{isValid:!1,error:`Invalid ${r} wallet address`};default:return{isValid:!1,error:`Unsupported network type: ${t}`}}}const ja=e=>["quote",e];function Sa(e,{from_token:t,to_token:r,amount:n,from_user_address:o,to_user_address:a,user_refund_pubkey:l,slippage:i="100",affiliate_fee_bps:c,affiliate_info:u,trade_timeout:d,script_timeout:f,enabled:m=!0,onQuote:b}){const v=r&&a?vr(a,r.network_type,r.network_id).isValid:!1,h=t&&r&&n&&parseFloat(n)>0&&o&&a&&l&&v;return Ge({queryKey:ja({from_token:t,to_token:r,amount:n,from_user_address:o,to_user_address:a,user_refund_pubkey:l,slippage:i}),queryFn:async()=>{const y=Ke(e),g=Mn(n,t.token_decimals).toString(),S=await y.createQuote({from_token_id:t.token_id,to_token_id:r.token_id,amount_in:g,slippage:i,from_user_address:o,to_user_address:a,user_refund_pubkey:l,affiliate_fee_bps:c,affiliate_info:u,trade_timeout:d,script_timeout:f});return b?.({quote:S,from_token:t,to_token:r,amount_in:n}),S},enabled:m&&!!h,staleTime:va,refetchInterval:xa,retry:2,retryDelay:1e3})}const Dn=p.createContext(null);function Ea({children:e,value:t}){return s.jsx(Dn.Provider,{value:t,children:e})}function ct(){const e=p.useContext(Dn);if(!e)throw new Error("useWidgetConfig must be used within SwapWidget");return e}function Na({className:e="h-6 w-6"}){return s.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("rect",{width:"24",height:"24",rx:"6",fill:"#D0D0D8"}),s.jsx("rect",{x:"4",y:"4",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#FFD49F"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.98943 6.98062C9.06078 6.50027 8.69769 6.24205 8.20122 6.06979L8.36227 5.4191L7.96906 5.32039L7.81227 5.95393C7.7089 5.92798 7.60273 5.9035 7.49723 5.87925L7.65514 5.24153L7.26216 5.14282L7.101 5.79329C7.01544 5.77366 6.93144 5.75426 6.84991 5.73384L6.85036 5.73181L6.30809 5.59542L6.20348 6.01846C6.20348 6.01846 6.49523 6.08581 6.48907 6.08998C6.64832 6.13003 6.6771 6.23618 6.67229 6.32034L6.48884 7.06162C6.49982 7.06444 6.51404 7.0685 6.52972 7.07482L6.5164 7.07147L6.48817 7.06444L6.23103 8.10286C6.21155 8.1516 6.16216 8.2247 6.05084 8.19695C6.05476 8.2027 5.76503 8.12509 5.76503 8.12509L5.56982 8.57847L6.08152 8.70696C6.13867 8.72139 6.19513 8.73622 6.251 8.7509C6.2882 8.76067 6.32514 8.77037 6.36184 8.77984L6.19912 9.43798L6.59188 9.53669L6.75304 8.88554C6.86033 8.91487 6.96448 8.94195 7.06639 8.96744L6.9058 9.61554L7.299 9.71425L7.46173 9.05735C8.13224 9.18517 8.63643 9.13361 8.84866 8.52274C9.01967 8.03089 8.84015 7.74717 8.48737 7.56216C8.74428 7.50248 8.93781 7.33225 8.98943 6.98062ZM8.09134 8.24968C7.97986 8.70094 7.27864 8.51438 6.9578 8.42902L6.95779 8.42901C6.92893 8.42133 6.90314 8.41447 6.88114 8.40897L7.09706 7.53706C7.12385 7.54379 7.15659 7.55119 7.19367 7.55957C7.52551 7.63458 8.20558 7.78829 8.09134 8.24968ZM7.26037 7.15491C7.52787 7.22682 8.11136 7.38367 8.213 6.97354C8.31679 6.55403 7.74968 6.42757 7.47272 6.36581C7.44156 6.35886 7.41408 6.35273 7.39164 6.3471L7.19587 7.1379C7.21436 7.14254 7.23606 7.14838 7.26037 7.15491Z",fill:"#F7931A"}),s.jsx("rect",{x:"12.8572",y:"4",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"white"}),s.jsx("path",{d:"M14.8567 7.47096L16.2848 8.30034V6.83321V5.14284L14.8567 7.47096Z",fill:"#898989"}),s.jsx("path",{d:"M16.2837 5.14284V6.8332V8.30033L17.7118 7.47096L16.2837 5.14284Z",fill:"#323232"}),s.jsx("path",{d:"M16.2837 6.83343L17.7114 7.47098L16.2837 8.30014V6.83343Z",fill:"#141414"}),s.jsx("path",{d:"M16.2848 6.83322L16.2853 6.83336V8.29993L16.2848 8.30035L14.8567 7.47097L16.2848 6.83322Z",fill:"#373737"}),s.jsx("path",{d:"M14.8567 7.73708L16.2848 9.71431V8.56604L14.8567 7.73708Z",fill:"#898989"}),s.jsx("path",{d:"M16.2837 8.56604V9.71431L17.7127 7.73708L16.2837 8.56604Z",fill:"#323232"}),s.jsx("rect",{x:"4",y:"12.8571",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#DCFFFB"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.68368 15.456C8.66445 15.4645 8.64369 15.469 8.6227 15.469H5.49249C5.47756 15.469 5.46296 15.4645 5.45047 15.4563C5.43798 15.448 5.42815 15.4362 5.42218 15.4223C5.41621 15.4084 5.41436 15.3931 5.41685 15.3782C5.41935 15.3633 5.42608 15.3494 5.43622 15.3383L6.0958 14.6209C6.11009 14.6053 6.12738 14.5929 6.14662 14.5844C6.16585 14.5758 6.18661 14.5714 6.2076 14.5714H9.33781C9.35286 14.5711 9.3677 14.5753 9.3804 14.5835C9.39311 14.5917 9.40317 14.6035 9.40925 14.6175C9.41536 14.6315 9.41722 14.6469 9.41465 14.662C9.41208 14.677 9.40518 14.691 9.39482 14.7021L8.7345 15.4195C8.72021 15.4351 8.70292 15.4475 8.68368 15.456ZM8.73471 15.9844C8.72037 15.9689 8.70306 15.9565 8.68384 15.948C8.66462 15.9395 8.64389 15.9351 8.62291 15.935H5.4927C5.47777 15.935 5.46317 15.9394 5.45068 15.9477C5.43819 15.956 5.42836 15.9678 5.42239 15.9817C5.41642 15.9955 5.41457 16.0108 5.41706 16.0258C5.41955 16.0407 5.42629 16.0545 5.43643 16.0656L6.09601 16.7835C6.11035 16.799 6.12766 16.8114 6.14688 16.8199C6.1661 16.8284 6.18683 16.8328 6.20781 16.8329H9.33802C9.35292 16.8328 9.36746 16.8284 9.3799 16.82C9.39235 16.8117 9.40211 16.7999 9.40804 16.7861C9.41396 16.7722 9.41579 16.7569 9.41326 16.742C9.41076 16.7272 9.40405 16.7133 9.39392 16.7023L8.73471 15.9844ZM9.39503 17.4295L8.73471 18.147C8.72042 18.1626 8.70313 18.175 8.68389 18.1835C8.66466 18.192 8.6439 18.1964 8.62291 18.1965H5.4927C5.47777 18.1964 5.46317 18.192 5.45068 18.1837C5.43819 18.1754 5.42836 18.1636 5.42239 18.1498C5.41642 18.1359 5.41457 18.1206 5.41706 18.1057C5.41955 18.0908 5.42629 18.0769 5.43643 18.0658L6.09601 17.3484C6.1103 17.3328 6.12759 17.3203 6.14683 17.3118C6.16606 17.3033 6.18682 17.2989 6.20781 17.2989H9.33802C9.35307 17.2986 9.3679 17.3028 9.38061 17.311C9.39332 17.3192 9.40338 17.331 9.40945 17.345C9.41557 17.3589 9.41743 17.3744 9.41486 17.3895C9.41229 17.4045 9.40539 17.4185 9.39503 17.4295Z",fill:"url(#paint0_linear_all_networks)"}),s.jsx("rect",{x:"12.8572",y:"12.8571",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#999CB3"}),s.jsx("path",{d:"M16.0979 17.4286V15.1429H16.473V17.4286H16.0979ZM15.1426 16.4692V16.097H17.4283V16.4692H15.1426Z",fill:"#2D3153"}),s.jsx("defs",{children:s.jsxs("linearGradient",{id:"paint0_linear_all_networks",x1:"7.82209",y1:"19.7701",x2:"10.7176",y2:"15.7425",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{offset:"0.08",stopColor:"#9945FF"}),s.jsx("stop",{offset:"0.3",stopColor:"#8752F3"}),s.jsx("stop",{offset:"0.5",stopColor:"#5497D5"}),s.jsx("stop",{offset:"0.6",stopColor:"#43B4CA"}),s.jsx("stop",{offset:"0.72",stopColor:"#28E0B9"}),s.jsx("stop",{offset:"0.97",stopColor:"#19FB9B"})]})})]})}function Ta(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",...e,children:s.jsx("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"})})}function gr({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}function In({className:e="h-4 w-4"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function Ln({className:e="h-5 w-5"}){return s.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),s.jsx("path",{strokeLinecap:"round",d:"M12 2a10 10 0 019.17 6"})]})}function Ra({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}function Ie({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function Oa(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[s.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),s.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}function _a(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",...e,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}function Aa({className:e="h-3.5 w-3.5"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}function Pa(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 29 20",fill:"currentColor",...e,children:s.jsx("path",{d:"M18.1123 4.25181C17.9463 3.49057 17.537 2.8272 16.9727 2.31607C15.4792 0.978457 13.189 1.03283 11.7619 2.4357C11.2751 2.91419 10.9321 3.51232 10.7662 4.18656C10.6002 4.84993 10.6555 5.64381 10.4564 6.50293C10.1798 7.75354 9.53813 8.90629 8.6088 9.81978C7.6131 10.7985 6.34081 11.451 4.95788 11.6903C4.19451 11.8208 3.3205 11.7773 2.57925 12.0165C2.00396 12.2014 1.48398 12.5276 1.07463 12.9409C-0.374675 14.3981 -0.352546 16.7254 1.10782 18.1609C2.535 19.5637 4.84725 19.6181 6.32974 18.2696C6.72802 17.9107 7.04886 17.4757 7.25907 16.9755C7.67947 16.0076 7.52459 15.5944 7.65735 14.6483C7.73479 14.0936 7.87862 13.5608 8.08882 13.0388C8.31009 12.4841 8.3986 12.3319 8.70837 11.8643C9.29473 10.9943 10.0692 10.2548 10.9874 9.73278C12.0053 9.14554 13.178 8.81929 14.4392 8.81929C16.32 8.81929 18.0237 9.56966 19.2628 10.7768C20.2586 11.7446 20.9445 13.0061 21.1879 14.4199C21.3096 15.0941 21.2432 15.8227 21.4202 16.4861C21.5972 17.1386 21.9402 17.715 22.4049 18.1826C23.8763 19.629 26.266 19.629 27.7485 18.1826C29.1646 16.7906 29.231 14.5395 27.8923 13.0823C27.4498 12.6038 26.8855 12.234 26.2549 12.0274C25.4252 11.7664 25.0379 11.8643 24.1971 11.7555C22.6593 11.5598 21.2875 10.8638 20.2475 9.84153C19.1854 8.79754 18.4663 7.40554 18.2893 5.8613C18.1897 5.19793 18.2561 4.87168 18.1123 4.25181ZM16.9617 11.0486C15.5013 9.61316 13.1448 9.61316 11.6844 11.0486C10.2241 12.4841 10.2241 14.8005 11.6844 16.236C13.1448 17.6715 15.5013 17.6715 16.9617 16.236C18.422 14.8005 18.422 12.4841 16.9617 11.0486ZM26.0668 3.13169C24.6065 1.6962 22.25 1.6962 20.7896 3.13169C19.3292 4.56719 19.3292 6.88355 20.7896 8.31904C22.25 9.75453 24.6065 9.75453 26.0668 8.31904C27.5272 6.88355 27.5272 4.56719 26.0668 3.13169ZM7.95606 3.17519C6.49569 1.7397 4.13919 1.7397 2.67882 3.17519C1.21845 4.61069 1.21845 6.92705 2.67882 8.36254C4.13919 9.79803 6.49569 9.79803 7.95606 8.36254C9.41643 6.92705 9.41643 4.59981 7.95606 3.17519Z"})})}function Ma(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 124 22",...e,children:s.jsx("path",{d:"M41.39 4.241c3.385 0 6.162 2.73 6.162 6.058s-2.777 6.003-6.162 6.003h-.62c-3.385 0-6.162-2.676-6.162-6.003S37.385 4.24 40.77 4.24zm-.3 10.745c2.877 0 4.825-2.317 4.825-4.644.055-2.37-1.903-4.796-4.824-4.796-2.976 0-4.879 2.425-4.824 4.796-.01 2.316 1.892 4.644 4.824 4.644m21.353-4.698c0 3.327-2.268 5.992-5.233 5.992h-.62c-2.422 0-3.905-.805-4.978-2.665V22H50.02V4.241h1.593V6.96c.963-1.925 2.666-2.719 4.979-2.719h.62c2.964 0 5.232 2.719 5.232 6.047m-1.703 0c0-2.317-1.649-4.644-4.559-4.644-2.312 0-4.259 1.925-4.259 4.23v.816c0 2.316 1.936 4.187 4.304 4.187 2.832 0 4.514-2.273 4.514-4.59m8.275 6.003c-.354 0-.72-.055-1.073-.196-.874-.305-1.593-.86-2.058-1.61a5 5 0 0 1-.465-1.109c-.1-.402-.155-.707-.155-1.11V5.765h-1.382v-1.36h1.382V.772h1.649v3.632h3.44v1.36h-3.44v6.144c0 1.762.774 2.828 2.722 2.828h1.438v1.566h-2.058zm6.018-15.28c0 .555-.409 1.012-.973 1.012A1.025 1.025 0 0 1 73.03 1.01C73.031.457 73.496 0 74.06 0s.973.457.973 1.011m-1.792 3.23h1.593v12.06h-1.593zm14.283 2.621c.819-1.718 2.511-2.62 4.47-2.62 3.075 0 4.47 2.729 4.47 5.502v6.558H94.87V9.396c0-5.655-6.881-4.698-6.881.196v6.71h-1.594V9.396c0-5.655-6.826-4.698-6.826.196v6.71h-1.637V4.242h1.593v2.065c1.637-2.925 6.716-2.773 7.999.555m17.436 8.124c1.847 0 3.695-1.164 4.304-2.73h1.593c-.819 2.316-2.877 4.035-5.543 4.035h-.664c-3.385 0-5.897-2.676-5.897-6.003s2.512-6.058 5.897-6.058h.664c3.341 0 5.897 2.73 5.897 6.058 0 .195 0 .402-.056.609H100.38c.121 2.273 2.268 4.089 4.58 4.089m4.624-5.296c-.099-2.273-2.257-4.133-4.613-4.133-2.312 0-4.47 1.86-4.569 4.133zM124 4.24l-5.133 6.058L124 16.302h-2.058l-4.104-4.84-4.105 4.84h-2.002l5.133-6.003-5.133-6.058h2.002l4.105 4.84 4.104-4.84zm-105.888-.49a3.67 3.67 0 0 0-1.14-1.935 3.817 3.817 0 0 0-5.21.12 3.67 3.67 0 0 0-.996 1.75c-.166.664-.11 1.458-.31 2.317A6.7 6.7 0 0 1 8.61 9.32a6.88 6.88 0 0 1-3.651 1.87c-.763.13-1.638.087-2.379.327a3.75 3.75 0 0 0-1.504.924 3.667 3.667 0 0 0 .033 5.22c1.427 1.403 3.74 1.457 5.222.109.398-.36.719-.794.93-1.294.42-.968.265-1.382.397-2.328a6.8 6.8 0 0 1 .432-1.61c.221-.554.31-.706.62-1.174a6.862 6.862 0 0 1 5.73-3.045c1.881 0 3.585.75 4.824 1.958a6.64 6.64 0 0 1 1.925 3.643c.122.674.055 1.403.232 2.066.177.653.52 1.229.985 1.697 1.471 1.446 3.861 1.446 5.343 0a3.666 3.666 0 0 0 .144-5.1 3.9 3.9 0 0 0-1.637-1.056c-.83-.26-1.217-.163-2.058-.271a6.86 6.86 0 0 1-3.95-1.914 6.65 6.65 0 0 1-1.958-3.98c-.1-.664-.033-.99-.177-1.61m-1.15 6.798a3.77 3.77 0 0 0-5.278 0 3.62 3.62 0 0 0 0 5.187 3.77 3.77 0 0 0 5.278 0 3.62 3.62 0 0 0 0-5.187m9.105-7.917a3.77 3.77 0 0 0-5.277 0 3.62 3.62 0 0 0 0 5.187 3.77 3.77 0 0 0 5.277 0 3.62 3.62 0 0 0 0-5.187m-18.11.043a3.77 3.77 0 0 0-5.278 0 3.62 3.62 0 0 0 0 5.188 3.77 3.77 0 0 0 5.277 0 3.62 3.62 0 0 0 0-5.188"})})}function Da(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",...e,children:[s.jsx("mask",{id:"paste_mask",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"25",children:s.jsx("rect",{y:"0.5",width:"24",height:"24",fill:"#D9D9D9"})}),s.jsx("g",{mask:"url(#paste_mask)",children:s.jsx("path",{d:"M5.30775 20.9999C4.80908 20.9999 4.38308 20.8233 4.02975 20.4701C3.67658 20.1168 3.5 19.6908 3.5 19.1921V5.80762C3.5 5.30895 3.67658 4.88295 4.02975 4.52962C4.38308 4.17645 4.80908 3.99987 5.30775 3.99987H9.7135C9.852 3.5127 10.135 3.10887 10.5625 2.78837C10.99 2.46787 11.4692 2.30762 12 2.30762C12.5513 2.30762 13.0382 2.46787 13.4605 2.78837C13.883 3.10887 14.1635 3.5127 14.302 3.99987H18.6923C19.1909 3.99987 19.6169 4.17645 19.9703 4.52962C20.3234 4.88295 20.5 5.30895 20.5 5.80762V19.1921C20.5 19.6908 20.3234 20.1168 19.9703 20.4701C19.6169 20.8233 19.1909 20.9999 18.6923 20.9999H5.30775ZM5.30775 19.4999H18.6923C18.7692 19.4999 18.8398 19.4678 18.9038 19.4036C18.9679 19.3396 19 19.2691 19 19.1921V5.80762C19 5.73062 18.9679 5.66012 18.9038 5.59612C18.8398 5.53195 18.7692 5.49987 18.6923 5.49987H16.5V8.11512H7.5V5.49987H5.30775C5.23075 5.49987 5.16025 5.53195 5.09625 5.59612C5.03208 5.66012 5 5.73062 5 5.80762V19.1921C5 19.2691 5.03208 19.3396 5.09625 19.4036C5.16025 19.4678 5.23075 19.4999 5.30775 19.4999ZM12 5.61537C12.2577 5.61537 12.4728 5.52912 12.6453 5.35662C12.8176 5.18412 12.9038 4.96903 12.9038 4.71137C12.9038 4.4537 12.8176 4.23862 12.6453 4.06612C12.4728 3.89378 12.2577 3.80762 12 3.80762C11.7423 3.80762 11.5273 3.89378 11.3548 4.06612C11.1824 4.23862 11.0963 4.4537 11.0963 4.71137C11.0963 4.96903 11.1824 5.18412 11.3548 5.35662C11.5273 5.52912 11.7423 5.61537 12 5.61537Z",fill:"currentColor",fillOpacity:.48})})]})}function Ia(e){return s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[s.jsx("path",{d:"M4 12C4 7.58172 7.58172 4 12 4C15.0736 4 17.7555 5.6841 19.2291 8.16667M20 12C20 16.4183 16.4183 20 12 20C8.92638 20 6.24452 18.3159 4.77091 15.8333",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),s.jsx("path",{d:"M19 4V8H15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M5 20V16H9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function La(e){return s.jsxs("svg",{viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[s.jsx("circle",{cx:"32",cy:"32",r:"28",className:"fill-[var(--optimex-error)]/10 stroke-[var(--optimex-error)]",strokeWidth:"2"}),s.jsx("path",{d:"M20 22L26 28M26 22L20 28",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"}),s.jsx("path",{d:"M38 22L44 28M44 22L38 28",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"}),s.jsx("path",{d:"M22 44C26 38 38 38 42 44",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"})]})}function Fa({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function $a({className:e="h-5 w-5"}){return s.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function Fn(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[s.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}),s.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]})}function qr({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}function $n(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 21",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",d:"m11.299 2.846-.553 2.231q.557.126 1.103.263l.549-2.219 1.375.346-.563 2.277c1.737.603 3.008 1.506 2.759 3.188-.18 1.23-.858 1.827-1.757 2.036 1.234.647 1.862 1.641 1.264 3.362-.743 2.137-2.507 2.318-4.854 1.87l-.57 2.3-1.376-.345.562-2.269a53 53 0 0 1-1.096-.287l-.565 2.28-1.374-.346.57-2.304c-.322-.082-.65-.17-.982-.254L4 14.525l.684-1.587c.009.002 1.013.272 1 .251.389.098.562-.158.63-.33l.9-3.633.145.036a1 1 0 0 0-.142-.047l.64-2.593c.018-.295-.082-.667-.64-.807.02-.014-1-.25-1-.25l.367-1.48 1.898.476-.002.008q.43.106.88.207L9.922 2.5zM8.588 13.93c.933.233 3.81 1.164 4.236-.557.444-1.795-2.547-2.26-3.48-2.495zM9.69 9.483c.778.195 3.172.99 3.56-.575.404-1.634-2.098-1.998-2.875-2.193z"})})}function Bn(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 12",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M2.463 8.78a.44.44 0 0 1 .311-.129H13.5a.22.22 0 0 1 .156.376l-2.119 2.124a.44.44 0 0 1-.311.129H.5a.22.22 0 0 1-.156-.377zm0-7.932A.45.45 0 0 1 2.774.72H13.5a.221.221 0 0 1 .156.376L11.536 3.22a.44.44 0 0 1-.311.13H.5a.22.22 0 0 1-.156-.377zm9.074 3.941a.44.44 0 0 0-.311-.13H.5a.22.22 0 0 0-.156.377l2.12 2.124a.44.44 0 0 0 .31.129H13.5a.221.221 0 0 0 .156-.376z"})})}function zn(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 22",width:"20",height:"20",...e,children:[s.jsx("path",{fill:"currentColor",d:"M6.998 0 .5 11.204l6.498-3.069zM6.998 8.136.5 11.205l6.498 3.992z"}),s.jsx("path",{fill:"currentColor",d:"M13.496 11.204 6.997 0v8.135z"}),s.jsx("path",{fill:"currentColor",d:"m6.997 15.197 6.499-3.992-6.499-3.07zM.5 12.484 6.998 22v-5.526z"}),s.jsx("path",{fill:"currentColor",d:"M6.997 16.474V22l6.502-9.516z"})]})}function Wn(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M11.984 21.5c4.98 0 9.016-4.03 9.016-9s-4.036-9-9.016-9C7.26 3.5 3.385 7.127 3 11.743h11.917v1.514H3c.385 4.616 4.26 8.243 8.984 8.243"})})}function Vn(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:[s.jsxs("g",{fill:"currentColor",fillOpacity:.48,clipPath:"url(#arb_a)",children:[s.jsx("path",{d:"m12.089 14.49 2.278 3.68 2.105-1.255-2.992-4.852zM18.389 15.439l-.002-1.006-3.27-5.24-1.213 2.119 3.157 5.251 1.14-.68a.53.53 0 0 0 .188-.379zM4.688 16.387l1.611.956 5.363-8.85-.91-.024c-.776-.011-1.611.196-1.994.84l-3.046 4.857-1.024 1.62zM14.758 8.494l-2.4.009-5.426 9.214 1.897 1.123.515-.9z"}),s.jsx("path",{d:"M19.4 8.481a1.58 1.58 0 0 0-.718-1.264L12.72 3.69a1.51 1.51 0 0 0-1.368 0c-.05.026-5.8 3.456-5.8 3.456a1.572 1.572 0 0 0-.863 1.333v7.307l1.024-1.62-.009-5.638.007-.06a.52.52 0 0 1 .204-.332c.027-.02 5.875-3.502 5.893-3.512a.5.5 0 0 1 .45-.002l5.887 3.484c.139.091.226.246.234.415v6.984a.52.52 0 0 1-.176.38l-1.141.68-.589.35-2.105 1.256-2.134 1.272a.5.5 0 0 1-.364-.007L9.345 17.94l-.516.9 2.27 1.344.36.207c.161.08.393.127.602.127q.29 0 .556-.108l6.2-3.693c.355-.284.565-.712.584-1.175z"})]}),s.jsx("defs",{children:s.jsx("clipPath",{id:"arb_a",children:s.jsx("path",{fill:"currentColor",d:"M4 3h16v18H4z"})})})]})}function Un(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M7.245 16.646q-1.431 0-2.343-.672C4.301 15.52 4 14.867 4 14.03c0-.18.02-.39.058-.647q.154-.862.441-2.08Q5.317 8 8.717 8c.614 0 1.171.102 1.657.314q.73.298 1.152.915.423.604.423 1.44 0 .249-.058.633a26 26 0 0 1-.435 2.08c-.282 1.095-.762 1.92-1.453 2.464-.685.538-1.606.8-2.758.8m.173-1.728c.448 0 .825-.134 1.139-.396q.481-.393.685-1.216c.185-.756.326-1.408.422-1.972q.05-.25.051-.518.002-1.094-1.139-1.094-.672.001-1.152.396-.471.393-.672 1.216c-.147.538-.288 1.19-.435 1.972q-.05.238-.051.505c-.007.743.384 1.107 1.152 1.107M12.506 16.531c-.09 0-.154-.025-.205-.083-.038-.064-.051-.134-.038-.218l1.657-7.808a.32.32 0 0 1 .135-.217.35.35 0 0 1 .23-.083h3.194q1.333.001 2.137.55c.544.371.82.902.82 1.6 0 .198-.026.41-.071.627-.198.922-.602 1.6-1.216 2.042q-.902.66-2.477.659h-1.619l-.55 2.63a.34.34 0 0 1-.135.218.35.35 0 0 1-.23.083zm4.25-4.589c.339 0 .627-.09.876-.275q.383-.277.506-.793.038-.203.038-.359c0-.23-.07-.41-.205-.531-.134-.128-.37-.192-.697-.192h-1.44l-.455 2.15z"})})}function Hn(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:[s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m4.913 12.5.011 3.868 3.286 1.935v2.264L3 17.511V11.37zm0-3.868v2.254L3 9.754V7.5l1.913-1.133L6.836 7.5zM9.582 7.5l1.913-1.133L13.418 7.5l-1.923 1.132z"}),s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M6.297 15.567v-2.265l1.913 1.132v2.254zm3.285 3.547 1.914 1.132 1.923-1.132v2.254L11.496 22.5l-1.914-1.132zM16.163 7.5l1.913-1.133L20 7.5v2.254l-1.923 1.132V8.632zm1.913 8.868.011-3.868L20 11.368v6.142l-5.208 3.056v-2.265z"}),s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m16.704 15.567-1.914 1.122v-2.254l1.913-1.133z"}),s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m16.704 9.434.01 2.264-3.294 1.934v3.878l-1.913 1.122-1.914-1.122v-3.878l-3.295-1.934V9.434L8.22 8.3l3.275 1.944L14.79 8.3l1.922 1.133zM6.297 5.566 11.496 2.5l5.208 3.066L14.791 6.7l-3.295-1.944L8.21 6.7z"})]})}const Qr={bitcoin:$n,solana:Bn,ethereum:zn,base:Wn,arbitrum:Vn,optimism:Un,bsc:Hn};function Ba(e){if(!e)return null;const t=e.toLowerCase().replace(/[\s_-]/g,"");return t in Qr?Qr[t]:t.includes("bitcoin")||t.includes("btc")?$n:t.includes("solana")||t.includes("sol")?Bn:t.includes("ethereum")||t.includes("eth")||t.includes("erc20")?zn:t.includes("base")?Wn:t.includes("arbitrum")||t.includes("arb")?Vn:t.includes("optimism")||t.includes("op")?Un:t.includes("bsc")||t.includes("binance")||t.includes("bnb")?Hn:null}function za(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Wa({icon:e,label:t,address:r,className:n=""}){const[o,a]=p.useState(!1),l=p.useCallback(async()=>{try{await navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),2e3)}catch{console.error("Failed to copy")}},[r]);return s.jsxs("div",{className:`flex items-center justify-between px-4 py-3 ${n}`,children:[s.jsxs("div",{className:"flex items-center gap-2 text-[var(--optimex-text-secondary)]",children:[s.jsx(e,{className:"size-4"}),s.jsx("span",{className:"text-sm",children:t})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:za(r)}),s.jsx("button",{onClick:l,className:"p-1 rounded hover:bg-[var(--optimex-surface-hover)] transition-colors",title:o?"Copied!":"Copy",children:o?s.jsx(gr,{className:"size-4 text-[var(--optimex-success)]"}):s.jsx(Oa,{className:"size-4 text-[var(--optimex-text-secondary)]"})})]})]})}const Va={primary:"bg-[var(--optimex-primary)] text-black hover:brightness-110 shadow-lg shadow-[var(--optimex-primary)]/30",secondary:"bg-[var(--optimex-surface)] text-[var(--optimex-text)] hover:bg-white/10 border border-white/10",ghost:"bg-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]",danger:"bg-[var(--optimex-error)] text-white hover:bg-[var(--optimex-error)]/90 hover:shadow-lg hover:shadow-[var(--optimex-error)]/25"},Ua={sm:"px-3 py-1.5 text-xs rounded-[var(--optimex-radius-button)] gap-1.5 max-h-[2rem]",md:"px-4 py-2 text-sm rounded-[var(--optimex-radius-button)] gap-2 max-h-[2.5rem]",lg:"px-6 py-3 text-sm rounded-[var(--optimex-radius-button)] gap-2 max-h-[3rem]"};function qn({variant:e="primary",size:t="md",fullWidth:r=!1,isLoading:n=!1,leftIcon:o,rightIcon:a,children:l,className:i="",disabled:c,...u}){const d=c||n;return s.jsxs("button",{className:`
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.optx-widget .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.optx-widget .fixed{position:fixed}.optx-widget .absolute{position:absolute}.optx-widget .relative{position:relative}.optx-widget .inset-0{inset:0}.optx-widget .inset-2{inset:.5rem}.optx-widget .inset-x-0{left:0;right:0}.optx-widget .-bottom-1{bottom:-.25rem}.optx-widget .-bottom-2{bottom:-.5rem}.optx-widget .-right-1{right:-.25rem}.optx-widget .-top-2{top:-.5rem}.optx-widget .bottom-0{bottom:0}.optx-widget .bottom-full{bottom:100%}.optx-widget .left-0{left:0}.optx-widget .left-1\\/2{left:50%}.optx-widget .left-3{left:.75rem}.optx-widget .left-4{left:1rem}.optx-widget .right-0{right:0}.optx-widget .right-3{right:.75rem}.optx-widget .right-4{right:1rem}.optx-widget .top-1\\/2{top:50%}.optx-widget .top-full{top:100%}.optx-widget .z-10{z-index:10}.optx-widget .z-50{z-index:50}.optx-widget .z-\\[9999\\]{z-index:9999}.optx-widget .\\!m-0{margin:0!important}.optx-widget .-my-4{margin-top:-1rem;margin-bottom:-1rem}.optx-widget .mx-auto{margin-left:auto;margin-right:auto}.optx-widget .mb-1{margin-bottom:.25rem}.optx-widget .mb-2{margin-bottom:.5rem}.optx-widget .mb-3{margin-bottom:.75rem}.optx-widget .mb-4{margin-bottom:1rem}.optx-widget .mb-6{margin-bottom:1.5rem}.optx-widget .ml-2{margin-left:.5rem}.optx-widget .ml-3{margin-left:.75rem}.optx-widget .ml-auto{margin-left:auto}.optx-widget .mt-1{margin-top:.25rem}.optx-widget .mt-2{margin-top:.5rem}.optx-widget .mt-24{margin-top:6rem}.optx-widget .mt-3{margin-top:.75rem}.optx-widget .mt-4{margin-top:1rem}.optx-widget .mt-auto{margin-top:auto}.optx-widget .block{display:block}.optx-widget .inline-block{display:inline-block}.optx-widget .flex{display:flex}.optx-widget .hidden{display:none}.optx-widget .size-10{width:2.5rem;height:2.5rem}.optx-widget .size-12{width:3rem;height:3rem}.optx-widget .size-2{width:.5rem;height:.5rem}.optx-widget .size-20{width:5rem;height:5rem}.optx-widget .size-3{width:.75rem;height:.75rem}.optx-widget .size-4{width:1rem;height:1rem}.optx-widget .size-5{width:1.25rem;height:1.25rem}.optx-widget .size-8{width:2rem;height:2rem}.optx-widget .h-1\\.5{height:.375rem}.optx-widget .h-10{height:2.5rem}.optx-widget .h-12{height:3rem}.optx-widget .h-14{height:3.5rem}.optx-widget .h-16{height:4rem}.optx-widget .h-2{height:.5rem}.optx-widget .h-3{height:.75rem}.optx-widget .h-3\\.5{height:.875rem}.optx-widget .h-4{height:1rem}.optx-widget .h-5{height:1.25rem}.optx-widget .h-6{height:1.5rem}.optx-widget .h-8{height:2rem}.optx-widget .h-auto{height:auto}.optx-widget .h-full{height:100%}.optx-widget .max-h-\\[2\\.5rem\\]{max-height:2.5rem}.optx-widget .max-h-\\[2rem\\]{max-height:2rem}.optx-widget .max-h-\\[3rem\\]{max-height:3rem}.optx-widget .max-h-\\[5rem\\]{max-height:5rem}.optx-widget .max-h-\\[600px\\]{max-height:600px}.optx-widget .max-h-\\[60vh\\]{max-height:60vh}.optx-widget .max-h-\\[85vh\\]{max-height:85vh}.optx-widget .max-h-\\[96vh\\]{max-height:96vh}.optx-widget .w-1\\/3{width:33.333333%}.optx-widget .w-10{width:2.5rem}.optx-widget .w-12{width:3rem}.optx-widget .w-14{width:3.5rem}.optx-widget .w-16{width:4rem}.optx-widget .w-20{width:5rem}.optx-widget .w-24{width:6rem}.optx-widget .w-28{width:7rem}.optx-widget .w-3{width:.75rem}.optx-widget .w-3\\.5{width:.875rem}.optx-widget .w-32{width:8rem}.optx-widget .w-4{width:1rem}.optx-widget .w-48{width:12rem}.optx-widget .w-5{width:1.25rem}.optx-widget .w-6{width:1.5rem}.optx-widget .w-72{width:18rem}.optx-widget .w-8{width:2rem}.optx-widget .w-96{width:24rem}.optx-widget .w-auto{width:auto}.optx-widget .w-full{width:100%}.optx-widget .min-w-0{min-width:0px}.optx-widget .min-w-\\[140px\\]{min-width:140px}.optx-widget .max-w-2xl{max-width:42rem}.optx-widget .max-w-\\[280px\\]{max-width:280px}.optx-widget .max-w-\\[calc\\(100\\%-2rem\\)\\]{max-width:calc(100% - 2rem)}.optx-widget .max-w-md{max-width:28rem}.optx-widget .flex-1{flex:1 1 0%}.optx-widget .flex-shrink-0,.optx-widget .shrink-0{flex-shrink:0}.optx-widget .-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.optx-widget .animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.optx-widget .animate-spin{animation:spin 1s linear infinite}.optx-widget .cursor-not-allowed{cursor:not-allowed}.optx-widget .cursor-pointer{cursor:pointer}.optx-widget .resize{resize:both}.optx-widget .flex-col{flex-direction:column}.optx-widget .flex-wrap{flex-wrap:wrap}.optx-widget .items-end{align-items:flex-end}.optx-widget .items-center{align-items:center}.optx-widget .justify-end{justify-content:flex-end}.optx-widget .justify-center{justify-content:center}.optx-widget .justify-between{justify-content:space-between}.optx-widget .gap-0\\.5{gap:.125rem}.optx-widget .gap-1{gap:.25rem}.optx-widget .gap-1\\.5{gap:.375rem}.optx-widget .gap-2{gap:.5rem}.optx-widget .gap-3{gap:.75rem}.optx-widget .gap-4{gap:1rem}.optx-widget :is(.space-y-1>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.optx-widget :is(.space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.optx-widget :is(.space-y-3>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.optx-widget :is(.divide-y>:not([hidden])~:not([hidden])){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.optx-widget :is(.divide-\\[var\\(--optimex-border\\)\\]>:not([hidden])~:not([hidden])){border-color:var(--optimex-border)}.optx-widget .overflow-auto{overflow:auto}.optx-widget .overflow-hidden{overflow:hidden}.optx-widget .overflow-y-auto{overflow-y:auto}.optx-widget .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.optx-widget .break-all{word-break:break-all}.optx-widget .rounded{border-radius:.25rem}.optx-widget .rounded-2xl{border-radius:1rem}.optx-widget .rounded-\\[0\\.25rem\\]{border-radius:.25rem}.optx-widget .rounded-\\[9999px\\]{border-radius:9999px}.optx-widget .rounded-\\[var\\(--optimex-overlay-radius\\)\\]{border-radius:var(--optimex-overlay-radius)}.optx-widget .rounded-\\[var\\(--optimex-radius-button\\)\\]{border-radius:var(--optimex-radius-button)}.optx-widget .rounded-\\[var\\(--optimex-radius-input\\)\\]{border-radius:var(--optimex-radius-input)}.optx-widget .rounded-\\[var\\(--optimex-radius-widget\\)\\]{border-radius:var(--optimex-radius-widget)}.optx-widget .rounded-full{border-radius:9999px}.optx-widget .rounded-lg{border-radius:.5rem}.optx-widget .rounded-md{border-radius:.375rem}.optx-widget .rounded-xl{border-radius:.75rem}.optx-widget .rounded-t-\\[var\\(--optimex-overlay-radius\\)\\]{border-top-left-radius:var(--optimex-overlay-radius);border-top-right-radius:var(--optimex-overlay-radius)}.optx-widget .rounded-t-sm{border-top-left-radius:.125rem;border-top-right-radius:.125rem}.optx-widget .border{border-width:1px}.optx-widget .border-2{border-width:2px}.optx-widget .border-4{border-width:4px}.optx-widget .border-b{border-bottom-width:1px}.optx-widget .border-l{border-left-width:1px}.optx-widget .border-r{border-right-width:1px}.optx-widget .border-t{border-top-width:1px}.optx-widget .border-none{border-style:none}.optx-widget .border-\\[var\\(--optimex-background\\)\\]{border-color:var(--optimex-background)}.optx-widget .border-\\[var\\(--optimex-border\\)\\]{border-color:var(--optimex-border)}.optx-widget .border-\\[var\\(--optimex-error\\)\\]{border-color:var(--optimex-error)}.optx-widget .border-\\[var\\(--optimex-primary\\)\\]{border-color:var(--optimex-primary)}.optx-widget .border-\\[var\\(--optimex-surface\\)\\]{border-color:var(--optimex-surface)}.optx-widget .border-current{border-color:currentColor}.optx-widget .border-transparent{border-color:transparent}.optx-widget .border-white\\/10{border-color:#ffffff1a}.optx-widget .border-white\\/5{border-color:#ffffff0d}.optx-widget .border-white\\/\\[0\\.02\\]{border-color:#ffffff05}.optx-widget .border-white\\/\\[0\\.05\\]{border-color:#ffffff0d}.optx-widget .border-t-transparent{border-top-color:transparent}.optx-widget .bg-\\[rgba\\(239\\,68\\,68\\,0\\.15\\)\\]{background-color:#ef444426}.optx-widget .bg-\\[rgba\\(34\\,197\\,94\\,0\\.15\\)\\]{background-color:#22c55e26}.optx-widget .bg-\\[rgba\\(59\\,130\\,246\\,0\\.15\\)\\]{background-color:#3b82f626}.optx-widget .bg-\\[var\\(--optimex-background\\)\\]{background-color:var(--optimex-background)}.optx-widget .bg-\\[var\\(--optimex-border\\)\\]{background-color:var(--optimex-border)}.optx-widget .bg-\\[var\\(--optimex-error\\)\\]{background-color:var(--optimex-error)}.optx-widget .bg-\\[var\\(--optimex-overlay-background\\)\\]{background-color:var(--optimex-overlay-background)}.optx-widget .bg-\\[var\\(--optimex-primary\\)\\]{background-color:var(--optimex-primary)}.optx-widget .bg-\\[var\\(--optimex-surface\\)\\]{background-color:var(--optimex-surface)}.optx-widget .bg-\\[var\\(--optimex-surface-hover\\)\\]{background-color:var(--optimex-surface-hover)}.optx-widget .bg-black\\/60{background-color:#0009}.optx-widget .bg-blue-500\\/20{background-color:#3b82f633}.optx-widget .bg-green-500\\/10{background-color:#22c55e1a}.optx-widget .bg-orange-500\\/20{background-color:#f9731633}.optx-widget .bg-purple-500\\/20{background-color:#a855f733}.optx-widget .bg-red-500\\/10{background-color:#ef44441a}.optx-widget .bg-transparent{background-color:transparent}.optx-widget .bg-white\\/10{background-color:#ffffff1a}.optx-widget .bg-white\\/20{background-color:#fff3}.optx-widget .bg-white\\/5{background-color:#ffffff0d}.optx-widget .bg-white\\/\\[0\\.02\\]{background-color:#ffffff05}.optx-widget .bg-yellow-500\\/10{background-color:#eab3081a}.optx-widget .bg-zinc-900\\/50{background-color:#18181b80}.optx-widget .stroke-\\[var\\(--optimex-error\\)\\]{stroke:var(--optimex-error)}.optx-widget .p-0{padding:0}.optx-widget .p-1{padding:.25rem}.optx-widget .p-1\\.5{padding:.375rem}.optx-widget .p-2{padding:.5rem}.optx-widget .p-3{padding:.75rem}.optx-widget .p-4{padding:1rem}.optx-widget .p-6{padding:1.5rem}.optx-widget .px-1\\.5{padding-left:.375rem;padding-right:.375rem}.optx-widget .px-2{padding-left:.5rem;padding-right:.5rem}.optx-widget .px-2\\.5{padding-left:.625rem;padding-right:.625rem}.optx-widget .px-3{padding-left:.75rem;padding-right:.75rem}.optx-widget .px-4{padding-left:1rem;padding-right:1rem}.optx-widget .px-6{padding-left:1.5rem;padding-right:1.5rem}.optx-widget .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.optx-widget .py-1{padding-top:.25rem;padding-bottom:.25rem}.optx-widget .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.optx-widget .py-12{padding-top:3rem;padding-bottom:3rem}.optx-widget .py-2{padding-top:.5rem;padding-bottom:.5rem}.optx-widget .py-3{padding-top:.75rem;padding-bottom:.75rem}.optx-widget .py-4{padding-top:1rem;padding-bottom:1rem}.optx-widget .py-8{padding-top:2rem;padding-bottom:2rem}.optx-widget .py-\\[6px\\]{padding-top:6px;padding-bottom:6px}.optx-widget .pb-3{padding-bottom:.75rem}.optx-widget .pb-4{padding-bottom:1rem}.optx-widget .pl-10{padding-left:2.5rem}.optx-widget .pl-2{padding-left:.5rem}.optx-widget .pr-10{padding-right:2.5rem}.optx-widget .pr-3{padding-right:.75rem}.optx-widget .pt-2{padding-top:.5rem}.optx-widget .pt-3{padding-top:.75rem}.optx-widget .text-left{text-align:left}.optx-widget .text-center{text-align:center}.optx-widget .text-2xl{font-size:1.5rem;line-height:2rem}.optx-widget .text-\\[10px\\]{font-size:10px}.optx-widget .text-base{font-size:1rem;line-height:1.5rem}.optx-widget .text-lg{font-size:1.125rem;line-height:1.75rem}.optx-widget .text-sm{font-size:.875rem;line-height:1.25rem}.optx-widget .text-xl{font-size:1.25rem;line-height:1.75rem}.optx-widget .text-xs{font-size:.75rem;line-height:1rem}.optx-widget .font-bold{font-weight:700}.optx-widget .font-medium{font-weight:500}.optx-widget .font-semibold{font-weight:600}.optx-widget .uppercase{text-transform:uppercase}.optx-widget .leading-none{line-height:1}.optx-widget .tracking-tight{letter-spacing:-.025em}.optx-widget .tracking-wider{letter-spacing:.05em}.optx-widget .text-\\[var\\(--optimex-error\\)\\]{color:var(--optimex-error)}.optx-widget .text-\\[var\\(--optimex-primary\\)\\]{color:var(--optimex-primary)}.optx-widget .text-\\[var\\(--optimex-success\\)\\]{color:var(--optimex-success)}.optx-widget .text-\\[var\\(--optimex-text\\)\\]{color:var(--optimex-text)}.optx-widget .text-\\[var\\(--optimex-text-secondary\\)\\]{color:var(--optimex-text-secondary)}.optx-widget .text-\\[var\\(--optimex-warning\\)\\]{color:var(--optimex-warning)}.optx-widget .text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.optx-widget .text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.optx-widget .text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.optx-widget .text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.optx-widget .text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.optx-widget .text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.optx-widget .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.optx-widget .text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.optx-widget .text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.optx-widget .text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.optx-widget .opacity-0{opacity:0}.optx-widget .opacity-50{opacity:.5}.optx-widget .opacity-70{opacity:.7}.optx-widget .shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_15px_rgba\\(235\\,98\\,0\\,0\\.1\\)\\]{--tw-shadow: 0 0 15px rgba(235,98,0,.1);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_15px_rgba\\(235\\,98\\,0\\,0\\.3\\)\\]{--tw-shadow: 0 0 15px rgba(235,98,0,.3);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_8px_rgba\\(235\\,98\\,0\\,0\\.8\\)\\]{--tw-shadow: 0 0 8px rgba(235,98,0,.8);--tw-shadow-colored: 0 0 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .outline-none{outline:2px solid transparent;outline-offset:2px}.optx-widget .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)}.optx-widget .backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-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)}.optx-widget .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .duration-200{transition-duration:.2s}.optx-widget .duration-300{transition-duration:.3s}.optx-widget{isolation:isolate;width:100%;min-width:0;max-width:100%;--optimex-primary: #ed6300;--optimex-background: hsla(0, 0%, 100%, .04);--optimex-surface: hsla(0, 0%, 0%, .2);--optimex-text: #ffffff;--optimex-text-secondary: hsla(0, 0%, 100%, .48);--optimex-error: #ff4d4f;--optimex-success: #52c41a;--optimex-overlay-background: #1a1a1a;--optimex-overlay-radius: .75rem;--optimex-radius-widget: 1rem;--optimex-radius-input: .75rem;--optimex-radius-button: .5rem;--optimex-font-family: "Inter", sans-serif;--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;font-family:var(--optimex-font-family);font-size:14px;line-height:1.5;color:var(--optimex-text);text-align:left;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.optx-widget .widget-container{background:var(--optimex-background);border:1px solid rgba(255,255,255,.05);border-radius:var(--optimex-radius-widget);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);width:100%;min-width:0;max-width:100%;box-sizing:border-box}.optx-widget *,.optx-widget *:before,.optx-widget *:after{box-sizing:border-box}.optx-widget button{font-family:inherit;line-height:inherit;margin:0;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.optx-widget input,.optx-widget select,.optx-widget textarea{font-family:inherit;line-height:inherit;margin:0}.optx-widget a{color:inherit;text-decoration:none}.optx-widget ul,.optx-widget ol{list-style:none;margin:0;padding:0}.optx-widget img{max-width:100%;height:auto}.optx-widget svg{display:inline-block;vertical-align:middle}.optx-widget .glow-orange{box-shadow:inset 0 0 15px #eb620026,0 0 20px #eb62001a}.optx-widget .glow-green{box-shadow:0 0 12px #22c55e33}.optx-widget .glow-red{box-shadow:0 0 12px #ef444433}@keyframes optx-status-pulse{0%,to{opacity:1}50%{opacity:.5}}.optx-widget .status-pulse{animation:optx-status-pulse 2s cubic-bezier(.4,0,.6,1) infinite}.optx-widget .placeholder\\:text-\\[var\\(--optimex-text-secondary\\)\\]::-moz-placeholder{color:var(--optimex-text-secondary)}.optx-widget .placeholder\\:text-\\[var\\(--optimex-text-secondary\\)\\]::placeholder{color:var(--optimex-text-secondary)}.optx-widget .focus-within\\:border-\\[var\\(--optimex-primary\\)\\]:focus-within{border-color:var(--optimex-primary)}.optx-widget .hover\\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .hover\\:border-\\[var\\(--optimex-primary\\)\\]:hover{border-color:var(--optimex-primary)}.optx-widget .hover\\:bg-\\[rgba\\(239\\,68\\,68\\,0\\.2\\)\\]:hover{background-color:#ef444433}.optx-widget .hover\\:bg-\\[var\\(--optimex-primary-hover\\)\\]:hover{background-color:var(--optimex-primary-hover)}.optx-widget .hover\\:bg-\\[var\\(--optimex-surface-hover\\)\\]:hover{background-color:var(--optimex-surface-hover)}.optx-widget .hover\\:bg-white\\/10:hover{background-color:#ffffff1a}.optx-widget .hover\\:bg-white\\/5:hover{background-color:#ffffff0d}.optx-widget .hover\\:bg-white\\/\\[0\\.02\\]:hover{background-color:#ffffff05}.optx-widget .hover\\:text-\\[var\\(--optimex-primary\\)\\]:hover{color:var(--optimex-primary)}.optx-widget .hover\\:text-\\[var\\(--optimex-text\\)\\]:hover{color:var(--optimex-text)}.optx-widget .hover\\:text-\\[var\\(--optimex-text-secondary\\)\\]:hover{color:var(--optimex-text-secondary)}.optx-widget .hover\\:opacity-100:hover{opacity:1}.optx-widget .hover\\:opacity-70:hover{opacity:.7}.optx-widget .hover\\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .hover\\:brightness-110:hover{--tw-brightness: brightness(1.1);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)}.optx-widget .focus\\:border-\\[var\\(--optimex-primary\\)\\]:focus{border-color:var(--optimex-primary)}.optx-widget .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.optx-widget .focus\\:ring-0:focus{--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(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.optx-widget .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .active\\:scale-\\[0\\.98\\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.optx-widget .disabled\\:opacity-50:disabled{opacity:.5}.optx-widget :is(.group:hover .group-hover\\:rotate-180){--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget :is(.group:hover .group-hover\\:opacity-100){opacity:1}@media(min-width:640px){.optx-widget .sm\\:max-w-lg{max-width:32rem}.optx-widget .sm\\:text-left{text-align:left}}@media(min-width:768px){.optx-widget .md\\:h-\\[70vh\\]{height:70vh}}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),p=require("react"),wn=require("react-dom");function Cn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const x=Cn(p),yo=Cn(wn);var it=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Me=typeof window>"u"||"Deno"in globalThis;function ae(){}function wo(e,t){return typeof e=="function"?e(t):e}function er(e){return typeof e=="number"&&e>=0&&e!==1/0}function kn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function He(e,t){return typeof e=="function"?e(t):e}function ce(e,t){return typeof e=="function"?e(t):e}function Lr(e,t){const{type:r="all",exact:n,fetchStatus:o,predicate:a,queryKey:l,stale:i}=e;if(l){if(n){if(t.queryHash!==mr(l,t.options))return!1}else if(!st(t.queryKey,l))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||o&&o!==t.state.fetchStatus||a&&!a(t))}function Dr(e,t){const{exact:r,status:n,predicate:o,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(nt(t.options.mutationKey)!==nt(a))return!1}else if(!st(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||o&&!o(t))}function mr(e,t){return(t?.queryKeyHashFn||nt)(e)}function nt(e){return JSON.stringify(e,(t,r)=>nr(r)?Object.keys(r).sort().reduce((n,o)=>(n[o]=r[o],n),{}):r)}function st(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(r=>!st(e[r],t[r])):!1}function tr(e,t){if(e===t)return e;const r=Fr(e)&&Fr(t);if(r||nr(e)&&nr(t)){const n=r?e:Object.keys(e),o=n.length,a=r?t:Object.keys(t),l=a.length,i=r?[]:{};let c=0;for(let u=0;u<l;u++){const d=r?u:a[u];(!r&&n.includes(d)||r)&&e[d]===void 0&&t[d]===void 0?(i[d]=void 0,c++):(i[d]=tr(e[d],t[d]),i[d]===e[d]&&e[d]!==void 0&&c++)}return o===l&&c===o?e:i}return t}function rr(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Fr(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function nr(e){if(!$r(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!$r(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $r(e){return Object.prototype.toString.call(e)==="[object Object]"}function Co(e){return new Promise(t=>{setTimeout(t,e)})}function sr(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return tr(e,t)}catch(n){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`)}return tr(e,t)}return t}function ko(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function jo(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var jt=Symbol();function jn(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===jt&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===jt?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var So=class extends it{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!Me&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},pr=new So,Eo=class extends it{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!Me&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#t}},St=new Eo;function or(){let e,t;const r=new Promise((o,a)=>{e=o,t=a});r.status="pending",r.catch(()=>{});function n(o){Object.assign(r,o),delete r.resolve,delete r.reject}return r.resolve=o=>{n({status:"fulfilled",value:o}),e(o)},r.reject=o=>{n({status:"rejected",reason:o}),t(o)},r}function No(e){return Math.min(1e3*2**e,3e4)}function Sn(e){return(e??"online")==="online"?St.isOnline():!0}var En=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function It(e){return e instanceof En}function Nn(e){let t=!1,r=0,n=!1,o;const a=or(),l=h=>{n||(m(new En(h)),e.abort?.())},i=()=>{t=!0},c=()=>{t=!1},u=()=>pr.isFocused()&&(e.networkMode==="always"||St.isOnline())&&e.canRun(),d=()=>Sn(e.networkMode)&&e.canRun(),f=h=>{n||(n=!0,e.onSuccess?.(h),o?.(),a.resolve(h))},m=h=>{n||(n=!0,e.onError?.(h),o?.(),a.reject(h))},b=()=>new Promise(h=>{o=y=>{(n||u())&&h(y)},e.onPause?.()}).then(()=>{o=void 0,n||e.onContinue?.()}),v=()=>{if(n)return;let h;const y=r===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(g){h=Promise.reject(g)}Promise.resolve(h).then(f).catch(g=>{if(n)return;const S=e.retry??(Me?0:3),k=e.retryDelay??No,w=typeof k=="function"?k(r,g):k,N=S===!0||typeof S=="number"&&r<S||typeof S=="function"&&S(r,g);if(t||!N){m(g);return}r++,e.onFail?.(r,g),Co(w).then(()=>u()?void 0:b()).then(()=>{t?m(g):v()})})};return{promise:a,cancel:l,continue:()=>(o?.(),a),cancelRetry:i,continueRetry:c,canStart:d,start:()=>(d()?v():b().then(v),a)}}function To(){let e=[],t=0,r=i=>{i()},n=i=>{i()},o=i=>setTimeout(i,0);const a=i=>{t?e.push(i):o(()=>{r(i)})},l=()=>{const i=e;e=[],i.length&&o(()=>{n(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||l()}return c},batchCalls:i=>(...c)=>{a(()=>{i(...c)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{o=i}}}var te=To(),Tn=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),er(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Me?1/0:300*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},Ro=class extends Tn{#t;#e;#n;#r;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#n=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Oo(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const r=sr(this.state.data,e,this.options);return this.#s({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(ae).catch(ae):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>ce(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===jt||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!kn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const i=this.observers.find(c=>c.options.queryFn);i&&this.setOptions(i.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,n=i=>{Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(this.#o=!0,r.signal)})},o=()=>{const i=jn(this.options,t),c={queryKey:this.queryKey,meta:this.meta};return n(c),this.#o=!1,this.options.persister?this.options.persister(i,c,this):i(c)},a={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};n(a),this.options.behavior?.onFetch(a,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:"fetch",meta:a.fetchOptions?.meta});const l=i=>{It(i)&&i.silent||this.#s({type:"error",error:i}),It(i)||(this.#n.config.onError?.(i,this),this.#n.config.onSettled?.(this.state.data,i,this)),this.scheduleGc()};return this.#r=Nn({initialPromise:t?.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:i=>{if(i===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(i)}catch(c){l(c);return}this.#n.config.onSuccess?.(i,this),this.#n.config.onSettled?.(i,this.state.error,this),this.scheduleGc()},onError:l,onFail:(i,c)=>{this.#s({type:"failed",failureCount:i,error:c})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),this.#r.start()}#s(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Rn(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return It(n)&&n.revert&&this.#e?{...this.#e,fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),te.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Rn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Sn(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Oo(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var _o=class extends it{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,r){const n=t.queryKey,o=t.queryHash??mr(n,t);let a=this.get(o);return a||(a=new Ro({cache:this,queryKey:n,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(a)),a}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){te.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>Lr(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>Lr(e,r)):t}notify(e){te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){te.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){te.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ao=class extends Tn{#t;#e;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||Po(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){this.#n=Nn({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(n,o)=>{this.#r({type:"failed",failureCount:n,error:o})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const t=this.state.status==="pending",r=!this.#n.canStart();try{if(!t){this.#r({type:"pending",variables:e,isPaused:r}),await this.#e.config.onMutate?.(e,this);const o=await this.options.onMutate?.(e);o!==this.state.context&&this.#r({type:"pending",context:o,variables:e,isPaused:r})}const n=await this.#n.start();return await this.#e.config.onSuccess?.(n,e,this.state.context,this),await this.options.onSuccess?.(n,e,this.state.context),await this.#e.config.onSettled?.(n,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(n,null,e,this.state.context),this.#r({type:"success",data:n}),n}catch(n){try{throw await this.#e.config.onError?.(n,e,this.state.context,this),await this.options.onError?.(n,e,this.state.context),await this.#e.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,n,e,this.state.context),n}finally{this.#r({type:"error",error:n})}}finally{this.#e.runNext(this)}}#r(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),te.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function Po(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Mo=class extends it{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(e,t,r){const n=new Ao({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#t.add(e);const t=ft(e);if(typeof t=="string"){const r=this.#e.get(t);r?r.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=ft(e);if(typeof t=="string"){const r=this.#e.get(t);if(r)if(r.length>1){const n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=ft(e);if(typeof t=="string"){const n=this.#e.get(t)?.find(o=>o.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=ft(e);return typeof t=="string"?this.#e.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){te.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>Dr(t,r))}findAll(e={}){return this.getAll().filter(t=>Dr(e,t))}notify(e){te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return te.batch(()=>Promise.all(e.map(t=>t.continue().catch(ae))))}};function ft(e){return e.options.scope?.id}function Br(e){return{onFetch:(t,r)=>{const n=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],l=t.state.data?.pageParams||[];let i={pages:[],pageParams:[]},c=0;const u=async()=>{let d=!1;const f=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?d=!0:t.signal.addEventListener("abort",()=>{d=!0}),t.signal)})},m=jn(t.options,t.fetchOptions),b=async(v,h,y)=>{if(d)return Promise.reject();if(h==null&&v.pages.length)return Promise.resolve(v);const g={queryKey:t.queryKey,pageParam:h,direction:y?"backward":"forward",meta:t.options.meta};f(g);const S=await m(g),{maxPages:k}=t.options,w=y?jo:ko;return{pages:w(v.pages,S,k),pageParams:w(v.pageParams,h,k)}};if(o&&a.length){const v=o==="backward",h=v?Io:zr,y={pages:a,pageParams:l},g=h(n,y);i=await b(y,g,v)}else{const v=e??a.length;do{const h=c===0?l[0]??n.initialPageParam:zr(n,i);if(c>0&&h==null)break;i=await b(i,h),c++}while(c<v)}return i};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function zr(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Io(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Lo=class{#t;#e;#n;#r;#a;#o;#s;#i;constructor(e={}){this.#t=e.queryCache||new _o,this.#e=e.mutationCache||new Mo,this.#n=e.defaultOptions||{},this.#r=new Map,this.#a=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#s=pr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#i=St.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#s?.(),this.#s=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#t.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(He(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),a=this.#t.get(n.queryHash)?.state.data,l=wo(t,a);if(l!==void 0)return this.#t.build(this,n).setData(l,{...r,manual:!0})}setQueriesData(e,t,r){return te.batch(()=>this.#t.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;te.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#t,n={type:"active",...e};return te.batch(()=>(r.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(n,t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=te.batch(()=>this.#t.findAll(e).map(o=>o.cancel(r)));return Promise.all(n).then(ae).catch(ae)}invalidateQueries(e,t={}){return te.batch(()=>{if(this.#t.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none")return Promise.resolve();const r={...e,type:e?.refetchType??e?.type??"active"};return this.refetchQueries(r,t)})}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=te.batch(()=>this.#t.findAll(e).filter(o=>!o.isDisabled()).map(o=>{let a=o.fetch(void 0,r);return r.throwOnError||(a=a.catch(ae)),o.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(ae)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#t.build(this,t);return r.isStaleByTime(He(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ae).catch(ae)}fetchInfiniteQuery(e){return e.behavior=Br(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ae).catch(ae)}ensureInfiniteQueryData(e){return e.behavior=Br(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return St.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(nt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],r={};return t.forEach(n=>{st(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#a.set(nt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#a.values()];let r={};return t.forEach(n=>{st(e,n.mutationKey)&&(r={...r,...n.defaultOptions})}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=mr(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===jt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},Do=class extends it{constructor(e,t){super(),this.options=t,this.#t=e,this.#i=null,this.#s=or(),this.options.experimental_prefetchInRender||this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#n=void 0;#r=void 0;#a;#o;#s;#i;#p;#f;#h;#c;#u;#l;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Wr(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ar(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ar(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#w(),this.#e.removeObserver(this)}setOptions(e,t){const r=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ce(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#e.setOptions(this.options),r._defaulted&&!rr(this.options,r)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const o=this.hasListeners();o&&Vr(this.#e,n,this.options,r)&&this.#d(),this.updateResult(t),o&&(this.#e!==n||ce(this.options.enabled,this.#e)!==ce(r.enabled,this.#e)||He(this.options.staleTime,this.#e)!==He(r.staleTime,this.#e))&&this.#x();const a=this.#v();o&&(this.#e!==n||ce(this.options.enabled,this.#e)!==ce(r.enabled,this.#e)||a!==this.#l)&&this.#g(a)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),r=this.createResult(t,e);return $o(this,r)&&(this.#r=r,this.#o=this.options,this.#a=this.#e.state),r}getCurrentResult(){return this.#r}trackResult(e,t){const r={};return Object.keys(e).forEach(n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(n),t?.(n),e[n])})}),r}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),r=this.#t.getQueryCache().build(this.#t,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#d(e){this.#C();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ae)),t}#x(){this.#y();const e=He(this.options.staleTime,this.#e);if(Me||this.#r.isStale||!er(e))return;const r=kn(this.#r.dataUpdatedAt,e)+1;this.#c=setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#g(e){this.#w(),this.#l=e,!(Me||ce(this.options.enabled,this.#e)===!1||!er(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||pr.isFocused())&&this.#d()},this.#l))}#b(){this.#x(),this.#g(this.#v())}#y(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#e,n=this.options,o=this.#r,a=this.#a,l=this.#o,c=e!==r?e.state:this.#n,{state:u}=e;let d={...u},f=!1,m;if(t._optimisticResults){const C=this.hasListeners(),j=!C&&Wr(e,t),O=C&&Vr(e,r,t,n);(j||O)&&(d={...d,...Rn(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:b,errorUpdatedAt:v,status:h}=d;if(t.select&&d.data!==void 0)if(o&&d.data===a?.data&&t.select===this.#p)m=this.#f;else try{this.#p=t.select,m=t.select(d.data),m=sr(o?.data,m,t),this.#f=m,this.#i=null}catch(C){this.#i=C}else m=d.data;if(t.placeholderData!==void 0&&m===void 0&&h==="pending"){let C;if(o?.isPlaceholderData&&t.placeholderData===l?.placeholderData)C=o.data;else if(C=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,t.select&&C!==void 0)try{C=t.select(C),this.#i=null}catch(j){this.#i=j}C!==void 0&&(h="success",m=sr(o?.data,C,t),f=!0)}this.#i&&(b=this.#i,m=this.#f,v=Date.now(),h="error");const y=d.fetchStatus==="fetching",g=h==="pending",S=h==="error",k=g&&y,w=m!==void 0,A={status:h,fetchStatus:d.fetchStatus,isPending:g,isSuccess:h==="success",isError:S,isInitialLoading:k,isLoading:k,data:m,dataUpdatedAt:d.dataUpdatedAt,error:b,errorUpdatedAt:v,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:y,isRefetching:y&&!g,isLoadingError:S&&!w,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&w,isStale:xr(e,t),refetch:this.refetch,promise:this.#s};if(this.options.experimental_prefetchInRender){const C=D=>{A.status==="error"?D.reject(A.error):A.data!==void 0&&D.resolve(A.data)},j=()=>{const D=this.#s=A.promise=or();C(D)},O=this.#s;switch(O.status){case"pending":e.queryHash===r.queryHash&&C(O);break;case"fulfilled":(A.status==="error"||A.data!==O.value)&&j();break;case"rejected":(A.status!=="error"||A.error!==O.reason)&&j();break}}return A}updateResult(e){const t=this.#r,r=this.createResult(this.#e,this.options);if(this.#a=this.#e.state,this.#o=this.options,this.#a.data!==void 0&&(this.#h=this.#e),rr(r,t))return;this.#r=r;const n={},o=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,l=typeof a=="function"?a():a;if(l==="all"||!l&&!this.#m.size)return!0;const i=new Set(l??this.#m);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(c=>{const u=c;return this.#r[u]!==t[u]&&i.has(u)})};e?.listeners!==!1&&o()&&(n.listeners=!0),this.#k({...n,...e})}#C(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(e){te.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function Fo(e,t){return ce(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Wr(e,t){return Fo(e,t)||e.state.data!==void 0&&ar(e,t,t.refetchOnMount)}function ar(e,t,r){if(ce(t.enabled,e)!==!1){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&xr(e,t)}return!1}function Vr(e,t,r,n){return(e!==t||ce(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&xr(e,r)}function xr(e,t){return ce(t.enabled,e)!==!1&&e.isStaleByTime(He(t.staleTime,e))}function $o(e,t){return!rr(e.getCurrentResult(),t)}var On=x.createContext(void 0),Bo=e=>{const t=x.useContext(On);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},zo=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(On.Provider,{value:e,children:t})),_n=x.createContext(!1),Wo=()=>x.useContext(_n);_n.Provider;function Vo(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Uo=x.createContext(Vo()),Ho=()=>x.useContext(Uo);function qo(e,t){return typeof e=="function"?e(...t):!!e}function Ur(){}var Qo=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Ko=e=>{x.useEffect(()=>{e.clearReset()},[e])},Go=({result:e,errorResetBoundary:t,throwOnError:r,query:n})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&qo(r,[e.error,n]),Yo=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...r)=>Math.max(t(...r),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Zo=(e,t)=>e.isLoading&&e.isFetching&&!t,Xo=(e,t)=>e?.suspense&&t.isPending,Hr=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Jo(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Bo(),o=Wo(),a=Ho(),l=n.defaultQueryOptions(e);n.getDefaultOptions().queries?._experimental_beforeQuery?.(l),l._optimisticResults=o?"isRestoring":"optimistic",Yo(l),Qo(l,a),Ko(a);const i=!n.getQueryCache().get(l.queryHash),[c]=x.useState(()=>new t(n,l)),u=c.getOptimisticResult(l),d=!o&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(f=>{const m=d?c.subscribe(te.batchCalls(f)):Ur;return c.updateResult(),m},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),x.useEffect(()=>{c.setOptions(l,{listeners:!1})},[l,c]),Xo(l,u))throw Hr(l,c,a);if(Go({result:u,errorResetBoundary:a,throwOnError:l.throwOnError,query:n.getQueryCache().get(l.queryHash)}))throw u.error;return n.getDefaultOptions().queries?._experimental_afterQuery?.(l,u),l.experimental_prefetchInRender&&!Me&&Zo(u,o)&&(i?Hr(l,c,a):n.getQueryCache().get(l.queryHash)?.promise)?.catch(Ur).finally(()=>{c.updateResult()}),l.notifyOnChangeProps?u:c.trackResult(u)}function Qe(e,t){return Jo(e,Do)}const ea={widget:"1rem",input:"0.75rem",button:"0.5rem"},ta={primary:"#ffffff",secondary:"hsla(0, 0%, 100%, 0.48)"},ra={background:"#343b47",radius:"0.75rem"},oe={colors:{primary:"#ed6300",background:"hsla(0, 0%, 100%, 0.04)",surface:"hsla(0, 0%, 0%, 0.2)",text:ta,error:"#ff4d4f",success:"#52c41a"},radius:ea,overlay:ra,fontFamily:"'Inter', sans-serif"},na=p.createContext(null);function sa({children:e,theme:t}){const r=p.useMemo(()=>t?{colors:{primary:t.colors?.primary??oe.colors.primary,background:t.colors?.background??oe.colors.background,surface:t.colors?.surface??oe.colors.surface,text:{primary:t.colors?.text?.primary??oe.colors.text.primary,secondary:t.colors?.text?.secondary??oe.colors.text.secondary},error:t.colors?.error??oe.colors.error,success:t.colors?.success??oe.colors.success},radius:{widget:t.radius?.widget??oe.radius.widget,input:t.radius?.input??oe.radius.input,button:t.radius?.button??oe.radius.button},overlay:{background:t.overlay?.background??oe.overlay.background,radius:t.overlay?.radius??oe.overlay.radius},fontFamily:t.fontFamily??oe.fontFamily}:oe,[t]),n=p.useMemo(()=>({"--optimex-primary":r.colors.primary,"--optimex-background":r.colors.background,"--optimex-surface":r.colors.surface,"--optimex-text":r.colors.text.primary,"--optimex-text-secondary":r.colors.text.secondary,"--optimex-error":r.colors.error,"--optimex-success":r.colors.success,"--optimex-radius-widget":r.radius.widget,"--optimex-radius-input":r.radius.input,"--optimex-radius-button":r.radius.button,"--optimex-overlay-background":r.overlay.background,"--optimex-overlay-radius":r.overlay.radius,"--optimex-font-family":r.fontFamily}),[r]);return s.jsx(na.Provider,{value:{theme:r},children:s.jsx("div",{style:n,className:"w-full",children:e})})}const An=p.createContext(null);function oa({children:e,externalWalletClient:t,onRequestWallet:r}){const n=p.useMemo(()=>{const o=t?.evm?.address??null,a=t?.evm?.chain?.id??null,l=t?.btc?.address??null,i=t?.btc?.publicKey??null,c=t?.solana?.address??null,u=!!o,d=!!l,f=!!c;return{mode:"external",isExternalWallet:!0,isConnected:u||d||f,evmAddress:o,evmChainId:a,isEvmConnected:u,btcAddress:l,btcPublicKey:i,isBtcConnected:d,solanaAddress:c,isSolanaConnected:f,externalWalletClient:t,onRequestWallet:r,isConnecting:!1}},[t,r]);return s.jsx(An.Provider,{value:n,children:e})}class Lt extends Error{status;code;constructor(t,r,n){super(r),this.name="ApiError",this.status=t,this.code=n}}class Pn{baseUrl;headers;constructor(t){this.baseUrl=t.replace(/\/$/,""),this.headers={"Content-Type":"application/json"}}async request(t,r,n){const o=`${this.baseUrl}${r}`;try{const a=await fetch(o,{method:t,headers:this.headers,body:n?JSON.stringify(n):void 0});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Lt(a.status,i.message||`Request failed with status ${a.status}`,i.code)}return(await a.json()).data}catch(a){throw a instanceof Lt?a:new Lt(0,a instanceof Error?a.message:"Network error","NETWORK_ERROR")}}async getTokens(){return this.request("GET","/v2/tokens")}async createQuote(t){return this.request("POST","/v2/trades/quote",t)}async submitTransaction(t,r){return this.request("POST","/v2/trades/submit-tx",{trade_id:t,tx_id:r})}async getTrade(t){return this.request("GET",`/v2/trades/${t}`)}async getTokenPrice(t){return this.request("GET",`/v2/tokens/${t}`)}async listTrades(t={}){const r=new URLSearchParams;t.limit&&r.set("limit",String(t.limit)),t.page&&r.set("page",String(t.page)),t.state&&r.set("state",t.state),t.from_user_address?.length&&t.from_user_address.forEach(a=>r.append("from_user_address",a)),t.to_user_address?.length&&t.to_user_address.forEach(a=>r.append("to_user_address",a));const n=r.toString(),o=n?`/v2/trades?${n}`:"/v2/trades";return this.request("GET",o)}}let Ue=null;function Ke(e){if(!Ue&&e&&(Ue=new Pn(e)),!Ue)throw new Error("API not initialized. Please provide baseUrl.");return Ue}function aa(e){return Ue=new Pn(e),Ue}const ia=["tokens"];function la(e){return Qe({queryKey:ia,queryFn:async()=>Ke(e).getTokens(),staleTime:300*1e3,gcTime:1800*1e3,retry:3,retryDelay:t=>Math.min(1e3*2**t,3e4)})}const ca=15e3,ua=1e4,G={EVM:"EVM",BTC:"BTC",SOLANA:"Solana"};function da(e,t=4){return e?e.length<=t*2+3?e:`${e.slice(0,t+2)}...${e.slice(-t)}`:""}function fa(e,t,r=6){if(!e)return"0";let n;typeof e=="bigint"?n=e:typeof e=="string"?n=BigInt(e):n=BigInt(Math.floor(e));const o=BigInt(10**t),a=n/o,l=n%o;if(l===0n)return a.toString();const c=l.toString().padStart(t,"0").slice(0,r).replace(/0+$/,"");return c?`${a}.${c}`:a.toString()}function Mn(e,t){if(!e||e==="0")return 0n;const[r,n=""]=e.split("."),o=n.slice(0,t).padEnd(t,"0"),a=r+o;return BigInt(a)}function Ne(e,t=18,r=6){if(!e)return"0";const n=String(e);if(n.includes(".")||!Number.isInteger(Number(n))){const o=parseFloat(n);return isNaN(o)?"0":o.toFixed(r).replace(/\.?0+$/,"")}return fa(n,t,r)}function ha(e){return/^0x[a-fA-F0-9]{40}$/.test(e)}function ma(e){return/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(bc1)[a-z0-9]{39,59}$/.test(e)}function pa(e){return/^[mn2][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(tb1)[a-z0-9]{39,59}$/.test(e)}function xa(e){return/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)}function vr(e,t,r){const n=e.trim();if(!n)return{isValid:!1,error:"Address is required"};switch(t){case G.EVM:return ha(n)?{isValid:!0}:{isValid:!1,error:`Invalid ${r} wallet address`};case G.BTC:if(r==="bitcoin_testnet"){if(!pa(n))return{isValid:!1,error:`Invalid ${r} wallet address`}}else if(!ma(n))return{isValid:!1,error:`Invalid ${r} wallet address`};return{isValid:!0};case G.SOLANA:return xa(n)?{isValid:!0}:{isValid:!1,error:`Invalid ${r} wallet address`};default:return{isValid:!1,error:`Unsupported network type: ${t}`}}}const va=e=>["quote",e];function ga(e,{from_token:t,to_token:r,amount:n,from_user_address:o,to_user_address:a,user_refund_pubkey:l,slippage:i="100",affiliate_fee_bps:c,affiliate_info:u,trade_timeout:d,script_timeout:f,enabled:m=!0,onQuote:b}){const v=r&&a?vr(a,r.network_type,r.network_id).isValid:!1,h=t&&r&&n&&parseFloat(n)>0&&o&&a&&l&&v;return Qe({queryKey:va({from_token:t,to_token:r,amount:n,from_user_address:o,to_user_address:a,user_refund_pubkey:l,slippage:i}),queryFn:async()=>{const y=Ke(e),g=Mn(n,t.token_decimals).toString(),S=await y.createQuote({from_token_id:t.token_id,to_token_id:r.token_id,amount_in:g,slippage:i,from_user_address:o,to_user_address:a,user_refund_pubkey:l,affiliate_fee_bps:c,affiliate_info:u,trade_timeout:d,script_timeout:f});return b?.({quote:S,from_token:t,to_token:r,amount_in:n}),S},enabled:m&&!!h,staleTime:ua,refetchInterval:ca,retry:2,retryDelay:1e3})}const In=p.createContext(null);function ba({children:e,value:t}){return s.jsx(In.Provider,{value:t,children:e})}function lt(){const e=p.useContext(In);if(!e)throw new Error("useWidgetConfig must be used within SwapWidget");return e}function ya({className:e="h-6 w-6"}){return s.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("rect",{width:"24",height:"24",rx:"6",fill:"#D0D0D8"}),s.jsx("rect",{x:"4",y:"4",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#FFD49F"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.98943 6.98062C9.06078 6.50027 8.69769 6.24205 8.20122 6.06979L8.36227 5.4191L7.96906 5.32039L7.81227 5.95393C7.7089 5.92798 7.60273 5.9035 7.49723 5.87925L7.65514 5.24153L7.26216 5.14282L7.101 5.79329C7.01544 5.77366 6.93144 5.75426 6.84991 5.73384L6.85036 5.73181L6.30809 5.59542L6.20348 6.01846C6.20348 6.01846 6.49523 6.08581 6.48907 6.08998C6.64832 6.13003 6.6771 6.23618 6.67229 6.32034L6.48884 7.06162C6.49982 7.06444 6.51404 7.0685 6.52972 7.07482L6.5164 7.07147L6.48817 7.06444L6.23103 8.10286C6.21155 8.1516 6.16216 8.2247 6.05084 8.19695C6.05476 8.2027 5.76503 8.12509 5.76503 8.12509L5.56982 8.57847L6.08152 8.70696C6.13867 8.72139 6.19513 8.73622 6.251 8.7509C6.2882 8.76067 6.32514 8.77037 6.36184 8.77984L6.19912 9.43798L6.59188 9.53669L6.75304 8.88554C6.86033 8.91487 6.96448 8.94195 7.06639 8.96744L6.9058 9.61554L7.299 9.71425L7.46173 9.05735C8.13224 9.18517 8.63643 9.13361 8.84866 8.52274C9.01967 8.03089 8.84015 7.74717 8.48737 7.56216C8.74428 7.50248 8.93781 7.33225 8.98943 6.98062ZM8.09134 8.24968C7.97986 8.70094 7.27864 8.51438 6.9578 8.42902L6.95779 8.42901C6.92893 8.42133 6.90314 8.41447 6.88114 8.40897L7.09706 7.53706C7.12385 7.54379 7.15659 7.55119 7.19367 7.55957C7.52551 7.63458 8.20558 7.78829 8.09134 8.24968ZM7.26037 7.15491C7.52787 7.22682 8.11136 7.38367 8.213 6.97354C8.31679 6.55403 7.74968 6.42757 7.47272 6.36581C7.44156 6.35886 7.41408 6.35273 7.39164 6.3471L7.19587 7.1379C7.21436 7.14254 7.23606 7.14838 7.26037 7.15491Z",fill:"#F7931A"}),s.jsx("rect",{x:"12.8572",y:"4",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"white"}),s.jsx("path",{d:"M14.8567 7.47096L16.2848 8.30034V6.83321V5.14284L14.8567 7.47096Z",fill:"#898989"}),s.jsx("path",{d:"M16.2837 5.14284V6.8332V8.30033L17.7118 7.47096L16.2837 5.14284Z",fill:"#323232"}),s.jsx("path",{d:"M16.2837 6.83343L17.7114 7.47098L16.2837 8.30014V6.83343Z",fill:"#141414"}),s.jsx("path",{d:"M16.2848 6.83322L16.2853 6.83336V8.29993L16.2848 8.30035L14.8567 7.47097L16.2848 6.83322Z",fill:"#373737"}),s.jsx("path",{d:"M14.8567 7.73708L16.2848 9.71431V8.56604L14.8567 7.73708Z",fill:"#898989"}),s.jsx("path",{d:"M16.2837 8.56604V9.71431L17.7127 7.73708L16.2837 8.56604Z",fill:"#323232"}),s.jsx("rect",{x:"4",y:"12.8571",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#DCFFFB"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.68368 15.456C8.66445 15.4645 8.64369 15.469 8.6227 15.469H5.49249C5.47756 15.469 5.46296 15.4645 5.45047 15.4563C5.43798 15.448 5.42815 15.4362 5.42218 15.4223C5.41621 15.4084 5.41436 15.3931 5.41685 15.3782C5.41935 15.3633 5.42608 15.3494 5.43622 15.3383L6.0958 14.6209C6.11009 14.6053 6.12738 14.5929 6.14662 14.5844C6.16585 14.5758 6.18661 14.5714 6.2076 14.5714H9.33781C9.35286 14.5711 9.3677 14.5753 9.3804 14.5835C9.39311 14.5917 9.40317 14.6035 9.40925 14.6175C9.41536 14.6315 9.41722 14.6469 9.41465 14.662C9.41208 14.677 9.40518 14.691 9.39482 14.7021L8.7345 15.4195C8.72021 15.4351 8.70292 15.4475 8.68368 15.456ZM8.73471 15.9844C8.72037 15.9689 8.70306 15.9565 8.68384 15.948C8.66462 15.9395 8.64389 15.9351 8.62291 15.935H5.4927C5.47777 15.935 5.46317 15.9394 5.45068 15.9477C5.43819 15.956 5.42836 15.9678 5.42239 15.9817C5.41642 15.9955 5.41457 16.0108 5.41706 16.0258C5.41955 16.0407 5.42629 16.0545 5.43643 16.0656L6.09601 16.7835C6.11035 16.799 6.12766 16.8114 6.14688 16.8199C6.1661 16.8284 6.18683 16.8328 6.20781 16.8329H9.33802C9.35292 16.8328 9.36746 16.8284 9.3799 16.82C9.39235 16.8117 9.40211 16.7999 9.40804 16.7861C9.41396 16.7722 9.41579 16.7569 9.41326 16.742C9.41076 16.7272 9.40405 16.7133 9.39392 16.7023L8.73471 15.9844ZM9.39503 17.4295L8.73471 18.147C8.72042 18.1626 8.70313 18.175 8.68389 18.1835C8.66466 18.192 8.6439 18.1964 8.62291 18.1965H5.4927C5.47777 18.1964 5.46317 18.192 5.45068 18.1837C5.43819 18.1754 5.42836 18.1636 5.42239 18.1498C5.41642 18.1359 5.41457 18.1206 5.41706 18.1057C5.41955 18.0908 5.42629 18.0769 5.43643 18.0658L6.09601 17.3484C6.1103 17.3328 6.12759 17.3203 6.14683 17.3118C6.16606 17.3033 6.18682 17.2989 6.20781 17.2989H9.33802C9.35307 17.2986 9.3679 17.3028 9.38061 17.311C9.39332 17.3192 9.40338 17.331 9.40945 17.345C9.41557 17.3589 9.41743 17.3744 9.41486 17.3895C9.41229 17.4045 9.40539 17.4185 9.39503 17.4295Z",fill:"url(#paint0_linear_all_networks)"}),s.jsx("rect",{x:"12.8572",y:"12.8571",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#999CB3"}),s.jsx("path",{d:"M16.0979 17.4286V15.1429H16.473V17.4286H16.0979ZM15.1426 16.4692V16.097H17.4283V16.4692H15.1426Z",fill:"#2D3153"}),s.jsx("defs",{children:s.jsxs("linearGradient",{id:"paint0_linear_all_networks",x1:"7.82209",y1:"19.7701",x2:"10.7176",y2:"15.7425",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{offset:"0.08",stopColor:"#9945FF"}),s.jsx("stop",{offset:"0.3",stopColor:"#8752F3"}),s.jsx("stop",{offset:"0.5",stopColor:"#5497D5"}),s.jsx("stop",{offset:"0.6",stopColor:"#43B4CA"}),s.jsx("stop",{offset:"0.72",stopColor:"#28E0B9"}),s.jsx("stop",{offset:"0.97",stopColor:"#19FB9B"})]})})]})}function wa(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",...e,children:s.jsx("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"})})}function gr({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}function Ln({className:e="h-4 w-4"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function Dn({className:e="h-5 w-5"}){return s.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),s.jsx("path",{strokeLinecap:"round",d:"M12 2a10 10 0 019.17 6"})]})}function Ca({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}function Ie({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function ka(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[s.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),s.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}function ja(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",...e,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}function Sa({className:e="h-3.5 w-3.5"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}function Ea(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 29 20",fill:"currentColor",...e,children:s.jsx("path",{d:"M18.1123 4.25181C17.9463 3.49057 17.537 2.8272 16.9727 2.31607C15.4792 0.978457 13.189 1.03283 11.7619 2.4357C11.2751 2.91419 10.9321 3.51232 10.7662 4.18656C10.6002 4.84993 10.6555 5.64381 10.4564 6.50293C10.1798 7.75354 9.53813 8.90629 8.6088 9.81978C7.6131 10.7985 6.34081 11.451 4.95788 11.6903C4.19451 11.8208 3.3205 11.7773 2.57925 12.0165C2.00396 12.2014 1.48398 12.5276 1.07463 12.9409C-0.374675 14.3981 -0.352546 16.7254 1.10782 18.1609C2.535 19.5637 4.84725 19.6181 6.32974 18.2696C6.72802 17.9107 7.04886 17.4757 7.25907 16.9755C7.67947 16.0076 7.52459 15.5944 7.65735 14.6483C7.73479 14.0936 7.87862 13.5608 8.08882 13.0388C8.31009 12.4841 8.3986 12.3319 8.70837 11.8643C9.29473 10.9943 10.0692 10.2548 10.9874 9.73278C12.0053 9.14554 13.178 8.81929 14.4392 8.81929C16.32 8.81929 18.0237 9.56966 19.2628 10.7768C20.2586 11.7446 20.9445 13.0061 21.1879 14.4199C21.3096 15.0941 21.2432 15.8227 21.4202 16.4861C21.5972 17.1386 21.9402 17.715 22.4049 18.1826C23.8763 19.629 26.266 19.629 27.7485 18.1826C29.1646 16.7906 29.231 14.5395 27.8923 13.0823C27.4498 12.6038 26.8855 12.234 26.2549 12.0274C25.4252 11.7664 25.0379 11.8643 24.1971 11.7555C22.6593 11.5598 21.2875 10.8638 20.2475 9.84153C19.1854 8.79754 18.4663 7.40554 18.2893 5.8613C18.1897 5.19793 18.2561 4.87168 18.1123 4.25181ZM16.9617 11.0486C15.5013 9.61316 13.1448 9.61316 11.6844 11.0486C10.2241 12.4841 10.2241 14.8005 11.6844 16.236C13.1448 17.6715 15.5013 17.6715 16.9617 16.236C18.422 14.8005 18.422 12.4841 16.9617 11.0486ZM26.0668 3.13169C24.6065 1.6962 22.25 1.6962 20.7896 3.13169C19.3292 4.56719 19.3292 6.88355 20.7896 8.31904C22.25 9.75453 24.6065 9.75453 26.0668 8.31904C27.5272 6.88355 27.5272 4.56719 26.0668 3.13169ZM7.95606 3.17519C6.49569 1.7397 4.13919 1.7397 2.67882 3.17519C1.21845 4.61069 1.21845 6.92705 2.67882 8.36254C4.13919 9.79803 6.49569 9.79803 7.95606 8.36254C9.41643 6.92705 9.41643 4.59981 7.95606 3.17519Z"})})}function Na(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 124 22",...e,children:s.jsx("path",{d:"M41.39 4.241c3.385 0 6.162 2.73 6.162 6.058s-2.777 6.003-6.162 6.003h-.62c-3.385 0-6.162-2.676-6.162-6.003S37.385 4.24 40.77 4.24zm-.3 10.745c2.877 0 4.825-2.317 4.825-4.644.055-2.37-1.903-4.796-4.824-4.796-2.976 0-4.879 2.425-4.824 4.796-.01 2.316 1.892 4.644 4.824 4.644m21.353-4.698c0 3.327-2.268 5.992-5.233 5.992h-.62c-2.422 0-3.905-.805-4.978-2.665V22H50.02V4.241h1.593V6.96c.963-1.925 2.666-2.719 4.979-2.719h.62c2.964 0 5.232 2.719 5.232 6.047m-1.703 0c0-2.317-1.649-4.644-4.559-4.644-2.312 0-4.259 1.925-4.259 4.23v.816c0 2.316 1.936 4.187 4.304 4.187 2.832 0 4.514-2.273 4.514-4.59m8.275 6.003c-.354 0-.72-.055-1.073-.196-.874-.305-1.593-.86-2.058-1.61a5 5 0 0 1-.465-1.109c-.1-.402-.155-.707-.155-1.11V5.765h-1.382v-1.36h1.382V.772h1.649v3.632h3.44v1.36h-3.44v6.144c0 1.762.774 2.828 2.722 2.828h1.438v1.566h-2.058zm6.018-15.28c0 .555-.409 1.012-.973 1.012A1.025 1.025 0 0 1 73.03 1.01C73.031.457 73.496 0 74.06 0s.973.457.973 1.011m-1.792 3.23h1.593v12.06h-1.593zm14.283 2.621c.819-1.718 2.511-2.62 4.47-2.62 3.075 0 4.47 2.729 4.47 5.502v6.558H94.87V9.396c0-5.655-6.881-4.698-6.881.196v6.71h-1.594V9.396c0-5.655-6.826-4.698-6.826.196v6.71h-1.637V4.242h1.593v2.065c1.637-2.925 6.716-2.773 7.999.555m17.436 8.124c1.847 0 3.695-1.164 4.304-2.73h1.593c-.819 2.316-2.877 4.035-5.543 4.035h-.664c-3.385 0-5.897-2.676-5.897-6.003s2.512-6.058 5.897-6.058h.664c3.341 0 5.897 2.73 5.897 6.058 0 .195 0 .402-.056.609H100.38c.121 2.273 2.268 4.089 4.58 4.089m4.624-5.296c-.099-2.273-2.257-4.133-4.613-4.133-2.312 0-4.47 1.86-4.569 4.133zM124 4.24l-5.133 6.058L124 16.302h-2.058l-4.104-4.84-4.105 4.84h-2.002l5.133-6.003-5.133-6.058h2.002l4.105 4.84 4.104-4.84zm-105.888-.49a3.67 3.67 0 0 0-1.14-1.935 3.817 3.817 0 0 0-5.21.12 3.67 3.67 0 0 0-.996 1.75c-.166.664-.11 1.458-.31 2.317A6.7 6.7 0 0 1 8.61 9.32a6.88 6.88 0 0 1-3.651 1.87c-.763.13-1.638.087-2.379.327a3.75 3.75 0 0 0-1.504.924 3.667 3.667 0 0 0 .033 5.22c1.427 1.403 3.74 1.457 5.222.109.398-.36.719-.794.93-1.294.42-.968.265-1.382.397-2.328a6.8 6.8 0 0 1 .432-1.61c.221-.554.31-.706.62-1.174a6.862 6.862 0 0 1 5.73-3.045c1.881 0 3.585.75 4.824 1.958a6.64 6.64 0 0 1 1.925 3.643c.122.674.055 1.403.232 2.066.177.653.52 1.229.985 1.697 1.471 1.446 3.861 1.446 5.343 0a3.666 3.666 0 0 0 .144-5.1 3.9 3.9 0 0 0-1.637-1.056c-.83-.26-1.217-.163-2.058-.271a6.86 6.86 0 0 1-3.95-1.914 6.65 6.65 0 0 1-1.958-3.98c-.1-.664-.033-.99-.177-1.61m-1.15 6.798a3.77 3.77 0 0 0-5.278 0 3.62 3.62 0 0 0 0 5.187 3.77 3.77 0 0 0 5.278 0 3.62 3.62 0 0 0 0-5.187m9.105-7.917a3.77 3.77 0 0 0-5.277 0 3.62 3.62 0 0 0 0 5.187 3.77 3.77 0 0 0 5.277 0 3.62 3.62 0 0 0 0-5.187m-18.11.043a3.77 3.77 0 0 0-5.278 0 3.62 3.62 0 0 0 0 5.188 3.77 3.77 0 0 0 5.277 0 3.62 3.62 0 0 0 0-5.188"})})}function Ta(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",...e,children:[s.jsx("mask",{id:"paste_mask",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"25",children:s.jsx("rect",{y:"0.5",width:"24",height:"24",fill:"#D9D9D9"})}),s.jsx("g",{mask:"url(#paste_mask)",children:s.jsx("path",{d:"M5.30775 20.9999C4.80908 20.9999 4.38308 20.8233 4.02975 20.4701C3.67658 20.1168 3.5 19.6908 3.5 19.1921V5.80762C3.5 5.30895 3.67658 4.88295 4.02975 4.52962C4.38308 4.17645 4.80908 3.99987 5.30775 3.99987H9.7135C9.852 3.5127 10.135 3.10887 10.5625 2.78837C10.99 2.46787 11.4692 2.30762 12 2.30762C12.5513 2.30762 13.0382 2.46787 13.4605 2.78837C13.883 3.10887 14.1635 3.5127 14.302 3.99987H18.6923C19.1909 3.99987 19.6169 4.17645 19.9703 4.52962C20.3234 4.88295 20.5 5.30895 20.5 5.80762V19.1921C20.5 19.6908 20.3234 20.1168 19.9703 20.4701C19.6169 20.8233 19.1909 20.9999 18.6923 20.9999H5.30775ZM5.30775 19.4999H18.6923C18.7692 19.4999 18.8398 19.4678 18.9038 19.4036C18.9679 19.3396 19 19.2691 19 19.1921V5.80762C19 5.73062 18.9679 5.66012 18.9038 5.59612C18.8398 5.53195 18.7692 5.49987 18.6923 5.49987H16.5V8.11512H7.5V5.49987H5.30775C5.23075 5.49987 5.16025 5.53195 5.09625 5.59612C5.03208 5.66012 5 5.73062 5 5.80762V19.1921C5 19.2691 5.03208 19.3396 5.09625 19.4036C5.16025 19.4678 5.23075 19.4999 5.30775 19.4999ZM12 5.61537C12.2577 5.61537 12.4728 5.52912 12.6453 5.35662C12.8176 5.18412 12.9038 4.96903 12.9038 4.71137C12.9038 4.4537 12.8176 4.23862 12.6453 4.06612C12.4728 3.89378 12.2577 3.80762 12 3.80762C11.7423 3.80762 11.5273 3.89378 11.3548 4.06612C11.1824 4.23862 11.0963 4.4537 11.0963 4.71137C11.0963 4.96903 11.1824 5.18412 11.3548 5.35662C11.5273 5.52912 11.7423 5.61537 12 5.61537Z",fill:"currentColor",fillOpacity:.48})})]})}function Ra(e){return s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[s.jsx("path",{d:"M4 12C4 7.58172 7.58172 4 12 4C15.0736 4 17.7555 5.6841 19.2291 8.16667M20 12C20 16.4183 16.4183 20 12 20C8.92638 20 6.24452 18.3159 4.77091 15.8333",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),s.jsx("path",{d:"M19 4V8H15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M5 20V16H9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Oa(e){return s.jsxs("svg",{viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[s.jsx("circle",{cx:"32",cy:"32",r:"28",className:"fill-[var(--optimex-error)]/10 stroke-[var(--optimex-error)]",strokeWidth:"2"}),s.jsx("path",{d:"M20 22L26 28M26 22L20 28",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"}),s.jsx("path",{d:"M38 22L44 28M44 22L38 28",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"}),s.jsx("path",{d:"M22 44C26 38 38 38 42 44",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"})]})}function _a({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function Aa({className:e="h-5 w-5"}){return s.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function Fn(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[s.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}),s.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]})}function qr({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}function $n(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 21",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",d:"m11.299 2.846-.553 2.231q.557.126 1.103.263l.549-2.219 1.375.346-.563 2.277c1.737.603 3.008 1.506 2.759 3.188-.18 1.23-.858 1.827-1.757 2.036 1.234.647 1.862 1.641 1.264 3.362-.743 2.137-2.507 2.318-4.854 1.87l-.57 2.3-1.376-.345.562-2.269a53 53 0 0 1-1.096-.287l-.565 2.28-1.374-.346.57-2.304c-.322-.082-.65-.17-.982-.254L4 14.525l.684-1.587c.009.002 1.013.272 1 .251.389.098.562-.158.63-.33l.9-3.633.145.036a1 1 0 0 0-.142-.047l.64-2.593c.018-.295-.082-.667-.64-.807.02-.014-1-.25-1-.25l.367-1.48 1.898.476-.002.008q.43.106.88.207L9.922 2.5zM8.588 13.93c.933.233 3.81 1.164 4.236-.557.444-1.795-2.547-2.26-3.48-2.495zM9.69 9.483c.778.195 3.172.99 3.56-.575.404-1.634-2.098-1.998-2.875-2.193z"})})}function Bn(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 12",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M2.463 8.78a.44.44 0 0 1 .311-.129H13.5a.22.22 0 0 1 .156.376l-2.119 2.124a.44.44 0 0 1-.311.129H.5a.22.22 0 0 1-.156-.377zm0-7.932A.45.45 0 0 1 2.774.72H13.5a.221.221 0 0 1 .156.376L11.536 3.22a.44.44 0 0 1-.311.13H.5a.22.22 0 0 1-.156-.377zm9.074 3.941a.44.44 0 0 0-.311-.13H.5a.22.22 0 0 0-.156.377l2.12 2.124a.44.44 0 0 0 .31.129H13.5a.221.221 0 0 0 .156-.376z"})})}function zn(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 22",width:"20",height:"20",...e,children:[s.jsx("path",{fill:"currentColor",d:"M6.998 0 .5 11.204l6.498-3.069zM6.998 8.136.5 11.205l6.498 3.992z"}),s.jsx("path",{fill:"currentColor",d:"M13.496 11.204 6.997 0v8.135z"}),s.jsx("path",{fill:"currentColor",d:"m6.997 15.197 6.499-3.992-6.499-3.07zM.5 12.484 6.998 22v-5.526z"}),s.jsx("path",{fill:"currentColor",d:"M6.997 16.474V22l6.502-9.516z"})]})}function Wn(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M11.984 21.5c4.98 0 9.016-4.03 9.016-9s-4.036-9-9.016-9C7.26 3.5 3.385 7.127 3 11.743h11.917v1.514H3c.385 4.616 4.26 8.243 8.984 8.243"})})}function Vn(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:[s.jsxs("g",{fill:"currentColor",fillOpacity:.48,clipPath:"url(#arb_a)",children:[s.jsx("path",{d:"m12.089 14.49 2.278 3.68 2.105-1.255-2.992-4.852zM18.389 15.439l-.002-1.006-3.27-5.24-1.213 2.119 3.157 5.251 1.14-.68a.53.53 0 0 0 .188-.379zM4.688 16.387l1.611.956 5.363-8.85-.91-.024c-.776-.011-1.611.196-1.994.84l-3.046 4.857-1.024 1.62zM14.758 8.494l-2.4.009-5.426 9.214 1.897 1.123.515-.9z"}),s.jsx("path",{d:"M19.4 8.481a1.58 1.58 0 0 0-.718-1.264L12.72 3.69a1.51 1.51 0 0 0-1.368 0c-.05.026-5.8 3.456-5.8 3.456a1.572 1.572 0 0 0-.863 1.333v7.307l1.024-1.62-.009-5.638.007-.06a.52.52 0 0 1 .204-.332c.027-.02 5.875-3.502 5.893-3.512a.5.5 0 0 1 .45-.002l5.887 3.484c.139.091.226.246.234.415v6.984a.52.52 0 0 1-.176.38l-1.141.68-.589.35-2.105 1.256-2.134 1.272a.5.5 0 0 1-.364-.007L9.345 17.94l-.516.9 2.27 1.344.36.207c.161.08.393.127.602.127q.29 0 .556-.108l6.2-3.693c.355-.284.565-.712.584-1.175z"})]}),s.jsx("defs",{children:s.jsx("clipPath",{id:"arb_a",children:s.jsx("path",{fill:"currentColor",d:"M4 3h16v18H4z"})})})]})}function Un(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M7.245 16.646q-1.431 0-2.343-.672C4.301 15.52 4 14.867 4 14.03c0-.18.02-.39.058-.647q.154-.862.441-2.08Q5.317 8 8.717 8c.614 0 1.171.102 1.657.314q.73.298 1.152.915.423.604.423 1.44 0 .249-.058.633a26 26 0 0 1-.435 2.08c-.282 1.095-.762 1.92-1.453 2.464-.685.538-1.606.8-2.758.8m.173-1.728c.448 0 .825-.134 1.139-.396q.481-.393.685-1.216c.185-.756.326-1.408.422-1.972q.05-.25.051-.518.002-1.094-1.139-1.094-.672.001-1.152.396-.471.393-.672 1.216c-.147.538-.288 1.19-.435 1.972q-.05.238-.051.505c-.007.743.384 1.107 1.152 1.107M12.506 16.531c-.09 0-.154-.025-.205-.083-.038-.064-.051-.134-.038-.218l1.657-7.808a.32.32 0 0 1 .135-.217.35.35 0 0 1 .23-.083h3.194q1.333.001 2.137.55c.544.371.82.902.82 1.6 0 .198-.026.41-.071.627-.198.922-.602 1.6-1.216 2.042q-.902.66-2.477.659h-1.619l-.55 2.63a.34.34 0 0 1-.135.218.35.35 0 0 1-.23.083zm4.25-4.589c.339 0 .627-.09.876-.275q.383-.277.506-.793.038-.203.038-.359c0-.23-.07-.41-.205-.531-.134-.128-.37-.192-.697-.192h-1.44l-.455 2.15z"})})}function Hn(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:[s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m4.913 12.5.011 3.868 3.286 1.935v2.264L3 17.511V11.37zm0-3.868v2.254L3 9.754V7.5l1.913-1.133L6.836 7.5zM9.582 7.5l1.913-1.133L13.418 7.5l-1.923 1.132z"}),s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M6.297 15.567v-2.265l1.913 1.132v2.254zm3.285 3.547 1.914 1.132 1.923-1.132v2.254L11.496 22.5l-1.914-1.132zM16.163 7.5l1.913-1.133L20 7.5v2.254l-1.923 1.132V8.632zm1.913 8.868.011-3.868L20 11.368v6.142l-5.208 3.056v-2.265z"}),s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m16.704 15.567-1.914 1.122v-2.254l1.913-1.133z"}),s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m16.704 9.434.01 2.264-3.294 1.934v3.878l-1.913 1.122-1.914-1.122v-3.878l-3.295-1.934V9.434L8.22 8.3l3.275 1.944L14.79 8.3l1.922 1.133zM6.297 5.566 11.496 2.5l5.208 3.066L14.791 6.7l-3.295-1.944L8.21 6.7z"})]})}const Qr={bitcoin:$n,solana:Bn,ethereum:zn,base:Wn,arbitrum:Vn,optimism:Un,bsc:Hn};function Pa(e){if(!e)return null;const t=e.toLowerCase().replace(/[\s_-]/g,"");return t in Qr?Qr[t]:t.includes("bitcoin")||t.includes("btc")?$n:t.includes("solana")||t.includes("sol")?Bn:t.includes("ethereum")||t.includes("eth")||t.includes("erc20")?zn:t.includes("base")?Wn:t.includes("arbitrum")||t.includes("arb")?Vn:t.includes("optimism")||t.includes("op")?Un:t.includes("bsc")||t.includes("binance")||t.includes("bnb")?Hn:null}function Ma(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ia({icon:e,label:t,address:r,className:n=""}){const[o,a]=p.useState(!1),l=p.useCallback(async()=>{try{await navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),2e3)}catch{console.error("Failed to copy")}},[r]);return s.jsxs("div",{className:`flex items-center justify-between px-4 py-3 ${n}`,children:[s.jsxs("div",{className:"flex items-center gap-2 text-[var(--optimex-text-secondary)]",children:[s.jsx(e,{className:"size-4"}),s.jsx("span",{className:"text-sm",children:t})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:Ma(r)}),s.jsx("button",{onClick:l,className:"p-1 rounded hover:bg-[var(--optimex-surface-hover)] transition-colors",title:o?"Copied!":"Copy",children:o?s.jsx(gr,{className:"size-4 text-[var(--optimex-success)]"}):s.jsx(ka,{className:"size-4 text-[var(--optimex-text-secondary)]"})})]})]})}const La={primary:"bg-[var(--optimex-primary)] text-black hover:brightness-110 shadow-lg shadow-[var(--optimex-primary)]/30",secondary:"bg-[var(--optimex-surface)] text-[var(--optimex-text)] hover:bg-white/10 border border-white/10",ghost:"bg-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]",danger:"bg-[var(--optimex-error)] text-white hover:bg-[var(--optimex-error)]/90 hover:shadow-lg hover:shadow-[var(--optimex-error)]/25"},Da={sm:"px-3 py-1.5 text-xs rounded-[var(--optimex-radius-button)] gap-1.5 max-h-[2rem]",md:"px-4 py-2 text-sm rounded-[var(--optimex-radius-button)] gap-2 max-h-[2.5rem]",lg:"px-6 py-3 text-sm rounded-[var(--optimex-radius-button)] gap-2 max-h-[3rem]"};function qn({variant:e="primary",size:t="md",fullWidth:r=!1,isLoading:n=!1,leftIcon:o,rightIcon:a,children:l,className:i="",disabled:c,...u}){const d=c||n;return s.jsxs("button",{className:`
|
|
3
3
|
group flex items-center justify-center font-semibold transition-all active:scale-[0.98]
|
|
4
|
-
${
|
|
5
|
-
${
|
|
4
|
+
${La[e]}
|
|
5
|
+
${Da[t]}
|
|
6
6
|
${r?"w-full":""}
|
|
7
7
|
${d?"cursor-not-allowed opacity-50":""}
|
|
8
8
|
${i}
|
|
9
|
-
`,disabled:d,...u,children:[n&&s.jsx(Ha,{size:t}),!n&&o&&s.jsx("span",{className:"shrink-0",children:o}),l,!n&&a&&s.jsx("span",{className:"shrink-0",children:a})]})}function Ha({size:e}){const t=e==="sm"?"h-4 w-4":"h-5 w-5";return s.jsx("div",{className:`${t} animate-spin rounded-[9999px] border-2 border-current border-t-transparent`})}function Qn(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=Qn(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Gn(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=Qn(e))&&(n&&(n+=" "),n+=t);return n}const qa=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},Qa=(e,t)=>({classGroupId:e,validator:t}),Kn=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Nt="-",Gr=[],Ga="arbitrary..",Ka=e=>{const t=Za(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return Ya(l);const i=l.split(Nt),c=i[0]===""&&i.length>1?1:0;return Yn(i,c,t)},getConflictingClassGroupIds:(l,i)=>{if(i){const c=n[l],u=r[l];return c?u?qa(u,c):c:u||Gr}return r[l]||Gr}}},Yn=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],a=r.nextPart.get(o);if(a){const u=Yn(e,t+1,a);if(u)return u}const l=r.validators;if(l===null)return;const i=t===0?e.join(Nt):e.slice(t).join(Nt),c=l.length;for(let u=0;u<c;u++){const d=l[u];if(d.validator(i))return d.classGroupId}},Ya=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?Ga+n:void 0})(),Za=e=>{const{theme:t,classGroups:r}=e;return Xa(r,t)},Xa=(e,t)=>{const r=Kn();for(const n in e){const o=e[n];br(o,r,n,t)}return r},br=(e,t,r,n)=>{const o=e.length;for(let a=0;a<o;a++){const l=e[a];Ja(l,t,r,n)}},Ja=(e,t,r,n)=>{if(typeof e=="string"){ei(e,t,r);return}if(typeof e=="function"){ti(e,t,r,n);return}ri(e,t,r,n)},ei=(e,t,r)=>{const n=e===""?t:Zn(t,e);n.classGroupId=r},ti=(e,t,r,n)=>{if(ni(e)){br(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Qa(r,e))},ri=(e,t,r,n)=>{const o=Object.entries(e),a=o.length;for(let l=0;l<a;l++){const[i,c]=o[l];br(c,Zn(t,i),r,n)}},Zn=(e,t)=>{let r=e;const n=t.split(Nt),o=n.length;for(let a=0;a<o;a++){const l=n[a];let i=r.nextPart.get(l);i||(i=Kn(),r.nextPart.set(l,i)),r=i}return r},ni=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,si=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const o=(a,l)=>{r[a]=l,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let l=r[a];if(l!==void 0)return l;if((l=n[a])!==void 0)return o(a,l),l},set(a,l){a in r?r[a]=l:o(a,l)}}},ir="!",Kr=":",oi=[],Yr=(e,t,r,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:o}),ai=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=o=>{const a=[];let l=0,i=0,c=0,u;const d=o.length;for(let h=0;h<d;h++){const y=o[h];if(l===0&&i===0){if(y===Kr){a.push(o.slice(c,h)),c=h+1;continue}if(y==="/"){u=h;continue}}y==="["?l++:y==="]"?l--:y==="("?i++:y===")"&&i--}const f=a.length===0?o:o.slice(c);let m=f,b=!1;f.endsWith(ir)?(m=f.slice(0,-1),b=!0):f.startsWith(ir)&&(m=f.slice(1),b=!0);const v=u&&u>c?u-c:void 0;return Yr(a,b,m,v)};if(t){const o=t+Kr,a=n;n=l=>l.startsWith(o)?a(l.slice(o.length)):Yr(oi,!1,l,void 0,!0)}if(r){const o=n;n=a=>r({className:a,parseClassName:o})}return n},ii=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let o=[];for(let a=0;a<r.length;a++){const l=r[a],i=l[0]==="[",c=t.has(l);i||c?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(l)):o.push(l)}return o.length>0&&(o.sort(),n.push(...o)),n}},li=e=>({cache:si(e.cacheSize),parseClassName:ai(e),sortModifiers:ii(e),...Ka(e)}),ci=/\s+/,ui=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:a}=t,l=[],i=e.trim().split(ci);let c="";for(let u=i.length-1;u>=0;u-=1){const d=i[u],{isExternal:f,modifiers:m,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:h}=r(d);if(f){c=d+(c.length>0?" "+c:c);continue}let y=!!h,g=n(y?v.substring(0,h):v);if(!g){if(!y){c=d+(c.length>0?" "+c:c);continue}if(g=n(v),!g){c=d+(c.length>0?" "+c:c);continue}y=!1}const S=m.length===0?"":m.length===1?m[0]:a(m).join(":"),k=b?S+ir:S,w=k+g;if(l.indexOf(w)>-1)continue;l.push(w);const N=o(g,y);for(let A=0;A<N.length;++A){const C=N[A];l.push(k+C)}c=d+(c.length>0?" "+c:c)}return c},di=(...e)=>{let t=0,r,n,o="";for(;t<e.length;)(r=e[t++])&&(n=Xn(r))&&(o&&(o+=" "),o+=n);return o},Xn=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Xn(e[n]))&&(r&&(r+=" "),r+=t);return r},fi=(e,...t)=>{let r,n,o,a;const l=c=>{const u=t.reduce((d,f)=>f(d),e());return r=li(u),n=r.cache.get,o=r.cache.set,a=i,i(c)},i=c=>{const u=n(c);if(u)return u;const d=ui(c,r);return o(c,d),d};return a=l,(...c)=>a(di(...c))},hi=[],J=e=>{const t=r=>r[e]||hi;return t.isThemeGetter=!0,t},Jn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,es=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mi=/^\d+\/\d+$/,pi=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xi=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,vi=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gi=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bi=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ze=e=>mi.test(e),I=e=>!!e&&!Number.isNaN(Number(e)),Se=e=>!!e&&Number.isInteger(Number(e)),Lt=e=>e.endsWith("%")&&I(e.slice(0,-1)),ve=e=>pi.test(e),yi=()=>!0,wi=e=>xi.test(e)&&!vi.test(e),ts=()=>!1,Ci=e=>gi.test(e),ki=e=>bi.test(e),ji=e=>!T(e)&&!R(e),Si=e=>Ye(e,ss,ts),T=e=>Jn.test(e),Ae=e=>Ye(e,os,wi),Ft=e=>Ye(e,Oi,I),Zr=e=>Ye(e,rs,ts),Ei=e=>Ye(e,ns,ki),mt=e=>Ye(e,as,Ci),R=e=>es.test(e),tt=e=>Ze(e,os),Ni=e=>Ze(e,_i),Xr=e=>Ze(e,rs),Ti=e=>Ze(e,ss),Ri=e=>Ze(e,ns),pt=e=>Ze(e,as,!0),Ye=(e,t,r)=>{const n=Jn.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ze=(e,t,r=!1)=>{const n=es.exec(e);return n?n[1]?t(n[1]):r:!1},rs=e=>e==="position"||e==="percentage",ns=e=>e==="image"||e==="url",ss=e=>e==="length"||e==="size"||e==="bg-size",os=e=>e==="length",Oi=e=>e==="number",_i=e=>e==="family-name",as=e=>e==="shadow",Ai=()=>{const e=J("color"),t=J("font"),r=J("text"),n=J("font-weight"),o=J("tracking"),a=J("leading"),l=J("breakpoint"),i=J("container"),c=J("spacing"),u=J("radius"),d=J("shadow"),f=J("inset-shadow"),m=J("text-shadow"),b=J("drop-shadow"),v=J("blur"),h=J("perspective"),y=J("aspect"),g=J("ease"),S=J("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...w(),R,T],A=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],j=()=>[R,T,c],O=()=>[ze,"full","auto",...j()],L=()=>[Se,"none","subgrid",R,T],M=()=>["auto",{span:["full",Se,R,T]},Se,R,T],$=()=>[Se,"auto",R,T],_=()=>["auto","min","max","fr",R,T],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...j()],U=()=>[ze,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],E=()=>[e,R,T],ne=()=>[...w(),Xr,Zr,{position:[R,T]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Re=()=>["auto","cover","contain",Ti,Si,{size:[R,T]}],pe=()=>[Lt,tt,Ae],H=()=>["","none","full",u,R,T],Z=()=>["",I,tt,Ae],de=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>[I,Lt,Xr,Zr],xe=()=>["","none",v,R,T],we=()=>["none",I,R,T],Ce=()=>["none",I,R,T],fe=()=>[I,R,T],Oe=()=>[ze,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ve],breakpoint:[ve],color:[yi],container:[ve],"drop-shadow":[ve],ease:["in","out","in-out"],font:[ji],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ve],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ve],shadow:[ve],spacing:["px",I],text:[ve],"text-shadow":[ve],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ze,T,R,y]}],container:["container"],columns:[{columns:[I,T,R,i]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[Se,"auto",R,T]}],basis:[{basis:[ze,"full","auto",i,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[I,ze,"auto","initial","none",T]}],grow:[{grow:["",I,R,T]}],shrink:[{shrink:["",I,R,T]}],order:[{order:[Se,"first","last","none",R,T]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":_()}],"auto-rows":[{"auto-rows":_()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[i,"screen",...U()]}],"min-w":[{"min-w":[i,"screen","none",...U()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[l]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",r,tt,Ae]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,R,Ft]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Lt,T]}],"font-family":[{font:[Ni,T,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,R,T]}],"line-clamp":[{"line-clamp":[I,"none",R,Ft]}],leading:[{leading:[a,...j()]}],"list-image":[{"list-image":["none",R,T]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",R,T]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[I,"from-font","auto",R,Ae]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[I,"auto",R,T]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",R,T]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",R,T]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ne()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:Re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Se,R,T],radial:["",R,T],conic:[Se,R,T]},Ri,Ei]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[I,R,T]}],"outline-w":[{outline:["",I,tt,Ae]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",d,pt,mt]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",f,pt,mt]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[I,Ae]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",m,pt,mt]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[I,R,T]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[I]}],"mask-image-linear-from-pos":[{"mask-linear-from":F()}],"mask-image-linear-to-pos":[{"mask-linear-to":F()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":F()}],"mask-image-t-to-pos":[{"mask-t-to":F()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":F()}],"mask-image-r-to-pos":[{"mask-r-to":F()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":F()}],"mask-image-b-to-pos":[{"mask-b-to":F()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":F()}],"mask-image-l-to-pos":[{"mask-l-to":F()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":F()}],"mask-image-x-to-pos":[{"mask-x-to":F()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":F()}],"mask-image-y-to-pos":[{"mask-y-to":F()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[R,T]}],"mask-image-radial-from-pos":[{"mask-radial-from":F()}],"mask-image-radial-to-pos":[{"mask-radial-to":F()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[I]}],"mask-image-conic-from-pos":[{"mask-conic-from":F()}],"mask-image-conic-to-pos":[{"mask-conic-to":F()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:Re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",R,T]}],filter:[{filter:["","none",R,T]}],blur:[{blur:xe()}],brightness:[{brightness:[I,R,T]}],contrast:[{contrast:[I,R,T]}],"drop-shadow":[{"drop-shadow":["","none",b,pt,mt]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",I,R,T]}],"hue-rotate":[{"hue-rotate":[I,R,T]}],invert:[{invert:["",I,R,T]}],saturate:[{saturate:[I,R,T]}],sepia:[{sepia:["",I,R,T]}],"backdrop-filter":[{"backdrop-filter":["","none",R,T]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[I,R,T]}],"backdrop-contrast":[{"backdrop-contrast":[I,R,T]}],"backdrop-grayscale":[{"backdrop-grayscale":["",I,R,T]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[I,R,T]}],"backdrop-invert":[{"backdrop-invert":["",I,R,T]}],"backdrop-opacity":[{"backdrop-opacity":[I,R,T]}],"backdrop-saturate":[{"backdrop-saturate":[I,R,T]}],"backdrop-sepia":[{"backdrop-sepia":["",I,R,T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",R,T]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[I,"initial",R,T]}],ease:[{ease:["linear","initial",g,R,T]}],delay:[{delay:[I,R,T]}],animate:[{animate:["none",S,R,T]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,R,T]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:we()}],"rotate-x":[{"rotate-x":we()}],"rotate-y":[{"rotate-y":we()}],"rotate-z":[{"rotate-z":we()}],scale:[{scale:Ce()}],"scale-x":[{"scale-x":Ce()}],"scale-y":[{"scale-y":Ce()}],"scale-z":[{"scale-z":Ce()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[R,T,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",R,T]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",R,T]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[I,tt,Ae,Ft]}],stroke:[{stroke:["none",...E()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},is=fi(Ai);function ls(...e){return is(Gn(e))}function Pi({state:e,onConfirm:t,confirmText:r="Confirm",processingText:n="Processing...",successText:o="Done",errorText:a="Retry"}){const l=e==="processing",i=()=>{switch(e){case"processing":return n;case"success":return o;case"error":return a;default:return r}};return s.jsx(qn,{variant:"primary",size:"lg",fullWidth:!0,onClick:t,isLoading:l,children:i()})}function Ne(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}function Jr(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function cs(...e){return t=>{let r=!1;const n=e.map(o=>{const a=Jr(o,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let o=0;o<n.length;o++){const a=n[o];typeof a=="function"?a():Jr(e[o],null)}}}}function $e(...e){return x.useCallback(cs(...e),e)}function Mi(e,t){const r=x.createContext(t),n=a=>{const{children:l,...i}=a,c=x.useMemo(()=>i,Object.values(i));return s.jsx(r.Provider,{value:c,children:l})};n.displayName=e+"Provider";function o(a){const l=x.useContext(r);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,o]}function Di(e,t=[]){let r=[];function n(a,l){const i=x.createContext(l),c=r.length;r=[...r,l];const u=f=>{const{scope:m,children:b,...v}=f,h=m?.[e]?.[c]||i,y=x.useMemo(()=>v,Object.values(v));return s.jsx(h.Provider,{value:y,children:b})};u.displayName=a+"Provider";function d(f,m){const b=m?.[e]?.[c]||i,v=x.useContext(b);if(v)return v;if(l!==void 0)return l;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,d]}const o=()=>{const a=r.map(l=>x.createContext(l));return function(i){const c=i?.[e]||a;return x.useMemo(()=>({[`__scope${e}`]:{...i,[e]:c}}),[i,c])}};return o.scopeName=e,[n,Ii(o,...t)]}function Ii(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const l=n.reduce((i,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...i,...f}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return r.scopeName=t.scopeName,r}var at=globalThis?.document?x.useLayoutEffect:()=>{},Li=x[" useId ".trim().toString()]||(()=>{}),Fi=0;function $t(e){const[t,r]=x.useState(Li());return at(()=>{r(n=>n??String(Fi++))},[e]),e||(t?`radix-${t}`:"")}var $i=x[" useInsertionEffect ".trim().toString()]||at;function Bi({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[o,a,l]=zi({defaultProp:t,onChange:r}),i=e!==void 0,c=i?e:o;{const d=x.useRef(e!==void 0);x.useEffect(()=>{const f=d.current;f!==i&&console.warn(`${n} is changing from ${f?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=i},[i,n])}const u=x.useCallback(d=>{if(i){const f=Wi(d)?d(e):d;f!==e&&l.current?.(f)}else a(d)},[i,e,a,l]);return[c,u]}function zi({defaultProp:e,onChange:t}){const[r,n]=x.useState(e),o=x.useRef(r),a=x.useRef(t);return $i(()=>{a.current=t},[t]),x.useEffect(()=>{o.current!==r&&(a.current?.(r),o.current=r)},[r,o]),[r,n,a]}function Wi(e){return typeof e=="function"}function us(e){const t=Vi(e),r=x.forwardRef((n,o)=>{const{children:a,...l}=n,i=x.Children.toArray(a),c=i.find(Hi);if(c){const u=c.props.children,d=i.map(f=>f===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:f);return s.jsx(t,{...l,ref:o,children:x.isValidElement(u)?x.cloneElement(u,void 0,d):null})}return s.jsx(t,{...l,ref:o,children:a})});return r.displayName=`${e}.Slot`,r}function Vi(e){const t=x.forwardRef((r,n)=>{const{children:o,...a}=r;if(x.isValidElement(o)){const l=Qi(o),i=qi(a,o.props);return o.type!==x.Fragment&&(i.ref=n?cs(n,l):l),x.cloneElement(o,i)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ui=Symbol("radix.slottable");function Hi(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ui}function qi(e,t){const r={...t};for(const n in t){const o=e[n],a=t[n];/^on[A-Z]/.test(n)?o&&a?r[n]=(...i)=>{const c=a(...i);return o(...i),c}:o&&(r[n]=o):n==="style"?r[n]={...o,...a}:n==="className"&&(r[n]=[o,a].filter(Boolean).join(" "))}return{...e,...r}}function Qi(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Gi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ge=Gi.reduce((e,t)=>{const r=us(`Primitive.${t}`),n=x.forwardRef((o,a)=>{const{asChild:l,...i}=o,c=l?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...i,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Ki(e,t){e&&No.flushSync(()=>e.dispatchEvent(t))}function it(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...r)=>t.current?.(...r),[])}function Yi(e,t=globalThis?.document){const r=it(e);x.useEffect(()=>{const n=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Zi="DismissableLayer",lr="dismissableLayer.update",Xi="dismissableLayer.pointerDownOutside",Ji="dismissableLayer.focusOutside",en,ds=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fs=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:i,...c}=e,u=x.useContext(ds),[d,f]=x.useState(null),m=d?.ownerDocument??globalThis?.document,[,b]=x.useState({}),v=$e(t,C=>f(C)),h=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(y),S=d?h.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,w=S>=g,N=rl(C=>{const j=C.target,O=[...u.branches].some(L=>L.contains(j));!w||O||(o?.(C),l?.(C),C.defaultPrevented||i?.())},m),A=nl(C=>{const j=C.target;[...u.branches].some(L=>L.contains(j))||(a?.(C),l?.(C),C.defaultPrevented||i?.())},m);return Yi(C=>{S===u.layers.size-1&&(n?.(C),!C.defaultPrevented&&i&&(C.preventDefault(),i()))},m),x.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(en=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),tn(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=en)}},[d,m,r,u]),x.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),tn())},[d,u]),x.useEffect(()=>{const C=()=>b({});return document.addEventListener(lr,C),()=>document.removeEventListener(lr,C)},[]),s.jsx(ge.div,{...c,ref:v,style:{pointerEvents:k?w?"auto":"none":void 0,...e.style},onFocusCapture:Ne(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Ne(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Ne(e.onPointerDownCapture,N.onPointerDownCapture)})});fs.displayName=Zi;var el="DismissableLayerBranch",tl=x.forwardRef((e,t)=>{const r=x.useContext(ds),n=x.useRef(null),o=$e(t,n);return x.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),s.jsx(ge.div,{...e,ref:o})});tl.displayName=el;function rl(e,t=globalThis?.document){const r=it(e),n=x.useRef(!1),o=x.useRef(()=>{});return x.useEffect(()=>{const a=i=>{if(i.target&&!n.current){let c=function(){hs(Xi,r,u,{discrete:!0})};const u={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);n.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function nl(e,t=globalThis?.document){const r=it(e),n=x.useRef(!1);return x.useEffect(()=>{const o=a=>{a.target&&!n.current&&hs(Ji,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function tn(){const e=new CustomEvent(lr);document.dispatchEvent(e)}function hs(e,t,r,{discrete:n}){const o=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?Ki(o,a):o.dispatchEvent(a)}var Bt="focusScope.autoFocusOnMount",zt="focusScope.autoFocusOnUnmount",rn={bubbles:!1,cancelable:!0},sl="FocusScope",ms=x.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[i,c]=x.useState(null),u=it(o),d=it(a),f=x.useRef(null),m=$e(t,h=>c(h)),b=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(n){let h=function(k){if(b.paused||!i)return;const w=k.target;i.contains(w)?f.current=w:Ee(f.current,{select:!0})},y=function(k){if(b.paused||!i)return;const w=k.relatedTarget;w!==null&&(i.contains(w)||Ee(f.current,{select:!0}))},g=function(k){if(document.activeElement===document.body)for(const N of k)N.removedNodes.length>0&&Ee(i)};document.addEventListener("focusin",h),document.addEventListener("focusout",y);const S=new MutationObserver(g);return i&&S.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",y),S.disconnect()}}},[n,i,b.paused]),x.useEffect(()=>{if(i){sn.add(b);const h=document.activeElement;if(!i.contains(h)){const g=new CustomEvent(Bt,rn);i.addEventListener(Bt,u),i.dispatchEvent(g),g.defaultPrevented||(ol(ul(ps(i)),{select:!0}),document.activeElement===h&&Ee(i))}return()=>{i.removeEventListener(Bt,u),setTimeout(()=>{const g=new CustomEvent(zt,rn);i.addEventListener(zt,d),i.dispatchEvent(g),g.defaultPrevented||Ee(h??document.body,{select:!0}),i.removeEventListener(zt,d),sn.remove(b)},0)}}},[i,u,d,b]);const v=x.useCallback(h=>{if(!r&&!n||b.paused)return;const y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(y&&g){const S=h.currentTarget,[k,w]=al(S);k&&w?!h.shiftKey&&g===w?(h.preventDefault(),r&&Ee(k,{select:!0})):h.shiftKey&&g===k&&(h.preventDefault(),r&&Ee(w,{select:!0})):g===S&&h.preventDefault()}},[r,n,b.paused]);return s.jsx(ge.div,{tabIndex:-1,...l,ref:m,onKeyDown:v})});ms.displayName=sl;function ol(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Ee(n,{select:t}),document.activeElement!==r)return}function al(e){const t=ps(e),r=nn(t,e),n=nn(t.reverse(),e);return[r,n]}function ps(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function nn(e,t){for(const r of e)if(!il(r,{upTo:t}))return r}function il(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ll(e){return e instanceof HTMLInputElement&&"select"in e}function Ee(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&ll(e)&&t&&e.select()}}var sn=cl();function cl(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=on(e,t),e.unshift(t)},remove(t){e=on(e,t),e[0]?.resume()}}}function on(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function ul(e){return e.filter(t=>t.tagName!=="A")}var dl="Portal",xs=x.forwardRef((e,t)=>{const{container:r,...n}=e,[o,a]=x.useState(!1);at(()=>a(!0),[]);const l=r||o&&globalThis?.document?.body;return l?wn.createPortal(s.jsx(ge.div,{...n,ref:t}),l):null});xs.displayName=dl;function fl(e,t){return x.useReducer((r,n)=>t[r][n]??r,e)}var Ot=e=>{const{present:t,children:r}=e,n=hl(t),o=typeof r=="function"?r({present:n.isPresent}):x.Children.only(r),a=$e(n.ref,ml(o));return typeof r=="function"||n.isPresent?x.cloneElement(o,{ref:a}):null};Ot.displayName="Presence";function hl(e){const[t,r]=x.useState(),n=x.useRef(null),o=x.useRef(e),a=x.useRef("none"),l=e?"mounted":"unmounted",[i,c]=fl(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=xt(n.current);a.current=i==="mounted"?u:"none"},[i]),at(()=>{const u=n.current,d=o.current;if(d!==e){const m=a.current,b=xt(u);e?c("MOUNT"):b==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&m!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),at(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=b=>{const h=xt(n.current).includes(CSS.escape(b.animationName));if(b.target===t&&h&&(c("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=b=>{b.target===t&&(a.current=xt(n.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:x.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function xt(e){return e?.animationName||"none"}function ml(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Wt=0;function pl(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??an()),document.body.insertAdjacentElement("beforeend",e[1]??an()),Wt++,()=>{Wt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Wt--}},[])}function an(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var me=function(){return me=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},me.apply(this,arguments)};function vs(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function xl(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,a;n<o;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var kt="right-scroll-bar-position",jt="width-before-scroll-bar",vl="with-scroll-bars-hidden",gl="--removed-body-scroll-bar-size";function Vt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function bl(e,t){var r=p.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=t,r.facade}var yl=typeof window<"u"?x.useLayoutEffect:x.useEffect,ln=new WeakMap;function wl(e,t){var r=bl(null,function(n){return e.forEach(function(o){return Vt(o,n)})});return yl(function(){var n=ln.get(r);if(n){var o=new Set(n),a=new Set(e),l=r.current;o.forEach(function(i){a.has(i)||Vt(i,null)}),a.forEach(function(i){o.has(i)||Vt(i,l)})}ln.set(r,e)},[e]),r}function Cl(e){return e}function kl(e,t){t===void 0&&(t=Cl);var r=[],n=!1,o={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var l=t(a,n);return r.push(l),function(){r=r.filter(function(i){return i!==l})}},assignSyncMedium:function(a){for(n=!0;r.length;){var l=r;r=[],l.forEach(a)}r={push:function(i){return a(i)},filter:function(){return r}}},assignMedium:function(a){n=!0;var l=[];if(r.length){var i=r;r=[],i.forEach(a),l=r}var c=function(){var d=l;l=[],d.forEach(a)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){l.push(d),u()},filter:function(d){return l=l.filter(d),r}}}};return o}function jl(e){e===void 0&&(e={});var t=kl(null);return t.options=me({async:!0,ssr:!1},e),t}var gs=function(e){var t=e.sideCar,r=vs(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return x.createElement(n,me({},r))};gs.isSideCarExport=!0;function Sl(e,t){return e.useMedium(t),gs}var bs=jl(),Ut=function(){},_t=x.forwardRef(function(e,t){var r=x.useRef(null),n=x.useState({onScrollCapture:Ut,onWheelCapture:Ut,onTouchMoveCapture:Ut}),o=n[0],a=n[1],l=e.forwardProps,i=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,b=e.noRelative,v=e.noIsolation,h=e.inert,y=e.allowPinchZoom,g=e.as,S=g===void 0?"div":g,k=e.gapMode,w=vs(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,A=wl([r,t]),C=me(me({},w),o);return x.createElement(x.Fragment,null,d&&x.createElement(N,{sideCar:bs,removeScrollBar:u,shards:f,noRelative:b,noIsolation:v,inert:h,setCallbacks:a,allowPinchZoom:!!y,lockRef:r,gapMode:k}),l?x.cloneElement(x.Children.only(i),me(me({},C),{ref:A})):x.createElement(S,me({},C,{className:c,ref:A}),i))});_t.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_t.classNames={fullWidth:jt,zeroRight:kt};var El=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Nl(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=El();return t&&e.setAttribute("nonce",t),e}function Tl(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Rl(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Ol=function(){var e=0,t=null;return{add:function(r){e==0&&(t=Nl())&&(Tl(t,r),Rl(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},_l=function(){var e=Ol();return function(t,r){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},ys=function(){var e=_l(),t=function(r){var n=r.styles,o=r.dynamic;return e(n,o),null};return t},Al={left:0,top:0,right:0,gap:0},Ht=function(e){return parseInt(e||"",10)||0},Pl=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Ht(r),Ht(n),Ht(o)]},Ml=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Al;var t=Pl(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},Dl=ys(),Qe="data-scroll-locked",Il=function(e,t,r,n){var o=e.left,a=e.top,l=e.right,i=e.gap;return r===void 0&&(r="margin"),`
|
|
10
|
-
.`.concat(
|
|
9
|
+
`,disabled:d,...u,children:[n&&s.jsx(Fa,{size:t}),!n&&o&&s.jsx("span",{className:"shrink-0",children:o}),l,!n&&a&&s.jsx("span",{className:"shrink-0",children:a})]})}function Fa({size:e}){const t=e==="sm"?"h-4 w-4":"h-5 w-5";return s.jsx("div",{className:`${t} animate-spin rounded-[9999px] border-2 border-current border-t-transparent`})}function Qn(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=Qn(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Kn(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=Qn(e))&&(n&&(n+=" "),n+=t);return n}const $a=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},Ba=(e,t)=>({classGroupId:e,validator:t}),Gn=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Et="-",Kr=[],za="arbitrary..",Wa=e=>{const t=Ua(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return Va(l);const i=l.split(Et),c=i[0]===""&&i.length>1?1:0;return Yn(i,c,t)},getConflictingClassGroupIds:(l,i)=>{if(i){const c=n[l],u=r[l];return c?u?$a(u,c):c:u||Kr}return r[l]||Kr}}},Yn=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],a=r.nextPart.get(o);if(a){const u=Yn(e,t+1,a);if(u)return u}const l=r.validators;if(l===null)return;const i=t===0?e.join(Et):e.slice(t).join(Et),c=l.length;for(let u=0;u<c;u++){const d=l[u];if(d.validator(i))return d.classGroupId}},Va=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?za+n:void 0})(),Ua=e=>{const{theme:t,classGroups:r}=e;return Ha(r,t)},Ha=(e,t)=>{const r=Gn();for(const n in e){const o=e[n];br(o,r,n,t)}return r},br=(e,t,r,n)=>{const o=e.length;for(let a=0;a<o;a++){const l=e[a];qa(l,t,r,n)}},qa=(e,t,r,n)=>{if(typeof e=="string"){Qa(e,t,r);return}if(typeof e=="function"){Ka(e,t,r,n);return}Ga(e,t,r,n)},Qa=(e,t,r)=>{const n=e===""?t:Zn(t,e);n.classGroupId=r},Ka=(e,t,r,n)=>{if(Ya(e)){br(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Ba(r,e))},Ga=(e,t,r,n)=>{const o=Object.entries(e),a=o.length;for(let l=0;l<a;l++){const[i,c]=o[l];br(c,Zn(t,i),r,n)}},Zn=(e,t)=>{let r=e;const n=t.split(Et),o=n.length;for(let a=0;a<o;a++){const l=n[a];let i=r.nextPart.get(l);i||(i=Gn(),r.nextPart.set(l,i)),r=i}return r},Ya=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Za=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const o=(a,l)=>{r[a]=l,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let l=r[a];if(l!==void 0)return l;if((l=n[a])!==void 0)return o(a,l),l},set(a,l){a in r?r[a]=l:o(a,l)}}},ir="!",Gr=":",Xa=[],Yr=(e,t,r,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:o}),Ja=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=o=>{const a=[];let l=0,i=0,c=0,u;const d=o.length;for(let h=0;h<d;h++){const y=o[h];if(l===0&&i===0){if(y===Gr){a.push(o.slice(c,h)),c=h+1;continue}if(y==="/"){u=h;continue}}y==="["?l++:y==="]"?l--:y==="("?i++:y===")"&&i--}const f=a.length===0?o:o.slice(c);let m=f,b=!1;f.endsWith(ir)?(m=f.slice(0,-1),b=!0):f.startsWith(ir)&&(m=f.slice(1),b=!0);const v=u&&u>c?u-c:void 0;return Yr(a,b,m,v)};if(t){const o=t+Gr,a=n;n=l=>l.startsWith(o)?a(l.slice(o.length)):Yr(Xa,!1,l,void 0,!0)}if(r){const o=n;n=a=>r({className:a,parseClassName:o})}return n},ei=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let o=[];for(let a=0;a<r.length;a++){const l=r[a],i=l[0]==="[",c=t.has(l);i||c?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(l)):o.push(l)}return o.length>0&&(o.sort(),n.push(...o)),n}},ti=e=>({cache:Za(e.cacheSize),parseClassName:Ja(e),sortModifiers:ei(e),...Wa(e)}),ri=/\s+/,ni=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:a}=t,l=[],i=e.trim().split(ri);let c="";for(let u=i.length-1;u>=0;u-=1){const d=i[u],{isExternal:f,modifiers:m,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:h}=r(d);if(f){c=d+(c.length>0?" "+c:c);continue}let y=!!h,g=n(y?v.substring(0,h):v);if(!g){if(!y){c=d+(c.length>0?" "+c:c);continue}if(g=n(v),!g){c=d+(c.length>0?" "+c:c);continue}y=!1}const S=m.length===0?"":m.length===1?m[0]:a(m).join(":"),k=b?S+ir:S,w=k+g;if(l.indexOf(w)>-1)continue;l.push(w);const N=o(g,y);for(let A=0;A<N.length;++A){const C=N[A];l.push(k+C)}c=d+(c.length>0?" "+c:c)}return c},si=(...e)=>{let t=0,r,n,o="";for(;t<e.length;)(r=e[t++])&&(n=Xn(r))&&(o&&(o+=" "),o+=n);return o},Xn=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Xn(e[n]))&&(r&&(r+=" "),r+=t);return r},oi=(e,...t)=>{let r,n,o,a;const l=c=>{const u=t.reduce((d,f)=>f(d),e());return r=ti(u),n=r.cache.get,o=r.cache.set,a=i,i(c)},i=c=>{const u=n(c);if(u)return u;const d=ni(c,r);return o(c,d),d};return a=l,(...c)=>a(si(...c))},ai=[],J=e=>{const t=r=>r[e]||ai;return t.isThemeGetter=!0,t},Jn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,es=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ii=/^\d+\/\d+$/,li=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ci=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ui=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,di=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fi=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Be=e=>ii.test(e),L=e=>!!e&&!Number.isNaN(Number(e)),je=e=>!!e&&Number.isInteger(Number(e)),Dt=e=>e.endsWith("%")&&L(e.slice(0,-1)),ve=e=>li.test(e),hi=()=>!0,mi=e=>ci.test(e)&&!ui.test(e),ts=()=>!1,pi=e=>di.test(e),xi=e=>fi.test(e),vi=e=>!T(e)&&!R(e),gi=e=>Ge(e,ss,ts),T=e=>Jn.test(e),_e=e=>Ge(e,os,mi),Ft=e=>Ge(e,ki,L),Zr=e=>Ge(e,rs,ts),bi=e=>Ge(e,ns,xi),ht=e=>Ge(e,as,pi),R=e=>es.test(e),et=e=>Ye(e,os),yi=e=>Ye(e,ji),Xr=e=>Ye(e,rs),wi=e=>Ye(e,ss),Ci=e=>Ye(e,ns),mt=e=>Ye(e,as,!0),Ge=(e,t,r)=>{const n=Jn.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ye=(e,t,r=!1)=>{const n=es.exec(e);return n?n[1]?t(n[1]):r:!1},rs=e=>e==="position"||e==="percentage",ns=e=>e==="image"||e==="url",ss=e=>e==="length"||e==="size"||e==="bg-size",os=e=>e==="length",ki=e=>e==="number",ji=e=>e==="family-name",as=e=>e==="shadow",Si=()=>{const e=J("color"),t=J("font"),r=J("text"),n=J("font-weight"),o=J("tracking"),a=J("leading"),l=J("breakpoint"),i=J("container"),c=J("spacing"),u=J("radius"),d=J("shadow"),f=J("inset-shadow"),m=J("text-shadow"),b=J("drop-shadow"),v=J("blur"),h=J("perspective"),y=J("aspect"),g=J("ease"),S=J("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...w(),R,T],A=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],j=()=>[R,T,c],O=()=>[Be,"full","auto",...j()],D=()=>[je,"none","subgrid",R,T],M=()=>["auto",{span:["full",je,R,T]},je,R,T],$=()=>[je,"auto",R,T],_=()=>["auto","min","max","fr",R,T],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...j()],U=()=>[Be,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],E=()=>[e,R,T],ne=()=>[...w(),Xr,Zr,{position:[R,T]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Te=()=>["auto","cover","contain",wi,gi,{size:[R,T]}],pe=()=>[Dt,et,_e],H=()=>["","none","full",u,R,T],Z=()=>["",L,et,_e],de=()=>["solid","dashed","dotted","double"],be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>[L,Dt,Xr,Zr],xe=()=>["","none",v,R,T],ye=()=>["none",L,R,T],we=()=>["none",L,R,T],fe=()=>[L,R,T],Re=()=>[Be,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ve],breakpoint:[ve],color:[hi],container:[ve],"drop-shadow":[ve],ease:["in","out","in-out"],font:[vi],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ve],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ve],shadow:[ve],spacing:["px",L],text:[ve],"text-shadow":[ve],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Be,T,R,y]}],container:["container"],columns:[{columns:[L,T,R,i]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[je,"auto",R,T]}],basis:[{basis:[Be,"full","auto",i,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[L,Be,"auto","initial","none",T]}],grow:[{grow:["",L,R,T]}],shrink:[{shrink:["",L,R,T]}],order:[{order:[je,"first","last","none",R,T]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":_()}],"auto-rows":[{"auto-rows":_()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[i,"screen",...U()]}],"min-w":[{"min-w":[i,"screen","none",...U()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[l]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",r,et,_e]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,R,Ft]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Dt,T]}],"font-family":[{font:[yi,T,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,R,T]}],"line-clamp":[{"line-clamp":[L,"none",R,Ft]}],leading:[{leading:[a,...j()]}],"list-image":[{"list-image":["none",R,T]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",R,T]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[L,"from-font","auto",R,_e]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[L,"auto",R,T]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",R,T]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",R,T]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ne()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:Te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},je,R,T],radial:["",R,T],conic:[je,R,T]},Ci,bi]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[L,R,T]}],"outline-w":[{outline:["",L,et,_e]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",d,mt,ht]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",f,mt,ht]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[L,_e]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",m,mt,ht]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[L,R,T]}],"mix-blend":[{"mix-blend":[...be(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":be()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[L]}],"mask-image-linear-from-pos":[{"mask-linear-from":F()}],"mask-image-linear-to-pos":[{"mask-linear-to":F()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":F()}],"mask-image-t-to-pos":[{"mask-t-to":F()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":F()}],"mask-image-r-to-pos":[{"mask-r-to":F()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":F()}],"mask-image-b-to-pos":[{"mask-b-to":F()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":F()}],"mask-image-l-to-pos":[{"mask-l-to":F()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":F()}],"mask-image-x-to-pos":[{"mask-x-to":F()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":F()}],"mask-image-y-to-pos":[{"mask-y-to":F()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[R,T]}],"mask-image-radial-from-pos":[{"mask-radial-from":F()}],"mask-image-radial-to-pos":[{"mask-radial-to":F()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[L]}],"mask-image-conic-from-pos":[{"mask-conic-from":F()}],"mask-image-conic-to-pos":[{"mask-conic-to":F()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:Te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",R,T]}],filter:[{filter:["","none",R,T]}],blur:[{blur:xe()}],brightness:[{brightness:[L,R,T]}],contrast:[{contrast:[L,R,T]}],"drop-shadow":[{"drop-shadow":["","none",b,mt,ht]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",L,R,T]}],"hue-rotate":[{"hue-rotate":[L,R,T]}],invert:[{invert:["",L,R,T]}],saturate:[{saturate:[L,R,T]}],sepia:[{sepia:["",L,R,T]}],"backdrop-filter":[{"backdrop-filter":["","none",R,T]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[L,R,T]}],"backdrop-contrast":[{"backdrop-contrast":[L,R,T]}],"backdrop-grayscale":[{"backdrop-grayscale":["",L,R,T]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[L,R,T]}],"backdrop-invert":[{"backdrop-invert":["",L,R,T]}],"backdrop-opacity":[{"backdrop-opacity":[L,R,T]}],"backdrop-saturate":[{"backdrop-saturate":[L,R,T]}],"backdrop-sepia":[{"backdrop-sepia":["",L,R,T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",R,T]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[L,"initial",R,T]}],ease:[{ease:["linear","initial",g,R,T]}],delay:[{delay:[L,R,T]}],animate:[{animate:["none",S,R,T]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,R,T]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:we()}],"scale-x":[{"scale-x":we()}],"scale-y":[{"scale-y":we()}],"scale-z":[{"scale-z":we()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[R,T,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Re()}],"translate-x":[{"translate-x":Re()}],"translate-y":[{"translate-y":Re()}],"translate-z":[{"translate-z":Re()}],"translate-none":["translate-none"],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",R,T]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",R,T]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[L,et,_e,Ft]}],stroke:[{stroke:["none",...E()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},is=oi(Si);function ls(...e){return is(Kn(e))}function Ei({state:e,onConfirm:t,confirmText:r="Confirm",processingText:n="Processing...",successText:o="Done",errorText:a="Retry"}){const l=e==="processing",i=()=>{switch(e){case"processing":return n;case"success":return o;case"error":return a;default:return r}};return s.jsx(qn,{variant:"primary",size:"lg",fullWidth:!0,onClick:t,isLoading:l,children:i()})}function Ee(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}function Jr(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function cs(...e){return t=>{let r=!1;const n=e.map(o=>{const a=Jr(o,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let o=0;o<n.length;o++){const a=n[o];typeof a=="function"?a():Jr(e[o],null)}}}}function Fe(...e){return x.useCallback(cs(...e),e)}function Ni(e,t){const r=x.createContext(t),n=a=>{const{children:l,...i}=a,c=x.useMemo(()=>i,Object.values(i));return s.jsx(r.Provider,{value:c,children:l})};n.displayName=e+"Provider";function o(a){const l=x.useContext(r);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,o]}function Ti(e,t=[]){let r=[];function n(a,l){const i=x.createContext(l),c=r.length;r=[...r,l];const u=f=>{const{scope:m,children:b,...v}=f,h=m?.[e]?.[c]||i,y=x.useMemo(()=>v,Object.values(v));return s.jsx(h.Provider,{value:y,children:b})};u.displayName=a+"Provider";function d(f,m){const b=m?.[e]?.[c]||i,v=x.useContext(b);if(v)return v;if(l!==void 0)return l;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,d]}const o=()=>{const a=r.map(l=>x.createContext(l));return function(i){const c=i?.[e]||a;return x.useMemo(()=>({[`__scope${e}`]:{...i,[e]:c}}),[i,c])}};return o.scopeName=e,[n,Ri(o,...t)]}function Ri(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const l=n.reduce((i,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...i,...f}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return r.scopeName=t.scopeName,r}var ot=globalThis?.document?x.useLayoutEffect:()=>{},Oi=x[" useId ".trim().toString()]||(()=>{}),_i=0;function $t(e){const[t,r]=x.useState(Oi());return ot(()=>{r(n=>n??String(_i++))},[e]),e||(t?`radix-${t}`:"")}var Ai=x[" useInsertionEffect ".trim().toString()]||ot;function Pi({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[o,a,l]=Mi({defaultProp:t,onChange:r}),i=e!==void 0,c=i?e:o;{const d=x.useRef(e!==void 0);x.useEffect(()=>{const f=d.current;f!==i&&console.warn(`${n} is changing from ${f?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=i},[i,n])}const u=x.useCallback(d=>{if(i){const f=Ii(d)?d(e):d;f!==e&&l.current?.(f)}else a(d)},[i,e,a,l]);return[c,u]}function Mi({defaultProp:e,onChange:t}){const[r,n]=x.useState(e),o=x.useRef(r),a=x.useRef(t);return Ai(()=>{a.current=t},[t]),x.useEffect(()=>{o.current!==r&&(a.current?.(r),o.current=r)},[r,o]),[r,n,a]}function Ii(e){return typeof e=="function"}function us(e){const t=Li(e),r=x.forwardRef((n,o)=>{const{children:a,...l}=n,i=x.Children.toArray(a),c=i.find(Fi);if(c){const u=c.props.children,d=i.map(f=>f===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:f);return s.jsx(t,{...l,ref:o,children:x.isValidElement(u)?x.cloneElement(u,void 0,d):null})}return s.jsx(t,{...l,ref:o,children:a})});return r.displayName=`${e}.Slot`,r}function Li(e){const t=x.forwardRef((r,n)=>{const{children:o,...a}=r;if(x.isValidElement(o)){const l=Bi(o),i=$i(a,o.props);return o.type!==x.Fragment&&(i.ref=n?cs(n,l):l),x.cloneElement(o,i)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Di=Symbol("radix.slottable");function Fi(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Di}function $i(e,t){const r={...t};for(const n in t){const o=e[n],a=t[n];/^on[A-Z]/.test(n)?o&&a?r[n]=(...i)=>{const c=a(...i);return o(...i),c}:o&&(r[n]=o):n==="style"?r[n]={...o,...a}:n==="className"&&(r[n]=[o,a].filter(Boolean).join(" "))}return{...e,...r}}function Bi(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var zi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ge=zi.reduce((e,t)=>{const r=us(`Primitive.${t}`),n=x.forwardRef((o,a)=>{const{asChild:l,...i}=o,c=l?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...i,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Wi(e,t){e&&yo.flushSync(()=>e.dispatchEvent(t))}function at(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...r)=>t.current?.(...r),[])}function Vi(e,t=globalThis?.document){const r=at(e);x.useEffect(()=>{const n=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Ui="DismissableLayer",lr="dismissableLayer.update",Hi="dismissableLayer.pointerDownOutside",qi="dismissableLayer.focusOutside",en,ds=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fs=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:i,...c}=e,u=x.useContext(ds),[d,f]=x.useState(null),m=d?.ownerDocument??globalThis?.document,[,b]=x.useState({}),v=Fe(t,C=>f(C)),h=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(y),S=d?h.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,w=S>=g,N=Gi(C=>{const j=C.target,O=[...u.branches].some(D=>D.contains(j));!w||O||(o?.(C),l?.(C),C.defaultPrevented||i?.())},m),A=Yi(C=>{const j=C.target;[...u.branches].some(D=>D.contains(j))||(a?.(C),l?.(C),C.defaultPrevented||i?.())},m);return Vi(C=>{S===u.layers.size-1&&(n?.(C),!C.defaultPrevented&&i&&(C.preventDefault(),i()))},m),x.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(en=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),tn(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=en)}},[d,m,r,u]),x.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),tn())},[d,u]),x.useEffect(()=>{const C=()=>b({});return document.addEventListener(lr,C),()=>document.removeEventListener(lr,C)},[]),s.jsx(ge.div,{...c,ref:v,style:{pointerEvents:k?w?"auto":"none":void 0,...e.style},onFocusCapture:Ee(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Ee(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Ee(e.onPointerDownCapture,N.onPointerDownCapture)})});fs.displayName=Ui;var Qi="DismissableLayerBranch",Ki=x.forwardRef((e,t)=>{const r=x.useContext(ds),n=x.useRef(null),o=Fe(t,n);return x.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),s.jsx(ge.div,{...e,ref:o})});Ki.displayName=Qi;function Gi(e,t=globalThis?.document){const r=at(e),n=x.useRef(!1),o=x.useRef(()=>{});return x.useEffect(()=>{const a=i=>{if(i.target&&!n.current){let c=function(){hs(Hi,r,u,{discrete:!0})};const u={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);n.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Yi(e,t=globalThis?.document){const r=at(e),n=x.useRef(!1);return x.useEffect(()=>{const o=a=>{a.target&&!n.current&&hs(qi,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function tn(){const e=new CustomEvent(lr);document.dispatchEvent(e)}function hs(e,t,r,{discrete:n}){const o=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?Wi(o,a):o.dispatchEvent(a)}var Bt="focusScope.autoFocusOnMount",zt="focusScope.autoFocusOnUnmount",rn={bubbles:!1,cancelable:!0},Zi="FocusScope",ms=x.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[i,c]=x.useState(null),u=at(o),d=at(a),f=x.useRef(null),m=Fe(t,h=>c(h)),b=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(n){let h=function(k){if(b.paused||!i)return;const w=k.target;i.contains(w)?f.current=w:Se(f.current,{select:!0})},y=function(k){if(b.paused||!i)return;const w=k.relatedTarget;w!==null&&(i.contains(w)||Se(f.current,{select:!0}))},g=function(k){if(document.activeElement===document.body)for(const N of k)N.removedNodes.length>0&&Se(i)};document.addEventListener("focusin",h),document.addEventListener("focusout",y);const S=new MutationObserver(g);return i&&S.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",y),S.disconnect()}}},[n,i,b.paused]),x.useEffect(()=>{if(i){sn.add(b);const h=document.activeElement;if(!i.contains(h)){const g=new CustomEvent(Bt,rn);i.addEventListener(Bt,u),i.dispatchEvent(g),g.defaultPrevented||(Xi(nl(ps(i)),{select:!0}),document.activeElement===h&&Se(i))}return()=>{i.removeEventListener(Bt,u),setTimeout(()=>{const g=new CustomEvent(zt,rn);i.addEventListener(zt,d),i.dispatchEvent(g),g.defaultPrevented||Se(h??document.body,{select:!0}),i.removeEventListener(zt,d),sn.remove(b)},0)}}},[i,u,d,b]);const v=x.useCallback(h=>{if(!r&&!n||b.paused)return;const y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(y&&g){const S=h.currentTarget,[k,w]=Ji(S);k&&w?!h.shiftKey&&g===w?(h.preventDefault(),r&&Se(k,{select:!0})):h.shiftKey&&g===k&&(h.preventDefault(),r&&Se(w,{select:!0})):g===S&&h.preventDefault()}},[r,n,b.paused]);return s.jsx(ge.div,{tabIndex:-1,...l,ref:m,onKeyDown:v})});ms.displayName=Zi;function Xi(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Se(n,{select:t}),document.activeElement!==r)return}function Ji(e){const t=ps(e),r=nn(t,e),n=nn(t.reverse(),e);return[r,n]}function ps(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function nn(e,t){for(const r of e)if(!el(r,{upTo:t}))return r}function el(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function tl(e){return e instanceof HTMLInputElement&&"select"in e}function Se(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&tl(e)&&t&&e.select()}}var sn=rl();function rl(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=on(e,t),e.unshift(t)},remove(t){e=on(e,t),e[0]?.resume()}}}function on(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function nl(e){return e.filter(t=>t.tagName!=="A")}var sl="Portal",xs=x.forwardRef((e,t)=>{const{container:r,...n}=e,[o,a]=x.useState(!1);ot(()=>a(!0),[]);const l=r||o&&globalThis?.document?.body;return l?wn.createPortal(s.jsx(ge.div,{...n,ref:t}),l):null});xs.displayName=sl;function ol(e,t){return x.useReducer((r,n)=>t[r][n]??r,e)}var Ot=e=>{const{present:t,children:r}=e,n=al(t),o=typeof r=="function"?r({present:n.isPresent}):x.Children.only(r),a=Fe(n.ref,il(o));return typeof r=="function"||n.isPresent?x.cloneElement(o,{ref:a}):null};Ot.displayName="Presence";function al(e){const[t,r]=x.useState(),n=x.useRef(null),o=x.useRef(e),a=x.useRef("none"),l=e?"mounted":"unmounted",[i,c]=ol(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=pt(n.current);a.current=i==="mounted"?u:"none"},[i]),ot(()=>{const u=n.current,d=o.current;if(d!==e){const m=a.current,b=pt(u);e?c("MOUNT"):b==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&m!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ot(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=b=>{const h=pt(n.current).includes(CSS.escape(b.animationName));if(b.target===t&&h&&(c("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=b=>{b.target===t&&(a.current=pt(n.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:x.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function pt(e){return e?.animationName||"none"}function il(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Wt=0;function ll(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??an()),document.body.insertAdjacentElement("beforeend",e[1]??an()),Wt++,()=>{Wt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Wt--}},[])}function an(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var me=function(){return me=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},me.apply(this,arguments)};function vs(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function cl(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,a;n<o;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var Ct="right-scroll-bar-position",kt="width-before-scroll-bar",ul="with-scroll-bars-hidden",dl="--removed-body-scroll-bar-size";function Vt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function fl(e,t){var r=p.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=t,r.facade}var hl=typeof window<"u"?x.useLayoutEffect:x.useEffect,ln=new WeakMap;function ml(e,t){var r=fl(null,function(n){return e.forEach(function(o){return Vt(o,n)})});return hl(function(){var n=ln.get(r);if(n){var o=new Set(n),a=new Set(e),l=r.current;o.forEach(function(i){a.has(i)||Vt(i,null)}),a.forEach(function(i){o.has(i)||Vt(i,l)})}ln.set(r,e)},[e]),r}function pl(e){return e}function xl(e,t){t===void 0&&(t=pl);var r=[],n=!1,o={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var l=t(a,n);return r.push(l),function(){r=r.filter(function(i){return i!==l})}},assignSyncMedium:function(a){for(n=!0;r.length;){var l=r;r=[],l.forEach(a)}r={push:function(i){return a(i)},filter:function(){return r}}},assignMedium:function(a){n=!0;var l=[];if(r.length){var i=r;r=[],i.forEach(a),l=r}var c=function(){var d=l;l=[],d.forEach(a)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){l.push(d),u()},filter:function(d){return l=l.filter(d),r}}}};return o}function vl(e){e===void 0&&(e={});var t=xl(null);return t.options=me({async:!0,ssr:!1},e),t}var gs=function(e){var t=e.sideCar,r=vs(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return x.createElement(n,me({},r))};gs.isSideCarExport=!0;function gl(e,t){return e.useMedium(t),gs}var bs=vl(),Ut=function(){},_t=x.forwardRef(function(e,t){var r=x.useRef(null),n=x.useState({onScrollCapture:Ut,onWheelCapture:Ut,onTouchMoveCapture:Ut}),o=n[0],a=n[1],l=e.forwardProps,i=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,b=e.noRelative,v=e.noIsolation,h=e.inert,y=e.allowPinchZoom,g=e.as,S=g===void 0?"div":g,k=e.gapMode,w=vs(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,A=ml([r,t]),C=me(me({},w),o);return x.createElement(x.Fragment,null,d&&x.createElement(N,{sideCar:bs,removeScrollBar:u,shards:f,noRelative:b,noIsolation:v,inert:h,setCallbacks:a,allowPinchZoom:!!y,lockRef:r,gapMode:k}),l?x.cloneElement(x.Children.only(i),me(me({},C),{ref:A})):x.createElement(S,me({},C,{className:c,ref:A}),i))});_t.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_t.classNames={fullWidth:kt,zeroRight:Ct};var bl=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function yl(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=bl();return t&&e.setAttribute("nonce",t),e}function wl(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Cl(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var kl=function(){var e=0,t=null;return{add:function(r){e==0&&(t=yl())&&(wl(t,r),Cl(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},jl=function(){var e=kl();return function(t,r){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},ys=function(){var e=jl(),t=function(r){var n=r.styles,o=r.dynamic;return e(n,o),null};return t},Sl={left:0,top:0,right:0,gap:0},Ht=function(e){return parseInt(e||"",10)||0},El=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Ht(r),Ht(n),Ht(o)]},Nl=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Sl;var t=El(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},Tl=ys(),qe="data-scroll-locked",Rl=function(e,t,r,n){var o=e.left,a=e.top,l=e.right,i=e.gap;return r===void 0&&(r="margin"),`
|
|
10
|
+
.`.concat(ul,` {
|
|
11
11
|
overflow: hidden `).concat(n,`;
|
|
12
12
|
padding-right: `).concat(i,"px ").concat(n,`;
|
|
13
13
|
}
|
|
14
|
-
body[`).concat(
|
|
14
|
+
body[`).concat(qe,`] {
|
|
15
15
|
overflow: hidden `).concat(n,`;
|
|
16
16
|
overscroll-behavior: contain;
|
|
17
17
|
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
|
|
@@ -24,32 +24,32 @@
|
|
|
24
24
|
`),r==="padding"&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.`).concat(
|
|
27
|
+
.`).concat(Ct,` {
|
|
28
28
|
right: `).concat(i,"px ").concat(n,`;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.`).concat(
|
|
31
|
+
.`).concat(kt,` {
|
|
32
32
|
margin-right: `).concat(i,"px ").concat(n,`;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
.`).concat(
|
|
35
|
+
.`).concat(Ct," .").concat(Ct,` {
|
|
36
36
|
right: 0 `).concat(n,`;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.`).concat(
|
|
39
|
+
.`).concat(kt," .").concat(kt,` {
|
|
40
40
|
margin-right: 0 `).concat(n,`;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
body[`).concat(
|
|
44
|
-
`).concat(
|
|
43
|
+
body[`).concat(qe,`] {
|
|
44
|
+
`).concat(dl,": ").concat(i,`px;
|
|
45
45
|
}
|
|
46
|
-
`)},cn=function(){var e=parseInt(document.body.getAttribute(
|
|
46
|
+
`)},cn=function(){var e=parseInt(document.body.getAttribute(qe)||"0",10);return isFinite(e)?e:0},Ol=function(){x.useEffect(function(){return document.body.setAttribute(qe,(cn()+1).toString()),function(){var e=cn()-1;e<=0?document.body.removeAttribute(qe):document.body.setAttribute(qe,e.toString())}},[])},_l=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,o=n===void 0?"margin":n;Ol();var a=x.useMemo(function(){return Nl(o)},[o]);return x.createElement(Tl,{styles:Rl(a,!t,o,r?"":"!important")})},cr=!1;if(typeof window<"u")try{var xt=Object.defineProperty({},"passive",{get:function(){return cr=!0,!0}});window.addEventListener("test",xt,xt),window.removeEventListener("test",xt,xt)}catch{cr=!1}var ze=cr?{passive:!1}:!1,Al=function(e){return e.tagName==="TEXTAREA"},ws=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!Al(e)&&r[t]==="visible")},Pl=function(e){return ws(e,"overflowY")},Ml=function(e){return ws(e,"overflowX")},un=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=Cs(e,n);if(o){var a=ks(e,n),l=a[1],i=a[2];if(l>i)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Il=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},Ll=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Cs=function(e,t){return e==="v"?Pl(t):Ml(t)},ks=function(e,t){return e==="v"?Il(t):Ll(t)},Dl=function(e,t){return e==="h"&&t==="rtl"?-1:1},Fl=function(e,t,r,n,o){var a=Dl(e,window.getComputedStyle(t).direction),l=a*n,i=r.target,c=t.contains(i),u=!1,d=l>0,f=0,m=0;do{if(!i)break;var b=ks(e,i),v=b[0],h=b[1],y=b[2],g=h-y-a*v;(v||g)&&Cs(e,i)&&(f+=g,m+=v);var S=i.parentNode;i=S&&S.nodeType===Node.DOCUMENT_FRAGMENT_NODE?S.host:S}while(!c&&i!==document.body||c&&(t.contains(i)||t===i));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(u=!0),u},vt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},dn=function(e){return[e.deltaX,e.deltaY]},fn=function(e){return e&&"current"in e?e.current:e},$l=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Bl=function(e){return`
|
|
47
47
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
48
48
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
49
|
-
`)},
|
|
49
|
+
`)},zl=0,We=[];function Wl(e){var t=x.useRef([]),r=x.useRef([0,0]),n=x.useRef(),o=x.useState(zl++)[0],a=x.useState(ys)[0],l=x.useRef(e);x.useEffect(function(){l.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var h=cl([e.lockRef.current],(e.shards||[]).map(fn),!0).filter(Boolean);return h.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var i=x.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!l.current.allowPinchZoom;var g=vt(h),S=r.current,k="deltaX"in h?h.deltaX:S[0]-g[0],w="deltaY"in h?h.deltaY:S[1]-g[1],N,A=h.target,C=Math.abs(k)>Math.abs(w)?"h":"v";if("touches"in h&&C==="h"&&A.type==="range")return!1;var j=window.getSelection(),O=j&&j.anchorNode,D=O?O===A||O.contains(A):!1;if(D)return!1;var M=un(C,A);if(!M)return!0;if(M?N=C:(N=C==="v"?"h":"v",M=un(C,A)),!M)return!1;if(!n.current&&"changedTouches"in h&&(k||w)&&(n.current=N),!N)return!0;var $=n.current||N;return Fl($,y,h,$==="h"?k:w)},[]),c=x.useCallback(function(h){var y=h;if(!(!We.length||We[We.length-1]!==a)){var g="deltaY"in y?dn(y):vt(y),S=t.current.filter(function(N){return N.name===y.type&&(N.target===y.target||y.target===N.shadowParent)&&$l(N.delta,g)})[0];if(S&&S.should){y.cancelable&&y.preventDefault();return}if(!S){var k=(l.current.shards||[]).map(fn).filter(Boolean).filter(function(N){return N.contains(y.target)}),w=k.length>0?i(y,k[0]):!l.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),u=x.useCallback(function(h,y,g,S){var k={name:h,delta:y,target:g,should:S,shadowParent:Vl(g)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(w){return w!==k})},1)},[]),d=x.useCallback(function(h){r.current=vt(h),n.current=void 0},[]),f=x.useCallback(function(h){u(h.type,dn(h),h.target,i(h,e.lockRef.current))},[]),m=x.useCallback(function(h){u(h.type,vt(h),h.target,i(h,e.lockRef.current))},[]);x.useEffect(function(){return We.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,ze),document.addEventListener("touchmove",c,ze),document.addEventListener("touchstart",d,ze),function(){We=We.filter(function(h){return h!==a}),document.removeEventListener("wheel",c,ze),document.removeEventListener("touchmove",c,ze),document.removeEventListener("touchstart",d,ze)}},[]);var b=e.removeScrollBar,v=e.inert;return x.createElement(x.Fragment,null,v?x.createElement(a,{styles:Bl(o)}):null,b?x.createElement(_l,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Vl(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Ul=gl(bs,Wl);var js=x.forwardRef(function(e,t){return x.createElement(_t,me({},e,{ref:t,sideCar:Ul}))});js.classNames=_t.classNames;var Hl=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ve=new WeakMap,gt=new WeakMap,bt={},qt=0,Ss=function(e){return e&&(e.host||Ss(e.parentNode))},ql=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Ss(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Ql=function(e,t,r,n){var o=ql(t,Array.isArray(e)?e:[e]);bt[r]||(bt[r]=new WeakMap);var a=bt[r],l=[],i=new Set,c=new Set(o),u=function(f){!f||i.has(f)||(i.add(f),u(f.parentNode))};o.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(i.has(m))d(m);else try{var b=m.getAttribute(n),v=b!==null&&b!=="false",h=(Ve.get(m)||0)+1,y=(a.get(m)||0)+1;Ve.set(m,h),a.set(m,y),l.push(m),h===1&&v&>.set(m,!0),y===1&&m.setAttribute(r,"true"),v||m.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",m,g)}})};return d(t),i.clear(),qt++,function(){l.forEach(function(f){var m=Ve.get(f)-1,b=a.get(f)-1;Ve.set(f,m),a.set(f,b),m||(gt.has(f)||f.removeAttribute(n),gt.delete(f)),b||f.removeAttribute(r)}),qt--,qt||(Ve=new WeakMap,Ve=new WeakMap,gt=new WeakMap,bt={})}},Kl=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),o=Hl(e);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live], script"))),Ql(n,o,r,"aria-hidden")):function(){return null}},At="Dialog",[Es]=Ti(At),[Gl,ue]=Es(At),Ns=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:o,onOpenChange:a,modal:l=!0}=e,i=x.useRef(null),c=x.useRef(null),[u,d]=Pi({prop:n,defaultProp:o??!1,onChange:a,caller:At});return s.jsx(Gl,{scope:t,triggerRef:i,contentRef:c,contentId:$t(),titleId:$t(),descriptionId:$t(),open:u,onOpenChange:d,onOpenToggle:x.useCallback(()=>d(f=>!f),[d]),modal:l,children:r})};Ns.displayName=At;var Ts="DialogTrigger",Yl=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=ue(Ts,r),a=Fe(t,o.triggerRef);return s.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Cr(o.open),...n,ref:a,onClick:Ee(e.onClick,o.onOpenToggle)})});Yl.displayName=Ts;var yr="DialogPortal",[Zl,Rs]=Es(yr,{forceMount:void 0}),Os=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:o}=e,a=ue(yr,t);return s.jsx(Zl,{scope:t,forceMount:r,children:x.Children.map(n,l=>s.jsx(Ot,{present:r||a.open,children:s.jsx(xs,{asChild:!0,container:o,children:l})}))})};Os.displayName=yr;var Nt="DialogOverlay",_s=x.forwardRef((e,t)=>{const r=Rs(Nt,e.__scopeDialog),{forceMount:n=r.forceMount,...o}=e,a=ue(Nt,e.__scopeDialog);return a.modal?s.jsx(Ot,{present:n||a.open,children:s.jsx(Jl,{...o,ref:t})}):null});_s.displayName=Nt;var Xl=us("DialogOverlay.RemoveScroll"),Jl=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=ue(Nt,r);return s.jsx(js,{as:Xl,allowPinchZoom:!0,shards:[o.contentRef],children:s.jsx(ge.div,{"data-state":Cr(o.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Le="DialogContent",As=x.forwardRef((e,t)=>{const r=Rs(Le,e.__scopeDialog),{forceMount:n=r.forceMount,...o}=e,a=ue(Le,e.__scopeDialog);return s.jsx(Ot,{present:n||a.open,children:a.modal?s.jsx(ec,{...o,ref:t}):s.jsx(tc,{...o,ref:t})})});As.displayName=Le;var ec=x.forwardRef((e,t)=>{const r=ue(Le,e.__scopeDialog),n=x.useRef(null),o=Fe(t,r.contentRef,n);return x.useEffect(()=>{const a=n.current;if(a)return Kl(a)},[]),s.jsx(Ps,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ee(e.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&a.preventDefault()}),onFocusOutside:Ee(e.onFocusOutside,a=>a.preventDefault())})}),tc=x.forwardRef((e,t)=>{const r=ue(Le,e.__scopeDialog),n=x.useRef(!1),o=x.useRef(!1);return s.jsx(Ps,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||r.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=a.target;r.triggerRef.current?.contains(l)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),Ps=x.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:a,...l}=e,i=ue(Le,r),c=x.useRef(null),u=Fe(t,c);return ll(),s.jsxs(s.Fragment,{children:[s.jsx(ms,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:a,children:s.jsx(fs,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Cr(i.open),...l,ref:u,onDismiss:()=>i.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(rc,{titleId:i.titleId}),s.jsx(sc,{contentRef:c,descriptionId:i.descriptionId})]})]})}),wr="DialogTitle",Ms=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=ue(wr,r);return s.jsx(ge.h2,{id:o.titleId,...n,ref:t})});Ms.displayName=wr;var Is="DialogDescription",Ls=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=ue(Is,r);return s.jsx(ge.p,{id:o.descriptionId,...n,ref:t})});Ls.displayName=Is;var Ds="DialogClose",Fs=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=ue(Ds,r);return s.jsx(ge.button,{type:"button",...n,ref:t,onClick:Ee(e.onClick,()=>o.onOpenChange(!1))})});Fs.displayName=Ds;function Cr(e){return e?"open":"closed"}var $s="DialogTitleWarning",[wd,Bs]=Ni($s,{contentName:Le,titleName:wr,docsSlug:"dialog"}),rc=({titleId:e})=>{const t=Bs($s),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
50
50
|
|
|
51
51
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
52
52
|
|
|
53
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},
|
|
53
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},nc="DialogDescriptionWarning",sc=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Bs(nc).contentName}}.`;return x.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},oc=Ns,ac=Os,ic=_s,lc=As,cc=Ms,uc=Ls,dc=Fs;function fc(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const zs=p.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),ct=()=>{const e=p.useContext(zs);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};fc(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
54
54
|
[data-state=closed]
|
|
55
|
-
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function hc(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function mc(){return kr(/^Mac/)}function pc(){return kr(/^iPhone/)}function hn(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function xc(){return kr(/^iPad/)||mc()&&navigator.maxTouchPoints>1}function Ks(){return pc()||xc()}function kr(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const vc=24,gc=typeof window<"u"?p.useLayoutEffect:p.useEffect;function mn(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}const Qt=typeof document<"u"&&window.visualViewport;function pn(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Ys(e){for(pn(e)&&(e=e.parentElement);e&&!pn(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const bc=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let wt=0,Gt;function yc(e={}){let{isDisabled:t}=e;gc(()=>{if(!t)return wt++,wt===1&&Ks()&&(Gt=wc()),()=>{wt--,wt===0&&Gt?.()}},[t])}function wc(){let e,t=0,r=f=>{e=Ys(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},n=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let m=f.changedTouches[0].pageY,b=e.scrollTop,v=e.scrollHeight-e.clientHeight;v!==0&&((b<=0&&m>t||b>=v&&m<t)&&f.preventDefault(),t=m)},o=f=>{let m=f.target;ur(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},a=f=>{let m=f.target;ur(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",Qt&&(Qt.height<window.innerHeight?requestAnimationFrame(()=>{xn(m)}):Qt.addEventListener("resize",()=>xn(m),{once:!0}))}))},l=()=>{window.scrollTo(0,0)},i=window.pageXOffset,c=window.pageYOffset,u=mn(Cc(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let d=mn(rt(document,"touchstart",r,{passive:!1,capture:!0}),rt(document,"touchmove",n,{passive:!1,capture:!0}),rt(document,"touchend",o,{passive:!1,capture:!0}),rt(document,"focus",a,!0),rt(window,"scroll",l));return()=>{u(),d(),window.scrollTo(i,c)}}function Cc(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function rt(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function xn(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=Ys(e);if(r!==document.documentElement&&r!==document.body&&r!==e){let n=r.getBoundingClientRect().top,o=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom;const l=r.getBoundingClientRect().bottom+vc;a>l&&(r.scrollTop+=o-n)}e=r.parentElement}}function ur(e){return e instanceof HTMLInputElement&&!bc.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function kc(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function jc(...e){return t=>e.forEach(r=>kc(r,t))}function Zs(...e){return x.useCallback(jc(...e),e)}const Xs=new WeakMap;function ee(e,t,r=!1){if(!e||!(e instanceof HTMLElement))return;let n={};Object.entries(t).forEach(([o,a])=>{if(o.startsWith("--")){e.style.setProperty(o,a);return}n[o]=e.style[o],e.style[o]=a}),!r&&Xs.set(e,n)}function Sc(e,t){if(!e||!(e instanceof HTMLElement))return;let r=Xs.get(e);r&&(e.style[t]=r[t])}const X=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Ct(e,t){if(!e)return null;const r=window.getComputedStyle(e),n=r.transform||r.webkitTransform||r.mozTransform;let o=n.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[X(t)?13:12]):(o=n.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[X(t)?5:4]):null)}function Ec(e){return 8*(Math.log(e+1)-2)}function Kt(e,t){if(!e)return()=>{};const r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}function Nc(...e){return(...t)=>{for(const r of e)typeof r=="function"&&r(...t)}}const G={DURATION:.5,EASE:[.32,.72,0,1]},Js=.4,Tc=.25,Rc=100,eo=8,Pe=16,dr=26,Yt="vaul-dragging";function to(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function Oc({defaultProp:e,onChange:t}){const r=p.useState(e),[n]=r,o=p.useRef(n),a=to(t);return p.useEffect(()=>{o.current!==n&&(a(n),o.current=n)},[n,o,a]),r}function ro({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,o]=Oc({defaultProp:t,onChange:r}),a=e!==void 0,l=a?e:n,i=to(r),c=p.useCallback(u=>{if(a){const f=typeof u=="function"?u(e):u;f!==e&&i(f)}else o(u)},[a,e,o,i]);return[l,c]}function _c({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:o,fadeFromIndex:a,onSnapPointChange:l,direction:i="bottom",container:c,snapToSequentialPoint:u}){const[d,f]=ro({prop:e,defaultProp:r?.[0],onChange:t}),[m,b]=p.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);p.useEffect(()=>{function C(){b({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const v=p.useMemo(()=>d===r?.[r.length-1]||null,[r,d]),h=p.useMemo(()=>{var C;return(C=r?.findIndex(j=>j===d))!=null?C:null},[r,d]),y=r&&r.length>0&&(a||a===0)&&!Number.isNaN(a)&&r[a]===d||!r,g=p.useMemo(()=>{const C=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var j;return(j=r?.map(O=>{const L=typeof O=="string";let M=0;if(L&&(M=parseInt(O,10)),X(i)){const _=L?M:m?O*C.height:0;return m?i==="bottom"?C.height-_:-C.height+_:_}const $=L?M:m?O*C.width:0;return m?i==="right"?C.width-$:-C.width+$:$}))!=null?j:[]},[r,m,c]),S=p.useMemo(()=>h!==null?g?.[h]:null,[g,h]),k=p.useCallback(C=>{var j;const O=(j=g?.findIndex(L=>L===C))!=null?j:null;l(O),ee(n.current,{transition:`transform ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,transform:X(i)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),g&&O!==g.length-1&&a!==void 0&&O!==a&&O<a?ee(o.current,{transition:`opacity ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,opacity:"0"}):ee(o.current,{transition:`opacity ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,opacity:"1"}),f(r?.[Math.max(O,0)])},[n.current,r,g,a,o,f]);p.useEffect(()=>{if(d||e){var C;const j=(C=r?.findIndex(O=>O===e||O===d))!=null?C:-1;g&&j!==-1&&typeof g[j]=="number"&&k(g[j])}},[d,e,r,g,k]);function w({draggedDistance:C,closeDrawer:j,velocity:O,dismissible:L}){if(a===void 0)return;const M=i==="bottom"||i==="right"?(S??0)-C:(S??0)+C,$=h===a-1,_=h===0,W=C>0;if($&&ee(o.current,{transition:`opacity ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`}),!u&&O>2&&!W){L?j():k(g[0]);return}if(!u&&O>2&&W&&g&&r){k(g[r.length-1]);return}const V=g?.reduce((U,E)=>typeof U!="number"||typeof E!="number"?U:Math.abs(E-M)<Math.abs(U-M)?E:U),Q=X(i)?window.innerHeight:window.innerWidth;if(O>Js&&Math.abs(C)<Q*.4){const U=W?1:-1;if(U>0&&v&&r){k(g[r.length-1]);return}if(_&&U<0&&L&&j(),h===null)return;k(g[h+U]);return}k(V)}function N({draggedDistance:C}){if(S===null)return;const j=i==="bottom"||i==="right"?S-C:S+C;(i==="bottom"||i==="right")&&j<g[g.length-1]||(i==="top"||i==="left")&&j>g[g.length-1]||ee(n.current,{transform:X(i)?`translate3d(0, ${j}px, 0)`:`translate3d(${j}px, 0, 0)`})}function A(C,j){if(!r||typeof h!="number"||!g||a===void 0)return null;const O=h===a-1;if(h>=a&&j)return 0;if(O&&!j)return 1;if(!y&&!O)return null;const M=O?h+1:h-1,$=O?g[M]-g[M-1]:g[M+1]-g[M],_=C/Math.abs($);return O?1-_:_}return{isLastSnapPoint:v,activeSnapPoint:d,shouldFade:y,getPercentageDragged:A,setActiveSnapPoint:f,activeSnapPointIndex:h,onRelease:w,onDrag:N,snapPointsOffset:g}}const Ac=()=>()=>{};function Pc(){const{direction:e,isOpen:t,shouldScaleBackground:r,setBackgroundColorOnScale:n,noBodyStyles:o}=ut(),a=p.useRef(null),l=p.useMemo(()=>document.body.style.backgroundColor,[]);function i(){return(window.innerWidth-dr)/window.innerWidth}p.useEffect(()=>{if(t&&r){a.current&&clearTimeout(a.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;Nc(n&&!o?Kt(document.body,{background:"black"}):Ac,Kt(c,{transformOrigin:X(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${G.DURATION}s`,transitionTimingFunction:`cubic-bezier(${G.EASE.join(",")})`}));const u=Kt(c,{borderRadius:`${eo}px`,overflow:"hidden",...X(e)?{transform:`scale(${i()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${i()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{u(),a.current=window.setTimeout(()=>{l?document.body.style.background=l:document.body.style.removeProperty("background")},G.DURATION*1e3)}}},[t,r,l])}let nt=null;function Mc({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:o,noBodyStyles:a}){const[l,i]=p.useState(()=>typeof window<"u"?window.location.href:""),c=p.useRef(0),u=p.useCallback(()=>{if(hn()&&nt===null&&e&&!a){nt={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:m}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const b=m-window.innerHeight;b&&c.current>=m&&(document.body.style.top=`${-(c.current+b)}px`)}),300)}},[e]),d=p.useCallback(()=>{if(hn()&&nt!==null&&!a){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,nt),window.requestAnimationFrame(()=>{if(o&&l!==window.location.href){i(window.location.href);return}window.scrollTo(m,f)}),nt=null}},[l]);return p.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),p.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||d()}},[t,d]),p.useEffect(()=>{r||!n||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{d()},500)):d())},[e,n,l,t,r,u,d]),{restorePositionSetting:d}}function Dc({open:e,onOpenChange:t,children:r,onDrag:n,onRelease:o,snapPoints:a,shouldScaleBackground:l=!1,setBackgroundColorOnScale:i=!0,closeThreshold:c=Tc,scrollLockTimeout:u=Rc,dismissible:d=!0,handleOnly:f=!1,fadeFromIndex:m=a&&a.length-1,activeSnapPoint:b,setActiveSnapPoint:v,fixed:h,modal:y=!0,onClose:g,nested:S,noBodyStyles:k=!1,direction:w="bottom",defaultOpen:N=!1,disablePreventScroll:A=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:j=!1,repositionInputs:O=!0,onAnimationEnd:L,container:M,autoFocus:$=!1}){var _,W;const[V=!1,Q]=ro({defaultProp:N,prop:e,onChange:P=>{t?.(P),!P&&!S&&bo(),setTimeout(()=>{L?.(P)},G.DURATION*1e3),P&&!y&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),P||(document.body.style.pointerEvents="auto")}}),[U,E]=p.useState(!1),[ne,ie]=p.useState(!1),[Re,pe]=p.useState(!1),H=p.useRef(null),Z=p.useRef(null),de=p.useRef(null),ye=p.useRef(null),F=p.useRef(null),xe=p.useRef(!1),we=p.useRef(null),Ce=p.useRef(0),fe=p.useRef(!1),Oe=p.useRef(!N),Tr=p.useRef(0),D=p.useRef(null),Rr=p.useRef(((_=D.current)==null?void 0:_.getBoundingClientRect().height)||0),Or=p.useRef(((W=D.current)==null?void 0:W.getBoundingClientRect().width)||0),Mt=p.useRef(0),mo=p.useCallback(P=>{a&&P===Je.length-1&&(Z.current=new Date)},[]),{activeSnapPoint:po,activeSnapPointIndex:Be,setActiveSnapPoint:_r,onRelease:xo,snapPointsOffset:Je,onDrag:vo,shouldFade:Ar,getPercentageDragged:go}=_c({snapPoints:a,activeSnapPointProp:b,setActiveSnapPointProp:v,drawerRef:D,fadeFromIndex:m,overlayRef:H,onSnapPointChange:mo,direction:w,container:M,snapToSequentialPoint:C});yc({isDisabled:!V||ne||!y||Re||!U||!O||!A});const{restorePositionSetting:bo}=Mc({isOpen:V,modal:y,nested:S??!1,hasBeenOpened:U,preventScrollRestoration:j,noBodyStyles:k});function dt(){return(window.innerWidth-dr)/window.innerWidth}function yo(P){var z,q;!d&&!a||D.current&&!D.current.contains(P.target)||(Rr.current=((z=D.current)==null?void 0:z.getBoundingClientRect().height)||0,Or.current=((q=D.current)==null?void 0:q.getBoundingClientRect().width)||0,ie(!0),de.current=new Date,Ks()&&window.addEventListener("touchend",()=>xe.current=!1,{once:!0}),P.target.setPointerCapture(P.pointerId),Ce.current=X(w)?P.pageY:P.pageX)}function Pr(P,z){var q;let B=P;const Y=(q=window.getSelection())==null?void 0:q.toString(),se=D.current?Ct(D.current,w):null,re=new Date;if(B.tagName==="SELECT"||B.hasAttribute("data-vaul-no-drag")||B.closest("[data-vaul-no-drag]"))return!1;if(w==="right"||w==="left")return!0;if(Z.current&&re.getTime()-Z.current.getTime()<500)return!1;if(se!==null&&(w==="bottom"?se>0:se<0))return!0;if(Y&&Y.length>0)return!1;if(F.current&&re.getTime()-F.current.getTime()<u&&se===0||z)return F.current=re,!1;for(;B;){if(B.scrollHeight>B.clientHeight){if(B.scrollTop!==0)return F.current=new Date,!1;if(B.getAttribute("role")==="dialog")return!0}B=B.parentNode}return!0}function wo(P){if(D.current&&ne){const z=w==="bottom"||w==="right"?1:-1,q=(Ce.current-(X(w)?P.pageY:P.pageX))*z,B=q>0,Y=a&&!d&&!B;if(Y&&Be===0)return;const se=Math.abs(q),re=document.querySelector("[data-vaul-drawer-wrapper]"),ke=w==="bottom"||w==="top"?Rr.current:Or.current;let le=se/ke;const _e=go(se,B);if(_e!==null&&(le=_e),Y&&le>=1||!xe.current&&!Pr(P.target,B))return;if(D.current.classList.add(Yt),xe.current=!0,ee(D.current,{transition:"none"}),ee(H.current,{transition:"none"}),a&&vo({draggedDistance:q}),B&&!a){const he=Ec(q),ft=Math.min(he*-1,0)*z;ee(D.current,{transform:X(w)?`translate3d(0, ${ft}px, 0)`:`translate3d(${ft}px, 0, 0)`});return}const je=1-le;if((Ar||m&&Be===m-1)&&(n?.(P,le),ee(H.current,{opacity:`${je}`,transition:"none"},!0)),re&&H.current&&l){const he=Math.min(dt()+le*(1-dt()),1),ft=8-le*8,Dr=Math.max(0,14-le*14);ee(re,{borderRadius:`${ft}px`,transform:X(w)?`scale(${he}) translate3d(0, ${Dr}px, 0)`:`scale(${he}) translate3d(${Dr}px, 0, 0)`,transition:"none"},!0)}if(!a){const he=se*z;ee(D.current,{transform:X(w)?`translate3d(0, ${he}px, 0)`:`translate3d(${he}px, 0, 0)`})}}}p.useEffect(()=>{window.requestAnimationFrame(()=>{Oe.current=!0})},[]),p.useEffect(()=>{var P;function z(){if(!D.current||!O)return;const q=document.activeElement;if(ur(q)||fe.current){var B;const Y=((B=window.visualViewport)==null?void 0:B.height)||0,se=window.innerHeight;let re=se-Y;const ke=D.current.getBoundingClientRect().height||0,le=ke>se*.8;Mt.current||(Mt.current=ke);const _e=D.current.getBoundingClientRect().top;if(Math.abs(Tr.current-re)>60&&(fe.current=!fe.current),a&&a.length>0&&Je&&Be){const je=Je[Be]||0;re+=je}if(Tr.current=re,ke>Y||fe.current){const je=D.current.getBoundingClientRect().height;let he=je;je>Y&&(he=Y-(le?_e:dr)),h?D.current.style.height=`${je-Math.max(re,0)}px`:D.current.style.height=`${Math.max(he,Y-_e)}px`}else hc()||(D.current.style.height=`${Mt.current}px`);a&&a.length>0&&!fe.current?D.current.style.bottom="0px":D.current.style.bottom=`${Math.max(re,0)}px`}}return(P=window.visualViewport)==null||P.addEventListener("resize",z),()=>{var q;return(q=window.visualViewport)==null?void 0:q.removeEventListener("resize",z)}},[Be,a,Je]);function et(P){Co(),g?.(),P||Q(!1),setTimeout(()=>{a&&_r(a[0])},G.DURATION*1e3)}function Mr(){if(!D.current)return;const P=document.querySelector("[data-vaul-drawer-wrapper]"),z=Ct(D.current,w);ee(D.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`}),ee(H.current,{transition:`opacity ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,opacity:"1"}),l&&z&&z>0&&V&&ee(P,{borderRadius:`${eo}px`,overflow:"hidden",...X(w)?{transform:`scale(${dt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${dt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${G.DURATION}s`,transitionTimingFunction:`cubic-bezier(${G.EASE.join(",")})`},!0)}function Co(){!ne||!D.current||(D.current.classList.remove(Yt),xe.current=!1,ie(!1),ye.current=new Date)}function ko(P){if(!ne||!D.current)return;D.current.classList.remove(Yt),xe.current=!1,ie(!1),ye.current=new Date;const z=Ct(D.current,w);if(!P||!Pr(P.target,!1)||!z||Number.isNaN(z)||de.current===null)return;const q=ye.current.getTime()-de.current.getTime(),B=Ce.current-(X(w)?P.pageY:P.pageX),Y=Math.abs(B)/q;if(Y>.05&&(pe(!0),setTimeout(()=>{pe(!1)},200)),a){xo({draggedDistance:B*(w==="bottom"||w==="right"?1:-1),closeDrawer:et,velocity:Y,dismissible:d}),o?.(P,!0);return}if(w==="bottom"||w==="right"?B>0:B<0){Mr(),o?.(P,!0);return}if(Y>Js){et(),o?.(P,!1);return}var se;const re=Math.min((se=D.current.getBoundingClientRect().height)!=null?se:0,window.innerHeight);var ke;const le=Math.min((ke=D.current.getBoundingClientRect().width)!=null?ke:0,window.innerWidth),_e=w==="left"||w==="right";if(Math.abs(z)>=(_e?le:re)*c){et(),o?.(P,!1);return}o?.(P,!0),Mr()}p.useEffect(()=>(V&&(ee(document.documentElement,{scrollBehavior:"auto"}),Z.current=new Date),()=>{Sc(document.documentElement,"scrollBehavior")}),[V]);function jo(P){const z=P?(window.innerWidth-Pe)/window.innerWidth:1,q=P?-Pe:0;we.current&&window.clearTimeout(we.current),ee(D.current,{transition:`transform ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,transform:X(w)?`scale(${z}) translate3d(0, ${q}px, 0)`:`scale(${z}) translate3d(${q}px, 0, 0)`}),!P&&D.current&&(we.current=setTimeout(()=>{const B=Ct(D.current,w);ee(D.current,{transition:"none",transform:X(w)?`translate3d(0, ${B}px, 0)`:`translate3d(${B}px, 0, 0)`})},500))}function So(P,z){if(z<0)return;const q=(window.innerWidth-Pe)/window.innerWidth,B=q+z*(1-q),Y=-Pe+z*Pe;ee(D.current,{transform:X(w)?`scale(${B}) translate3d(0, ${Y}px, 0)`:`scale(${B}) translate3d(${Y}px, 0, 0)`,transition:"none"})}function Eo(P,z){const q=X(w)?window.innerHeight:window.innerWidth,B=z?(q-Pe)/q:1,Y=z?-Pe:0;z&&ee(D.current,{transition:`transform ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,transform:X(w)?`scale(${B}) translate3d(0, ${Y}px, 0)`:`scale(${B}) translate3d(${Y}px, 0, 0)`})}return p.useEffect(()=>{y||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[y]),p.createElement(zs,{defaultOpen:N,onOpenChange:P=>{!d&&!P||(P?E(!0):et(!0),Q(P))},open:V},p.createElement(Gs.Provider,{value:{activeSnapPoint:po,snapPoints:a,setActiveSnapPoint:_r,drawerRef:D,overlayRef:H,onOpenChange:t,onPress:yo,onRelease:ko,onDrag:wo,dismissible:d,shouldAnimate:Oe,handleOnly:f,isOpen:V,isDragging:ne,shouldFade:Ar,closeDrawer:et,onNestedDrag:So,onNestedOpenChange:jo,onNestedRelease:Eo,keyboardIsOpen:fe,modal:y,snapPointsOffset:Je,activeSnapPointIndex:Be,direction:w,shouldScaleBackground:l,setBackgroundColorOnScale:i,noBodyStyles:k,container:M,autoFocus:$}},r))}const no=p.forwardRef(function({...e},t){const{overlayRef:r,snapPoints:n,onRelease:o,shouldFade:a,isOpen:l,modal:i,shouldAnimate:c}=ut(),u=Zs(t,r),d=n&&n.length>0;if(!i)return null;const f=p.useCallback(m=>o(m),[o]);return p.createElement(Vs,{onMouseUp:f,ref:u,"data-vaul-overlay":"","data-vaul-snap-points":l&&d?"true":"false","data-vaul-snap-points-overlay":l&&a?"true":"false","data-vaul-animate":c?.current?"true":"false",...e})});no.displayName="Drawer.Overlay";const so=p.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:r,...n},o){const{drawerRef:a,onPress:l,onRelease:i,onDrag:c,keyboardIsOpen:u,snapPointsOffset:d,activeSnapPointIndex:f,modal:m,isOpen:b,direction:v,snapPoints:h,container:y,handleOnly:g,shouldAnimate:S,autoFocus:k}=ut(),[w,N]=p.useState(!1),A=Zs(o,a),C=p.useRef(null),j=p.useRef(null),O=p.useRef(!1),L=h&&h.length>0;Pc();const M=(_,W,V=0)=>{if(O.current)return!0;const Q=Math.abs(_.y),U=Math.abs(_.x),E=U>Q,ne=["bottom","right"].includes(W)?1:-1;if(W==="left"||W==="right"){if(!(_.x*ne<0)&&U>=0&&U<=V)return E}else if(!(_.y*ne<0)&&Q>=0&&Q<=V)return!E;return O.current=!0,!0};p.useEffect(()=>{L&&window.requestAnimationFrame(()=>{N(!0)})},[]);function $(_){C.current=null,O.current=!1,i(_)}return p.createElement(Us,{"data-vaul-drawer-direction":v,"data-vaul-drawer":"","data-vaul-delayed-snap-points":w?"true":"false","data-vaul-snap-points":b&&L?"true":"false","data-vaul-custom-container":y?"true":"false","data-vaul-animate":S?.current?"true":"false",...n,ref:A,style:d&&d.length>0?{"--snap-point-height":`${d[f??0]}px`,...t}:t,onPointerDown:_=>{g||(n.onPointerDown==null||n.onPointerDown.call(n,_),C.current={x:_.pageX,y:_.pageY},l(_))},onOpenAutoFocus:_=>{r?.(_),k||_.preventDefault()},onPointerDownOutside:_=>{if(e?.(_),!m||_.defaultPrevented){_.preventDefault();return}u.current&&(u.current=!1)},onFocusOutside:_=>{if(!m){_.preventDefault();return}},onPointerMove:_=>{if(j.current=_,g||(n.onPointerMove==null||n.onPointerMove.call(n,_),!C.current))return;const W=_.pageY-C.current.y,V=_.pageX-C.current.x,Q=_.pointerType==="touch"?10:2;M({x:V,y:W},v,Q)?c(_):(Math.abs(V)>Q||Math.abs(W)>Q)&&(C.current=null)},onPointerUp:_=>{n.onPointerUp==null||n.onPointerUp.call(n,_),C.current=null,O.current=!1,i(_)},onPointerOut:_=>{n.onPointerOut==null||n.onPointerOut.call(n,_),$(j.current)},onContextMenu:_=>{n.onContextMenu==null||n.onContextMenu.call(n,_),j.current&&$(j.current)}})});so.displayName="Drawer.Content";const Ic=250,Lc=120,Fc=p.forwardRef(function({preventCycle:e=!1,children:t,...r},n){const{closeDrawer:o,isDragging:a,snapPoints:l,activeSnapPoint:i,setActiveSnapPoint:c,dismissible:u,handleOnly:d,isOpen:f,onPress:m,onDrag:b}=ut(),v=p.useRef(null),h=p.useRef(!1);function y(){if(h.current){k();return}window.setTimeout(()=>{g()},Lc)}function g(){if(a||e||h.current){k();return}if(k(),!l||l.length===0){u||o();return}if(i===l[l.length-1]&&u){o();return}const N=l.findIndex(C=>C===i);if(N===-1)return;const A=l[N+1];c(A)}function S(){v.current=window.setTimeout(()=>{h.current=!0},Ic)}function k(){v.current&&window.clearTimeout(v.current),h.current=!1}return p.createElement("div",{onClick:y,onPointerCancel:k,onPointerDown:w=>{d&&m(w),S()},onPointerMove:w=>{d&&b(w)},ref:n,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...r},p.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});Fc.displayName="Drawer.Handle";function $c(e){const t=ut(),{container:r=t.container,...n}=e;return p.createElement(Ws,{container:r,...n})}const Me={Root:Dc,Content:so,Overlay:no,Portal:$c,Close:Qs,Title:Hs,Description:qs};function Bc(e=768){const[t,r]=p.useState(!1);return p.useEffect(()=>{const n=()=>{r(window.innerWidth<e)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),t}function be(...e){return is(Gn(e))}function zc({...e}){return s.jsx(zs,{"data-slot":"dialog",...e})}function Wc({...e}){return s.jsx(Ws,{"data-slot":"dialog-portal",...e})}function Vc({className:e,...t}){return s.jsx(Vs,{"data-slot":"dialog-overlay",className:be("fixed inset-0 z-[9999] bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t})}function Uc({className:e,children:t,showCloseButton:r=!0,...n}){return s.jsxs(Wc,{children:[s.jsx(Vc,{}),s.jsxs(Us,{"data-slot":"dialog-content",className:be("fixed left-1/2 top-1/2 z-[9999] flex max-h-[85vh] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-[var(--optimex-overlay-radius)] border border-white/10 bg-[var(--optimex-overlay-background)] shadow-2xl outline-none duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:max-w-lg",e),...n,children:[t,r&&s.jsxs(Qs,{"data-slot":"dialog-close",className:"absolute right-4 top-4 rounded-[var(--optimex-radius-button)] p-1.5 text-[var(--optimex-text-secondary)] opacity-70 transition-opacity hover:opacity-100 hover:bg-white/10 focus:outline-none disabled:pointer-events-none",children:[s.jsx(Ie,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Hc({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:be("flex flex-col gap-1.5 border-b border-white/[0.05] p-4",e),...t})}function qc({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:be("flex gap-2 border-t border-white/[0.05] p-4",e),...t})}function Qc({className:e,...t}){return s.jsx(Hs,{"data-slot":"dialog-title",className:be("text-lg font-bold leading-none text-[var(--optimex-text)]",e),...t})}function Gc({className:e,...t}){return s.jsx(qs,{"data-slot":"dialog-description",className:be("text-sm text-[var(--optimex-text-secondary)]",e),...t})}function Kc({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-body",className:be("flex flex-1 flex-col overflow-hidden",e),...t})}function jr({open:e,onOpenChange:t,children:r,title:n,description:o,className:a="",showCloseButton:l=!0}){return Bc()?s.jsx(Me.Root,{open:e,onOpenChange:t,children:s.jsxs(Me.Portal,{children:[s.jsx(Me.Overlay,{className:"fixed inset-0 z-[9999] bg-black/60 backdrop-blur-sm"}),s.jsxs(Me.Content,{className:be("fixed inset-x-0 bottom-0 z-[9999] mt-24 flex max-h-[96vh] flex-col rounded-t-[var(--optimex-overlay-radius)] border-t border-white/10 bg-[var(--optimex-overlay-background)] outline-none",a),children:[s.jsx("div",{className:"mx-auto mt-4 h-1.5 w-12 flex-shrink-0 rounded-full bg-white/20"}),(n||l)&&s.jsxs("div",{className:"flex items-center justify-between border-b border-white/[0.05] px-4 pb-4 pt-2",children:[s.jsxs("div",{children:[n&&s.jsx(Me.Title,{className:"text-lg font-bold text-[var(--optimex-text)]",children:n}),o&&s.jsx(Me.Description,{className:"text-sm text-[var(--optimex-text-secondary)]",children:o})]}),l&&s.jsx(Me.Close,{className:"rounded-[var(--optimex-radius-button)] p-1.5 text-[var(--optimex-text-secondary)] transition-colors hover:bg-white/10 hover:text-[var(--optimex-text)]",children:s.jsx(Ie,{})})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:r})]})]})}):s.jsx(zc,{open:e,onOpenChange:t,children:s.jsxs(Uc,{className:a,showCloseButton:l,children:[(n||o)&&s.jsxs(Hc,{children:[n&&s.jsx(Qc,{children:n}),o&&s.jsx(Gc,{children:o})]}),s.jsx(Kc,{children:r})]})})}const Yc=({children:e,className:t=""})=>s.jsx("div",{className:be("p-4",t),children:e}),Zc=qc;function fr({children:e,onClick:t,isActive:r=!1,type:n="button",className:o=""}){return s.jsx("button",{type:n,onClick:t,className:ls(`px-2 py-1 bg-white/5 rounded-md text-xs transition-colors shadow-sm border ${r?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-[var(--optimex-surface-hover)] hover:text-[var(--optimex-text)]"} ${o}`),children:e})}const Xc={"bottom-right":"right-0 top-full mt-2","bottom-left":"left-0 top-full mt-2","bottom-center":"left-1/2 -translate-x-1/2 top-full mt-2","top-right":"right-0 bottom-full mb-2","top-left":"left-0 bottom-full mb-2","top-center":"left-1/2 -translate-x-1/2 bottom-full mb-2"},Jc={"bottom-right":"-top-2 right-4 rotate-45 border-l border-t border-white/10","bottom-left":"-top-2 left-4 rotate-45 border-l border-t border-white/10","bottom-center":"-top-2 left-1/2 -translate-x-1/2 rotate-45 border-l border-t border-white/10","top-right":"-bottom-2 right-4 rotate-45 border-r border-b border-white/10","top-left":"-bottom-2 left-4 rotate-45 border-r border-b border-white/10","top-center":"-bottom-2 left-1/2 -translate-x-1/2 rotate-45 border-r border-b border-white/10"};function eu({isOpen:e,onClose:t,children:r,anchorRef:n,position:o="bottom-right",width:a="w-72",showArrow:l=!0,className:i="",ariaLabel:c}){const u=p.useRef(null);return p.useEffect(()=>{if(!e)return;const d=b=>{const v=b.target;u.current?.contains(v)||n?.current?.contains(v)||t()},f=b=>{b.key==="Escape"&&t()},m=setTimeout(()=>{document.addEventListener("mousedown",d),document.addEventListener("keydown",f)},0);return()=>{clearTimeout(m),document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f)}},[e,t,n]),e?s.jsxs("div",{ref:u,className:`absolute z-50 rounded-[var(--optimex-overlay-radius)] border border-white/10 bg-[var(--optimex-overlay-background)] p-4 shadow-xl ${Xc[o]} ${a} ${i}`,role:"dialog","aria-label":c,children:[l&&s.jsx("div",{className:`absolute h-4 w-4 bg-[var(--optimex-overlay-background)] ${Jc[o]}`}),s.jsx("div",{className:"relative",children:r})]}):null}function tu({value:e,onChange:t,placeholder:r,hasError:n=!1,leftIcon:o,rightContent:a,type:l="text",inputMode:i="text",disabled:c=!1,className:u=""}){return s.jsxs("div",{className:`flex rounded-[var(--optimex-radius-button)] items-center gap-2 bg-white/5 border py-3 px-3 transition-colors ${n?"border-[var(--optimex-error)]":"border-white/10 hover:border-[var(--optimex-primary)] focus-within:border-[var(--optimex-primary)]"} ${c?"opacity-50 cursor-not-allowed":""} ${u}`,children:[o&&s.jsx(o,{className:"size-5 text-[var(--optimex-text-secondary)] shrink-0"}),s.jsx("input",{type:l,inputMode:i,value:e,onChange:d=>t(d.target.value),placeholder:r,disabled:c,className:"flex-1 min-w-0 bg-transparent text-[var(--optimex-text)] text-sm placeholder:text-[var(--optimex-text-secondary)]/30 outline-none disabled:cursor-not-allowed"}),a]})}const ru={sm:{container:"h-6 w-6",icon:"h-6 w-6",badge:"h-3 w-3"},md:{container:"h-8 w-8",icon:"h-8 w-8",badge:"h-4 w-4"},lg:{container:"h-10 w-10",icon:"h-10 w-10",badge:"h-5 w-5"},xl:{container:"h-14 w-14",icon:"h-14 w-14",badge:"h-6 w-6"}};function Fe({token:e,size:t="md",showNetworkBadge:r=!0}){const n=ru[t];return s.jsxs("div",{className:`relative shrink-0 ${n.container}`,children:[s.jsx("img",{src:e.token_logo_uri||"/placeholder-token.svg",alt:e.token_symbol,className:`${n.icon} rounded-[9999px] bg-[var(--optimex-background)]`,onError:o=>{o.target.src="/placeholder-token.svg"}}),r&&e.network_logo_uri&&s.jsx("img",{src:e.network_logo_uri,alt:e.network_name,className:`absolute -bottom-1 -right-1 ${n.badge} rounded-[9999px] border-2 border-[var(--optimex-surface)]`,onError:o=>{o.target.style.display="none"}})]})}const nu="widget-container rounded-[var(--optimex-radius-widget)] p-4 shadow-2xl relative w-full min-w-0";function Sr({children:e,className:t}){return s.jsx("div",{className:t??nu,children:e})}function su(){return s.jsxs("div",{className:"relative size-20 mb-4",children:[s.jsx("div",{className:"absolute inset-0 rounded-full bg-[var(--optimex-error)]/10 animate-pulse"}),s.jsx("div",{className:"absolute inset-2 rounded-full bg-[var(--optimex-error)]/20"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx(La,{className:"size-10 text-[var(--optimex-error)]"})})]})}function ou({error:e,onRetry:t,className:r}){const n=()=>{const o=e?.message?.toLowerCase()||"";return o.includes("network")||o.includes("fetch")?"Connection issue. Check your internet and try again.":o.includes("timeout")?"Request timed out. The server might be busy.":o.includes("401")||o.includes("403")?"Access denied. Please check your credentials.":o.includes("500")||o.includes("server")?"Server is having issues. Please try again later.":"Something went wrong while loading. Let's give it another shot!"};return s.jsx(Sr,{className:r,children:s.jsx("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-6 border border-white/[0.02]",children:s.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[s.jsx(su,{}),s.jsx("h3",{className:"text-base font-bold text-[var(--optimex-text)] mb-1",children:"Oops! Something went wrong"}),s.jsx("p",{className:"text-sm text-[var(--optimex-text-secondary)] mb-6 max-w-[280px]",children:n()}),s.jsx(qn,{onClick:t,size:"md",fullWidth:!0,leftIcon:s.jsx(Ia,{className:"size-4 transition-transform group-hover:rotate-180"}),children:"Try Again"}),e?.message&&s.jsxs("details",{className:"mt-4 w-full",children:[s.jsx("summary",{className:"cursor-pointer text-xs text-[var(--optimex-text-secondary)]/60 hover:text-[var(--optimex-text-secondary)] transition-colors",children:"Technical details"}),s.jsx("p",{className:"mt-2 bg-white/5 p-3 text-left text-xs text-[var(--optimex-text-secondary)] break-all border border-white/[0.02]",children:e.message})]})]})})})}function au({className:e}){return s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("header",{className:"flex items-center justify-between px-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"size-8 rounded-lg bg-[var(--optimex-primary)]/30 animate-pulse"}),s.jsx("div",{className:"h-6 w-28 rounded bg-white/10 animate-pulse"})]}),s.jsx("div",{className:"size-10 rounded-lg bg-white/5 animate-pulse"})]}),s.jsxs(Sr,{className:e,children:[s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-2",children:[s.jsx("div",{className:"flex justify-between items-center mb-4",children:s.jsx("div",{className:"h-3 w-10 animate-pulse rounded bg-white/10"})}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-8 w-24 animate-pulse rounded bg-white/10 mb-2"}),s.jsx("div",{className:"h-3 w-16 animate-pulse rounded bg-white/5"})]}),s.jsxs("div",{className:"flex items-center gap-2 bg-white/5 p-2 pr-3 rounded-full border border-white/10",children:[s.jsx("div",{className:"size-8 rounded-full bg-white/10 animate-pulse"}),s.jsxs("div",{children:[s.jsx("div",{className:"h-4 w-12 animate-pulse rounded bg-white/10 mb-1"}),s.jsx("div",{className:"h-2 w-16 animate-pulse rounded bg-white/5"})]})]})]})]}),s.jsx("div",{className:"relative z-10 -my-4 flex justify-center",children:s.jsx("div",{className:"size-10 rounded-full bg-[var(--optimex-surface)] border-4 border-[var(--optimex-background)] animate-pulse"})}),s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-4",children:[s.jsx("div",{className:"flex justify-between items-center mb-4",children:s.jsx("div",{className:"h-3 w-6 animate-pulse rounded bg-white/10"})}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-8 w-20 animate-pulse rounded bg-white/10 mb-2"}),s.jsx("div",{className:"h-3 w-14 animate-pulse rounded bg-white/5"})]}),s.jsxs("div",{className:"flex items-center gap-2 bg-white/5 p-2 pr-3 rounded-full border border-white/10",children:[s.jsx("div",{className:"size-8 rounded-full bg-white/10 animate-pulse"}),s.jsxs("div",{children:[s.jsx("div",{className:"h-4 w-12 animate-pulse rounded bg-white/10 mb-1"}),s.jsx("div",{className:"h-2 w-16 animate-pulse rounded bg-white/5"})]})]})]})]}),s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-4",children:[s.jsx("div",{className:"h-3 w-28 animate-pulse rounded bg-white/10 mb-2"}),s.jsxs("div",{className:"flex items-center gap-2 bg-white/5 border border-white/10 py-3 px-3 rounded-md",children:[s.jsx("div",{className:"size-5 rounded-full bg-white/10 animate-pulse shrink-0"}),s.jsx("div",{className:"h-4 flex-1 animate-pulse rounded bg-white/5"})]}),s.jsx("div",{className:"h-2 w-48 animate-pulse rounded bg-white/5 mt-2"})]}),s.jsx("div",{className:"h-12 w-full animate-pulse rounded-xl bg-[var(--optimex-primary)]/30 bg-white/5 mt-2"}),s.jsx("div",{className:"mt-4 flex items-center justify-center",children:s.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-white/5"})})]})]})}const oo=p.createContext(null);function iu({children:e}){const t=ct(),{data:r,isLoading:n,error:o,refetch:a}=pa(t.apiBaseUrl),l=t.renderLoading??au,i=t.renderError??ou;if(n)return s.jsx(l,{});if(o||!r){const c=o instanceof Error?o:new Error("Failed to load tokens");return s.jsx(i,{error:c,onRetry:()=>a()})}return s.jsx(oo.Provider,{value:{tokensData:r,refetch:a},children:e})}function lu(){const e=p.useContext(oo);if(!e)throw new Error("useTokensData must be used within TokensProvider");return e}function cu({token:e,value:t,onChange:r,placeholder:n,error:o,onClose:a}){const l=p.useCallback(()=>{r("")},[r]),i=p.useCallback(async()=>{try{const f=await navigator.clipboard.readText();f&&r(f.trim())}catch(f){console.error("Failed to read clipboard:",f)}},[r]),c=()=>n||(e?`Enter ${e.network_name} address`:"Enter receiving address"),u=e?.network_name||"destination",d=p.useMemo(()=>Ba(e?.network_name)||Fn,[e?.network_name]);return s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-[var(--optimex-radius-input)] p-4 border border-white/[0.05] animate-in slide-in-from-top-2 duration-300",children:[s.jsxs("div",{className:"flex justify-between items-center mb-2",children:[s.jsx("label",{className:"text-[var(--optimex-text-secondary)] text-xs",children:"Recipient Address"}),a&&s.jsx("button",{type:"button",onClick:l,className:"text-[var(--optimex-text-secondary)]/50 hover:text-[var(--optimex-text-secondary)] transition-colors",children:s.jsx(Ie,{className:"size-4"})})]}),s.jsx(tu,{value:t,onChange:r,placeholder:c(),hasError:!!o,leftIcon:d,rightContent:t?s.jsx("button",{type:"button",onClick:l,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors",children:s.jsx(Ie,{className:"size-5"})}):s.jsx("button",{type:"button",onClick:i,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-primary)] transition-colors",children:s.jsx(Da,{className:"size-5"})})}),o?s.jsxs("p",{className:"text-[10px] text-[var(--optimex-error)] mt-2 flex items-center gap-1",children:[s.jsx(qr,{className:"size-3"}),o]}):s.jsxs("p",{className:"text-[10px] text-[var(--optimex-text-secondary)] mt-2 flex items-center gap-1",children:[s.jsx(qr,{className:"size-3"}),"Ensure the address matches the ",u," network."]})]})}function vn({token:e,value:t,onChange:r,readOnly:n=!1,onSelectToken:o,isLoading:a=!1,loadingText:l="Loading...",balance:i,isOutput:c=!1,isWalletConnected:u=!1,usdValue:d="$0.00"}){const f=h=>{if(n||!r)return;const y=h.target.value;/^[0-9]*\.?[0-9]*$/.test(y)&&r(y)},m=u&&!c&&i!==void 0,b=()=>{if(!i||!r||n)return;const h=(parseFloat(i)/2).toString();r(h)},v=()=>{!i||!r||n||r(i)};return s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-[var(--optimex-radius-input)] p-4 flex flex-col gap-2 border border-white/[0.02] focus-within:border-[var(--optimex-primary)]/40 transition-colors",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)] text-xs",children:c?"To":"From"}),s.jsx("div",{className:"flex items-center gap-2",children:m&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-[var(--optimex-text-secondary)] text-xs",children:["Balance: ",i," ",e?.token_symbol]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(fr,{onClick:b,children:"50%"}),s.jsx(fr,{onClick:v,children:"Max"})]})]})})]}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("input",{type:"text",inputMode:"decimal",placeholder:"0.0",value:t,onChange:f,readOnly:n,className:"w-full bg-transparent border-none p-0 text-[var(--optimex-text)] text-2xl font-bold focus:ring-0 placeholder:text-[var(--optimex-text-secondary)]/30 outline-none"}),s.jsxs("p",{className:"text-[var(--optimex-text-secondary)] text-xs mt-1",children:["~",d]})]}),s.jsxs("button",{onClick:o,className:"flex items-center gap-2 bg-white/5 hover:bg-white/10 p-2 pr-3 rounded-[9999px] transition-all border border-white/10 active:scale-95 shrink-0",children:[e?s.jsxs(s.Fragment,{children:[s.jsx(Fe,{token:e,size:"md"}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"text-[var(--optimex-text)] text-sm font-bold leading-none",children:e.token_symbol}),s.jsx("p",{className:"text-[var(--optimex-text-secondary)] text-[10px] leading-none mt-1",children:e.network_name})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"size-8 rounded-[9999px] bg-white/10"}),s.jsx("span",{className:"text-[var(--optimex-text)] text-sm font-bold",children:"Select"})]}),s.jsx(In,{className:"size-4 text-[var(--optimex-text-secondary)]"})]})]}),a&&s.jsxs("div",{className:"flex items-center justify-end gap-2 text-sm text-[var(--optimex-text-secondary)]",children:[s.jsx("div",{className:"size-3 animate-spin rounded-[9999px] border border-[var(--optimex-primary)] border-t-transparent"}),s.jsx("span",{children:l})]})]})}const Zt=[.5,.75,1];function uu({value:e,onChange:t}){const[r,n]=p.useState(""),[o,a]=p.useState(!Zt.includes(e)),l=p.useCallback(u=>{a(!1),n(""),t(u)},[t]),i=p.useCallback(u=>{const d=u.target.value;if(d===""||/^\d*\.?\d*$/.test(d)){n(d),a(!0);const f=parseFloat(d);!isNaN(f)&&f>0&&f<=50&&t(f)}},[t]),c=p.useCallback(()=>{a(!0),!r&&e&&n(Zt.includes(e)?"":String(e))},[r,e]);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:"Slippage Tolerance"}),s.jsxs("span",{className:"text-sm text-[var(--optimex-text-secondary)]",children:[e,"%"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Zt.map(u=>s.jsxs(fr,{onClick:()=>l(u),isActive:e===u&&!o,className:"flex-1",children:[u,"%"]},u)),s.jsxs("div",{className:`flex flex-1 items-center justify-center px-2 rounded-md transition-colors shadow-sm bg-white/5 border ${o?"border-[var(--optimex-primary)]":"border-transparent hover:bg-white/10"}`,children:[s.jsx("input",{type:"text",inputMode:"decimal",placeholder:"Custom",value:r,onChange:i,onFocus:c,className:"w-full min-w-0 py-[6px] bg-transparent text-center text-xs outline-none placeholder:text-[var(--optimex-text-secondary)] text-[var(--optimex-text)]"}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:"%"})]})]}),e>5&&s.jsx("p",{className:"text-xs text-[var(--optimex-warning)]",children:"This may result in an unfavorable trade. Try lowering your slippage setting."})]})}function du({isOpen:e,onClose:t,value:r,onChange:n,anchorRef:o}){const a=p.useCallback(l=>{n(l)},[n]);return s.jsx(eu,{isOpen:e,onClose:t,anchorRef:o,position:"bottom-right",width:"w-96",ariaLabel:"Slippage settings",children:s.jsx(uu,{value:r,onChange:a})})}const fu=({title:e})=>s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"size-8 bg-[var(--optimex-primary)] rounded-[var(--optimex-radius-button)] flex items-center justify-center shadow-[0_0_15px_rgba(235,98,0,0.3)]",children:s.jsx(Pa,{className:"w-5 h-auto text-white"})}),s.jsx("h2",{className:"text-xl font-bold tracking-tight text-[var(--optimex-text)]",children:e})]});function hu({title:e="Swap",headerLeft:t,slippage:r=.75,onSlippageChange:n,isSettingsOpen:o=!1,onSettingsToggle:a,onHistoryClick:l,hideHistory:i=!1}){const c=p.useRef(null);return s.jsxs("header",{className:"flex items-center justify-between px-2",children:[t??s.jsx(fu,{title:e}),s.jsxs("div",{className:"flex items-center gap-2",children:[!i&&s.jsx("button",{onClick:l,className:"size-10 rounded-[var(--optimex-radius-button)] bg-white/5 hover:bg-white/10 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors flex items-center justify-center","aria-label":"Trade History",children:s.jsx(_a,{className:"size-5"})}),s.jsxs("div",{className:"relative",children:[s.jsx("button",{ref:c,onClick:a,className:"size-10 rounded-[var(--optimex-radius-button)] bg-white/5 hover:bg-white/10 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors flex items-center justify-center","aria-label":"Settings",children:s.jsx($a,{className:"size-5"})}),s.jsx(du,{isOpen:o,onClose:()=>a?.(),value:r,onChange:u=>n?.(u),anchorRef:c})]})]})]})}function ao({onClick:e,disabled:t}){return s.jsx("div",{className:"!m-0 absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10",children:s.jsx("button",{onClick:e,disabled:t,className:"size-10 rounded-[9999px] bg-[var(--optimex-surface)] border-4 border-white/5 flex items-center justify-center text-[var(--optimex-primary)] hover:scale-110 transition-all shadow-xl disabled:cursor-not-allowed",children:s.jsx(Ta,{className:"size-5"})})})}function mu({quote:e,fromToken:t,toToken:r,amount:n,slippage:o,isFetching:a}){const[l,i]=p.useState(!1),[c,u]=p.useState(!1),d=p.useCallback(()=>{u(g=>!g)},[]),f=p.useCallback(()=>{i(g=>!g)},[]),m=parseFloat(n)||0,b=parseFloat(e.min_amount_out)/Math.pow(10,r.token_decimals),v=m>0?b/m:0,h=b>0?m/b:0,y=()=>c?`1 ${r.token_symbol} = ${h.toFixed(6)} ${t.token_symbol}`:`1 ${t.token_symbol} = ${v.toFixed(6)} ${r.token_symbol}`;return s.jsxs("div",{className:"bg-white/[0.02] rounded-[var(--optimex-radius-button)] border border-white/5 overflow-hidden",children:[s.jsxs("button",{type:"button",onClick:f,className:"w-full flex items-center justify-between p-3 text-xs cursor-pointer hover:bg-white/[0.02] transition-colors",children:[s.jsx("div",{className:"flex items-center gap-2 text-[var(--optimex-text-secondary)] font-medium",children:a?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-3 animate-spin rounded-[9999px] border border-[var(--optimex-primary)] border-t-transparent"}),s.jsx("span",{children:"Updating..."})]}):s.jsx("span",{role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),d()},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.stopPropagation(),d())},className:"hover:text-[var(--optimex-text)] transition-colors",children:y()})}),s.jsx(In,{className:`size-4 text-[var(--optimex-text-secondary)] transition-transform ${l?"rotate-180":""}`})]}),l&&s.jsxs("div",{className:"px-3 pb-3 space-y-2 text-xs border-t border-white/5",children:[s.jsxs("div",{className:"flex items-center justify-between pt-3",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Min. Received"}),s.jsxs("span",{className:"font-medium text-[var(--optimex-text)]",children:[Te(e.min_amount_out,r.token_decimals)," ",r.token_symbol]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Est. Time"}),s.jsx("span",{className:"font-medium text-[var(--optimex-primary)]",children:"~10 minutes"})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Slippage Tolerance"}),s.jsxs("span",{className:"font-medium text-[var(--optimex-text)]",children:[o,"%"]})]})]})]})}function pu({text:e,disabled:t,onClick:r}){return s.jsx("button",{disabled:t,onClick:r,className:"w-full font-semibold text-black bg-[var(--optimex-primary)] hover:brightness-110 py-4 rounded-[var(--optimex-radius-button)] shadow-lg shadow-[var(--optimex-primary)]/30 flex items-center justify-center transition-all active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-50",children:e})}function xu(){return s.jsxs("a",{href:"https://optimex.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 text-[var(--optimex-text-secondary)] text-[10px] opacity-50 hover:opacity-70 transition-opacity",children:[s.jsx("span",{children:"Powered by"}),s.jsx(Ma,{className:"h-3 w-auto"})]})}function vu({value:e,onChange:t,placeholder:r="Search by name or symbol..."}){return s.jsx("div",{className:"flex-shrink-0 p-4 pb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"text",placeholder:r,value:e,onChange:n=>t(n.target.value),className:"w-full rounded-xl bg-white/5 border border-white/10 px-4 py-3 pl-10 pr-10 text-[var(--optimex-text)] outline-none placeholder:text-[var(--optimex-text-secondary)]/60 transition-colors hover:border-[var(--optimex-primary)] focus:border-[var(--optimex-primary)]"}),s.jsx(Fa,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-[var(--optimex-text-secondary)]"}),e&&s.jsx("button",{type:"button",onClick:()=>t(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors",children:s.jsx(Ie,{className:"size-5"})})]})})}function gu({networks:e,selectedNetwork:t,onSelectNetwork:r}){return s.jsxs("div",{className:"w-1/3 min-w-[140px] border-r border-white/[0.05] overflow-y-auto p-2",children:[s.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--optimex-text-secondary)]",children:"Networks"}),s.jsxs("div",{className:"space-y-1 px-2",children:[s.jsxs("button",{onClick:()=>r(null),className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors ${t===null?"bg-white/5 text-[var(--optimex-text)]":"text-[var(--optimex-text-secondary)] hover:bg-white/5 hover:text-[var(--optimex-text)]"}`,children:[s.jsx(Na,{}),s.jsx("span",{children:"All"})]}),e.map(n=>s.jsx(bu,{network:n,isSelected:t===n.network_id,onSelect:()=>r(n.network_id)},n.network_id))]})]})}function bu({network:e,isSelected:t,onSelect:r}){return s.jsxs("button",{onClick:r,className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors ${t?"bg-white/5 text-[var(--optimex-text)]":"text-[var(--optimex-text-secondary)] hover:bg-white/5 hover:text-[var(--optimex-text)]"}`,children:[e.logo_uri?s.jsx("img",{src:e.logo_uri,alt:e.name,className:"h-8 w-8 rounded-lg",onError:n=>{n.target.style.display="none"}}):s.jsx("div",{className:"h-6 w-6 rounded-full bg-white/10"}),s.jsx("span",{className:"truncate",children:e.name})]})}function yu({tokens:e,selectedSymbol:t,onSelectSymbol:r,maxVisible:n=12}){return s.jsxs("div",{className:"flex-shrink-0 border-b border-white/[0.05] p-2",children:[s.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--optimex-text-secondary)]",children:"Tokens"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5 overflow-hidden max-h-[5rem]",children:[s.jsx("button",{onClick:()=>r(null),className:`border rounded-lg px-2.5 py-1 text-xs font-medium transition-colors ${t===null?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]"}`,children:"All"}),e.slice(0,n).map(o=>s.jsx(wu,{token:o,isSelected:t===o.token_symbol,onSelect:()=>r(o.token_symbol)},o.token_symbol))]})]})}function wu({token:e,isSelected:t,onSelect:r}){return s.jsxs("button",{onClick:r,className:ls("flex items-center gap-1 rounded-lg px-2.5 py-1 text-xs font-medium transition-colors outline-none border bg-white/5",t?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]"),children:[e.token_logo_uri&&s.jsx("img",{src:e.token_logo_uri,alt:e.token_symbol,className:"h-4 w-4 rounded-full",onError:n=>{n.target.style.display="none"}}),e.token_symbol]})}function Xe(){const e=p.useContext(An);if(!e)throw new Error("useWallet must be used within WalletProvider");return e}function Pt(e){return`https://network-api-stg.bitdex.xyz/${e}/rpc/zwD70RMT9DrE8L5SaMnJNMF8m70Gum`}function Cu(e){return e==="bitcoin_testnet"?"https://mempool.space/testnet4/api":"https://mempool.space/api"}function Er(e){return!e.token_address||e.token_address===""||e.token_address==="native"||e.token_address==="0x0000000000000000000000000000000000000000"}function ku(e,t){if(!e||e==="0")return"0";const r=BigInt(e),n=BigInt(10**t),o=r/n,a=r%n;if(a===BigInt(0))return o.toString();let l=a.toString().padStart(t,"0");return l=l.replace(/0+$/,""),l.length>6&&(l=l.slice(0,6)),`${o}.${l}`}function ju(e){return`0x70a08231000000000000000000000000${e.toLowerCase().replace("0x","")}`}async function io(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`RPC request failed: ${r.status}`);return r.json()}async function Su(e,t){const n=await io(e,{jsonrpc:"2.0",method:"eth_getBalance",params:[t,"latest"],id:1});if(n.error)throw new Error(`RPC error: ${n.error.message}`);const o=n.result||"0x0";return BigInt(o).toString()}async function Eu(e,t,r){const n={jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:ju(r)},"latest"],id:1},o=await io(e,n);if(o.error)throw new Error(`RPC error: ${o.error.message}`);const a=o.result||"0x0";return BigInt(a).toString()}async function Nu(e,t){const r=Pt(e.network_id),n=Er(e);let o;return n?o=await Su(r,t):o=await Eu(r,e.token_address,t),{rawBalance:o,isNative:n}}async function Tu(e,t){const n=`${Cu(e.network_id)}/address/${t}`,o=await fetch(n);if(!o.ok)throw new Error(`Mempool API request failed: ${o.status}`);const a=await o.json(),l=a.chain_stats.funded_txo_sum-a.chain_stats.spent_txo_sum,i=a.mempool_stats.funded_txo_sum-a.mempool_stats.spent_txo_sum;return{rawBalance:(l+i).toString(),isNative:!0}}async function lo(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`RPC request failed: ${r.status}`);return r.json()}async function Ru(e,t){const n=await lo(e,{jsonrpc:"2.0",method:"getBalance",params:[t],id:1});if(n.error)throw new Error(`RPC error: ${n.error.message}`);return(n.result?.value||0).toString()}async function Ou(e,t,r){const o=await lo(e,{jsonrpc:"2.0",method:"getTokenAccountsByOwner",params:[r,{mint:t},{encoding:"jsonParsed"}],id:1});if(o.error)throw new Error(`RPC error: ${o.error.message}`);const a=o.result?.value||[];let l=BigInt(0);for(const i of a){const c=i.account.data.parsed.info.tokenAmount.amount;l+=BigInt(c)}return l.toString()}async function _u(e,t){const r=Pt(e.network_id),n=Er(e);let o;return n?o=await Ru(r,t):o=await Ou(r,e.token_address,t),{rawBalance:o,isNative:n}}function Au(e,t){if(!t)return!1;switch(t){case K.EVM:return e.isEvmConnected;case K.BTC:return e.isBtcConnected;case K.SOLANA:return e.isSolanaConnected;default:return!1}}function Pu(e){if(!e)return"";switch(e){case K.EVM:return"EVM";case K.BTC:return"Bitcoin";case K.SOLANA:return"Solana";default:return e}}function Mu(e,t){if(!t)return null;switch(t){case K.EVM:return e.evmAddress;case K.BTC:return e.btcAddress;case K.SOLANA:return e.solanaAddress;default:return null}}async function co({provider:e,address:t,chainId:r,chainName:n="Unknown"}){let o=t;if(!o){const l=await e.request({method:"eth_accounts"});if(!l||l.length===0)throw new Error("No accounts found. Please connect your wallet first.");o=l[0]}let a=r;if(a===void 0){const l=await e.request({method:"eth_chainId"});a=parseInt(l,16)}return uo({provider:e,address:o,chainId:a,chainName:n})}function uo({provider:e,address:t,chainId:r,chainName:n="Unknown"}){return{address:t,publicKey:t,chain:{id:r,name:n,type:"EVM"},sendTransaction:async i=>{const c=i;return await e.request({method:"eth_sendTransaction",params:[{from:t,to:c.to,value:c.value?`0x${c.value.toString(16)}`:void 0,data:c.data}]})},getChainId:async()=>{const i=await e.request({method:"eth_chainId"});return parseInt(i,16)},switchChain:async i=>{try{await e.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${i.toString(16)}`}]})}catch(c){throw c.code===4902?new Error(`Chain ${i} not found in wallet. Please add it first.`):c}}}}const Du=co;async function Iu(e,t){const r=e.token_address||"native";let n;switch(e.network_type){case K.BTC:n=await Tu(e,t);break;case K.SOLANA:n=await _u(e,t);break;case K.EVM:default:n=await Nu(e,t)}return{tokenId:r,networkId:e.network_id,walletAddress:t,rawBalance:n.rawBalance,formattedBalance:ku(n.rawBalance,e.token_decimals),updatedAt:Date.now()}}const Lu=30*1e3,Fu=15*1e3;function $u(e,t){return!e||!t?["balance"]:["balance",e.network_id,e.token_address||"native",t]}function fo({token:e,walletAddress:t,enabled:r=!0,polling:n=!1,pollingInterval:o=Fu}){const a=r&&!!e&&!!t,{data:l,isLoading:i,isFetching:c,error:u,refetch:d}=Ge({queryKey:$u(e,t),queryFn:()=>Iu(e,t),enabled:a,staleTime:Lu,retry:1,refetchOnWindowFocus:!1,refetchInterval:n?o:!1});return{balance:l,formattedBalance:l?.formattedBalance||"0",isLoading:a&&i,isFetching:a&&c,error:u,refetch:d}}function Bu({token:e,isSelected:t,isDisabled:r,onSelect:n}){const o=Xe(),a=Mu(o,e.network_type),{formattedBalance:l,isLoading:i}=fo({token:e,walletAddress:a,enabled:!!a}),c=!!a;return s.jsxs("button",{onClick:n,disabled:r,className:`flex w-full items-center gap-3 rounded-lg p-2 transition-colors ${t?"bg-white/5 text-[var(--optimex-text)]":r?"cursor-not-allowed opacity-50":"hover:bg-white/5"}`,children:[s.jsx(Fe,{token:e}),s.jsxs("div",{className:"flex-1 text-left",children:[s.jsx("div",{className:"text-sm text-[var(--optimex-text-secondary)]",children:e.token_name}),s.jsxs("div",{className:"flex items-center gap-2",children:[c&&s.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:i?s.jsx("span",{className:"inline-block h-4 w-12 animate-pulse rounded bg-white/10"}):l}),s.jsx("span",{className:"font-medium text-[var(--optimex-text)]",children:e.token_symbol})]})]}),t&&s.jsx(gr,{className:"h-5 w-5 text-[var(--optimex-primary)]"})]})}function zu({tokens:e,selectedTokenId:t,disabledTokenId:r,disabledTokenIds:n,isLoading:o,emptyMessage:a="No tokens available",onSelect:l}){return o?s.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-[var(--optimex-primary)] border-t-transparent"})})}):e.length===0?s.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:s.jsx("div",{className:"py-8 text-center text-[var(--optimex-text-secondary)]",children:a})}):s.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:s.jsx("div",{className:"space-y-1",children:e.map(i=>{const c=r===i.token_id||n?.has(i.token_id)===!0;return s.jsx(Bu,{token:i,isSelected:t===i.token_id,isDisabled:c,onSelect:()=>l(i)},i.token_id)})})})}function Wu({isOpen:e,onClose:t,onSelect:r,tokensData:n,isLoading:o,selectedToken:a,disabledTokenId:l,disabledTokenIds:i,tokens:c,emptyMessage:u,title:d="Select Token",filterNetworkType:f}){const[m,b]=p.useState(""),[v,h]=p.useState(null),[y,g]=p.useState(null),S=p.useMemo(()=>n?.supported_networks?f?n.supported_networks.filter(M=>M.type===f):n.supported_networks:[],[n,f]),k=c??n?.tokens,w=p.useMemo(()=>k?k.filter(M=>{if(f&&M.network_type!==f||v&&M.network_id!==v)return!1;if(m){const $=(W,V)=>W.toLowerCase().includes(V.toLowerCase()),_=m.toLowerCase();return $(M.token_symbol,_)||$(M.token_name,_)||$(M.token_address,_)}return!0}):[],[k,m,v,f]),N=p.useMemo(()=>{if(!k)return[];const M=new Map;return k.forEach($=>{f&&$.network_type!==f||v&&$.network_id!==v||M.has($.token_symbol)||M.set($.token_symbol,$)}),Array.from(M.values())},[k,f,v]),A=p.useMemo(()=>y?w.filter(M=>M.token_symbol===y):w,[w,y]),C=()=>{b(""),h(null),g(null)},j=M=>{r(M),t(),C()},O=M=>{M||(t(),C())},L=M=>{h(M),g(null)};return s.jsx(jr,{open:e,onOpenChange:O,title:d,className:"h-full md:h-[70vh] max-h-[600px] w-full max-w-2xl",children:s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsx(vu,{value:m,onChange:b}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsx(gu,{networks:S,selectedNetwork:v,onSelectNetwork:L}),s.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden pl-2",children:[s.jsx(yu,{tokens:N,selectedSymbol:y,onSelectSymbol:g}),s.jsx(zu,{tokens:A,selectedTokenId:a?.token_id,disabledTokenId:l,disabledTokenIds:i,isLoading:o,emptyMessage:m?"No tokens found":u??"No tokens available",onSelect:j})]})]})]})})}function gn({token:e,amount:t,label:r,isEstimated:n=!1,highlight:o=!1,usdValue:a="$0.00"}){return s.jsx("div",{className:`p-4 rounded-xl border transition-all duration-200 ${o?"bg-zinc-900/50 border-[var(--optimex-primary)]/20 shadow-[0_0_15px_rgba(235,98,0,0.1)]":"bg-zinc-900/50 border-white/5"}`,children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"size-12 flex items-center justify-center ",children:s.jsx(Fe,{token:e,size:"lg"})}),s.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[s.jsxs("p",{className:`text-xs font-medium uppercase tracking-wider ${o?"text-[var(--optimex-primary)]":"text-zinc-500"}`,children:[r," ",n&&"(Est.)"]}),s.jsx("p",{className:"text-white text-sm font-semibold truncate",children:e.token_symbol}),s.jsx("p",{className:"text-zinc-500 text-xs truncate",children:e.network_name})]}),s.jsxs("div",{className:"flex flex-col items-end gap-0.5 ml-auto shrink-0",children:[s.jsx("p",{className:"text-white text-lg font-bold",children:n?`~${t}`:t}),s.jsx("p",{className:"text-zinc-400 text-xs",children:a})]})]})})}function Vu({fromToken:e,toToken:t,fromAmount:r,toAmount:n,fromUsdValue:o="$0.00",toUsdValue:a="$0.00"}){return s.jsxs("div",{className:"relative flex flex-col gap-2",children:[s.jsx(gn,{token:e,amount:r,label:"You Pay",usdValue:o}),s.jsx(ao,{onClick:()=>{},disabled:!0}),s.jsx(gn,{token:t,amount:n,label:"You Receive",usdValue:a})]})}function Xt({label:e,value:t,borderTop:r}){return s.jsxs("div",{className:`flex justify-between items-center text-sm ${r?"pt-2 mt-2 border-t border-white/5":""}`,children:[s.jsx("span",{className:"text-zinc-500",children:e}),s.jsx("div",{className:"flex items-center gap-1 text-white font-medium",children:t})]})}function Uu({minReceived:e,estimatedTime:t,slippage:r,networkFee:n="Included"}){return s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-xl p-4 border border-white/5 space-y-3",children:[s.jsx(Xt,{label:"Min. Received",value:e}),s.jsx(Xt,{label:"Estimated Time",value:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-2 bg-[var(--optimex-primary)] rounded-full animate-pulse shadow-[0_0_8px_rgba(235,98,0,0.8)]"}),s.jsx("span",{children:t})]})}),s.jsx(Xt,{label:"Slippage Tolerance",value:r})]})}const Hu=3e4,qu=6e4;function Rt({symbol:e,enabled:t=!0}){const r=ct(),{data:n,isLoading:o,isError:a}=Ge({queryKey:["tokenPrice",e],queryFn:async()=>{if(!e)throw new Error("Symbol is required");return(await Ke(r.apiBaseUrl).getTokenPrice(e)).current_price},enabled:t&&!!e,staleTime:Hu,refetchInterval:qu,retry:2});return{price:n??null,isLoading:o,isError:a,calculateUsdValue:i=>{if(!n||!i||isNaN(parseFloat(i)))return"$0.00";const c=parseFloat(i);if(c===0)return"$0.00";const u=c*n;return u<.01?"<$0.01":u<1?`$${u.toFixed(4)}`:u<1e3?`$${u.toFixed(2)}`:u<1e6?`$${(u/1e3).toFixed(2)}K`:`$${(u/1e6).toFixed(2)}M`}}}function Qu({isOpen:e,onClose:t,onConfirm:r,fromToken:n,toToken:o,amountIn:a,quote:l,slippage:i,stage:c,receivingAddress:u=""}){const d=c!=="idle"&&c!=="confirming"&&c!=="error"&&c!=="submitted",f=c==="submitted",m=c==="error",b=Te(l.min_amount_out,o.token_decimals),{calculateUsdValue:v}=Rt({symbol:n.token_symbol,enabled:e}),{calculateUsdValue:h}=Rt({symbol:o.token_symbol,enabled:e}),y=v(a),g=h(b),S=w=>{!w&&!d&&t()},k=f?"Swap Complete":m?"Swap Failed":"Review Swap";return s.jsxs(jr,{open:e,onOpenChange:S,title:k,showCloseButton:!d,className:"w-full max-w-md",children:[s.jsxs(Yc,{className:"space-y-3",children:[s.jsx(Vu,{fromToken:n,toToken:o,fromAmount:a,toAmount:b,fromUsdValue:y,toUsdValue:g}),s.jsx(Uu,{minReceived:`${b} ${o.token_symbol}`,estimatedTime:"~10 minutes",slippage:`${i}%`}),u&&s.jsx("div",{className:"bg-[var(--optimex-surface)] rounded-xl px-2 border border-white/5",children:s.jsx(Wa,{icon:Fn,label:"Receiving Address",address:u})})]}),s.jsx(Zc,{children:s.jsx(Pi,{state:d?"processing":f?"success":m?"error":"idle",onConfirm:f?t:r,confirmText:"Confirm Swap"})})]})}function Gu({swap:e}){const{tokens:t,modals:r,tokenSelect:n,actions:o,input:a,quote:l,execution:i}=e;return s.jsxs(s.Fragment,{children:[r.tokenSelect.isOpen&&s.jsx(Wu,{isOpen:r.tokenSelect.isOpen,onClose:r.tokenSelect.close,onSelect:o.selectToken,tokensData:t.data,isLoading:!1,selectedToken:n.type==="from"?t.from:t.to,disabledTokenId:n.type==="from"?t.to?.token_id:t.from?.token_id,tokens:n.type==="to"?t.availableTo:t.all,emptyMessage:n.type==="to"?"No available pairs for selected source token":void 0,title:n.type==="from"?"Select Source Token":"Select Destination Token"}),l.data&&t.from&&t.to&&r.confirm.isOpen&&s.jsx(Qu,{isOpen:r.confirm.isOpen,onClose:o.closeConfirmModal,onConfirm:o.confirmSwap,fromToken:t.from,toToken:t.to,amountIn:a.amount,quote:l.data,slippage:a.slippage,stage:i.stage,txHash:i.txHash,error:i.error,receivingAddress:e.addresses.receiving})]})}function Nr({status:e}){const t={pending:{icon:Ln,text:"Processing",bgClass:"bg-yellow-500/10",textClass:"text-yellow-500",animate:!0},success:{icon:gr,text:"Completed",bgClass:"bg-green-500/10",textClass:"text-green-500",animate:!1},failed:{icon:Ra,text:"Failed",bgClass:"bg-red-500/10",textClass:"text-red-500",animate:!1}},{icon:r,text:n,bgClass:o,textClass:a,animate:l}=t[e];return s.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${o}`,children:[s.jsx(r,{className:`w-4 h-4 ${a} ${l?"animate-spin":""}`}),s.jsx("span",{className:`text-xs font-medium ${a}`,children:n})]})}function Ku({onClose:e}){return s.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-[var(--optimex-border)] rounded-xl p-4 mt-3",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)] font-medium",children:"Recent Trade"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nr,{status:"pending"}),e&&s.jsx("button",{onClick:e,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors cursor-pointer","aria-label":"Close",children:s.jsx(Ie,{className:"w-4 h-4"})})]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("div",{className:"w-16 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsx("div",{className:"w-10 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]})]}),s.jsx("div",{className:"flex items-center px-3",children:s.jsx("svg",{className:"w-5 h-5 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsx("div",{className:"w-16 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsx("div",{className:"w-10 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]}),s.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"})]})]})]})}function Yu({trade:e,status:t,isLoading:r,onClose:n}){if(r||!e)return s.jsx(Ku,{onClose:n});const o=e.from_token,a=e.to_token,l=Te(e.amount_in,o.token_decimals),i=Te(e.min_amount_out,a.token_decimals);return s.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-[var(--optimex-border)] rounded-xl p-4 mt-3",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)] font-medium",children:"Recent Trade"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nr,{status:t}),n&&s.jsx("button",{onClick:n,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors cursor-pointer","aria-label":"Close",children:s.jsx(Ie,{className:"w-4 h-4"})})]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Fe,{token:o,size:"sm",showNetworkBadge:!1}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:l}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:o.token_symbol})]})]}),s.jsx("div",{className:"flex items-center px-3",children:s.jsx("svg",{className:"w-5 h-5 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:i}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:a.token_symbol})]}),s.jsx(Fe,{token:a,size:"sm",showNetworkBadge:!1})]})]})]})}const Zu=1e4;function Xu({apiBaseUrl:e,walletAddresses:t,enabled:r=!0,limit:n=20}){const{data:o,isLoading:a,isError:l,refetch:i}=Ge({queryKey:["trades",t,n],queryFn:async()=>Ke(e).listTrades({from_user_address:t,limit:n}),enabled:r&&!!t?.length,refetchInterval:Zu,retry:2,retryDelay:2e3});return{trades:o??[],isLoading:a,isError:l,refetch:i}}function Ju(e){if(!e)return"pending";switch(e.toLowerCase()){case"success":case"completed":return"success";case"failed":case"refunded":case"expired":return"failed";default:return"pending"}}function ed({trade:e}){const t=e.from_token,r=e.to_token,n=Ju(e.state),o=Te(e.amount_in,t.token_decimals),a=Te(e.min_amount_out,r.token_decimals);return s.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-[var(--optimex-border)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Fe,{token:t,size:"sm",showNetworkBadge:!1}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:o}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:t.token_symbol})]})]}),s.jsx("div",{className:"flex items-center px-2",children:s.jsx("svg",{className:"w-4 h-4 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:a}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:r.token_symbol})]}),s.jsx(Fe,{token:r,size:"sm",showNetworkBadge:!1})]}),s.jsx("div",{className:"ml-3",children:s.jsx(Nr,{status:n})})]})}function Jt(){return s.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-[var(--optimex-border)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("div",{className:"w-14 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsx("div",{className:"w-8 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]})]}),s.jsx("div",{className:"w-4 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsx("div",{className:"w-14 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsx("div",{className:"w-8 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]}),s.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"})]}),s.jsx("div",{className:"ml-3 w-20 h-6 bg-[var(--optimex-border)] rounded-full animate-pulse"})]})}function td(){return s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx("div",{className:"w-16 h-16 mb-4 rounded-full bg-[var(--optimex-surface)] flex items-center justify-center",children:s.jsx("svg",{className:"w-8 h-8 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),s.jsx("p",{className:"text-sm text-[var(--optimex-text-secondary)]",children:"No trade history yet"})]})}function rd({open:e,onOpenChange:t,evmAddress:r,btcAddress:n,solanaAddress:o}){const a=ct(),l=[r,n,o].filter(u=>!!u),{trades:i,isLoading:c}=Xu({apiBaseUrl:a.apiBaseUrl,walletAddresses:l.length>0?l:void 0,enabled:e&&l.length>0});return s.jsx(jr,{open:e,onOpenChange:t,title:"Trade History",className:"w-full max-w-md",children:s.jsxs("div",{className:"p-4 space-y-3 max-h-[60vh] overflow-y-auto",children:[c?s.jsxs(s.Fragment,{children:[s.jsx(Jt,{}),s.jsx(Jt,{}),s.jsx(Jt,{})]}):i.length===0?s.jsx(td,{}):i.map(u=>s.jsx(ed,{trade:u},u.trade_id)),!c&&i.length>0&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2 text-xs text-[var(--optimex-text-secondary)]",children:[s.jsx(Ln,{className:"w-3 h-3 animate-spin"}),s.jsx("span",{children:"Auto-refreshing"})]})]})})}function nd(e,t){return p.useMemo(()=>{const r=e.trim();if(!t||!r)return{isValid:!r,error:void 0};const n=vr(r,t.network_type,t.network_id);return{isValid:n.isValid,error:n.isValid?void 0:n.error}},[e,t])}function sd(){const[e,t]=p.useState(null),[r,n]=p.useState(!1),[o,a]=p.useState(!1),l=p.useCallback(()=>t("from"),[]),i=p.useCallback(()=>t("to"),[]),c=p.useCallback(()=>t(null),[]),u=p.useCallback(()=>n(!0),[]),d=p.useCallback(()=>n(!1),[]),f=p.useCallback(()=>a(b=>!b),[]),m=p.useCallback(()=>a(!1),[]);return{tokenSelect:{isOpen:e!==null,type:e,openFrom:l,openTo:i,close:c},confirm:{isOpen:r,open:u,close:d},settings:{isOpen:o,toggle:f,close:m}}}function od({fromToken:e,toToken:t,amount:r,fromUserAddress:n,toUserAddress:o,userRefundPubkey:a,slippage:l,config:i}){return p.useMemo(()=>{const c=o.trim(),u=i.affiliateAddress&&i.affiliateFee?[{provider:i.affiliateProvider??"optimex-widget",rate:String(i.affiliateFee),receiver:i.affiliateAddress,network:"ethereum"}]:void 0,d=Math.round(l*100);return{from_token:e,to_token:t,amount:r,from_user_address:n,to_user_address:c||null,user_refund_pubkey:a,slippage:String(d),affiliate_fee_bps:i.affiliateFee?String(i.affiliateFee):void 0,affiliate_info:u,trade_timeout:i.tradeTimeout,script_timeout:i.scriptTimeout}},[e,t,r,n,o,a,l,i.affiliateFee,i.affiliateAddress,i.affiliateProvider,i.tradeTimeout,i.scriptTimeout])}function ad(e,t){return p.useMemo(()=>{if(!e||!t)return{walletAccount:void 0,evmWalletAccount:void 0};switch(e.network_type){case K.EVM:return{walletAccount:t.evm,evmWalletAccount:t.evm};case K.BTC:return{walletAccount:t.btc,evmWalletAccount:void 0};case K.SOLANA:return{walletAccount:t.solana,evmWalletAccount:void 0};default:return{walletAccount:void 0,evmWalletAccount:void 0}}},[e,t])}const bn={BTC:1,EVM:2,Solana:3};function id(e){const{tokens:t,pairs:r,selectedFromToken:n}=e,o=p.useMemo(()=>{const b=new Map;if(!r)return b;for(const v of r){if(!v.is_active)continue;const h=b.get(v.from_token_id);h?h.add(v.to_token_id):b.set(v.from_token_id,new Set([v.to_token_id]))}return b},[r]),a=p.useMemo(()=>t??[],[t]),l=p.useMemo(()=>{const b=new Set;for(const v of a){const h=o.get(v.token_id);(!h||h.size===0)&&b.add(v.token_id)}return b},[a,o]),i=p.useMemo(()=>{if(!n)return[];const b=o.get(n.token_id);return!b||b.size===0?[]:a.filter(v=>b.has(v.token_id))},[n,o,a]),c=p.useCallback((b,v)=>o.get(b)?.has(v)??!1,[o]),u=p.useCallback(b=>(o.get(b)?.size??0)>0,[o]),d=p.useCallback(b=>[...b].sort((v,h)=>{const y=bn[v.network_type]??99,g=bn[h.network_type]??99;return y-g}),[]),f=p.useCallback(b=>{const v=o.get(b.token_id);if(!v||v.size===0)return null;const h=a.filter(g=>v.has(g.token_id));return h.length===0?null:d(h)[0]??null},[o,a,d]),m=p.useCallback(()=>{if(a.length===0)return null;const b=d(a);for(const v of b){const h=f(v);if(h)return{fromToken:v,toToken:h}}return null},[a,d,f]);return{allTokens:a,tokensWithoutPairs:l,availableToTokens:i,isPairValid:c,findBestToToken:f,hasValidPairs:u,getDefaultPair:m}}function ld(e){if(!e.chain_id||e.network_type!=="EVM")return;const t=parseInt(e.chain_id,10);return isNaN(t)?void 0:t}async function cd(e,t){const r=ld(t);if(!r)throw new Error(`Cannot determine chain ID for token: ${t.token_id}`);return await e.getChainId()===r?!1:(await e.switchChain(r),!0)}const ud="0xdd62ed3e",dd="0x095ea7b3",fd="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";function hr(e){return e.toLowerCase().replace("0x","").padStart(64,"0")}function hd(e){return e.toString(16).padStart(64,"0")}function md(e){const t=e.startsWith("0x")?e.slice(2):e;return!t||t===""?0n:BigInt("0x"+t)}async function pd(e,t,r,n){const o=Pt(e),a=ud+hr(r)+hr(n),i=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:t,data:a},"latest"]})})).json();if(i.error)throw new Error(`Failed to check allowance: ${i.error.message}`);return md(i.result)}function xd(e,t){const r=t?hd(t):fd.slice(2);return`${dd}${hr(e)}${r}`}async function vd(e,t,r,n){const o=xd(r,n);return await e.sendTransaction({to:t,data:o})}async function gd(e,t,r=60,n=2e3){const o=Pt(e);for(let a=0;a<r;a++){const i=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_getTransactionReceipt",params:[t]})})).json();if(i.error)throw new Error(`RPC error: ${i.error.message}`);if(i.result){const c=i.result;return{status:c.status==="0x1"?"success":"reverted",blockNumber:c.blockNumber,transactionHash:c.transactionHash}}await new Promise(c=>setTimeout(c,n))}throw new Error(`Transaction ${t} not confirmed after ${r} attempts`)}function bd(e){return e?"getChainId"in e&&"switchChain"in e&&typeof e.getChainId=="function"&&typeof e.switchChain=="function":!1}function yd({apiBaseUrl:e,onWalletTx:t,onSubmitTx:r,onError:n}){const[o,a]=p.useState({stage:"idle",txHash:null,tradeId:null,error:null}),l=p.useCallback(()=>{a({stage:"idle",txHash:null,tradeId:null,error:null})},[]),i=p.useCallback(()=>{a(f=>({stage:"idle",txHash:f.txHash,tradeId:f.tradeId,error:null}))},[]),c=p.useCallback((f,m,b)=>{a(v=>({...v,stage:"error",error:f})),n?.({error:f,stage:m,trade_id:b})},[n]),u=p.useCallback(async(f,m,b,v)=>{const h=b.deposit_address;if(!h)throw new Error("Missing deposit address for EVM transaction");a(k=>({...k,stage:"switching_chain"})),await cd(f,m);const y=Er(m);if(!y&&m.token_address&&(a(w=>({...w,stage:"checking_allowance"})),await pd(m.network_id,m.token_address,f.address,h)<v)){a(A=>({...A,stage:"approving"}));const w=await vd(f,m.token_address,h,v);if((await gd(m.network_id,w)).status==="reverted")throw new Error("Token approval transaction reverted")}a(k=>({...k,stage:"broadcasting"}));const g={to:h,value:y?v:0n,data:b.payload?b.payload:void 0};return await f.sendTransaction(g)},[]),d=p.useCallback(async({quote:f,fromToken:m,toToken:b,amountIn:v,walletAccount:h,evmWalletAccount:y})=>{const g=Ke(e);try{a({stage:"confirming",txHash:null,tradeId:f.trade_id,error:null});const S=y||h;if(!S)throw new Error("Wallet not available");a(N=>({...N,stage:"signing"}));let k;const w=Mn(v,m.token_decimals);if(m.network_type===K.EVM){const N=y||(bd(h)?h:null);if(N)k=await u(N,m,f,w);else{const A=f.deposit_address,C=f.payload?f.payload:void 0;if(!A)throw new Error("Missing deposit address for EVM transaction");a(O=>({...O,stage:"broadcasting"}));const j={to:A,value:w,data:C};k=await S.sendTransaction(j)}}else if(m.network_type===K.BTC){if(!f.deposit_address)throw new Error("Missing deposit address for BTC transaction");a(N=>({...N,stage:"broadcasting"})),k=await S.sendTransaction({toAddress:f.deposit_address,amount:w})}else if(m.network_type===K.SOLANA){if(!f.payload)throw new Error("Missing payload for Solana transaction");a(N=>({...N,stage:"broadcasting"})),k=await S.sendTransaction(f.payload)}else throw new Error(`Unsupported network type: ${m.network_type}`);t?.({trade_id:f.trade_id,tx_hash:k,from_token:m,to_token:b,amount_in:v}),a(N=>({...N,txHash:k,stage:"submitting"}));try{await g.submitTransaction(f.trade_id,k),r?.({trade_id:f.trade_id,tx_hash:k,status:"success"})}catch(N){throw r?.({trade_id:f.trade_id,tx_hash:k,status:"error",error:N.message}),N}return a(N=>({...N,stage:"submitted"})),{tradeId:f.trade_id,txHash:k}}catch(S){const k=o.stage==="approving"?"approval":"wallet_tx";throw c(S,k,f.trade_id),S}},[e,t,r,c,u,o.stage]);return{...o,executeSwap:d,resetState:l,resetStateKeepTradeId:i,isExecuting:o.stage!=="idle"&&o.stage!=="submitted"&&o.stage!=="error"}}function wd({defaultPair:e,isPairValid:t,findBestToToken:r,hasValidPairs:n,defaultSlippage:o=.75,selectingToken:a=null}){const[l,i]=p.useState(null),[c,u]=p.useState(null),[d,f]=p.useState(""),[m,b]=p.useState(""),[v,h]=p.useState(o),y=l??e?.fromToken??null,g=c??e?.toToken??null,S=p.useCallback(()=>{y&&g&&t(g.token_id,y.token_id)&&(i(g),u(y),f(""))},[y,g,t]),k=p.useCallback(w=>{if(a==="from"){if(!n(w.token_id))return!1;if(w.token_id===g?.token_id)u(y);else if(g&&!t(w.token_id,g.token_id)){const N=r(w);u(N)}return i(w),!0}else if(a==="to")return w.token_id===y?.token_id&&i(g),u(w),!0;return!1},[a,y,g,t,r,n]);return{fromToken:y,toToken:g,handleTokenSelect:k,handleSwapDirection:S,amount:d,setAmount:f,receivingAddress:m,setReceivingAddress:b,slippage:v,setSlippage:h}}function Cd({fromToken:e,toToken:t}){const r=Xe();return p.useMemo(()=>{const n=r.evmAddress,o=r.btcAddress,a=r.btcPublicKey;let l=null,i=null;return e?.network_type===K.EVM?(l=n,i=n):e?.network_type===K.BTC&&(l=o,i=a),{fromUserAddress:l,userRefundPubkey:i}},[r.evmAddress,r.btcAddress,r.btcPublicKey,e,t])}function kd({fromToken:e,toToken:t,amount:r,quote:n,isLoadingQuote:o,isFetchingQuote:a,receivingAddress:l,onConnectWallet:i,onSwap:c}){const u=Xe();return p.useMemo(()=>{if(!Au(u,e?.network_type)){const m=Pu(e?.network_type);return{text:m?`Connect ${m} Wallet`:"Connect Wallet",disabled:!1,action:i}}return!e||!t?{text:"Select Tokens",disabled:!0,action:void 0}:!r||parseFloat(r)<=0?{text:"Enter Amount",disabled:!0,action:void 0}:l.trim()?vr(l,t.network_type,t.network_id).isValid?o||a?{text:"Getting Quote...",disabled:!0,action:void 0}:n?{text:"Review",disabled:!1,action:c}:{text:"Unable to Quote",disabled:!0,action:void 0}:{text:"Enter Receiving Address",disabled:!0,action:void 0}:{text:"Enter Receiving Address",disabled:!0,action:void 0}},[u.isEvmConnected,u.isBtcConnected,u.isSolanaConnected,e,t,r,o,a,n,i,c,l])}function jd({tokens:e,defaultFromToken:t,defaultToToken:r,isPairValid:n}){return p.useMemo(()=>{if(!t||!r||!e)return null;const o=e.find(l=>l.token_id===t),a=e.find(l=>l.token_id===r);return!o||!a?null:n(o.token_id,a.token_id)?{fromToken:o,toToken:a}:null},[e,t,r,n])}function Sd(){const e=Xe(),t=ct(),r=sd(),{tokensData:n}=lu(),o=n.tokens,a=n.pairs,{allTokens:l,tokensWithoutPairs:i,isPairValid:c,findBestToToken:u,hasValidPairs:d,getDefaultPair:f}=id({tokens:o,pairs:a,selectedFromToken:null}),b=jd({tokens:o,defaultFromToken:t.defaultFromToken,defaultToToken:t.defaultToToken,isPairValid:c})??f(),{fromToken:v,toToken:h,handleTokenSelect:y,handleSwapDirection:g,amount:S,setAmount:k,receivingAddress:w,setReceivingAddress:N,slippage:A,setSlippage:C}=wd({defaultPair:b,isPairValid:c,findBestToToken:u,hasValidPairs:d,defaultSlippage:t.defaultSlippage,selectingToken:r.tokenSelect.type}),j=p.useMemo(()=>v?l.filter(F=>c(v.token_id,F.token_id)):[],[v,l,c]),O=nd(w,h),{fromUserAddress:L,userRefundPubkey:M}=Cd({fromToken:v,toToken:h}),$=od({fromToken:v,toToken:h,amount:S,fromUserAddress:L,toUserAddress:w,userRefundPubkey:M,slippage:A,config:{affiliateFee:t.affiliateFee,affiliateAddress:t.affiliateAddress,affiliateProvider:t.affiliateProvider,tradeTimeout:t.tradeTimeout,scriptTimeout:t.scriptTimeout}}),_=!!v&&!!h&&parseFloat(S)>0&&!!w.trim()&&!r.confirm.isOpen,{data:W,isLoading:V,isFetching:Q,refetch:U}=Sa(t.apiBaseUrl,{...$,enabled:_,onQuote:t.callbacks?.onQuote}),E=yd({apiBaseUrl:t.apiBaseUrl,onWalletTx:t.callbacks?.onWalletTx,onSubmitTx:t.callbacks?.onSubmitTx,onError:t.callbacks?.onError}),{walletAccount:ne,evmWalletAccount:ie}=ad(v,e.externalWalletClient??void 0),Re=p.useCallback(()=>{e.isExternalWallet?e.onRequestWallet?.(v?.network_id??""):e.openConnectModal?.()},[e,v?.network_id]),pe=p.useCallback(()=>{!W||!v||!h||(E.resetState(),r.confirm.open())},[W,v,h,r.confirm,E]),H=p.useCallback((F=!1)=>{E.isExecuting||(r.confirm.close(),F&&E.resetStateKeepTradeId())},[E,r.confirm]),Z=p.useCallback(async()=>{if(!(!W||!v||!h))try{const{txHash:F}=await E.executeSwap({quote:W,fromToken:v,toToken:h,amountIn:S,walletAccount:ne,evmWalletAccount:ie});H(!!F),k(""),N("")}catch(F){console.error("Swap failed:",F)}},[W,v,h,S,ne,ie,E,H,k,N]),de=p.useCallback(F=>{y(F)&&r.tokenSelect.close()},[y,r.tokenSelect]),ye=kd({fromToken:v,toToken:h,amount:S,quote:W,isLoadingQuote:V,isFetchingQuote:Q,receivingAddress:w,onConnectWallet:Re,onSwap:pe});return{tokens:{from:v,to:h,all:l,availableTo:j,withoutPairs:i,data:n},input:{amount:S,setAmount:k,receivingAddress:w,setReceivingAddress:N,slippage:A,setSlippage:C},quote:{data:W,isLoading:V,isFetching:Q,refetch:U},validation:{address:O},buttonState:ye,modals:r,tokenSelect:{type:r.tokenSelect.type},actions:{selectToken:de,swapDirection:g,connectWallet:Re,openSwapConfirm:pe,closeConfirmModal:H,confirmSwap:Z},execution:{stage:E.stage,txHash:E.txHash,tradeId:E.tradeId,error:E.error,isExecuting:E.isExecuting},wallet:e,addresses:{sending:L,receiving:w}}}const Ed=5e3;function yn(e){if(!e)return"pending";switch(e.toLowerCase()){case"success":case"completed":return"success";case"failed":case"refunded":case"expired":return"failed";default:return"pending"}}function Nd({apiBaseUrl:e,tradeId:t}){const{data:r,isLoading:n}=Ge({queryKey:["trade",t],queryFn:async()=>Ke(e).getTrade(t),enabled:!!t,refetchInterval:o=>{const a=o.state.data;return a&&yn(a.state)==="success"?!1:Ed},retry:!0,retryDelay:2e3});return{trade:r??null,status:yn(r?.state),isLoading:n}}function ho(){const e=Sd(),t=ct(),{tokens:r,input:n,quote:o,modals:a,buttonState:l,validation:i,actions:c,addresses:u,wallet:d,execution:f}=e,[m,b]=p.useState(!1),{trade:v,status:h,isLoading:y}=Nd({apiBaseUrl:t.apiBaseUrl,tradeId:f.tradeId}),{formattedBalance:g}=fo({token:r.from,walletAddress:u.sending,enabled:!!r.from&&!!u.sending,polling:!0}),{calculateUsdValue:S}=Rt({symbol:r.from?.token_symbol,enabled:!!r.from}),{calculateUsdValue:k}=Rt({symbol:r.to?.token_symbol,enabled:!!r.to}),w=d.isConnected,N=S(n.amount),A=o.data?k(Te(o.data.min_amount_out,r.to?.token_decimals||18)):"$0.00";return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-col gap-4 w-full min-w-0",children:[s.jsx(hu,{headerLeft:t.headerLeft,slippage:n.slippage,onSlippageChange:n.setSlippage,isSettingsOpen:a.settings.isOpen,onSettingsToggle:a.settings.toggle,onHistoryClick:()=>b(!0),hideHistory:t.hideHistory||!d.isConnected}),s.jsxs(Sr,{children:[s.jsxs("div",{className:"space-y-2 relative",children:[s.jsx(vn,{token:r.from,value:n.amount,onChange:n.setAmount,onSelectToken:a.tokenSelect.openFrom,balance:g,isWalletConnected:w,usdValue:N}),s.jsx(ao,{onClick:c.swapDirection}),s.jsx(vn,{token:r.to,value:o.data?Te(o.data.min_amount_out,r.to?.token_decimals||18):"",readOnly:!0,onSelectToken:a.tokenSelect.openTo,isOutput:!0,usdValue:A})]}),s.jsx("div",{className:"mt-4",children:s.jsx(cu,{token:r.to,value:n.receivingAddress,onChange:n.setReceivingAddress,error:i.address.error})}),s.jsx("div",{className:"mt-4",children:s.jsx(pu,{text:l.text,disabled:l.disabled,onClick:l.action})}),o.data&&r.from&&r.to&&s.jsx("div",{className:"mt-4",children:s.jsx(mu,{quote:o.data,fromToken:r.from,toToken:r.to,amount:n.amount,slippage:n.slippage,isFetching:o.isFetching,onRefresh:o.refetch})}),s.jsx("div",{className:"mt-4",children:s.jsx(xu,{})}),f.tradeId&&f.txHash&&s.jsx("div",{className:"mt-4",children:s.jsx(Yu,{trade:v,status:h,isLoading:y})})]})]}),s.jsx(Gu,{swap:e}),m&&s.jsx(rd,{open:m,onOpenChange:b,evmAddress:d.evmAddress??void 0,btcAddress:d.btcAddress??void 0,solanaAddress:d.solanaAddress??void 0})]})}function Td({className:e,connectLabel:t="Connect Wallet",showNetworkBadge:r=!0,onClick:n}){const o=Xe(),a=o.evmAddress||o.btcAddress||o.solanaAddress,l=()=>{if(n){n();return}o.isExternalWallet?o.onRequestWallet?.():o.openConnectModal?.()},i=()=>r?o.isEvmConnected?s.jsx("span",{className:"rounded bg-blue-500/20 px-1.5 py-0.5 text-xs text-blue-400",children:"EVM"}):o.isBtcConnected?s.jsx("span",{className:"rounded bg-orange-500/20 px-1.5 py-0.5 text-xs text-orange-400",children:"BTC"}):o.isSolanaConnected?s.jsx("span",{className:"rounded bg-purple-500/20 px-1.5 py-0.5 text-xs text-purple-400",children:"SOL"}):null:null;return o.isConnected?s.jsxs("div",{className:`flex items-center gap-2 ${e||""}`,children:[i(),s.jsxs("button",{onClick:l,className:"group flex items-center gap-1.5 rounded-[0.25rem] bg-[var(--optimex-surface-hover)] px-3 py-1.5 text-sm text-[var(--optimex-text)] transition-colors hover:bg-[rgba(239,68,68,0.2)]",children:[s.jsx("span",{children:ga(a)}),s.jsx(Aa,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]})]}):s.jsx("button",{onClick:l,className:`rounded-[0.25rem] bg-[var(--optimex-primary)] px-4 py-1.5 text-sm font-medium text-white transition-colors hover:bg-[var(--optimex-primary-hover)] ${e||""}`,children:t})}function Rd({apiBaseUrl:e,walletClient:t,onRequestWallet:r,theme:n,defaultFromToken:o,defaultToToken:a,headerLeft:l,affiliateFee:i,affiliateAddress:c,affiliateProvider:u,tradeTimeout:d,scriptTimeout:f,defaultSlippage:m=.75,hideHistory:b=!1,children:v,renderLoading:h,renderError:y,queryClient:g,onQuote:S,onWalletTx:k,onSubmitTx:w,onSwapComplete:N,onError:A}){ha(e);const C=p.useMemo(()=>g??new Vo,[g]),O={apiBaseUrl:e,defaultSlippage:m,affiliateFee:i,affiliateAddress:c,affiliateProvider:u,tradeTimeout:d,scriptTimeout:f,defaultFromToken:o,defaultToToken:a,hideHistory:b,headerLeft:l,callbacks:{onQuote:S,onWalletTx:k,onSubmitTx:w,onSwapComplete:N,onError:A},renderLoading:h,renderError:y},L=v??s.jsx(ho,{});return s.jsx("div",{className:"optx-widget",children:s.jsx(Go,{client:C,children:s.jsx(Ea,{value:O,children:s.jsx(da,{theme:n,children:s.jsx(fa,{externalWalletClient:t,onRequestWallet:r,children:s.jsx(iu,{children:L})})})})})})}exports.ConnectButton=Td;exports.SwapCard=ho;exports.SwapWidget=Rd;exports.createEvmWalletClient=co;exports.createEvmWalletClientAsync=Du;exports.createEvmWalletClientSync=uo;exports.useWallet=Xe;
|
|
55
|
+
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function hc(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function mc(){return kr(/^Mac/)}function pc(){return kr(/^iPhone/)}function hn(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function xc(){return kr(/^iPad/)||mc()&&navigator.maxTouchPoints>1}function Ws(){return pc()||xc()}function kr(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const vc=24,gc=typeof window<"u"?p.useLayoutEffect:p.useEffect;function mn(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}const Qt=typeof document<"u"&&window.visualViewport;function pn(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Vs(e){for(pn(e)&&(e=e.parentElement);e&&!pn(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const bc=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let yt=0,Kt;function yc(e={}){let{isDisabled:t}=e;gc(()=>{if(!t)return yt++,yt===1&&Ws()&&(Kt=wc()),()=>{yt--,yt===0&&Kt?.()}},[t])}function wc(){let e,t=0,r=f=>{e=Vs(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},n=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let m=f.changedTouches[0].pageY,b=e.scrollTop,v=e.scrollHeight-e.clientHeight;v!==0&&((b<=0&&m>t||b>=v&&m<t)&&f.preventDefault(),t=m)},o=f=>{let m=f.target;ur(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},a=f=>{let m=f.target;ur(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",Qt&&(Qt.height<window.innerHeight?requestAnimationFrame(()=>{xn(m)}):Qt.addEventListener("resize",()=>xn(m),{once:!0}))}))},l=()=>{window.scrollTo(0,0)},i=window.pageXOffset,c=window.pageYOffset,u=mn(Cc(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let d=mn(tt(document,"touchstart",r,{passive:!1,capture:!0}),tt(document,"touchmove",n,{passive:!1,capture:!0}),tt(document,"touchend",o,{passive:!1,capture:!0}),tt(document,"focus",a,!0),tt(window,"scroll",l));return()=>{u(),d(),window.scrollTo(i,c)}}function Cc(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function tt(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function xn(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=Vs(e);if(r!==document.documentElement&&r!==document.body&&r!==e){let n=r.getBoundingClientRect().top,o=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom;const l=r.getBoundingClientRect().bottom+vc;a>l&&(r.scrollTop+=o-n)}e=r.parentElement}}function ur(e){return e instanceof HTMLInputElement&&!bc.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function kc(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function jc(...e){return t=>e.forEach(r=>kc(r,t))}function Us(...e){return x.useCallback(jc(...e),e)}const Hs=new WeakMap;function ee(e,t,r=!1){if(!e||!(e instanceof HTMLElement))return;let n={};Object.entries(t).forEach(([o,a])=>{if(o.startsWith("--")){e.style.setProperty(o,a);return}n[o]=e.style[o],e.style[o]=a}),!r&&Hs.set(e,n)}function Sc(e,t){if(!e||!(e instanceof HTMLElement))return;let r=Hs.get(e);r&&(e.style[t]=r[t])}const X=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function wt(e,t){if(!e)return null;const r=window.getComputedStyle(e),n=r.transform||r.webkitTransform||r.mozTransform;let o=n.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[X(t)?13:12]):(o=n.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[X(t)?5:4]):null)}function Ec(e){return 8*(Math.log(e+1)-2)}function Gt(e,t){if(!e)return()=>{};const r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}function Nc(...e){return(...t)=>{for(const r of e)typeof r=="function"&&r(...t)}}const K={DURATION:.5,EASE:[.32,.72,0,1]},qs=.4,Tc=.25,Rc=100,Qs=8,Ae=16,dr=26,Yt="vaul-dragging";function Ks(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function Oc({defaultProp:e,onChange:t}){const r=p.useState(e),[n]=r,o=p.useRef(n),a=Ks(t);return p.useEffect(()=>{o.current!==n&&(a(n),o.current=n)},[n,o,a]),r}function Gs({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,o]=Oc({defaultProp:t,onChange:r}),a=e!==void 0,l=a?e:n,i=Ks(r),c=p.useCallback(u=>{if(a){const f=typeof u=="function"?u(e):u;f!==e&&i(f)}else o(u)},[a,e,o,i]);return[l,c]}function _c({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:o,fadeFromIndex:a,onSnapPointChange:l,direction:i="bottom",container:c,snapToSequentialPoint:u}){const[d,f]=Gs({prop:e,defaultProp:r?.[0],onChange:t}),[m,b]=p.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);p.useEffect(()=>{function C(){b({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const v=p.useMemo(()=>d===r?.[r.length-1]||null,[r,d]),h=p.useMemo(()=>{var C;return(C=r?.findIndex(j=>j===d))!=null?C:null},[r,d]),y=r&&r.length>0&&(a||a===0)&&!Number.isNaN(a)&&r[a]===d||!r,g=p.useMemo(()=>{const C=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var j;return(j=r?.map(O=>{const D=typeof O=="string";let M=0;if(D&&(M=parseInt(O,10)),X(i)){const _=D?M:m?O*C.height:0;return m?i==="bottom"?C.height-_:-C.height+_:_}const $=D?M:m?O*C.width:0;return m?i==="right"?C.width-$:-C.width+$:$}))!=null?j:[]},[r,m,c]),S=p.useMemo(()=>h!==null?g?.[h]:null,[g,h]),k=p.useCallback(C=>{var j;const O=(j=g?.findIndex(D=>D===C))!=null?j:null;l(O),ee(n.current,{transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,transform:X(i)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),g&&O!==g.length-1&&a!==void 0&&O!==a&&O<a?ee(o.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,opacity:"0"}):ee(o.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,opacity:"1"}),f(r?.[Math.max(O,0)])},[n.current,r,g,a,o,f]);p.useEffect(()=>{if(d||e){var C;const j=(C=r?.findIndex(O=>O===e||O===d))!=null?C:-1;g&&j!==-1&&typeof g[j]=="number"&&k(g[j])}},[d,e,r,g,k]);function w({draggedDistance:C,closeDrawer:j,velocity:O,dismissible:D}){if(a===void 0)return;const M=i==="bottom"||i==="right"?(S??0)-C:(S??0)+C,$=h===a-1,_=h===0,W=C>0;if($&&ee(o.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`}),!u&&O>2&&!W){D?j():k(g[0]);return}if(!u&&O>2&&W&&g&&r){k(g[r.length-1]);return}const V=g?.reduce((U,E)=>typeof U!="number"||typeof E!="number"?U:Math.abs(E-M)<Math.abs(U-M)?E:U),Q=X(i)?window.innerHeight:window.innerWidth;if(O>qs&&Math.abs(C)<Q*.4){const U=W?1:-1;if(U>0&&v&&r){k(g[r.length-1]);return}if(_&&U<0&&D&&j(),h===null)return;k(g[h+U]);return}k(V)}function N({draggedDistance:C}){if(S===null)return;const j=i==="bottom"||i==="right"?S-C:S+C;(i==="bottom"||i==="right")&&j<g[g.length-1]||(i==="top"||i==="left")&&j>g[g.length-1]||ee(n.current,{transform:X(i)?`translate3d(0, ${j}px, 0)`:`translate3d(${j}px, 0, 0)`})}function A(C,j){if(!r||typeof h!="number"||!g||a===void 0)return null;const O=h===a-1;if(h>=a&&j)return 0;if(O&&!j)return 1;if(!y&&!O)return null;const M=O?h+1:h-1,$=O?g[M]-g[M-1]:g[M+1]-g[M],_=C/Math.abs($);return O?1-_:_}return{isLastSnapPoint:v,activeSnapPoint:d,shouldFade:y,getPercentageDragged:A,setActiveSnapPoint:f,activeSnapPointIndex:h,onRelease:w,onDrag:N,snapPointsOffset:g}}const Ac=()=>()=>{};function Pc(){const{direction:e,isOpen:t,shouldScaleBackground:r,setBackgroundColorOnScale:n,noBodyStyles:o}=ct(),a=p.useRef(null),l=p.useMemo(()=>document.body.style.backgroundColor,[]);function i(){return(window.innerWidth-dr)/window.innerWidth}p.useEffect(()=>{if(t&&r){a.current&&clearTimeout(a.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;Nc(n&&!o?Gt(document.body,{background:"black"}):Ac,Gt(c,{transformOrigin:X(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${K.DURATION}s`,transitionTimingFunction:`cubic-bezier(${K.EASE.join(",")})`}));const u=Gt(c,{borderRadius:`${Qs}px`,overflow:"hidden",...X(e)?{transform:`scale(${i()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${i()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{u(),a.current=window.setTimeout(()=>{l?document.body.style.background=l:document.body.style.removeProperty("background")},K.DURATION*1e3)}}},[t,r,l])}let rt=null;function Mc({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:o,noBodyStyles:a}){const[l,i]=p.useState(()=>typeof window<"u"?window.location.href:""),c=p.useRef(0),u=p.useCallback(()=>{if(hn()&&rt===null&&e&&!a){rt={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:m}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const b=m-window.innerHeight;b&&c.current>=m&&(document.body.style.top=`${-(c.current+b)}px`)}),300)}},[e]),d=p.useCallback(()=>{if(hn()&&rt!==null&&!a){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,rt),window.requestAnimationFrame(()=>{if(o&&l!==window.location.href){i(window.location.href);return}window.scrollTo(m,f)}),rt=null}},[l]);return p.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),p.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||d()}},[t,d]),p.useEffect(()=>{r||!n||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{d()},500)):d())},[e,n,l,t,r,u,d]),{restorePositionSetting:d}}function Ic({open:e,onOpenChange:t,children:r,onDrag:n,onRelease:o,snapPoints:a,shouldScaleBackground:l=!1,setBackgroundColorOnScale:i=!0,closeThreshold:c=Tc,scrollLockTimeout:u=Rc,dismissible:d=!0,handleOnly:f=!1,fadeFromIndex:m=a&&a.length-1,activeSnapPoint:b,setActiveSnapPoint:v,fixed:h,modal:y=!0,onClose:g,nested:S,noBodyStyles:k=!1,direction:w="bottom",defaultOpen:N=!1,disablePreventScroll:A=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:j=!1,repositionInputs:O=!0,onAnimationEnd:D,container:M,autoFocus:$=!1}){var _,W;const[V=!1,Q]=Gs({defaultProp:N,prop:e,onChange:P=>{t?.(P),!P&&!S&&fo(),setTimeout(()=>{D?.(P)},K.DURATION*1e3),P&&!y&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),P||(document.body.style.pointerEvents="auto")}}),[U,E]=p.useState(!1),[ne,ie]=p.useState(!1),[Te,pe]=p.useState(!1),H=p.useRef(null),Z=p.useRef(null),de=p.useRef(null),be=p.useRef(null),F=p.useRef(null),xe=p.useRef(!1),ye=p.useRef(null),we=p.useRef(0),fe=p.useRef(!1),Re=p.useRef(!N),Tr=p.useRef(0),I=p.useRef(null),Rr=p.useRef(((_=I.current)==null?void 0:_.getBoundingClientRect().height)||0),Or=p.useRef(((W=I.current)==null?void 0:W.getBoundingClientRect().width)||0),Mt=p.useRef(0),ao=p.useCallback(P=>{a&&P===Xe.length-1&&(Z.current=new Date)},[]),{activeSnapPoint:io,activeSnapPointIndex:$e,setActiveSnapPoint:_r,onRelease:lo,snapPointsOffset:Xe,onDrag:co,shouldFade:Ar,getPercentageDragged:uo}=_c({snapPoints:a,activeSnapPointProp:b,setActiveSnapPointProp:v,drawerRef:I,fadeFromIndex:m,overlayRef:H,onSnapPointChange:ao,direction:w,container:M,snapToSequentialPoint:C});yc({isDisabled:!V||ne||!y||Te||!U||!O||!A});const{restorePositionSetting:fo}=Mc({isOpen:V,modal:y,nested:S??!1,hasBeenOpened:U,preventScrollRestoration:j,noBodyStyles:k});function ut(){return(window.innerWidth-dr)/window.innerWidth}function ho(P){var z,q;!d&&!a||I.current&&!I.current.contains(P.target)||(Rr.current=((z=I.current)==null?void 0:z.getBoundingClientRect().height)||0,Or.current=((q=I.current)==null?void 0:q.getBoundingClientRect().width)||0,ie(!0),de.current=new Date,Ws()&&window.addEventListener("touchend",()=>xe.current=!1,{once:!0}),P.target.setPointerCapture(P.pointerId),we.current=X(w)?P.pageY:P.pageX)}function Pr(P,z){var q;let B=P;const Y=(q=window.getSelection())==null?void 0:q.toString(),se=I.current?wt(I.current,w):null,re=new Date;if(B.tagName==="SELECT"||B.hasAttribute("data-vaul-no-drag")||B.closest("[data-vaul-no-drag]"))return!1;if(w==="right"||w==="left")return!0;if(Z.current&&re.getTime()-Z.current.getTime()<500)return!1;if(se!==null&&(w==="bottom"?se>0:se<0))return!0;if(Y&&Y.length>0)return!1;if(F.current&&re.getTime()-F.current.getTime()<u&&se===0||z)return F.current=re,!1;for(;B;){if(B.scrollHeight>B.clientHeight){if(B.scrollTop!==0)return F.current=new Date,!1;if(B.getAttribute("role")==="dialog")return!0}B=B.parentNode}return!0}function mo(P){if(I.current&&ne){const z=w==="bottom"||w==="right"?1:-1,q=(we.current-(X(w)?P.pageY:P.pageX))*z,B=q>0,Y=a&&!d&&!B;if(Y&&$e===0)return;const se=Math.abs(q),re=document.querySelector("[data-vaul-drawer-wrapper]"),Ce=w==="bottom"||w==="top"?Rr.current:Or.current;let le=se/Ce;const Oe=uo(se,B);if(Oe!==null&&(le=Oe),Y&&le>=1||!xe.current&&!Pr(P.target,B))return;if(I.current.classList.add(Yt),xe.current=!0,ee(I.current,{transition:"none"}),ee(H.current,{transition:"none"}),a&&co({draggedDistance:q}),B&&!a){const he=Ec(q),dt=Math.min(he*-1,0)*z;ee(I.current,{transform:X(w)?`translate3d(0, ${dt}px, 0)`:`translate3d(${dt}px, 0, 0)`});return}const ke=1-le;if((Ar||m&&$e===m-1)&&(n?.(P,le),ee(H.current,{opacity:`${ke}`,transition:"none"},!0)),re&&H.current&&l){const he=Math.min(ut()+le*(1-ut()),1),dt=8-le*8,Ir=Math.max(0,14-le*14);ee(re,{borderRadius:`${dt}px`,transform:X(w)?`scale(${he}) translate3d(0, ${Ir}px, 0)`:`scale(${he}) translate3d(${Ir}px, 0, 0)`,transition:"none"},!0)}if(!a){const he=se*z;ee(I.current,{transform:X(w)?`translate3d(0, ${he}px, 0)`:`translate3d(${he}px, 0, 0)`})}}}p.useEffect(()=>{window.requestAnimationFrame(()=>{Re.current=!0})},[]),p.useEffect(()=>{var P;function z(){if(!I.current||!O)return;const q=document.activeElement;if(ur(q)||fe.current){var B;const Y=((B=window.visualViewport)==null?void 0:B.height)||0,se=window.innerHeight;let re=se-Y;const Ce=I.current.getBoundingClientRect().height||0,le=Ce>se*.8;Mt.current||(Mt.current=Ce);const Oe=I.current.getBoundingClientRect().top;if(Math.abs(Tr.current-re)>60&&(fe.current=!fe.current),a&&a.length>0&&Xe&&$e){const ke=Xe[$e]||0;re+=ke}if(Tr.current=re,Ce>Y||fe.current){const ke=I.current.getBoundingClientRect().height;let he=ke;ke>Y&&(he=Y-(le?Oe:dr)),h?I.current.style.height=`${ke-Math.max(re,0)}px`:I.current.style.height=`${Math.max(he,Y-Oe)}px`}else hc()||(I.current.style.height=`${Mt.current}px`);a&&a.length>0&&!fe.current?I.current.style.bottom="0px":I.current.style.bottom=`${Math.max(re,0)}px`}}return(P=window.visualViewport)==null||P.addEventListener("resize",z),()=>{var q;return(q=window.visualViewport)==null?void 0:q.removeEventListener("resize",z)}},[$e,a,Xe]);function Je(P){po(),g?.(),P||Q(!1),setTimeout(()=>{a&&_r(a[0])},K.DURATION*1e3)}function Mr(){if(!I.current)return;const P=document.querySelector("[data-vaul-drawer-wrapper]"),z=wt(I.current,w);ee(I.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`}),ee(H.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,opacity:"1"}),l&&z&&z>0&&V&&ee(P,{borderRadius:`${Qs}px`,overflow:"hidden",...X(w)?{transform:`scale(${ut()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${ut()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${K.DURATION}s`,transitionTimingFunction:`cubic-bezier(${K.EASE.join(",")})`},!0)}function po(){!ne||!I.current||(I.current.classList.remove(Yt),xe.current=!1,ie(!1),be.current=new Date)}function xo(P){if(!ne||!I.current)return;I.current.classList.remove(Yt),xe.current=!1,ie(!1),be.current=new Date;const z=wt(I.current,w);if(!P||!Pr(P.target,!1)||!z||Number.isNaN(z)||de.current===null)return;const q=be.current.getTime()-de.current.getTime(),B=we.current-(X(w)?P.pageY:P.pageX),Y=Math.abs(B)/q;if(Y>.05&&(pe(!0),setTimeout(()=>{pe(!1)},200)),a){lo({draggedDistance:B*(w==="bottom"||w==="right"?1:-1),closeDrawer:Je,velocity:Y,dismissible:d}),o?.(P,!0);return}if(w==="bottom"||w==="right"?B>0:B<0){Mr(),o?.(P,!0);return}if(Y>qs){Je(),o?.(P,!1);return}var se;const re=Math.min((se=I.current.getBoundingClientRect().height)!=null?se:0,window.innerHeight);var Ce;const le=Math.min((Ce=I.current.getBoundingClientRect().width)!=null?Ce:0,window.innerWidth),Oe=w==="left"||w==="right";if(Math.abs(z)>=(Oe?le:re)*c){Je(),o?.(P,!1);return}o?.(P,!0),Mr()}p.useEffect(()=>(V&&(ee(document.documentElement,{scrollBehavior:"auto"}),Z.current=new Date),()=>{Sc(document.documentElement,"scrollBehavior")}),[V]);function vo(P){const z=P?(window.innerWidth-Ae)/window.innerWidth:1,q=P?-Ae:0;ye.current&&window.clearTimeout(ye.current),ee(I.current,{transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,transform:X(w)?`scale(${z}) translate3d(0, ${q}px, 0)`:`scale(${z}) translate3d(${q}px, 0, 0)`}),!P&&I.current&&(ye.current=setTimeout(()=>{const B=wt(I.current,w);ee(I.current,{transition:"none",transform:X(w)?`translate3d(0, ${B}px, 0)`:`translate3d(${B}px, 0, 0)`})},500))}function go(P,z){if(z<0)return;const q=(window.innerWidth-Ae)/window.innerWidth,B=q+z*(1-q),Y=-Ae+z*Ae;ee(I.current,{transform:X(w)?`scale(${B}) translate3d(0, ${Y}px, 0)`:`scale(${B}) translate3d(${Y}px, 0, 0)`,transition:"none"})}function bo(P,z){const q=X(w)?window.innerHeight:window.innerWidth,B=z?(q-Ae)/q:1,Y=z?-Ae:0;z&&ee(I.current,{transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,transform:X(w)?`scale(${B}) translate3d(0, ${Y}px, 0)`:`scale(${B}) translate3d(${Y}px, 0, 0)`})}return p.useEffect(()=>{y||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[y]),p.createElement(oc,{defaultOpen:N,onOpenChange:P=>{!d&&!P||(P?E(!0):Je(!0),Q(P))},open:V},p.createElement(zs.Provider,{value:{activeSnapPoint:io,snapPoints:a,setActiveSnapPoint:_r,drawerRef:I,overlayRef:H,onOpenChange:t,onPress:ho,onRelease:xo,onDrag:mo,dismissible:d,shouldAnimate:Re,handleOnly:f,isOpen:V,isDragging:ne,shouldFade:Ar,closeDrawer:Je,onNestedDrag:go,onNestedOpenChange:vo,onNestedRelease:bo,keyboardIsOpen:fe,modal:y,snapPointsOffset:Xe,activeSnapPointIndex:$e,direction:w,shouldScaleBackground:l,setBackgroundColorOnScale:i,noBodyStyles:k,container:M,autoFocus:$}},r))}const Ys=p.forwardRef(function({...e},t){const{overlayRef:r,snapPoints:n,onRelease:o,shouldFade:a,isOpen:l,modal:i,shouldAnimate:c}=ct(),u=Us(t,r),d=n&&n.length>0;if(!i)return null;const f=p.useCallback(m=>o(m),[o]);return p.createElement(ic,{onMouseUp:f,ref:u,"data-vaul-overlay":"","data-vaul-snap-points":l&&d?"true":"false","data-vaul-snap-points-overlay":l&&a?"true":"false","data-vaul-animate":c?.current?"true":"false",...e})});Ys.displayName="Drawer.Overlay";const Zs=p.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:r,...n},o){const{drawerRef:a,onPress:l,onRelease:i,onDrag:c,keyboardIsOpen:u,snapPointsOffset:d,activeSnapPointIndex:f,modal:m,isOpen:b,direction:v,snapPoints:h,container:y,handleOnly:g,shouldAnimate:S,autoFocus:k}=ct(),[w,N]=p.useState(!1),A=Us(o,a),C=p.useRef(null),j=p.useRef(null),O=p.useRef(!1),D=h&&h.length>0;Pc();const M=(_,W,V=0)=>{if(O.current)return!0;const Q=Math.abs(_.y),U=Math.abs(_.x),E=U>Q,ne=["bottom","right"].includes(W)?1:-1;if(W==="left"||W==="right"){if(!(_.x*ne<0)&&U>=0&&U<=V)return E}else if(!(_.y*ne<0)&&Q>=0&&Q<=V)return!E;return O.current=!0,!0};p.useEffect(()=>{D&&window.requestAnimationFrame(()=>{N(!0)})},[]);function $(_){C.current=null,O.current=!1,i(_)}return p.createElement(lc,{"data-vaul-drawer-direction":v,"data-vaul-drawer":"","data-vaul-delayed-snap-points":w?"true":"false","data-vaul-snap-points":b&&D?"true":"false","data-vaul-custom-container":y?"true":"false","data-vaul-animate":S?.current?"true":"false",...n,ref:A,style:d&&d.length>0?{"--snap-point-height":`${d[f??0]}px`,...t}:t,onPointerDown:_=>{g||(n.onPointerDown==null||n.onPointerDown.call(n,_),C.current={x:_.pageX,y:_.pageY},l(_))},onOpenAutoFocus:_=>{r?.(_),k||_.preventDefault()},onPointerDownOutside:_=>{if(e?.(_),!m||_.defaultPrevented){_.preventDefault();return}u.current&&(u.current=!1)},onFocusOutside:_=>{if(!m){_.preventDefault();return}},onPointerMove:_=>{if(j.current=_,g||(n.onPointerMove==null||n.onPointerMove.call(n,_),!C.current))return;const W=_.pageY-C.current.y,V=_.pageX-C.current.x,Q=_.pointerType==="touch"?10:2;M({x:V,y:W},v,Q)?c(_):(Math.abs(V)>Q||Math.abs(W)>Q)&&(C.current=null)},onPointerUp:_=>{n.onPointerUp==null||n.onPointerUp.call(n,_),C.current=null,O.current=!1,i(_)},onPointerOut:_=>{n.onPointerOut==null||n.onPointerOut.call(n,_),$(j.current)},onContextMenu:_=>{n.onContextMenu==null||n.onContextMenu.call(n,_),j.current&&$(j.current)}})});Zs.displayName="Drawer.Content";const Lc=250,Dc=120,Fc=p.forwardRef(function({preventCycle:e=!1,children:t,...r},n){const{closeDrawer:o,isDragging:a,snapPoints:l,activeSnapPoint:i,setActiveSnapPoint:c,dismissible:u,handleOnly:d,isOpen:f,onPress:m,onDrag:b}=ct(),v=p.useRef(null),h=p.useRef(!1);function y(){if(h.current){k();return}window.setTimeout(()=>{g()},Dc)}function g(){if(a||e||h.current){k();return}if(k(),!l||l.length===0){u||o();return}if(i===l[l.length-1]&&u){o();return}const N=l.findIndex(C=>C===i);if(N===-1)return;const A=l[N+1];c(A)}function S(){v.current=window.setTimeout(()=>{h.current=!0},Lc)}function k(){v.current&&window.clearTimeout(v.current),h.current=!1}return p.createElement("div",{onClick:y,onPointerCancel:k,onPointerDown:w=>{d&&m(w),S()},onPointerMove:w=>{d&&b(w)},ref:n,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...r},p.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});Fc.displayName="Drawer.Handle";function $c(e){const t=ct(),{container:r=t.container,...n}=e;return p.createElement(ac,{container:r,...n})}const Pe={Root:Ic,Content:Zs,Overlay:Ys,Portal:$c,Close:dc,Title:cc,Description:uc};function Bc(e=768){const[t,r]=p.useState(!1);return p.useEffect(()=>{const n=()=>{r(window.innerWidth<e)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),t}function Tt(...e){return is(Kn(e))}function jr({open:e,onOpenChange:t,children:r,title:n,description:o,className:a="",showCloseButton:l=!0}){const i=Bc();return x.useEffect(()=>{if(!e)return;const c=u=>{u.key==="Escape"&&t(!1)};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),x.useEffect(()=>{if(e){const c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=c}}},[e]),e?i?s.jsx(Pe.Root,{open:e,onOpenChange:t,children:s.jsxs(Pe.Portal,{children:[s.jsx(Pe.Overlay,{className:"fixed inset-0 z-[9999] bg-black/60 backdrop-blur-sm"}),s.jsxs(Pe.Content,{className:Tt("fixed inset-x-0 bottom-0 z-[9999] mt-24 flex max-h-[96vh] flex-col rounded-t-[var(--optimex-overlay-radius)] border-t border-white/10 bg-[var(--optimex-overlay-background)] outline-none",a),children:[s.jsx("div",{className:"mx-auto mt-4 h-1.5 w-12 flex-shrink-0 rounded-full bg-white/20"}),(n||l)&&s.jsxs("div",{className:"flex items-center justify-between border-b border-white/[0.05] px-4 pb-4 pt-2",children:[s.jsxs("div",{children:[n&&s.jsx(Pe.Title,{className:"text-lg font-bold text-[var(--optimex-text)]",children:n}),o&&s.jsx(Pe.Description,{className:"text-sm text-[var(--optimex-text-secondary)]",children:o})]}),l&&s.jsx(Pe.Close,{className:"rounded-[var(--optimex-radius-button)] p-1.5 text-[var(--optimex-text-secondary)] transition-colors hover:bg-white/10 hover:text-[var(--optimex-text)]",children:s.jsx(Ie,{})})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:r})]})]})}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 z-[9999] bg-black/60 backdrop-blur-sm animate-in fade-in-0",onClick:()=>t(!1),"aria-hidden":"true"}),s.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":n?"modal-title":void 0,"aria-describedby":o?"modal-description":void 0,className:Tt("fixed left-1/2 top-1/2 z-[9999] flex max-h-[85vh] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-[var(--optimex-overlay-radius)] border border-white/10 bg-[var(--optimex-overlay-background)] shadow-2xl outline-none animate-in fade-in-0 zoom-in-95 sm:max-w-lg",a),children:[(n||o||l)&&s.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between border-b border-white/[0.05] p-4",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[n&&s.jsx("h2",{id:"modal-title",className:"text-lg font-bold leading-none text-[var(--optimex-text)]",children:n}),o&&s.jsx("p",{id:"modal-description",className:"text-sm text-[var(--optimex-text-secondary)]",children:o})]}),l&&s.jsxs("button",{onClick:()=>t(!1),className:"rounded-[var(--optimex-radius-button)] p-1.5 text-[var(--optimex-text-secondary)] opacity-70 transition-opacity hover:opacity-100 hover:bg-white/10 focus:outline-none",children:[s.jsx(Ie,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]}),s.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:r})]})]}):null}const zc=({children:e,className:t=""})=>s.jsx("div",{className:Tt("p-4",t),children:e}),Wc=({children:e,className:t=""})=>s.jsx("div",{className:Tt("flex gap-2 border-t border-white/[0.05] p-4",t),children:e});function fr({children:e,onClick:t,isActive:r=!1,type:n="button",className:o=""}){return s.jsx("button",{type:n,onClick:t,className:ls(`px-2 py-1 bg-white/5 rounded-md text-xs transition-colors shadow-sm border ${r?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-[var(--optimex-surface-hover)] hover:text-[var(--optimex-text)]"} ${o}`),children:e})}const Vc={"bottom-right":"right-0 top-full mt-2","bottom-left":"left-0 top-full mt-2","bottom-center":"left-1/2 -translate-x-1/2 top-full mt-2","top-right":"right-0 bottom-full mb-2","top-left":"left-0 bottom-full mb-2","top-center":"left-1/2 -translate-x-1/2 bottom-full mb-2"},Uc={"bottom-right":"-top-2 right-4 rotate-45 border-l border-t border-white/10","bottom-left":"-top-2 left-4 rotate-45 border-l border-t border-white/10","bottom-center":"-top-2 left-1/2 -translate-x-1/2 rotate-45 border-l border-t border-white/10","top-right":"-bottom-2 right-4 rotate-45 border-r border-b border-white/10","top-left":"-bottom-2 left-4 rotate-45 border-r border-b border-white/10","top-center":"-bottom-2 left-1/2 -translate-x-1/2 rotate-45 border-r border-b border-white/10"};function Hc({isOpen:e,onClose:t,children:r,anchorRef:n,position:o="bottom-right",width:a="w-72",showArrow:l=!0,className:i="",ariaLabel:c}){const u=p.useRef(null);return p.useEffect(()=>{if(!e)return;const d=b=>{const v=b.target;u.current?.contains(v)||n?.current?.contains(v)||t()},f=b=>{b.key==="Escape"&&t()},m=setTimeout(()=>{document.addEventListener("mousedown",d),document.addEventListener("keydown",f)},0);return()=>{clearTimeout(m),document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f)}},[e,t,n]),e?s.jsxs("div",{ref:u,className:`absolute z-50 rounded-[var(--optimex-overlay-radius)] border border-white/10 bg-[var(--optimex-overlay-background)] p-4 shadow-xl ${Vc[o]} ${a} ${i}`,role:"dialog","aria-label":c,children:[l&&s.jsx("div",{className:`absolute h-4 w-4 bg-[var(--optimex-overlay-background)] ${Uc[o]}`}),s.jsx("div",{className:"relative",children:r})]}):null}function qc({value:e,onChange:t,placeholder:r,hasError:n=!1,leftIcon:o,rightContent:a,type:l="text",inputMode:i="text",disabled:c=!1,className:u=""}){return s.jsxs("div",{className:`flex rounded-[var(--optimex-radius-button)] items-center gap-2 bg-white/5 border py-3 px-3 transition-colors ${n?"border-[var(--optimex-error)]":"border-white/10 hover:border-[var(--optimex-primary)] focus-within:border-[var(--optimex-primary)]"} ${c?"opacity-50 cursor-not-allowed":""} ${u}`,children:[o&&s.jsx(o,{className:"size-5 text-[var(--optimex-text-secondary)] shrink-0"}),s.jsx("input",{type:l,inputMode:i,value:e,onChange:d=>t(d.target.value),placeholder:r,disabled:c,className:"flex-1 min-w-0 bg-transparent text-[var(--optimex-text)] text-sm placeholder:text-[var(--optimex-text-secondary)]/30 outline-none disabled:cursor-not-allowed"}),a]})}const Qc={sm:{container:"h-6 w-6",icon:"h-6 w-6",badge:"h-3 w-3"},md:{container:"h-8 w-8",icon:"h-8 w-8",badge:"h-4 w-4"},lg:{container:"h-10 w-10",icon:"h-10 w-10",badge:"h-5 w-5"},xl:{container:"h-14 w-14",icon:"h-14 w-14",badge:"h-6 w-6"}};function De({token:e,size:t="md",showNetworkBadge:r=!0}){const n=Qc[t];return s.jsxs("div",{className:`relative shrink-0 ${n.container}`,children:[s.jsx("img",{src:e.token_logo_uri||"/placeholder-token.svg",alt:e.token_symbol,className:`${n.icon} rounded-[9999px] bg-[var(--optimex-background)]`,onError:o=>{o.target.src="/placeholder-token.svg"}}),r&&e.network_logo_uri&&s.jsx("img",{src:e.network_logo_uri,alt:e.network_name,className:`absolute -bottom-1 -right-1 ${n.badge} rounded-[9999px] border-2 border-[var(--optimex-surface)]`,onError:o=>{o.target.style.display="none"}})]})}const Kc="widget-container rounded-[var(--optimex-radius-widget)] p-4 shadow-2xl relative w-full min-w-0";function Sr({children:e,className:t}){return s.jsx("div",{className:t??Kc,children:e})}function Gc(){return s.jsxs("div",{className:"relative size-20 mb-4",children:[s.jsx("div",{className:"absolute inset-0 rounded-full bg-[var(--optimex-error)]/10 animate-pulse"}),s.jsx("div",{className:"absolute inset-2 rounded-full bg-[var(--optimex-error)]/20"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx(Oa,{className:"size-10 text-[var(--optimex-error)]"})})]})}function Yc({error:e,onRetry:t,className:r}){const n=()=>{const o=e?.message?.toLowerCase()||"";return o.includes("network")||o.includes("fetch")?"Connection issue. Check your internet and try again.":o.includes("timeout")?"Request timed out. The server might be busy.":o.includes("401")||o.includes("403")?"Access denied. Please check your credentials.":o.includes("500")||o.includes("server")?"Server is having issues. Please try again later.":"Something went wrong while loading. Let's give it another shot!"};return s.jsx(Sr,{className:r,children:s.jsx("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-6 border border-white/[0.02]",children:s.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[s.jsx(Gc,{}),s.jsx("h3",{className:"text-base font-bold text-[var(--optimex-text)] mb-1",children:"Oops! Something went wrong"}),s.jsx("p",{className:"text-sm text-[var(--optimex-text-secondary)] mb-6 max-w-[280px]",children:n()}),s.jsx(qn,{onClick:t,size:"md",fullWidth:!0,leftIcon:s.jsx(Ra,{className:"size-4 transition-transform group-hover:rotate-180"}),children:"Try Again"}),e?.message&&s.jsxs("details",{className:"mt-4 w-full",children:[s.jsx("summary",{className:"cursor-pointer text-xs text-[var(--optimex-text-secondary)]/60 hover:text-[var(--optimex-text-secondary)] transition-colors",children:"Technical details"}),s.jsx("p",{className:"mt-2 bg-white/5 p-3 text-left text-xs text-[var(--optimex-text-secondary)] break-all border border-white/[0.02]",children:e.message})]})]})})})}function Zc({className:e}){return s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("header",{className:"flex items-center justify-between px-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"size-8 rounded-lg bg-[var(--optimex-primary)]/30 animate-pulse"}),s.jsx("div",{className:"h-6 w-28 rounded bg-white/10 animate-pulse"})]}),s.jsx("div",{className:"size-10 rounded-lg bg-white/5 animate-pulse"})]}),s.jsxs(Sr,{className:e,children:[s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-2",children:[s.jsx("div",{className:"flex justify-between items-center mb-4",children:s.jsx("div",{className:"h-3 w-10 animate-pulse rounded bg-white/10"})}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-8 w-24 animate-pulse rounded bg-white/10 mb-2"}),s.jsx("div",{className:"h-3 w-16 animate-pulse rounded bg-white/5"})]}),s.jsxs("div",{className:"flex items-center gap-2 bg-white/5 p-2 pr-3 rounded-full border border-white/10",children:[s.jsx("div",{className:"size-8 rounded-full bg-white/10 animate-pulse"}),s.jsxs("div",{children:[s.jsx("div",{className:"h-4 w-12 animate-pulse rounded bg-white/10 mb-1"}),s.jsx("div",{className:"h-2 w-16 animate-pulse rounded bg-white/5"})]})]})]})]}),s.jsx("div",{className:"relative z-10 -my-4 flex justify-center",children:s.jsx("div",{className:"size-10 rounded-full bg-[var(--optimex-surface)] border-4 border-[var(--optimex-background)] animate-pulse"})}),s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-4",children:[s.jsx("div",{className:"flex justify-between items-center mb-4",children:s.jsx("div",{className:"h-3 w-6 animate-pulse rounded bg-white/10"})}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-8 w-20 animate-pulse rounded bg-white/10 mb-2"}),s.jsx("div",{className:"h-3 w-14 animate-pulse rounded bg-white/5"})]}),s.jsxs("div",{className:"flex items-center gap-2 bg-white/5 p-2 pr-3 rounded-full border border-white/10",children:[s.jsx("div",{className:"size-8 rounded-full bg-white/10 animate-pulse"}),s.jsxs("div",{children:[s.jsx("div",{className:"h-4 w-12 animate-pulse rounded bg-white/10 mb-1"}),s.jsx("div",{className:"h-2 w-16 animate-pulse rounded bg-white/5"})]})]})]})]}),s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-4",children:[s.jsx("div",{className:"h-3 w-28 animate-pulse rounded bg-white/10 mb-2"}),s.jsxs("div",{className:"flex items-center gap-2 bg-white/5 border border-white/10 py-3 px-3 rounded-md",children:[s.jsx("div",{className:"size-5 rounded-full bg-white/10 animate-pulse shrink-0"}),s.jsx("div",{className:"h-4 flex-1 animate-pulse rounded bg-white/5"})]}),s.jsx("div",{className:"h-2 w-48 animate-pulse rounded bg-white/5 mt-2"})]}),s.jsx("div",{className:"h-12 w-full animate-pulse rounded-xl bg-[var(--optimex-primary)]/30 bg-white/5 mt-2"}),s.jsx("div",{className:"mt-4 flex items-center justify-center",children:s.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-white/5"})})]})]})}const Xs=p.createContext(null);function Xc({children:e}){const t=lt(),{data:r,isLoading:n,error:o,refetch:a}=la(t.apiBaseUrl),l=t.renderLoading??Zc,i=t.renderError??Yc;if(n)return s.jsx(l,{});if(o||!r){const c=o instanceof Error?o:new Error("Failed to load tokens");return s.jsx(i,{error:c,onRetry:()=>a()})}return s.jsx(Xs.Provider,{value:{tokensData:r,refetch:a},children:e})}function Jc(){const e=p.useContext(Xs);if(!e)throw new Error("useTokensData must be used within TokensProvider");return e}function eu({token:e,value:t,onChange:r,placeholder:n,error:o,onClose:a}){const l=p.useCallback(()=>{r("")},[r]),i=p.useCallback(async()=>{try{const f=await navigator.clipboard.readText();f&&r(f.trim())}catch(f){console.error("Failed to read clipboard:",f)}},[r]),c=()=>n||(e?`Enter ${e.network_name} address`:"Enter receiving address"),u=e?.network_name||"destination",d=p.useMemo(()=>Pa(e?.network_name)||Fn,[e?.network_name]);return s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-[var(--optimex-radius-input)] p-4 border border-white/[0.05] animate-in slide-in-from-top-2 duration-300",children:[s.jsxs("div",{className:"flex justify-between items-center mb-2",children:[s.jsx("label",{className:"text-[var(--optimex-text-secondary)] text-xs",children:"Recipient Address"}),a&&s.jsx("button",{type:"button",onClick:l,className:"text-[var(--optimex-text-secondary)]/50 hover:text-[var(--optimex-text-secondary)] transition-colors",children:s.jsx(Ie,{className:"size-4"})})]}),s.jsx(qc,{value:t,onChange:r,placeholder:c(),hasError:!!o,leftIcon:d,rightContent:t?s.jsx("button",{type:"button",onClick:l,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors",children:s.jsx(Ie,{className:"size-5"})}):s.jsx("button",{type:"button",onClick:i,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-primary)] transition-colors",children:s.jsx(Ta,{className:"size-5"})})}),o?s.jsxs("p",{className:"text-[10px] text-[var(--optimex-error)] mt-2 flex items-center gap-1",children:[s.jsx(qr,{className:"size-3"}),o]}):s.jsxs("p",{className:"text-[10px] text-[var(--optimex-text-secondary)] mt-2 flex items-center gap-1",children:[s.jsx(qr,{className:"size-3"}),"Ensure the address matches the ",u," network."]})]})}function vn({token:e,value:t,onChange:r,readOnly:n=!1,onSelectToken:o,isLoading:a=!1,loadingText:l="Loading...",balance:i,isOutput:c=!1,isWalletConnected:u=!1,usdValue:d="$0.00"}){const f=h=>{if(n||!r)return;const y=h.target.value;/^[0-9]*\.?[0-9]*$/.test(y)&&r(y)},m=u&&!c&&i!==void 0,b=()=>{if(!i||!r||n)return;const h=(parseFloat(i)/2).toString();r(h)},v=()=>{!i||!r||n||r(i)};return s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-[var(--optimex-radius-input)] p-4 flex flex-col gap-2 border border-white/[0.02] focus-within:border-[var(--optimex-primary)]/40 transition-colors",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)] text-xs",children:c?"To":"From"}),s.jsx("div",{className:"flex items-center gap-2",children:m&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-[var(--optimex-text-secondary)] text-xs",children:["Balance: ",i," ",e?.token_symbol]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(fr,{onClick:b,children:"50%"}),s.jsx(fr,{onClick:v,children:"Max"})]})]})})]}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("input",{type:"text",inputMode:"decimal",placeholder:"0.0",value:t,onChange:f,readOnly:n,className:"w-full bg-transparent border-none p-0 text-[var(--optimex-text)] text-2xl font-bold focus:ring-0 placeholder:text-[var(--optimex-text-secondary)]/30 outline-none"}),s.jsxs("p",{className:"text-[var(--optimex-text-secondary)] text-xs mt-1",children:["~",d]})]}),s.jsxs("button",{onClick:o,className:"flex items-center gap-2 bg-white/5 hover:bg-white/10 p-2 pr-3 rounded-[9999px] transition-all border border-white/10 active:scale-95 shrink-0",children:[e?s.jsxs(s.Fragment,{children:[s.jsx(De,{token:e,size:"md"}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"text-[var(--optimex-text)] text-sm font-bold leading-none",children:e.token_symbol}),s.jsx("p",{className:"text-[var(--optimex-text-secondary)] text-[10px] leading-none mt-1",children:e.network_name})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"size-8 rounded-[9999px] bg-white/10"}),s.jsx("span",{className:"text-[var(--optimex-text)] text-sm font-bold",children:"Select"})]}),s.jsx(Ln,{className:"size-4 text-[var(--optimex-text-secondary)]"})]})]}),a&&s.jsxs("div",{className:"flex items-center justify-end gap-2 text-sm text-[var(--optimex-text-secondary)]",children:[s.jsx("div",{className:"size-3 animate-spin rounded-[9999px] border border-[var(--optimex-primary)] border-t-transparent"}),s.jsx("span",{children:l})]})]})}const Zt=[.5,.75,1];function tu({value:e,onChange:t}){const[r,n]=p.useState(""),[o,a]=p.useState(!Zt.includes(e)),l=p.useCallback(u=>{a(!1),n(""),t(u)},[t]),i=p.useCallback(u=>{const d=u.target.value;if(d===""||/^\d*\.?\d*$/.test(d)){n(d),a(!0);const f=parseFloat(d);!isNaN(f)&&f>0&&f<=50&&t(f)}},[t]),c=p.useCallback(()=>{a(!0),!r&&e&&n(Zt.includes(e)?"":String(e))},[r,e]);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:"Slippage Tolerance"}),s.jsxs("span",{className:"text-sm text-[var(--optimex-text-secondary)]",children:[e,"%"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Zt.map(u=>s.jsxs(fr,{onClick:()=>l(u),isActive:e===u&&!o,className:"flex-1",children:[u,"%"]},u)),s.jsxs("div",{className:`flex flex-1 items-center justify-center px-2 rounded-md transition-colors shadow-sm bg-white/5 border ${o?"border-[var(--optimex-primary)]":"border-transparent hover:bg-white/10"}`,children:[s.jsx("input",{type:"text",inputMode:"decimal",placeholder:"Custom",value:r,onChange:i,onFocus:c,className:"w-full min-w-0 py-[6px] bg-transparent text-center text-xs outline-none placeholder:text-[var(--optimex-text-secondary)] text-[var(--optimex-text)]"}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:"%"})]})]}),e>5&&s.jsx("p",{className:"text-xs text-[var(--optimex-warning)]",children:"This may result in an unfavorable trade. Try lowering your slippage setting."})]})}function ru({isOpen:e,onClose:t,value:r,onChange:n,anchorRef:o}){const a=p.useCallback(l=>{n(l)},[n]);return s.jsx(Hc,{isOpen:e,onClose:t,anchorRef:o,position:"bottom-right",width:"w-96",ariaLabel:"Slippage settings",children:s.jsx(tu,{value:r,onChange:a})})}const nu=({title:e})=>s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"size-8 bg-[var(--optimex-primary)] rounded-[var(--optimex-radius-button)] flex items-center justify-center shadow-[0_0_15px_rgba(235,98,0,0.3)]",children:s.jsx(Ea,{className:"w-5 h-auto text-white"})}),s.jsx("h2",{className:"text-xl font-bold tracking-tight text-[var(--optimex-text)]",children:e})]});function su({title:e="Swap",headerLeft:t,slippage:r=.75,onSlippageChange:n,isSettingsOpen:o=!1,onSettingsToggle:a,onHistoryClick:l,hideHistory:i=!1}){const c=p.useRef(null);return s.jsxs("header",{className:"flex items-center justify-between px-2",children:[t??s.jsx(nu,{title:e}),s.jsxs("div",{className:"flex items-center gap-2",children:[!i&&s.jsx("button",{onClick:l,className:"size-10 rounded-[var(--optimex-radius-button)] bg-white/5 hover:bg-white/10 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors flex items-center justify-center","aria-label":"Trade History",children:s.jsx(ja,{className:"size-5"})}),s.jsxs("div",{className:"relative",children:[s.jsx("button",{ref:c,onClick:a,className:"size-10 rounded-[var(--optimex-radius-button)] bg-white/5 hover:bg-white/10 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors flex items-center justify-center","aria-label":"Settings",children:s.jsx(Aa,{className:"size-5"})}),s.jsx(ru,{isOpen:o,onClose:()=>a?.(),value:r,onChange:u=>n?.(u),anchorRef:c})]})]})]})}function Js({onClick:e,disabled:t}){return s.jsx("div",{className:"!m-0 absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10",children:s.jsx("button",{onClick:e,disabled:t,className:"size-10 rounded-[9999px] bg-[var(--optimex-surface)] border-4 border-white/5 flex items-center justify-center text-[var(--optimex-primary)] hover:scale-110 transition-all shadow-xl disabled:cursor-not-allowed",children:s.jsx(wa,{className:"size-5"})})})}function ou({quote:e,fromToken:t,toToken:r,amount:n,slippage:o,isFetching:a}){const[l,i]=p.useState(!1),[c,u]=p.useState(!1),d=p.useCallback(()=>{u(g=>!g)},[]),f=p.useCallback(()=>{i(g=>!g)},[]),m=parseFloat(n)||0,b=parseFloat(e.min_amount_out)/Math.pow(10,r.token_decimals),v=m>0?b/m:0,h=b>0?m/b:0,y=()=>c?`1 ${r.token_symbol} = ${h.toFixed(6)} ${t.token_symbol}`:`1 ${t.token_symbol} = ${v.toFixed(6)} ${r.token_symbol}`;return s.jsxs("div",{className:"bg-white/[0.02] rounded-[var(--optimex-radius-button)] border border-white/5 overflow-hidden",children:[s.jsxs("button",{type:"button",onClick:f,className:"w-full flex items-center justify-between p-3 text-xs cursor-pointer hover:bg-white/[0.02] transition-colors",children:[s.jsx("div",{className:"flex items-center gap-2 text-[var(--optimex-text-secondary)] font-medium",children:a?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-3 animate-spin rounded-[9999px] border border-[var(--optimex-primary)] border-t-transparent"}),s.jsx("span",{children:"Updating..."})]}):s.jsx("span",{role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),d()},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.stopPropagation(),d())},className:"hover:text-[var(--optimex-text)] transition-colors",children:y()})}),s.jsx(Ln,{className:`size-4 text-[var(--optimex-text-secondary)] transition-transform ${l?"rotate-180":""}`})]}),l&&s.jsxs("div",{className:"px-3 pb-3 space-y-2 text-xs border-t border-white/5",children:[s.jsxs("div",{className:"flex items-center justify-between pt-3",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Min. Received"}),s.jsxs("span",{className:"font-medium text-[var(--optimex-text)]",children:[Ne(e.min_amount_out,r.token_decimals)," ",r.token_symbol]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Est. Time"}),s.jsx("span",{className:"font-medium text-[var(--optimex-primary)]",children:"~10 minutes"})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Slippage Tolerance"}),s.jsxs("span",{className:"font-medium text-[var(--optimex-text)]",children:[o,"%"]})]})]})]})}function au({text:e,disabled:t,onClick:r}){return s.jsx("button",{disabled:t,onClick:r,className:"w-full font-semibold text-black bg-[var(--optimex-primary)] hover:brightness-110 py-4 rounded-[var(--optimex-radius-button)] shadow-lg shadow-[var(--optimex-primary)]/30 flex items-center justify-center transition-all active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-50",children:e})}function iu(){return s.jsxs("a",{href:"https://optimex.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 text-[var(--optimex-text-secondary)] text-[10px] opacity-50 hover:opacity-70 transition-opacity",children:[s.jsx("span",{children:"Powered by"}),s.jsx(Na,{className:"h-3 w-auto"})]})}function lu({value:e,onChange:t,placeholder:r="Search by name or symbol..."}){return s.jsx("div",{className:"flex-shrink-0 p-4 pb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"text",placeholder:r,value:e,onChange:n=>t(n.target.value),className:"w-full rounded-xl bg-white/5 border border-white/10 px-4 py-3 pl-10 pr-10 text-[var(--optimex-text)] outline-none placeholder:text-[var(--optimex-text-secondary)]/60 transition-colors hover:border-[var(--optimex-primary)] focus:border-[var(--optimex-primary)]"}),s.jsx(_a,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-[var(--optimex-text-secondary)]"}),e&&s.jsx("button",{type:"button",onClick:()=>t(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors",children:s.jsx(Ie,{className:"size-5"})})]})})}function cu({networks:e,selectedNetwork:t,onSelectNetwork:r}){return s.jsxs("div",{className:"w-1/3 min-w-[140px] border-r border-white/[0.05] overflow-y-auto p-2",children:[s.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--optimex-text-secondary)]",children:"Networks"}),s.jsxs("div",{className:"space-y-1 px-2",children:[s.jsxs("button",{onClick:()=>r(null),className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors ${t===null?"bg-white/5 text-[var(--optimex-text)]":"text-[var(--optimex-text-secondary)] hover:bg-white/5 hover:text-[var(--optimex-text)]"}`,children:[s.jsx(ya,{}),s.jsx("span",{children:"All"})]}),e.map(n=>s.jsx(uu,{network:n,isSelected:t===n.network_id,onSelect:()=>r(n.network_id)},n.network_id))]})]})}function uu({network:e,isSelected:t,onSelect:r}){return s.jsxs("button",{onClick:r,className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors ${t?"bg-white/5 text-[var(--optimex-text)]":"text-[var(--optimex-text-secondary)] hover:bg-white/5 hover:text-[var(--optimex-text)]"}`,children:[e.logo_uri?s.jsx("img",{src:e.logo_uri,alt:e.name,className:"h-8 w-8 rounded-lg",onError:n=>{n.target.style.display="none"}}):s.jsx("div",{className:"h-6 w-6 rounded-full bg-white/10"}),s.jsx("span",{className:"truncate",children:e.name})]})}function du({tokens:e,selectedSymbol:t,onSelectSymbol:r,maxVisible:n=12}){return s.jsxs("div",{className:"flex-shrink-0 border-b border-white/[0.05] p-2",children:[s.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--optimex-text-secondary)]",children:"Tokens"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5 overflow-hidden max-h-[5rem]",children:[s.jsx("button",{onClick:()=>r(null),className:`border rounded-lg px-2.5 py-1 text-xs font-medium transition-colors ${t===null?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]"}`,children:"All"}),e.slice(0,n).map(o=>s.jsx(fu,{token:o,isSelected:t===o.token_symbol,onSelect:()=>r(o.token_symbol)},o.token_symbol))]})]})}function fu({token:e,isSelected:t,onSelect:r}){return s.jsxs("button",{onClick:r,className:ls("flex items-center gap-1 rounded-lg px-2.5 py-1 text-xs font-medium transition-colors outline-none border bg-white/5",t?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]"),children:[e.token_logo_uri&&s.jsx("img",{src:e.token_logo_uri,alt:e.token_symbol,className:"h-4 w-4 rounded-full",onError:n=>{n.target.style.display="none"}}),e.token_symbol]})}function Ze(){const e=p.useContext(An);if(!e)throw new Error("useWallet must be used within WalletProvider");return e}function Pt(e){return`https://network-api-stg.bitdex.xyz/${e}/rpc/zwD70RMT9DrE8L5SaMnJNMF8m70Gum`}function hu(e){return e==="bitcoin_testnet"?"https://mempool.space/testnet4/api":"https://mempool.space/api"}function Er(e){return!e.token_address||e.token_address===""||e.token_address==="native"||e.token_address==="0x0000000000000000000000000000000000000000"}function mu(e,t){if(!e||e==="0")return"0";const r=BigInt(e),n=BigInt(10**t),o=r/n,a=r%n;if(a===BigInt(0))return o.toString();let l=a.toString().padStart(t,"0");return l=l.replace(/0+$/,""),l.length>6&&(l=l.slice(0,6)),`${o}.${l}`}function pu(e){return`0x70a08231000000000000000000000000${e.toLowerCase().replace("0x","")}`}async function eo(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`RPC request failed: ${r.status}`);return r.json()}async function xu(e,t){const n=await eo(e,{jsonrpc:"2.0",method:"eth_getBalance",params:[t,"latest"],id:1});if(n.error)throw new Error(`RPC error: ${n.error.message}`);const o=n.result||"0x0";return BigInt(o).toString()}async function vu(e,t,r){const n={jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:pu(r)},"latest"],id:1},o=await eo(e,n);if(o.error)throw new Error(`RPC error: ${o.error.message}`);const a=o.result||"0x0";return BigInt(a).toString()}async function gu(e,t){const r=Pt(e.network_id),n=Er(e);let o;return n?o=await xu(r,t):o=await vu(r,e.token_address,t),{rawBalance:o,isNative:n}}async function bu(e,t){const n=`${hu(e.network_id)}/address/${t}`,o=await fetch(n);if(!o.ok)throw new Error(`Mempool API request failed: ${o.status}`);const a=await o.json(),l=a.chain_stats.funded_txo_sum-a.chain_stats.spent_txo_sum,i=a.mempool_stats.funded_txo_sum-a.mempool_stats.spent_txo_sum;return{rawBalance:(l+i).toString(),isNative:!0}}async function to(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`RPC request failed: ${r.status}`);return r.json()}async function yu(e,t){const n=await to(e,{jsonrpc:"2.0",method:"getBalance",params:[t],id:1});if(n.error)throw new Error(`RPC error: ${n.error.message}`);return(n.result?.value||0).toString()}async function wu(e,t,r){const o=await to(e,{jsonrpc:"2.0",method:"getTokenAccountsByOwner",params:[r,{mint:t},{encoding:"jsonParsed"}],id:1});if(o.error)throw new Error(`RPC error: ${o.error.message}`);const a=o.result?.value||[];let l=BigInt(0);for(const i of a){const c=i.account.data.parsed.info.tokenAmount.amount;l+=BigInt(c)}return l.toString()}async function Cu(e,t){const r=Pt(e.network_id),n=Er(e);let o;return n?o=await yu(r,t):o=await wu(r,e.token_address,t),{rawBalance:o,isNative:n}}function ku(e,t){if(!t)return!1;switch(t){case G.EVM:return e.isEvmConnected;case G.BTC:return e.isBtcConnected;case G.SOLANA:return e.isSolanaConnected;default:return!1}}function ju(e){if(!e)return"";switch(e){case G.EVM:return"EVM";case G.BTC:return"Bitcoin";case G.SOLANA:return"Solana";default:return e}}function Su(e,t){if(!t)return null;switch(t){case G.EVM:return e.evmAddress;case G.BTC:return e.btcAddress;case G.SOLANA:return e.solanaAddress;default:return null}}async function ro({provider:e,address:t,chainId:r,chainName:n="Unknown"}){let o=t;if(!o){const l=await e.request({method:"eth_accounts"});if(!l||l.length===0)throw new Error("No accounts found. Please connect your wallet first.");o=l[0]}let a=r;if(a===void 0){const l=await e.request({method:"eth_chainId"});a=parseInt(l,16)}return no({provider:e,address:o,chainId:a,chainName:n})}function no({provider:e,address:t,chainId:r,chainName:n="Unknown"}){return{address:t,publicKey:t,chain:{id:r,name:n,type:"EVM"},sendTransaction:async i=>{const c=i;return await e.request({method:"eth_sendTransaction",params:[{from:t,to:c.to,value:c.value?`0x${c.value.toString(16)}`:void 0,data:c.data}]})},getChainId:async()=>{const i=await e.request({method:"eth_chainId"});return parseInt(i,16)},switchChain:async i=>{try{await e.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${i.toString(16)}`}]})}catch(c){throw c.code===4902?new Error(`Chain ${i} not found in wallet. Please add it first.`):c}}}}const Eu=ro;async function Nu(e,t){const r=e.token_address||"native";let n;switch(e.network_type){case G.BTC:n=await bu(e,t);break;case G.SOLANA:n=await Cu(e,t);break;case G.EVM:default:n=await gu(e,t)}return{tokenId:r,networkId:e.network_id,walletAddress:t,rawBalance:n.rawBalance,formattedBalance:mu(n.rawBalance,e.token_decimals),updatedAt:Date.now()}}const Tu=30*1e3,Ru=15*1e3;function Ou(e,t){return!e||!t?["balance"]:["balance",e.network_id,e.token_address||"native",t]}function so({token:e,walletAddress:t,enabled:r=!0,polling:n=!1,pollingInterval:o=Ru}){const a=r&&!!e&&!!t,{data:l,isLoading:i,isFetching:c,error:u,refetch:d}=Qe({queryKey:Ou(e,t),queryFn:()=>Nu(e,t),enabled:a,staleTime:Tu,retry:1,refetchOnWindowFocus:!1,refetchInterval:n?o:!1});return{balance:l,formattedBalance:l?.formattedBalance||"0",isLoading:a&&i,isFetching:a&&c,error:u,refetch:d}}function _u({token:e,isSelected:t,isDisabled:r,onSelect:n}){const o=Ze(),a=Su(o,e.network_type),{formattedBalance:l,isLoading:i}=so({token:e,walletAddress:a,enabled:!!a}),c=!!a;return s.jsxs("button",{onClick:n,disabled:r,className:`flex w-full items-center gap-3 rounded-lg p-2 transition-colors ${t?"bg-white/5 text-[var(--optimex-text)]":r?"cursor-not-allowed opacity-50":"hover:bg-white/5"}`,children:[s.jsx(De,{token:e}),s.jsxs("div",{className:"flex-1 text-left",children:[s.jsx("div",{className:"text-sm text-[var(--optimex-text-secondary)]",children:e.token_name}),s.jsxs("div",{className:"flex items-center gap-2",children:[c&&s.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:i?s.jsx("span",{className:"inline-block h-4 w-12 animate-pulse rounded bg-white/10"}):l}),s.jsx("span",{className:"font-medium text-[var(--optimex-text)]",children:e.token_symbol})]})]}),t&&s.jsx(gr,{className:"h-5 w-5 text-[var(--optimex-primary)]"})]})}function Au({tokens:e,selectedTokenId:t,disabledTokenId:r,disabledTokenIds:n,isLoading:o,emptyMessage:a="No tokens available",onSelect:l}){return o?s.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-[var(--optimex-primary)] border-t-transparent"})})}):e.length===0?s.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:s.jsx("div",{className:"py-8 text-center text-[var(--optimex-text-secondary)]",children:a})}):s.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:s.jsx("div",{className:"space-y-1",children:e.map(i=>{const c=r===i.token_id||n?.has(i.token_id)===!0;return s.jsx(_u,{token:i,isSelected:t===i.token_id,isDisabled:c,onSelect:()=>l(i)},i.token_id)})})})}function Pu({isOpen:e,onClose:t,onSelect:r,tokensData:n,isLoading:o,selectedToken:a,disabledTokenId:l,disabledTokenIds:i,tokens:c,emptyMessage:u,title:d="Select Token",filterNetworkType:f}){const[m,b]=p.useState(""),[v,h]=p.useState(null),[y,g]=p.useState(null),S=p.useMemo(()=>n?.supported_networks?f?n.supported_networks.filter(M=>M.type===f):n.supported_networks:[],[n,f]),k=c??n?.tokens,w=p.useMemo(()=>k?k.filter(M=>{if(f&&M.network_type!==f||v&&M.network_id!==v)return!1;if(m){const $=(W,V)=>W.toLowerCase().includes(V.toLowerCase()),_=m.toLowerCase();return $(M.token_symbol,_)||$(M.token_name,_)||$(M.token_address,_)}return!0}):[],[k,m,v,f]),N=p.useMemo(()=>{if(!k)return[];const M=new Map;return k.forEach($=>{f&&$.network_type!==f||v&&$.network_id!==v||M.has($.token_symbol)||M.set($.token_symbol,$)}),Array.from(M.values())},[k,f,v]),A=p.useMemo(()=>y?w.filter(M=>M.token_symbol===y):w,[w,y]),C=()=>{b(""),h(null),g(null)},j=M=>{r(M),t(),C()},O=M=>{M||(t(),C())},D=M=>{h(M),g(null)};return s.jsx(jr,{open:e,onOpenChange:O,title:d,className:"h-full md:h-[70vh] max-h-[600px] w-full max-w-2xl",children:s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsx(lu,{value:m,onChange:b}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsx(cu,{networks:S,selectedNetwork:v,onSelectNetwork:D}),s.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden pl-2",children:[s.jsx(du,{tokens:N,selectedSymbol:y,onSelectSymbol:g}),s.jsx(Au,{tokens:A,selectedTokenId:a?.token_id,disabledTokenId:l,disabledTokenIds:i,isLoading:o,emptyMessage:m?"No tokens found":u??"No tokens available",onSelect:j})]})]})]})})}function gn({token:e,amount:t,label:r,isEstimated:n=!1,highlight:o=!1,usdValue:a="$0.00"}){return s.jsx("div",{className:`p-4 rounded-xl border transition-all duration-200 ${o?"bg-zinc-900/50 border-[var(--optimex-primary)]/20 shadow-[0_0_15px_rgba(235,98,0,0.1)]":"bg-zinc-900/50 border-white/5"}`,children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"size-12 flex items-center justify-center ",children:s.jsx(De,{token:e,size:"lg"})}),s.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[s.jsxs("p",{className:`text-xs font-medium uppercase tracking-wider ${o?"text-[var(--optimex-primary)]":"text-zinc-500"}`,children:[r," ",n&&"(Est.)"]}),s.jsx("p",{className:"text-white text-sm font-semibold truncate",children:e.token_symbol}),s.jsx("p",{className:"text-zinc-500 text-xs truncate",children:e.network_name})]}),s.jsxs("div",{className:"flex flex-col items-end gap-0.5 ml-auto shrink-0",children:[s.jsx("p",{className:"text-white text-lg font-bold",children:n?`~${t}`:t}),s.jsx("p",{className:"text-zinc-400 text-xs",children:a})]})]})})}function Mu({fromToken:e,toToken:t,fromAmount:r,toAmount:n,fromUsdValue:o="$0.00",toUsdValue:a="$0.00"}){return s.jsxs("div",{className:"relative flex flex-col gap-2",children:[s.jsx(gn,{token:e,amount:r,label:"You Pay",usdValue:o}),s.jsx(Js,{onClick:()=>{},disabled:!0}),s.jsx(gn,{token:t,amount:n,label:"You Receive",usdValue:a})]})}function Xt({label:e,value:t,borderTop:r}){return s.jsxs("div",{className:`flex justify-between items-center text-sm ${r?"pt-2 mt-2 border-t border-white/5":""}`,children:[s.jsx("span",{className:"text-zinc-500",children:e}),s.jsx("div",{className:"flex items-center gap-1 text-white font-medium",children:t})]})}function Iu({minReceived:e,estimatedTime:t,slippage:r,networkFee:n="Included"}){return s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-xl p-4 border border-white/5 space-y-3",children:[s.jsx(Xt,{label:"Min. Received",value:e}),s.jsx(Xt,{label:"Estimated Time",value:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-2 bg-[var(--optimex-primary)] rounded-full animate-pulse shadow-[0_0_8px_rgba(235,98,0,0.8)]"}),s.jsx("span",{children:t})]})}),s.jsx(Xt,{label:"Slippage Tolerance",value:r})]})}const Lu=3e4,Du=6e4;function Rt({symbol:e,enabled:t=!0}){const r=lt(),{data:n,isLoading:o,isError:a}=Qe({queryKey:["tokenPrice",e],queryFn:async()=>{if(!e)throw new Error("Symbol is required");return(await Ke(r.apiBaseUrl).getTokenPrice(e)).current_price},enabled:t&&!!e,staleTime:Lu,refetchInterval:Du,retry:2});return{price:n??null,isLoading:o,isError:a,calculateUsdValue:i=>{if(!n||!i||isNaN(parseFloat(i)))return"$0.00";const c=parseFloat(i);if(c===0)return"$0.00";const u=c*n;return u<.01?"<$0.01":u<1?`$${u.toFixed(4)}`:u<1e3?`$${u.toFixed(2)}`:u<1e6?`$${(u/1e3).toFixed(2)}K`:`$${(u/1e6).toFixed(2)}M`}}}function Fu({isOpen:e,onClose:t,onConfirm:r,fromToken:n,toToken:o,amountIn:a,quote:l,slippage:i,stage:c,receivingAddress:u=""}){const d=c!=="idle"&&c!=="confirming"&&c!=="error"&&c!=="submitted",f=c==="submitted",m=c==="error",b=Ne(l.min_amount_out,o.token_decimals),{calculateUsdValue:v}=Rt({symbol:n.token_symbol,enabled:e}),{calculateUsdValue:h}=Rt({symbol:o.token_symbol,enabled:e}),y=v(a),g=h(b),S=w=>{!w&&!d&&t()},k=f?"Swap Complete":m?"Swap Failed":"Review Swap";return s.jsxs(jr,{open:e,onOpenChange:S,title:k,showCloseButton:!d,className:"w-full max-w-md",children:[s.jsxs(zc,{className:"space-y-3",children:[s.jsx(Mu,{fromToken:n,toToken:o,fromAmount:a,toAmount:b,fromUsdValue:y,toUsdValue:g}),s.jsx(Iu,{minReceived:`${b} ${o.token_symbol}`,estimatedTime:"~10 minutes",slippage:`${i}%`}),u&&s.jsx("div",{className:"bg-[var(--optimex-surface)] rounded-xl px-2 border border-white/5",children:s.jsx(Ia,{icon:Fn,label:"Receiving Address",address:u})})]}),s.jsx(Wc,{children:s.jsx(Ei,{state:d?"processing":f?"success":m?"error":"idle",onConfirm:f?t:r,confirmText:"Confirm Swap"})})]})}function $u({swap:e}){const{tokens:t,modals:r,tokenSelect:n,actions:o,input:a,quote:l,execution:i}=e;return s.jsxs(s.Fragment,{children:[r.tokenSelect.isOpen&&s.jsx(Pu,{isOpen:r.tokenSelect.isOpen,onClose:r.tokenSelect.close,onSelect:o.selectToken,tokensData:t.data,isLoading:!1,selectedToken:n.type==="from"?t.from:t.to,disabledTokenId:n.type==="from"?t.to?.token_id:t.from?.token_id,tokens:n.type==="to"?t.availableTo:t.all,emptyMessage:n.type==="to"?"No available pairs for selected source token":void 0,title:n.type==="from"?"Select Source Token":"Select Destination Token"}),l.data&&t.from&&t.to&&r.confirm.isOpen&&s.jsx(Fu,{isOpen:r.confirm.isOpen,onClose:o.closeConfirmModal,onConfirm:o.confirmSwap,fromToken:t.from,toToken:t.to,amountIn:a.amount,quote:l.data,slippage:a.slippage,stage:i.stage,txHash:i.txHash,error:i.error,receivingAddress:e.addresses.receiving})]})}function Nr({status:e}){const t={pending:{icon:Dn,text:"Processing",bgClass:"bg-yellow-500/10",textClass:"text-yellow-500",animate:!0},success:{icon:gr,text:"Completed",bgClass:"bg-green-500/10",textClass:"text-green-500",animate:!1},failed:{icon:Ca,text:"Failed",bgClass:"bg-red-500/10",textClass:"text-red-500",animate:!1}},{icon:r,text:n,bgClass:o,textClass:a,animate:l}=t[e];return s.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${o}`,children:[s.jsx(r,{className:`w-4 h-4 ${a} ${l?"animate-spin":""}`}),s.jsx("span",{className:`text-xs font-medium ${a}`,children:n})]})}function Bu({onClose:e}){return s.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-[var(--optimex-border)] rounded-xl p-4 mt-3",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)] font-medium",children:"Recent Trade"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nr,{status:"pending"}),e&&s.jsx("button",{onClick:e,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors cursor-pointer","aria-label":"Close",children:s.jsx(Ie,{className:"w-4 h-4"})})]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("div",{className:"w-16 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsx("div",{className:"w-10 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]})]}),s.jsx("div",{className:"flex items-center px-3",children:s.jsx("svg",{className:"w-5 h-5 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsx("div",{className:"w-16 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsx("div",{className:"w-10 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]}),s.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"})]})]})]})}function zu({trade:e,status:t,isLoading:r,onClose:n}){if(r||!e)return s.jsx(Bu,{onClose:n});const o=e.from_token,a=e.to_token,l=Ne(e.amount_in,o.token_decimals),i=Ne(e.min_amount_out,a.token_decimals);return s.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-[var(--optimex-border)] rounded-xl p-4 mt-3",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)] font-medium",children:"Recent Trade"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nr,{status:t}),n&&s.jsx("button",{onClick:n,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors cursor-pointer","aria-label":"Close",children:s.jsx(Ie,{className:"w-4 h-4"})})]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{token:o,size:"sm",showNetworkBadge:!1}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:l}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:o.token_symbol})]})]}),s.jsx("div",{className:"flex items-center px-3",children:s.jsx("svg",{className:"w-5 h-5 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:i}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:a.token_symbol})]}),s.jsx(De,{token:a,size:"sm",showNetworkBadge:!1})]})]})]})}const Wu=1e4;function Vu({apiBaseUrl:e,walletAddresses:t,enabled:r=!0,limit:n=20}){const{data:o,isLoading:a,isError:l,refetch:i}=Qe({queryKey:["trades",t,n],queryFn:async()=>Ke(e).listTrades({from_user_address:t,limit:n}),enabled:r&&!!t?.length,refetchInterval:Wu,retry:2,retryDelay:2e3});return{trades:o??[],isLoading:a,isError:l,refetch:i}}function Uu(e){if(!e)return"pending";switch(e.toLowerCase()){case"success":case"completed":return"success";case"failed":case"refunded":case"expired":return"failed";default:return"pending"}}function Hu({trade:e}){const t=e.from_token,r=e.to_token,n=Uu(e.state),o=Ne(e.amount_in,t.token_decimals),a=Ne(e.min_amount_out,r.token_decimals);return s.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-[var(--optimex-border)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{token:t,size:"sm",showNetworkBadge:!1}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:o}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:t.token_symbol})]})]}),s.jsx("div",{className:"flex items-center px-2",children:s.jsx("svg",{className:"w-4 h-4 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:a}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:r.token_symbol})]}),s.jsx(De,{token:r,size:"sm",showNetworkBadge:!1})]}),s.jsx("div",{className:"ml-3",children:s.jsx(Nr,{status:n})})]})}function Jt(){return s.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-[var(--optimex-border)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("div",{className:"w-14 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsx("div",{className:"w-8 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]})]}),s.jsx("div",{className:"w-4 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsx("div",{className:"w-14 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsx("div",{className:"w-8 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]}),s.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"})]}),s.jsx("div",{className:"ml-3 w-20 h-6 bg-[var(--optimex-border)] rounded-full animate-pulse"})]})}function qu(){return s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx("div",{className:"w-16 h-16 mb-4 rounded-full bg-[var(--optimex-surface)] flex items-center justify-center",children:s.jsx("svg",{className:"w-8 h-8 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),s.jsx("p",{className:"text-sm text-[var(--optimex-text-secondary)]",children:"No trade history yet"})]})}function Qu({open:e,onOpenChange:t,evmAddress:r,btcAddress:n,solanaAddress:o}){const a=lt(),l=[r,n,o].filter(u=>!!u),{trades:i,isLoading:c}=Vu({apiBaseUrl:a.apiBaseUrl,walletAddresses:l.length>0?l:void 0,enabled:e&&l.length>0});return s.jsx(jr,{open:e,onOpenChange:t,title:"Trade History",className:"w-full max-w-md",children:s.jsxs("div",{className:"p-4 space-y-3 max-h-[60vh] overflow-y-auto",children:[c?s.jsxs(s.Fragment,{children:[s.jsx(Jt,{}),s.jsx(Jt,{}),s.jsx(Jt,{})]}):i.length===0?s.jsx(qu,{}):i.map(u=>s.jsx(Hu,{trade:u},u.trade_id)),!c&&i.length>0&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2 text-xs text-[var(--optimex-text-secondary)]",children:[s.jsx(Dn,{className:"w-3 h-3 animate-spin"}),s.jsx("span",{children:"Auto-refreshing"})]})]})})}function Ku(e,t){return p.useMemo(()=>{const r=e.trim();if(!t||!r)return{isValid:!r,error:void 0};const n=vr(r,t.network_type,t.network_id);return{isValid:n.isValid,error:n.isValid?void 0:n.error}},[e,t])}function Gu(){const[e,t]=p.useState(null),[r,n]=p.useState(!1),[o,a]=p.useState(!1),l=p.useCallback(()=>t("from"),[]),i=p.useCallback(()=>t("to"),[]),c=p.useCallback(()=>t(null),[]),u=p.useCallback(()=>n(!0),[]),d=p.useCallback(()=>n(!1),[]),f=p.useCallback(()=>a(b=>!b),[]),m=p.useCallback(()=>a(!1),[]);return{tokenSelect:{isOpen:e!==null,type:e,openFrom:l,openTo:i,close:c},confirm:{isOpen:r,open:u,close:d},settings:{isOpen:o,toggle:f,close:m}}}function Yu({fromToken:e,toToken:t,amount:r,fromUserAddress:n,toUserAddress:o,userRefundPubkey:a,slippage:l,config:i}){return p.useMemo(()=>{const c=o.trim(),u=i.affiliateAddress&&i.affiliateFee?[{provider:i.affiliateProvider??"optimex-widget",rate:String(i.affiliateFee),receiver:i.affiliateAddress,network:"ethereum"}]:void 0,d=Math.round(l*100);return{from_token:e,to_token:t,amount:r,from_user_address:n,to_user_address:c||null,user_refund_pubkey:a,slippage:String(d),affiliate_fee_bps:i.affiliateFee?String(i.affiliateFee):void 0,affiliate_info:u,trade_timeout:i.tradeTimeout,script_timeout:i.scriptTimeout}},[e,t,r,n,o,a,l,i.affiliateFee,i.affiliateAddress,i.affiliateProvider,i.tradeTimeout,i.scriptTimeout])}function Zu(e,t){return p.useMemo(()=>{if(!e||!t)return{walletAccount:void 0,evmWalletAccount:void 0};switch(e.network_type){case G.EVM:return{walletAccount:t.evm,evmWalletAccount:t.evm};case G.BTC:return{walletAccount:t.btc,evmWalletAccount:void 0};case G.SOLANA:return{walletAccount:t.solana,evmWalletAccount:void 0};default:return{walletAccount:void 0,evmWalletAccount:void 0}}},[e,t])}const bn={BTC:1,EVM:2,Solana:3};function Xu(e){const{tokens:t,pairs:r,selectedFromToken:n}=e,o=p.useMemo(()=>{const b=new Map;if(!r)return b;for(const v of r){if(!v.is_active)continue;const h=b.get(v.from_token_id);h?h.add(v.to_token_id):b.set(v.from_token_id,new Set([v.to_token_id]))}return b},[r]),a=p.useMemo(()=>t??[],[t]),l=p.useMemo(()=>{const b=new Set;for(const v of a){const h=o.get(v.token_id);(!h||h.size===0)&&b.add(v.token_id)}return b},[a,o]),i=p.useMemo(()=>{if(!n)return[];const b=o.get(n.token_id);return!b||b.size===0?[]:a.filter(v=>b.has(v.token_id))},[n,o,a]),c=p.useCallback((b,v)=>o.get(b)?.has(v)??!1,[o]),u=p.useCallback(b=>(o.get(b)?.size??0)>0,[o]),d=p.useCallback(b=>[...b].sort((v,h)=>{const y=bn[v.network_type]??99,g=bn[h.network_type]??99;return y-g}),[]),f=p.useCallback(b=>{const v=o.get(b.token_id);if(!v||v.size===0)return null;const h=a.filter(g=>v.has(g.token_id));return h.length===0?null:d(h)[0]??null},[o,a,d]),m=p.useCallback(()=>{if(a.length===0)return null;const b=d(a);for(const v of b){const h=f(v);if(h)return{fromToken:v,toToken:h}}return null},[a,d,f]);return{allTokens:a,tokensWithoutPairs:l,availableToTokens:i,isPairValid:c,findBestToToken:f,hasValidPairs:u,getDefaultPair:m}}function Ju(e){if(!e.chain_id||e.network_type!=="EVM")return;const t=parseInt(e.chain_id,10);return isNaN(t)?void 0:t}async function ed(e,t){const r=Ju(t);if(!r)throw new Error(`Cannot determine chain ID for token: ${t.token_id}`);return await e.getChainId()===r?!1:(await e.switchChain(r),!0)}const td="0xdd62ed3e",rd="0x095ea7b3",nd="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";function hr(e){return e.toLowerCase().replace("0x","").padStart(64,"0")}function sd(e){return e.toString(16).padStart(64,"0")}function od(e){const t=e.startsWith("0x")?e.slice(2):e;return!t||t===""?0n:BigInt("0x"+t)}async function ad(e,t,r,n){const o=Pt(e),a=td+hr(r)+hr(n),i=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:t,data:a},"latest"]})})).json();if(i.error)throw new Error(`Failed to check allowance: ${i.error.message}`);return od(i.result)}function id(e,t){const r=t?sd(t):nd.slice(2);return`${rd}${hr(e)}${r}`}async function ld(e,t,r,n){const o=id(r,n);return await e.sendTransaction({to:t,data:o})}async function cd(e,t,r=60,n=2e3){const o=Pt(e);for(let a=0;a<r;a++){const i=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_getTransactionReceipt",params:[t]})})).json();if(i.error)throw new Error(`RPC error: ${i.error.message}`);if(i.result){const c=i.result;return{status:c.status==="0x1"?"success":"reverted",blockNumber:c.blockNumber,transactionHash:c.transactionHash}}await new Promise(c=>setTimeout(c,n))}throw new Error(`Transaction ${t} not confirmed after ${r} attempts`)}function ud(e){return e?"getChainId"in e&&"switchChain"in e&&typeof e.getChainId=="function"&&typeof e.switchChain=="function":!1}function dd({apiBaseUrl:e,onWalletTx:t,onSubmitTx:r,onError:n}){const[o,a]=p.useState({stage:"idle",txHash:null,tradeId:null,error:null}),l=p.useCallback(()=>{a({stage:"idle",txHash:null,tradeId:null,error:null})},[]),i=p.useCallback(()=>{a(f=>({stage:"idle",txHash:f.txHash,tradeId:f.tradeId,error:null}))},[]),c=p.useCallback((f,m,b)=>{a(v=>({...v,stage:"error",error:f})),n?.({error:f,stage:m,trade_id:b})},[n]),u=p.useCallback(async(f,m,b,v)=>{const h=b.deposit_address;if(!h)throw new Error("Missing deposit address for EVM transaction");a(k=>({...k,stage:"switching_chain"})),await ed(f,m);const y=Er(m);if(!y&&m.token_address&&(a(w=>({...w,stage:"checking_allowance"})),await ad(m.network_id,m.token_address,f.address,h)<v)){a(A=>({...A,stage:"approving"}));const w=await ld(f,m.token_address,h,v);if((await cd(m.network_id,w)).status==="reverted")throw new Error("Token approval transaction reverted")}a(k=>({...k,stage:"broadcasting"}));const g={to:h,value:y?v:0n,data:b.payload?b.payload:void 0};return await f.sendTransaction(g)},[]),d=p.useCallback(async({quote:f,fromToken:m,toToken:b,amountIn:v,walletAccount:h,evmWalletAccount:y})=>{const g=Ke(e);try{a({stage:"confirming",txHash:null,tradeId:f.trade_id,error:null});const S=y||h;if(!S)throw new Error("Wallet not available");a(N=>({...N,stage:"signing"}));let k;const w=Mn(v,m.token_decimals);if(m.network_type===G.EVM){const N=y||(ud(h)?h:null);if(N)k=await u(N,m,f,w);else{const A=f.deposit_address,C=f.payload?f.payload:void 0;if(!A)throw new Error("Missing deposit address for EVM transaction");a(O=>({...O,stage:"broadcasting"}));const j={to:A,value:w,data:C};k=await S.sendTransaction(j)}}else if(m.network_type===G.BTC){if(!f.deposit_address)throw new Error("Missing deposit address for BTC transaction");a(N=>({...N,stage:"broadcasting"})),k=await S.sendTransaction({toAddress:f.deposit_address,amount:w})}else if(m.network_type===G.SOLANA){if(!f.payload)throw new Error("Missing payload for Solana transaction");a(N=>({...N,stage:"broadcasting"})),k=await S.sendTransaction(f.payload)}else throw new Error(`Unsupported network type: ${m.network_type}`);t?.({trade_id:f.trade_id,tx_hash:k,from_token:m,to_token:b,amount_in:v}),a(N=>({...N,txHash:k,stage:"submitting"}));try{await g.submitTransaction(f.trade_id,k),r?.({trade_id:f.trade_id,tx_hash:k,status:"success"})}catch(N){throw r?.({trade_id:f.trade_id,tx_hash:k,status:"error",error:N.message}),N}return a(N=>({...N,stage:"submitted"})),{tradeId:f.trade_id,txHash:k}}catch(S){const k=o.stage==="approving"?"approval":"wallet_tx";throw c(S,k,f.trade_id),S}},[e,t,r,c,u,o.stage]);return{...o,executeSwap:d,resetState:l,resetStateKeepTradeId:i,isExecuting:o.stage!=="idle"&&o.stage!=="submitted"&&o.stage!=="error"}}function fd({defaultPair:e,isPairValid:t,findBestToToken:r,hasValidPairs:n,defaultSlippage:o=.75,selectingToken:a=null}){const[l,i]=p.useState(null),[c,u]=p.useState(null),[d,f]=p.useState(""),[m,b]=p.useState(""),[v,h]=p.useState(o),y=l??e?.fromToken??null,g=c??e?.toToken??null,S=p.useCallback(()=>{y&&g&&t(g.token_id,y.token_id)&&(i(g),u(y),f(""))},[y,g,t]),k=p.useCallback(w=>{if(a==="from"){if(!n(w.token_id))return!1;if(w.token_id===g?.token_id)u(y);else if(g&&!t(w.token_id,g.token_id)){const N=r(w);u(N)}return i(w),!0}else if(a==="to")return w.token_id===y?.token_id&&i(g),u(w),!0;return!1},[a,y,g,t,r,n]);return{fromToken:y,toToken:g,handleTokenSelect:k,handleSwapDirection:S,amount:d,setAmount:f,receivingAddress:m,setReceivingAddress:b,slippage:v,setSlippage:h}}function hd({fromToken:e,toToken:t}){const r=Ze();return p.useMemo(()=>{const n=r.evmAddress,o=r.btcAddress,a=r.btcPublicKey;let l=null,i=null;return e?.network_type===G.EVM?(l=n,i=n):e?.network_type===G.BTC&&(l=o,i=a),{fromUserAddress:l,userRefundPubkey:i}},[r.evmAddress,r.btcAddress,r.btcPublicKey,e,t])}function md({fromToken:e,toToken:t,amount:r,quote:n,isLoadingQuote:o,isFetchingQuote:a,receivingAddress:l,onConnectWallet:i,onSwap:c}){const u=Ze();return p.useMemo(()=>{if(!ku(u,e?.network_type)){const m=ju(e?.network_type);return{text:m?`Connect ${m} Wallet`:"Connect Wallet",disabled:!1,action:i}}return!e||!t?{text:"Select Tokens",disabled:!0,action:void 0}:!r||parseFloat(r)<=0?{text:"Enter Amount",disabled:!0,action:void 0}:l.trim()?vr(l,t.network_type,t.network_id).isValid?o||a?{text:"Getting Quote...",disabled:!0,action:void 0}:n?{text:"Review",disabled:!1,action:c}:{text:"Unable to Quote",disabled:!0,action:void 0}:{text:"Enter Receiving Address",disabled:!0,action:void 0}:{text:"Enter Receiving Address",disabled:!0,action:void 0}},[u.isEvmConnected,u.isBtcConnected,u.isSolanaConnected,e,t,r,o,a,n,i,c,l])}function pd({tokens:e,defaultFromToken:t,defaultToToken:r,isPairValid:n}){return p.useMemo(()=>{if(!t||!r||!e)return null;const o=e.find(l=>l.token_id===t),a=e.find(l=>l.token_id===r);return!o||!a?null:n(o.token_id,a.token_id)?{fromToken:o,toToken:a}:null},[e,t,r,n])}function xd(){const e=Ze(),t=lt(),r=Gu(),{tokensData:n}=Jc(),o=n.tokens,a=n.pairs,{allTokens:l,tokensWithoutPairs:i,isPairValid:c,findBestToToken:u,hasValidPairs:d,getDefaultPair:f}=Xu({tokens:o,pairs:a,selectedFromToken:null}),b=pd({tokens:o,defaultFromToken:t.defaultFromToken,defaultToToken:t.defaultToToken,isPairValid:c})??f(),{fromToken:v,toToken:h,handleTokenSelect:y,handleSwapDirection:g,amount:S,setAmount:k,receivingAddress:w,setReceivingAddress:N,slippage:A,setSlippage:C}=fd({defaultPair:b,isPairValid:c,findBestToToken:u,hasValidPairs:d,defaultSlippage:t.defaultSlippage,selectingToken:r.tokenSelect.type}),j=p.useMemo(()=>v?l.filter(F=>c(v.token_id,F.token_id)):[],[v,l,c]),O=Ku(w,h),{fromUserAddress:D,userRefundPubkey:M}=hd({fromToken:v,toToken:h}),$=Yu({fromToken:v,toToken:h,amount:S,fromUserAddress:D,toUserAddress:w,userRefundPubkey:M,slippage:A,config:{affiliateFee:t.affiliateFee,affiliateAddress:t.affiliateAddress,affiliateProvider:t.affiliateProvider,tradeTimeout:t.tradeTimeout,scriptTimeout:t.scriptTimeout}}),_=!!v&&!!h&&parseFloat(S)>0&&!!w.trim()&&!r.confirm.isOpen,{data:W,isLoading:V,isFetching:Q,refetch:U}=ga(t.apiBaseUrl,{...$,enabled:_,onQuote:t.callbacks?.onQuote}),E=dd({apiBaseUrl:t.apiBaseUrl,onWalletTx:t.callbacks?.onWalletTx,onSubmitTx:t.callbacks?.onSubmitTx,onError:t.callbacks?.onError}),{walletAccount:ne,evmWalletAccount:ie}=Zu(v,e.externalWalletClient??void 0),Te=p.useCallback(()=>{e.isExternalWallet?e.onRequestWallet?.(v?.network_id??""):e.openConnectModal?.()},[e,v?.network_id]),pe=p.useCallback(()=>{!W||!v||!h||(E.resetState(),r.confirm.open())},[W,v,h,r.confirm,E]),H=p.useCallback((F=!1)=>{E.isExecuting||(r.confirm.close(),F&&E.resetStateKeepTradeId())},[E,r.confirm]),Z=p.useCallback(async()=>{if(!(!W||!v||!h))try{const{txHash:F}=await E.executeSwap({quote:W,fromToken:v,toToken:h,amountIn:S,walletAccount:ne,evmWalletAccount:ie});H(!!F),k(""),N("")}catch(F){console.error("Swap failed:",F)}},[W,v,h,S,ne,ie,E,H,k,N]),de=p.useCallback(F=>{y(F)&&r.tokenSelect.close()},[y,r.tokenSelect]),be=md({fromToken:v,toToken:h,amount:S,quote:W,isLoadingQuote:V,isFetchingQuote:Q,receivingAddress:w,onConnectWallet:Te,onSwap:pe});return{tokens:{from:v,to:h,all:l,availableTo:j,withoutPairs:i,data:n},input:{amount:S,setAmount:k,receivingAddress:w,setReceivingAddress:N,slippage:A,setSlippage:C},quote:{data:W,isLoading:V,isFetching:Q,refetch:U},validation:{address:O},buttonState:be,modals:r,tokenSelect:{type:r.tokenSelect.type},actions:{selectToken:de,swapDirection:g,connectWallet:Te,openSwapConfirm:pe,closeConfirmModal:H,confirmSwap:Z},execution:{stage:E.stage,txHash:E.txHash,tradeId:E.tradeId,error:E.error,isExecuting:E.isExecuting},wallet:e,addresses:{sending:D,receiving:w}}}const vd=5e3;function yn(e){if(!e)return"pending";switch(e.toLowerCase()){case"success":case"completed":return"success";case"failed":case"refunded":case"expired":return"failed";default:return"pending"}}function gd({apiBaseUrl:e,tradeId:t}){const{data:r,isLoading:n}=Qe({queryKey:["trade",t],queryFn:async()=>Ke(e).getTrade(t),enabled:!!t,refetchInterval:o=>{const a=o.state.data;return a&&yn(a.state)==="success"?!1:vd},retry:!0,retryDelay:2e3});return{trade:r??null,status:yn(r?.state),isLoading:n}}function oo(){const e=xd(),t=lt(),{tokens:r,input:n,quote:o,modals:a,buttonState:l,validation:i,actions:c,addresses:u,wallet:d,execution:f}=e,[m,b]=p.useState(!1),{trade:v,status:h,isLoading:y}=gd({apiBaseUrl:t.apiBaseUrl,tradeId:f.tradeId}),{formattedBalance:g}=so({token:r.from,walletAddress:u.sending,enabled:!!r.from&&!!u.sending,polling:!0}),{calculateUsdValue:S}=Rt({symbol:r.from?.token_symbol,enabled:!!r.from}),{calculateUsdValue:k}=Rt({symbol:r.to?.token_symbol,enabled:!!r.to}),w=d.isConnected,N=S(n.amount),A=o.data?k(Ne(o.data.min_amount_out,r.to?.token_decimals||18)):"$0.00";return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-col gap-4 w-full min-w-0",children:[s.jsx(su,{headerLeft:t.headerLeft,slippage:n.slippage,onSlippageChange:n.setSlippage,isSettingsOpen:a.settings.isOpen,onSettingsToggle:a.settings.toggle,onHistoryClick:()=>b(!0),hideHistory:t.hideHistory||!d.isConnected}),s.jsxs(Sr,{children:[s.jsxs("div",{className:"space-y-2 relative",children:[s.jsx(vn,{token:r.from,value:n.amount,onChange:n.setAmount,onSelectToken:a.tokenSelect.openFrom,balance:g,isWalletConnected:w,usdValue:N}),s.jsx(Js,{onClick:c.swapDirection}),s.jsx(vn,{token:r.to,value:o.data?Ne(o.data.min_amount_out,r.to?.token_decimals||18):"",readOnly:!0,onSelectToken:a.tokenSelect.openTo,isOutput:!0,usdValue:A})]}),s.jsx("div",{className:"mt-4",children:s.jsx(eu,{token:r.to,value:n.receivingAddress,onChange:n.setReceivingAddress,error:i.address.error})}),s.jsx("div",{className:"mt-4",children:s.jsx(au,{text:l.text,disabled:l.disabled,onClick:l.action})}),o.data&&r.from&&r.to&&s.jsx("div",{className:"mt-4",children:s.jsx(ou,{quote:o.data,fromToken:r.from,toToken:r.to,amount:n.amount,slippage:n.slippage,isFetching:o.isFetching,onRefresh:o.refetch})}),s.jsx("div",{className:"mt-4",children:s.jsx(iu,{})}),f.tradeId&&f.txHash&&s.jsx("div",{className:"mt-4",children:s.jsx(zu,{trade:v,status:h,isLoading:y})})]})]}),s.jsx($u,{swap:e}),m&&s.jsx(Qu,{open:m,onOpenChange:b,evmAddress:d.evmAddress??void 0,btcAddress:d.btcAddress??void 0,solanaAddress:d.solanaAddress??void 0})]})}function bd({className:e,connectLabel:t="Connect Wallet",showNetworkBadge:r=!0,onClick:n}){const o=Ze(),a=o.evmAddress||o.btcAddress||o.solanaAddress,l=()=>{if(n){n();return}o.isExternalWallet?o.onRequestWallet?.():o.openConnectModal?.()},i=()=>r?o.isEvmConnected?s.jsx("span",{className:"rounded bg-blue-500/20 px-1.5 py-0.5 text-xs text-blue-400",children:"EVM"}):o.isBtcConnected?s.jsx("span",{className:"rounded bg-orange-500/20 px-1.5 py-0.5 text-xs text-orange-400",children:"BTC"}):o.isSolanaConnected?s.jsx("span",{className:"rounded bg-purple-500/20 px-1.5 py-0.5 text-xs text-purple-400",children:"SOL"}):null:null;return o.isConnected?s.jsxs("div",{className:`flex items-center gap-2 ${e||""}`,children:[i(),s.jsxs("button",{onClick:l,className:"group flex items-center gap-1.5 rounded-[0.25rem] bg-[var(--optimex-surface-hover)] px-3 py-1.5 text-sm text-[var(--optimex-text)] transition-colors hover:bg-[rgba(239,68,68,0.2)]",children:[s.jsx("span",{children:da(a)}),s.jsx(Sa,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]})]}):s.jsx("button",{onClick:l,className:`rounded-[0.25rem] bg-[var(--optimex-primary)] px-4 py-1.5 text-sm font-medium text-white transition-colors hover:bg-[var(--optimex-primary-hover)] ${e||""}`,children:t})}function yd({apiBaseUrl:e,walletClient:t,onRequestWallet:r,theme:n,defaultFromToken:o,defaultToToken:a,headerLeft:l,affiliateFee:i,affiliateAddress:c,affiliateProvider:u,tradeTimeout:d,scriptTimeout:f,defaultSlippage:m=.75,hideHistory:b=!1,children:v,renderLoading:h,renderError:y,queryClient:g,onQuote:S,onWalletTx:k,onSubmitTx:w,onSwapComplete:N,onError:A}){aa(e);const C=p.useMemo(()=>g??new Lo,[g]),O={apiBaseUrl:e,defaultSlippage:m,affiliateFee:i,affiliateAddress:c,affiliateProvider:u,tradeTimeout:d,scriptTimeout:f,defaultFromToken:o,defaultToToken:a,hideHistory:b,headerLeft:l,callbacks:{onQuote:S,onWalletTx:k,onSubmitTx:w,onSwapComplete:N,onError:A},renderLoading:h,renderError:y},D=v??s.jsx(oo,{});return s.jsx("div",{className:"optx-widget",children:s.jsx(zo,{client:C,children:s.jsx(ba,{value:O,children:s.jsx(sa,{theme:n,children:s.jsx(oa,{externalWalletClient:t,onRequestWallet:r,children:s.jsx(Xc,{children:D})})})})})})}exports.ConnectButton=bd;exports.SwapCard=oo;exports.SwapWidget=yd;exports.createEvmWalletClient=ro;exports.createEvmWalletClientAsync=Eu;exports.createEvmWalletClientSync=no;exports.useWallet=Ze;
|