From fe0572be1a5a72a1255ae9effa4a97868b639aa6 Mon Sep 17 00:00:00 2001 From: masoumeMohebbi Date: Fri, 10 Nov 2023 11:12:20 +0330 Subject: [PATCH] Updates --- assets/index-1258d1e6.css | 1 - assets/index-be13e13a.css | 1 + assets/{index-004936ff.js => index-e657c97b.js} | 2 +- index.html | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 assets/index-1258d1e6.css create mode 100644 assets/index-be13e13a.css rename assets/{index-004936ff.js => index-e657c97b.js} (99%) diff --git a/assets/index-1258d1e6.css b/assets/index-1258d1e6.css deleted file mode 100644 index c485100..0000000 --- a/assets/index-1258d1e6.css +++ /dev/null @@ -1 +0,0 @@ -@font-face{font-family:vazir;font-weight:400;font-style:normal;src:url(/react-noteapp-redux-tlk/assets/Vazir-77161a05.woff) format("woff")}@font-face{font-family:vazir;font-weight:700;font-style:normal;src:url(/react-noteapp-redux-tlk/assets/Vazir-Bold-4b0f0e67.woff) format("woff")}body,button{font-family:vazir}*{-webkit-user-select:none}@media all and (max-device-width: 480px){html,body,p{text-size-adjust:none!important;-webkit-text-size-adjust:none!important;-moz-text-size-adjust:none!important;-ms-text-size-adjust:none!important}}@media all and (min-device-width: 768px) and (max-device-width: 1024px){html,body,p{text-size-adjust:none!important;-webkit-text-size-adjust:none!important;-moz-text-size-adjust:none!important;-ms-text-size-adjust:none!important}}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:vazir;font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*{scrollbar-color:initial;scrollbar-width:initial}*,:before,:after{--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: }::backdrop{--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: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.left-1\/2{left:50%}.right-\[1px\]{right:1px}.top-3{top:.75rem}.top-80{top:20rem}.z-20{z-index:20}.col-span-9{grid-column:span 9 / span 9}.mx-auto{margin-left:auto;margin-right:auto}.my-11{margin-top:2.75rem;margin-bottom:2.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-9{margin-bottom:2.25rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mr-\[6px\]{margin-right:6px}.mt-1{margin-top:.25rem}.mt-16{margin-top:4rem}.mt-6{margin-top:1.5rem}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-1{height:.25rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-56{height:14rem}.h-screen{height:100vh}.min-h-\[250px\]{min-height:250px}.w-11\/12{width:91.666667%}.w-4{width:1rem}.w-5{width:1.25rem}.w-full{width:100%}.w-screen{width:100vw}.shrink-0{flex-shrink:0}.-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))}.-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))}.cursor-pointer{cursor:pointer}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-9{grid-template-columns:repeat(9,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-11{gap:2.75rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-y-2{row-gap:.5rem}.rounded-\[4px\]{border-radius:4px}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-2{border-width:2px}.border-\[\#d8b4fe\]{--tw-border-opacity: 1;border-color:rgb(216 180 254 / var(--tw-border-opacity))}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248 113 113 / var(--tw-border-opacity))}.\!bg-gray-500{--tw-bg-opacity: 1 !important;background-color:rgb(107 114 128 / var(--tw-bg-opacity))!important}.bg-\[\#faf5ff\]{--tw-bg-opacity: 1;background-color:rgb(250 245 255 / var(--tw-bg-opacity))}.bg-blue-300{--tw-bg-opacity: 1;background-color:rgb(147 197 253 / var(--tw-bg-opacity))}.bg-green-300{--tw-bg-opacity: 1;background-color:rgb(134 239 172 / var(--tw-bg-opacity))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity))}.bg-orange-300{--tw-bg-opacity: 1;background-color:rgb(253 186 116 / var(--tw-bg-opacity))}.bg-orange-400{--tw-bg-opacity: 1;background-color:rgb(251 146 60 / var(--tw-bg-opacity))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity))}.bg-purple-200{--tw-bg-opacity: 1;background-color:rgb(233 213 255 / var(--tw-bg-opacity))}.bg-purple-300{--tw-bg-opacity: 1;background-color:rgb(216 180 254 / var(--tw-bg-opacity))}.bg-purple-400{--tw-bg-opacity: 1;background-color:rgb(192 132 252 / var(--tw-bg-opacity))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity))}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-opacity-80{--tw-bg-opacity: .8}.stroke-white{stroke:#fff}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-\[6px\]{padding-top:6px;padding-bottom:6px}.pb-2{padding-bottom:.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.text-primary{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.line-through{text-decoration-line:line-through}.opacity-100{opacity:1}.opacity-50{opacity:.5}.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)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.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)}.duration-500{transition-duration:.5s}.scrollbar-thin{scrollbar-color:var(--scrollbar-thumb, initial) var(--scrollbar-track, initial)}.scrollbar-thin::-webkit-scrollbar-track{background-color:var(--scrollbar-track);border-radius:var(--scrollbar-track-radius)}.scrollbar-thin::-webkit-scrollbar-track:hover{background-color:var(--scrollbar-track-hover, var(--scrollbar-track))}.scrollbar-thin::-webkit-scrollbar-track:active{background-color:var(--scrollbar-track-active, var(--scrollbar-track-hover, var(--scrollbar-track)))}.scrollbar-thin::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb);border-radius:var(--scrollbar-thumb-radius)}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover, var(--scrollbar-thumb))}.scrollbar-thin::-webkit-scrollbar-thumb:active{background-color:var(--scrollbar-thumb-active, var(--scrollbar-thumb-hover, var(--scrollbar-thumb)))}.scrollbar-thin::-webkit-scrollbar-corner{background-color:var(--scrollbar-corner);border-radius:var(--scrollbar-corner-radius)}.scrollbar-thin::-webkit-scrollbar-corner:hover{background-color:var(--scrollbar-corner-hover, var(--scrollbar-corner))}.scrollbar-thin::-webkit-scrollbar-corner:active{background-color:var(--scrollbar-corner-active, var(--scrollbar-corner-hover, var(--scrollbar-corner)))}.scrollbar-thin{scrollbar-width:thin}.scrollbar-thin::-webkit-scrollbar{display:block;width:8px;height:8px}.scrollbar-track-\[\#efefef\]{--scrollbar-track: #efefef !important}.scrollbar-thumb-purple-400{--scrollbar-thumb: #c084fc !important}.scrollbar-track-rounded-lg{--scrollbar-track-radius: .5rem}.scrollbar-thumb-rounded-lg{--scrollbar-thumb-radius: .5rem}nav li{position:relative;cursor:pointer;border-radius:.5rem;padding-left:1.75rem;padding-right:1.75rem;padding-top:6px;padding-bottom:6px;transition-duration:.5s}nav li:before{position:absolute;left:50%;top:1.75rem;height:.5rem;width:.5rem;--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));content:var(--tw-content);border-radius:9999px}.before\:bg-blue-300:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(147 197 253 / var(--tw-bg-opacity))}.before\:bg-green-300:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(134 239 172 / var(--tw-bg-opacity))}.before\:bg-orange-300:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(253 186 116 / var(--tw-bg-opacity))}.before\:bg-purple-300:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(216 180 254 / var(--tw-bg-opacity))}.checked\:border-0:checked{border-width:0px}.checked\:bg-purple-800:checked{--tw-bg-opacity: 1;background-color:rgb(107 33 168 / var(--tw-bg-opacity))}.peer:checked~.peer-checked\:block{display:block}.hover\:bg-purple-500:hover{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity))}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity))}.hover\:bg-red-400:hover{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity))}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-purple-600:hover{--tw-ring-opacity: 1;--tw-ring-color: rgb(147 51 234 / var(--tw-ring-opacity))}.hover\:ring-offset-2:hover{--tw-ring-offset-width: 2px}.hover\:ring-offset-current:hover{--tw-ring-offset-color: currentColor}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2: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(2px + 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)}.focus\:ring-purple-300:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(216 180 254 / var(--tw-ring-opacity))}.focus\:ring-offset-0:focus{--tw-ring-offset-width: 0px}@media (min-width: 640px){.sm\:w-3\/5{width:60%}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 768px){.md\:static{position:static}.md\:col-span-3{grid-column:span 3 / span 3}.md\:col-span-6{grid-column:span 6 / span 6}.md\:mb-0{margin-bottom:0}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:gap-x-9{-moz-column-gap:2.25rem;column-gap:2.25rem}.md\:pl-9{padding-left:2.25rem}}@media (min-width: 1024px){.lg\:max-w-\[70vw\]{max-width:70vw}} diff --git a/assets/index-be13e13a.css b/assets/index-be13e13a.css new file mode 100644 index 0000000..2a7ad5b --- /dev/null +++ b/assets/index-be13e13a.css @@ -0,0 +1 @@ +@font-face{font-family:vazir;font-weight:400;font-style:normal;src:url(/react-noteapp-redux-tlk/assets/Vazir-77161a05.woff) format("woff")}@font-face{font-family:vazir;font-weight:700;font-style:normal;src:url(/react-noteapp-redux-tlk/assets/Vazir-Bold-4b0f0e67.woff) format("woff")}body,button{font-family:vazir}*{-webkit-user-select:none}@media all and (max-device-width: 480px){html,body,p{text-size-adjust:none!important;-webkit-text-size-adjust:none!important;-moz-text-size-adjust:none!important;-ms-text-size-adjust:none!important}}@media all and (min-device-width: 768px) and (max-device-width: 1024px){html,body,p{text-size-adjust:none!important;-webkit-text-size-adjust:none!important;-moz-text-size-adjust:none!important;-ms-text-size-adjust:none!important}}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:vazir;font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*{scrollbar-color:initial;scrollbar-width:initial}*,:before,:after{--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: }::backdrop{--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: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.left-1\/2{left:50%}.right-1{right:.25rem}.top-3{top:.75rem}.top-80{top:20rem}.z-20{z-index:20}.col-span-9{grid-column:span 9 / span 9}.mx-auto{margin-left:auto;margin-right:auto}.my-11{margin-top:2.75rem;margin-bottom:2.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-9{margin-bottom:2.25rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mr-\[6px\]{margin-right:6px}.mt-1{margin-top:.25rem}.mt-16{margin-top:4rem}.mt-6{margin-top:1.5rem}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-1{height:.25rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-56{height:14rem}.h-screen{height:100vh}.min-h-\[250px\]{min-height:250px}.w-11\/12{width:91.666667%}.w-4{width:1rem}.w-5{width:1.25rem}.w-full{width:100%}.w-screen{width:100vw}.shrink-0{flex-shrink:0}.-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))}.-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))}.cursor-pointer{cursor:pointer}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-9{grid-template-columns:repeat(9,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-11{gap:2.75rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-y-2{row-gap:.5rem}.rounded-\[4px\]{border-radius:4px}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-2{border-width:2px}.border-\[\#d8b4fe\]{--tw-border-opacity: 1;border-color:rgb(216 180 254 / var(--tw-border-opacity))}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248 113 113 / var(--tw-border-opacity))}.\!bg-gray-500{--tw-bg-opacity: 1 !important;background-color:rgb(107 114 128 / var(--tw-bg-opacity))!important}.bg-\[\#faf5ff\]{--tw-bg-opacity: 1;background-color:rgb(250 245 255 / var(--tw-bg-opacity))}.bg-blue-300{--tw-bg-opacity: 1;background-color:rgb(147 197 253 / var(--tw-bg-opacity))}.bg-green-300{--tw-bg-opacity: 1;background-color:rgb(134 239 172 / var(--tw-bg-opacity))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity))}.bg-orange-300{--tw-bg-opacity: 1;background-color:rgb(253 186 116 / var(--tw-bg-opacity))}.bg-orange-400{--tw-bg-opacity: 1;background-color:rgb(251 146 60 / var(--tw-bg-opacity))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity))}.bg-purple-200{--tw-bg-opacity: 1;background-color:rgb(233 213 255 / var(--tw-bg-opacity))}.bg-purple-300{--tw-bg-opacity: 1;background-color:rgb(216 180 254 / var(--tw-bg-opacity))}.bg-purple-400{--tw-bg-opacity: 1;background-color:rgb(192 132 252 / var(--tw-bg-opacity))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity))}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-opacity-80{--tw-bg-opacity: .8}.stroke-white{stroke:#fff}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-\[6px\]{padding-top:6px;padding-bottom:6px}.pb-2{padding-bottom:.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.text-primary{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.line-through{text-decoration-line:line-through}.opacity-100{opacity:1}.opacity-50{opacity:.5}.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)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.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)}.duration-500{transition-duration:.5s}.scrollbar-thin{scrollbar-color:var(--scrollbar-thumb, initial) var(--scrollbar-track, initial)}.scrollbar-thin::-webkit-scrollbar-track{background-color:var(--scrollbar-track);border-radius:var(--scrollbar-track-radius)}.scrollbar-thin::-webkit-scrollbar-track:hover{background-color:var(--scrollbar-track-hover, var(--scrollbar-track))}.scrollbar-thin::-webkit-scrollbar-track:active{background-color:var(--scrollbar-track-active, var(--scrollbar-track-hover, var(--scrollbar-track)))}.scrollbar-thin::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb);border-radius:var(--scrollbar-thumb-radius)}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover, var(--scrollbar-thumb))}.scrollbar-thin::-webkit-scrollbar-thumb:active{background-color:var(--scrollbar-thumb-active, var(--scrollbar-thumb-hover, var(--scrollbar-thumb)))}.scrollbar-thin::-webkit-scrollbar-corner{background-color:var(--scrollbar-corner);border-radius:var(--scrollbar-corner-radius)}.scrollbar-thin::-webkit-scrollbar-corner:hover{background-color:var(--scrollbar-corner-hover, var(--scrollbar-corner))}.scrollbar-thin::-webkit-scrollbar-corner:active{background-color:var(--scrollbar-corner-active, var(--scrollbar-corner-hover, var(--scrollbar-corner)))}.scrollbar-thin{scrollbar-width:thin}.scrollbar-thin::-webkit-scrollbar{display:block;width:8px;height:8px}.scrollbar-track-\[\#efefef\]{--scrollbar-track: #efefef !important}.scrollbar-thumb-purple-400{--scrollbar-thumb: #c084fc !important}.scrollbar-track-rounded-lg{--scrollbar-track-radius: .5rem}.scrollbar-thumb-rounded-lg{--scrollbar-thumb-radius: .5rem}nav li{position:relative;cursor:pointer;border-radius:.5rem;padding-left:1.75rem;padding-right:1.75rem;padding-top:6px;padding-bottom:6px;transition-duration:.5s}nav li:before{position:absolute;left:50%;top:1.75rem;height:.5rem;width:.5rem;--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));content:var(--tw-content);border-radius:9999px}.before\:bg-blue-300:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(147 197 253 / var(--tw-bg-opacity))}.before\:bg-green-300:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(134 239 172 / var(--tw-bg-opacity))}.before\:bg-orange-300:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(253 186 116 / var(--tw-bg-opacity))}.before\:bg-purple-300:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(216 180 254 / var(--tw-bg-opacity))}.checked\:border-0:checked{border-width:0px}.checked\:bg-purple-800:checked{--tw-bg-opacity: 1;background-color:rgb(107 33 168 / var(--tw-bg-opacity))}.peer:checked~.peer-checked\:block{display:block}.hover\:bg-purple-500:hover{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity))}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity))}.hover\:bg-red-400:hover{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity))}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-purple-600:hover{--tw-ring-opacity: 1;--tw-ring-color: rgb(147 51 234 / var(--tw-ring-opacity))}.hover\:ring-offset-2:hover{--tw-ring-offset-width: 2px}.hover\:ring-offset-current:hover{--tw-ring-offset-color: currentColor}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2: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(2px + 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)}.focus\:ring-purple-300:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(216 180 254 / var(--tw-ring-opacity))}.focus\:ring-offset-0:focus{--tw-ring-offset-width: 0px}@media (min-width: 640px){.sm\:w-3\/5{width:60%}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 768px){.md\:static{position:static}.md\:col-span-3{grid-column:span 3 / span 3}.md\:col-span-6{grid-column:span 6 / span 6}.md\:mb-0{margin-bottom:0}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:gap-x-9{-moz-column-gap:2.25rem;column-gap:2.25rem}.md\:pl-9{padding-left:2.25rem}}@media (min-width: 1024px){.lg\:max-w-\[70vw\]{max-width:70vw}} diff --git a/assets/index-004936ff.js b/assets/index-e657c97b.js similarity index 99% rename from assets/index-004936ff.js rename to assets/index-e657c97b.js index 12f7aad..a51ef70 100644 --- a/assets/index-004936ff.js +++ b/assets/index-e657c97b.js @@ -249,6 +249,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Uc=Symbol.for("react.element"),Bc=Symbol.for("react.portal"),ca=Symbol.for("react.fragment"),da=Symbol.for("react.strict_mode"),fa=Symbol.for("react.profiler"),ha=Symbol.for("react.provider"),pa=Symbol.for("react.context"),d_=Symbol.for("react.server_context"),ma=Symbol.for("react.forward_ref"),va=Symbol.for("react.suspense"),ga=Symbol.for("react.suspense_list"),ya=Symbol.for("react.memo"),wa=Symbol.for("react.lazy"),f_=Symbol.for("react.offscreen"),Gv;Gv=Symbol.for("react.module.reference");function ct(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Uc:switch(e=e.type,e){case ca:case fa:case da:case va:case ga:return e;default:switch(e=e&&e.$$typeof,e){case d_:case pa:case ma:case wa:case ya:case ha:return e;default:return t}}case Bc:return t}}}G.ContextConsumer=pa;G.ContextProvider=ha;G.Element=Uc;G.ForwardRef=ma;G.Fragment=ca;G.Lazy=wa;G.Memo=ya;G.Portal=Bc;G.Profiler=fa;G.StrictMode=da;G.Suspense=va;G.SuspenseList=ga;G.isAsyncMode=function(){return!1};G.isConcurrentMode=function(){return!1};G.isContextConsumer=function(e){return ct(e)===pa};G.isContextProvider=function(e){return ct(e)===ha};G.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Uc};G.isForwardRef=function(e){return ct(e)===ma};G.isFragment=function(e){return ct(e)===ca};G.isLazy=function(e){return ct(e)===wa};G.isMemo=function(e){return ct(e)===ya};G.isPortal=function(e){return ct(e)===Bc};G.isProfiler=function(e){return ct(e)===fa};G.isStrictMode=function(e){return ct(e)===da};G.isSuspense=function(e){return ct(e)===va};G.isSuspenseList=function(e){return ct(e)===ga};G.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===ca||e===fa||e===da||e===va||e===ga||e===f_||typeof e=="object"&&e!==null&&(e.$$typeof===wa||e.$$typeof===ya||e.$$typeof===ha||e.$$typeof===pa||e.$$typeof===ma||e.$$typeof===Gv||e.getModuleId!==void 0)};G.typeOf=ct;function h_(){const e=o_();let t=null,n=null;return{clear(){t=null,n=null},notify(){e(()=>{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const Zf={notify(){},get:()=>[]};function p_(e,t){let n,r=Zf,i=0,o=!1;function s(v){c();const w=r.subscribe(v);let h=!1;return()=>{h||(h=!0,w(),d())}}function l(){r.notify()}function a(){g.onStateChange&&g.onStateChange()}function u(){return o}function c(){i++,n||(n=t?t.addNestedSub(a):e.subscribe(a),r=h_())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Zf)}function f(){o||(o=!0,c())}function m(){o&&(o=!1,d())}const g={addNestedSub:s,notifyNestedSubs:l,handleChangeWrapper:a,isSubscribed:u,trySubscribe:f,tryUnsubscribe:m,getListeners:()=>r};return g}const m_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",v_=m_?b.useLayoutEffect:b.useEffect;function g_({store:e,context:t,children:n,serverState:r,stabilityCheck:i="once",noopCheck:o="once"}){const s=b.useMemo(()=>{const u=p_(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),l=b.useMemo(()=>e.getState(),[e]);v_(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),l!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,l]);const a=t||Sn;return b.createElement(a.Provider,{value:s},n)}function qv(e=Sn){const t=e===Sn?Wv:zc(e);return function(){const{store:r}=t();return r}}const y_=qv();function w_(e=Sn){const t=e===Sn?y_:qv(e);return function(){return t().dispatch}}const Hc=w_();l_(n_.useSyncExternalStoreWithSelector);i_(kc.unstable_batchedUpdates);function vt(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:Wc(e)?2:Kc(e)?3:0}function br(e,t){return Lr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function S_(e,t){return Lr(e)===2?e.get(t):e[t]}function Qv(e,t,n){var r=Lr(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Jv(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function Wc(e){return k_&&e instanceof Map}function Kc(e){return O_&&e instanceof Set}function An(e){return e.o||e.t}function Gc(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Xv(e);delete t[Z];for(var n=Er(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=b_),Object.freeze(e),t&&Wn(e,function(n,r){return qc(r,!0)},!0)),e}function b_(){vt(2)}function Qc(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Tt(e){var t=Cu[e];return t||vt(18,e),t}function E_(e,t){Cu[e]||(Cu[e]=t)}function bu(){return Mi}function il(e,t){t&&(Tt("Patches"),e.u=[],e.s=[],e.v=t)}function ks(e){Eu(e),e.p.forEach(__),e.p=null}function Eu(e){e===Mi&&(Mi=e.l)}function eh(e){return Mi={p:[],l:Mi,h:e,m:!0,_:0}}function __(e){var t=e[Z];t.i===0||t.i===1?t.j():t.g=!0}function ol(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||Tt("ES5").S(t,e,r),r?(n[Z].P&&(ks(t),vt(4)),Ht(e)&&(e=Os(t,e),t.l||Ps(t,e)),t.u&&Tt("Patches").M(n[Z].t,e,t.u,t.s)):e=Os(t,n,[]),ks(t),t.u&&t.v(t.u,t.s),e!==Yv?e:void 0}function Os(e,t,n){if(Qc(t))return t;var r=t[Z];if(!r)return Wn(t,function(l,a){return th(e,r,t,l,a,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Ps(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=Gc(r.k):r.o,o=i,s=!1;r.i===3&&(o=new Set(i),i.clear(),s=!0),Wn(o,function(l,a){return th(e,r,i,l,a,n,s)}),Ps(e,i,!1),n&&e.u&&Tt("Patches").N(r,n,e.u,e.s)}return r.o}function th(e,t,n,r,i,o,s){if(bn(i)){var l=Os(e,i,o&&t&&t.i!==3&&!br(t.R,r)?o.concat(r):void 0);if(Qv(n,r,l),!bn(l))return;e.m=!1}else s&&n.add(i);if(Ht(i)&&!Qc(i)){if(!e.h.D&&e._<1)return;Os(e,i),t&&t.A.l||Ps(e,i)}}function Ps(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&qc(t,n)}function sl(e,t){var n=e[Z];return(n?An(n):e)[t]}function nh(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function tn(e){e.P||(e.P=!0,e.l&&tn(e.l))}function al(e){e.o||(e.o=Gc(e.t))}function _u(e,t,n){var r=Wc(t)?Tt("MapSet").F(t,n):Kc(t)?Tt("MapSet").T(t,n):e.O?function(i,o){var s=Array.isArray(i),l={i:s?1:0,A:o?o.A:bu(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},a=l,u=Ni;s&&(a=[l],u=ni);var c=Proxy.revocable(a,u),d=c.revoke,f=c.proxy;return l.k=f,l.j=d,f}(t,n):Tt("ES5").J(t,n);return(n?n.A:bu()).p.push(r),r}function C_(e){return bn(e)||vt(22,e),function t(n){if(!Ht(n))return n;var r,i=n[Z],o=Lr(n);if(i){if(!i.P&&(i.i<4||!Tt("ES5").K(i)))return i.t;i.I=!0,r=rh(n,o),i.I=!1}else r=rh(n,o);return Wn(r,function(s,l){i&&S_(i.t,s)===l||Qv(r,s,t(l))}),o===3?new Set(r):r}(e)}function rh(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Gc(e)}function x_(){function e(o,s){var l=i[o];return l?l.enumerable=s:i[o]=l={configurable:!0,enumerable:s,get:function(){var a=this[Z];return Ni.get(a,o)},set:function(a){var u=this[Z];Ni.set(u,o,a)}},l}function t(o){for(var s=o.length-1;s>=0;s--){var l=o[s][Z];if(!l.P)switch(l.i){case 5:r(l)&&tn(l);break;case 4:n(l)&&tn(l)}}}function n(o){for(var s=o.t,l=o.k,a=Er(l),u=a.length-1;u>=0;u--){var c=a[u];if(c!==Z){var d=s[c];if(d===void 0&&!br(s,c))return!0;var f=l[c],m=f&&f[Z];if(m?m.t!==d:!Jv(f,d))return!0}}var g=!!s[Z];return a.length!==Er(s).length+(g?0:1)}function r(o){var s=o.k;if(s.length!==o.t.length)return!0;var l=Object.getOwnPropertyDescriptor(s,s.length-1);if(l&&!l.get)return!0;for(var a=0;a1?h-1:0),y=1;y1?c-1:0),f=1;f=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var s=Tt("Patches").$;return bn(n)?s(n,r):this.produce(n,function(l){return s(l,r)})},e}(),Ye=new T_,Zv=Ye.produce;Ye.produceWithPatches.bind(Ye);Ye.setAutoFreeze.bind(Ye);Ye.setUseProxies.bind(Ye);Ye.applyPatches.bind(Ye);Ye.createDraft.bind(Ye);Ye.finishDraft.bind(Ye);function Oe(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var ah=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),ll=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ts={INIT:"@@redux/INIT"+ll(),REPLACE:"@@redux/REPLACE"+ll(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+ll()}};function $_(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function eg(e,t,n){var r;if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Oe(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Oe(1));return n(eg)(e,t)}if(typeof e!="function")throw new Error(Oe(2));var i=e,o=t,s=[],l=s,a=!1;function u(){l===s&&(l=s.slice())}function c(){if(a)throw new Error(Oe(3));return o}function d(v){if(typeof v!="function")throw new Error(Oe(4));if(a)throw new Error(Oe(5));var w=!0;return u(),l.push(v),function(){if(w){if(a)throw new Error(Oe(6));w=!1,u();var p=l.indexOf(v);l.splice(p,1),s=null}}}function f(v){if(!$_(v))throw new Error(Oe(7));if(typeof v.type>"u")throw new Error(Oe(8));if(a)throw new Error(Oe(9));try{a=!0,o=i(o,v)}finally{a=!1}for(var w=s=l,h=0;h"u")throw new Error(Oe(12));if(typeof n(void 0,{type:Ts.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Oe(13))})}function I_(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(Oe(14));d[m]=w,c=c||w!==v}return c=c||o.length!==Object.keys(a).length,c?d:a}}function $s(){for(var e=arguments.length,t=new Array(e),n=0;n0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]{if(o=aC(o),o in hh)return;hh[o]=!0;const s=o.endsWith(".css"),l=s?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!s||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${l}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":sC,s||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),s)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})},lC=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Yi(()=>Promise.resolve().then(()=>Xi),void 0).then(({default:r})=>r(...n)):t=fetch,(...n)=>t(...n)};class Xc extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}}class uC extends Xc{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class cC extends Xc{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class dC extends Xc{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var fC=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};class hC{constructor(t,{headers:n={},customFetch:r}={}){this.url=t,this.headers=n,this.fetch=lC(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t,n={}){var r;return fC(this,void 0,void 0,function*(){try{const{headers:i,method:o,body:s}=n;let l={},a;s&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)&&(typeof Blob<"u"&&s instanceof Blob||s instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",a=s):typeof s=="string"?(l["Content-Type"]="text/plain",a=s):typeof FormData<"u"&&s instanceof FormData?a=s:(l["Content-Type"]="application/json",a=JSON.stringify(s)));const u=yield this.fetch(`${this.url}/${t}`,{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),i),body:a}).catch(m=>{throw new uC(m)}),c=u.headers.get("x-relay-error");if(c&&c==="true")throw new cC(u);if(!u.ok)throw new dC(u);let d=((r=u.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),f;return d==="application/json"?f=yield u.json():d==="application/octet-stream"?f=yield u.blob():d==="multipart/form-data"?f=yield u.formData():f=yield u.text(),{data:f,error:null}}catch(i){return{data:null,error:i}}})}}var ku={exports:{}};(function(e,t){var n=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof ud<"u")return ud;throw new Error("unable to locate global object")},r=n();e.exports=t=r.fetch,r.fetch&&(t.default=r.fetch.bind(r)),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response})(ku,ku.exports);var Zc=ku.exports;const ed=$h(Zc),Xi=Th({__proto__:null,default:ed},[Zc]);class pC{constructor(t){this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=t.headers,this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=t.shouldThrowOnError,this.signal=t.signal,this.isMaybeSingle=t.isMaybeSingle,t.fetch?this.fetch=t.fetch:typeof fetch>"u"?this.fetch=ed:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(t,n){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");const r=this.fetch;let i=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{var s,l,a;let u=null,c=null,d=null,f=o.status,m=o.statusText;if(o.ok){if(this.method!=="HEAD"){const h=await o.text();h===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?c=h:c=JSON.parse(h))}const v=(s=this.headers.Prefer)===null||s===void 0?void 0:s.match(/count=(exact|planned|estimated)/),w=(l=o.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");v&&w&&w.length>1&&(d=parseInt(w[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(c)&&(c.length>1?(u={code:"PGRST116",details:`Results contain ${c.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},c=null,d=null,f=406,m="Not Acceptable"):c.length===1?c=c[0]:c=null)}else{const v=await o.text();try{u=JSON.parse(v),Array.isArray(u)&&o.status===404&&(c=[],u=null,f=200,m="OK")}catch{o.status===404&&v===""?(f=204,m="No Content"):u={message:v}}if(u&&this.isMaybeSingle&&(!((a=u==null?void 0:u.details)===null||a===void 0)&&a.includes("0 rows"))&&(u=null,f=200,m="OK"),u&&this.shouldThrowOnError)throw u}return{error:u,data:c,count:d,status:f,statusText:m}});return this.shouldThrowOnError||(i=i.catch(o=>{var s,l,a;return{error:{message:`${(s=o==null?void 0:o.name)!==null&&s!==void 0?s:"FetchError"}: ${o==null?void 0:o.message}`,details:`${(l=o==null?void 0:o.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(a=o==null?void 0:o.code)!==null&&a!==void 0?a:""}`},data:null,count:null,status:0,statusText:""}})),i.then(t,n)}}class mC extends pC{select(t){let n=!1;const r=(t??"*").split("").map(i=>/\s/.test(i)&&!n?"":(i==='"'&&(n=!n),i)).join("");return this.url.searchParams.set("select",r),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(t,{ascending:n=!0,nullsFirst:r,foreignTable:i}={}){const o=i?`${i}.order`:"order",s=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${s?`${s},`:""}${t}.${n?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:n}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${t}`),this}range(t,n,{foreignTable:r}={}){const i=typeof r>"u"?"offset":`${r}.offset`,o=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(o,`${n-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:t=!1,verbose:n=!1,settings:r=!1,buffers:i=!1,wal:o=!1,format:s="text"}={}){const l=[t?"analyze":null,n?"verbose":null,r?"settings":null,i?"buffers":null,o?"wal":null].filter(Boolean).join("|"),a=this.headers.Accept;return this.headers.Accept=`application/vnd.pgrst.plan+${s}; for="${a}"; options=${l};`,s==="json"?this:this}rollback(){var t;return((t=this.headers.Prefer)!==null&&t!==void 0?t:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}class tr extends mC{eq(t,n){return this.url.searchParams.append(t,`eq.${n}`),this}neq(t,n){return this.url.searchParams.append(t,`neq.${n}`),this}gt(t,n){return this.url.searchParams.append(t,`gt.${n}`),this}gte(t,n){return this.url.searchParams.append(t,`gte.${n}`),this}lt(t,n){return this.url.searchParams.append(t,`lt.${n}`),this}lte(t,n){return this.url.searchParams.append(t,`lte.${n}`),this}like(t,n){return this.url.searchParams.append(t,`like.${n}`),this}likeAllOf(t,n){return this.url.searchParams.append(t,`like(all).{${n.join(",")}}`),this}likeAnyOf(t,n){return this.url.searchParams.append(t,`like(any).{${n.join(",")}}`),this}ilike(t,n){return this.url.searchParams.append(t,`ilike.${n}`),this}ilikeAllOf(t,n){return this.url.searchParams.append(t,`ilike(all).{${n.join(",")}}`),this}ilikeAnyOf(t,n){return this.url.searchParams.append(t,`ilike(any).{${n.join(",")}}`),this}is(t,n){return this.url.searchParams.append(t,`is.${n}`),this}in(t,n){const r=n.map(i=>typeof i=="string"&&new RegExp("[,()]").test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}contains(t,n){return typeof n=="string"?this.url.searchParams.append(t,`cs.${n}`):Array.isArray(n)?this.url.searchParams.append(t,`cs.{${n.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(n)}`),this}containedBy(t,n){return typeof n=="string"?this.url.searchParams.append(t,`cd.${n}`):Array.isArray(n)?this.url.searchParams.append(t,`cd.{${n.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(n)}`),this}rangeGt(t,n){return this.url.searchParams.append(t,`sr.${n}`),this}rangeGte(t,n){return this.url.searchParams.append(t,`nxl.${n}`),this}rangeLt(t,n){return this.url.searchParams.append(t,`sl.${n}`),this}rangeLte(t,n){return this.url.searchParams.append(t,`nxr.${n}`),this}rangeAdjacent(t,n){return this.url.searchParams.append(t,`adj.${n}`),this}overlaps(t,n){return typeof n=="string"?this.url.searchParams.append(t,`ov.${n}`):this.url.searchParams.append(t,`ov.{${n.join(",")}}`),this}textSearch(t,n,{config:r,type:i}={}){let o="";i==="plain"?o="pl":i==="phrase"?o="ph":i==="websearch"&&(o="w");const s=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${o}fts${s}.${n}`),this}match(t){return Object.entries(t).forEach(([n,r])=>{this.url.searchParams.append(n,`eq.${r}`)}),this}not(t,n,r){return this.url.searchParams.append(t,`not.${n}.${r}`),this}or(t,{foreignTable:n}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${t})`),this}filter(t,n,r){return this.url.searchParams.append(t,`${n}.${r}`),this}}class vC{constructor(t,{headers:n={},schema:r,fetch:i}){this.url=t,this.headers=n,this.schema=r,this.fetch=i}select(t,{head:n=!1,count:r}={}){const i=n?"HEAD":"GET";let o=!1;const s=(t??"*").split("").map(l=>/\s/.test(l)&&!o?"":(l==='"'&&(o=!o),l)).join("");return this.url.searchParams.set("select",s),r&&(this.headers.Prefer=`count=${r}`),new tr({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(t,{count:n,defaultToNull:r=!0}={}){const i="POST",o=[];if(this.headers.Prefer&&o.push(this.headers.Prefer),n&&o.push(`count=${n}`),r||o.push("missing=default"),this.headers.Prefer=o.join(","),Array.isArray(t)){const s=t.reduce((l,a)=>l.concat(Object.keys(a)),[]);if(s.length>0){const l=[...new Set(s)].map(a=>`"${a}"`);this.url.searchParams.set("columns",l.join(","))}}return new tr({method:i,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:this.fetch,allowEmpty:!1})}upsert(t,{onConflict:n,ignoreDuplicates:r=!1,count:i,defaultToNull:o=!0}={}){const s="POST",l=[`resolution=${r?"ignore":"merge"}-duplicates`];if(n!==void 0&&this.url.searchParams.set("on_conflict",n),this.headers.Prefer&&l.push(this.headers.Prefer),i&&l.push(`count=${i}`),o||l.push("missing=default"),this.headers.Prefer=l.join(","),Array.isArray(t)){const a=t.reduce((u,c)=>u.concat(Object.keys(c)),[]);if(a.length>0){const u=[...new Set(a)].map(c=>`"${c}"`);this.url.searchParams.set("columns",u.join(","))}}return new tr({method:s,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:this.fetch,allowEmpty:!1})}update(t,{count:n}={}){const r="PATCH",i=[];return this.headers.Prefer&&i.push(this.headers.Prefer),n&&i.push(`count=${n}`),this.headers.Prefer=i.join(","),new tr({method:r,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:this.fetch,allowEmpty:!1})}delete({count:t}={}){const n="DELETE",r=[];return t&&r.push(`count=${t}`),this.headers.Prefer&&r.unshift(this.headers.Prefer),this.headers.Prefer=r.join(","),new tr({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}const gC="1.8.5",yC={"X-Client-Info":`postgrest-js/${gC}`};class td{constructor(t,{headers:n={},schema:r,fetch:i}={}){this.url=t,this.headers=Object.assign(Object.assign({},yC),n),this.schemaName=r,this.fetch=i}from(t){const n=new URL(`${this.url}/${t}`);return new vC(n,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new td(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,n={},{head:r=!1,count:i}={}){let o;const s=new URL(`${this.url}/rpc/${t}`);let l;r?(o="HEAD",Object.entries(n).forEach(([u,c])=>{s.searchParams.append(u,`${c}`)})):(o="POST",l=n);const a=Object.assign({},this.headers);return i&&(a.Prefer=`count=${i}`),new tr({method:o,url:s,headers:a,schema:this.schemaName,body:l,fetch:this.fetch,allowEmpty:!1})}}var dl,ph;function wC(){if(ph)return dl;ph=1;var e=function(){if(typeof self=="object"&&self)return self;if(typeof window=="object"&&window)return window;throw new Error("Unable to resolve global `this`")};return dl=function(){if(this)return this;if(typeof globalThis=="object"&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch{return e()}try{return __global__||e()}finally{delete Object.prototype.__global__}}(),dl}const SC="websocket",bC="Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",EC=["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],_C="Brian McKelvey (https://github.com/theturtle32)",CC=["Iñaki Baz Castillo (http://dev.sipdoc.net)"],xC="1.0.34",kC={type:"git",url:"https://github.com/theturtle32/WebSocket-Node.git"},OC="https://github.com/theturtle32/WebSocket-Node",PC={node:">=4.0.0"},TC={bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},$C={"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1",jshint:"^2.0.0",tape:"^4.9.1"},AC={verbose:!1},IC={test:"tape test/unit/*.js",gulp:"gulp"},RC="index",DC={lib:"./lib"},FC="lib/browser.js",jC="Apache-2.0",LC={name:SC,description:bC,keywords:EC,author:_C,contributors:CC,version:xC,repository:kC,homepage:OC,engines:PC,dependencies:TC,devDependencies:$C,config:AC,scripts:IC,main:RC,directories:DC,browser:FC,license:jC};var MC=LC.version,In;if(typeof globalThis=="object")In=globalThis;else try{In=wC()}catch{}finally{if(!In&&typeof window<"u"&&(In=window),!In)throw new Error("Could not determine global this")}var Vi=In.WebSocket||In.MozWebSocket,NC=MC;function og(e,t){var n;return t?n=new Vi(e,t):n=new Vi(e),n}Vi&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach(function(e){Object.defineProperty(og,e,{get:function(){return Vi[e]}})});var VC={w3cwebsocket:Vi?og:null,version:NC};const zC="2.8.4",UC={"X-Client-Info":`realtime-js/${zC}`},BC="1.0.0",sg=1e4,HC=1e3;var pi;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(pi||(pi={}));var He;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(He||(He={}));var pt;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(pt||(pt={}));var Ou;(function(e){e.websocket="websocket"})(Ou||(Ou={}));var Rn;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Rn||(Rn={}));class ag{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}class WC{constructor(){this.HEADER_LENGTH=1}decode(t,n){return t.constructor===ArrayBuffer?n(this._binaryDecode(t)):n(typeof t=="string"?JSON.parse(t):{})}_binaryDecode(t){const n=new DataView(t),r=new TextDecoder;return this._decodeBroadcast(t,n,r)}_decodeBroadcast(t,n,r){const i=n.getUint8(1),o=n.getUint8(2);let s=this.HEADER_LENGTH+2;const l=r.decode(t.slice(s,s+i));s=s+i;const a=r.decode(t.slice(s,s+o));s=s+o;const u=JSON.parse(r.decode(t.slice(s,t.byteLength)));return{ref:null,topic:l,event:a,payload:u}}}class fl{constructor(t,n,r={},i=sg){this.channel=t,this.event=n,this.payload=r,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var r;return this._hasReceived(t)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var mh;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(mh||(mh={}));class mi{constructor(t,n){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},i=>{const{onJoin:o,onLeave:s,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=mi.syncState(this.state,i,o,s),this.pendingDiffs.forEach(a=>{this.state=mi.syncDiff(this.state,a,o,s)}),this.pendingDiffs=[],l()}),this.channel._on(r.diff,{},i=>{const{onJoin:o,onLeave:s,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=mi.syncDiff(this.state,i,o,s),l())}),this.onJoin((i,o,s)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:o,newPresences:s})}),this.onLeave((i,o,s)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:o,leftPresences:s})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,r,i){const o=this.cloneDeep(t),s=this.transformState(n),l={},a={};return this.map(o,(u,c)=>{s[u]||(a[u]=c)}),this.map(s,(u,c)=>{const d=o[u];if(d){const f=c.map(w=>w.presence_ref),m=d.map(w=>w.presence_ref),g=c.filter(w=>m.indexOf(w.presence_ref)<0),v=d.filter(w=>f.indexOf(w.presence_ref)<0);g.length>0&&(l[u]=g),v.length>0&&(a[u]=v)}else l[u]=c}),this.syncDiff(o,{joins:l,leaves:a},r,i)}static syncDiff(t,n,r,i){const{joins:o,leaves:s}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),i||(i=()=>{}),this.map(o,(l,a)=>{var u;const c=(u=t[l])!==null&&u!==void 0?u:[];if(t[l]=this.cloneDeep(a),c.length>0){const d=t[l].map(m=>m.presence_ref),f=c.filter(m=>d.indexOf(m.presence_ref)<0);t[l].unshift(...f)}r(l,c,a)}),this.map(s,(l,a)=>{let u=t[l];if(!u)return;const c=a.map(d=>d.presence_ref);u=u.filter(d=>c.indexOf(d.presence_ref)<0),t[l]=u,i(l,u,a),u.length===0&&delete t[l]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const i=t[r];return"metas"in i?n[r]=i.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[r]=i,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Q;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(Q||(Q={}));const vh=(e,t,n={})=>{var r;const i=(r=n.skipTypes)!==null&&r!==void 0?r:[];return Object.keys(t).reduce((o,s)=>(o[s]=KC(s,e,t,i),o),{})},KC=(e,t,n,r)=>{const i=t.find(l=>l.name===e),o=i==null?void 0:i.type,s=n[e];return o&&!r.includes(o)?lg(o,s):Pu(s)},lg=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return JC(t,n)}switch(e){case Q.bool:return GC(t);case Q.float4:case Q.float8:case Q.int2:case Q.int4:case Q.int8:case Q.numeric:case Q.oid:return qC(t);case Q.json:case Q.jsonb:return QC(t);case Q.timestamp:return YC(t);case Q.abstime:case Q.date:case Q.daterange:case Q.int4range:case Q.int8range:case Q.money:case Q.reltime:case Q.text:case Q.time:case Q.timestamptz:case Q.timetz:case Q.tsrange:case Q.tstzrange:return Pu(t);default:return Pu(t)}},Pu=e=>e,GC=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},qC=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},QC=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},JC=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let o;const s=e.slice(1,n);try{o=JSON.parse("["+s+"]")}catch{o=s?s.split(","):[]}return o.map(l=>lg(t,l))}return e},YC=e=>typeof e=="string"?e.replace(" ","T"):e;var gh;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(gh||(gh={}));var yh;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes"})(yh||(yh={}));var wh;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(wh||(wh={}));class nd{constructor(t,n={config:{}},r){this.topic=t,this.params=n,this.socket=r,this.bindings={},this.state=He.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""}},n.config),this.timeout=this.socket.timeout,this.joinPush=new fl(this,pt.join,this.params,this.timeout),this.rejoinTimer=new ag(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=He.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>i.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=He.closed,this.socket._remove(this)}),this._onError(i=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,i),this.state=He.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=He.errored,this.rejoinTimer.scheduleTimeout())}),this._on(pt.reply,{},(i,o)=>{this._trigger(this._replyEventName(o),i)}),this.presence=new mi(this),this.broadcastEndpointURL=this._broadcastEndpointURL()}subscribe(t,n=this.timeout){var r,i;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const{config:{broadcast:o,presence:s}}=this.params;this._onError(u=>t&&t("CHANNEL_ERROR",u)),this._onClose(()=>t&&t("CLOSED"));const l={},a={broadcast:o,presence:s,postgres_changes:(i=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(u=>u.filter))!==null&&i!==void 0?i:[]};this.socket.accessToken&&(l.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:a},l)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",({postgres_changes:u})=>{var c;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),u===void 0){t&&t("SUBSCRIBED");return}else{const d=this.bindings.postgres_changes,f=(c=d==null?void 0:d.length)!==null&&c!==void 0?c:0,m=[];for(let g=0;g{t&&t("CHANNEL_ERROR",new Error(JSON.stringify(Object.values(u).join(", ")||"error")))}).receive("timeout",()=>{t&&t("TIMED_OUT")})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){return this._on(t,n,r)}async send(t,n={}){var r,i;if(!this._canPush()&&t.type==="broadcast"){const{event:o,payload:s}=t,l={method:"POST",headers:{apikey:(r=this.socket.accessToken)!==null&&r!==void 0?r:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:s}]})};try{return(await this._fetchWithTimeout(this.broadcastEndpointURL,l,(i=n.timeout)!==null&&i!==void 0?i:this.timeout)).ok?"ok":"error"}catch(a){return a.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var s,l,a;const u=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((a=(l=(s=this.params)===null||s===void 0?void 0:s.config)===null||l===void 0?void 0:l.broadcast)===null||a===void 0)&&a.ack)&&o("ok"),u.receive("ok",()=>o("ok")),u.receive("timeout",()=>o("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=He.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(pt.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(r=>{const i=new fl(this,pt.leave,{},t);i.receive("ok",()=>{n(),r("ok")}).receive("timeout",()=>{n(),r("timed out")}).receive("error",()=>{r("error")}),i.send(),this._canPush()||i.trigger("ok",{})})}_broadcastEndpointURL(){let t=this.socket.endPoint;return t=t.replace(/^ws/i,"http"),t=t.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),t.replace(/\/+$/,"")+"/api/broadcast"}async _fetchWithTimeout(t,n,r){const i=new AbortController,o=setTimeout(()=>i.abort(),r),s=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(o),s}_push(t,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new fl(this,t,n,r);return this._canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}_onMessage(t,n,r){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,r){var i,o;const s=t.toLocaleLowerCase(),{close:l,error:a,leave:u,join:c}=pt;if(r&&[l,a,u,c].indexOf(s)>=0&&r!==this._joinRef())return;let f=this._onMessage(s,n,r);if(n&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(s)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(m=>{var g,v,w;return((g=m.filter)===null||g===void 0?void 0:g.event)==="*"||((w=(v=m.filter)===null||v===void 0?void 0:v.event)===null||w===void 0?void 0:w.toLocaleLowerCase())===s}).map(m=>m.callback(f,r)):(o=this.bindings[s])===null||o===void 0||o.filter(m=>{var g,v,w,h,p,y;if(["broadcast","presence","postgres_changes"].includes(s))if("id"in m){const S=m.id,E=(g=m.filter)===null||g===void 0?void 0:g.event;return S&&((v=n.ids)===null||v===void 0?void 0:v.includes(S))&&(E==="*"||(E==null?void 0:E.toLocaleLowerCase())===((w=n.data)===null||w===void 0?void 0:w.type.toLocaleLowerCase()))}else{const S=(p=(h=m==null?void 0:m.filter)===null||h===void 0?void 0:h.event)===null||p===void 0?void 0:p.toLocaleLowerCase();return S==="*"||S===((y=n==null?void 0:n.event)===null||y===void 0?void 0:y.toLocaleLowerCase())}else return m.type.toLocaleLowerCase()===s}).map(m=>{if(typeof f=="object"&&"ids"in f){const g=f.data,{schema:v,table:w,commit_timestamp:h,type:p,errors:y}=g;f=Object.assign(Object.assign({},{schema:v,table:w,commit_timestamp:h,eventType:p,new:{},old:{},errors:y}),this._getPayloadRecords(g))}m.callback(f,r)})}_isClosed(){return this.state===He.closed}_isJoined(){return this.state===He.joined}_isJoining(){return this.state===He.joining}_isLeaving(){return this.state===He.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,r){const i=t.toLocaleLowerCase(),o={type:i,filter:n,callback:r};return this.bindings[i]?this.bindings[i].push(o):this.bindings[i]=[o],this}_off(t,n){const r=t.toLocaleLowerCase();return this.bindings[r]=this.bindings[r].filter(i=>{var o;return!(((o=i.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===r&&nd.isEqual(i.filter,n))}),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const r in t)if(t[r]!==n[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(pt.close,{},t)}_onError(t){this._on(pt.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=He.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=vh(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=vh(t.columns,t.old_record)),n}}const XC=()=>{};class ZC{constructor(t,n){var r;this.accessToken=null,this.channels=[],this.endPoint="",this.headers=UC,this.params={},this.timeout=sg,this.transport=VC.w3cwebsocket,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=XC,this.conn=null,this.sendBuffer=[],this.serializer=new WC,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=o=>{let s;return o?s=o:typeof fetch>"u"?s=(...l)=>Yi(()=>Promise.resolve().then(()=>Xi),void 0).then(({default:a})=>a(...l)):s=fetch,(...l)=>s(...l)},this.endPoint=`${t}/${Ou.websocket}`,n!=null&&n.params&&(this.params=n.params),n!=null&&n.headers&&(this.headers=Object.assign(Object.assign({},this.headers),n.headers)),n!=null&&n.timeout&&(this.timeout=n.timeout),n!=null&&n.logger&&(this.logger=n.logger),n!=null&&n.transport&&(this.transport=n.transport),n!=null&&n.heartbeatIntervalMs&&(this.heartbeatIntervalMs=n.heartbeatIntervalMs);const i=(r=n==null?void 0:n.params)===null||r===void 0?void 0:r.apikey;i&&(this.accessToken=i),this.reconnectAfterMs=n!=null&&n.reconnectAfterMs?n.reconnectAfterMs:o=>[1e3,2e3,5e3,1e4][o-1]||1e4,this.encode=n!=null&&n.encode?n.encode:(o,s)=>s(JSON.stringify(o)),this.decode=n!=null&&n.decode?n.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new ag(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){this.conn||(this.conn=new this.transport(this._endPointURL(),[],null,this.headers),this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t)))}disconnect(t,n){this.conn&&(this.conn.onclose=function(){},t?this.conn.close(t,n??""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.disconnect(),t}log(t,n,r){this.logger(t,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case pi.connecting:return Rn.Connecting;case pi.open:return Rn.Open;case pi.closing:return Rn.Closing;default:return Rn.Closed}}isConnected(){return this.connectionState()===Rn.Open}channel(t,n={config:{}}){const r=new nd(`realtime:${t}`,n,this);return this.channels.push(r),r}push(t){const{topic:n,event:r,payload:i,ref:o}=t,s=()=>{this.encode(t,l=>{var a;(a=this.conn)===null||a===void 0||a.send(l)})};this.log("push",`${n} ${r} (${o})`,i),this.isConnected()?s():this.sendBuffer.push(s)}setAuth(t){this.accessToken=t,this.channels.forEach(n=>{t&&n.updateJoinPayload({access_token:t}),n.joinedOnce&&n._isJoined()&&n._push(pt.access_token,{access_token:t})})}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let n=this.channels.find(r=>r.topic===t&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n._joinRef()!==t._joinRef())}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:BC}))}_onConnMessage(t){this.decode(t.data,n=>{let{topic:r,event:i,payload:o,ref:s}=n;(s&&s===this.pendingHeartbeatRef||i===(o==null?void 0:o.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${o.status||""} ${r} ${i} ${s&&"("+s+")"||""}`,o),this.channels.filter(l=>l._isMember(r)).forEach(l=>l._trigger(i,o,s)),this.stateChangeCallbacks.message.forEach(l=>l(n))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(t=>t())}_onConnClose(t){this.log("transport","close",t),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(n=>n(t))}_onConnError(t){this.log("transport",t.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(n=>n(t))}_triggerChanError(){this.channels.forEach(t=>t._trigger(pt.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const r=t.match(/\?/)?"&":"?",i=new URLSearchParams(n);return`${t}${r}${i}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_sendHeartbeat(){var t;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(t=this.conn)===null||t===void 0||t.close(HC,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class rd extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function Pe(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class ex extends rd{constructor(t,n){super(t),this.name="StorageApiError",this.status=n}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class Sh extends rd{constructor(t,n){super(t),this.name="StorageUnknownError",this.originalError=n}}var tx=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};const ug=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Yi(()=>Promise.resolve().then(()=>Xi),void 0).then(({default:r})=>r(...n)):t=fetch,(...n)=>t(...n)},nx=()=>tx(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Yi(()=>Promise.resolve().then(()=>Xi),void 0)).Response:Response});var Mr=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};const hl=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),rx=(e,t)=>Mr(void 0,void 0,void 0,function*(){const n=yield nx();e instanceof n?e.json().then(r=>{t(new ex(hl(r),e.status||500))}).catch(r=>{t(new Sh(hl(r),r))}):t(new Sh(hl(e),e))}),ix=(e,t,n,r)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),n))};function Sa(e,t,n,r,i,o){return Mr(this,void 0,void 0,function*(){return new Promise((s,l)=>{e(n,ix(t,r,i,o)).then(a=>{if(!a.ok)throw a;return r!=null&&r.noResolveJson?a:a.json()}).then(a=>s(a)).catch(a=>rx(a,l))})})}function Tu(e,t,n,r){return Mr(this,void 0,void 0,function*(){return Sa(e,"GET",t,n,r)})}function Yt(e,t,n,r,i){return Mr(this,void 0,void 0,function*(){return Sa(e,"POST",t,r,i,n)})}function ox(e,t,n,r,i){return Mr(this,void 0,void 0,function*(){return Sa(e,"PUT",t,r,i,n)})}function cg(e,t,n,r,i){return Mr(this,void 0,void 0,function*(){return Sa(e,"DELETE",t,r,i,n)})}var rt=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};const sx={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},bh={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ax{constructor(t,n={},r,i){this.url=t,this.headers=n,this.bucketId=r,this.fetch=ug(i)}uploadOrUpdate(t,n,r,i){return rt(this,void 0,void 0,function*(){try{let o;const s=Object.assign(Object.assign({},bh),i),l=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(s.upsert)});typeof Blob<"u"&&r instanceof Blob?(o=new FormData,o.append("cacheControl",s.cacheControl),o.append("",r)):typeof FormData<"u"&&r instanceof FormData?(o=r,o.append("cacheControl",s.cacheControl)):(o=r,l["cache-control"]=`max-age=${s.cacheControl}`,l["content-type"]=s.contentType);const a=this._removeEmptyFolders(n),u=this._getFinalPath(a),c=yield this.fetch(`${this.url}/object/${u}`,Object.assign({method:t,body:o,headers:l},s!=null&&s.duplex?{duplex:s.duplex}:{}));return c.ok?{data:{path:a},error:null}:{data:null,error:yield c.json()}}catch(o){if(Pe(o))return{data:null,error:o};throw o}})}upload(t,n,r){return rt(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,n,r)})}uploadToSignedUrl(t,n,r,i){return rt(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(t),s=this._getFinalPath(o),l=new URL(this.url+`/object/upload/sign/${s}`);l.searchParams.set("token",n);try{let a;const u=Object.assign({upsert:bh.upsert},i),c=Object.assign(Object.assign({},this.headers),{"x-upsert":String(u.upsert)});typeof Blob<"u"&&r instanceof Blob?(a=new FormData,a.append("cacheControl",u.cacheControl),a.append("",r)):typeof FormData<"u"&&r instanceof FormData?(a=r,a.append("cacheControl",u.cacheControl)):(a=r,c["cache-control"]=`max-age=${u.cacheControl}`,c["content-type"]=u.contentType);const d=yield this.fetch(l.toString(),{method:"PUT",body:a,headers:c});return d.ok?{data:{path:o},error:null}:{data:null,error:yield d.json()}}catch(a){if(Pe(a))return{data:null,error:a};throw a}})}createSignedUploadUrl(t){return rt(this,void 0,void 0,function*(){try{let n=this._getFinalPath(t);const r=yield Yt(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:this.headers}),i=new URL(this.url+r.url),o=i.searchParams.get("token");if(!o)throw new rd("No token returned by API");return{data:{signedUrl:i.toString(),path:t,token:o},error:null}}catch(n){if(Pe(n))return{data:null,error:n};throw n}})}update(t,n,r){return rt(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,n,r)})}move(t,n){return rt(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n},{headers:this.headers}),error:null}}catch(r){if(Pe(r))return{data:null,error:r};throw r}})}copy(t,n){return rt(this,void 0,void 0,function*(){try{return{data:{path:(yield Yt(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n},{headers:this.headers})).Key},error:null}}catch(r){if(Pe(r))return{data:null,error:r};throw r}})}createSignedUrl(t,n,r){return rt(this,void 0,void 0,function*(){try{let i=this._getFinalPath(t),o=yield Yt(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:n},r!=null&&r.transform?{transform:r.transform}:{}),{headers:this.headers});const s=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${s}`)},{data:o,error:null}}catch(i){if(Pe(i))return{data:null,error:i};throw i}})}createSignedUrls(t,n,r){return rt(this,void 0,void 0,function*(){try{const i=yield Yt(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:t},{headers:this.headers}),o=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return{data:i.map(s=>Object.assign(Object.assign({},s),{signedUrl:s.signedURL?encodeURI(`${this.url}${s.signedURL}${o}`):null})),error:null}}catch(i){if(Pe(i))return{data:null,error:i};throw i}})}download(t,n){return rt(this,void 0,void 0,function*(){const i=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),s=o?`?${o}`:"";try{const l=this._getFinalPath(t);return{data:yield(yield Tu(this.fetch,`${this.url}/${i}/${l}${s}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(l){if(Pe(l))return{data:null,error:l};throw l}})}getPublicUrl(t,n){const r=this._getFinalPath(t),i=[],o=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";o!==""&&i.push(o);const l=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",a=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});a!==""&&i.push(a);let u=i.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${r}${u}`)}}}remove(t){return rt(this,void 0,void 0,function*(){try{return{data:yield cg(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(n){if(Pe(n))return{data:null,error:n};throw n}})}list(t,n,r){return rt(this,void 0,void 0,function*(){try{const i=Object.assign(Object.assign(Object.assign({},sx),n),{prefix:t||""});return{data:yield Yt(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},r),error:null}}catch(i){if(Pe(i))return{data:null,error:i};throw i}})}_getFinalPath(t){return`${this.bucketId}/${t}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const n=[];return t.width&&n.push(`width=${t.width}`),t.height&&n.push(`height=${t.height}`),t.resize&&n.push(`resize=${t.resize}`),t.format&&n.push(`format=${t.format}`),t.quality&&n.push(`quality=${t.quality}`),n.join("&")}}const lx="2.5.4",ux={"X-Client-Info":`storage-js/${lx}`};var Yn=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};class cx{constructor(t,n={},r){this.url=t,this.headers=Object.assign(Object.assign({},ux),n),this.fetch=ug(r)}listBuckets(){return Yn(this,void 0,void 0,function*(){try{return{data:yield Tu(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(t){if(Pe(t))return{data:null,error:t};throw t}})}getBucket(t){return Yn(this,void 0,void 0,function*(){try{return{data:yield Tu(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(n){if(Pe(n))return{data:null,error:n};throw n}})}createBucket(t,n={public:!1}){return Yn(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/bucket`,{id:t,name:t,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(Pe(r))return{data:null,error:r};throw r}})}updateBucket(t,n){return Yn(this,void 0,void 0,function*(){try{return{data:yield ox(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(Pe(r))return{data:null,error:r};throw r}})}emptyBucket(t){return Yn(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(Pe(n))return{data:null,error:n};throw n}})}deleteBucket(t){return Yn(this,void 0,void 0,function*(){try{return{data:yield cg(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(Pe(n))return{data:null,error:n};throw n}})}}class dx extends cx{constructor(t,n={},r){super(t,n,r)}from(t){return new ax(this.url,this.headers,t,this.fetch)}}const fx="2.38.4";let ri="";typeof Deno<"u"?ri="deno":typeof document<"u"?ri="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ri="react-native":ri="node";const hx={"X-Client-Info":`supabase-js-${ri}/${fx}`};var px=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};const mx=e=>{let t;return e?t=e:typeof fetch>"u"?t=ed:t=fetch,(...n)=>t(...n)},vx=()=>typeof Headers>"u"?Zc.Headers:Headers,gx=(e,t,n)=>{const r=mx(n),i=vx();return(o,s)=>px(void 0,void 0,void 0,function*(){var l;const a=(l=yield t())!==null&&l!==void 0?l:e;let u=new i(s==null?void 0:s.headers);return u.has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization",`Bearer ${a}`),r(o,Object.assign(Object.assign({},s),{headers:u}))})};function yx(e){return e.replace(/\/$/,"")}function wx(e,t){const{db:n,auth:r,realtime:i,global:o}=e,{db:s,auth:l,realtime:a,global:u}=t;return{db:Object.assign(Object.assign({},s),n),auth:Object.assign(Object.assign({},l),r),realtime:Object.assign(Object.assign({},a),i),global:Object.assign(Object.assign({},u),o)}}function Sx(e){return Math.round(Date.now()/1e3)+e}function bx(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}const It=()=>typeof document<"u",On={tested:!1,writable:!1},vi=()=>{if(!It())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(On.tested)return On.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),On.tested=!0,On.writable=!0}catch{On.tested=!0,On.writable=!1}return On.writable};function pl(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,o)=>{t[o]=i})}catch{}return n.searchParams.forEach((r,i)=>{t[i]=r}),t}const dg=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Yi(()=>Promise.resolve().then(()=>Xi),void 0).then(({default:r})=>r(...n)):t=fetch,(...n)=>t(...n)},Ex=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Pn=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},Co=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},ml=async(e,t)=>{await e.removeItem(t)};function _x(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let n="",r,i,o,s,l,a,u,c=0;for(e=e.replace("-","+").replace("_","/");c>4,i=(l&15)<<4|a>>2,o=(a&3)<<6|u,n=n+String.fromCharCode(r),a!=64&&i!=0&&(n=n+String.fromCharCode(i)),u!=64&&o!=0&&(n=n+String.fromCharCode(o));return n}class ba{constructor(){this.promise=new ba.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}ba.promiseConstructor=Promise;function Eh(e){const t=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,n=e.split(".");if(n.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!t.test(n[1]))throw new Error("JWT is not valid: payload is not in base64url format");const r=n[1];return JSON.parse(_x(r))}async function Cx(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function xx(e,t){return new Promise((r,i)=>{(async()=>{for(let o=0;o<1/0;o++)try{const s=await e(o);if(!t(o,null,s)){r(s);return}}catch(s){if(!t(o,s)){i(s);return}}})()})}function kx(e){return("0"+e.toString(16)).substr(-2)}function Xn(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let i="";for(let o=0;o<56;o++)i+=n.charAt(Math.floor(Math.random()*r));return i}return crypto.getRandomValues(t),Array.from(t,kx).join("")}async function Ox(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(r);return Array.from(i).map(o=>String.fromCharCode(o)).join("")}function Px(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Zn(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await Ox(e);return Px(n)}class id extends Error{constructor(t,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n}}function N(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Tx extends id{constructor(t,n){super(t,n),this.name="AuthApiError",this.status=n}toJSON(){return{name:this.name,message:this.message,status:this.status}}}function $x(e){return N(e)&&e.name==="AuthApiError"}class fg extends id{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Nr extends id{constructor(t,n,r){super(t),this.name=n,this.status=r}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class er extends Nr{constructor(){super("Auth session missing!","AuthSessionMissingError",400)}}class vl extends Nr{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500)}}class xo extends Nr{constructor(t){super(t,"AuthInvalidCredentialsError",400)}}class ko extends Nr{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class _h extends Nr{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class $u extends Nr{constructor(t,n){super(t,"AuthRetryableFetchError",n)}}function Ch(e){return N(e)&&e.name==="AuthRetryableFetchError"}var Ax=globalThis&&globalThis.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);ie.msg||e.message||e.error_description||e.error||JSON.stringify(e),Ix=[502,503,504];async function xh(e){if(!Ex(e))throw new $u(ii(e),0);if(Ix.includes(e.status))throw new $u(ii(e),e.status);let t;try{t=await e.json()}catch(n){throw new fg(ii(n),n)}throw new Tx(ii(t),e.status||500)}const Rx=(e,t,n,r)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),n))};async function U(e,t,n,r){var i;const o=Object.assign({},r==null?void 0:r.headers);r!=null&&r.jwt&&(o.Authorization=`Bearer ${r.jwt}`);const s=(i=r==null?void 0:r.query)!==null&&i!==void 0?i:{};r!=null&&r.redirectTo&&(s.redirect_to=r.redirectTo);const l=Object.keys(s).length?"?"+new URLSearchParams(s).toString():"",a=await Dx(e,t,n+l,{headers:o,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(a):{data:Object.assign({},a),error:null}}async function Dx(e,t,n,r,i,o){const s=Rx(t,r,i,o);let l;try{l=await e(n,s)}catch(a){throw console.error(a),new $u(ii(a),0)}if(l.ok||await xh(l),r!=null&&r.noResolveJson)return l;try{return await l.json()}catch(a){await xh(a)}}function qt(e){var t;let n=null;Mx(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=Sx(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function nn(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Fx(e){return{data:e,error:null}}function jx(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:i,verification_type:o}=e,s=Ax(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:n,hashed_token:r,redirect_to:i,verification_type:o},a=Object.assign({},s);return{data:{properties:l,user:a},error:null}}function Lx(e){return e}function Mx(e){return e.access_token&&e.refresh_token&&e.expires_in}var Nx=globalThis&&globalThis.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i0&&(m.forEach(g=>{const v=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(g.split(";")[1].split("=")[1]);u[`${w}Page`]=v}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},d),u),error:null}}catch(u){if(N(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){try{return await U(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:nn})}catch(n){if(N(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){try{return await U(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:nn})}catch(r){if(N(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){try{return await U(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:nn})}catch(r){if(N(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){try{const{data:n,error:r}=await U(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:r}}catch(n){if(N(n))return{data:null,error:n};throw n}}async _deleteFactor(t){try{return{data:await U(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(N(n))return{data:null,error:n};throw n}}}const hg="2.57.0",zx="http://localhost:9999",Ux="supabase.auth.token",Bx={"X-Client-Info":`gotrue-js/${hg}`},kh=10,Hx={getItem:e=>vi()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{vi()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{vi()&&globalThis.localStorage.removeItem(e)}};function Oh(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}function Wx(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}globalThis&&vi()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class Kx extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}Wx();const Gx={url:zx,storageKey:Ux,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Bx,flowType:"implicit",debug:!1},Jr=30*1e3,Ph=3;async function qx(e,t,n){return await n()}class zi{constructor(t){var n;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=zi.nextInstanceID,zi.nextInstanceID+=1,this.instanceID>0&&It()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const r=Object.assign(Object.assign({},Gx),t);if(this.logDebugMessages=!!r.debug,typeof r.debug=="function"&&(this.logger=r.debug),this.persistSession=r.persistSession,this.storageKey=r.storageKey,this.autoRefreshToken=r.autoRefreshToken,this.admin=new Vx({url:r.url,headers:r.headers,fetch:r.fetch}),this.url=r.url,this.headers=r.headers,this.fetch=dg(r.fetch),this.lock=r.lock||qx,this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?r.storage?this.storage=r.storage:vi()?this.storage=Hx:(this.memoryStorage={},this.storage=Oh(this.memoryStorage)):(this.memoryStorage={},this.storage=Oh(this.memoryStorage)),It()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${hg}) ${new Date().toISOString()}`,...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){try{const t=It()?await this._isPKCEFlow():!1;if(this._debug("#_initialize()","begin","is PKCE flow",t),t||this.detectSessionInUrl&&this._isImplicitGrantFlow()){const{data:n,error:r}=await this._getSessionFromURL(t);if(r)return this._debug("#_initialize()","error detecting session from URL",r),await this._removeSession(),{error:r};const{session:i,redirectType:o}=n;return this._debug("#_initialize()","detected session in URL",i,"redirect type",o),await this._saveSession(i),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return N(t)?{error:t}:{error:new fg("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signUp(t){var n,r,i;try{await this._removeSession();let o;if("email"in t){const{email:c,password:d,options:f}=t;let m=null,g=null;if(this.flowType==="pkce"){const v=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,v),m=await Zn(v),g=v===m?"plain":"s256"}o=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:c,password:d,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:m,code_challenge_method:g},xform:qt})}else if("phone"in t){const{phone:c,password:d,options:f}=t;o=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:c,password:d,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},channel:(i=f==null?void 0:f.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:qt})}else throw new xo("You must provide either an email or phone number and a password");const{data:s,error:l}=o;if(l||!s)return{data:{user:null,session:null},error:l};const a=s.session,u=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:u,session:a},error:null}}catch(o){if(N(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(t){try{await this._removeSession();let n;if("email"in t){const{email:o,password:s,options:l}=t;n=await U(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:s,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:qt})}else if("phone"in t){const{phone:o,password:s,options:l}=t;n=await U(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:s,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:qt})}else throw new xo("You must provide either an email or phone number and a password");const{data:r,error:i}=n;return i?{data:{user:null,session:null},error:i}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new vl}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:{user:r.user,session:r.session},error:i})}catch(n){if(N(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(t){var n,r,i,o;return await this._removeSession(),await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(i=t.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(o=t.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async _exchangeCodeForSession(t){const n=await Co(this.storage,`${this.storageKey}-code-verifier`),{data:r,error:i}=await U(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:qt});return await ml(this.storage,`${this.storageKey}-code-verifier`),i?{data:{user:null,session:null},error:i}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new vl}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:r,error:i})}async signInWithIdToken(t){await this._removeSession();try{const{options:n,provider:r,token:i,access_token:o,nonce:s}=t,l=await U(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:i,access_token:o,nonce:s,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:qt}),{data:a,error:u}=l;return u?{data:{user:null,session:null},error:u}:!a||!a.session||!a.user?{data:{user:null,session:null},error:new vl}:(a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:a,error:u})}catch(n){if(N(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(t){var n,r,i,o,s;try{if(await this._removeSession(),"email"in t){const{email:l,options:a}=t;let u=null,c=null;if(this.flowType==="pkce"){const f=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,f),u=await Zn(f),c=f===u?"plain":"s256"}const{error:d}=await U(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(n=a==null?void 0:a.data)!==null&&n!==void 0?n:{},create_user:(r=a==null?void 0:a.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken},code_challenge:u,code_challenge_method:c},redirectTo:a==null?void 0:a.emailRedirectTo});return{data:{user:null,session:null},error:d}}if("phone"in t){const{phone:l,options:a}=t,{data:u,error:c}=await U(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(i=a==null?void 0:a.data)!==null&&i!==void 0?i:{},create_user:(o=a==null?void 0:a.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken},channel:(s=a==null?void 0:a.channel)!==null&&s!==void 0?s:"sms"}});return{data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:c}}throw new xo("You must provide either an email or phone number.")}catch(l){if(N(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(t){var n,r;try{t.type!=="email_change"&&t.type!=="phone_change"&&await this._removeSession();let i,o;"options"in t&&(i=(n=t.options)===null||n===void 0?void 0:n.redirectTo,o=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:s,error:l}=await U(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:o}}),redirectTo:i,xform:qt});if(l)throw l;if(!s)throw new Error("An error occurred on token verification.");const a=s.session,u=s.user;return a!=null&&a.access_token&&(await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:u,session:a},error:null}}catch(i){if(N(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithSSO(t){var n,r,i;try{await this._removeSession();let o=null,s=null;if(this.flowType==="pkce"){const l=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,l),o=await Zn(l),s=l===o?"plain":"s256"}return await U(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((i=t==null?void 0:t.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:s}),headers:this.headers,xform:Fx})}catch(o){if(N(o))return{data:null,error:o};throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new er;const{error:i}=await U(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:i}})}catch(t){if(N(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{t.type!="email_change"&&t.type!="phone_change"&&await this._removeSession();const n=`${this.url}/resend`;if("email"in t){const{email:r,type:i,options:o}=t,{error:s}=await U(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},redirectTo:o==null?void 0:o.emailRedirectTo});return{data:{user:null,session:null},error:s}}else if("phone"in t){const{phone:r,type:i,options:o}=t,{data:s,error:l}=await U(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return{data:{user:null,session:null,messageId:s==null?void 0:s.message_id},error:l}}throw new xo("You must provide either an email or phone number and a type")}catch(n){if(N(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,this._acquireLock(-1,async()=>this._useSession(async t=>t))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await Co(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r)return{data:{session:t},error:null};const{session:i,error:o}=await this._callRefreshToken(t.refresh_token);return o?{data:{session:null},error:o}:{data:{session:i},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(t){return t?await this._getUser(t):(await this.initializePromise,this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(t){try{return t?await U(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:nn}):await this._useSession(async n=>{var r,i;const{data:o,error:s}=n;if(s)throw s;return await U(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(r=o.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0,xform:nn})})}catch(n){if(N(n))return{data:{user:null},error:n};throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:i,error:o}=r;if(o)throw o;if(!i.session)throw new er;const s=i.session;let l=null,a=null;if(this.flowType==="pkce"&&t.email!=null){const d=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,d),l=await Zn(d),a=d===l?"plain":"s256"}const{data:u,error:c}=await U(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:a}),jwt:s.access_token,xform:nn});if(c)throw c;return s.user=u.user,await this._saveSession(s),await this._notifyAllSubscribers("USER_UPDATED",s),{data:{user:s.user},error:null}})}catch(r){if(N(r))return{data:{user:null},error:r};throw r}}_decodeJWT(t){return Eh(t)}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new er;const n=Date.now()/1e3;let r=n,i=!0,o=null;const s=Eh(t.access_token);if(s.exp&&(r=s.exp,i=r<=n),i){const{session:l,error:a}=await this._callRefreshToken(t.refresh_token);if(a)return{data:{user:null,session:null},error:a};if(!l)return{data:{user:null,session:null},error:null};o=l}else{const{data:l,error:a}=await this._getUser(t.access_token);if(a)throw a;o={access_token:t.access_token,refresh_token:t.refresh_token,user:l.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return{data:{user:o.user,session:o},error:null}}catch(n){if(N(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:s,error:l}=n;if(l)throw l;t=(r=s.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new er;const{session:i,error:o}=await this._callRefreshToken(t.refresh_token);return o?{data:{user:null,session:null},error:o}:i?{data:{user:i.user,session:i},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(N(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(t){try{if(!It())throw new ko("No browser detected.");if(this.flowType==="implicit"&&!this._isImplicitGrantFlow())throw new ko("Not a valid implicit grant flow url.");if(this.flowType=="pkce"&&!t)throw new _h("Not a valid PKCE flow url.");const n=pl(window.location.href);if(t){if(!n.code)throw new _h("No code detected.");const{data:p,error:y}=await this._exchangeCodeForSession(n.code);if(y)throw y;const S=new URL(window.location.href);return S.searchParams.delete("code"),window.history.replaceState(window.history.state,"",S.toString()),{data:{session:p.session,redirectType:null},error:null}}if(n.error||n.error_description||n.error_code)throw new ko(n.error_description||"Error in URL with unspecified error_description",{error:n.error||"unspecified_error",code:n.error_code||"unspecified_code"});const{provider_token:r,provider_refresh_token:i,access_token:o,refresh_token:s,expires_in:l,expires_at:a,token_type:u}=n;if(!o||!l||!s||!u)throw new ko("No session defined in URL");const c=Math.round(Date.now()/1e3),d=parseInt(l);let f=c+d;a&&(f=parseInt(a));const m=f-c;m*1e3<=Jr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${d}s`);const g=f-d;c-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,f,c):c-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",g,f,c);const{data:v,error:w}=await this._getUser(o);if(w)throw w;const h={provider_token:r,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:s,token_type:u,user:v.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:h,redirectType:n.type},error:null}}catch(n){if(N(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantFlow(){const t=pl(window.location.href);return!!(It()&&(t.access_token||t.error_description))}async _isPKCEFlow(){const t=pl(window.location.href),n=await Co(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:i,error:o}=n;if(o)return{error:o};const s=(r=i.session)===null||r===void 0?void 0:r.access_token;if(s){const{error:l}=await this.admin.signOut(s,t);if(l&&!($x(l)&&(l.status===404||l.status===401)))return{error:l}}return t!=="others"&&(await this._removeSession(),await ml(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(t){const n=bx(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,i;try{const{data:{session:o},error:s}=n;if(s)throw s;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",t,"session",o)}catch(o){await((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",o),console.error(o)}})}async resetPasswordForEmail(t,n={}){let r=null,i=null;if(this.flowType==="pkce"){const o=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,o),r=await Zn(o),i=o===r?"plain":"s256"}try{return await U(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(N(o))return{data:null,error:o};throw o}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await xx(async i=>(await Cx(i*200),this._debug(n,"refreshing attempt",i),await U(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:qt})),(i,o,s)=>s&&s.error&&Ch(s.error)&&Date.now()+(i+1)*200-r{try{await l.callback(t,n)}catch(a){o.push(a)}});if(await Promise.all(s),o.length>0){for(let l=0;lthis._autoRefreshTokenTick(),Jr);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((r.expires_at*1e3-t)/Jr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Jr}ms, refresh threshold is ${Ph} ticks`),i<=Ph&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof Kx)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!It()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n){const r=[`provider=${encodeURIComponent(t)}`];if(n!=null&&n.redirectTo&&r.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&r.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const i=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,i);const o=await Zn(i),s=i===o?"plain":"s256";this._debug("PKCE","code verifier",`${i.substring(0,5)}...`,"code challenge",o,"method",s);const l=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(s)}`});r.push(l.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);r.push(i.toString())}return`${this.url}/authorize?${r.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:i,error:o}=n;return o?{data:null,error:o}:await U(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(N(n))return{data:null,error:n};throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,i;const{data:o,error:s}=n;if(s)return{data:null,error:s};const{data:l,error:a}=await U(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:t.friendlyName,factor_type:t.factorType,issuer:t.issuer},headers:this.headers,jwt:(r=o==null?void 0:o.session)===null||r===void 0?void 0:r.access_token});return a?{data:null,error:a}:(!((i=l==null?void 0:l.totp)===null||i===void 0)&&i.qr_code&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),{data:l,error:null})})}catch(n){if(N(n))return{data:null,error:n};throw n}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:o}=n;if(o)return{data:null,error:o};const{data:s,error:l}=await U(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:{code:t.code,challenge_id:t.challengeId},headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+s.expires_in},s)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",s),{data:s,error:l})})}catch(n){if(N(n))return{data:null,error:n};throw n}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:o}=n;return o?{data:null,error:o}:await U(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(N(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?{data:null,error:r}:await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){const{data:{user:t},error:n}=await this.getUser();if(n)return{data:null,error:n};const r=(t==null?void 0:t.factors)||[],i=r.filter(o=>o.factor_type==="totp"&&o.status==="verified");return{data:{all:r,totp:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async t=>{var n,r;const{data:{session:i},error:o}=t;if(o)return{data:null,error:o};if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const s=this._decodeJWT(i.access_token);let l=null;s.aal&&(l=s.aal);let a=l;((r=(n=i.user.factors)===null||n===void 0?void 0:n.filter(d=>d.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(a="aal2");const c=s.amr||[];return{data:{currentLevel:l,nextLevel:a,currentAuthenticationMethods:c},error:null}}))}}zi.nextInstanceID=0;class Qx extends zi{constructor(t){super(t)}}var Jx=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};const Yx={headers:hx},Xx={schema:"public"},Zx={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},e2={};class t2{constructor(t,n,r){var i,o,s,l,a,u,c,d;if(this.supabaseUrl=t,this.supabaseKey=n,!t)throw new Error("supabaseUrl is required.");if(!n)throw new Error("supabaseKey is required.");const f=yx(t);this.realtimeUrl=`${f}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${f}/auth/v1`,this.storageUrl=`${f}/storage/v1`,this.functionsUrl=`${f}/functions/v1`;const m=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,g={db:Xx,realtime:e2,auth:Object.assign(Object.assign({},Zx),{storageKey:m}),global:Yx},v=wx(r??{},g);this.storageKey=(o=(i=v.auth)===null||i===void 0?void 0:i.storageKey)!==null&&o!==void 0?o:"",this.headers=(l=(s=v.global)===null||s===void 0?void 0:s.headers)!==null&&l!==void 0?l:{},this.auth=this._initSupabaseAuthClient((a=v.auth)!==null&&a!==void 0?a:{},this.headers,(u=v.global)===null||u===void 0?void 0:u.fetch),this.fetch=gx(n,this._getAccessToken.bind(this),(c=v.global)===null||c===void 0?void 0:c.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},v.realtime)),this.rest=new td(`${f}/rest/v1`,{headers:this.headers,schema:(d=v.db)===null||d===void 0?void 0:d.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new hC(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new dx(this.storageUrl,this.headers,this.fetch)}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,n={},r){return this.rest.rpc(t,n,r)}channel(t,n={config:{}}){return this.realtime.channel(t,n)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var t,n;return Jx(this,void 0,void 0,function*(){const{data:r}=yield this.auth.getSession();return(n=(t=r.session)===null||t===void 0?void 0:t.access_token)!==null&&n!==void 0?n:null})}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:n,detectSessionInUrl:r,storage:i,storageKey:o,flowType:s,debug:l},a,u){const c={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Qx({url:this.authUrl,headers:Object.assign(Object.assign({},c),a),storageKey:o,autoRefreshToken:t,persistSession:n,detectSessionInUrl:r,storage:i,flowType:s,debug:l,fetch:u})}_initRealtimeClient(t){return new ZC(this.realtimeUrl,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,r)=>{this._handleTokenChanged(n,"CLIENT",r==null?void 0:r.access_token)})}_handleTokenChanged(t,n,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.realtime.setAuth(r??null),this.changedAccessToken=r):t==="SIGNED_OUT"&&(this.realtime.setAuth(this.supabaseKey),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const n2=(e,t,n)=>new t2(e,t,n),r2="https://kyczonpiwdgrrfzzndtg.supabase.co",i2="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imt5Y3pvbnBpd2RncnJmenpuZHRnIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTE3NTUwNjUsImV4cCI6MjAwNzMzMTA2NX0.9WwSPA4ciXxd0xXIdYuUT3nXosBvH_Rm7IdO9mdl6_8",En=n2(r2,i2),gi=Ji("notes/getAsyncNotes",async(e,{rejectWithValue:t})=>{try{const{data:n}=await En.from("noteapp").select("*");return n}catch(n){return t(n.message)}}),Au=Ji("notes/addAsyncNotes",async(e,{rejectWithValue:t})=>{try{await En.from("noteapp").insert({title:e.title,description:e.description,category:e.category,completed:!1,date:Date.now()});const{data:n}=await En.from("noteapp").select("*");return n}catch(n){return t(n.message)}}),pg=Ji("notes/deleteAsyncNotes",async(e,{rejectWithValue:t})=>{try{return await En.from("noteapp").delete().eq("id",e.id),{id:e.id}}catch(n){return t(n.message)}}),mg=Ji("notes/toggleAsyncNote",async(e,{rejectWithValue:t})=>{try{await En.from("noteapp").update({completed:e.completed}).match({id:e.id});let{data:n}=await En.from("noteapp").select("*").eq("id",e.id);return n}catch(n){return t(n.message)}}),vg=Ji("notes/updateAsyncNote",async(e,{rejectWithValue:t})=>{try{await En.from("noteapp").update({title:e.title,description:e.description,category:e.category}).match({id:e.id});let{data:n}=await En.from("noteapp").select("*").eq("id",e.id);return console.log(n),n}catch(n){return t(n.message)}}),o2=Z_({name:"notes",initialState:{notes:[],loading:!1,error:""},extraReducers:{[gi.pending]:(e,t)=>{e.loading=!0,e.notes=[],e.error=""},[gi.fulfilled]:(e,t)=>{e.loading=!1,e.notes=t.payload},[gi.rejected]:(e,t)=>{e.loading=!1,e.error=t.payload,e.notes=[]},[Au.pending]:(e,t)=>{e.loading=!0},[Au.fulfilled]:(e,t)=>{e.loading=!1,e.notes=t.payload},[pg.fulfilled]:(e,t)=>{e.loading=!1,e.notes=e.notes.filter(n=>n.id!==t.payload.id)},[mg.fulfilled]:(e,t)=>{const n=e.notes.find(r=>r.id===t.payload[0].id);n.completed=t.payload[0].completed},[vg.fulfilled]:(e,t)=>{const n=e.notes.find(r=>r.id===t.payload[0].id);n.title=t.payload[0].title,n.description=t.payload[0].description,n.category=t.payload[0].category}}}),s2=o2.reducer,gg=b.createContext();function a2({children:e}){const[t,n]=b.useState("همه");return P.jsx(gg.Provider,{value:{selectedCat:t,setSelectedCat:n},children:e})}function Ea(){return b.useContext(gg)}function yg({isOpenModal:e,setIsOpenModal:t,editNote:n,setEditNote:r}){const[i,o]=b.useState(""),[s,l]=b.useState(""),[a,u]=b.useState(null),{loading:c}=Qi(v=>v.notes),d=Hc(),{setSelectedCat:f}=Ea();b.useEffect(()=>{o((n==null?void 0:n.title)||""),l((n==null?void 0:n.description)||""),n!=null&&n.title&&u({label:n==null?void 0:n.category})},[n]);const m=()=>{if(!i||!s||!a){Uo.error("پر کردن همه ی فیلدها الزامیست");return}d(Au({title:i,description:s,category:a.value})),o(""),l(""),u(null),f("همه"),setTimeout(()=>{Uo.success("یادداشت جدید اضافه شد")},1500)},g=()=>{d(vg({id:n.id,title:i,description:s,category:a==null?void 0:a.value})),t(!1),r(null),Uo.success("آپدیت انجام شد")};return e?P.jsxs("div",{children:[P.jsx("div",{onClick:()=>t(!1),className:"w-screen h-screen fixed inset-0 bg-purple-300 bg-opacity-80 duration-500"}),P.jsxs("div",{className:"bg-white z-20 rounded-md px-4 w-11/12 sm:w-3/5 min-h-[250px] -translate-x-1/2 -translate-y-1/2 absolute top-80 py-4 left-1/2 shadow-lg",children:[P.jsxs("div",{className:"mb-6",children:[P.jsx("h1",{className:"text-lg pb-2 text-slate-700 font-semibold",children:n?" تغییر دادن یادداشت":" اضافه کردن یادداشت"}),P.jsx("div",{className:"h-1 bg-purple-200 w-full"})]}),P.jsxs("div",{className:"grid grid-cols-9 gap-3",children:[P.jsx("input",{value:i,onChange:v=>o(v.target.value),className:"col-span-9 md:col-span-6 border border-[#d8b4fe] shadow-md p-2 outline-none text-primary bg-purple-100 rounded-md",type:"text",placeholder:"عنوان یادداشت..."}),P.jsx(LE,{selectedOption:a,setSelectedOption:u}),P.jsx("textarea",{value:s,onChange:v=>l(v.target.value),placeholder:"توضیحات...",className:"border border-[#d8b4fe] p-2 shadow-md outline-none col-span-9 md:col-span-6 h-56 bg-purple-100 rounded-md"})]}),P.jsxs("div",{className:"flex gap-4 mt-6 text-primary",children:[n?P.jsx("button",{disabled:c,onClick:g,className:` ${c?"opacity-50":"opacity-100"} px-4 py-1 shadow-md bg-purple-600 hover:bg-purple-500 text-white rounded-md`,children:"تغییر"}):P.jsx("button",{disabled:c,onClick:m,className:` ${c?"opacity-50":"opacity-100"} px-4 py-1 shadow-md bg-purple-600 hover:bg-purple-500 text-white rounded-md`,children:c?"در حال اضافه شدن":"اضافه"}),P.jsx("button",{onClick:()=>t(!1),className:"px-4 py-1 shadow-md text-primary border-2 border-red-400 hover:bg-red-400 rounded-md",children:"انصراف"})]})]})]}):null}const wg=b.createContext();function l2({children:e}){const[t,n]=b.useState(null),{notes:r}=Qi(o=>o.notes),i=Hc();return b.useEffect(()=>{i(gi())},[]),b.useEffect(()=>{n(r.filter(o=>o.category!=="همه"))},[r]),P.jsx(wg.Provider,{value:{selectedNotes:t,setSlectedNotes:n},children:e})}function od(){return b.useContext(wg)}function u2(){return P.jsxs("div",{className:"",children:[P.jsx(c2,{}),P.jsx(d2,{})]})}function c2(){const{selectedNotes:e,setSlectedNotes:t}=od(),{notes:n}=Qi(o=>o.notes),{setSelectedCat:r}=Ea(),i=o=>{const s=e.filter(l=>(l.title||l.description).toLowerCase().includes(o.target.value.toLowerCase()));!o.target.value==""?t(s):(t(n),r("همه"))};return P.jsxs("div",{className:"flex items-center p-3 w-full mb-5 shadow-md bg-white",children:[P.jsx(V1,{className:"text-primary w-5 h-5"}),P.jsx("input",{onChange:o=>i(o),type:"text",className:"capitalize outline-none mr-2 w-full text-primary",placeholder:"جستجو یادداشت..."})]})}function d2(){const{setSlectedNotes:e}=od(),[t,n]=b.useState(!1),{selectedCat:r,setSelectedCat:i}=Ea(),{notes:o}=Qi(l=>l.notes),s=l=>{i(l);const a=o.filter(u=>u.category===l);if(e(a),l==="همه")return e(o.filter(u=>u.category!=="همه"))};return P.jsxs(P.Fragment,{children:[P.jsxs("nav",{className:"flex flex-col-reverse md:flex-row justify-between py-6 items-start md:items-center",children:[P.jsxs("ul",{className:"flex gap-x-2 md:gap-x-9 md:pl-9 text-primary",children:[P.jsx("li",{onClick:()=>s("همه"),className:` ${r==="همه"&&"bg-blue-300"} before:bg-blue-300`,children:"همه"}),P.jsx("li",{onClick:()=>s("خانه"),className:` ${r==="خانه"&&"bg-orange-300"} before:bg-orange-300`,children:"خانه"}),P.jsx("li",{onClick:()=>s("کار"),className:`${r==="کار"&&"bg-purple-300"} before:bg-purple-300`,children:"کار"}),P.jsx("li",{onClick:()=>s("شخصی"),className:`${r==="شخصی"&&"bg-green-300"} before:bg-green-300`,children:"شخصی"})]}),P.jsxs("button",{onClick:()=>n(l=>!l),className:"bg-purple-500 mb-9 absolute top-3 right-[1px] md:static md:mb-0 hover:ring-2 duration-500 hover:bg-purple-600 hover:ring-purple-600 hover:ring-offset-2 hover:ring-offset-current py-[6px] px-4 justify-between flex items-center rounded-md text-white",children:[P.jsx(N1,{className:"w-5 h-5 ml-2"}),"اضافه کردن",P.jsx("span",{className:"mr-[6px] block",children:" یادداشت"})]})]}),P.jsx(yg,{isOpenModal:t,setIsOpenModal:n})]})}function f2(){return P.jsxs("div",{className:"flex items-center gap-4 my-4 w-full",children:[P.jsx(Gm,{style:{width:"1.3rem",height:"1.3rem"}}),P.jsx("p",{children:" دریافت اطلاعات..."})]})}function h2(){const[e,t]=b.useState(null),{selectedNotes:n}=od(),{setSelectedCat:r}=Ea(),[i,o]=b.useState(!1),{notes:s,loading:l,error:a}=Qi(f=>f.notes),u=Hc();b.useEffect(()=>{u(gi())},[]);const c=(f,m)=>{u(pg({id:f})),r("همه"),Uo.success(` ${m} حذف شد `)},d=(f,m,g,v)=>{t({id:f,title:m,description:g,category:v}),o(!0)};return s!=null&&s.length?P.jsxs("div",{children:[P.jsx(p2,{numOfAllNotes:s==null?void 0:s.length,numOfCompleted:s==null?void 0:s.filter(f=>f.completed===!0).length}),P.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:l?P.jsx(f2,{}):a?P.jsx("p",{children:"error ..."}):n==null?void 0:n.map(f=>{const g=new Date(Number(f.date)).toLocaleDateString("fa-IR");return P.jsxs("article",{className:` ${f.category==="کار"?"bg-purple-400":f.category==="خانه"?"bg-orange-400":"bg-green-400"} shadow-lg flex flex-col gap-11 rounded-md p-2 text-primary ${f.completed?"!bg-gray-500":""}`,children:[P.jsxs("div",{className:"flex justify-between items-center relative",children:[P.jsxs("div",{className:"flex gap-x-3",children:[P.jsx("input",{checked:f.completed,className:` ${f.completed&&"line-through"} w-5 h-5 duration-500 cursor-pointer relative peer shrink-0 appearance-none border-2 border-purple-500 rounded-[4px] bg-purple-200 + */var Uc=Symbol.for("react.element"),Bc=Symbol.for("react.portal"),ca=Symbol.for("react.fragment"),da=Symbol.for("react.strict_mode"),fa=Symbol.for("react.profiler"),ha=Symbol.for("react.provider"),pa=Symbol.for("react.context"),d_=Symbol.for("react.server_context"),ma=Symbol.for("react.forward_ref"),va=Symbol.for("react.suspense"),ga=Symbol.for("react.suspense_list"),ya=Symbol.for("react.memo"),wa=Symbol.for("react.lazy"),f_=Symbol.for("react.offscreen"),Gv;Gv=Symbol.for("react.module.reference");function ct(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Uc:switch(e=e.type,e){case ca:case fa:case da:case va:case ga:return e;default:switch(e=e&&e.$$typeof,e){case d_:case pa:case ma:case wa:case ya:case ha:return e;default:return t}}case Bc:return t}}}G.ContextConsumer=pa;G.ContextProvider=ha;G.Element=Uc;G.ForwardRef=ma;G.Fragment=ca;G.Lazy=wa;G.Memo=ya;G.Portal=Bc;G.Profiler=fa;G.StrictMode=da;G.Suspense=va;G.SuspenseList=ga;G.isAsyncMode=function(){return!1};G.isConcurrentMode=function(){return!1};G.isContextConsumer=function(e){return ct(e)===pa};G.isContextProvider=function(e){return ct(e)===ha};G.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Uc};G.isForwardRef=function(e){return ct(e)===ma};G.isFragment=function(e){return ct(e)===ca};G.isLazy=function(e){return ct(e)===wa};G.isMemo=function(e){return ct(e)===ya};G.isPortal=function(e){return ct(e)===Bc};G.isProfiler=function(e){return ct(e)===fa};G.isStrictMode=function(e){return ct(e)===da};G.isSuspense=function(e){return ct(e)===va};G.isSuspenseList=function(e){return ct(e)===ga};G.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===ca||e===fa||e===da||e===va||e===ga||e===f_||typeof e=="object"&&e!==null&&(e.$$typeof===wa||e.$$typeof===ya||e.$$typeof===ha||e.$$typeof===pa||e.$$typeof===ma||e.$$typeof===Gv||e.getModuleId!==void 0)};G.typeOf=ct;function h_(){const e=o_();let t=null,n=null;return{clear(){t=null,n=null},notify(){e(()=>{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const Zf={notify(){},get:()=>[]};function p_(e,t){let n,r=Zf,i=0,o=!1;function s(v){c();const w=r.subscribe(v);let h=!1;return()=>{h||(h=!0,w(),d())}}function l(){r.notify()}function a(){g.onStateChange&&g.onStateChange()}function u(){return o}function c(){i++,n||(n=t?t.addNestedSub(a):e.subscribe(a),r=h_())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Zf)}function f(){o||(o=!0,c())}function m(){o&&(o=!1,d())}const g={addNestedSub:s,notifyNestedSubs:l,handleChangeWrapper:a,isSubscribed:u,trySubscribe:f,tryUnsubscribe:m,getListeners:()=>r};return g}const m_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",v_=m_?b.useLayoutEffect:b.useEffect;function g_({store:e,context:t,children:n,serverState:r,stabilityCheck:i="once",noopCheck:o="once"}){const s=b.useMemo(()=>{const u=p_(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),l=b.useMemo(()=>e.getState(),[e]);v_(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),l!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,l]);const a=t||Sn;return b.createElement(a.Provider,{value:s},n)}function qv(e=Sn){const t=e===Sn?Wv:zc(e);return function(){const{store:r}=t();return r}}const y_=qv();function w_(e=Sn){const t=e===Sn?y_:qv(e);return function(){return t().dispatch}}const Hc=w_();l_(n_.useSyncExternalStoreWithSelector);i_(kc.unstable_batchedUpdates);function vt(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:Wc(e)?2:Kc(e)?3:0}function br(e,t){return Lr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function S_(e,t){return Lr(e)===2?e.get(t):e[t]}function Qv(e,t,n){var r=Lr(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Jv(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function Wc(e){return k_&&e instanceof Map}function Kc(e){return O_&&e instanceof Set}function An(e){return e.o||e.t}function Gc(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Xv(e);delete t[Z];for(var n=Er(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=b_),Object.freeze(e),t&&Wn(e,function(n,r){return qc(r,!0)},!0)),e}function b_(){vt(2)}function Qc(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Tt(e){var t=Cu[e];return t||vt(18,e),t}function E_(e,t){Cu[e]||(Cu[e]=t)}function bu(){return Mi}function il(e,t){t&&(Tt("Patches"),e.u=[],e.s=[],e.v=t)}function ks(e){Eu(e),e.p.forEach(__),e.p=null}function Eu(e){e===Mi&&(Mi=e.l)}function eh(e){return Mi={p:[],l:Mi,h:e,m:!0,_:0}}function __(e){var t=e[Z];t.i===0||t.i===1?t.j():t.g=!0}function ol(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||Tt("ES5").S(t,e,r),r?(n[Z].P&&(ks(t),vt(4)),Ht(e)&&(e=Os(t,e),t.l||Ps(t,e)),t.u&&Tt("Patches").M(n[Z].t,e,t.u,t.s)):e=Os(t,n,[]),ks(t),t.u&&t.v(t.u,t.s),e!==Yv?e:void 0}function Os(e,t,n){if(Qc(t))return t;var r=t[Z];if(!r)return Wn(t,function(l,a){return th(e,r,t,l,a,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Ps(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=Gc(r.k):r.o,o=i,s=!1;r.i===3&&(o=new Set(i),i.clear(),s=!0),Wn(o,function(l,a){return th(e,r,i,l,a,n,s)}),Ps(e,i,!1),n&&e.u&&Tt("Patches").N(r,n,e.u,e.s)}return r.o}function th(e,t,n,r,i,o,s){if(bn(i)){var l=Os(e,i,o&&t&&t.i!==3&&!br(t.R,r)?o.concat(r):void 0);if(Qv(n,r,l),!bn(l))return;e.m=!1}else s&&n.add(i);if(Ht(i)&&!Qc(i)){if(!e.h.D&&e._<1)return;Os(e,i),t&&t.A.l||Ps(e,i)}}function Ps(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&qc(t,n)}function sl(e,t){var n=e[Z];return(n?An(n):e)[t]}function nh(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function tn(e){e.P||(e.P=!0,e.l&&tn(e.l))}function al(e){e.o||(e.o=Gc(e.t))}function _u(e,t,n){var r=Wc(t)?Tt("MapSet").F(t,n):Kc(t)?Tt("MapSet").T(t,n):e.O?function(i,o){var s=Array.isArray(i),l={i:s?1:0,A:o?o.A:bu(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},a=l,u=Ni;s&&(a=[l],u=ni);var c=Proxy.revocable(a,u),d=c.revoke,f=c.proxy;return l.k=f,l.j=d,f}(t,n):Tt("ES5").J(t,n);return(n?n.A:bu()).p.push(r),r}function C_(e){return bn(e)||vt(22,e),function t(n){if(!Ht(n))return n;var r,i=n[Z],o=Lr(n);if(i){if(!i.P&&(i.i<4||!Tt("ES5").K(i)))return i.t;i.I=!0,r=rh(n,o),i.I=!1}else r=rh(n,o);return Wn(r,function(s,l){i&&S_(i.t,s)===l||Qv(r,s,t(l))}),o===3?new Set(r):r}(e)}function rh(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Gc(e)}function x_(){function e(o,s){var l=i[o];return l?l.enumerable=s:i[o]=l={configurable:!0,enumerable:s,get:function(){var a=this[Z];return Ni.get(a,o)},set:function(a){var u=this[Z];Ni.set(u,o,a)}},l}function t(o){for(var s=o.length-1;s>=0;s--){var l=o[s][Z];if(!l.P)switch(l.i){case 5:r(l)&&tn(l);break;case 4:n(l)&&tn(l)}}}function n(o){for(var s=o.t,l=o.k,a=Er(l),u=a.length-1;u>=0;u--){var c=a[u];if(c!==Z){var d=s[c];if(d===void 0&&!br(s,c))return!0;var f=l[c],m=f&&f[Z];if(m?m.t!==d:!Jv(f,d))return!0}}var g=!!s[Z];return a.length!==Er(s).length+(g?0:1)}function r(o){var s=o.k;if(s.length!==o.t.length)return!0;var l=Object.getOwnPropertyDescriptor(s,s.length-1);if(l&&!l.get)return!0;for(var a=0;a1?h-1:0),y=1;y1?c-1:0),f=1;f=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var s=Tt("Patches").$;return bn(n)?s(n,r):this.produce(n,function(l){return s(l,r)})},e}(),Ye=new T_,Zv=Ye.produce;Ye.produceWithPatches.bind(Ye);Ye.setAutoFreeze.bind(Ye);Ye.setUseProxies.bind(Ye);Ye.applyPatches.bind(Ye);Ye.createDraft.bind(Ye);Ye.finishDraft.bind(Ye);function Oe(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var ah=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),ll=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ts={INIT:"@@redux/INIT"+ll(),REPLACE:"@@redux/REPLACE"+ll(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+ll()}};function $_(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function eg(e,t,n){var r;if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Oe(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Oe(1));return n(eg)(e,t)}if(typeof e!="function")throw new Error(Oe(2));var i=e,o=t,s=[],l=s,a=!1;function u(){l===s&&(l=s.slice())}function c(){if(a)throw new Error(Oe(3));return o}function d(v){if(typeof v!="function")throw new Error(Oe(4));if(a)throw new Error(Oe(5));var w=!0;return u(),l.push(v),function(){if(w){if(a)throw new Error(Oe(6));w=!1,u();var p=l.indexOf(v);l.splice(p,1),s=null}}}function f(v){if(!$_(v))throw new Error(Oe(7));if(typeof v.type>"u")throw new Error(Oe(8));if(a)throw new Error(Oe(9));try{a=!0,o=i(o,v)}finally{a=!1}for(var w=s=l,h=0;h"u")throw new Error(Oe(12));if(typeof n(void 0,{type:Ts.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Oe(13))})}function I_(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(Oe(14));d[m]=w,c=c||w!==v}return c=c||o.length!==Object.keys(a).length,c?d:a}}function $s(){for(var e=arguments.length,t=new Array(e),n=0;n0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]{if(o=aC(o),o in hh)return;hh[o]=!0;const s=o.endsWith(".css"),l=s?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!s||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${l}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":sC,s||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),s)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})},lC=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Yi(()=>Promise.resolve().then(()=>Xi),void 0).then(({default:r})=>r(...n)):t=fetch,(...n)=>t(...n)};class Xc extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}}class uC extends Xc{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class cC extends Xc{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class dC extends Xc{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var fC=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};class hC{constructor(t,{headers:n={},customFetch:r}={}){this.url=t,this.headers=n,this.fetch=lC(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t,n={}){var r;return fC(this,void 0,void 0,function*(){try{const{headers:i,method:o,body:s}=n;let l={},a;s&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)&&(typeof Blob<"u"&&s instanceof Blob||s instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",a=s):typeof s=="string"?(l["Content-Type"]="text/plain",a=s):typeof FormData<"u"&&s instanceof FormData?a=s:(l["Content-Type"]="application/json",a=JSON.stringify(s)));const u=yield this.fetch(`${this.url}/${t}`,{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),i),body:a}).catch(m=>{throw new uC(m)}),c=u.headers.get("x-relay-error");if(c&&c==="true")throw new cC(u);if(!u.ok)throw new dC(u);let d=((r=u.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),f;return d==="application/json"?f=yield u.json():d==="application/octet-stream"?f=yield u.blob():d==="multipart/form-data"?f=yield u.formData():f=yield u.text(),{data:f,error:null}}catch(i){return{data:null,error:i}}})}}var ku={exports:{}};(function(e,t){var n=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof ud<"u")return ud;throw new Error("unable to locate global object")},r=n();e.exports=t=r.fetch,r.fetch&&(t.default=r.fetch.bind(r)),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response})(ku,ku.exports);var Zc=ku.exports;const ed=$h(Zc),Xi=Th({__proto__:null,default:ed},[Zc]);class pC{constructor(t){this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=t.headers,this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=t.shouldThrowOnError,this.signal=t.signal,this.isMaybeSingle=t.isMaybeSingle,t.fetch?this.fetch=t.fetch:typeof fetch>"u"?this.fetch=ed:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(t,n){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");const r=this.fetch;let i=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{var s,l,a;let u=null,c=null,d=null,f=o.status,m=o.statusText;if(o.ok){if(this.method!=="HEAD"){const h=await o.text();h===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?c=h:c=JSON.parse(h))}const v=(s=this.headers.Prefer)===null||s===void 0?void 0:s.match(/count=(exact|planned|estimated)/),w=(l=o.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");v&&w&&w.length>1&&(d=parseInt(w[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(c)&&(c.length>1?(u={code:"PGRST116",details:`Results contain ${c.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},c=null,d=null,f=406,m="Not Acceptable"):c.length===1?c=c[0]:c=null)}else{const v=await o.text();try{u=JSON.parse(v),Array.isArray(u)&&o.status===404&&(c=[],u=null,f=200,m="OK")}catch{o.status===404&&v===""?(f=204,m="No Content"):u={message:v}}if(u&&this.isMaybeSingle&&(!((a=u==null?void 0:u.details)===null||a===void 0)&&a.includes("0 rows"))&&(u=null,f=200,m="OK"),u&&this.shouldThrowOnError)throw u}return{error:u,data:c,count:d,status:f,statusText:m}});return this.shouldThrowOnError||(i=i.catch(o=>{var s,l,a;return{error:{message:`${(s=o==null?void 0:o.name)!==null&&s!==void 0?s:"FetchError"}: ${o==null?void 0:o.message}`,details:`${(l=o==null?void 0:o.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(a=o==null?void 0:o.code)!==null&&a!==void 0?a:""}`},data:null,count:null,status:0,statusText:""}})),i.then(t,n)}}class mC extends pC{select(t){let n=!1;const r=(t??"*").split("").map(i=>/\s/.test(i)&&!n?"":(i==='"'&&(n=!n),i)).join("");return this.url.searchParams.set("select",r),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(t,{ascending:n=!0,nullsFirst:r,foreignTable:i}={}){const o=i?`${i}.order`:"order",s=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${s?`${s},`:""}${t}.${n?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:n}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${t}`),this}range(t,n,{foreignTable:r}={}){const i=typeof r>"u"?"offset":`${r}.offset`,o=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(o,`${n-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:t=!1,verbose:n=!1,settings:r=!1,buffers:i=!1,wal:o=!1,format:s="text"}={}){const l=[t?"analyze":null,n?"verbose":null,r?"settings":null,i?"buffers":null,o?"wal":null].filter(Boolean).join("|"),a=this.headers.Accept;return this.headers.Accept=`application/vnd.pgrst.plan+${s}; for="${a}"; options=${l};`,s==="json"?this:this}rollback(){var t;return((t=this.headers.Prefer)!==null&&t!==void 0?t:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}class tr extends mC{eq(t,n){return this.url.searchParams.append(t,`eq.${n}`),this}neq(t,n){return this.url.searchParams.append(t,`neq.${n}`),this}gt(t,n){return this.url.searchParams.append(t,`gt.${n}`),this}gte(t,n){return this.url.searchParams.append(t,`gte.${n}`),this}lt(t,n){return this.url.searchParams.append(t,`lt.${n}`),this}lte(t,n){return this.url.searchParams.append(t,`lte.${n}`),this}like(t,n){return this.url.searchParams.append(t,`like.${n}`),this}likeAllOf(t,n){return this.url.searchParams.append(t,`like(all).{${n.join(",")}}`),this}likeAnyOf(t,n){return this.url.searchParams.append(t,`like(any).{${n.join(",")}}`),this}ilike(t,n){return this.url.searchParams.append(t,`ilike.${n}`),this}ilikeAllOf(t,n){return this.url.searchParams.append(t,`ilike(all).{${n.join(",")}}`),this}ilikeAnyOf(t,n){return this.url.searchParams.append(t,`ilike(any).{${n.join(",")}}`),this}is(t,n){return this.url.searchParams.append(t,`is.${n}`),this}in(t,n){const r=n.map(i=>typeof i=="string"&&new RegExp("[,()]").test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}contains(t,n){return typeof n=="string"?this.url.searchParams.append(t,`cs.${n}`):Array.isArray(n)?this.url.searchParams.append(t,`cs.{${n.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(n)}`),this}containedBy(t,n){return typeof n=="string"?this.url.searchParams.append(t,`cd.${n}`):Array.isArray(n)?this.url.searchParams.append(t,`cd.{${n.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(n)}`),this}rangeGt(t,n){return this.url.searchParams.append(t,`sr.${n}`),this}rangeGte(t,n){return this.url.searchParams.append(t,`nxl.${n}`),this}rangeLt(t,n){return this.url.searchParams.append(t,`sl.${n}`),this}rangeLte(t,n){return this.url.searchParams.append(t,`nxr.${n}`),this}rangeAdjacent(t,n){return this.url.searchParams.append(t,`adj.${n}`),this}overlaps(t,n){return typeof n=="string"?this.url.searchParams.append(t,`ov.${n}`):this.url.searchParams.append(t,`ov.{${n.join(",")}}`),this}textSearch(t,n,{config:r,type:i}={}){let o="";i==="plain"?o="pl":i==="phrase"?o="ph":i==="websearch"&&(o="w");const s=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${o}fts${s}.${n}`),this}match(t){return Object.entries(t).forEach(([n,r])=>{this.url.searchParams.append(n,`eq.${r}`)}),this}not(t,n,r){return this.url.searchParams.append(t,`not.${n}.${r}`),this}or(t,{foreignTable:n}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${t})`),this}filter(t,n,r){return this.url.searchParams.append(t,`${n}.${r}`),this}}class vC{constructor(t,{headers:n={},schema:r,fetch:i}){this.url=t,this.headers=n,this.schema=r,this.fetch=i}select(t,{head:n=!1,count:r}={}){const i=n?"HEAD":"GET";let o=!1;const s=(t??"*").split("").map(l=>/\s/.test(l)&&!o?"":(l==='"'&&(o=!o),l)).join("");return this.url.searchParams.set("select",s),r&&(this.headers.Prefer=`count=${r}`),new tr({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(t,{count:n,defaultToNull:r=!0}={}){const i="POST",o=[];if(this.headers.Prefer&&o.push(this.headers.Prefer),n&&o.push(`count=${n}`),r||o.push("missing=default"),this.headers.Prefer=o.join(","),Array.isArray(t)){const s=t.reduce((l,a)=>l.concat(Object.keys(a)),[]);if(s.length>0){const l=[...new Set(s)].map(a=>`"${a}"`);this.url.searchParams.set("columns",l.join(","))}}return new tr({method:i,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:this.fetch,allowEmpty:!1})}upsert(t,{onConflict:n,ignoreDuplicates:r=!1,count:i,defaultToNull:o=!0}={}){const s="POST",l=[`resolution=${r?"ignore":"merge"}-duplicates`];if(n!==void 0&&this.url.searchParams.set("on_conflict",n),this.headers.Prefer&&l.push(this.headers.Prefer),i&&l.push(`count=${i}`),o||l.push("missing=default"),this.headers.Prefer=l.join(","),Array.isArray(t)){const a=t.reduce((u,c)=>u.concat(Object.keys(c)),[]);if(a.length>0){const u=[...new Set(a)].map(c=>`"${c}"`);this.url.searchParams.set("columns",u.join(","))}}return new tr({method:s,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:this.fetch,allowEmpty:!1})}update(t,{count:n}={}){const r="PATCH",i=[];return this.headers.Prefer&&i.push(this.headers.Prefer),n&&i.push(`count=${n}`),this.headers.Prefer=i.join(","),new tr({method:r,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:this.fetch,allowEmpty:!1})}delete({count:t}={}){const n="DELETE",r=[];return t&&r.push(`count=${t}`),this.headers.Prefer&&r.unshift(this.headers.Prefer),this.headers.Prefer=r.join(","),new tr({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}const gC="1.8.5",yC={"X-Client-Info":`postgrest-js/${gC}`};class td{constructor(t,{headers:n={},schema:r,fetch:i}={}){this.url=t,this.headers=Object.assign(Object.assign({},yC),n),this.schemaName=r,this.fetch=i}from(t){const n=new URL(`${this.url}/${t}`);return new vC(n,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new td(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,n={},{head:r=!1,count:i}={}){let o;const s=new URL(`${this.url}/rpc/${t}`);let l;r?(o="HEAD",Object.entries(n).forEach(([u,c])=>{s.searchParams.append(u,`${c}`)})):(o="POST",l=n);const a=Object.assign({},this.headers);return i&&(a.Prefer=`count=${i}`),new tr({method:o,url:s,headers:a,schema:this.schemaName,body:l,fetch:this.fetch,allowEmpty:!1})}}var dl,ph;function wC(){if(ph)return dl;ph=1;var e=function(){if(typeof self=="object"&&self)return self;if(typeof window=="object"&&window)return window;throw new Error("Unable to resolve global `this`")};return dl=function(){if(this)return this;if(typeof globalThis=="object"&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch{return e()}try{return __global__||e()}finally{delete Object.prototype.__global__}}(),dl}const SC="websocket",bC="Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",EC=["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],_C="Brian McKelvey (https://github.com/theturtle32)",CC=["Iñaki Baz Castillo (http://dev.sipdoc.net)"],xC="1.0.34",kC={type:"git",url:"https://github.com/theturtle32/WebSocket-Node.git"},OC="https://github.com/theturtle32/WebSocket-Node",PC={node:">=4.0.0"},TC={bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},$C={"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1",jshint:"^2.0.0",tape:"^4.9.1"},AC={verbose:!1},IC={test:"tape test/unit/*.js",gulp:"gulp"},RC="index",DC={lib:"./lib"},FC="lib/browser.js",jC="Apache-2.0",LC={name:SC,description:bC,keywords:EC,author:_C,contributors:CC,version:xC,repository:kC,homepage:OC,engines:PC,dependencies:TC,devDependencies:$C,config:AC,scripts:IC,main:RC,directories:DC,browser:FC,license:jC};var MC=LC.version,In;if(typeof globalThis=="object")In=globalThis;else try{In=wC()}catch{}finally{if(!In&&typeof window<"u"&&(In=window),!In)throw new Error("Could not determine global this")}var Vi=In.WebSocket||In.MozWebSocket,NC=MC;function og(e,t){var n;return t?n=new Vi(e,t):n=new Vi(e),n}Vi&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach(function(e){Object.defineProperty(og,e,{get:function(){return Vi[e]}})});var VC={w3cwebsocket:Vi?og:null,version:NC};const zC="2.8.4",UC={"X-Client-Info":`realtime-js/${zC}`},BC="1.0.0",sg=1e4,HC=1e3;var pi;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(pi||(pi={}));var He;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(He||(He={}));var pt;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(pt||(pt={}));var Ou;(function(e){e.websocket="websocket"})(Ou||(Ou={}));var Rn;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Rn||(Rn={}));class ag{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}class WC{constructor(){this.HEADER_LENGTH=1}decode(t,n){return t.constructor===ArrayBuffer?n(this._binaryDecode(t)):n(typeof t=="string"?JSON.parse(t):{})}_binaryDecode(t){const n=new DataView(t),r=new TextDecoder;return this._decodeBroadcast(t,n,r)}_decodeBroadcast(t,n,r){const i=n.getUint8(1),o=n.getUint8(2);let s=this.HEADER_LENGTH+2;const l=r.decode(t.slice(s,s+i));s=s+i;const a=r.decode(t.slice(s,s+o));s=s+o;const u=JSON.parse(r.decode(t.slice(s,t.byteLength)));return{ref:null,topic:l,event:a,payload:u}}}class fl{constructor(t,n,r={},i=sg){this.channel=t,this.event=n,this.payload=r,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var r;return this._hasReceived(t)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var mh;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(mh||(mh={}));class mi{constructor(t,n){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},i=>{const{onJoin:o,onLeave:s,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=mi.syncState(this.state,i,o,s),this.pendingDiffs.forEach(a=>{this.state=mi.syncDiff(this.state,a,o,s)}),this.pendingDiffs=[],l()}),this.channel._on(r.diff,{},i=>{const{onJoin:o,onLeave:s,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=mi.syncDiff(this.state,i,o,s),l())}),this.onJoin((i,o,s)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:o,newPresences:s})}),this.onLeave((i,o,s)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:o,leftPresences:s})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,r,i){const o=this.cloneDeep(t),s=this.transformState(n),l={},a={};return this.map(o,(u,c)=>{s[u]||(a[u]=c)}),this.map(s,(u,c)=>{const d=o[u];if(d){const f=c.map(w=>w.presence_ref),m=d.map(w=>w.presence_ref),g=c.filter(w=>m.indexOf(w.presence_ref)<0),v=d.filter(w=>f.indexOf(w.presence_ref)<0);g.length>0&&(l[u]=g),v.length>0&&(a[u]=v)}else l[u]=c}),this.syncDiff(o,{joins:l,leaves:a},r,i)}static syncDiff(t,n,r,i){const{joins:o,leaves:s}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),i||(i=()=>{}),this.map(o,(l,a)=>{var u;const c=(u=t[l])!==null&&u!==void 0?u:[];if(t[l]=this.cloneDeep(a),c.length>0){const d=t[l].map(m=>m.presence_ref),f=c.filter(m=>d.indexOf(m.presence_ref)<0);t[l].unshift(...f)}r(l,c,a)}),this.map(s,(l,a)=>{let u=t[l];if(!u)return;const c=a.map(d=>d.presence_ref);u=u.filter(d=>c.indexOf(d.presence_ref)<0),t[l]=u,i(l,u,a),u.length===0&&delete t[l]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const i=t[r];return"metas"in i?n[r]=i.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[r]=i,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Q;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(Q||(Q={}));const vh=(e,t,n={})=>{var r;const i=(r=n.skipTypes)!==null&&r!==void 0?r:[];return Object.keys(t).reduce((o,s)=>(o[s]=KC(s,e,t,i),o),{})},KC=(e,t,n,r)=>{const i=t.find(l=>l.name===e),o=i==null?void 0:i.type,s=n[e];return o&&!r.includes(o)?lg(o,s):Pu(s)},lg=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return JC(t,n)}switch(e){case Q.bool:return GC(t);case Q.float4:case Q.float8:case Q.int2:case Q.int4:case Q.int8:case Q.numeric:case Q.oid:return qC(t);case Q.json:case Q.jsonb:return QC(t);case Q.timestamp:return YC(t);case Q.abstime:case Q.date:case Q.daterange:case Q.int4range:case Q.int8range:case Q.money:case Q.reltime:case Q.text:case Q.time:case Q.timestamptz:case Q.timetz:case Q.tsrange:case Q.tstzrange:return Pu(t);default:return Pu(t)}},Pu=e=>e,GC=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},qC=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},QC=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},JC=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let o;const s=e.slice(1,n);try{o=JSON.parse("["+s+"]")}catch{o=s?s.split(","):[]}return o.map(l=>lg(t,l))}return e},YC=e=>typeof e=="string"?e.replace(" ","T"):e;var gh;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(gh||(gh={}));var yh;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes"})(yh||(yh={}));var wh;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(wh||(wh={}));class nd{constructor(t,n={config:{}},r){this.topic=t,this.params=n,this.socket=r,this.bindings={},this.state=He.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""}},n.config),this.timeout=this.socket.timeout,this.joinPush=new fl(this,pt.join,this.params,this.timeout),this.rejoinTimer=new ag(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=He.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>i.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=He.closed,this.socket._remove(this)}),this._onError(i=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,i),this.state=He.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=He.errored,this.rejoinTimer.scheduleTimeout())}),this._on(pt.reply,{},(i,o)=>{this._trigger(this._replyEventName(o),i)}),this.presence=new mi(this),this.broadcastEndpointURL=this._broadcastEndpointURL()}subscribe(t,n=this.timeout){var r,i;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const{config:{broadcast:o,presence:s}}=this.params;this._onError(u=>t&&t("CHANNEL_ERROR",u)),this._onClose(()=>t&&t("CLOSED"));const l={},a={broadcast:o,presence:s,postgres_changes:(i=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(u=>u.filter))!==null&&i!==void 0?i:[]};this.socket.accessToken&&(l.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:a},l)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",({postgres_changes:u})=>{var c;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),u===void 0){t&&t("SUBSCRIBED");return}else{const d=this.bindings.postgres_changes,f=(c=d==null?void 0:d.length)!==null&&c!==void 0?c:0,m=[];for(let g=0;g{t&&t("CHANNEL_ERROR",new Error(JSON.stringify(Object.values(u).join(", ")||"error")))}).receive("timeout",()=>{t&&t("TIMED_OUT")})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){return this._on(t,n,r)}async send(t,n={}){var r,i;if(!this._canPush()&&t.type==="broadcast"){const{event:o,payload:s}=t,l={method:"POST",headers:{apikey:(r=this.socket.accessToken)!==null&&r!==void 0?r:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:s}]})};try{return(await this._fetchWithTimeout(this.broadcastEndpointURL,l,(i=n.timeout)!==null&&i!==void 0?i:this.timeout)).ok?"ok":"error"}catch(a){return a.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var s,l,a;const u=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((a=(l=(s=this.params)===null||s===void 0?void 0:s.config)===null||l===void 0?void 0:l.broadcast)===null||a===void 0)&&a.ack)&&o("ok"),u.receive("ok",()=>o("ok")),u.receive("timeout",()=>o("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=He.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(pt.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(r=>{const i=new fl(this,pt.leave,{},t);i.receive("ok",()=>{n(),r("ok")}).receive("timeout",()=>{n(),r("timed out")}).receive("error",()=>{r("error")}),i.send(),this._canPush()||i.trigger("ok",{})})}_broadcastEndpointURL(){let t=this.socket.endPoint;return t=t.replace(/^ws/i,"http"),t=t.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),t.replace(/\/+$/,"")+"/api/broadcast"}async _fetchWithTimeout(t,n,r){const i=new AbortController,o=setTimeout(()=>i.abort(),r),s=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(o),s}_push(t,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new fl(this,t,n,r);return this._canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}_onMessage(t,n,r){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,r){var i,o;const s=t.toLocaleLowerCase(),{close:l,error:a,leave:u,join:c}=pt;if(r&&[l,a,u,c].indexOf(s)>=0&&r!==this._joinRef())return;let f=this._onMessage(s,n,r);if(n&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(s)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(m=>{var g,v,w;return((g=m.filter)===null||g===void 0?void 0:g.event)==="*"||((w=(v=m.filter)===null||v===void 0?void 0:v.event)===null||w===void 0?void 0:w.toLocaleLowerCase())===s}).map(m=>m.callback(f,r)):(o=this.bindings[s])===null||o===void 0||o.filter(m=>{var g,v,w,h,p,y;if(["broadcast","presence","postgres_changes"].includes(s))if("id"in m){const S=m.id,E=(g=m.filter)===null||g===void 0?void 0:g.event;return S&&((v=n.ids)===null||v===void 0?void 0:v.includes(S))&&(E==="*"||(E==null?void 0:E.toLocaleLowerCase())===((w=n.data)===null||w===void 0?void 0:w.type.toLocaleLowerCase()))}else{const S=(p=(h=m==null?void 0:m.filter)===null||h===void 0?void 0:h.event)===null||p===void 0?void 0:p.toLocaleLowerCase();return S==="*"||S===((y=n==null?void 0:n.event)===null||y===void 0?void 0:y.toLocaleLowerCase())}else return m.type.toLocaleLowerCase()===s}).map(m=>{if(typeof f=="object"&&"ids"in f){const g=f.data,{schema:v,table:w,commit_timestamp:h,type:p,errors:y}=g;f=Object.assign(Object.assign({},{schema:v,table:w,commit_timestamp:h,eventType:p,new:{},old:{},errors:y}),this._getPayloadRecords(g))}m.callback(f,r)})}_isClosed(){return this.state===He.closed}_isJoined(){return this.state===He.joined}_isJoining(){return this.state===He.joining}_isLeaving(){return this.state===He.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,r){const i=t.toLocaleLowerCase(),o={type:i,filter:n,callback:r};return this.bindings[i]?this.bindings[i].push(o):this.bindings[i]=[o],this}_off(t,n){const r=t.toLocaleLowerCase();return this.bindings[r]=this.bindings[r].filter(i=>{var o;return!(((o=i.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===r&&nd.isEqual(i.filter,n))}),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const r in t)if(t[r]!==n[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(pt.close,{},t)}_onError(t){this._on(pt.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=He.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=vh(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=vh(t.columns,t.old_record)),n}}const XC=()=>{};class ZC{constructor(t,n){var r;this.accessToken=null,this.channels=[],this.endPoint="",this.headers=UC,this.params={},this.timeout=sg,this.transport=VC.w3cwebsocket,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=XC,this.conn=null,this.sendBuffer=[],this.serializer=new WC,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=o=>{let s;return o?s=o:typeof fetch>"u"?s=(...l)=>Yi(()=>Promise.resolve().then(()=>Xi),void 0).then(({default:a})=>a(...l)):s=fetch,(...l)=>s(...l)},this.endPoint=`${t}/${Ou.websocket}`,n!=null&&n.params&&(this.params=n.params),n!=null&&n.headers&&(this.headers=Object.assign(Object.assign({},this.headers),n.headers)),n!=null&&n.timeout&&(this.timeout=n.timeout),n!=null&&n.logger&&(this.logger=n.logger),n!=null&&n.transport&&(this.transport=n.transport),n!=null&&n.heartbeatIntervalMs&&(this.heartbeatIntervalMs=n.heartbeatIntervalMs);const i=(r=n==null?void 0:n.params)===null||r===void 0?void 0:r.apikey;i&&(this.accessToken=i),this.reconnectAfterMs=n!=null&&n.reconnectAfterMs?n.reconnectAfterMs:o=>[1e3,2e3,5e3,1e4][o-1]||1e4,this.encode=n!=null&&n.encode?n.encode:(o,s)=>s(JSON.stringify(o)),this.decode=n!=null&&n.decode?n.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new ag(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){this.conn||(this.conn=new this.transport(this._endPointURL(),[],null,this.headers),this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t)))}disconnect(t,n){this.conn&&(this.conn.onclose=function(){},t?this.conn.close(t,n??""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.disconnect(),t}log(t,n,r){this.logger(t,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case pi.connecting:return Rn.Connecting;case pi.open:return Rn.Open;case pi.closing:return Rn.Closing;default:return Rn.Closed}}isConnected(){return this.connectionState()===Rn.Open}channel(t,n={config:{}}){const r=new nd(`realtime:${t}`,n,this);return this.channels.push(r),r}push(t){const{topic:n,event:r,payload:i,ref:o}=t,s=()=>{this.encode(t,l=>{var a;(a=this.conn)===null||a===void 0||a.send(l)})};this.log("push",`${n} ${r} (${o})`,i),this.isConnected()?s():this.sendBuffer.push(s)}setAuth(t){this.accessToken=t,this.channels.forEach(n=>{t&&n.updateJoinPayload({access_token:t}),n.joinedOnce&&n._isJoined()&&n._push(pt.access_token,{access_token:t})})}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let n=this.channels.find(r=>r.topic===t&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n._joinRef()!==t._joinRef())}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:BC}))}_onConnMessage(t){this.decode(t.data,n=>{let{topic:r,event:i,payload:o,ref:s}=n;(s&&s===this.pendingHeartbeatRef||i===(o==null?void 0:o.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${o.status||""} ${r} ${i} ${s&&"("+s+")"||""}`,o),this.channels.filter(l=>l._isMember(r)).forEach(l=>l._trigger(i,o,s)),this.stateChangeCallbacks.message.forEach(l=>l(n))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(t=>t())}_onConnClose(t){this.log("transport","close",t),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(n=>n(t))}_onConnError(t){this.log("transport",t.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(n=>n(t))}_triggerChanError(){this.channels.forEach(t=>t._trigger(pt.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const r=t.match(/\?/)?"&":"?",i=new URLSearchParams(n);return`${t}${r}${i}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_sendHeartbeat(){var t;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(t=this.conn)===null||t===void 0||t.close(HC,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class rd extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function Pe(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class ex extends rd{constructor(t,n){super(t),this.name="StorageApiError",this.status=n}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class Sh extends rd{constructor(t,n){super(t),this.name="StorageUnknownError",this.originalError=n}}var tx=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};const ug=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Yi(()=>Promise.resolve().then(()=>Xi),void 0).then(({default:r})=>r(...n)):t=fetch,(...n)=>t(...n)},nx=()=>tx(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Yi(()=>Promise.resolve().then(()=>Xi),void 0)).Response:Response});var Mr=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};const hl=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),rx=(e,t)=>Mr(void 0,void 0,void 0,function*(){const n=yield nx();e instanceof n?e.json().then(r=>{t(new ex(hl(r),e.status||500))}).catch(r=>{t(new Sh(hl(r),r))}):t(new Sh(hl(e),e))}),ix=(e,t,n,r)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),n))};function Sa(e,t,n,r,i,o){return Mr(this,void 0,void 0,function*(){return new Promise((s,l)=>{e(n,ix(t,r,i,o)).then(a=>{if(!a.ok)throw a;return r!=null&&r.noResolveJson?a:a.json()}).then(a=>s(a)).catch(a=>rx(a,l))})})}function Tu(e,t,n,r){return Mr(this,void 0,void 0,function*(){return Sa(e,"GET",t,n,r)})}function Yt(e,t,n,r,i){return Mr(this,void 0,void 0,function*(){return Sa(e,"POST",t,r,i,n)})}function ox(e,t,n,r,i){return Mr(this,void 0,void 0,function*(){return Sa(e,"PUT",t,r,i,n)})}function cg(e,t,n,r,i){return Mr(this,void 0,void 0,function*(){return Sa(e,"DELETE",t,r,i,n)})}var rt=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};const sx={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},bh={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ax{constructor(t,n={},r,i){this.url=t,this.headers=n,this.bucketId=r,this.fetch=ug(i)}uploadOrUpdate(t,n,r,i){return rt(this,void 0,void 0,function*(){try{let o;const s=Object.assign(Object.assign({},bh),i),l=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(s.upsert)});typeof Blob<"u"&&r instanceof Blob?(o=new FormData,o.append("cacheControl",s.cacheControl),o.append("",r)):typeof FormData<"u"&&r instanceof FormData?(o=r,o.append("cacheControl",s.cacheControl)):(o=r,l["cache-control"]=`max-age=${s.cacheControl}`,l["content-type"]=s.contentType);const a=this._removeEmptyFolders(n),u=this._getFinalPath(a),c=yield this.fetch(`${this.url}/object/${u}`,Object.assign({method:t,body:o,headers:l},s!=null&&s.duplex?{duplex:s.duplex}:{}));return c.ok?{data:{path:a},error:null}:{data:null,error:yield c.json()}}catch(o){if(Pe(o))return{data:null,error:o};throw o}})}upload(t,n,r){return rt(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,n,r)})}uploadToSignedUrl(t,n,r,i){return rt(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(t),s=this._getFinalPath(o),l=new URL(this.url+`/object/upload/sign/${s}`);l.searchParams.set("token",n);try{let a;const u=Object.assign({upsert:bh.upsert},i),c=Object.assign(Object.assign({},this.headers),{"x-upsert":String(u.upsert)});typeof Blob<"u"&&r instanceof Blob?(a=new FormData,a.append("cacheControl",u.cacheControl),a.append("",r)):typeof FormData<"u"&&r instanceof FormData?(a=r,a.append("cacheControl",u.cacheControl)):(a=r,c["cache-control"]=`max-age=${u.cacheControl}`,c["content-type"]=u.contentType);const d=yield this.fetch(l.toString(),{method:"PUT",body:a,headers:c});return d.ok?{data:{path:o},error:null}:{data:null,error:yield d.json()}}catch(a){if(Pe(a))return{data:null,error:a};throw a}})}createSignedUploadUrl(t){return rt(this,void 0,void 0,function*(){try{let n=this._getFinalPath(t);const r=yield Yt(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:this.headers}),i=new URL(this.url+r.url),o=i.searchParams.get("token");if(!o)throw new rd("No token returned by API");return{data:{signedUrl:i.toString(),path:t,token:o},error:null}}catch(n){if(Pe(n))return{data:null,error:n};throw n}})}update(t,n,r){return rt(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,n,r)})}move(t,n){return rt(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n},{headers:this.headers}),error:null}}catch(r){if(Pe(r))return{data:null,error:r};throw r}})}copy(t,n){return rt(this,void 0,void 0,function*(){try{return{data:{path:(yield Yt(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n},{headers:this.headers})).Key},error:null}}catch(r){if(Pe(r))return{data:null,error:r};throw r}})}createSignedUrl(t,n,r){return rt(this,void 0,void 0,function*(){try{let i=this._getFinalPath(t),o=yield Yt(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:n},r!=null&&r.transform?{transform:r.transform}:{}),{headers:this.headers});const s=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${s}`)},{data:o,error:null}}catch(i){if(Pe(i))return{data:null,error:i};throw i}})}createSignedUrls(t,n,r){return rt(this,void 0,void 0,function*(){try{const i=yield Yt(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:t},{headers:this.headers}),o=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return{data:i.map(s=>Object.assign(Object.assign({},s),{signedUrl:s.signedURL?encodeURI(`${this.url}${s.signedURL}${o}`):null})),error:null}}catch(i){if(Pe(i))return{data:null,error:i};throw i}})}download(t,n){return rt(this,void 0,void 0,function*(){const i=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),s=o?`?${o}`:"";try{const l=this._getFinalPath(t);return{data:yield(yield Tu(this.fetch,`${this.url}/${i}/${l}${s}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(l){if(Pe(l))return{data:null,error:l};throw l}})}getPublicUrl(t,n){const r=this._getFinalPath(t),i=[],o=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";o!==""&&i.push(o);const l=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",a=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});a!==""&&i.push(a);let u=i.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${r}${u}`)}}}remove(t){return rt(this,void 0,void 0,function*(){try{return{data:yield cg(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(n){if(Pe(n))return{data:null,error:n};throw n}})}list(t,n,r){return rt(this,void 0,void 0,function*(){try{const i=Object.assign(Object.assign(Object.assign({},sx),n),{prefix:t||""});return{data:yield Yt(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},r),error:null}}catch(i){if(Pe(i))return{data:null,error:i};throw i}})}_getFinalPath(t){return`${this.bucketId}/${t}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const n=[];return t.width&&n.push(`width=${t.width}`),t.height&&n.push(`height=${t.height}`),t.resize&&n.push(`resize=${t.resize}`),t.format&&n.push(`format=${t.format}`),t.quality&&n.push(`quality=${t.quality}`),n.join("&")}}const lx="2.5.4",ux={"X-Client-Info":`storage-js/${lx}`};var Yn=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};class cx{constructor(t,n={},r){this.url=t,this.headers=Object.assign(Object.assign({},ux),n),this.fetch=ug(r)}listBuckets(){return Yn(this,void 0,void 0,function*(){try{return{data:yield Tu(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(t){if(Pe(t))return{data:null,error:t};throw t}})}getBucket(t){return Yn(this,void 0,void 0,function*(){try{return{data:yield Tu(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(n){if(Pe(n))return{data:null,error:n};throw n}})}createBucket(t,n={public:!1}){return Yn(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/bucket`,{id:t,name:t,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(Pe(r))return{data:null,error:r};throw r}})}updateBucket(t,n){return Yn(this,void 0,void 0,function*(){try{return{data:yield ox(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(Pe(r))return{data:null,error:r};throw r}})}emptyBucket(t){return Yn(this,void 0,void 0,function*(){try{return{data:yield Yt(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(Pe(n))return{data:null,error:n};throw n}})}deleteBucket(t){return Yn(this,void 0,void 0,function*(){try{return{data:yield cg(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(Pe(n))return{data:null,error:n};throw n}})}}class dx extends cx{constructor(t,n={},r){super(t,n,r)}from(t){return new ax(this.url,this.headers,t,this.fetch)}}const fx="2.38.4";let ri="";typeof Deno<"u"?ri="deno":typeof document<"u"?ri="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ri="react-native":ri="node";const hx={"X-Client-Info":`supabase-js-${ri}/${fx}`};var px=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};const mx=e=>{let t;return e?t=e:typeof fetch>"u"?t=ed:t=fetch,(...n)=>t(...n)},vx=()=>typeof Headers>"u"?Zc.Headers:Headers,gx=(e,t,n)=>{const r=mx(n),i=vx();return(o,s)=>px(void 0,void 0,void 0,function*(){var l;const a=(l=yield t())!==null&&l!==void 0?l:e;let u=new i(s==null?void 0:s.headers);return u.has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization",`Bearer ${a}`),r(o,Object.assign(Object.assign({},s),{headers:u}))})};function yx(e){return e.replace(/\/$/,"")}function wx(e,t){const{db:n,auth:r,realtime:i,global:o}=e,{db:s,auth:l,realtime:a,global:u}=t;return{db:Object.assign(Object.assign({},s),n),auth:Object.assign(Object.assign({},l),r),realtime:Object.assign(Object.assign({},a),i),global:Object.assign(Object.assign({},u),o)}}function Sx(e){return Math.round(Date.now()/1e3)+e}function bx(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}const It=()=>typeof document<"u",On={tested:!1,writable:!1},vi=()=>{if(!It())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(On.tested)return On.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),On.tested=!0,On.writable=!0}catch{On.tested=!0,On.writable=!1}return On.writable};function pl(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,o)=>{t[o]=i})}catch{}return n.searchParams.forEach((r,i)=>{t[i]=r}),t}const dg=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Yi(()=>Promise.resolve().then(()=>Xi),void 0).then(({default:r})=>r(...n)):t=fetch,(...n)=>t(...n)},Ex=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Pn=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},Co=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},ml=async(e,t)=>{await e.removeItem(t)};function _x(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let n="",r,i,o,s,l,a,u,c=0;for(e=e.replace("-","+").replace("_","/");c>4,i=(l&15)<<4|a>>2,o=(a&3)<<6|u,n=n+String.fromCharCode(r),a!=64&&i!=0&&(n=n+String.fromCharCode(i)),u!=64&&o!=0&&(n=n+String.fromCharCode(o));return n}class ba{constructor(){this.promise=new ba.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}ba.promiseConstructor=Promise;function Eh(e){const t=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,n=e.split(".");if(n.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!t.test(n[1]))throw new Error("JWT is not valid: payload is not in base64url format");const r=n[1];return JSON.parse(_x(r))}async function Cx(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function xx(e,t){return new Promise((r,i)=>{(async()=>{for(let o=0;o<1/0;o++)try{const s=await e(o);if(!t(o,null,s)){r(s);return}}catch(s){if(!t(o,s)){i(s);return}}})()})}function kx(e){return("0"+e.toString(16)).substr(-2)}function Xn(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let i="";for(let o=0;o<56;o++)i+=n.charAt(Math.floor(Math.random()*r));return i}return crypto.getRandomValues(t),Array.from(t,kx).join("")}async function Ox(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(r);return Array.from(i).map(o=>String.fromCharCode(o)).join("")}function Px(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Zn(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await Ox(e);return Px(n)}class id extends Error{constructor(t,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n}}function N(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Tx extends id{constructor(t,n){super(t,n),this.name="AuthApiError",this.status=n}toJSON(){return{name:this.name,message:this.message,status:this.status}}}function $x(e){return N(e)&&e.name==="AuthApiError"}class fg extends id{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Nr extends id{constructor(t,n,r){super(t),this.name=n,this.status=r}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class er extends Nr{constructor(){super("Auth session missing!","AuthSessionMissingError",400)}}class vl extends Nr{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500)}}class xo extends Nr{constructor(t){super(t,"AuthInvalidCredentialsError",400)}}class ko extends Nr{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class _h extends Nr{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class $u extends Nr{constructor(t,n){super(t,"AuthRetryableFetchError",n)}}function Ch(e){return N(e)&&e.name==="AuthRetryableFetchError"}var Ax=globalThis&&globalThis.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);ie.msg||e.message||e.error_description||e.error||JSON.stringify(e),Ix=[502,503,504];async function xh(e){if(!Ex(e))throw new $u(ii(e),0);if(Ix.includes(e.status))throw new $u(ii(e),e.status);let t;try{t=await e.json()}catch(n){throw new fg(ii(n),n)}throw new Tx(ii(t),e.status||500)}const Rx=(e,t,n,r)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),n))};async function U(e,t,n,r){var i;const o=Object.assign({},r==null?void 0:r.headers);r!=null&&r.jwt&&(o.Authorization=`Bearer ${r.jwt}`);const s=(i=r==null?void 0:r.query)!==null&&i!==void 0?i:{};r!=null&&r.redirectTo&&(s.redirect_to=r.redirectTo);const l=Object.keys(s).length?"?"+new URLSearchParams(s).toString():"",a=await Dx(e,t,n+l,{headers:o,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(a):{data:Object.assign({},a),error:null}}async function Dx(e,t,n,r,i,o){const s=Rx(t,r,i,o);let l;try{l=await e(n,s)}catch(a){throw console.error(a),new $u(ii(a),0)}if(l.ok||await xh(l),r!=null&&r.noResolveJson)return l;try{return await l.json()}catch(a){await xh(a)}}function qt(e){var t;let n=null;Mx(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=Sx(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function nn(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Fx(e){return{data:e,error:null}}function jx(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:i,verification_type:o}=e,s=Ax(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:n,hashed_token:r,redirect_to:i,verification_type:o},a=Object.assign({},s);return{data:{properties:l,user:a},error:null}}function Lx(e){return e}function Mx(e){return e.access_token&&e.refresh_token&&e.expires_in}var Nx=globalThis&&globalThis.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i0&&(m.forEach(g=>{const v=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(g.split(";")[1].split("=")[1]);u[`${w}Page`]=v}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},d),u),error:null}}catch(u){if(N(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){try{return await U(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:nn})}catch(n){if(N(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){try{return await U(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:nn})}catch(r){if(N(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){try{return await U(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:nn})}catch(r){if(N(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){try{const{data:n,error:r}=await U(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:r}}catch(n){if(N(n))return{data:null,error:n};throw n}}async _deleteFactor(t){try{return{data:await U(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(N(n))return{data:null,error:n};throw n}}}const hg="2.57.0",zx="http://localhost:9999",Ux="supabase.auth.token",Bx={"X-Client-Info":`gotrue-js/${hg}`},kh=10,Hx={getItem:e=>vi()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{vi()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{vi()&&globalThis.localStorage.removeItem(e)}};function Oh(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}function Wx(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}globalThis&&vi()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class Kx extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}Wx();const Gx={url:zx,storageKey:Ux,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Bx,flowType:"implicit",debug:!1},Jr=30*1e3,Ph=3;async function qx(e,t,n){return await n()}class zi{constructor(t){var n;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=zi.nextInstanceID,zi.nextInstanceID+=1,this.instanceID>0&&It()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const r=Object.assign(Object.assign({},Gx),t);if(this.logDebugMessages=!!r.debug,typeof r.debug=="function"&&(this.logger=r.debug),this.persistSession=r.persistSession,this.storageKey=r.storageKey,this.autoRefreshToken=r.autoRefreshToken,this.admin=new Vx({url:r.url,headers:r.headers,fetch:r.fetch}),this.url=r.url,this.headers=r.headers,this.fetch=dg(r.fetch),this.lock=r.lock||qx,this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?r.storage?this.storage=r.storage:vi()?this.storage=Hx:(this.memoryStorage={},this.storage=Oh(this.memoryStorage)):(this.memoryStorage={},this.storage=Oh(this.memoryStorage)),It()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${hg}) ${new Date().toISOString()}`,...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){try{const t=It()?await this._isPKCEFlow():!1;if(this._debug("#_initialize()","begin","is PKCE flow",t),t||this.detectSessionInUrl&&this._isImplicitGrantFlow()){const{data:n,error:r}=await this._getSessionFromURL(t);if(r)return this._debug("#_initialize()","error detecting session from URL",r),await this._removeSession(),{error:r};const{session:i,redirectType:o}=n;return this._debug("#_initialize()","detected session in URL",i,"redirect type",o),await this._saveSession(i),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return N(t)?{error:t}:{error:new fg("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signUp(t){var n,r,i;try{await this._removeSession();let o;if("email"in t){const{email:c,password:d,options:f}=t;let m=null,g=null;if(this.flowType==="pkce"){const v=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,v),m=await Zn(v),g=v===m?"plain":"s256"}o=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:c,password:d,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:m,code_challenge_method:g},xform:qt})}else if("phone"in t){const{phone:c,password:d,options:f}=t;o=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:c,password:d,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},channel:(i=f==null?void 0:f.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:qt})}else throw new xo("You must provide either an email or phone number and a password");const{data:s,error:l}=o;if(l||!s)return{data:{user:null,session:null},error:l};const a=s.session,u=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:u,session:a},error:null}}catch(o){if(N(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(t){try{await this._removeSession();let n;if("email"in t){const{email:o,password:s,options:l}=t;n=await U(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:s,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:qt})}else if("phone"in t){const{phone:o,password:s,options:l}=t;n=await U(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:s,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:qt})}else throw new xo("You must provide either an email or phone number and a password");const{data:r,error:i}=n;return i?{data:{user:null,session:null},error:i}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new vl}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:{user:r.user,session:r.session},error:i})}catch(n){if(N(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(t){var n,r,i,o;return await this._removeSession(),await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(i=t.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(o=t.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async _exchangeCodeForSession(t){const n=await Co(this.storage,`${this.storageKey}-code-verifier`),{data:r,error:i}=await U(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:qt});return await ml(this.storage,`${this.storageKey}-code-verifier`),i?{data:{user:null,session:null},error:i}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new vl}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:r,error:i})}async signInWithIdToken(t){await this._removeSession();try{const{options:n,provider:r,token:i,access_token:o,nonce:s}=t,l=await U(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:i,access_token:o,nonce:s,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:qt}),{data:a,error:u}=l;return u?{data:{user:null,session:null},error:u}:!a||!a.session||!a.user?{data:{user:null,session:null},error:new vl}:(a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:a,error:u})}catch(n){if(N(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(t){var n,r,i,o,s;try{if(await this._removeSession(),"email"in t){const{email:l,options:a}=t;let u=null,c=null;if(this.flowType==="pkce"){const f=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,f),u=await Zn(f),c=f===u?"plain":"s256"}const{error:d}=await U(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(n=a==null?void 0:a.data)!==null&&n!==void 0?n:{},create_user:(r=a==null?void 0:a.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken},code_challenge:u,code_challenge_method:c},redirectTo:a==null?void 0:a.emailRedirectTo});return{data:{user:null,session:null},error:d}}if("phone"in t){const{phone:l,options:a}=t,{data:u,error:c}=await U(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(i=a==null?void 0:a.data)!==null&&i!==void 0?i:{},create_user:(o=a==null?void 0:a.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken},channel:(s=a==null?void 0:a.channel)!==null&&s!==void 0?s:"sms"}});return{data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:c}}throw new xo("You must provide either an email or phone number.")}catch(l){if(N(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(t){var n,r;try{t.type!=="email_change"&&t.type!=="phone_change"&&await this._removeSession();let i,o;"options"in t&&(i=(n=t.options)===null||n===void 0?void 0:n.redirectTo,o=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:s,error:l}=await U(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:o}}),redirectTo:i,xform:qt});if(l)throw l;if(!s)throw new Error("An error occurred on token verification.");const a=s.session,u=s.user;return a!=null&&a.access_token&&(await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:u,session:a},error:null}}catch(i){if(N(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithSSO(t){var n,r,i;try{await this._removeSession();let o=null,s=null;if(this.flowType==="pkce"){const l=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,l),o=await Zn(l),s=l===o?"plain":"s256"}return await U(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((i=t==null?void 0:t.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:s}),headers:this.headers,xform:Fx})}catch(o){if(N(o))return{data:null,error:o};throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new er;const{error:i}=await U(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:i}})}catch(t){if(N(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{t.type!="email_change"&&t.type!="phone_change"&&await this._removeSession();const n=`${this.url}/resend`;if("email"in t){const{email:r,type:i,options:o}=t,{error:s}=await U(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},redirectTo:o==null?void 0:o.emailRedirectTo});return{data:{user:null,session:null},error:s}}else if("phone"in t){const{phone:r,type:i,options:o}=t,{data:s,error:l}=await U(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return{data:{user:null,session:null,messageId:s==null?void 0:s.message_id},error:l}}throw new xo("You must provide either an email or phone number and a type")}catch(n){if(N(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,this._acquireLock(-1,async()=>this._useSession(async t=>t))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await Co(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r)return{data:{session:t},error:null};const{session:i,error:o}=await this._callRefreshToken(t.refresh_token);return o?{data:{session:null},error:o}:{data:{session:i},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(t){return t?await this._getUser(t):(await this.initializePromise,this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(t){try{return t?await U(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:nn}):await this._useSession(async n=>{var r,i;const{data:o,error:s}=n;if(s)throw s;return await U(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(r=o.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0,xform:nn})})}catch(n){if(N(n))return{data:{user:null},error:n};throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:i,error:o}=r;if(o)throw o;if(!i.session)throw new er;const s=i.session;let l=null,a=null;if(this.flowType==="pkce"&&t.email!=null){const d=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,d),l=await Zn(d),a=d===l?"plain":"s256"}const{data:u,error:c}=await U(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:a}),jwt:s.access_token,xform:nn});if(c)throw c;return s.user=u.user,await this._saveSession(s),await this._notifyAllSubscribers("USER_UPDATED",s),{data:{user:s.user},error:null}})}catch(r){if(N(r))return{data:{user:null},error:r};throw r}}_decodeJWT(t){return Eh(t)}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new er;const n=Date.now()/1e3;let r=n,i=!0,o=null;const s=Eh(t.access_token);if(s.exp&&(r=s.exp,i=r<=n),i){const{session:l,error:a}=await this._callRefreshToken(t.refresh_token);if(a)return{data:{user:null,session:null},error:a};if(!l)return{data:{user:null,session:null},error:null};o=l}else{const{data:l,error:a}=await this._getUser(t.access_token);if(a)throw a;o={access_token:t.access_token,refresh_token:t.refresh_token,user:l.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return{data:{user:o.user,session:o},error:null}}catch(n){if(N(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:s,error:l}=n;if(l)throw l;t=(r=s.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new er;const{session:i,error:o}=await this._callRefreshToken(t.refresh_token);return o?{data:{user:null,session:null},error:o}:i?{data:{user:i.user,session:i},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(N(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(t){try{if(!It())throw new ko("No browser detected.");if(this.flowType==="implicit"&&!this._isImplicitGrantFlow())throw new ko("Not a valid implicit grant flow url.");if(this.flowType=="pkce"&&!t)throw new _h("Not a valid PKCE flow url.");const n=pl(window.location.href);if(t){if(!n.code)throw new _h("No code detected.");const{data:p,error:y}=await this._exchangeCodeForSession(n.code);if(y)throw y;const S=new URL(window.location.href);return S.searchParams.delete("code"),window.history.replaceState(window.history.state,"",S.toString()),{data:{session:p.session,redirectType:null},error:null}}if(n.error||n.error_description||n.error_code)throw new ko(n.error_description||"Error in URL with unspecified error_description",{error:n.error||"unspecified_error",code:n.error_code||"unspecified_code"});const{provider_token:r,provider_refresh_token:i,access_token:o,refresh_token:s,expires_in:l,expires_at:a,token_type:u}=n;if(!o||!l||!s||!u)throw new ko("No session defined in URL");const c=Math.round(Date.now()/1e3),d=parseInt(l);let f=c+d;a&&(f=parseInt(a));const m=f-c;m*1e3<=Jr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${d}s`);const g=f-d;c-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,f,c):c-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",g,f,c);const{data:v,error:w}=await this._getUser(o);if(w)throw w;const h={provider_token:r,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:s,token_type:u,user:v.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:h,redirectType:n.type},error:null}}catch(n){if(N(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantFlow(){const t=pl(window.location.href);return!!(It()&&(t.access_token||t.error_description))}async _isPKCEFlow(){const t=pl(window.location.href),n=await Co(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:i,error:o}=n;if(o)return{error:o};const s=(r=i.session)===null||r===void 0?void 0:r.access_token;if(s){const{error:l}=await this.admin.signOut(s,t);if(l&&!($x(l)&&(l.status===404||l.status===401)))return{error:l}}return t!=="others"&&(await this._removeSession(),await ml(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(t){const n=bx(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,i;try{const{data:{session:o},error:s}=n;if(s)throw s;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",t,"session",o)}catch(o){await((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",o),console.error(o)}})}async resetPasswordForEmail(t,n={}){let r=null,i=null;if(this.flowType==="pkce"){const o=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,o),r=await Zn(o),i=o===r?"plain":"s256"}try{return await U(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(N(o))return{data:null,error:o};throw o}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await xx(async i=>(await Cx(i*200),this._debug(n,"refreshing attempt",i),await U(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:qt})),(i,o,s)=>s&&s.error&&Ch(s.error)&&Date.now()+(i+1)*200-r{try{await l.callback(t,n)}catch(a){o.push(a)}});if(await Promise.all(s),o.length>0){for(let l=0;lthis._autoRefreshTokenTick(),Jr);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((r.expires_at*1e3-t)/Jr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Jr}ms, refresh threshold is ${Ph} ticks`),i<=Ph&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof Kx)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!It()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n){const r=[`provider=${encodeURIComponent(t)}`];if(n!=null&&n.redirectTo&&r.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&r.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const i=Xn();await Pn(this.storage,`${this.storageKey}-code-verifier`,i);const o=await Zn(i),s=i===o?"plain":"s256";this._debug("PKCE","code verifier",`${i.substring(0,5)}...`,"code challenge",o,"method",s);const l=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(s)}`});r.push(l.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);r.push(i.toString())}return`${this.url}/authorize?${r.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:i,error:o}=n;return o?{data:null,error:o}:await U(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(N(n))return{data:null,error:n};throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,i;const{data:o,error:s}=n;if(s)return{data:null,error:s};const{data:l,error:a}=await U(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:t.friendlyName,factor_type:t.factorType,issuer:t.issuer},headers:this.headers,jwt:(r=o==null?void 0:o.session)===null||r===void 0?void 0:r.access_token});return a?{data:null,error:a}:(!((i=l==null?void 0:l.totp)===null||i===void 0)&&i.qr_code&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),{data:l,error:null})})}catch(n){if(N(n))return{data:null,error:n};throw n}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:o}=n;if(o)return{data:null,error:o};const{data:s,error:l}=await U(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:{code:t.code,challenge_id:t.challengeId},headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+s.expires_in},s)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",s),{data:s,error:l})})}catch(n){if(N(n))return{data:null,error:n};throw n}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:o}=n;return o?{data:null,error:o}:await U(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(N(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?{data:null,error:r}:await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){const{data:{user:t},error:n}=await this.getUser();if(n)return{data:null,error:n};const r=(t==null?void 0:t.factors)||[],i=r.filter(o=>o.factor_type==="totp"&&o.status==="verified");return{data:{all:r,totp:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async t=>{var n,r;const{data:{session:i},error:o}=t;if(o)return{data:null,error:o};if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const s=this._decodeJWT(i.access_token);let l=null;s.aal&&(l=s.aal);let a=l;((r=(n=i.user.factors)===null||n===void 0?void 0:n.filter(d=>d.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(a="aal2");const c=s.amr||[];return{data:{currentLevel:l,nextLevel:a,currentAuthenticationMethods:c},error:null}}))}}zi.nextInstanceID=0;class Qx extends zi{constructor(t){super(t)}}var Jx=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(c){try{u(r.next(c))}catch(d){s(d)}}function a(c){try{u(r.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((r=r.apply(e,t||[])).next())})};const Yx={headers:hx},Xx={schema:"public"},Zx={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},e2={};class t2{constructor(t,n,r){var i,o,s,l,a,u,c,d;if(this.supabaseUrl=t,this.supabaseKey=n,!t)throw new Error("supabaseUrl is required.");if(!n)throw new Error("supabaseKey is required.");const f=yx(t);this.realtimeUrl=`${f}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${f}/auth/v1`,this.storageUrl=`${f}/storage/v1`,this.functionsUrl=`${f}/functions/v1`;const m=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,g={db:Xx,realtime:e2,auth:Object.assign(Object.assign({},Zx),{storageKey:m}),global:Yx},v=wx(r??{},g);this.storageKey=(o=(i=v.auth)===null||i===void 0?void 0:i.storageKey)!==null&&o!==void 0?o:"",this.headers=(l=(s=v.global)===null||s===void 0?void 0:s.headers)!==null&&l!==void 0?l:{},this.auth=this._initSupabaseAuthClient((a=v.auth)!==null&&a!==void 0?a:{},this.headers,(u=v.global)===null||u===void 0?void 0:u.fetch),this.fetch=gx(n,this._getAccessToken.bind(this),(c=v.global)===null||c===void 0?void 0:c.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},v.realtime)),this.rest=new td(`${f}/rest/v1`,{headers:this.headers,schema:(d=v.db)===null||d===void 0?void 0:d.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new hC(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new dx(this.storageUrl,this.headers,this.fetch)}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,n={},r){return this.rest.rpc(t,n,r)}channel(t,n={config:{}}){return this.realtime.channel(t,n)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var t,n;return Jx(this,void 0,void 0,function*(){const{data:r}=yield this.auth.getSession();return(n=(t=r.session)===null||t===void 0?void 0:t.access_token)!==null&&n!==void 0?n:null})}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:n,detectSessionInUrl:r,storage:i,storageKey:o,flowType:s,debug:l},a,u){const c={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Qx({url:this.authUrl,headers:Object.assign(Object.assign({},c),a),storageKey:o,autoRefreshToken:t,persistSession:n,detectSessionInUrl:r,storage:i,flowType:s,debug:l,fetch:u})}_initRealtimeClient(t){return new ZC(this.realtimeUrl,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,r)=>{this._handleTokenChanged(n,"CLIENT",r==null?void 0:r.access_token)})}_handleTokenChanged(t,n,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.realtime.setAuth(r??null),this.changedAccessToken=r):t==="SIGNED_OUT"&&(this.realtime.setAuth(this.supabaseKey),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const n2=(e,t,n)=>new t2(e,t,n),r2="https://kyczonpiwdgrrfzzndtg.supabase.co",i2="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imt5Y3pvbnBpd2RncnJmenpuZHRnIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTE3NTUwNjUsImV4cCI6MjAwNzMzMTA2NX0.9WwSPA4ciXxd0xXIdYuUT3nXosBvH_Rm7IdO9mdl6_8",En=n2(r2,i2),gi=Ji("notes/getAsyncNotes",async(e,{rejectWithValue:t})=>{try{const{data:n}=await En.from("noteapp").select("*");return n}catch(n){return t(n.message)}}),Au=Ji("notes/addAsyncNotes",async(e,{rejectWithValue:t})=>{try{await En.from("noteapp").insert({title:e.title,description:e.description,category:e.category,completed:!1,date:Date.now()});const{data:n}=await En.from("noteapp").select("*");return n}catch(n){return t(n.message)}}),pg=Ji("notes/deleteAsyncNotes",async(e,{rejectWithValue:t})=>{try{return await En.from("noteapp").delete().eq("id",e.id),{id:e.id}}catch(n){return t(n.message)}}),mg=Ji("notes/toggleAsyncNote",async(e,{rejectWithValue:t})=>{try{await En.from("noteapp").update({completed:e.completed}).match({id:e.id});let{data:n}=await En.from("noteapp").select("*").eq("id",e.id);return n}catch(n){return t(n.message)}}),vg=Ji("notes/updateAsyncNote",async(e,{rejectWithValue:t})=>{try{await En.from("noteapp").update({title:e.title,description:e.description,category:e.category}).match({id:e.id});let{data:n}=await En.from("noteapp").select("*").eq("id",e.id);return console.log(n),n}catch(n){return t(n.message)}}),o2=Z_({name:"notes",initialState:{notes:[],loading:!1,error:""},extraReducers:{[gi.pending]:(e,t)=>{e.loading=!0,e.notes=[],e.error=""},[gi.fulfilled]:(e,t)=>{e.loading=!1,e.notes=t.payload},[gi.rejected]:(e,t)=>{e.loading=!1,e.error=t.payload,e.notes=[]},[Au.pending]:(e,t)=>{e.loading=!0},[Au.fulfilled]:(e,t)=>{e.loading=!1,e.notes=t.payload},[pg.fulfilled]:(e,t)=>{e.loading=!1,e.notes=e.notes.filter(n=>n.id!==t.payload.id)},[mg.fulfilled]:(e,t)=>{const n=e.notes.find(r=>r.id===t.payload[0].id);n.completed=t.payload[0].completed},[vg.fulfilled]:(e,t)=>{const n=e.notes.find(r=>r.id===t.payload[0].id);n.title=t.payload[0].title,n.description=t.payload[0].description,n.category=t.payload[0].category}}}),s2=o2.reducer,gg=b.createContext();function a2({children:e}){const[t,n]=b.useState("همه");return P.jsx(gg.Provider,{value:{selectedCat:t,setSelectedCat:n},children:e})}function Ea(){return b.useContext(gg)}function yg({isOpenModal:e,setIsOpenModal:t,editNote:n,setEditNote:r}){const[i,o]=b.useState(""),[s,l]=b.useState(""),[a,u]=b.useState(null),{loading:c}=Qi(v=>v.notes),d=Hc(),{setSelectedCat:f}=Ea();b.useEffect(()=>{o((n==null?void 0:n.title)||""),l((n==null?void 0:n.description)||""),n!=null&&n.title&&u({label:n==null?void 0:n.category})},[n]);const m=()=>{if(!i||!s||!a){Uo.error("پر کردن همه ی فیلدها الزامیست");return}d(Au({title:i,description:s,category:a.value})),o(""),l(""),u(null),f("همه"),setTimeout(()=>{Uo.success("یادداشت جدید اضافه شد")},1500)},g=()=>{d(vg({id:n.id,title:i,description:s,category:a==null?void 0:a.value})),t(!1),r(null),Uo.success("آپدیت انجام شد")};return e?P.jsxs("div",{children:[P.jsx("div",{onClick:()=>t(!1),className:"w-screen h-screen fixed inset-0 bg-purple-300 bg-opacity-80 duration-500"}),P.jsxs("div",{className:"bg-white z-20 rounded-md px-4 w-11/12 sm:w-3/5 min-h-[250px] -translate-x-1/2 -translate-y-1/2 absolute top-80 py-4 left-1/2 shadow-lg",children:[P.jsxs("div",{className:"mb-6",children:[P.jsx("h1",{className:"text-lg pb-2 text-slate-700 font-semibold",children:n?" تغییر دادن یادداشت":" اضافه کردن یادداشت"}),P.jsx("div",{className:"h-1 bg-purple-200 w-full"})]}),P.jsxs("div",{className:"grid grid-cols-9 gap-3",children:[P.jsx("input",{value:i,onChange:v=>o(v.target.value),className:"col-span-9 md:col-span-6 border border-[#d8b4fe] shadow-md p-2 outline-none text-primary bg-purple-100 rounded-md",type:"text",placeholder:"عنوان یادداشت..."}),P.jsx(LE,{selectedOption:a,setSelectedOption:u}),P.jsx("textarea",{value:s,onChange:v=>l(v.target.value),placeholder:"توضیحات...",className:"border border-[#d8b4fe] p-2 shadow-md outline-none col-span-9 md:col-span-6 h-56 bg-purple-100 rounded-md"})]}),P.jsxs("div",{className:"flex gap-4 mt-6 text-primary",children:[n?P.jsx("button",{disabled:c,onClick:g,className:` ${c?"opacity-50":"opacity-100"} px-4 py-1 shadow-md bg-purple-600 hover:bg-purple-500 text-white rounded-md`,children:"تغییر"}):P.jsx("button",{disabled:c,onClick:m,className:` ${c?"opacity-50":"opacity-100"} px-4 py-1 shadow-md bg-purple-600 hover:bg-purple-500 text-white rounded-md`,children:c?"در حال اضافه شدن":"اضافه"}),P.jsx("button",{onClick:()=>t(!1),className:"px-4 py-1 shadow-md text-primary border-2 border-red-400 hover:bg-red-400 rounded-md",children:"انصراف"})]})]})]}):null}const wg=b.createContext();function l2({children:e}){const[t,n]=b.useState(null),{notes:r}=Qi(o=>o.notes),i=Hc();return b.useEffect(()=>{i(gi())},[]),b.useEffect(()=>{n(r.filter(o=>o.category!=="همه"))},[r]),P.jsx(wg.Provider,{value:{selectedNotes:t,setSlectedNotes:n},children:e})}function od(){return b.useContext(wg)}function u2(){return P.jsxs("div",{className:"",children:[P.jsx(c2,{}),P.jsx(d2,{})]})}function c2(){const{selectedNotes:e,setSlectedNotes:t}=od(),{notes:n}=Qi(o=>o.notes),{setSelectedCat:r}=Ea(),i=o=>{const s=e.filter(l=>(l.title||l.description).toLowerCase().includes(o.target.value.toLowerCase()));!o.target.value==""?t(s):(t(n),r("همه"))};return P.jsxs("div",{className:"flex items-center p-3 w-full mb-5 shadow-md bg-white",children:[P.jsx(V1,{className:"text-primary w-5 h-5"}),P.jsx("input",{onChange:o=>i(o),type:"text",className:"capitalize outline-none mr-2 w-full text-primary",placeholder:"جستجو یادداشت..."})]})}function d2(){const{setSlectedNotes:e}=od(),[t,n]=b.useState(!1),{selectedCat:r,setSelectedCat:i}=Ea(),{notes:o}=Qi(l=>l.notes),s=l=>{i(l);const a=o.filter(u=>u.category===l);if(e(a),l==="همه")return e(o.filter(u=>u.category!=="همه"))};return P.jsxs(P.Fragment,{children:[P.jsxs("nav",{className:"flex flex-col-reverse md:flex-row justify-between py-6 items-start md:items-center",children:[P.jsxs("ul",{className:"flex gap-x-2 md:gap-x-9 md:pl-9 text-primary",children:[P.jsx("li",{onClick:()=>s("همه"),className:` ${r==="همه"&&"bg-blue-300"} before:bg-blue-300`,children:"همه"}),P.jsx("li",{onClick:()=>s("خانه"),className:` ${r==="خانه"&&"bg-orange-300"} before:bg-orange-300`,children:"خانه"}),P.jsx("li",{onClick:()=>s("کار"),className:`${r==="کار"&&"bg-purple-300"} before:bg-purple-300`,children:"کار"}),P.jsx("li",{onClick:()=>s("شخصی"),className:`${r==="شخصی"&&"bg-green-300"} before:bg-green-300`,children:"شخصی"})]}),P.jsxs("button",{onClick:()=>n(l=>!l),className:"bg-purple-500 mb-9 absolute top-3 right-1 md:static md:mb-0 hover:ring-2 duration-500 hover:bg-purple-600 hover:ring-purple-600 hover:ring-offset-2 hover:ring-offset-current py-[6px] px-4 justify-between flex items-center rounded-md text-white",children:[P.jsx(N1,{className:"w-5 h-5 ml-2"}),"اضافه کردن",P.jsx("span",{className:"mr-[6px] block",children:" یادداشت"})]})]}),P.jsx(yg,{isOpenModal:t,setIsOpenModal:n})]})}function f2(){return P.jsxs("div",{className:"flex items-center gap-4 my-4 w-full",children:[P.jsx(Gm,{style:{width:"1.3rem",height:"1.3rem"}}),P.jsx("p",{children:" دریافت اطلاعات..."})]})}function h2(){const[e,t]=b.useState(null),{selectedNotes:n}=od(),{setSelectedCat:r}=Ea(),[i,o]=b.useState(!1),{notes:s,loading:l,error:a}=Qi(f=>f.notes),u=Hc();b.useEffect(()=>{u(gi())},[]);const c=(f,m)=>{u(pg({id:f})),r("همه"),Uo.success(` ${m} حذف شد `)},d=(f,m,g,v)=>{t({id:f,title:m,description:g,category:v}),o(!0)};return s!=null&&s.length?P.jsxs("div",{children:[P.jsx(p2,{numOfAllNotes:s==null?void 0:s.length,numOfCompleted:s==null?void 0:s.filter(f=>f.completed===!0).length}),P.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:l?P.jsx(f2,{}):a?P.jsx("p",{children:"error ..."}):n==null?void 0:n.map(f=>{const g=new Date(Number(f.date)).toLocaleDateString("fa-IR");return P.jsxs("article",{className:` ${f.category==="کار"?"bg-purple-400":f.category==="خانه"?"bg-orange-400":"bg-green-400"} shadow-lg flex flex-col gap-11 rounded-md p-2 text-primary ${f.completed?"!bg-gray-500":""}`,children:[P.jsxs("div",{className:"flex justify-between items-center relative",children:[P.jsxs("div",{className:"flex gap-x-3",children:[P.jsx("input",{checked:f.completed,className:` ${f.completed&&"line-through"} w-5 h-5 duration-500 cursor-pointer relative peer shrink-0 appearance-none border-2 border-purple-500 rounded-[4px] bg-purple-200 mt-1 checked:bg-purple-800 checked:border-0 focus:outline-none focus:ring-offset-0 focus:ring-2 focus:ring-purple-300 disabled:border-steel-400 disabled:bg-steel-400`,type:"checkbox",onChange:()=>{u(mg({id:f.id,completed:!f.completed}))},name:"",id:""}),P.jsx("svg",{className:"absolute w-4 h-4 pointer-events-none hidden peer-checked:block stroke-white mt-1 outline-none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round",children:P.jsx("polyline",{points:"20 6 9 17 4 12"})}),P.jsx("h2",{className:`${f.completed?"line-through":""} font-semibold`,children:f.title})]}),P.jsxs("div",{className:"flex gap-x-3",children:[P.jsx("button",{onClick:()=>d(f.id,f.title,f.description,f.category),children:P.jsx(M1,{className:"w-5 h-5 text-primary"})}),P.jsx("button",{onClick:()=>c(f.id,f.title),children:P.jsx(z1,{className:"w-5 h-5 text-primary"})})]})]}),P.jsx("p",{className:`${f.completed?"line-through":""}`,children:f.description}),P.jsx("span",{className:`${f.completed?"line-through":""}`,children:g}),P.jsx(yg,{isOpenModal:i,setIsOpenModal:o,editNote:e,setEditNote:t})]},f.id)})})]}):P.jsxs("div",{className:"flex items-center justify-center mt-16 gap-x-2",children:[P.jsx("img",{src:"../../public/penciel.svg",alt:""}),P.jsx("p",{className:"text-lg sm:text-xl text-primary",children:"شما هنوز یادداشتی اضافه نکرده اید..."})]})}function p2({numOfAllNotes:e,numOfCompleted:t}){return P.jsxs("div",{className:"flex flex-col my-11 gap-y-2",children:[P.jsxs("span",{className:"text-xl text-slate-600 font-semibold",children:["شما ",t," از",e," یادداشت را انجام داده اید"]}),P.jsx("div",{className:"w-full h-1 bg-purple-200"})]})}function m2(){return P.jsxs("div",{className:"container relative py-20 mx-auto lg:max-w-[70vw] px-1",children:[P.jsx(F1,{}),P.jsx(u2,{}),P.jsx(h2,{})]})}const v2=Q_({reducer:{notes:s2}});function g2({children:e}){return P.jsx(l2,{children:P.jsx(a2,{children:e})})}gl.createRoot(document.getElementById("root")).render(P.jsx(g_,{store:v2,children:P.jsx(g2,{children:P.jsx(m2,{})})})); diff --git a/index.html b/index.html index ca4fbf8..3b00018 100644 --- a/index.html +++ b/index.html @@ -5,8 +5,8 @@ Note App - - + +