From a73b74ceaa414c4726faacf68ad2e06aa1bdabef Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Tue, 30 Jul 2024 18:39:00 -0300 Subject: [PATCH] updates on manager --- .../{index-BhBwBfey.js => index-BCs00WrS.js} | 116 +++++++++--------- manager/dist/index.html | 2 +- 2 files changed, 59 insertions(+), 59 deletions(-) rename manager/dist/assets/{index-BhBwBfey.js => index-BCs00WrS.js} (80%) diff --git a/manager/dist/assets/index-BhBwBfey.js b/manager/dist/assets/index-BCs00WrS.js similarity index 80% rename from manager/dist/assets/index-BhBwBfey.js rename to manager/dist/assets/index-BCs00WrS.js index 9e7e2b31..5c10eb32 100644 --- a/manager/dist/assets/index-BhBwBfey.js +++ b/manager/dist/assets/index-BCs00WrS.js @@ -1,4 +1,4 @@ -var cR=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $K=cR((jo,_o)=>{function yS(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function Km(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xS={exports:{}},Tf={},wS={exports:{}},et={};/** +var uR=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $K=uR((jo,_o)=>{function yS(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function Km(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xS={exports:{}},Tf={},wS={exports:{}},et={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var cR=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $K=cR((jo,_o) * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Zc=Symbol.for("react.element"),uR=Symbol.for("react.portal"),dR=Symbol.for("react.fragment"),fR=Symbol.for("react.strict_mode"),pR=Symbol.for("react.profiler"),hR=Symbol.for("react.provider"),gR=Symbol.for("react.context"),mR=Symbol.for("react.forward_ref"),vR=Symbol.for("react.suspense"),yR=Symbol.for("react.memo"),xR=Symbol.for("react.lazy"),cx=Symbol.iterator;function wR(e){return e===null||typeof e!="object"?null:(e=cx&&e[cx]||e["@@iterator"],typeof e=="function"?e:null)}var bS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},SS=Object.assign,CS={};function Ai(e,t,n){this.props=e,this.context=t,this.refs=CS,this.updater=n||bS}Ai.prototype.isReactComponent={};Ai.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ai.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function jS(){}jS.prototype=Ai.prototype;function qm(e,t,n){this.props=e,this.context=t,this.refs=CS,this.updater=n||bS}var Zm=qm.prototype=new jS;Zm.constructor=qm;SS(Zm,Ai.prototype);Zm.isPureReactComponent=!0;var ux=Array.isArray,_S=Object.prototype.hasOwnProperty,Jm={current:null},ES={key:!0,ref:!0,__self:!0,__source:!0};function TS(e,t,n){var r,o={},s=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(s=""+t.key),t)_S.call(t,r)&&!ES.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1()=>(t||e((t={exports:{}}).exports,t),t.exports);var $K=cR((jo,_o) * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var _R=v,ER=Symbol.for("react.element"),TR=Symbol.for("react.fragment"),kR=Object.prototype.hasOwnProperty,NR=_R.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,RR={key:!0,ref:!0,__self:!0,__source:!0};function NS(e,t,n){var r,o={},s=null,a=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)kR.call(t,r)&&!RR.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:ER,type:e,key:s,ref:a,props:o,_owner:NR.current}}Tf.Fragment=TR;Tf.jsx=NS;Tf.jsxs=NS;xS.exports=Tf;var i=xS.exports,ig={},RS={exports:{}},sr={},PS={exports:{}},IS={};/** + */var ER=v,TR=Symbol.for("react.element"),kR=Symbol.for("react.fragment"),NR=Object.prototype.hasOwnProperty,RR=ER.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,PR={key:!0,ref:!0,__self:!0,__source:!0};function NS(e,t,n){var r,o={},s=null,a=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)NR.call(t,r)&&!PR.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:TR,type:e,key:s,ref:a,props:o,_owner:RR.current}}Tf.Fragment=kR;Tf.jsx=NS;Tf.jsxs=NS;xS.exports=Tf;var i=xS.exports,ig={},RS={exports:{}},sr={},PS={exports:{}},IS={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var cR=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $K=cR((jo,_o) * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(z,L){var ee=z.length;z.push(L);e:for(;0>>1,B=z[fe];if(0>>1;feo(ie,ee))reo(W,ie)?(z[fe]=W,z[re]=ee,fe=re):(z[fe]=ie,z[X]=ee,fe=X);else if(reo(W,ee))z[fe]=W,z[re]=ee,fe=re;else break e}}return L}function o(z,L){var ee=z.sortIndex-L.sortIndex;return ee!==0?ee:z.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,p=null,f=3,h=!1,g=!1,m=!1,w=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(z){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=z)r(u),L.sortIndex=L.expirationTime,t(c,L);else break;L=n(u)}}function C(z){if(m=!1,b(z),!g)if(n(c)!==null)g=!0,ne(j);else{var L=n(u);L!==null&&K(C,L.startTime-z)}}function j(z,L){g=!1,m&&(m=!1,x(E),E=-1),h=!0;var ee=f;try{for(b(L),p=n(c);p!==null&&(!(p.expirationTime>L)||z&&!Z());){var fe=p.callback;if(typeof fe=="function"){p.callback=null,f=p.priorityLevel;var B=fe(p.expirationTime<=L);L=e.unstable_now(),typeof B=="function"?p.callback=B:p===n(c)&&r(c),b(L)}else r(c);p=n(c)}if(p!==null)var te=!0;else{var X=n(u);X!==null&&K(C,X.startTime-L),te=!1}return te}finally{p=null,f=ee,h=!1}}var S=!1,k=null,E=-1,O=5,F=-1;function Z(){return!(e.unstable_now()-Fz||125fe?(z.sortIndex=ee,t(u,z),n(c)===null&&z===n(u)&&(m?(x(E),E=-1):m=!0,K(C,ee-fe))):(z.sortIndex=B,t(c,z),g||h||(g=!0,ne(j))),z},e.unstable_shouldYield=Z,e.unstable_wrapCallback=function(z){var L=f;return function(){var ee=f;f=L;try{return z.apply(this,arguments)}finally{f=ee}}}})(IS);PS.exports=IS;var PR=PS.exports;/** + */(function(e){function t(z,L){var ee=z.length;z.push(L);e:for(;0>>1,B=z[fe];if(0>>1;feo(ie,ee))reo(W,ie)?(z[fe]=W,z[re]=ee,fe=re):(z[fe]=ie,z[X]=ee,fe=X);else if(reo(W,ee))z[fe]=W,z[re]=ee,fe=re;else break e}}return L}function o(z,L){var ee=z.sortIndex-L.sortIndex;return ee!==0?ee:z.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,p=null,f=3,h=!1,g=!1,m=!1,w=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(z){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=z)r(u),L.sortIndex=L.expirationTime,t(c,L);else break;L=n(u)}}function C(z){if(m=!1,b(z),!g)if(n(c)!==null)g=!0,ne(j);else{var L=n(u);L!==null&&K(C,L.startTime-z)}}function j(z,L){g=!1,m&&(m=!1,x(E),E=-1),h=!0;var ee=f;try{for(b(L),p=n(c);p!==null&&(!(p.expirationTime>L)||z&&!Z());){var fe=p.callback;if(typeof fe=="function"){p.callback=null,f=p.priorityLevel;var B=fe(p.expirationTime<=L);L=e.unstable_now(),typeof B=="function"?p.callback=B:p===n(c)&&r(c),b(L)}else r(c);p=n(c)}if(p!==null)var te=!0;else{var X=n(u);X!==null&&K(C,X.startTime-L),te=!1}return te}finally{p=null,f=ee,h=!1}}var S=!1,k=null,E=-1,O=5,F=-1;function Z(){return!(e.unstable_now()-Fz||125fe?(z.sortIndex=ee,t(u,z),n(c)===null&&z===n(u)&&(m?(x(E),E=-1):m=!0,K(C,ee-fe))):(z.sortIndex=B,t(c,z),g||h||(g=!0,ne(j))),z},e.unstable_shouldYield=Z,e.unstable_wrapCallback=function(z){var L=f;return function(){var ee=f;f=L;try{return z.apply(this,arguments)}finally{f=ee}}}})(IS);PS.exports=IS;var IR=PS.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ var cR=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $K=cR((jo,_o) * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var IR=v,rr=PR;function Y(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lg=Object.prototype.hasOwnProperty,DR=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,fx={},px={};function OR(e){return lg.call(px,e)?!0:lg.call(fx,e)?!1:DR.test(e)?px[e]=!0:(fx[e]=!0,!1)}function MR(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function AR(e,t,n,r){if(t===null||typeof t>"u"||MR(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Dn(e,t,n,r,o,s,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=a}var cn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){cn[e]=new Dn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];cn[t]=new Dn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){cn[e]=new Dn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){cn[e]=new Dn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){cn[e]=new Dn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){cn[e]=new Dn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){cn[e]=new Dn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){cn[e]=new Dn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){cn[e]=new Dn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Xm=/[\-:]([a-z])/g;function Qm(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Xm,Qm);cn[t]=new Dn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Xm,Qm);cn[t]=new Dn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Xm,Qm);cn[t]=new Dn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){cn[e]=new Dn(e,1,!1,e.toLowerCase(),null,!1,!1)});cn.xlinkHref=new Dn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){cn[e]=new Dn(e,1,!1,e.toLowerCase(),null,!0,!0)});function ev(e,t,n,r){var o=cn.hasOwnProperty(t)?cn[t]:null;(o!==null?o.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lg=Object.prototype.hasOwnProperty,OR=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,fx={},px={};function MR(e){return lg.call(px,e)?!0:lg.call(fx,e)?!1:OR.test(e)?px[e]=!0:(fx[e]=!0,!1)}function AR(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function FR(e,t,n,r){if(t===null||typeof t>"u"||AR(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Dn(e,t,n,r,o,s,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=a}var cn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){cn[e]=new Dn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];cn[t]=new Dn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){cn[e]=new Dn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){cn[e]=new Dn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){cn[e]=new Dn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){cn[e]=new Dn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){cn[e]=new Dn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){cn[e]=new Dn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){cn[e]=new Dn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Xm=/[\-:]([a-z])/g;function Qm(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Xm,Qm);cn[t]=new Dn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Xm,Qm);cn[t]=new Dn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Xm,Qm);cn[t]=new Dn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){cn[e]=new Dn(e,1,!1,e.toLowerCase(),null,!1,!1)});cn.xlinkHref=new Dn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){cn[e]=new Dn(e,1,!1,e.toLowerCase(),null,!0,!0)});function ev(e,t,n,r){var o=cn.hasOwnProperty(t)?cn[t]:null;(o!==null?o.type!==0:r||!(2l||o[a]!==s[l]){var c=` -`+o[a].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{Kp=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Tl(e):""}function FR(e){switch(e.tag){case 5:return Tl(e.type);case 16:return Tl("Lazy");case 13:return Tl("Suspense");case 19:return Tl("SuspenseList");case 0:case 2:case 15:return e=qp(e.type,!1),e;case 11:return e=qp(e.type.render,!1),e;case 1:return e=qp(e.type,!0),e;default:return""}}function fg(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ka:return"Fragment";case Wa:return"Portal";case cg:return"Profiler";case tv:return"StrictMode";case ug:return"Suspense";case dg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case MS:return(e.displayName||"Context")+".Consumer";case OS:return(e._context.displayName||"Context")+".Provider";case nv:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case rv:return t=e.displayName||null,t!==null?t:fg(e.type)||"Memo";case rs:t=e._payload,e=e._init;try{return fg(e(t))}catch{}}return null}function LR(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fg(t);case 8:return t===tv?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ss(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function FS(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function $R(e){var t=FS(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ju(e){e._valueTracker||(e._valueTracker=$R(e))}function LS(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=FS(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Td(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function pg(e,t){var n=t.checked;return Ot({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function gx(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ss(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function $S(e,t){t=t.checked,t!=null&&ev(e,"checked",t,!1)}function hg(e,t){$S(e,t);var n=Ss(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?gg(e,t.type,n):t.hasOwnProperty("defaultValue")&&gg(e,t.type,Ss(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function mx(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function gg(e,t,n){(t!=="number"||Td(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var kl=Array.isArray;function ci(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=_u.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function rc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ll={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},zR=["Webkit","ms","Moz","O"];Object.keys(Ll).forEach(function(e){zR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ll[t]=Ll[e]})});function BS(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ll.hasOwnProperty(e)&&Ll[e]?(""+t).trim():t+"px"}function HS(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=BS(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var VR=Ot({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function yg(e,t){if(t){if(VR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Y(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Y(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Y(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Y(62))}}function xg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wg=null;function ov(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bg=null,ui=null,di=null;function xx(e){if(e=Xc(e)){if(typeof bg!="function")throw Error(Y(280));var t=e.stateNode;t&&(t=Df(t),bg(e.stateNode,e.type,t))}}function GS(e){ui?di?di.push(e):di=[e]:ui=e}function WS(){if(ui){var e=ui,t=di;if(di=ui=null,xx(e),t)for(e=0;e>>=0,e===0?32:31-(XR(e)/QR|0)|0}var Eu=64,Tu=4194304;function Nl(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Pd(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~o;l!==0?r=Nl(l):(s&=a,s!==0&&(r=Nl(s)))}else a=n&~o,a!==0?r=Nl(a):s!==0&&(r=Nl(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,s=t&-t,o>=s||o===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Jc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Nr(t),e[t]=n}function rP(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=zl),kx=" ",Nx=!1;function fC(e,t){switch(e){case"keyup":return PP.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qa=!1;function DP(e,t){switch(e){case"compositionend":return pC(t);case"keypress":return t.which!==32?null:(Nx=!0,kx);case"textInput":return e=t.data,e===kx&&Nx?null:e;default:return null}}function OP(e,t){if(qa)return e==="compositionend"||!fv&&fC(e,t)?(e=uC(),sd=cv=cs=null,qa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Dx(n)}}function vC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yC(){for(var e=window,t=Td();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Td(e.document)}return t}function pv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function BP(e){var t=yC(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&vC(n.ownerDocument.documentElement,n)){if(r!==null&&pv(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,s=Math.min(r.start,o);r=r.end===void 0?s:Math.min(r.end,o),!e.extend&&s>r&&(o=r,r=s,s=o),o=Ox(n,s);var a=Ox(n,r);o&&a&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Za=null,Tg=null,Ul=null,kg=!1;function Mx(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kg||Za==null||Za!==Td(r)||(r=Za,"selectionStart"in r&&pv(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ul&&cc(Ul,r)||(Ul=r,r=Od(Tg,"onSelect"),0Xa||(e.current=Og[Xa],Og[Xa]=null,Xa--)}function gt(e,t){Xa++,Og[Xa]=e.current,e.current=t}var Cs={},wn=As(Cs),zn=As(!1),da=Cs;function Si(e,t){var n=e.type.contextTypes;if(!n)return Cs;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},s;for(s in n)o[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Vn(e){return e=e.childContextTypes,e!=null}function Ad(){jt(zn),jt(wn)}function Ux(e,t,n){if(wn.current!==Cs)throw Error(Y(168));gt(wn,t),gt(zn,n)}function TC(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(Y(108,LR(e)||"Unknown",o));return Ot({},n,r)}function Fd(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Cs,da=wn.current,gt(wn,e),gt(zn,zn.current),!0}function Bx(e,t,n){var r=e.stateNode;if(!r)throw Error(Y(169));n?(e=TC(e,t,da),r.__reactInternalMemoizedMergedChildContext=e,jt(zn),jt(wn),gt(wn,e)):jt(zn),gt(zn,n)}var xo=null,Of=!1,lh=!1;function kC(e){xo===null?xo=[e]:xo.push(e)}function tI(e){Of=!0,kC(e)}function Fs(){if(!lh&&xo!==null){lh=!0;var e=0,t=ct;try{var n=xo;for(ct=1;e>=a,o-=a,bo=1<<32-Nr(t)+o|n<E?(O=k,k=null):O=k.sibling;var F=f(x,k,b[E],C);if(F===null){k===null&&(k=O);break}e&&k&&F.alternate===null&&t(x,k),y=s(F,y,E),S===null?j=F:S.sibling=F,S=F,k=O}if(E===b.length)return n(x,k),Et&&Gs(x,E),j;if(k===null){for(;EE?(O=k,k=null):O=k.sibling;var Z=f(x,k,F.value,C);if(Z===null){k===null&&(k=O);break}e&&k&&Z.alternate===null&&t(x,k),y=s(Z,y,E),S===null?j=Z:S.sibling=Z,S=Z,k=O}if(F.done)return n(x,k),Et&&Gs(x,E),j;if(k===null){for(;!F.done;E++,F=b.next())F=p(x,F.value,C),F!==null&&(y=s(F,y,E),S===null?j=F:S.sibling=F,S=F);return Et&&Gs(x,E),j}for(k=r(x,k);!F.done;E++,F=b.next())F=h(k,x,E,F.value,C),F!==null&&(e&&F.alternate!==null&&k.delete(F.key===null?E:F.key),y=s(F,y,E),S===null?j=F:S.sibling=F,S=F);return e&&k.forEach(function(I){return t(x,I)}),Et&&Gs(x,E),j}function w(x,y,b,C){if(typeof b=="object"&&b!==null&&b.type===Ka&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Cu:e:{for(var j=b.key,S=y;S!==null;){if(S.key===j){if(j=b.type,j===Ka){if(S.tag===7){n(x,S.sibling),y=o(S,b.props.children),y.return=x,x=y;break e}}else if(S.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===rs&&Wx(j)===S.type){n(x,S.sibling),y=o(S,b.props),y.ref=dl(x,S,b),y.return=x,x=y;break e}n(x,S);break}else t(x,S);S=S.sibling}b.type===Ka?(y=sa(b.props.children,x.mode,C,b.key),y.return=x,x=y):(C=pd(b.type,b.key,b.props,null,x.mode,C),C.ref=dl(x,y,b),C.return=x,x=C)}return a(x);case Wa:e:{for(S=b.key;y!==null;){if(y.key===S)if(y.tag===4&&y.stateNode.containerInfo===b.containerInfo&&y.stateNode.implementation===b.implementation){n(x,y.sibling),y=o(y,b.children||[]),y.return=x,x=y;break e}else{n(x,y);break}else t(x,y);y=y.sibling}y=mh(b,x.mode,C),y.return=x,x=y}return a(x);case rs:return S=b._init,w(x,y,S(b._payload),C)}if(kl(b))return g(x,y,b,C);if(al(b))return m(x,y,b,C);Ou(x,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,y!==null&&y.tag===6?(n(x,y.sibling),y=o(y,b),y.return=x,x=y):(n(x,y),y=gh(b,x.mode,C),y.return=x,x=y),a(x)):n(x,y)}return w}var ji=IC(!0),DC=IC(!1),zd=As(null),Vd=null,ti=null,vv=null;function yv(){vv=ti=Vd=null}function xv(e){var t=zd.current;jt(zd),e._currentValue=t}function Fg(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function pi(e,t){Vd=e,vv=ti=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&($n=!0),e.firstContext=null)}function vr(e){var t=e._currentValue;if(vv!==e)if(e={context:e,memoizedValue:t,next:null},ti===null){if(Vd===null)throw Error(Y(308));ti=e,Vd.dependencies={lanes:0,firstContext:e}}else ti=ti.next=e;return t}var Ys=null;function wv(e){Ys===null?Ys=[e]:Ys.push(e)}function OC(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,wv(t)):(n.next=o.next,o.next=n),t.interleaved=n,Po(e,r)}function Po(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var os=!1;function bv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function MC(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Eo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ys(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,nt&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Po(e,n)}return o=r.interleaved,o===null?(t.next=t,wv(r)):(t.next=o.next,o.next=t),r.interleaved=t,Po(e,n)}function id(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,av(e,n)}}function Kx(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?o=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?o=s=t:s=s.next=t}else o=s=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ud(e,t,n,r){var o=e.updateQueue;os=!1;var s=o.firstBaseUpdate,a=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?s=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(s!==null){var p=o.baseState;a=0,d=u=c=null,l=s;do{var f=l.lane,h=l.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,m=l;switch(f=t,h=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){p=g.call(h,p,f);break e}p=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,f=typeof g=="function"?g.call(h,p,f):g,f==null)break e;p=Ot({},p,f);break e;case 2:os=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=o.effects,f===null?o.effects=[l]:f.push(l))}else h={eventTime:h,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=p):d=d.next=h,a|=f;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;f=l,l=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(d===null&&(c=p),o.baseState=c,o.firstBaseUpdate=u,o.lastBaseUpdate=d,t=o.shared.interleaved,t!==null){o=t;do a|=o.lane,o=o.next;while(o!==t)}else s===null&&(o.shared.lanes=0);ha|=a,e.lanes=a,e.memoizedState=p}}function qx(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=uh.transition;uh.transition={};try{e(!1),t()}finally{ct=n,uh.transition=r}}function XC(){return yr().memoizedState}function sI(e,t,n){var r=ws(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},QC(e))ej(t,n);else if(n=OC(e,t,n,r),n!==null){var o=Rn();Rr(n,e,r,o),tj(n,t,r)}}function aI(e,t,n){var r=ws(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(QC(e))ej(t,o);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,l=s(a,n);if(o.hasEagerState=!0,o.eagerState=l,Ar(l,a)){var c=t.interleaved;c===null?(o.next=o,wv(t)):(o.next=c.next,c.next=o),t.interleaved=o;return}}catch{}finally{}n=OC(e,t,o,r),n!==null&&(o=Rn(),Rr(n,e,r,o),tj(n,t,r))}}function QC(e){var t=e.alternate;return e===It||t!==null&&t===It}function ej(e,t){Bl=Hd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tj(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,av(e,n)}}var Gd={readContext:vr,useCallback:pn,useContext:pn,useEffect:pn,useImperativeHandle:pn,useInsertionEffect:pn,useLayoutEffect:pn,useMemo:pn,useReducer:pn,useRef:pn,useState:pn,useDebugValue:pn,useDeferredValue:pn,useTransition:pn,useMutableSource:pn,useSyncExternalStore:pn,useId:pn,unstable_isNewReconciler:!1},iI={readContext:vr,useCallback:function(e,t){return qr().memoizedState=[e,t===void 0?null:t],e},useContext:vr,useEffect:Jx,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,cd(4194308,4,KC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cd(4194308,4,e,t)},useInsertionEffect:function(e,t){return cd(4,2,e,t)},useMemo:function(e,t){var n=qr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=qr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=sI.bind(null,It,e),[r.memoizedState,e]},useRef:function(e){var t=qr();return e={current:e},t.memoizedState=e},useState:Zx,useDebugValue:Nv,useDeferredValue:function(e){return qr().memoizedState=e},useTransition:function(){var e=Zx(!1),t=e[0];return e=oI.bind(null,e[1]),qr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=It,o=qr();if(Et){if(n===void 0)throw Error(Y(407));n=n()}else{if(n=t(),en===null)throw Error(Y(349));pa&30||$C(r,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,Jx(VC.bind(null,r,s,e),[e]),r.flags|=2048,vc(9,zC.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=qr(),t=en.identifierPrefix;if(Et){var n=So,r=bo;n=(r&~(1<<32-Nr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=gc++,0")&&(c=c.replace("",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{Kp=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Tl(e):""}function LR(e){switch(e.tag){case 5:return Tl(e.type);case 16:return Tl("Lazy");case 13:return Tl("Suspense");case 19:return Tl("SuspenseList");case 0:case 2:case 15:return e=qp(e.type,!1),e;case 11:return e=qp(e.type.render,!1),e;case 1:return e=qp(e.type,!0),e;default:return""}}function fg(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case qa:return"Fragment";case Ka:return"Portal";case cg:return"Profiler";case tv:return"StrictMode";case ug:return"Suspense";case dg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case MS:return(e.displayName||"Context")+".Consumer";case OS:return(e._context.displayName||"Context")+".Provider";case nv:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case rv:return t=e.displayName||null,t!==null?t:fg(e.type)||"Memo";case rs:t=e._payload,e=e._init;try{return fg(e(t))}catch{}}return null}function $R(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fg(t);case 8:return t===tv?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ss(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function FS(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function zR(e){var t=FS(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ju(e){e._valueTracker||(e._valueTracker=zR(e))}function LS(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=FS(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Td(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function pg(e,t){var n=t.checked;return Ot({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function gx(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ss(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function $S(e,t){t=t.checked,t!=null&&ev(e,"checked",t,!1)}function hg(e,t){$S(e,t);var n=Ss(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?gg(e,t.type,n):t.hasOwnProperty("defaultValue")&&gg(e,t.type,Ss(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function mx(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function gg(e,t,n){(t!=="number"||Td(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var kl=Array.isArray;function ui(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=_u.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function rc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ll={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},VR=["Webkit","ms","Moz","O"];Object.keys(Ll).forEach(function(e){VR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ll[t]=Ll[e]})});function BS(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ll.hasOwnProperty(e)&&Ll[e]?(""+t).trim():t+"px"}function HS(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=BS(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var UR=Ot({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function yg(e,t){if(t){if(UR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Y(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Y(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Y(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Y(62))}}function xg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wg=null;function ov(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bg=null,di=null,fi=null;function xx(e){if(e=Xc(e)){if(typeof bg!="function")throw Error(Y(280));var t=e.stateNode;t&&(t=Df(t),bg(e.stateNode,e.type,t))}}function GS(e){di?fi?fi.push(e):fi=[e]:di=e}function WS(){if(di){var e=di,t=fi;if(fi=di=null,xx(e),t)for(e=0;e>>=0,e===0?32:31-(QR(e)/eP|0)|0}var Eu=64,Tu=4194304;function Nl(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Pd(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~o;l!==0?r=Nl(l):(s&=a,s!==0&&(r=Nl(s)))}else a=n&~o,a!==0?r=Nl(a):s!==0&&(r=Nl(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,s=t&-t,o>=s||o===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Jc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Nr(t),e[t]=n}function oP(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=zl),kx=" ",Nx=!1;function fC(e,t){switch(e){case"keyup":return IP.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Za=!1;function OP(e,t){switch(e){case"compositionend":return pC(t);case"keypress":return t.which!==32?null:(Nx=!0,kx);case"textInput":return e=t.data,e===kx&&Nx?null:e;default:return null}}function MP(e,t){if(Za)return e==="compositionend"||!fv&&fC(e,t)?(e=uC(),sd=cv=cs=null,Za=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Dx(n)}}function vC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yC(){for(var e=window,t=Td();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Td(e.document)}return t}function pv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function HP(e){var t=yC(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&vC(n.ownerDocument.documentElement,n)){if(r!==null&&pv(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,s=Math.min(r.start,o);r=r.end===void 0?s:Math.min(r.end,o),!e.extend&&s>r&&(o=r,r=s,s=o),o=Ox(n,s);var a=Ox(n,r);o&&a&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ja=null,Tg=null,Ul=null,kg=!1;function Mx(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kg||Ja==null||Ja!==Td(r)||(r=Ja,"selectionStart"in r&&pv(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ul&&cc(Ul,r)||(Ul=r,r=Od(Tg,"onSelect"),0Qa||(e.current=Og[Qa],Og[Qa]=null,Qa--)}function gt(e,t){Qa++,Og[Qa]=e.current,e.current=t}var Cs={},wn=As(Cs),zn=As(!1),da=Cs;function Ci(e,t){var n=e.type.contextTypes;if(!n)return Cs;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},s;for(s in n)o[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Vn(e){return e=e.childContextTypes,e!=null}function Ad(){jt(zn),jt(wn)}function Ux(e,t,n){if(wn.current!==Cs)throw Error(Y(168));gt(wn,t),gt(zn,n)}function TC(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(Y(108,$R(e)||"Unknown",o));return Ot({},n,r)}function Fd(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Cs,da=wn.current,gt(wn,e),gt(zn,zn.current),!0}function Bx(e,t,n){var r=e.stateNode;if(!r)throw Error(Y(169));n?(e=TC(e,t,da),r.__reactInternalMemoizedMergedChildContext=e,jt(zn),jt(wn),gt(wn,e)):jt(zn),gt(zn,n)}var xo=null,Of=!1,lh=!1;function kC(e){xo===null?xo=[e]:xo.push(e)}function nI(e){Of=!0,kC(e)}function Fs(){if(!lh&&xo!==null){lh=!0;var e=0,t=ct;try{var n=xo;for(ct=1;e>=a,o-=a,bo=1<<32-Nr(t)+o|n<E?(O=k,k=null):O=k.sibling;var F=f(x,k,b[E],C);if(F===null){k===null&&(k=O);break}e&&k&&F.alternate===null&&t(x,k),y=s(F,y,E),S===null?j=F:S.sibling=F,S=F,k=O}if(E===b.length)return n(x,k),Et&&Gs(x,E),j;if(k===null){for(;EE?(O=k,k=null):O=k.sibling;var Z=f(x,k,F.value,C);if(Z===null){k===null&&(k=O);break}e&&k&&Z.alternate===null&&t(x,k),y=s(Z,y,E),S===null?j=Z:S.sibling=Z,S=Z,k=O}if(F.done)return n(x,k),Et&&Gs(x,E),j;if(k===null){for(;!F.done;E++,F=b.next())F=p(x,F.value,C),F!==null&&(y=s(F,y,E),S===null?j=F:S.sibling=F,S=F);return Et&&Gs(x,E),j}for(k=r(x,k);!F.done;E++,F=b.next())F=h(k,x,E,F.value,C),F!==null&&(e&&F.alternate!==null&&k.delete(F.key===null?E:F.key),y=s(F,y,E),S===null?j=F:S.sibling=F,S=F);return e&&k.forEach(function(I){return t(x,I)}),Et&&Gs(x,E),j}function w(x,y,b,C){if(typeof b=="object"&&b!==null&&b.type===qa&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Cu:e:{for(var j=b.key,S=y;S!==null;){if(S.key===j){if(j=b.type,j===qa){if(S.tag===7){n(x,S.sibling),y=o(S,b.props.children),y.return=x,x=y;break e}}else if(S.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===rs&&Wx(j)===S.type){n(x,S.sibling),y=o(S,b.props),y.ref=dl(x,S,b),y.return=x,x=y;break e}n(x,S);break}else t(x,S);S=S.sibling}b.type===qa?(y=sa(b.props.children,x.mode,C,b.key),y.return=x,x=y):(C=pd(b.type,b.key,b.props,null,x.mode,C),C.ref=dl(x,y,b),C.return=x,x=C)}return a(x);case Ka:e:{for(S=b.key;y!==null;){if(y.key===S)if(y.tag===4&&y.stateNode.containerInfo===b.containerInfo&&y.stateNode.implementation===b.implementation){n(x,y.sibling),y=o(y,b.children||[]),y.return=x,x=y;break e}else{n(x,y);break}else t(x,y);y=y.sibling}y=mh(b,x.mode,C),y.return=x,x=y}return a(x);case rs:return S=b._init,w(x,y,S(b._payload),C)}if(kl(b))return g(x,y,b,C);if(al(b))return m(x,y,b,C);Ou(x,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,y!==null&&y.tag===6?(n(x,y.sibling),y=o(y,b),y.return=x,x=y):(n(x,y),y=gh(b,x.mode,C),y.return=x,x=y),a(x)):n(x,y)}return w}var _i=IC(!0),DC=IC(!1),zd=As(null),Vd=null,ni=null,vv=null;function yv(){vv=ni=Vd=null}function xv(e){var t=zd.current;jt(zd),e._currentValue=t}function Fg(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function hi(e,t){Vd=e,vv=ni=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&($n=!0),e.firstContext=null)}function vr(e){var t=e._currentValue;if(vv!==e)if(e={context:e,memoizedValue:t,next:null},ni===null){if(Vd===null)throw Error(Y(308));ni=e,Vd.dependencies={lanes:0,firstContext:e}}else ni=ni.next=e;return t}var Ys=null;function wv(e){Ys===null?Ys=[e]:Ys.push(e)}function OC(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,wv(t)):(n.next=o.next,o.next=n),t.interleaved=n,Po(e,r)}function Po(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var os=!1;function bv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function MC(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Eo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ys(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,nt&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Po(e,n)}return o=r.interleaved,o===null?(t.next=t,wv(r)):(t.next=o.next,o.next=t),r.interleaved=t,Po(e,n)}function id(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,av(e,n)}}function Kx(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?o=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?o=s=t:s=s.next=t}else o=s=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ud(e,t,n,r){var o=e.updateQueue;os=!1;var s=o.firstBaseUpdate,a=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?s=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(s!==null){var p=o.baseState;a=0,d=u=c=null,l=s;do{var f=l.lane,h=l.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,m=l;switch(f=t,h=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){p=g.call(h,p,f);break e}p=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,f=typeof g=="function"?g.call(h,p,f):g,f==null)break e;p=Ot({},p,f);break e;case 2:os=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=o.effects,f===null?o.effects=[l]:f.push(l))}else h={eventTime:h,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=p):d=d.next=h,a|=f;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;f=l,l=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(d===null&&(c=p),o.baseState=c,o.firstBaseUpdate=u,o.lastBaseUpdate=d,t=o.shared.interleaved,t!==null){o=t;do a|=o.lane,o=o.next;while(o!==t)}else s===null&&(o.shared.lanes=0);ha|=a,e.lanes=a,e.memoizedState=p}}function qx(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=uh.transition;uh.transition={};try{e(!1),t()}finally{ct=n,uh.transition=r}}function XC(){return yr().memoizedState}function aI(e,t,n){var r=ws(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},QC(e))ej(t,n);else if(n=OC(e,t,n,r),n!==null){var o=Rn();Rr(n,e,r,o),tj(n,t,r)}}function iI(e,t,n){var r=ws(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(QC(e))ej(t,o);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,l=s(a,n);if(o.hasEagerState=!0,o.eagerState=l,Ar(l,a)){var c=t.interleaved;c===null?(o.next=o,wv(t)):(o.next=c.next,c.next=o),t.interleaved=o;return}}catch{}finally{}n=OC(e,t,o,r),n!==null&&(o=Rn(),Rr(n,e,r,o),tj(n,t,r))}}function QC(e){var t=e.alternate;return e===It||t!==null&&t===It}function ej(e,t){Bl=Hd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tj(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,av(e,n)}}var Gd={readContext:vr,useCallback:pn,useContext:pn,useEffect:pn,useImperativeHandle:pn,useInsertionEffect:pn,useLayoutEffect:pn,useMemo:pn,useReducer:pn,useRef:pn,useState:pn,useDebugValue:pn,useDeferredValue:pn,useTransition:pn,useMutableSource:pn,useSyncExternalStore:pn,useId:pn,unstable_isNewReconciler:!1},lI={readContext:vr,useCallback:function(e,t){return qr().memoizedState=[e,t===void 0?null:t],e},useContext:vr,useEffect:Jx,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,cd(4194308,4,KC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cd(4194308,4,e,t)},useInsertionEffect:function(e,t){return cd(4,2,e,t)},useMemo:function(e,t){var n=qr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=qr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=aI.bind(null,It,e),[r.memoizedState,e]},useRef:function(e){var t=qr();return e={current:e},t.memoizedState=e},useState:Zx,useDebugValue:Nv,useDeferredValue:function(e){return qr().memoizedState=e},useTransition:function(){var e=Zx(!1),t=e[0];return e=sI.bind(null,e[1]),qr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=It,o=qr();if(Et){if(n===void 0)throw Error(Y(407));n=n()}else{if(n=t(),en===null)throw Error(Y(349));pa&30||$C(r,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,Jx(VC.bind(null,r,s,e),[e]),r.flags|=2048,vc(9,zC.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=qr(),t=en.identifierPrefix;if(Et){var n=So,r=bo;n=(r&~(1<<32-Nr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=gc++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Zr]=t,e[fc]=r,dj(e,t,!1,!1),t.stateNode=e;e:{switch(a=xg(n,r),n){case"dialog":wt("cancel",e),wt("close",e),o=r;break;case"iframe":case"object":case"embed":wt("load",e),o=r;break;case"video":case"audio":for(o=0;oTi&&(t.flags|=128,r=!0,fl(s,!1),t.lanes=4194304)}else{if(!r)if(e=Bd(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),fl(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!Et)return hn(t),null}else 2*zt()-s.renderingStartTime>Ti&&n!==1073741824&&(t.flags|=128,r=!0,fl(s,!1),t.lanes=4194304);s.isBackwards?(a.sibling=t.child,t.child=a):(n=s.last,n!==null?n.sibling=a:t.child=a,s.last=a)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=zt(),t.sibling=null,n=Pt.current,gt(Pt,r?n&1|2:n&1),t):(hn(t),null);case 22:case 23:return Mv(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Kn&1073741824&&(hn(t),t.subtreeFlags&6&&(t.flags|=8192)):hn(t),null;case 24:return null;case 25:return null}throw Error(Y(156,t.tag))}function gI(e,t){switch(gv(t),t.tag){case 1:return Vn(t.type)&&Ad(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return _i(),jt(zn),jt(wn),jv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Cv(t),null;case 13:if(jt(Pt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Y(340));Ci()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return jt(Pt),null;case 4:return _i(),null;case 10:return xv(t.type._context),null;case 22:case 23:return Mv(),null;case 24:return null;default:return null}}var Au=!1,yn=!1,mI=typeof WeakSet=="function"?WeakSet:Set,xe=null;function ni(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){At(e,t,r)}else n.current=null}function Wg(e,t,n){try{n()}catch(r){At(e,t,r)}}var iw=!1;function vI(e,t){if(Ng=Id,e=yC(),pv(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,p=e,f=null;t:for(;;){for(var h;p!==n||o!==0&&p.nodeType!==3||(l=a+o),p!==s||r!==0&&p.nodeType!==3||(c=a+r),p.nodeType===3&&(a+=p.nodeValue.length),(h=p.firstChild)!==null;)f=p,p=h;for(;;){if(p===e)break t;if(f===n&&++u===o&&(l=a),f===s&&++d===r&&(c=a),(h=p.nextSibling)!==null)break;p=f,f=p.parentNode}p=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Rg={focusedElem:e,selectionRange:n},Id=!1,xe=t;xe!==null;)if(t=xe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xe=e;else for(;xe!==null;){t=xe;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,w=g.memoizedState,x=t.stateNode,y=x.getSnapshotBeforeUpdate(t.elementType===t.type?m:Cr(t.type,m),w);x.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Y(163))}}catch(C){At(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,xe=e;break}xe=t.return}return g=iw,iw=!1,g}function Hl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var s=o.destroy;o.destroy=void 0,s!==void 0&&Wg(t,n,s)}o=o.next}while(o!==r)}}function Ff(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Kg(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function hj(e){var t=e.alternate;t!==null&&(e.alternate=null,hj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Zr],delete t[fc],delete t[Dg],delete t[QP],delete t[eI])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function gj(e){return e.tag===5||e.tag===3||e.tag===4}function lw(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gj(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Md));else if(r!==4&&(e=e.child,e!==null))for(qg(e,t,n),e=e.sibling;e!==null;)qg(e,t,n),e=e.sibling}function Zg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Zg(e,t,n),e=e.sibling;e!==null;)Zg(e,t,n),e=e.sibling}var an=null,jr=!1;function Yo(e,t,n){for(n=n.child;n!==null;)mj(e,t,n),n=n.sibling}function mj(e,t,n){if(eo&&typeof eo.onCommitFiberUnmount=="function")try{eo.onCommitFiberUnmount(Nf,n)}catch{}switch(n.tag){case 5:yn||ni(n,t);case 6:var r=an,o=jr;an=null,Yo(e,t,n),an=r,jr=o,an!==null&&(jr?(e=an,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):an.removeChild(n.stateNode));break;case 18:an!==null&&(jr?(e=an,n=n.stateNode,e.nodeType===8?ih(e.parentNode,n):e.nodeType===1&&ih(e,n),ic(e)):ih(an,n.stateNode));break;case 4:r=an,o=jr,an=n.stateNode.containerInfo,jr=!0,Yo(e,t,n),an=r,jr=o;break;case 0:case 11:case 14:case 15:if(!yn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var s=o,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&Wg(n,t,a),o=o.next}while(o!==r)}Yo(e,t,n);break;case 1:if(!yn&&(ni(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){At(n,t,l)}Yo(e,t,n);break;case 21:Yo(e,t,n);break;case 22:n.mode&1?(yn=(r=yn)||n.memoizedState!==null,Yo(e,t,n),yn=r):Yo(e,t,n);break;default:Yo(e,t,n)}}function cw(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new mI),t.forEach(function(r){var o=EI.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Sr(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=a),r&=~s}if(r=o,r=zt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*xI(r/1960))-r,10e?16:e,us===null)var r=!1;else{if(e=us,us=null,qd=0,nt&6)throw Error(Y(331));var o=nt;for(nt|=4,xe=e.current;xe!==null;){var s=xe,a=s.child;if(xe.flags&16){var l=s.deletions;if(l!==null){for(var c=0;czt()-Dv?oa(e,0):Iv|=n),Un(e,t)}function jj(e,t){t===0&&(e.mode&1?(t=Tu,Tu<<=1,!(Tu&130023424)&&(Tu=4194304)):t=1);var n=Rn();e=Po(e,t),e!==null&&(Jc(e,t,n),Un(e,n))}function _I(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),jj(e,n)}function EI(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Y(314))}r!==null&&r.delete(t),jj(e,n)}var _j;_j=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||zn.current)$n=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return $n=!1,pI(e,t,n);$n=!!(e.flags&131072)}else $n=!1,Et&&t.flags&1048576&&NC(t,$d,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ud(e,t),e=t.pendingProps;var o=Si(t,wn.current);pi(t,n),o=Ev(null,t,r,e,o,n);var s=Tv();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Vn(r)?(s=!0,Fd(t)):s=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,bv(t),o.updater=Af,t.stateNode=o,o._reactInternals=t,$g(t,r,e,n),t=Ug(null,t,r,!0,s,n)):(t.tag=0,Et&&s&&hv(t),Tn(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ud(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=kI(r),e=Cr(r,e),o){case 0:t=Vg(null,t,r,e,n);break e;case 1:t=ow(null,t,r,e,n);break e;case 11:t=nw(null,t,r,e,n);break e;case 14:t=rw(null,t,r,Cr(r.type,e),n);break e}throw Error(Y(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Cr(r,o),Vg(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Cr(r,o),ow(e,t,r,o,n);case 3:e:{if(lj(t),e===null)throw Error(Y(387));r=t.pendingProps,s=t.memoizedState,o=s.element,MC(e,t),Ud(t,r,null,n);var a=t.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){o=Ei(Error(Y(423)),t),t=sw(e,t,r,n,o);break e}else if(r!==o){o=Ei(Error(Y(424)),t),t=sw(e,t,r,n,o);break e}else for(Yn=vs(t.stateNode.containerInfo.firstChild),Qn=t,Et=!0,Er=null,n=DC(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ci(),r===o){t=Io(e,t,n);break e}Tn(e,t,r,n)}t=t.child}return t;case 5:return AC(t),e===null&&Ag(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,a=o.children,Pg(r,o)?a=null:s!==null&&Pg(r,s)&&(t.flags|=32),ij(e,t),Tn(e,t,a,n),t.child;case 6:return e===null&&Ag(t),null;case 13:return cj(e,t,n);case 4:return Sv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ji(t,null,r,n):Tn(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Cr(r,o),nw(e,t,r,o,n);case 7:return Tn(e,t,t.pendingProps,n),t.child;case 8:return Tn(e,t,t.pendingProps.children,n),t.child;case 12:return Tn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,s=t.memoizedProps,a=o.value,gt(zd,r._currentValue),r._currentValue=a,s!==null)if(Ar(s.value,a)){if(s.children===o.children&&!zn.current){t=Io(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){a=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=Eo(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Fg(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)a=s.type===t.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(Y(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Fg(a,n,t),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===t){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}Tn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,pi(t,n),o=vr(o),r=r(o),t.flags|=1,Tn(e,t,r,n),t.child;case 14:return r=t.type,o=Cr(r,t.pendingProps),o=Cr(r.type,o),rw(e,t,r,o,n);case 15:return sj(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Cr(r,o),ud(e,t),t.tag=1,Vn(r)?(e=!0,Fd(t)):e=!1,pi(t,n),nj(t,r,o),$g(t,r,o,n),Ug(null,t,r,!0,e,n);case 19:return uj(e,t,n);case 22:return aj(e,t,n)}throw Error(Y(156,t.tag))};function Ej(e,t){return QS(e,t)}function TI(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pr(e,t,n,r){return new TI(e,t,n,r)}function Fv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function kI(e){if(typeof e=="function")return Fv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===nv)return 11;if(e===rv)return 14}return 2}function bs(e,t){var n=e.alternate;return n===null?(n=pr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function pd(e,t,n,r,o,s){var a=2;if(r=e,typeof e=="function")Fv(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Ka:return sa(n.children,o,s,t);case tv:a=8,o|=8;break;case cg:return e=pr(12,n,t,o|2),e.elementType=cg,e.lanes=s,e;case ug:return e=pr(13,n,t,o),e.elementType=ug,e.lanes=s,e;case dg:return e=pr(19,n,t,o),e.elementType=dg,e.lanes=s,e;case AS:return $f(n,o,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case OS:a=10;break e;case MS:a=9;break e;case nv:a=11;break e;case rv:a=14;break e;case rs:a=16,r=null;break e}throw Error(Y(130,e==null?e:typeof e,""))}return t=pr(a,n,t,o),t.elementType=e,t.type=r,t.lanes=s,t}function sa(e,t,n,r){return e=pr(7,e,r,t),e.lanes=n,e}function $f(e,t,n,r){return e=pr(22,e,r,t),e.elementType=AS,e.lanes=n,e.stateNode={isHidden:!1},e}function gh(e,t,n){return e=pr(6,e,null,t),e.lanes=n,e}function mh(e,t,n){return t=pr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function NI(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jp(0),this.expirationTimes=Jp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jp(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Lv(e,t,n,r,o,s,a,l,c){return e=new NI(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=pr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},bv(s),e}function RI(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Rj)}catch(e){console.error(e)}}Rj(),RS.exports=sr;var Ls=RS.exports;const Pj=Km(Ls),MI=yS({__proto__:null,default:Pj},[Ls]);var vw=Ls;ig.createRoot=vw.createRoot,ig.hydrateRoot=vw.hydrateRoot;/** +`+s.stack}return{value:e,source:t,stack:o,digest:null}}function ph(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function zg(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var dI=typeof WeakMap=="function"?WeakMap:Map;function rj(e,t,n){n=Eo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Kd||(Kd=!0,Jg=r),zg(e,t)},n}function oj(e,t,n){n=Eo(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){zg(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){zg(e,t),typeof r!="function"&&(xs===null?xs=new Set([this]):xs.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Qx(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new dI;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=_I.bind(null,e,t,n),t.then(e,e))}function ew(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function tw(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Eo(-1,1),t.tag=2,ys(n,t,1))),n.lanes|=1),e)}var fI=$o.ReactCurrentOwner,$n=!1;function Tn(e,t,n,r){t.child=e===null?DC(t,null,n,r):_i(t,e.child,n,r)}function nw(e,t,n,r,o){n=n.render;var s=t.ref;return hi(t,o),r=Ev(e,t,n,r,s,o),n=Tv(),e!==null&&!$n?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Io(e,t,o)):(Et&&n&&hv(t),t.flags|=1,Tn(e,t,r,o),t.child)}function rw(e,t,n,r,o){if(e===null){var s=n.type;return typeof s=="function"&&!Fv(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,sj(e,t,s,r,o)):(e=pd(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&o)){var a=s.memoizedProps;if(n=n.compare,n=n!==null?n:cc,n(a,r)&&e.ref===t.ref)return Io(e,t,o)}return t.flags|=1,e=bs(s,r),e.ref=t.ref,e.return=t,t.child=e}function sj(e,t,n,r,o){if(e!==null){var s=e.memoizedProps;if(cc(s,r)&&e.ref===t.ref)if($n=!1,t.pendingProps=r=s,(e.lanes&o)!==0)e.flags&131072&&($n=!0);else return t.lanes=e.lanes,Io(e,t,o)}return Vg(e,t,n,r,o)}function aj(e,t,n){var r=t.pendingProps,o=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},gt(oi,Kn),Kn|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,gt(oi,Kn),Kn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,gt(oi,Kn),Kn|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,gt(oi,Kn),Kn|=r;return Tn(e,t,o,n),t.child}function ij(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Vg(e,t,n,r,o){var s=Vn(n)?da:wn.current;return s=Ci(t,s),hi(t,o),n=Ev(e,t,n,r,s,o),r=Tv(),e!==null&&!$n?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Io(e,t,o)):(Et&&r&&hv(t),t.flags|=1,Tn(e,t,n,o),t.child)}function ow(e,t,n,r,o){if(Vn(n)){var s=!0;Fd(t)}else s=!1;if(hi(t,o),t.stateNode===null)ud(e,t),nj(t,n,r),$g(t,n,r,o),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,u=n.contextType;typeof u=="object"&&u!==null?u=vr(u):(u=Vn(n)?da:wn.current,u=Ci(t,u));var d=n.getDerivedStateFromProps,p=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";p||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==u)&&Xx(t,a,r,u),os=!1;var f=t.memoizedState;a.state=f,Ud(t,r,a,o),c=t.memoizedState,l!==r||f!==c||zn.current||os?(typeof d=="function"&&(Lg(t,n,d,r),c=t.memoizedState),(l=os||Yx(t,n,l,r,f,c,u))?(p||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=u,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,MC(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Cr(t.type,l),a.props=u,p=t.pendingProps,f=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=vr(c):(c=Vn(n)?da:wn.current,c=Ci(t,c));var h=n.getDerivedStateFromProps;(d=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==p||f!==c)&&Xx(t,a,r,c),os=!1,f=t.memoizedState,a.state=f,Ud(t,r,a,o);var g=t.memoizedState;l!==p||f!==g||zn.current||os?(typeof h=="function"&&(Lg(t,n,h,r),g=t.memoizedState),(u=os||Yx(t,n,u,r,f,g,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,g,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,g,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),a.props=r,a.state=g,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Ug(e,t,n,r,s,o)}function Ug(e,t,n,r,o,s){ij(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return o&&Bx(t,n,!1),Io(e,t,s);r=t.stateNode,fI.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=_i(t,e.child,null,s),t.child=_i(t,null,l,s)):Tn(e,t,l,s),t.memoizedState=r.state,o&&Bx(t,n,!0),t.child}function lj(e){var t=e.stateNode;t.pendingContext?Ux(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ux(e,t.context,!1),Sv(e,t.containerInfo)}function sw(e,t,n,r,o){return ji(),mv(o),t.flags|=256,Tn(e,t,n,r),t.child}var Bg={dehydrated:null,treeContext:null,retryLane:0};function Hg(e){return{baseLanes:e,cachePool:null,transitions:null}}function cj(e,t,n){var r=t.pendingProps,o=Pt.current,s=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),gt(Pt,o&1),e===null)return Ag(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,s?(r=t.mode,s=t.child,a={mode:"hidden",children:a},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=$f(a,r,0,null),e=sa(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Hg(n),t.memoizedState=Bg,e):Rv(t,a));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return pI(e,t,a,r,l,o,n);if(s){s=r.fallback,a=t.mode,o=e.child,l=o.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=bs(o,c),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?s=bs(l,s):(s=sa(s,a,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,a=e.child.memoizedState,a=a===null?Hg(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=e.childLanes&~n,t.memoizedState=Bg,r}return s=e.child,e=s.sibling,r=bs(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Rv(e,t){return t=$f({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Mu(e,t,n,r){return r!==null&&mv(r),_i(t,e.child,null,n),e=Rv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function pI(e,t,n,r,o,s,a){if(n)return t.flags&256?(t.flags&=-257,r=ph(Error(Y(422))),Mu(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,o=t.mode,r=$f({mode:"visible",children:r.children},o,0,null),s=sa(s,o,a,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&_i(t,e.child,null,a),t.child.memoizedState=Hg(a),t.memoizedState=Bg,s);if(!(t.mode&1))return Mu(e,t,a,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(Y(419)),r=ph(s,r,void 0),Mu(e,t,a,r)}if(l=(a&e.childLanes)!==0,$n||l){if(r=en,r!==null){switch(a&-a){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|a)?0:o,o!==0&&o!==s.retryLane&&(s.retryLane=o,Po(e,o),Rr(r,e,o,-1))}return Av(),r=ph(Error(Y(421))),Mu(e,t,a,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=EI.bind(null,e),o._reactRetry=t,null):(e=s.treeContext,Yn=vs(o.nextSibling),Qn=t,Et=!0,Er=null,e!==null&&(ur[dr++]=bo,ur[dr++]=So,ur[dr++]=fa,bo=e.id,So=e.overflow,fa=t),t=Rv(t,r.children),t.flags|=4096,t)}function aw(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Fg(e.return,t,n)}function hh(e,t,n,r,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=o)}function uj(e,t,n){var r=t.pendingProps,o=r.revealOrder,s=r.tail;if(Tn(e,t,r.children,n),r=Pt.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&aw(e,n,t);else if(e.tag===19)aw(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(gt(Pt,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Bd(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),hh(t,!1,o,n,s);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Bd(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}hh(t,!0,n,null,s);break;case"together":hh(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ud(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Io(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ha|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Y(153));if(t.child!==null){for(e=t.child,n=bs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=bs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function hI(e,t,n){switch(t.tag){case 3:lj(t),ji();break;case 5:AC(t);break;case 1:Vn(t.type)&&Fd(t);break;case 4:Sv(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;gt(zd,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(gt(Pt,Pt.current&1),t.flags|=128,null):n&t.child.childLanes?cj(e,t,n):(gt(Pt,Pt.current&1),e=Io(e,t,n),e!==null?e.sibling:null);gt(Pt,Pt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return uj(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),gt(Pt,Pt.current),r)break;return null;case 22:case 23:return t.lanes=0,aj(e,t,n)}return Io(e,t,n)}var dj,Gg,fj,pj;dj=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Gg=function(){};fj=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Xs(to.current);var s=null;switch(n){case"input":o=pg(e,o),r=pg(e,r),s=[];break;case"select":o=Ot({},o,{value:void 0}),r=Ot({},r,{value:void 0}),s=[];break;case"textarea":o=mg(e,o),r=mg(e,r),s=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Md)}yg(n,r);var a;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var l=o[u];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(nc.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(l=o!=null?o[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(s||(s=[]),s.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(s=s||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(nc.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&wt("scroll",e),s||l===c||(s=[])):(s=s||[]).push(u,c))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}};pj=function(e,t,n,r){n!==r&&(t.flags|=4)};function fl(e,t){if(!Et)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function hn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function gI(e,t,n){var r=t.pendingProps;switch(gv(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return hn(t),null;case 1:return Vn(t.type)&&Ad(),hn(t),null;case 3:return r=t.stateNode,Ei(),jt(zn),jt(wn),jv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Du(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Er!==null&&(Qg(Er),Er=null))),Gg(e,t),hn(t),null;case 5:Cv(t);var o=Xs(hc.current);if(n=t.type,e!==null&&t.stateNode!=null)fj(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Y(166));return hn(t),null}if(e=Xs(to.current),Du(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Zr]=t,r[fc]=s,e=(t.mode&1)!==0,n){case"dialog":wt("cancel",r),wt("close",r);break;case"iframe":case"object":case"embed":wt("load",r);break;case"video":case"audio":for(o=0;o<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Zr]=t,e[fc]=r,dj(e,t,!1,!1),t.stateNode=e;e:{switch(a=xg(n,r),n){case"dialog":wt("cancel",e),wt("close",e),o=r;break;case"iframe":case"object":case"embed":wt("load",e),o=r;break;case"video":case"audio":for(o=0;oki&&(t.flags|=128,r=!0,fl(s,!1),t.lanes=4194304)}else{if(!r)if(e=Bd(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),fl(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!Et)return hn(t),null}else 2*zt()-s.renderingStartTime>ki&&n!==1073741824&&(t.flags|=128,r=!0,fl(s,!1),t.lanes=4194304);s.isBackwards?(a.sibling=t.child,t.child=a):(n=s.last,n!==null?n.sibling=a:t.child=a,s.last=a)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=zt(),t.sibling=null,n=Pt.current,gt(Pt,r?n&1|2:n&1),t):(hn(t),null);case 22:case 23:return Mv(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Kn&1073741824&&(hn(t),t.subtreeFlags&6&&(t.flags|=8192)):hn(t),null;case 24:return null;case 25:return null}throw Error(Y(156,t.tag))}function mI(e,t){switch(gv(t),t.tag){case 1:return Vn(t.type)&&Ad(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ei(),jt(zn),jt(wn),jv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Cv(t),null;case 13:if(jt(Pt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Y(340));ji()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return jt(Pt),null;case 4:return Ei(),null;case 10:return xv(t.type._context),null;case 22:case 23:return Mv(),null;case 24:return null;default:return null}}var Au=!1,yn=!1,vI=typeof WeakSet=="function"?WeakSet:Set,xe=null;function ri(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){At(e,t,r)}else n.current=null}function Wg(e,t,n){try{n()}catch(r){At(e,t,r)}}var iw=!1;function yI(e,t){if(Ng=Id,e=yC(),pv(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,p=e,f=null;t:for(;;){for(var h;p!==n||o!==0&&p.nodeType!==3||(l=a+o),p!==s||r!==0&&p.nodeType!==3||(c=a+r),p.nodeType===3&&(a+=p.nodeValue.length),(h=p.firstChild)!==null;)f=p,p=h;for(;;){if(p===e)break t;if(f===n&&++u===o&&(l=a),f===s&&++d===r&&(c=a),(h=p.nextSibling)!==null)break;p=f,f=p.parentNode}p=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Rg={focusedElem:e,selectionRange:n},Id=!1,xe=t;xe!==null;)if(t=xe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xe=e;else for(;xe!==null;){t=xe;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,w=g.memoizedState,x=t.stateNode,y=x.getSnapshotBeforeUpdate(t.elementType===t.type?m:Cr(t.type,m),w);x.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Y(163))}}catch(C){At(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,xe=e;break}xe=t.return}return g=iw,iw=!1,g}function Hl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var s=o.destroy;o.destroy=void 0,s!==void 0&&Wg(t,n,s)}o=o.next}while(o!==r)}}function Ff(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Kg(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function hj(e){var t=e.alternate;t!==null&&(e.alternate=null,hj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Zr],delete t[fc],delete t[Dg],delete t[eI],delete t[tI])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function gj(e){return e.tag===5||e.tag===3||e.tag===4}function lw(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gj(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Md));else if(r!==4&&(e=e.child,e!==null))for(qg(e,t,n),e=e.sibling;e!==null;)qg(e,t,n),e=e.sibling}function Zg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Zg(e,t,n),e=e.sibling;e!==null;)Zg(e,t,n),e=e.sibling}var an=null,jr=!1;function Yo(e,t,n){for(n=n.child;n!==null;)mj(e,t,n),n=n.sibling}function mj(e,t,n){if(eo&&typeof eo.onCommitFiberUnmount=="function")try{eo.onCommitFiberUnmount(Nf,n)}catch{}switch(n.tag){case 5:yn||ri(n,t);case 6:var r=an,o=jr;an=null,Yo(e,t,n),an=r,jr=o,an!==null&&(jr?(e=an,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):an.removeChild(n.stateNode));break;case 18:an!==null&&(jr?(e=an,n=n.stateNode,e.nodeType===8?ih(e.parentNode,n):e.nodeType===1&&ih(e,n),ic(e)):ih(an,n.stateNode));break;case 4:r=an,o=jr,an=n.stateNode.containerInfo,jr=!0,Yo(e,t,n),an=r,jr=o;break;case 0:case 11:case 14:case 15:if(!yn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var s=o,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&Wg(n,t,a),o=o.next}while(o!==r)}Yo(e,t,n);break;case 1:if(!yn&&(ri(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){At(n,t,l)}Yo(e,t,n);break;case 21:Yo(e,t,n);break;case 22:n.mode&1?(yn=(r=yn)||n.memoizedState!==null,Yo(e,t,n),yn=r):Yo(e,t,n);break;default:Yo(e,t,n)}}function cw(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vI),t.forEach(function(r){var o=TI.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Sr(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=a),r&=~s}if(r=o,r=zt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wI(r/1960))-r,10e?16:e,us===null)var r=!1;else{if(e=us,us=null,qd=0,nt&6)throw Error(Y(331));var o=nt;for(nt|=4,xe=e.current;xe!==null;){var s=xe,a=s.child;if(xe.flags&16){var l=s.deletions;if(l!==null){for(var c=0;czt()-Dv?oa(e,0):Iv|=n),Un(e,t)}function jj(e,t){t===0&&(e.mode&1?(t=Tu,Tu<<=1,!(Tu&130023424)&&(Tu=4194304)):t=1);var n=Rn();e=Po(e,t),e!==null&&(Jc(e,t,n),Un(e,n))}function EI(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),jj(e,n)}function TI(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Y(314))}r!==null&&r.delete(t),jj(e,n)}var _j;_j=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||zn.current)$n=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return $n=!1,hI(e,t,n);$n=!!(e.flags&131072)}else $n=!1,Et&&t.flags&1048576&&NC(t,$d,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ud(e,t),e=t.pendingProps;var o=Ci(t,wn.current);hi(t,n),o=Ev(null,t,r,e,o,n);var s=Tv();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Vn(r)?(s=!0,Fd(t)):s=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,bv(t),o.updater=Af,t.stateNode=o,o._reactInternals=t,$g(t,r,e,n),t=Ug(null,t,r,!0,s,n)):(t.tag=0,Et&&s&&hv(t),Tn(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ud(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=NI(r),e=Cr(r,e),o){case 0:t=Vg(null,t,r,e,n);break e;case 1:t=ow(null,t,r,e,n);break e;case 11:t=nw(null,t,r,e,n);break e;case 14:t=rw(null,t,r,Cr(r.type,e),n);break e}throw Error(Y(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Cr(r,o),Vg(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Cr(r,o),ow(e,t,r,o,n);case 3:e:{if(lj(t),e===null)throw Error(Y(387));r=t.pendingProps,s=t.memoizedState,o=s.element,MC(e,t),Ud(t,r,null,n);var a=t.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){o=Ti(Error(Y(423)),t),t=sw(e,t,r,n,o);break e}else if(r!==o){o=Ti(Error(Y(424)),t),t=sw(e,t,r,n,o);break e}else for(Yn=vs(t.stateNode.containerInfo.firstChild),Qn=t,Et=!0,Er=null,n=DC(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ji(),r===o){t=Io(e,t,n);break e}Tn(e,t,r,n)}t=t.child}return t;case 5:return AC(t),e===null&&Ag(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,a=o.children,Pg(r,o)?a=null:s!==null&&Pg(r,s)&&(t.flags|=32),ij(e,t),Tn(e,t,a,n),t.child;case 6:return e===null&&Ag(t),null;case 13:return cj(e,t,n);case 4:return Sv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=_i(t,null,r,n):Tn(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Cr(r,o),nw(e,t,r,o,n);case 7:return Tn(e,t,t.pendingProps,n),t.child;case 8:return Tn(e,t,t.pendingProps.children,n),t.child;case 12:return Tn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,s=t.memoizedProps,a=o.value,gt(zd,r._currentValue),r._currentValue=a,s!==null)if(Ar(s.value,a)){if(s.children===o.children&&!zn.current){t=Io(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){a=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=Eo(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Fg(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)a=s.type===t.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(Y(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Fg(a,n,t),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===t){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}Tn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,hi(t,n),o=vr(o),r=r(o),t.flags|=1,Tn(e,t,r,n),t.child;case 14:return r=t.type,o=Cr(r,t.pendingProps),o=Cr(r.type,o),rw(e,t,r,o,n);case 15:return sj(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Cr(r,o),ud(e,t),t.tag=1,Vn(r)?(e=!0,Fd(t)):e=!1,hi(t,n),nj(t,r,o),$g(t,r,o,n),Ug(null,t,r,!0,e,n);case 19:return uj(e,t,n);case 22:return aj(e,t,n)}throw Error(Y(156,t.tag))};function Ej(e,t){return QS(e,t)}function kI(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pr(e,t,n,r){return new kI(e,t,n,r)}function Fv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function NI(e){if(typeof e=="function")return Fv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===nv)return 11;if(e===rv)return 14}return 2}function bs(e,t){var n=e.alternate;return n===null?(n=pr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function pd(e,t,n,r,o,s){var a=2;if(r=e,typeof e=="function")Fv(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case qa:return sa(n.children,o,s,t);case tv:a=8,o|=8;break;case cg:return e=pr(12,n,t,o|2),e.elementType=cg,e.lanes=s,e;case ug:return e=pr(13,n,t,o),e.elementType=ug,e.lanes=s,e;case dg:return e=pr(19,n,t,o),e.elementType=dg,e.lanes=s,e;case AS:return $f(n,o,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case OS:a=10;break e;case MS:a=9;break e;case nv:a=11;break e;case rv:a=14;break e;case rs:a=16,r=null;break e}throw Error(Y(130,e==null?e:typeof e,""))}return t=pr(a,n,t,o),t.elementType=e,t.type=r,t.lanes=s,t}function sa(e,t,n,r){return e=pr(7,e,r,t),e.lanes=n,e}function $f(e,t,n,r){return e=pr(22,e,r,t),e.elementType=AS,e.lanes=n,e.stateNode={isHidden:!1},e}function gh(e,t,n){return e=pr(6,e,null,t),e.lanes=n,e}function mh(e,t,n){return t=pr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function RI(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jp(0),this.expirationTimes=Jp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jp(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Lv(e,t,n,r,o,s,a,l,c){return e=new RI(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=pr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},bv(s),e}function PI(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Rj)}catch(e){console.error(e)}}Rj(),RS.exports=sr;var Ls=RS.exports;const Pj=Km(Ls),AI=yS({__proto__:null,default:Pj},[Ls]);var vw=Ls;ig.createRoot=vw.createRoot,ig.hydrateRoot=vw.hydrateRoot;/** * @remix-run/router v1.18.0 * * Copyright (c) Remix Software Inc. @@ -46,9 +46,9 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Rt(){return Rt=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function ki(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function FI(){return Math.random().toString(36).substr(2,8)}function xw(e,t){return{usr:e.state,key:e.key,idx:t}}function xc(e,t,n,r){return n===void 0&&(n=null),Rt({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?$s(t):t,{state:n,key:t&&t.key||r||FI()})}function ma(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function $s(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function LI(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:s=!1}=r,a=o.history,l=Ht.Pop,c=null,u=d();u==null&&(u=0,a.replaceState(Rt({},a.state,{idx:u}),""));function d(){return(a.state||{idx:null}).idx}function p(){l=Ht.Pop;let w=d(),x=w==null?null:w-u;u=w,c&&c({action:l,location:m.location,delta:x})}function f(w,x){l=Ht.Push;let y=xc(m.location,w,x);u=d()+1;let b=xw(y,u),C=m.createHref(y);try{a.pushState(b,"",C)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;o.location.assign(C)}s&&c&&c({action:l,location:m.location,delta:1})}function h(w,x){l=Ht.Replace;let y=xc(m.location,w,x);u=d();let b=xw(y,u),C=m.createHref(y);a.replaceState(b,"",C),s&&c&&c({action:l,location:m.location,delta:0})}function g(w){let x=o.location.origin!=="null"?o.location.origin:o.location.href,y=typeof w=="string"?w:ma(w);return y=y.replace(/ $/,"%20"),Ze(x,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,x)}let m={get action(){return l},get location(){return e(o,a)},listen(w){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(yw,p),c=w,()=>{o.removeEventListener(yw,p),c=null}},createHref(w){return t(o,w)},createURL:g,encodeLocation(w){let x=g(w);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:h,go(w){return a.go(w)}};return m}var ht;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(ht||(ht={}));const $I=new Set(["lazy","caseSensitive","path","id","index","children"]);function zI(e){return e.index===!0}function wc(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((o,s)=>{let a=[...n,String(s)],l=typeof o.id=="string"?o.id:a.join("-");if(Ze(o.index!==!0||!o.children,"Cannot specify children on an index route"),Ze(!r[l],'Found a route id collision on id "'+l+`". Route id's must be globally unique within Data Router usages`),zI(o)){let c=Rt({},o,t(o),{id:l});return r[l]=c,c}else{let c=Rt({},o,t(o),{id:l,children:void 0});return r[l]=c,o.children&&(c.children=wc(o.children,t,a,r)),c}})}function qs(e,t,n){return n===void 0&&(n="/"),hd(e,t,n,!1)}function hd(e,t,n,r){let o=typeof t=="string"?$s(t):t,s=$i(o.pathname||"/",n);if(s==null)return null;let a=Ij(e);UI(a);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:a,route:s};c.relativePath.startsWith("/")&&(Ze(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=To([r,c.relativePath]),d=n.concat(c);s.children&&s.children.length>0&&(Ze(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Ij(s.children,t,d,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:ZI(u,s.index),routesMeta:d})};return e.forEach((s,a)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))o(s,a);else for(let c of Dj(s.path))o(s,a,c)}),t}function Dj(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return o?[s,""]:[s];let a=Dj(r.join("/")),l=[];return l.push(...a.map(c=>c===""?s:[s,c].join("/"))),o&&l.push(...a),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function UI(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:JI(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const BI=/^:[\w-]+$/,HI=3,GI=2,WI=1,KI=10,qI=-2,ww=e=>e==="*";function ZI(e,t){let n=e.split("/"),r=n.length;return n.some(ww)&&(r+=qI),t&&(r+=GI),n.filter(o=>!ww(o)).reduce((o,s)=>o+(BI.test(s)?HI:s===""?WI:KI),r)}function JI(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function YI(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,o={},s="/",a=[];for(let l=0;l{let{paramName:f,isOptional:h}=d;if(f==="*"){let m=l[p]||"";a=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[p];return h&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:a,pattern:e}}function XI(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),ki(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function QI(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ki(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function $i(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function eD(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?$s(e):e;return{pathname:n?n.startsWith("/")?n:tD(n,t):t,search:rD(r),hash:oD(o)}}function tD(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function vh(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Oj(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Hf(e,t){let n=Oj(e);return t?n.map((r,o)=>o===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Gf(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=$s(e):(o=Rt({},e),Ze(!o.pathname||!o.pathname.includes("?"),vh("?","pathname","search",o)),Ze(!o.pathname||!o.pathname.includes("#"),vh("#","pathname","hash",o)),Ze(!o.search||!o.search.includes("#"),vh("#","search","hash",o)));let s=e===""||o.pathname==="",a=s?"/":o.pathname,l;if(a==null)l=n;else{let p=t.length-1;if(!r&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),p-=1;o.pathname=f.join("/")}l=p>=0?t[p]:"/"}let c=eD(o,l),u=a&&a!=="/"&&a.endsWith("/"),d=(s||a===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const To=e=>e.join("/").replace(/\/\/+/g,"/"),nD=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),rD=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,oD=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Uv{constructor(t,n,r,o){o===void 0&&(o=!1),this.status=t,this.statusText=n||"",this.internal=o,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function Wf(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Mj=["post","put","patch","delete"],sD=new Set(Mj),aD=["get",...Mj],iD=new Set(aD),lD=new Set([301,302,303,307,308]),cD=new Set([307,308]),yh={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},uD={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},hl={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Bv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dD=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Aj="remix-router-transitions";function fD(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;Ze(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let o;if(e.mapRouteProperties)o=e.mapRouteProperties;else if(e.detectErrorBoundary){let N=e.detectErrorBoundary;o=R=>({hasErrorBoundary:N(R)})}else o=dD;let s={},a=wc(e.routes,o,void 0,s),l,c=e.basename||"/",u=e.unstable_dataStrategy||vD,d=e.unstable_patchRoutesOnMiss,p=Rt({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),f=null,h=new Set,g=null,m=null,w=null,x=e.hydrationData!=null,y=qs(a,e.history.location,c),b=null;if(y==null&&!d){let N=En(404,{pathname:e.history.location.pathname}),{matches:R,route:$}=Pw(a);y=R,b={[$.id]:N}}y&&d&&!e.hydrationData&&Hp(y,a,e.history.location.pathname).active&&(y=null);let C;if(!y)C=!1,y=[];else if(y.some(N=>N.route.lazy))C=!1;else if(!y.some(N=>N.route.loader))C=!0;else if(p.v7_partialHydration){let N=e.hydrationData?e.hydrationData.loaderData:null,R=e.hydrationData?e.hydrationData.errors:null,$=G=>G.route.loader?typeof G.route.loader=="function"&&G.route.loader.hydrate===!0?!1:N&&N[G.route.id]!==void 0||R&&R[G.route.id]!==void 0:!0;if(R){let G=y.findIndex(ve=>R[ve.route.id]!==void 0);C=y.slice(0,G+1).every($)}else C=y.every($)}else C=e.hydrationData!=null;let j,S={historyAction:e.history.action,location:e.history.location,matches:y,initialized:C,navigation:yh,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},k=Ht.Pop,E=!1,O,F=!1,Z=new Map,I=null,q=!1,H=!1,J=[],ne=[],K=new Map,z=0,L=-1,ee=new Map,fe=new Set,B=new Map,te=new Map,X=new Set,ie=new Map,re=new Map,W=new Map,we=!1;function Re(){if(f=e.history.listen(N=>{let{action:R,location:$,delta:G}=N;if(we){we=!1;return}ki(re.size===0||G!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let ve=Zo({currentLocation:S.location,nextLocation:$,historyAction:R});if(ve&&G!=null){we=!0,e.history.go(G*-1),Br(ve,{state:"blocked",location:$,proceed(){Br(ve,{state:"proceeding",proceed:void 0,reset:void 0,location:$}),e.history.go(G)},reset(){let _e=new Map(S.blockers);_e.set(ve,hl),ge({blockers:_e})}});return}return Lt(R,$)}),n){RD(t,Z);let N=()=>PD(t,Z);t.addEventListener("pagehide",N),I=()=>t.removeEventListener("pagehide",N)}return S.initialized||Lt(Ht.Pop,S.location,{initialHydration:!0}),j}function Fe(){f&&f(),I&&I(),h.clear(),O&&O.abort(),S.fetchers.forEach((N,R)=>Ur(R)),S.blockers.forEach((N,R)=>fn(R))}function Pe(N){return h.add(N),()=>h.delete(N)}function ge(N,R){R===void 0&&(R={}),S=Rt({},S,N);let $=[],G=[];p.v7_fetcherPersist&&S.fetchers.forEach((ve,_e)=>{ve.state==="idle"&&(X.has(_e)?G.push(_e):$.push(_e))}),[...h].forEach(ve=>ve(S,{deletedFetchers:G,unstable_viewTransitionOpts:R.viewTransitionOpts,unstable_flushSync:R.flushSync===!0})),p.v7_fetcherPersist&&($.forEach(ve=>S.fetchers.delete(ve)),G.forEach(ve=>Ur(ve)))}function Xe(N,R,$){var G,ve;let{flushSync:_e}=$===void 0?{}:$,Le=S.actionData!=null&&S.navigation.formMethod!=null&&_r(S.navigation.formMethod)&&S.navigation.state==="loading"&&((G=N.state)==null?void 0:G._isRedirect)!==!0,de;R.actionData?Object.keys(R.actionData).length>0?de=R.actionData:de=null:Le?de=S.actionData:de=null;let Ge=R.loaderData?Nw(S.loaderData,R.loaderData,R.matches||[],R.errors):S.loaderData,ke=S.blockers;ke.size>0&&(ke=new Map(ke),ke.forEach((it,ft)=>ke.set(ft,hl)));let Ie=E===!0||S.navigation.formMethod!=null&&_r(S.navigation.formMethod)&&((ve=N.state)==null?void 0:ve._isRedirect)!==!0;l&&(a=l,l=void 0),q||k===Ht.Pop||(k===Ht.Push?e.history.push(N,N.state):k===Ht.Replace&&e.history.replace(N,N.state));let dt;if(k===Ht.Pop){let it=Z.get(S.location.pathname);it&&it.has(N.pathname)?dt={currentLocation:S.location,nextLocation:N}:Z.has(N.pathname)&&(dt={currentLocation:N,nextLocation:S.location})}else if(F){let it=Z.get(S.location.pathname);it?it.add(N.pathname):(it=new Set([N.pathname]),Z.set(S.location.pathname,it)),dt={currentLocation:S.location,nextLocation:N}}ge(Rt({},R,{actionData:de,loaderData:Ge,historyAction:k,location:N,initialized:!0,navigation:yh,revalidation:"idle",restoreScrollPosition:ix(N,R.matches||S.matches),preventScrollReset:Ie,blockers:ke}),{viewTransitionOpts:dt,flushSync:_e===!0}),k=Ht.Pop,E=!1,F=!1,q=!1,H=!1,J=[],ne=[]}async function kt(N,R){if(typeof N=="number"){e.history.go(N);return}let $=em(S.location,S.matches,c,p.v7_prependBasename,N,p.v7_relativeSplatPath,R==null?void 0:R.fromRouteId,R==null?void 0:R.relative),{path:G,submission:ve,error:_e}=Sw(p.v7_normalizeFormMethod,!1,$,R),Le=S.location,de=xc(S.location,G,R&&R.state);de=Rt({},de,e.history.encodeLocation(de));let Ge=R&&R.replace!=null?R.replace:void 0,ke=Ht.Push;Ge===!0?ke=Ht.Replace:Ge===!1||ve!=null&&_r(ve.formMethod)&&ve.formAction===S.location.pathname+S.location.search&&(ke=Ht.Replace);let Ie=R&&"preventScrollReset"in R?R.preventScrollReset===!0:void 0,dt=(R&&R.unstable_flushSync)===!0,it=Zo({currentLocation:Le,nextLocation:de,historyAction:ke});if(it){Br(it,{state:"blocked",location:de,proceed(){Br(it,{state:"proceeding",proceed:void 0,reset:void 0,location:de}),kt(N,R)},reset(){let ft=new Map(S.blockers);ft.set(it,hl),ge({blockers:ft})}});return}return await Lt(ke,de,{submission:ve,pendingError:_e,preventScrollReset:Ie,replace:R&&R.replace,enableViewTransition:R&&R.unstable_viewTransition,flushSync:dt})}function Ut(){if(Yt(),ge({revalidation:"loading"}),S.navigation.state!=="submitting"){if(S.navigation.state==="idle"){Lt(S.historyAction,S.location,{startUninterruptedRevalidation:!0});return}Lt(k||S.historyAction,S.navigation.location,{overrideNavigation:S.navigation})}}async function Lt(N,R,$){O&&O.abort(),O=null,k=N,q=($&&$.startUninterruptedRevalidation)===!0,sR(S.location,S.matches),E=($&&$.preventScrollReset)===!0,F=($&&$.enableViewTransition)===!0;let G=l||a,ve=$&&$.overrideNavigation,_e=qs(G,R,c),Le=($&&$.flushSync)===!0,de=Hp(_e,G,R.pathname);if(de.active&&de.matches&&(_e=de.matches),!_e){let{error:st,notFoundMatches:on,route:Bt}=rl(R.pathname);Xe(R,{matches:on,loaderData:{},errors:{[Bt.id]:st}},{flushSync:Le});return}if(S.initialized&&!H&&CD(S.location,R)&&!($&&$.submission&&_r($.submission.formMethod))){Xe(R,{matches:_e},{flushSync:Le});return}O=new AbortController;let Ge=Ma(e.history,R,O.signal,$&&$.submission),ke;if($&&$.pendingError)ke=[oi(_e).route.id,{type:ht.error,error:$.pendingError}];else if($&&$.submission&&_r($.submission.formMethod)){let st=await Wt(Ge,R,$.submission,_e,de.active,{replace:$.replace,flushSync:Le});if(st.shortCircuited)return;if(st.pendingActionResult){let[on,Bt]=st.pendingActionResult;if(Zn(Bt)&&Wf(Bt.error)&&Bt.error.status===404){O=null,Xe(R,{matches:st.matches,loaderData:{},errors:{[on]:Bt.error}});return}}_e=st.matches||_e,ke=st.pendingActionResult,ve=xh(R,$.submission),Le=!1,de.active=!1,Ge=Ma(e.history,Ge.url,Ge.signal)}let{shortCircuited:Ie,matches:dt,loaderData:it,errors:ft}=await _(Ge,R,_e,de.active,ve,$&&$.submission,$&&$.fetcherSubmission,$&&$.replace,$&&$.initialHydration===!0,Le,ke);Ie||(O=null,Xe(R,Rt({matches:dt||_e},Rw(ke),{loaderData:it,errors:ft})))}async function Wt(N,R,$,G,ve,_e){_e===void 0&&(_e={}),Yt();let Le=kD(R,$);if(ge({navigation:Le},{flushSync:_e.flushSync===!0}),ve){let ke=await yu(G,R.pathname,N.signal);if(ke.type==="aborted")return{shortCircuited:!0};if(ke.type==="error"){let{boundaryId:Ie,error:dt}=Ra(R.pathname,ke);return{matches:ke.partialMatches,pendingActionResult:[Ie,{type:ht.error,error:dt}]}}else if(ke.matches)G=ke.matches;else{let{notFoundMatches:Ie,error:dt,route:it}=rl(R.pathname);return{matches:Ie,pendingActionResult:[it.id,{type:ht.error,error:dt}]}}}let de,Ge=Pl(G,R);if(!Ge.route.action&&!Ge.route.lazy)de={type:ht.error,error:En(405,{method:N.method,pathname:R.pathname,routeId:Ge.route.id})};else if(de=(await Je("action",N,[Ge],G))[0],N.signal.aborted)return{shortCircuited:!0};if(ea(de)){let ke;return _e&&_e.replace!=null?ke=_e.replace:ke=Ew(de.response.headers.get("Location"),new URL(N.url),c)===S.location.pathname+S.location.search,await be(N,de,{submission:$,replace:ke}),{shortCircuited:!0}}if(Qs(de))throw En(400,{type:"defer-action"});if(Zn(de)){let ke=oi(G,Ge.route.id);return(_e&&_e.replace)!==!0&&(k=Ht.Push),{matches:G,pendingActionResult:[ke.route.id,de]}}return{matches:G,pendingActionResult:[Ge.route.id,de]}}async function _(N,R,$,G,ve,_e,Le,de,Ge,ke,Ie){let dt=ve||xh(R,_e),it=_e||Le||Ow(dt),ft=!q&&(!p.v7_partialHydration||!Ge);if(G){if(ft){let Mt=D(Ie);ge(Rt({navigation:dt},Mt!==void 0?{actionData:Mt}:{}),{flushSync:ke})}let Ke=await yu($,R.pathname,N.signal);if(Ke.type==="aborted")return{shortCircuited:!0};if(Ke.type==="error"){let{boundaryId:Mt,error:Hn}=Ra(R.pathname,Ke);return{matches:Ke.partialMatches,loaderData:{},errors:{[Mt]:Hn}}}else if(Ke.matches)$=Ke.matches;else{let{error:Mt,notFoundMatches:Hn,route:_t}=rl(R.pathname);return{matches:Hn,loaderData:{},errors:{[_t.id]:Mt}}}}let st=l||a,[on,Bt]=Cw(e.history,S,$,it,R,p.v7_partialHydration&&Ge===!0,p.v7_skipActionErrorRevalidation,H,J,ne,X,B,fe,st,c,Ie);if(Hr(Ke=>!($&&$.some(Mt=>Mt.route.id===Ke))||on&&on.some(Mt=>Mt.route.id===Ke)),L=++z,on.length===0&&Bt.length===0){let Ke=ze();return Xe(R,Rt({matches:$,loaderData:{},errors:Ie&&Zn(Ie[1])?{[Ie[0]]:Ie[1].error}:null},Rw(Ie),Ke?{fetchers:new Map(S.fetchers)}:{}),{flushSync:ke}),{shortCircuited:!0}}if(ft){let Ke={};if(!G){Ke.navigation=dt;let Mt=D(Ie);Mt!==void 0&&(Ke.actionData=Mt)}Bt.length>0&&(Ke.fetchers=U(Bt)),ge(Ke,{flushSync:ke})}Bt.forEach(Ke=>{K.has(Ke.key)&&_n(Ke.key),Ke.controller&&K.set(Ke.key,Ke.controller)});let sl=()=>Bt.forEach(Ke=>_n(Ke.key));O&&O.signal.addEventListener("abort",sl);let{loaderResults:Jo,fetcherResults:Pa}=await yt(S.matches,$,on,Bt,N);if(N.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener("abort",sl),Bt.forEach(Ke=>K.delete(Ke.key));let Ia=Iw([...Jo,...Pa]);if(Ia){if(Ia.idx>=on.length){let Ke=Bt[Ia.idx-on.length].key;fe.add(Ke)}return await be(N,Ia.result,{replace:de}),{shortCircuited:!0}}let{loaderData:Da,errors:Gr}=kw(S,$,on,Jo,Ie,Bt,Pa,ie);ie.forEach((Ke,Mt)=>{Ke.subscribe(Hn=>{(Hn||Ke.done)&&ie.delete(Mt)})}),p.v7_partialHydration&&Ge&&S.errors&&Object.entries(S.errors).filter(Ke=>{let[Mt]=Ke;return!on.some(Hn=>Hn.route.id===Mt)}).forEach(Ke=>{let[Mt,Hn]=Ke;Gr=Object.assign(Gr||{},{[Mt]:Hn})});let xu=ze(),wu=pt(L),bu=xu||wu||Bt.length>0;return Rt({matches:$,loaderData:Da,errors:Gr},bu?{fetchers:new Map(S.fetchers)}:{})}function D(N){if(N&&!Zn(N[1]))return{[N[0]]:N[1].data};if(S.actionData)return Object.keys(S.actionData).length===0?null:S.actionData}function U(N){return N.forEach(R=>{let $=S.fetchers.get(R.key),G=gl(void 0,$?$.data:void 0);S.fetchers.set(R.key,G)}),new Map(S.fetchers)}function pe(N,R,$,G){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");K.has(N)&&_n(N);let ve=(G&&G.unstable_flushSync)===!0,_e=l||a,Le=em(S.location,S.matches,c,p.v7_prependBasename,$,p.v7_relativeSplatPath,R,G==null?void 0:G.relative),de=qs(_e,Le,c),Ge=Hp(de,_e,Le);if(Ge.active&&Ge.matches&&(de=Ge.matches),!de){Xt(N,R,En(404,{pathname:Le}),{flushSync:ve});return}let{path:ke,submission:Ie,error:dt}=Sw(p.v7_normalizeFormMethod,!0,Le,G);if(dt){Xt(N,R,dt,{flushSync:ve});return}let it=Pl(de,ke);if(E=(G&&G.preventScrollReset)===!0,Ie&&_r(Ie.formMethod)){le(N,R,ke,it,de,Ge.active,ve,Ie);return}B.set(N,{routeId:R,path:ke}),oe(N,R,ke,it,de,Ge.active,ve,Ie)}async function le(N,R,$,G,ve,_e,Le,de){Yt(),B.delete(N);function Ge(_t){if(!_t.route.action&&!_t.route.lazy){let fo=En(405,{method:de.formMethod,pathname:$,routeId:R});return Xt(N,R,fo,{flushSync:Le}),!0}return!1}if(!_e&&Ge(G))return;let ke=S.fetchers.get(N);rn(N,ND(de,ke),{flushSync:Le});let Ie=new AbortController,dt=Ma(e.history,$,Ie.signal,de);if(_e){let _t=await yu(ve,$,dt.signal);if(_t.type==="aborted")return;if(_t.type==="error"){let{error:fo}=Ra($,_t);Xt(N,R,fo,{flushSync:Le});return}else if(_t.matches){if(ve=_t.matches,G=Pl(ve,$),Ge(G))return}else{Xt(N,R,En(404,{pathname:$}),{flushSync:Le});return}}K.set(N,Ie);let it=z,st=(await Je("action",dt,[G],ve))[0];if(dt.signal.aborted){K.get(N)===Ie&&K.delete(N);return}if(p.v7_fetcherPersist&&X.has(N)){if(ea(st)||Zn(st)){rn(N,ts(void 0));return}}else{if(ea(st))if(K.delete(N),L>it){rn(N,ts(void 0));return}else return fe.add(N),rn(N,gl(de)),be(dt,st,{fetcherSubmission:de});if(Zn(st)){Xt(N,R,st.error);return}}if(Qs(st))throw En(400,{type:"defer-action"});let on=S.navigation.location||S.location,Bt=Ma(e.history,on,Ie.signal),sl=l||a,Jo=S.navigation.state!=="idle"?qs(sl,S.navigation.location,c):S.matches;Ze(Jo,"Didn't find any matches after fetcher action");let Pa=++z;ee.set(N,Pa);let Ia=gl(de,st.data);S.fetchers.set(N,Ia);let[Da,Gr]=Cw(e.history,S,Jo,de,on,!1,p.v7_skipActionErrorRevalidation,H,J,ne,X,B,fe,sl,c,[G.route.id,st]);Gr.filter(_t=>_t.key!==N).forEach(_t=>{let fo=_t.key,lx=S.fetchers.get(fo),lR=gl(void 0,lx?lx.data:void 0);S.fetchers.set(fo,lR),K.has(fo)&&_n(fo),_t.controller&&K.set(fo,_t.controller)}),ge({fetchers:new Map(S.fetchers)});let xu=()=>Gr.forEach(_t=>_n(_t.key));Ie.signal.addEventListener("abort",xu);let{loaderResults:wu,fetcherResults:bu}=await yt(S.matches,Jo,Da,Gr,Bt);if(Ie.signal.aborted)return;Ie.signal.removeEventListener("abort",xu),ee.delete(N),K.delete(N),Gr.forEach(_t=>K.delete(_t.key));let Ke=Iw([...wu,...bu]);if(Ke){if(Ke.idx>=Da.length){let _t=Gr[Ke.idx-Da.length].key;fe.add(_t)}return be(Bt,Ke.result)}let{loaderData:Mt,errors:Hn}=kw(S,S.matches,Da,wu,void 0,Gr,bu,ie);if(S.fetchers.has(N)){let _t=ts(st.data);S.fetchers.set(N,_t)}pt(Pa),S.navigation.state==="loading"&&Pa>L?(Ze(k,"Expected pending action"),O&&O.abort(),Xe(S.navigation.location,{matches:Jo,loaderData:Mt,errors:Hn,fetchers:new Map(S.fetchers)})):(ge({errors:Hn,loaderData:Nw(S.loaderData,Mt,Jo,Hn),fetchers:new Map(S.fetchers)}),H=!1)}async function oe(N,R,$,G,ve,_e,Le,de){let Ge=S.fetchers.get(N);rn(N,gl(de,Ge?Ge.data:void 0),{flushSync:Le});let ke=new AbortController,Ie=Ma(e.history,$,ke.signal);if(_e){let st=await yu(ve,$,Ie.signal);if(st.type==="aborted")return;if(st.type==="error"){let{error:on}=Ra($,st);Xt(N,R,on,{flushSync:Le});return}else if(st.matches)ve=st.matches,G=Pl(ve,$);else{Xt(N,R,En(404,{pathname:$}),{flushSync:Le});return}}K.set(N,ke);let dt=z,ft=(await Je("loader",Ie,[G],ve))[0];if(Qs(ft)&&(ft=await Vj(ft,Ie.signal,!0)||ft),K.get(N)===ke&&K.delete(N),!Ie.signal.aborted){if(X.has(N)){rn(N,ts(void 0));return}if(ea(ft))if(L>dt){rn(N,ts(void 0));return}else{fe.add(N),await be(Ie,ft);return}if(Zn(ft)){Xt(N,R,ft.error);return}Ze(!Qs(ft),"Unhandled fetcher deferred data"),rn(N,ts(ft.data))}}async function be(N,R,$){let{submission:G,fetcherSubmission:ve,replace:_e}=$===void 0?{}:$;R.response.headers.has("X-Remix-Revalidate")&&(H=!0);let Le=R.response.headers.get("Location");Ze(Le,"Expected a Location header on the redirect Response"),Le=Ew(Le,new URL(N.url),c);let de=xc(S.location,Le,{_isRedirect:!0});if(n){let ft=!1;if(R.response.headers.has("X-Remix-Reload-Document"))ft=!0;else if(Bv.test(Le)){const st=e.history.createURL(Le);ft=st.origin!==t.location.origin||$i(st.pathname,c)==null}if(ft){_e?t.location.replace(Le):t.location.assign(Le);return}}O=null;let Ge=_e===!0?Ht.Replace:Ht.Push,{formMethod:ke,formAction:Ie,formEncType:dt}=S.navigation;!G&&!ve&&ke&&Ie&&dt&&(G=Ow(S.navigation));let it=G||ve;if(cD.has(R.response.status)&&it&&_r(it.formMethod))await Lt(Ge,de,{submission:Rt({},it,{formAction:Le}),preventScrollReset:E});else{let ft=xh(de,G);await Lt(Ge,de,{overrideNavigation:ft,fetcherSubmission:ve,preventScrollReset:E})}}async function Je(N,R,$,G){try{let ve=await yD(u,N,R,$,G,s,o);return await Promise.all(ve.map((_e,Le)=>{if(_D(_e)){let de=_e.result;return{type:ht.redirect,response:bD(de,R,$[Le].route.id,G,c,p.v7_relativeSplatPath)}}return wD(_e)}))}catch(ve){return $.map(()=>({type:ht.error,error:ve}))}}async function yt(N,R,$,G,ve){let[_e,...Le]=await Promise.all([$.length?Je("loader",ve,$,R):[],...G.map(de=>{if(de.matches&&de.match&&de.controller){let Ge=Ma(e.history,de.path,de.controller.signal);return Je("loader",Ge,[de.match],de.matches).then(ke=>ke[0])}else return Promise.resolve({type:ht.error,error:En(404,{pathname:de.path})})})]);return await Promise.all([Dw(N,$,_e,_e.map(()=>ve.signal),!1,S.loaderData),Dw(N,G.map(de=>de.match),Le,G.map(de=>de.controller?de.controller.signal:null),!0)]),{loaderResults:_e,fetcherResults:Le}}function Yt(){H=!0,J.push(...Hr()),B.forEach((N,R)=>{K.has(R)&&(ne.push(R),_n(R))})}function rn(N,R,$){$===void 0&&($={}),S.fetchers.set(N,R),ge({fetchers:new Map(S.fetchers)},{flushSync:($&&$.flushSync)===!0})}function Xt(N,R,$,G){G===void 0&&(G={});let ve=oi(S.matches,R);Ur(N),ge({errors:{[ve.route.id]:$},fetchers:new Map(S.fetchers)},{flushSync:(G&&G.flushSync)===!0})}function qo(N){return p.v7_fetcherPersist&&(te.set(N,(te.get(N)||0)+1),X.has(N)&&X.delete(N)),S.fetchers.get(N)||uD}function Ur(N){let R=S.fetchers.get(N);K.has(N)&&!(R&&R.state==="loading"&&ee.has(N))&&_n(N),B.delete(N),ee.delete(N),fe.delete(N),X.delete(N),S.fetchers.delete(N)}function Bs(N){if(p.v7_fetcherPersist){let R=(te.get(N)||0)-1;R<=0?(te.delete(N),X.add(N)):te.set(N,R)}else Ur(N);ge({fetchers:new Map(S.fetchers)})}function _n(N){let R=K.get(N);Ze(R,"Expected fetch controller: "+N),R.abort(),K.delete(N)}function ce(N){for(let R of N){let $=qo(R),G=ts($.data);S.fetchers.set(R,G)}}function ze(){let N=[],R=!1;for(let $ of fe){let G=S.fetchers.get($);Ze(G,"Expected fetcher: "+$),G.state==="loading"&&(fe.delete($),N.push($),R=!0)}return ce(N),R}function pt(N){let R=[];for(let[$,G]of ee)if(G0}function ot(N,R){let $=S.blockers.get(N)||hl;return re.get(N)!==R&&re.set(N,R),$}function fn(N){S.blockers.delete(N),re.delete(N)}function Br(N,R){let $=S.blockers.get(N)||hl;Ze($.state==="unblocked"&&R.state==="blocked"||$.state==="blocked"&&R.state==="blocked"||$.state==="blocked"&&R.state==="proceeding"||$.state==="blocked"&&R.state==="unblocked"||$.state==="proceeding"&&R.state==="unblocked","Invalid blocker state transition: "+$.state+" -> "+R.state);let G=new Map(S.blockers);G.set(N,R),ge({blockers:G})}function Zo(N){let{currentLocation:R,nextLocation:$,historyAction:G}=N;if(re.size===0)return;re.size>1&&ki(!1,"A router only supports one blocker at a time");let ve=Array.from(re.entries()),[_e,Le]=ve[ve.length-1],de=S.blockers.get(_e);if(!(de&&de.state==="proceeding")&&Le({currentLocation:R,nextLocation:$,historyAction:G}))return _e}function rl(N){let R=En(404,{pathname:N}),$=l||a,{matches:G,route:ve}=Pw($);return Hr(),{notFoundMatches:G,route:ve,error:R}}function Ra(N,R){return{boundaryId:oi(R.partialMatches).route.id,error:En(400,{type:"route-discovery",pathname:N,message:R.error!=null&&"message"in R.error?R.error:String(R.error)})}}function Hr(N){let R=[];return ie.forEach(($,G)=>{(!N||N(G))&&($.cancel(),R.push(G),ie.delete(G))}),R}function ol(N,R,$){if(g=N,w=R,m=$||null,!x&&S.navigation===yh){x=!0;let G=ix(S.location,S.matches);G!=null&&ge({restoreScrollPosition:G})}return()=>{g=null,w=null,m=null}}function ax(N,R){return m&&m(N,R.map(G=>VI(G,S.loaderData)))||N.key}function sR(N,R){if(g&&w){let $=ax(N,R);g[$]=w()}}function ix(N,R){if(g){let $=ax(N,R),G=g[$];if(typeof G=="number")return G}return null}function Hp(N,R,$){if(d)if(N){let G=N[N.length-1].route;if(G.path&&(G.path==="*"||G.path.endsWith("/*")))return{active:!0,matches:hd(R,$,c,!0)}}else return{active:!0,matches:hd(R,$,c,!0)||[]};return{active:!1,matches:null}}async function yu(N,R,$){let G=N,ve=G.length>0?G[G.length-1].route:null;for(;;){let _e=l==null,Le=l||a;try{await mD(d,R,G,Le,s,o,W,$)}catch(Ie){return{type:"error",error:Ie,partialMatches:G}}finally{_e&&(a=[...a])}if($.aborted)return{type:"aborted"};let de=qs(Le,R,c),Ge=!1;if(de){let Ie=de[de.length-1].route;if(Ie.index)return{type:"success",matches:de};if(Ie.path&&Ie.path.length>0)if(Ie.path==="*")Ge=!0;else return{type:"success",matches:de}}let ke=hd(Le,R,c,!0);if(!ke||G.map(Ie=>Ie.route.id).join("-")===ke.map(Ie=>Ie.route.id).join("-"))return{type:"success",matches:Ge?de:null};if(G=ke,ve=G[G.length-1].route,ve.path==="*")return{type:"success",matches:G}}}function aR(N){s={},l=wc(N,o,void 0,s)}function iR(N,R){let $=l==null;Lj(N,R,l||a,s,o),$&&(a=[...a],ge({}))}return j={get basename(){return c},get future(){return p},get state(){return S},get routes(){return a},get window(){return t},initialize:Re,subscribe:Pe,enableScrollRestoration:ol,navigate:kt,fetch:pe,revalidate:Ut,createHref:N=>e.history.createHref(N),encodeLocation:N=>e.history.encodeLocation(N),getFetcher:qo,deleteFetcher:Bs,dispose:Fe,getBlocker:ot,deleteBlocker:fn,patchRoutes:iR,_internalFetchControllers:K,_internalActiveDeferreds:ie,_internalSetRoutes:aR},j}function pD(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function em(e,t,n,r,o,s,a,l){let c,u;if(a){c=[];for(let p of t)if(c.push(p),p.route.id===a){u=p;break}}else c=t,u=t[t.length-1];let d=Gf(o||".",Hf(c,s),$i(e.pathname,n)||e.pathname,l==="path");return o==null&&(d.search=e.search,d.hash=e.hash),(o==null||o===""||o===".")&&u&&u.route.index&&!Hv(d.search)&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),r&&n!=="/"&&(d.pathname=d.pathname==="/"?n:To([n,d.pathname])),ma(d)}function Sw(e,t,n,r){if(!r||!pD(r))return{path:n};if(r.formMethod&&!TD(r.formMethod))return{path:n,error:En(405,{method:r.formMethod})};let o=()=>({path:n,error:En(400,{type:"invalid-body"})}),s=r.formMethod||"get",a=e?s.toUpperCase():s.toLowerCase(),l=$j(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!_r(a))return o();let f=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((h,g)=>{let[m,w]=g;return""+h+m+"="+w+` -`},""):String(r.body);return{path:n,submission:{formMethod:a,formAction:l,formEncType:r.formEncType,formData:void 0,json:void 0,text:f}}}else if(r.formEncType==="application/json"){if(!_r(a))return o();try{let f=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:a,formAction:l,formEncType:r.formEncType,formData:void 0,json:f,text:void 0}}}catch{return o()}}}Ze(typeof FormData=="function","FormData is not available in this environment");let c,u;if(r.formData)c=tm(r.formData),u=r.formData;else if(r.body instanceof FormData)c=tm(r.body),u=r.body;else if(r.body instanceof URLSearchParams)c=r.body,u=Tw(c);else if(r.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(r.body),u=Tw(c)}catch{return o()}let d={formMethod:a,formAction:l,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(_r(d.formMethod))return{path:n,submission:d};let p=$s(n);return t&&p.search&&Hv(p.search)&&c.append("index",""),p.search="?"+c,{path:ma(p),submission:d}}function hD(e,t){let n=e;if(t){let r=e.findIndex(o=>o.route.id===t);r>=0&&(n=e.slice(0,r))}return n}function Cw(e,t,n,r,o,s,a,l,c,u,d,p,f,h,g,m){let w=m?Zn(m[1])?m[1].error:m[1].data:void 0,x=e.createURL(t.location),y=e.createURL(o),b=m&&Zn(m[1])?m[0]:void 0,C=b?hD(n,b):n,j=m?m[1].statusCode:void 0,S=a&&j&&j>=400,k=C.filter((O,F)=>{let{route:Z}=O;if(Z.lazy)return!0;if(Z.loader==null)return!1;if(s)return typeof Z.loader!="function"||Z.loader.hydrate?!0:t.loaderData[Z.id]===void 0&&(!t.errors||t.errors[Z.id]===void 0);if(gD(t.loaderData,t.matches[F],O)||c.some(H=>H===O.route.id))return!0;let I=t.matches[F],q=O;return jw(O,Rt({currentUrl:x,currentParams:I.params,nextUrl:y,nextParams:q.params},r,{actionResult:w,actionStatus:j,defaultShouldRevalidate:S?!1:l||x.pathname+x.search===y.pathname+y.search||x.search!==y.search||Fj(I,q)}))}),E=[];return p.forEach((O,F)=>{if(s||!n.some(J=>J.route.id===O.routeId)||d.has(F))return;let Z=qs(h,O.path,g);if(!Z){E.push({key:F,routeId:O.routeId,path:O.path,matches:null,match:null,controller:null});return}let I=t.fetchers.get(F),q=Pl(Z,O.path),H=!1;f.has(F)?H=!1:u.includes(F)?H=!0:I&&I.state!=="idle"&&I.data===void 0?H=l:H=jw(q,Rt({currentUrl:x,currentParams:t.matches[t.matches.length-1].params,nextUrl:y,nextParams:n[n.length-1].params},r,{actionResult:w,actionStatus:j,defaultShouldRevalidate:S?!1:l})),H&&E.push({key:F,routeId:O.routeId,path:O.path,matches:Z,match:q,controller:new AbortController})}),[k,E]}function gD(e,t,n){let r=!t||n.route.id!==t.route.id,o=e[n.route.id]===void 0;return r||o}function Fj(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function jw(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}async function mD(e,t,n,r,o,s,a,l){let c=[t,...n.map(u=>u.route.id)].join("-");try{let u=a.get(c);u||(u=e({path:t,matches:n,patch:(d,p)=>{l.aborted||Lj(d,p,r,o,s)}}),a.set(c,u)),u&&jD(u)&&await u}finally{a.delete(c)}}function Lj(e,t,n,r,o){if(e){var s;let a=r[e];Ze(a,"No route found to patch children into: routeId = "+e);let l=wc(t,o,[e,"patch",String(((s=a.children)==null?void 0:s.length)||"0")],r);a.children?a.children.push(...l):a.children=l}else{let a=wc(t,o,["patch",String(n.length||"0")],r);n.push(...a)}}async function _w(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let o=n[e.id];Ze(o,"No route found in manifest");let s={};for(let a in r){let c=o[a]!==void 0&&a!=="hasErrorBoundary";ki(!c,'Route "'+o.id+'" has a static property "'+a+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+a+'" will be ignored.')),!c&&!$I.has(a)&&(s[a]=r[a])}Object.assign(o,s),Object.assign(o,Rt({},t(o),{lazy:void 0}))}function vD(e){return Promise.all(e.matches.map(t=>t.resolve()))}async function yD(e,t,n,r,o,s,a,l){let c=r.reduce((p,f)=>p.add(f.route.id),new Set),u=new Set,d=await e({matches:o.map(p=>{let f=c.has(p.route.id);return Rt({},p,{shouldLoad:f,resolve:g=>(u.add(p.route.id),f?xD(t,n,p,s,a,g,l):Promise.resolve({type:ht.data,result:void 0}))})}),request:n,params:o[0].params,context:l});return o.forEach(p=>Ze(u.has(p.route.id),'`match.resolve()` was not called for route id "'+p.route.id+'". You must call `match.resolve()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.')),d.filter((p,f)=>c.has(o[f].route.id))}async function xD(e,t,n,r,o,s,a){let l,c,u=d=>{let p,f=new Promise((m,w)=>p=w);c=()=>p(),t.signal.addEventListener("abort",c);let h=m=>typeof d!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):d({request:t,params:n.params,context:a},...m!==void 0?[m]:[]),g;return s?g=s(m=>h(m)):g=(async()=>{try{return{type:"data",result:await h()}}catch(m){return{type:"error",result:m}}})(),Promise.race([g,f])};try{let d=n.route[e];if(n.route.lazy)if(d){let p,[f]=await Promise.all([u(d).catch(h=>{p=h}),_w(n.route,o,r)]);if(p!==void 0)throw p;l=f}else if(await _w(n.route,o,r),d=n.route[e],d)l=await u(d);else if(e==="action"){let p=new URL(t.url),f=p.pathname+p.search;throw En(405,{method:t.method,pathname:f,routeId:n.route.id})}else return{type:ht.data,result:void 0};else if(d)l=await u(d);else{let p=new URL(t.url),f=p.pathname+p.search;throw En(404,{pathname:f})}Ze(l.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(d){return{type:ht.error,result:d}}finally{c&&t.signal.removeEventListener("abort",c)}return l}async function wD(e){let{result:t,type:n,status:r}=e;if(zj(t)){let a;try{let l=t.headers.get("Content-Type");l&&/\bapplication\/json\b/.test(l)?t.body==null?a=null:a=await t.json():a=await t.text()}catch(l){return{type:ht.error,error:l}}return n===ht.error?{type:ht.error,error:new Uv(t.status,t.statusText,a),statusCode:t.status,headers:t.headers}:{type:ht.data,data:a,statusCode:t.status,headers:t.headers}}if(n===ht.error)return{type:ht.error,error:t,statusCode:Wf(t)?t.status:r};if(ED(t)){var o,s;return{type:ht.deferred,deferredData:t,statusCode:(o=t.init)==null?void 0:o.status,headers:((s=t.init)==null?void 0:s.headers)&&new Headers(t.init.headers)}}return{type:ht.data,data:t,statusCode:r}}function bD(e,t,n,r,o,s){let a=e.headers.get("Location");if(Ze(a,"Redirects returned/thrown from loaders/actions must have a Location header"),!Bv.test(a)){let l=r.slice(0,r.findIndex(c=>c.route.id===n)+1);a=em(new URL(t.url),l,o,!0,a,s),e.headers.set("Location",a)}return e}function Ew(e,t,n){if(Bv.test(e)){let r=e,o=r.startsWith("//")?new URL(t.protocol+r):new URL(r),s=$i(o.pathname,n)!=null;if(o.origin===t.origin&&s)return o.pathname+o.search+o.hash}return e}function Ma(e,t,n,r){let o=e.createURL($j(t)).toString(),s={signal:n};if(r&&_r(r.formMethod)){let{formMethod:a,formEncType:l}=r;s.method=a.toUpperCase(),l==="application/json"?(s.headers=new Headers({"Content-Type":l}),s.body=JSON.stringify(r.json)):l==="text/plain"?s.body=r.text:l==="application/x-www-form-urlencoded"&&r.formData?s.body=tm(r.formData):s.body=r.formData}return new Request(o,s)}function tm(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Tw(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function SD(e,t,n,r,o,s){let a={},l=null,c,u=!1,d={},p=r&&Zn(r[1])?r[1].error:void 0;return n.forEach((f,h)=>{let g=t[h].route.id;if(Ze(!ea(f),"Cannot handle redirect results in processLoaderData"),Zn(f)){let m=f.error;p!==void 0&&(m=p,p=void 0),l=l||{};{let w=oi(e,g);l[w.route.id]==null&&(l[w.route.id]=m)}a[g]=void 0,u||(u=!0,c=Wf(f.error)?f.error.status:500),f.headers&&(d[g]=f.headers)}else Qs(f)?(o.set(g,f.deferredData),a[g]=f.deferredData.data,f.statusCode!=null&&f.statusCode!==200&&!u&&(c=f.statusCode),f.headers&&(d[g]=f.headers)):(a[g]=f.data,f.statusCode&&f.statusCode!==200&&!u&&(c=f.statusCode),f.headers&&(d[g]=f.headers))}),p!==void 0&&r&&(l={[r[0]]:p},a[r[0]]=void 0),{loaderData:a,errors:l,statusCode:c||200,loaderHeaders:d}}function kw(e,t,n,r,o,s,a,l){let{loaderData:c,errors:u}=SD(t,n,r,o,l);for(let d=0;dr.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function Pw(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function En(e,t){let{pathname:n,routeId:r,method:o,type:s,message:a}=t===void 0?{}:t,l="Unknown Server Error",c="Unknown @remix-run/router error";return e===400?(l="Bad Request",s==="route-discovery"?c='Unable to match URL "'+n+'" - the `unstable_patchRoutesOnMiss()` '+(`function threw the following error: -`+a):o&&n&&r?c="You made a "+o+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":s==="defer-action"?c="defer() is not supported in actions":s==="invalid-body"&&(c="Unable to encode submission body")):e===403?(l="Forbidden",c='Route "'+r+'" does not match URL "'+n+'"'):e===404?(l="Not Found",c='No route matches URL "'+n+'"'):e===405&&(l="Method Not Allowed",o&&n&&r?c="You made a "+o.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":o&&(c='Invalid request method "'+o.toUpperCase()+'"')),new Uv(e||500,l,new Error(c),!0)}function Iw(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(ea(n))return{result:n,idx:t}}}function $j(e){let t=typeof e=="string"?$s(e):e;return ma(Rt({},t,{hash:""}))}function CD(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function jD(e){return typeof e=="object"&&e!=null&&"then"in e}function _D(e){return zj(e.result)&&lD.has(e.result.status)}function Qs(e){return e.type===ht.deferred}function Zn(e){return e.type===ht.error}function ea(e){return(e&&e.type)===ht.redirect}function ED(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function zj(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function TD(e){return iD.has(e.toLowerCase())}function _r(e){return sD.has(e.toLowerCase())}async function Dw(e,t,n,r,o,s){for(let a=0;ap.route.id===c.route.id),d=u!=null&&!Fj(u,c)&&(s&&s[c.route.id])!==void 0;if(Qs(l)&&(o||d)){let p=r[a];Ze(p,"Expected an AbortSignal for revalidating fetcher deferred result"),await Vj(l,p,o).then(f=>{f&&(n[a]=f||n[a])})}}}async function Vj(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:ht.data,data:e.deferredData.unwrappedData}}catch(o){return{type:ht.error,error:o}}return{type:ht.data,data:e.deferredData.data}}}function Hv(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Pl(e,t){let n=typeof t=="string"?$s(t).search:t.search;if(e[e.length-1].route.index&&Hv(n||""))return e[e.length-1];let r=Oj(e);return r[r.length-1]}function Ow(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:s,json:a}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(s!=null)return{formMethod:t,formAction:n,formEncType:r,formData:s,json:void 0,text:void 0};if(a!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:a,text:void 0}}}function xh(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function kD(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function gl(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function ND(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function ts(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function RD(e,t){try{let n=e.sessionStorage.getItem(Aj);if(n){let r=JSON.parse(n);for(let[o,s]of Object.entries(r||{}))s&&Array.isArray(s)&&t.set(o,new Set(s||[]))}}catch{}}function PD(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(Aj,JSON.stringify(n))}catch(r){ki(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/** + */function Rt(){return Rt=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Ni(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function LI(){return Math.random().toString(36).substr(2,8)}function xw(e,t){return{usr:e.state,key:e.key,idx:t}}function xc(e,t,n,r){return n===void 0&&(n=null),Rt({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?$s(t):t,{state:n,key:t&&t.key||r||LI()})}function ma(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function $s(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function $I(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:s=!1}=r,a=o.history,l=Ht.Pop,c=null,u=d();u==null&&(u=0,a.replaceState(Rt({},a.state,{idx:u}),""));function d(){return(a.state||{idx:null}).idx}function p(){l=Ht.Pop;let w=d(),x=w==null?null:w-u;u=w,c&&c({action:l,location:m.location,delta:x})}function f(w,x){l=Ht.Push;let y=xc(m.location,w,x);u=d()+1;let b=xw(y,u),C=m.createHref(y);try{a.pushState(b,"",C)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;o.location.assign(C)}s&&c&&c({action:l,location:m.location,delta:1})}function h(w,x){l=Ht.Replace;let y=xc(m.location,w,x);u=d();let b=xw(y,u),C=m.createHref(y);a.replaceState(b,"",C),s&&c&&c({action:l,location:m.location,delta:0})}function g(w){let x=o.location.origin!=="null"?o.location.origin:o.location.href,y=typeof w=="string"?w:ma(w);return y=y.replace(/ $/,"%20"),Ze(x,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,x)}let m={get action(){return l},get location(){return e(o,a)},listen(w){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(yw,p),c=w,()=>{o.removeEventListener(yw,p),c=null}},createHref(w){return t(o,w)},createURL:g,encodeLocation(w){let x=g(w);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:h,go(w){return a.go(w)}};return m}var ht;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(ht||(ht={}));const zI=new Set(["lazy","caseSensitive","path","id","index","children"]);function VI(e){return e.index===!0}function wc(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((o,s)=>{let a=[...n,String(s)],l=typeof o.id=="string"?o.id:a.join("-");if(Ze(o.index!==!0||!o.children,"Cannot specify children on an index route"),Ze(!r[l],'Found a route id collision on id "'+l+`". Route id's must be globally unique within Data Router usages`),VI(o)){let c=Rt({},o,t(o),{id:l});return r[l]=c,c}else{let c=Rt({},o,t(o),{id:l,children:void 0});return r[l]=c,o.children&&(c.children=wc(o.children,t,a,r)),c}})}function qs(e,t,n){return n===void 0&&(n="/"),hd(e,t,n,!1)}function hd(e,t,n,r){let o=typeof t=="string"?$s(t):t,s=zi(o.pathname||"/",n);if(s==null)return null;let a=Ij(e);BI(a);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:a,route:s};c.relativePath.startsWith("/")&&(Ze(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=To([r,c.relativePath]),d=n.concat(c);s.children&&s.children.length>0&&(Ze(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Ij(s.children,t,d,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:JI(u,s.index),routesMeta:d})};return e.forEach((s,a)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))o(s,a);else for(let c of Dj(s.path))o(s,a,c)}),t}function Dj(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return o?[s,""]:[s];let a=Dj(r.join("/")),l=[];return l.push(...a.map(c=>c===""?s:[s,c].join("/"))),o&&l.push(...a),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function BI(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:YI(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const HI=/^:[\w-]+$/,GI=3,WI=2,KI=1,qI=10,ZI=-2,ww=e=>e==="*";function JI(e,t){let n=e.split("/"),r=n.length;return n.some(ww)&&(r+=ZI),t&&(r+=WI),n.filter(o=>!ww(o)).reduce((o,s)=>o+(HI.test(s)?GI:s===""?KI:qI),r)}function YI(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function XI(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,o={},s="/",a=[];for(let l=0;l{let{paramName:f,isOptional:h}=d;if(f==="*"){let m=l[p]||"";a=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[p];return h&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:a,pattern:e}}function QI(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Ni(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function eD(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ni(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function zi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function tD(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?$s(e):e;return{pathname:n?n.startsWith("/")?n:nD(n,t):t,search:oD(r),hash:sD(o)}}function nD(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function vh(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Oj(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Hf(e,t){let n=Oj(e);return t?n.map((r,o)=>o===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Gf(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=$s(e):(o=Rt({},e),Ze(!o.pathname||!o.pathname.includes("?"),vh("?","pathname","search",o)),Ze(!o.pathname||!o.pathname.includes("#"),vh("#","pathname","hash",o)),Ze(!o.search||!o.search.includes("#"),vh("#","search","hash",o)));let s=e===""||o.pathname==="",a=s?"/":o.pathname,l;if(a==null)l=n;else{let p=t.length-1;if(!r&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),p-=1;o.pathname=f.join("/")}l=p>=0?t[p]:"/"}let c=tD(o,l),u=a&&a!=="/"&&a.endsWith("/"),d=(s||a===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const To=e=>e.join("/").replace(/\/\/+/g,"/"),rD=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),oD=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,sD=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Uv{constructor(t,n,r,o){o===void 0&&(o=!1),this.status=t,this.statusText=n||"",this.internal=o,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function Wf(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Mj=["post","put","patch","delete"],aD=new Set(Mj),iD=["get",...Mj],lD=new Set(iD),cD=new Set([301,302,303,307,308]),uD=new Set([307,308]),yh={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},dD={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},hl={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Bv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fD=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Aj="remix-router-transitions";function pD(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;Ze(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let o;if(e.mapRouteProperties)o=e.mapRouteProperties;else if(e.detectErrorBoundary){let N=e.detectErrorBoundary;o=R=>({hasErrorBoundary:N(R)})}else o=fD;let s={},a=wc(e.routes,o,void 0,s),l,c=e.basename||"/",u=e.unstable_dataStrategy||yD,d=e.unstable_patchRoutesOnMiss,p=Rt({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),f=null,h=new Set,g=null,m=null,w=null,x=e.hydrationData!=null,y=qs(a,e.history.location,c),b=null;if(y==null&&!d){let N=En(404,{pathname:e.history.location.pathname}),{matches:R,route:$}=Pw(a);y=R,b={[$.id]:N}}y&&d&&!e.hydrationData&&Hp(y,a,e.history.location.pathname).active&&(y=null);let C;if(!y)C=!1,y=[];else if(y.some(N=>N.route.lazy))C=!1;else if(!y.some(N=>N.route.loader))C=!0;else if(p.v7_partialHydration){let N=e.hydrationData?e.hydrationData.loaderData:null,R=e.hydrationData?e.hydrationData.errors:null,$=G=>G.route.loader?typeof G.route.loader=="function"&&G.route.loader.hydrate===!0?!1:N&&N[G.route.id]!==void 0||R&&R[G.route.id]!==void 0:!0;if(R){let G=y.findIndex(ve=>R[ve.route.id]!==void 0);C=y.slice(0,G+1).every($)}else C=y.every($)}else C=e.hydrationData!=null;let j,S={historyAction:e.history.action,location:e.history.location,matches:y,initialized:C,navigation:yh,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},k=Ht.Pop,E=!1,O,F=!1,Z=new Map,I=null,q=!1,H=!1,J=[],ne=[],K=new Map,z=0,L=-1,ee=new Map,fe=new Set,B=new Map,te=new Map,X=new Set,ie=new Map,re=new Map,W=new Map,we=!1;function Re(){if(f=e.history.listen(N=>{let{action:R,location:$,delta:G}=N;if(we){we=!1;return}Ni(re.size===0||G!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let ve=Zo({currentLocation:S.location,nextLocation:$,historyAction:R});if(ve&&G!=null){we=!0,e.history.go(G*-1),Br(ve,{state:"blocked",location:$,proceed(){Br(ve,{state:"proceeding",proceed:void 0,reset:void 0,location:$}),e.history.go(G)},reset(){let _e=new Map(S.blockers);_e.set(ve,hl),ge({blockers:_e})}});return}return Lt(R,$)}),n){PD(t,Z);let N=()=>ID(t,Z);t.addEventListener("pagehide",N),I=()=>t.removeEventListener("pagehide",N)}return S.initialized||Lt(Ht.Pop,S.location,{initialHydration:!0}),j}function Fe(){f&&f(),I&&I(),h.clear(),O&&O.abort(),S.fetchers.forEach((N,R)=>Ur(R)),S.blockers.forEach((N,R)=>fn(R))}function Pe(N){return h.add(N),()=>h.delete(N)}function ge(N,R){R===void 0&&(R={}),S=Rt({},S,N);let $=[],G=[];p.v7_fetcherPersist&&S.fetchers.forEach((ve,_e)=>{ve.state==="idle"&&(X.has(_e)?G.push(_e):$.push(_e))}),[...h].forEach(ve=>ve(S,{deletedFetchers:G,unstable_viewTransitionOpts:R.viewTransitionOpts,unstable_flushSync:R.flushSync===!0})),p.v7_fetcherPersist&&($.forEach(ve=>S.fetchers.delete(ve)),G.forEach(ve=>Ur(ve)))}function Xe(N,R,$){var G,ve;let{flushSync:_e}=$===void 0?{}:$,Le=S.actionData!=null&&S.navigation.formMethod!=null&&_r(S.navigation.formMethod)&&S.navigation.state==="loading"&&((G=N.state)==null?void 0:G._isRedirect)!==!0,de;R.actionData?Object.keys(R.actionData).length>0?de=R.actionData:de=null:Le?de=S.actionData:de=null;let Ge=R.loaderData?Nw(S.loaderData,R.loaderData,R.matches||[],R.errors):S.loaderData,ke=S.blockers;ke.size>0&&(ke=new Map(ke),ke.forEach((it,ft)=>ke.set(ft,hl)));let Ie=E===!0||S.navigation.formMethod!=null&&_r(S.navigation.formMethod)&&((ve=N.state)==null?void 0:ve._isRedirect)!==!0;l&&(a=l,l=void 0),q||k===Ht.Pop||(k===Ht.Push?e.history.push(N,N.state):k===Ht.Replace&&e.history.replace(N,N.state));let dt;if(k===Ht.Pop){let it=Z.get(S.location.pathname);it&&it.has(N.pathname)?dt={currentLocation:S.location,nextLocation:N}:Z.has(N.pathname)&&(dt={currentLocation:N,nextLocation:S.location})}else if(F){let it=Z.get(S.location.pathname);it?it.add(N.pathname):(it=new Set([N.pathname]),Z.set(S.location.pathname,it)),dt={currentLocation:S.location,nextLocation:N}}ge(Rt({},R,{actionData:de,loaderData:Ge,historyAction:k,location:N,initialized:!0,navigation:yh,revalidation:"idle",restoreScrollPosition:ix(N,R.matches||S.matches),preventScrollReset:Ie,blockers:ke}),{viewTransitionOpts:dt,flushSync:_e===!0}),k=Ht.Pop,E=!1,F=!1,q=!1,H=!1,J=[],ne=[]}async function kt(N,R){if(typeof N=="number"){e.history.go(N);return}let $=em(S.location,S.matches,c,p.v7_prependBasename,N,p.v7_relativeSplatPath,R==null?void 0:R.fromRouteId,R==null?void 0:R.relative),{path:G,submission:ve,error:_e}=Sw(p.v7_normalizeFormMethod,!1,$,R),Le=S.location,de=xc(S.location,G,R&&R.state);de=Rt({},de,e.history.encodeLocation(de));let Ge=R&&R.replace!=null?R.replace:void 0,ke=Ht.Push;Ge===!0?ke=Ht.Replace:Ge===!1||ve!=null&&_r(ve.formMethod)&&ve.formAction===S.location.pathname+S.location.search&&(ke=Ht.Replace);let Ie=R&&"preventScrollReset"in R?R.preventScrollReset===!0:void 0,dt=(R&&R.unstable_flushSync)===!0,it=Zo({currentLocation:Le,nextLocation:de,historyAction:ke});if(it){Br(it,{state:"blocked",location:de,proceed(){Br(it,{state:"proceeding",proceed:void 0,reset:void 0,location:de}),kt(N,R)},reset(){let ft=new Map(S.blockers);ft.set(it,hl),ge({blockers:ft})}});return}return await Lt(ke,de,{submission:ve,pendingError:_e,preventScrollReset:Ie,replace:R&&R.replace,enableViewTransition:R&&R.unstable_viewTransition,flushSync:dt})}function Ut(){if(Yt(),ge({revalidation:"loading"}),S.navigation.state!=="submitting"){if(S.navigation.state==="idle"){Lt(S.historyAction,S.location,{startUninterruptedRevalidation:!0});return}Lt(k||S.historyAction,S.navigation.location,{overrideNavigation:S.navigation})}}async function Lt(N,R,$){O&&O.abort(),O=null,k=N,q=($&&$.startUninterruptedRevalidation)===!0,aR(S.location,S.matches),E=($&&$.preventScrollReset)===!0,F=($&&$.enableViewTransition)===!0;let G=l||a,ve=$&&$.overrideNavigation,_e=qs(G,R,c),Le=($&&$.flushSync)===!0,de=Hp(_e,G,R.pathname);if(de.active&&de.matches&&(_e=de.matches),!_e){let{error:st,notFoundMatches:on,route:Bt}=rl(R.pathname);Xe(R,{matches:on,loaderData:{},errors:{[Bt.id]:st}},{flushSync:Le});return}if(S.initialized&&!H&&jD(S.location,R)&&!($&&$.submission&&_r($.submission.formMethod))){Xe(R,{matches:_e},{flushSync:Le});return}O=new AbortController;let Ge=Aa(e.history,R,O.signal,$&&$.submission),ke;if($&&$.pendingError)ke=[si(_e).route.id,{type:ht.error,error:$.pendingError}];else if($&&$.submission&&_r($.submission.formMethod)){let st=await Wt(Ge,R,$.submission,_e,de.active,{replace:$.replace,flushSync:Le});if(st.shortCircuited)return;if(st.pendingActionResult){let[on,Bt]=st.pendingActionResult;if(Zn(Bt)&&Wf(Bt.error)&&Bt.error.status===404){O=null,Xe(R,{matches:st.matches,loaderData:{},errors:{[on]:Bt.error}});return}}_e=st.matches||_e,ke=st.pendingActionResult,ve=xh(R,$.submission),Le=!1,de.active=!1,Ge=Aa(e.history,Ge.url,Ge.signal)}let{shortCircuited:Ie,matches:dt,loaderData:it,errors:ft}=await _(Ge,R,_e,de.active,ve,$&&$.submission,$&&$.fetcherSubmission,$&&$.replace,$&&$.initialHydration===!0,Le,ke);Ie||(O=null,Xe(R,Rt({matches:dt||_e},Rw(ke),{loaderData:it,errors:ft})))}async function Wt(N,R,$,G,ve,_e){_e===void 0&&(_e={}),Yt();let Le=ND(R,$);if(ge({navigation:Le},{flushSync:_e.flushSync===!0}),ve){let ke=await yu(G,R.pathname,N.signal);if(ke.type==="aborted")return{shortCircuited:!0};if(ke.type==="error"){let{boundaryId:Ie,error:dt}=Pa(R.pathname,ke);return{matches:ke.partialMatches,pendingActionResult:[Ie,{type:ht.error,error:dt}]}}else if(ke.matches)G=ke.matches;else{let{notFoundMatches:Ie,error:dt,route:it}=rl(R.pathname);return{matches:Ie,pendingActionResult:[it.id,{type:ht.error,error:dt}]}}}let de,Ge=Pl(G,R);if(!Ge.route.action&&!Ge.route.lazy)de={type:ht.error,error:En(405,{method:N.method,pathname:R.pathname,routeId:Ge.route.id})};else if(de=(await Je("action",N,[Ge],G))[0],N.signal.aborted)return{shortCircuited:!0};if(ea(de)){let ke;return _e&&_e.replace!=null?ke=_e.replace:ke=Ew(de.response.headers.get("Location"),new URL(N.url),c)===S.location.pathname+S.location.search,await be(N,de,{submission:$,replace:ke}),{shortCircuited:!0}}if(Qs(de))throw En(400,{type:"defer-action"});if(Zn(de)){let ke=si(G,Ge.route.id);return(_e&&_e.replace)!==!0&&(k=Ht.Push),{matches:G,pendingActionResult:[ke.route.id,de]}}return{matches:G,pendingActionResult:[Ge.route.id,de]}}async function _(N,R,$,G,ve,_e,Le,de,Ge,ke,Ie){let dt=ve||xh(R,_e),it=_e||Le||Ow(dt),ft=!q&&(!p.v7_partialHydration||!Ge);if(G){if(ft){let Mt=D(Ie);ge(Rt({navigation:dt},Mt!==void 0?{actionData:Mt}:{}),{flushSync:ke})}let Ke=await yu($,R.pathname,N.signal);if(Ke.type==="aborted")return{shortCircuited:!0};if(Ke.type==="error"){let{boundaryId:Mt,error:Hn}=Pa(R.pathname,Ke);return{matches:Ke.partialMatches,loaderData:{},errors:{[Mt]:Hn}}}else if(Ke.matches)$=Ke.matches;else{let{error:Mt,notFoundMatches:Hn,route:_t}=rl(R.pathname);return{matches:Hn,loaderData:{},errors:{[_t.id]:Mt}}}}let st=l||a,[on,Bt]=Cw(e.history,S,$,it,R,p.v7_partialHydration&&Ge===!0,p.v7_skipActionErrorRevalidation,H,J,ne,X,B,fe,st,c,Ie);if(Hr(Ke=>!($&&$.some(Mt=>Mt.route.id===Ke))||on&&on.some(Mt=>Mt.route.id===Ke)),L=++z,on.length===0&&Bt.length===0){let Ke=ze();return Xe(R,Rt({matches:$,loaderData:{},errors:Ie&&Zn(Ie[1])?{[Ie[0]]:Ie[1].error}:null},Rw(Ie),Ke?{fetchers:new Map(S.fetchers)}:{}),{flushSync:ke}),{shortCircuited:!0}}if(ft){let Ke={};if(!G){Ke.navigation=dt;let Mt=D(Ie);Mt!==void 0&&(Ke.actionData=Mt)}Bt.length>0&&(Ke.fetchers=U(Bt)),ge(Ke,{flushSync:ke})}Bt.forEach(Ke=>{K.has(Ke.key)&&_n(Ke.key),Ke.controller&&K.set(Ke.key,Ke.controller)});let sl=()=>Bt.forEach(Ke=>_n(Ke.key));O&&O.signal.addEventListener("abort",sl);let{loaderResults:Jo,fetcherResults:Ia}=await yt(S.matches,$,on,Bt,N);if(N.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener("abort",sl),Bt.forEach(Ke=>K.delete(Ke.key));let Da=Iw([...Jo,...Ia]);if(Da){if(Da.idx>=on.length){let Ke=Bt[Da.idx-on.length].key;fe.add(Ke)}return await be(N,Da.result,{replace:de}),{shortCircuited:!0}}let{loaderData:Oa,errors:Gr}=kw(S,$,on,Jo,Ie,Bt,Ia,ie);ie.forEach((Ke,Mt)=>{Ke.subscribe(Hn=>{(Hn||Ke.done)&&ie.delete(Mt)})}),p.v7_partialHydration&&Ge&&S.errors&&Object.entries(S.errors).filter(Ke=>{let[Mt]=Ke;return!on.some(Hn=>Hn.route.id===Mt)}).forEach(Ke=>{let[Mt,Hn]=Ke;Gr=Object.assign(Gr||{},{[Mt]:Hn})});let xu=ze(),wu=pt(L),bu=xu||wu||Bt.length>0;return Rt({matches:$,loaderData:Oa,errors:Gr},bu?{fetchers:new Map(S.fetchers)}:{})}function D(N){if(N&&!Zn(N[1]))return{[N[0]]:N[1].data};if(S.actionData)return Object.keys(S.actionData).length===0?null:S.actionData}function U(N){return N.forEach(R=>{let $=S.fetchers.get(R.key),G=gl(void 0,$?$.data:void 0);S.fetchers.set(R.key,G)}),new Map(S.fetchers)}function pe(N,R,$,G){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");K.has(N)&&_n(N);let ve=(G&&G.unstable_flushSync)===!0,_e=l||a,Le=em(S.location,S.matches,c,p.v7_prependBasename,$,p.v7_relativeSplatPath,R,G==null?void 0:G.relative),de=qs(_e,Le,c),Ge=Hp(de,_e,Le);if(Ge.active&&Ge.matches&&(de=Ge.matches),!de){Xt(N,R,En(404,{pathname:Le}),{flushSync:ve});return}let{path:ke,submission:Ie,error:dt}=Sw(p.v7_normalizeFormMethod,!0,Le,G);if(dt){Xt(N,R,dt,{flushSync:ve});return}let it=Pl(de,ke);if(E=(G&&G.preventScrollReset)===!0,Ie&&_r(Ie.formMethod)){le(N,R,ke,it,de,Ge.active,ve,Ie);return}B.set(N,{routeId:R,path:ke}),oe(N,R,ke,it,de,Ge.active,ve,Ie)}async function le(N,R,$,G,ve,_e,Le,de){Yt(),B.delete(N);function Ge(_t){if(!_t.route.action&&!_t.route.lazy){let fo=En(405,{method:de.formMethod,pathname:$,routeId:R});return Xt(N,R,fo,{flushSync:Le}),!0}return!1}if(!_e&&Ge(G))return;let ke=S.fetchers.get(N);rn(N,RD(de,ke),{flushSync:Le});let Ie=new AbortController,dt=Aa(e.history,$,Ie.signal,de);if(_e){let _t=await yu(ve,$,dt.signal);if(_t.type==="aborted")return;if(_t.type==="error"){let{error:fo}=Pa($,_t);Xt(N,R,fo,{flushSync:Le});return}else if(_t.matches){if(ve=_t.matches,G=Pl(ve,$),Ge(G))return}else{Xt(N,R,En(404,{pathname:$}),{flushSync:Le});return}}K.set(N,Ie);let it=z,st=(await Je("action",dt,[G],ve))[0];if(dt.signal.aborted){K.get(N)===Ie&&K.delete(N);return}if(p.v7_fetcherPersist&&X.has(N)){if(ea(st)||Zn(st)){rn(N,ts(void 0));return}}else{if(ea(st))if(K.delete(N),L>it){rn(N,ts(void 0));return}else return fe.add(N),rn(N,gl(de)),be(dt,st,{fetcherSubmission:de});if(Zn(st)){Xt(N,R,st.error);return}}if(Qs(st))throw En(400,{type:"defer-action"});let on=S.navigation.location||S.location,Bt=Aa(e.history,on,Ie.signal),sl=l||a,Jo=S.navigation.state!=="idle"?qs(sl,S.navigation.location,c):S.matches;Ze(Jo,"Didn't find any matches after fetcher action");let Ia=++z;ee.set(N,Ia);let Da=gl(de,st.data);S.fetchers.set(N,Da);let[Oa,Gr]=Cw(e.history,S,Jo,de,on,!1,p.v7_skipActionErrorRevalidation,H,J,ne,X,B,fe,sl,c,[G.route.id,st]);Gr.filter(_t=>_t.key!==N).forEach(_t=>{let fo=_t.key,lx=S.fetchers.get(fo),cR=gl(void 0,lx?lx.data:void 0);S.fetchers.set(fo,cR),K.has(fo)&&_n(fo),_t.controller&&K.set(fo,_t.controller)}),ge({fetchers:new Map(S.fetchers)});let xu=()=>Gr.forEach(_t=>_n(_t.key));Ie.signal.addEventListener("abort",xu);let{loaderResults:wu,fetcherResults:bu}=await yt(S.matches,Jo,Oa,Gr,Bt);if(Ie.signal.aborted)return;Ie.signal.removeEventListener("abort",xu),ee.delete(N),K.delete(N),Gr.forEach(_t=>K.delete(_t.key));let Ke=Iw([...wu,...bu]);if(Ke){if(Ke.idx>=Oa.length){let _t=Gr[Ke.idx-Oa.length].key;fe.add(_t)}return be(Bt,Ke.result)}let{loaderData:Mt,errors:Hn}=kw(S,S.matches,Oa,wu,void 0,Gr,bu,ie);if(S.fetchers.has(N)){let _t=ts(st.data);S.fetchers.set(N,_t)}pt(Ia),S.navigation.state==="loading"&&Ia>L?(Ze(k,"Expected pending action"),O&&O.abort(),Xe(S.navigation.location,{matches:Jo,loaderData:Mt,errors:Hn,fetchers:new Map(S.fetchers)})):(ge({errors:Hn,loaderData:Nw(S.loaderData,Mt,Jo,Hn),fetchers:new Map(S.fetchers)}),H=!1)}async function oe(N,R,$,G,ve,_e,Le,de){let Ge=S.fetchers.get(N);rn(N,gl(de,Ge?Ge.data:void 0),{flushSync:Le});let ke=new AbortController,Ie=Aa(e.history,$,ke.signal);if(_e){let st=await yu(ve,$,Ie.signal);if(st.type==="aborted")return;if(st.type==="error"){let{error:on}=Pa($,st);Xt(N,R,on,{flushSync:Le});return}else if(st.matches)ve=st.matches,G=Pl(ve,$);else{Xt(N,R,En(404,{pathname:$}),{flushSync:Le});return}}K.set(N,ke);let dt=z,ft=(await Je("loader",Ie,[G],ve))[0];if(Qs(ft)&&(ft=await Vj(ft,Ie.signal,!0)||ft),K.get(N)===ke&&K.delete(N),!Ie.signal.aborted){if(X.has(N)){rn(N,ts(void 0));return}if(ea(ft))if(L>dt){rn(N,ts(void 0));return}else{fe.add(N),await be(Ie,ft);return}if(Zn(ft)){Xt(N,R,ft.error);return}Ze(!Qs(ft),"Unhandled fetcher deferred data"),rn(N,ts(ft.data))}}async function be(N,R,$){let{submission:G,fetcherSubmission:ve,replace:_e}=$===void 0?{}:$;R.response.headers.has("X-Remix-Revalidate")&&(H=!0);let Le=R.response.headers.get("Location");Ze(Le,"Expected a Location header on the redirect Response"),Le=Ew(Le,new URL(N.url),c);let de=xc(S.location,Le,{_isRedirect:!0});if(n){let ft=!1;if(R.response.headers.has("X-Remix-Reload-Document"))ft=!0;else if(Bv.test(Le)){const st=e.history.createURL(Le);ft=st.origin!==t.location.origin||zi(st.pathname,c)==null}if(ft){_e?t.location.replace(Le):t.location.assign(Le);return}}O=null;let Ge=_e===!0?Ht.Replace:Ht.Push,{formMethod:ke,formAction:Ie,formEncType:dt}=S.navigation;!G&&!ve&&ke&&Ie&&dt&&(G=Ow(S.navigation));let it=G||ve;if(uD.has(R.response.status)&&it&&_r(it.formMethod))await Lt(Ge,de,{submission:Rt({},it,{formAction:Le}),preventScrollReset:E});else{let ft=xh(de,G);await Lt(Ge,de,{overrideNavigation:ft,fetcherSubmission:ve,preventScrollReset:E})}}async function Je(N,R,$,G){try{let ve=await xD(u,N,R,$,G,s,o);return await Promise.all(ve.map((_e,Le)=>{if(ED(_e)){let de=_e.result;return{type:ht.redirect,response:SD(de,R,$[Le].route.id,G,c,p.v7_relativeSplatPath)}}return bD(_e)}))}catch(ve){return $.map(()=>({type:ht.error,error:ve}))}}async function yt(N,R,$,G,ve){let[_e,...Le]=await Promise.all([$.length?Je("loader",ve,$,R):[],...G.map(de=>{if(de.matches&&de.match&&de.controller){let Ge=Aa(e.history,de.path,de.controller.signal);return Je("loader",Ge,[de.match],de.matches).then(ke=>ke[0])}else return Promise.resolve({type:ht.error,error:En(404,{pathname:de.path})})})]);return await Promise.all([Dw(N,$,_e,_e.map(()=>ve.signal),!1,S.loaderData),Dw(N,G.map(de=>de.match),Le,G.map(de=>de.controller?de.controller.signal:null),!0)]),{loaderResults:_e,fetcherResults:Le}}function Yt(){H=!0,J.push(...Hr()),B.forEach((N,R)=>{K.has(R)&&(ne.push(R),_n(R))})}function rn(N,R,$){$===void 0&&($={}),S.fetchers.set(N,R),ge({fetchers:new Map(S.fetchers)},{flushSync:($&&$.flushSync)===!0})}function Xt(N,R,$,G){G===void 0&&(G={});let ve=si(S.matches,R);Ur(N),ge({errors:{[ve.route.id]:$},fetchers:new Map(S.fetchers)},{flushSync:(G&&G.flushSync)===!0})}function qo(N){return p.v7_fetcherPersist&&(te.set(N,(te.get(N)||0)+1),X.has(N)&&X.delete(N)),S.fetchers.get(N)||dD}function Ur(N){let R=S.fetchers.get(N);K.has(N)&&!(R&&R.state==="loading"&&ee.has(N))&&_n(N),B.delete(N),ee.delete(N),fe.delete(N),X.delete(N),S.fetchers.delete(N)}function Bs(N){if(p.v7_fetcherPersist){let R=(te.get(N)||0)-1;R<=0?(te.delete(N),X.add(N)):te.set(N,R)}else Ur(N);ge({fetchers:new Map(S.fetchers)})}function _n(N){let R=K.get(N);Ze(R,"Expected fetch controller: "+N),R.abort(),K.delete(N)}function ce(N){for(let R of N){let $=qo(R),G=ts($.data);S.fetchers.set(R,G)}}function ze(){let N=[],R=!1;for(let $ of fe){let G=S.fetchers.get($);Ze(G,"Expected fetcher: "+$),G.state==="loading"&&(fe.delete($),N.push($),R=!0)}return ce(N),R}function pt(N){let R=[];for(let[$,G]of ee)if(G0}function ot(N,R){let $=S.blockers.get(N)||hl;return re.get(N)!==R&&re.set(N,R),$}function fn(N){S.blockers.delete(N),re.delete(N)}function Br(N,R){let $=S.blockers.get(N)||hl;Ze($.state==="unblocked"&&R.state==="blocked"||$.state==="blocked"&&R.state==="blocked"||$.state==="blocked"&&R.state==="proceeding"||$.state==="blocked"&&R.state==="unblocked"||$.state==="proceeding"&&R.state==="unblocked","Invalid blocker state transition: "+$.state+" -> "+R.state);let G=new Map(S.blockers);G.set(N,R),ge({blockers:G})}function Zo(N){let{currentLocation:R,nextLocation:$,historyAction:G}=N;if(re.size===0)return;re.size>1&&Ni(!1,"A router only supports one blocker at a time");let ve=Array.from(re.entries()),[_e,Le]=ve[ve.length-1],de=S.blockers.get(_e);if(!(de&&de.state==="proceeding")&&Le({currentLocation:R,nextLocation:$,historyAction:G}))return _e}function rl(N){let R=En(404,{pathname:N}),$=l||a,{matches:G,route:ve}=Pw($);return Hr(),{notFoundMatches:G,route:ve,error:R}}function Pa(N,R){return{boundaryId:si(R.partialMatches).route.id,error:En(400,{type:"route-discovery",pathname:N,message:R.error!=null&&"message"in R.error?R.error:String(R.error)})}}function Hr(N){let R=[];return ie.forEach(($,G)=>{(!N||N(G))&&($.cancel(),R.push(G),ie.delete(G))}),R}function ol(N,R,$){if(g=N,w=R,m=$||null,!x&&S.navigation===yh){x=!0;let G=ix(S.location,S.matches);G!=null&&ge({restoreScrollPosition:G})}return()=>{g=null,w=null,m=null}}function ax(N,R){return m&&m(N,R.map(G=>UI(G,S.loaderData)))||N.key}function aR(N,R){if(g&&w){let $=ax(N,R);g[$]=w()}}function ix(N,R){if(g){let $=ax(N,R),G=g[$];if(typeof G=="number")return G}return null}function Hp(N,R,$){if(d)if(N){let G=N[N.length-1].route;if(G.path&&(G.path==="*"||G.path.endsWith("/*")))return{active:!0,matches:hd(R,$,c,!0)}}else return{active:!0,matches:hd(R,$,c,!0)||[]};return{active:!1,matches:null}}async function yu(N,R,$){let G=N,ve=G.length>0?G[G.length-1].route:null;for(;;){let _e=l==null,Le=l||a;try{await vD(d,R,G,Le,s,o,W,$)}catch(Ie){return{type:"error",error:Ie,partialMatches:G}}finally{_e&&(a=[...a])}if($.aborted)return{type:"aborted"};let de=qs(Le,R,c),Ge=!1;if(de){let Ie=de[de.length-1].route;if(Ie.index)return{type:"success",matches:de};if(Ie.path&&Ie.path.length>0)if(Ie.path==="*")Ge=!0;else return{type:"success",matches:de}}let ke=hd(Le,R,c,!0);if(!ke||G.map(Ie=>Ie.route.id).join("-")===ke.map(Ie=>Ie.route.id).join("-"))return{type:"success",matches:Ge?de:null};if(G=ke,ve=G[G.length-1].route,ve.path==="*")return{type:"success",matches:G}}}function iR(N){s={},l=wc(N,o,void 0,s)}function lR(N,R){let $=l==null;Lj(N,R,l||a,s,o),$&&(a=[...a],ge({}))}return j={get basename(){return c},get future(){return p},get state(){return S},get routes(){return a},get window(){return t},initialize:Re,subscribe:Pe,enableScrollRestoration:ol,navigate:kt,fetch:pe,revalidate:Ut,createHref:N=>e.history.createHref(N),encodeLocation:N=>e.history.encodeLocation(N),getFetcher:qo,deleteFetcher:Bs,dispose:Fe,getBlocker:ot,deleteBlocker:fn,patchRoutes:lR,_internalFetchControllers:K,_internalActiveDeferreds:ie,_internalSetRoutes:iR},j}function hD(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function em(e,t,n,r,o,s,a,l){let c,u;if(a){c=[];for(let p of t)if(c.push(p),p.route.id===a){u=p;break}}else c=t,u=t[t.length-1];let d=Gf(o||".",Hf(c,s),zi(e.pathname,n)||e.pathname,l==="path");return o==null&&(d.search=e.search,d.hash=e.hash),(o==null||o===""||o===".")&&u&&u.route.index&&!Hv(d.search)&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),r&&n!=="/"&&(d.pathname=d.pathname==="/"?n:To([n,d.pathname])),ma(d)}function Sw(e,t,n,r){if(!r||!hD(r))return{path:n};if(r.formMethod&&!kD(r.formMethod))return{path:n,error:En(405,{method:r.formMethod})};let o=()=>({path:n,error:En(400,{type:"invalid-body"})}),s=r.formMethod||"get",a=e?s.toUpperCase():s.toLowerCase(),l=$j(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!_r(a))return o();let f=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((h,g)=>{let[m,w]=g;return""+h+m+"="+w+` +`},""):String(r.body);return{path:n,submission:{formMethod:a,formAction:l,formEncType:r.formEncType,formData:void 0,json:void 0,text:f}}}else if(r.formEncType==="application/json"){if(!_r(a))return o();try{let f=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:a,formAction:l,formEncType:r.formEncType,formData:void 0,json:f,text:void 0}}}catch{return o()}}}Ze(typeof FormData=="function","FormData is not available in this environment");let c,u;if(r.formData)c=tm(r.formData),u=r.formData;else if(r.body instanceof FormData)c=tm(r.body),u=r.body;else if(r.body instanceof URLSearchParams)c=r.body,u=Tw(c);else if(r.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(r.body),u=Tw(c)}catch{return o()}let d={formMethod:a,formAction:l,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(_r(d.formMethod))return{path:n,submission:d};let p=$s(n);return t&&p.search&&Hv(p.search)&&c.append("index",""),p.search="?"+c,{path:ma(p),submission:d}}function gD(e,t){let n=e;if(t){let r=e.findIndex(o=>o.route.id===t);r>=0&&(n=e.slice(0,r))}return n}function Cw(e,t,n,r,o,s,a,l,c,u,d,p,f,h,g,m){let w=m?Zn(m[1])?m[1].error:m[1].data:void 0,x=e.createURL(t.location),y=e.createURL(o),b=m&&Zn(m[1])?m[0]:void 0,C=b?gD(n,b):n,j=m?m[1].statusCode:void 0,S=a&&j&&j>=400,k=C.filter((O,F)=>{let{route:Z}=O;if(Z.lazy)return!0;if(Z.loader==null)return!1;if(s)return typeof Z.loader!="function"||Z.loader.hydrate?!0:t.loaderData[Z.id]===void 0&&(!t.errors||t.errors[Z.id]===void 0);if(mD(t.loaderData,t.matches[F],O)||c.some(H=>H===O.route.id))return!0;let I=t.matches[F],q=O;return jw(O,Rt({currentUrl:x,currentParams:I.params,nextUrl:y,nextParams:q.params},r,{actionResult:w,actionStatus:j,defaultShouldRevalidate:S?!1:l||x.pathname+x.search===y.pathname+y.search||x.search!==y.search||Fj(I,q)}))}),E=[];return p.forEach((O,F)=>{if(s||!n.some(J=>J.route.id===O.routeId)||d.has(F))return;let Z=qs(h,O.path,g);if(!Z){E.push({key:F,routeId:O.routeId,path:O.path,matches:null,match:null,controller:null});return}let I=t.fetchers.get(F),q=Pl(Z,O.path),H=!1;f.has(F)?H=!1:u.includes(F)?H=!0:I&&I.state!=="idle"&&I.data===void 0?H=l:H=jw(q,Rt({currentUrl:x,currentParams:t.matches[t.matches.length-1].params,nextUrl:y,nextParams:n[n.length-1].params},r,{actionResult:w,actionStatus:j,defaultShouldRevalidate:S?!1:l})),H&&E.push({key:F,routeId:O.routeId,path:O.path,matches:Z,match:q,controller:new AbortController})}),[k,E]}function mD(e,t,n){let r=!t||n.route.id!==t.route.id,o=e[n.route.id]===void 0;return r||o}function Fj(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function jw(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}async function vD(e,t,n,r,o,s,a,l){let c=[t,...n.map(u=>u.route.id)].join("-");try{let u=a.get(c);u||(u=e({path:t,matches:n,patch:(d,p)=>{l.aborted||Lj(d,p,r,o,s)}}),a.set(c,u)),u&&_D(u)&&await u}finally{a.delete(c)}}function Lj(e,t,n,r,o){if(e){var s;let a=r[e];Ze(a,"No route found to patch children into: routeId = "+e);let l=wc(t,o,[e,"patch",String(((s=a.children)==null?void 0:s.length)||"0")],r);a.children?a.children.push(...l):a.children=l}else{let a=wc(t,o,["patch",String(n.length||"0")],r);n.push(...a)}}async function _w(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let o=n[e.id];Ze(o,"No route found in manifest");let s={};for(let a in r){let c=o[a]!==void 0&&a!=="hasErrorBoundary";Ni(!c,'Route "'+o.id+'" has a static property "'+a+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+a+'" will be ignored.')),!c&&!zI.has(a)&&(s[a]=r[a])}Object.assign(o,s),Object.assign(o,Rt({},t(o),{lazy:void 0}))}function yD(e){return Promise.all(e.matches.map(t=>t.resolve()))}async function xD(e,t,n,r,o,s,a,l){let c=r.reduce((p,f)=>p.add(f.route.id),new Set),u=new Set,d=await e({matches:o.map(p=>{let f=c.has(p.route.id);return Rt({},p,{shouldLoad:f,resolve:g=>(u.add(p.route.id),f?wD(t,n,p,s,a,g,l):Promise.resolve({type:ht.data,result:void 0}))})}),request:n,params:o[0].params,context:l});return o.forEach(p=>Ze(u.has(p.route.id),'`match.resolve()` was not called for route id "'+p.route.id+'". You must call `match.resolve()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.')),d.filter((p,f)=>c.has(o[f].route.id))}async function wD(e,t,n,r,o,s,a){let l,c,u=d=>{let p,f=new Promise((m,w)=>p=w);c=()=>p(),t.signal.addEventListener("abort",c);let h=m=>typeof d!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):d({request:t,params:n.params,context:a},...m!==void 0?[m]:[]),g;return s?g=s(m=>h(m)):g=(async()=>{try{return{type:"data",result:await h()}}catch(m){return{type:"error",result:m}}})(),Promise.race([g,f])};try{let d=n.route[e];if(n.route.lazy)if(d){let p,[f]=await Promise.all([u(d).catch(h=>{p=h}),_w(n.route,o,r)]);if(p!==void 0)throw p;l=f}else if(await _w(n.route,o,r),d=n.route[e],d)l=await u(d);else if(e==="action"){let p=new URL(t.url),f=p.pathname+p.search;throw En(405,{method:t.method,pathname:f,routeId:n.route.id})}else return{type:ht.data,result:void 0};else if(d)l=await u(d);else{let p=new URL(t.url),f=p.pathname+p.search;throw En(404,{pathname:f})}Ze(l.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(d){return{type:ht.error,result:d}}finally{c&&t.signal.removeEventListener("abort",c)}return l}async function bD(e){let{result:t,type:n,status:r}=e;if(zj(t)){let a;try{let l=t.headers.get("Content-Type");l&&/\bapplication\/json\b/.test(l)?t.body==null?a=null:a=await t.json():a=await t.text()}catch(l){return{type:ht.error,error:l}}return n===ht.error?{type:ht.error,error:new Uv(t.status,t.statusText,a),statusCode:t.status,headers:t.headers}:{type:ht.data,data:a,statusCode:t.status,headers:t.headers}}if(n===ht.error)return{type:ht.error,error:t,statusCode:Wf(t)?t.status:r};if(TD(t)){var o,s;return{type:ht.deferred,deferredData:t,statusCode:(o=t.init)==null?void 0:o.status,headers:((s=t.init)==null?void 0:s.headers)&&new Headers(t.init.headers)}}return{type:ht.data,data:t,statusCode:r}}function SD(e,t,n,r,o,s){let a=e.headers.get("Location");if(Ze(a,"Redirects returned/thrown from loaders/actions must have a Location header"),!Bv.test(a)){let l=r.slice(0,r.findIndex(c=>c.route.id===n)+1);a=em(new URL(t.url),l,o,!0,a,s),e.headers.set("Location",a)}return e}function Ew(e,t,n){if(Bv.test(e)){let r=e,o=r.startsWith("//")?new URL(t.protocol+r):new URL(r),s=zi(o.pathname,n)!=null;if(o.origin===t.origin&&s)return o.pathname+o.search+o.hash}return e}function Aa(e,t,n,r){let o=e.createURL($j(t)).toString(),s={signal:n};if(r&&_r(r.formMethod)){let{formMethod:a,formEncType:l}=r;s.method=a.toUpperCase(),l==="application/json"?(s.headers=new Headers({"Content-Type":l}),s.body=JSON.stringify(r.json)):l==="text/plain"?s.body=r.text:l==="application/x-www-form-urlencoded"&&r.formData?s.body=tm(r.formData):s.body=r.formData}return new Request(o,s)}function tm(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Tw(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function CD(e,t,n,r,o,s){let a={},l=null,c,u=!1,d={},p=r&&Zn(r[1])?r[1].error:void 0;return n.forEach((f,h)=>{let g=t[h].route.id;if(Ze(!ea(f),"Cannot handle redirect results in processLoaderData"),Zn(f)){let m=f.error;p!==void 0&&(m=p,p=void 0),l=l||{};{let w=si(e,g);l[w.route.id]==null&&(l[w.route.id]=m)}a[g]=void 0,u||(u=!0,c=Wf(f.error)?f.error.status:500),f.headers&&(d[g]=f.headers)}else Qs(f)?(o.set(g,f.deferredData),a[g]=f.deferredData.data,f.statusCode!=null&&f.statusCode!==200&&!u&&(c=f.statusCode),f.headers&&(d[g]=f.headers)):(a[g]=f.data,f.statusCode&&f.statusCode!==200&&!u&&(c=f.statusCode),f.headers&&(d[g]=f.headers))}),p!==void 0&&r&&(l={[r[0]]:p},a[r[0]]=void 0),{loaderData:a,errors:l,statusCode:c||200,loaderHeaders:d}}function kw(e,t,n,r,o,s,a,l){let{loaderData:c,errors:u}=CD(t,n,r,o,l);for(let d=0;dr.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function Pw(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function En(e,t){let{pathname:n,routeId:r,method:o,type:s,message:a}=t===void 0?{}:t,l="Unknown Server Error",c="Unknown @remix-run/router error";return e===400?(l="Bad Request",s==="route-discovery"?c='Unable to match URL "'+n+'" - the `unstable_patchRoutesOnMiss()` '+(`function threw the following error: +`+a):o&&n&&r?c="You made a "+o+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":s==="defer-action"?c="defer() is not supported in actions":s==="invalid-body"&&(c="Unable to encode submission body")):e===403?(l="Forbidden",c='Route "'+r+'" does not match URL "'+n+'"'):e===404?(l="Not Found",c='No route matches URL "'+n+'"'):e===405&&(l="Method Not Allowed",o&&n&&r?c="You made a "+o.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":o&&(c='Invalid request method "'+o.toUpperCase()+'"')),new Uv(e||500,l,new Error(c),!0)}function Iw(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(ea(n))return{result:n,idx:t}}}function $j(e){let t=typeof e=="string"?$s(e):e;return ma(Rt({},t,{hash:""}))}function jD(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function _D(e){return typeof e=="object"&&e!=null&&"then"in e}function ED(e){return zj(e.result)&&cD.has(e.result.status)}function Qs(e){return e.type===ht.deferred}function Zn(e){return e.type===ht.error}function ea(e){return(e&&e.type)===ht.redirect}function TD(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function zj(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function kD(e){return lD.has(e.toLowerCase())}function _r(e){return aD.has(e.toLowerCase())}async function Dw(e,t,n,r,o,s){for(let a=0;ap.route.id===c.route.id),d=u!=null&&!Fj(u,c)&&(s&&s[c.route.id])!==void 0;if(Qs(l)&&(o||d)){let p=r[a];Ze(p,"Expected an AbortSignal for revalidating fetcher deferred result"),await Vj(l,p,o).then(f=>{f&&(n[a]=f||n[a])})}}}async function Vj(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:ht.data,data:e.deferredData.unwrappedData}}catch(o){return{type:ht.error,error:o}}return{type:ht.data,data:e.deferredData.data}}}function Hv(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Pl(e,t){let n=typeof t=="string"?$s(t).search:t.search;if(e[e.length-1].route.index&&Hv(n||""))return e[e.length-1];let r=Oj(e);return r[r.length-1]}function Ow(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:s,json:a}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(s!=null)return{formMethod:t,formAction:n,formEncType:r,formData:s,json:void 0,text:void 0};if(a!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:a,text:void 0}}}function xh(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function ND(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function gl(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function RD(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function ts(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function PD(e,t){try{let n=e.sessionStorage.getItem(Aj);if(n){let r=JSON.parse(n);for(let[o,s]of Object.entries(r||{}))s&&Array.isArray(s)&&t.set(o,new Set(s||[]))}}catch{}}function ID(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(Aj,JSON.stringify(n))}catch(r){Ni(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/** * React Router v6.25.1 * * Copyright (c) Remix Software Inc. @@ -57,7 +57,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Yd(){return Yd=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),v.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let p=Gf(u,JSON.parse(a),s,d.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:To([t,p.pathname])),(d.replace?r.replace:r.push)(p,d.state,d)},[t,r,a,s,e])}function Vi(){let{matches:e}=v.useContext(zo),t=e[e.length-1];return t?t.params:{}}function Gj(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=v.useContext(zs),{matches:o}=v.useContext(zo),{pathname:s}=eu(),a=JSON.stringify(Hf(o,r.v7_relativeSplatPath));return v.useMemo(()=>Gf(e,JSON.parse(a),s,n==="path"),[e,a,s,n])}function OD(e,t,n,r){zi()||Ze(!1);let{navigator:o}=v.useContext(zs),{matches:s}=v.useContext(zo),a=s[s.length-1],l=a?a.params:{};a&&a.pathname;let c=a?a.pathnameBase:"/";a&&a.route;let u=eu(),d;d=u;let p=d.pathname||"/",f=p;if(c!=="/"){let m=c.replace(/^\//,"").split("/");f="/"+p.replace(/^\//,"").split("/").slice(m.length).join("/")}let h=qs(e,{pathname:f});return $D(h&&h.map(m=>Object.assign({},m,{params:Object.assign({},l,m.params),pathname:To([c,o.encodeLocation?o.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?c:To([c,o.encodeLocation?o.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),s,n,r)}function MD(){let e=BD(),t=Wf(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:o},n):null,null)}const AD=v.createElement(MD,null);class FD extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?v.createElement(zo.Provider,{value:this.props.routeContext},v.createElement(Bj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function LD(e){let{routeContext:t,match:n,children:r}=e,o=v.useContext(Kf);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(zo.Provider,{value:t},r)}function $D(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if((s=n)!=null&&s.errors)e=n.matches;else return null}let a=e,l=(o=n)==null?void 0:o.errors;if(l!=null){let d=a.findIndex(p=>p.route.id&&(l==null?void 0:l[p.route.id])!==void 0);d>=0||Ze(!1),a=a.slice(0,Math.min(a.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?a=a.slice(0,u+1):a=[a[0]];break}}}return a.reduceRight((d,p,f)=>{let h,g=!1,m=null,w=null;n&&(h=l&&p.route.id?l[p.route.id]:void 0,m=p.route.errorElement||AD,c&&(u<0&&f===0?(GD("route-fallback"),g=!0,w=null):u===f&&(g=!0,w=p.route.hydrateFallbackElement||null)));let x=t.concat(a.slice(0,f+1)),y=()=>{let b;return h?b=m:g?b=w:p.route.Component?b=v.createElement(p.route.Component,null):p.route.element?b=p.route.element:b=d,v.createElement(LD,{match:p,routeContext:{outlet:d,matches:x,isDataRoute:n!=null},children:b})};return n&&(p.route.ErrorBoundary||p.route.errorElement||f===0)?v.createElement(FD,{location:n.location,revalidation:n.revalidation,component:m,error:h,children:y(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):y()},null)}var Wj=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Wj||{}),Xd=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Xd||{});function zD(e){let t=v.useContext(Kf);return t||Ze(!1),t}function VD(e){let t=v.useContext(Uj);return t||Ze(!1),t}function UD(e){let t=v.useContext(zo);return t||Ze(!1),t}function Kj(e){let t=UD(),n=t.matches[t.matches.length-1];return n.route.id||Ze(!1),n.route.id}function BD(){var e;let t=v.useContext(Bj),n=VD(Xd.UseRouteError),r=Kj(Xd.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function HD(){let{router:e}=zD(Wj.UseNavigateStable),t=Kj(Xd.UseNavigateStable),n=v.useRef(!1);return Hj(()=>{n.current=!0}),v.useCallback(function(o,s){s===void 0&&(s={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,Yd({fromRouteId:t},s)))},[e,t])}const Mw={};function GD(e,t,n){Mw[e]||(Mw[e]=!0)}function qj(e){let{to:t,replace:n,state:r,relative:o}=e;zi()||Ze(!1);let{future:s,static:a}=v.useContext(zs),{matches:l}=v.useContext(zo),{pathname:c}=eu(),u=ir(),d=Gf(t,Hf(l,s.v7_relativeSplatPath),c,o==="path"),p=JSON.stringify(d);return v.useEffect(()=>u(JSON.parse(p),{replace:n,state:r,relative:o}),[u,p,o,n,r]),null}function WD(e){let{basename:t="/",children:n=null,location:r,navigationType:o=Ht.Pop,navigator:s,static:a=!1,future:l}=e;zi()&&Ze(!1);let c=t.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:c,navigator:s,static:a,future:Yd({v7_relativeSplatPath:!1},l)}),[c,l,s,a]);typeof r=="string"&&(r=$s(r));let{pathname:d="/",search:p="",hash:f="",state:h=null,key:g="default"}=r,m=v.useMemo(()=>{let w=$i(d,c);return w==null?null:{location:{pathname:w,search:p,hash:f,state:h,key:g},navigationType:o}},[c,d,p,f,h,g,o]);return m==null?null:v.createElement(zs.Provider,{value:u},v.createElement(Gv.Provider,{children:n,value:m}))}new Promise(()=>{});function KD(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:v.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/** + */function Yd(){return Yd=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),v.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let p=Gf(u,JSON.parse(a),s,d.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:To([t,p.pathname])),(d.replace?r.replace:r.push)(p,d.state,d)},[t,r,a,s,e])}function Ta(){let{matches:e}=v.useContext(zo),t=e[e.length-1];return t?t.params:{}}function Gj(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=v.useContext(zs),{matches:o}=v.useContext(zo),{pathname:s}=eu(),a=JSON.stringify(Hf(o,r.v7_relativeSplatPath));return v.useMemo(()=>Gf(e,JSON.parse(a),s,n==="path"),[e,a,s,n])}function MD(e,t,n,r){Vi()||Ze(!1);let{navigator:o}=v.useContext(zs),{matches:s}=v.useContext(zo),a=s[s.length-1],l=a?a.params:{};a&&a.pathname;let c=a?a.pathnameBase:"/";a&&a.route;let u=eu(),d;d=u;let p=d.pathname||"/",f=p;if(c!=="/"){let m=c.replace(/^\//,"").split("/");f="/"+p.replace(/^\//,"").split("/").slice(m.length).join("/")}let h=qs(e,{pathname:f});return zD(h&&h.map(m=>Object.assign({},m,{params:Object.assign({},l,m.params),pathname:To([c,o.encodeLocation?o.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?c:To([c,o.encodeLocation?o.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),s,n,r)}function AD(){let e=HD(),t=Wf(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:o},n):null,null)}const FD=v.createElement(AD,null);class LD extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?v.createElement(zo.Provider,{value:this.props.routeContext},v.createElement(Bj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function $D(e){let{routeContext:t,match:n,children:r}=e,o=v.useContext(Kf);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(zo.Provider,{value:t},r)}function zD(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if((s=n)!=null&&s.errors)e=n.matches;else return null}let a=e,l=(o=n)==null?void 0:o.errors;if(l!=null){let d=a.findIndex(p=>p.route.id&&(l==null?void 0:l[p.route.id])!==void 0);d>=0||Ze(!1),a=a.slice(0,Math.min(a.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?a=a.slice(0,u+1):a=[a[0]];break}}}return a.reduceRight((d,p,f)=>{let h,g=!1,m=null,w=null;n&&(h=l&&p.route.id?l[p.route.id]:void 0,m=p.route.errorElement||FD,c&&(u<0&&f===0?(WD("route-fallback"),g=!0,w=null):u===f&&(g=!0,w=p.route.hydrateFallbackElement||null)));let x=t.concat(a.slice(0,f+1)),y=()=>{let b;return h?b=m:g?b=w:p.route.Component?b=v.createElement(p.route.Component,null):p.route.element?b=p.route.element:b=d,v.createElement($D,{match:p,routeContext:{outlet:d,matches:x,isDataRoute:n!=null},children:b})};return n&&(p.route.ErrorBoundary||p.route.errorElement||f===0)?v.createElement(LD,{location:n.location,revalidation:n.revalidation,component:m,error:h,children:y(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):y()},null)}var Wj=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Wj||{}),Xd=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Xd||{});function VD(e){let t=v.useContext(Kf);return t||Ze(!1),t}function UD(e){let t=v.useContext(Uj);return t||Ze(!1),t}function BD(e){let t=v.useContext(zo);return t||Ze(!1),t}function Kj(e){let t=BD(),n=t.matches[t.matches.length-1];return n.route.id||Ze(!1),n.route.id}function HD(){var e;let t=v.useContext(Bj),n=UD(Xd.UseRouteError),r=Kj(Xd.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function GD(){let{router:e}=VD(Wj.UseNavigateStable),t=Kj(Xd.UseNavigateStable),n=v.useRef(!1);return Hj(()=>{n.current=!0}),v.useCallback(function(o,s){s===void 0&&(s={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,Yd({fromRouteId:t},s)))},[e,t])}const Mw={};function WD(e,t,n){Mw[e]||(Mw[e]=!0)}function qj(e){let{to:t,replace:n,state:r,relative:o}=e;Vi()||Ze(!1);let{future:s,static:a}=v.useContext(zs),{matches:l}=v.useContext(zo),{pathname:c}=eu(),u=ir(),d=Gf(t,Hf(l,s.v7_relativeSplatPath),c,o==="path"),p=JSON.stringify(d);return v.useEffect(()=>u(JSON.parse(p),{replace:n,state:r,relative:o}),[u,p,o,n,r]),null}function KD(e){let{basename:t="/",children:n=null,location:r,navigationType:o=Ht.Pop,navigator:s,static:a=!1,future:l}=e;Vi()&&Ze(!1);let c=t.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:c,navigator:s,static:a,future:Yd({v7_relativeSplatPath:!1},l)}),[c,l,s,a]);typeof r=="string"&&(r=$s(r));let{pathname:d="/",search:p="",hash:f="",state:h=null,key:g="default"}=r,m=v.useMemo(()=>{let w=zi(d,c);return w==null?null:{location:{pathname:w,search:p,hash:f,state:h,key:g},navigationType:o}},[c,d,p,f,h,g,o]);return m==null?null:v.createElement(zs.Provider,{value:u},v.createElement(Gv.Provider,{children:n,value:m}))}new Promise(()=>{});function qD(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:v.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/** * React Router DOM v6.25.1 * * Copyright (c) Remix Software Inc. @@ -66,47 +66,47 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function bc(){return bc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[o]=e[o]);return n}function ZD(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function JD(e,t){return e.button===0&&(!t||t==="_self")&&!ZD(e)}const YD=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],XD="6";try{window.__reactRouterVersion=XD}catch{}function QD(e,t){return fD({basename:void 0,future:bc({},void 0,{v7_prependBasename:!0}),history:AI({window:void 0}),hydrationData:eO(),routes:e,mapRouteProperties:KD,unstable_dataStrategy:void 0,unstable_patchRoutesOnMiss:void 0,window:void 0}).initialize()}function eO(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=bc({},t,{errors:tO(t.errors)})),t}function tO(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Uv(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let s=window[o.__subType];if(typeof s=="function")try{let a=new s(o.message);a.stack="",n[r]=a}catch{}}if(n[r]==null){let s=new Error(o.message);s.stack="",n[r]=s}}else n[r]=o;return n}const nO=v.createContext({isTransitioning:!1}),rO=v.createContext(new Map),oO="startTransition",Aw=kf[oO],sO="flushSync",Fw=MI[sO];function aO(e){Aw?Aw(e):e()}function ml(e){Fw?Fw(e):e()}class iO{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function lO(e){let{fallbackElement:t,router:n,future:r}=e,[o,s]=v.useState(n.state),[a,l]=v.useState(),[c,u]=v.useState({isTransitioning:!1}),[d,p]=v.useState(),[f,h]=v.useState(),[g,m]=v.useState(),w=v.useRef(new Map),{v7_startTransition:x}=r||{},y=v.useCallback(E=>{x?aO(E):E()},[x]),b=v.useCallback((E,O)=>{let{deletedFetchers:F,unstable_flushSync:Z,unstable_viewTransitionOpts:I}=O;F.forEach(H=>w.current.delete(H)),E.fetchers.forEach((H,J)=>{H.data!==void 0&&w.current.set(J,H.data)});let q=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!I||q){Z?ml(()=>s(E)):y(()=>s(E));return}if(Z){ml(()=>{f&&(d&&d.resolve(),f.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:I.currentLocation,nextLocation:I.nextLocation})});let H=n.window.document.startViewTransition(()=>{ml(()=>s(E))});H.finished.finally(()=>{ml(()=>{p(void 0),h(void 0),l(void 0),u({isTransitioning:!1})})}),ml(()=>h(H));return}f?(d&&d.resolve(),f.skipTransition(),m({state:E,currentLocation:I.currentLocation,nextLocation:I.nextLocation})):(l(E),u({isTransitioning:!0,flushSync:!1,currentLocation:I.currentLocation,nextLocation:I.nextLocation}))},[n.window,f,d,w,y]);v.useLayoutEffect(()=>n.subscribe(b),[n,b]),v.useEffect(()=>{c.isTransitioning&&!c.flushSync&&p(new iO)},[c]),v.useEffect(()=>{if(d&&a&&n.window){let E=a,O=d.promise,F=n.window.document.startViewTransition(async()=>{y(()=>s(E)),await O});F.finished.finally(()=>{p(void 0),h(void 0),l(void 0),u({isTransitioning:!1})}),h(F)}},[y,a,d,n.window]),v.useEffect(()=>{d&&a&&o.location.key===a.location.key&&d.resolve()},[d,f,o.location,a]),v.useEffect(()=>{!c.isTransitioning&&g&&(l(g.state),u({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),m(void 0))},[c.isTransitioning,g]),v.useEffect(()=>{},[]);let C=v.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:E=>n.navigate(E),push:(E,O,F)=>n.navigate(E,{state:O,preventScrollReset:F==null?void 0:F.preventScrollReset}),replace:(E,O,F)=>n.navigate(E,{replace:!0,state:O,preventScrollReset:F==null?void 0:F.preventScrollReset})}),[n]),j=n.basename||"/",S=v.useMemo(()=>({router:n,navigator:C,static:!1,basename:j}),[n,C,j]),k=v.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return v.createElement(v.Fragment,null,v.createElement(Kf.Provider,{value:S},v.createElement(Uj.Provider,{value:o},v.createElement(rO.Provider,{value:w.current},v.createElement(nO.Provider,{value:c},v.createElement(WD,{basename:j,location:o.location,navigationType:o.historyAction,navigator:C,future:k},o.initialized||n.future.v7_partialHydration?v.createElement(cO,{routes:n.routes,future:n.future,state:o}):t))))),null)}const cO=v.memo(uO);function uO(e){let{routes:t,future:n,state:r}=e;return OD(t,void 0,r,n)}const dO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",fO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Lw=v.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:s,replace:a,state:l,target:c,to:u,preventScrollReset:d,unstable_viewTransition:p}=t,f=qD(t,YD),{basename:h}=v.useContext(zs),g,m=!1;if(typeof u=="string"&&fO.test(u)&&(g=u,dO))try{let b=new URL(window.location.href),C=u.startsWith("//")?new URL(b.protocol+u):new URL(u),j=$i(C.pathname,h);C.origin===b.origin&&j!=null?u=j+C.search+C.hash:m=!0}catch{}let w=ID(u,{relative:o}),x=pO(u,{replace:a,state:l,target:c,preventScrollReset:d,relative:o,unstable_viewTransition:p});function y(b){r&&r(b),b.defaultPrevented||x(b)}return v.createElement("a",bc({},f,{href:g||w,onClick:m||s?r:y,ref:n,target:c}))});var $w;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})($w||($w={}));var zw;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(zw||(zw={}));function pO(e,t){let{target:n,replace:r,state:o,preventScrollReset:s,relative:a,unstable_viewTransition:l}=t===void 0?{}:t,c=ir(),u=eu(),d=Gj(e,{relative:a});return v.useCallback(p=>{if(JD(p,n)){p.preventDefault();let f=r!==void 0?r:ma(u)===ma(d);c(e,{replace:f,state:o,preventScrollReset:s,relative:a,unstable_viewTransition:l})}},[u,c,d,r,o,n,e,s,a,l])}const sn=({children:e})=>{const t=localStorage.getItem("apiUrl"),n=localStorage.getItem("token"),r=localStorage.getItem("version");return!t||!n||!r?i.jsx(qj,{to:"/manager/login"}):e},hO=({children:e})=>{const t=localStorage.getItem("apiUrl"),n=localStorage.getItem("token"),r=localStorage.getItem("version");return t&&n&&r?i.jsx(qj,{to:"/"}):e};function Zj(e,t){return function(){return e.apply(t,arguments)}}const{toString:gO}=Object.prototype,{getPrototypeOf:Wv}=Object,qf=(e=>t=>{const n=gO.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),$r=e=>(e=e.toLowerCase(),t=>qf(t)===e),Zf=e=>t=>typeof t===e,{isArray:Ui}=Array,Sc=Zf("undefined");function mO(e){return e!==null&&!Sc(e)&&e.constructor!==null&&!Sc(e.constructor)&&gr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Jj=$r("ArrayBuffer");function vO(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Jj(e.buffer),t}const yO=Zf("string"),gr=Zf("function"),Yj=Zf("number"),Jf=e=>e!==null&&typeof e=="object",xO=e=>e===!0||e===!1,gd=e=>{if(qf(e)!=="object")return!1;const t=Wv(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},wO=$r("Date"),bO=$r("File"),SO=$r("Blob"),CO=$r("FileList"),jO=e=>Jf(e)&&gr(e.pipe),_O=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||gr(e.append)&&((t=qf(e))==="formdata"||t==="object"&&gr(e.toString)&&e.toString()==="[object FormData]"))},EO=$r("URLSearchParams"),[TO,kO,NO,RO]=["ReadableStream","Request","Response","Headers"].map($r),PO=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tu(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,o;if(typeof e!="object"&&(e=[e]),Ui(e))for(r=0,o=e.length;r0;)if(o=n[r],t===o.toLowerCase())return o;return null}const Qj=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,e_=e=>!Sc(e)&&e!==Qj;function nm(){const{caseless:e}=e_(this)&&this||{},t={},n=(r,o)=>{const s=e&&Xj(t,o)||o;gd(t[s])&&gd(r)?t[s]=nm(t[s],r):gd(r)?t[s]=nm({},r):Ui(r)?t[s]=r.slice():t[s]=r};for(let r=0,o=arguments.length;r(tu(t,(o,s)=>{n&&gr(o)?e[s]=Zj(o,n):e[s]=o},{allOwnKeys:r}),e),DO=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),OO=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},MO=(e,t,n,r)=>{let o,s,a;const l={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],(!r||r(a,e,t))&&!l[a]&&(t[a]=e[a],l[a]=!0);e=n!==!1&&Wv(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},AO=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},FO=e=>{if(!e)return null;if(Ui(e))return e;let t=e.length;if(!Yj(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},LO=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Wv(Uint8Array)),$O=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=r.next())&&!o.done;){const s=o.value;t.call(e,s[0],s[1])}},zO=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},VO=$r("HTMLFormElement"),UO=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),Vw=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),BO=$r("RegExp"),t_=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};tu(n,(o,s)=>{let a;(a=t(o,s,e))!==!1&&(r[s]=a||o)}),Object.defineProperties(e,r)},HO=e=>{t_(e,(t,n)=>{if(gr(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(gr(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},GO=(e,t)=>{const n={},r=o=>{o.forEach(s=>{n[s]=!0})};return Ui(e)?r(e):r(String(e).split(t)),n},WO=()=>{},KO=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,wh="abcdefghijklmnopqrstuvwxyz",Uw="0123456789",n_={DIGIT:Uw,ALPHA:wh,ALPHA_DIGIT:wh+wh.toUpperCase()+Uw},qO=(e=16,t=n_.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function ZO(e){return!!(e&&gr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const JO=e=>{const t=new Array(10),n=(r,o)=>{if(Jf(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[o]=r;const s=Ui(r)?[]:{};return tu(r,(a,l)=>{const c=n(a,o+1);!Sc(c)&&(s[l]=c)}),t[o]=void 0,s}}return r};return n(e,0)},YO=$r("AsyncFunction"),XO=e=>e&&(Jf(e)||gr(e))&&gr(e.then)&&gr(e.catch),V={isArray:Ui,isArrayBuffer:Jj,isBuffer:mO,isFormData:_O,isArrayBufferView:vO,isString:yO,isNumber:Yj,isBoolean:xO,isObject:Jf,isPlainObject:gd,isReadableStream:TO,isRequest:kO,isResponse:NO,isHeaders:RO,isUndefined:Sc,isDate:wO,isFile:bO,isBlob:SO,isRegExp:BO,isFunction:gr,isStream:jO,isURLSearchParams:EO,isTypedArray:LO,isFileList:CO,forEach:tu,merge:nm,extend:IO,trim:PO,stripBOM:DO,inherits:OO,toFlatObject:MO,kindOf:qf,kindOfTest:$r,endsWith:AO,toArray:FO,forEachEntry:$O,matchAll:zO,isHTMLForm:VO,hasOwnProperty:Vw,hasOwnProp:Vw,reduceDescriptors:t_,freezeMethods:HO,toObjectSet:GO,toCamelCase:UO,noop:WO,toFiniteNumber:KO,findKey:Xj,global:Qj,isContextDefined:e_,ALPHABET:n_,generateString:qO,isSpecCompliantForm:ZO,toJSONObject:JO,isAsyncFn:YO,isThenable:XO};function Be(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}V.inherits(Be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:V.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const r_=Be.prototype,o_={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{o_[e]={value:e}});Object.defineProperties(Be,o_);Object.defineProperty(r_,"isAxiosError",{value:!0});Be.from=(e,t,n,r,o,s)=>{const a=Object.create(r_);return V.toFlatObject(e,a,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),Be.call(a,e.message,t,n,r,o),a.cause=e,a.name=e.name,s&&Object.assign(a,s),a};const QO=null;function rm(e){return V.isPlainObject(e)||V.isArray(e)}function s_(e){return V.endsWith(e,"[]")?e.slice(0,-2):e}function Bw(e,t,n){return e?e.concat(t).map(function(o,s){return o=s_(o),!n&&s?"["+o+"]":o}).join(n?".":""):t}function eM(e){return V.isArray(e)&&!e.some(rm)}const tM=V.toFlatObject(V,{},null,function(t){return/^is[A-Z]/.test(t)});function Yf(e,t,n){if(!V.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=V.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!V.isUndefined(w[m])});const r=n.metaTokens,o=n.visitor||d,s=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&V.isSpecCompliantForm(t);if(!V.isFunction(o))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(V.isDate(g))return g.toISOString();if(!c&&V.isBlob(g))throw new Be("Blob is not supported. Use a Buffer instead.");return V.isArrayBuffer(g)||V.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,m,w){let x=g;if(g&&!w&&typeof g=="object"){if(V.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(V.isArray(g)&&eM(g)||(V.isFileList(g)||V.endsWith(m,"[]"))&&(x=V.toArray(g)))return m=s_(m),x.forEach(function(b,C){!(V.isUndefined(b)||b===null)&&t.append(a===!0?Bw([m],C,s):a===null?m:m+"[]",u(b))}),!1}return rm(g)?!0:(t.append(Bw(w,m,s),u(g)),!1)}const p=[],f=Object.assign(tM,{defaultVisitor:d,convertValue:u,isVisitable:rm});function h(g,m){if(!V.isUndefined(g)){if(p.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));p.push(g),V.forEach(g,function(x,y){(!(V.isUndefined(x)||x===null)&&o.call(t,x,V.isString(y)?y.trim():y,m,f))===!0&&h(x,m?m.concat(y):[y])}),p.pop()}}if(!V.isObject(e))throw new TypeError("data must be an object");return h(e),t}function Hw(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Kv(e,t){this._pairs=[],e&&Yf(e,this,t)}const a_=Kv.prototype;a_.append=function(t,n){this._pairs.push([t,n])};a_.toString=function(t){const n=t?function(r){return t.call(this,r,Hw)}:Hw;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function nM(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function i_(e,t,n){if(!t)return e;const r=n&&n.encode||nM,o=n&&n.serialize;let s;if(o?s=o(t,n):s=V.isURLSearchParams(t)?t.toString():new Kv(t,n).toString(r),s){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Gw{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){V.forEach(this.handlers,function(r){r!==null&&t(r)})}}const l_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},rM=typeof URLSearchParams<"u"?URLSearchParams:Kv,oM=typeof FormData<"u"?FormData:null,sM=typeof Blob<"u"?Blob:null,aM={isBrowser:!0,classes:{URLSearchParams:rM,FormData:oM,Blob:sM},protocols:["http","https","file","blob","url","data"]},qv=typeof window<"u"&&typeof document<"u",iM=(e=>qv&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),lM=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",cM=qv&&window.location.href||"http://localhost",uM=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:qv,hasStandardBrowserEnv:iM,hasStandardBrowserWebWorkerEnv:lM,origin:cM},Symbol.toStringTag,{value:"Module"})),Pr={...uM,...aM};function dM(e,t){return Yf(e,new Pr.classes.URLSearchParams,Object.assign({visitor:function(n,r,o,s){return Pr.isNode&&V.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function fM(e){return V.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function pM(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r=n.length;return a=!a&&V.isArray(o)?o.length:a,c?(V.hasOwnProp(o,a)?o[a]=[o[a],r]:o[a]=r,!l):((!o[a]||!V.isObject(o[a]))&&(o[a]=[]),t(n,r,o[a],s)&&V.isArray(o[a])&&(o[a]=pM(o[a])),!l)}if(V.isFormData(e)&&V.isFunction(e.entries)){const n={};return V.forEachEntry(e,(r,o)=>{t(fM(r),o,n,0)}),n}return null}function hM(e,t,n){if(V.isString(e))try{return(t||JSON.parse)(e),V.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const nu={transitional:l_,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,s=V.isObject(t);if(s&&V.isHTMLForm(t)&&(t=new FormData(t)),V.isFormData(t))return o?JSON.stringify(c_(t)):t;if(V.isArrayBuffer(t)||V.isBuffer(t)||V.isStream(t)||V.isFile(t)||V.isBlob(t)||V.isReadableStream(t))return t;if(V.isArrayBufferView(t))return t.buffer;if(V.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return dM(t,this.formSerializer).toString();if((l=V.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Yf(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||o?(n.setContentType("application/json",!1),hM(t)):t}],transformResponse:[function(t){const n=this.transitional||nu.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(V.isResponse(t)||V.isReadableStream(t))return t;if(t&&V.isString(t)&&(r&&!this.responseType||o)){const a=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(l){if(a)throw l.name==="SyntaxError"?Be.from(l,Be.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Pr.classes.FormData,Blob:Pr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};V.forEach(["delete","get","head","post","put","patch"],e=>{nu.headers[e]={}});const gM=V.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),mM=e=>{const t={};let n,r,o;return e&&e.split(` -`).forEach(function(a){o=a.indexOf(":"),n=a.substring(0,o).trim().toLowerCase(),r=a.substring(o+1).trim(),!(!n||t[n]&&gM[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Ww=Symbol("internals");function vl(e){return e&&String(e).trim().toLowerCase()}function md(e){return e===!1||e==null?e:V.isArray(e)?e.map(md):String(e)}function vM(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const yM=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function bh(e,t,n,r,o){if(V.isFunction(r))return r.call(this,t,n);if(o&&(t=n),!!V.isString(t)){if(V.isString(r))return t.indexOf(r)!==-1;if(V.isRegExp(r))return r.test(t)}}function xM(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function wM(e,t){const n=V.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(o,s,a){return this[r].call(this,t,o,s,a)},configurable:!0})})}class Bn{constructor(t){t&&this.set(t)}set(t,n,r){const o=this;function s(l,c,u){const d=vl(c);if(!d)throw new Error("header name must be a non-empty string");const p=V.findKey(o,d);(!p||o[p]===void 0||u===!0||u===void 0&&o[p]!==!1)&&(o[p||c]=md(l))}const a=(l,c)=>V.forEach(l,(u,d)=>s(u,d,c));if(V.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(V.isString(t)&&(t=t.trim())&&!yM(t))a(mM(t),n);else if(V.isHeaders(t))for(const[l,c]of t.entries())s(c,l,r);else t!=null&&s(n,t,r);return this}get(t,n){if(t=vl(t),t){const r=V.findKey(this,t);if(r){const o=this[r];if(!n)return o;if(n===!0)return vM(o);if(V.isFunction(n))return n.call(this,o,r);if(V.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=vl(t),t){const r=V.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||bh(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let o=!1;function s(a){if(a=vl(a),a){const l=V.findKey(r,a);l&&(!n||bh(r,r[l],l,n))&&(delete r[l],o=!0)}}return V.isArray(t)?t.forEach(s):s(t),o}clear(t){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const s=n[r];(!t||bh(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){const n=this,r={};return V.forEach(this,(o,s)=>{const a=V.findKey(r,s);if(a){n[a]=md(o),delete n[s];return}const l=t?xM(s):String(s).trim();l!==s&&delete n[s],n[l]=md(o),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return V.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=t&&V.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[Ww]=this[Ww]={accessors:{}}).accessors,o=this.prototype;function s(a){const l=vl(a);r[l]||(wM(o,a),r[l]=!0)}return V.isArray(t)?t.forEach(s):s(t),this}}Bn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);V.reduceDescriptors(Bn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});V.freezeMethods(Bn);function Sh(e,t){const n=this||nu,r=t||n,o=Bn.from(r.headers);let s=r.data;return V.forEach(e,function(l){s=l.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function u_(e){return!!(e&&e.__CANCEL__)}function Bi(e,t,n){Be.call(this,e??"canceled",Be.ERR_CANCELED,t,n),this.name="CanceledError"}V.inherits(Bi,Be,{__CANCEL__:!0});function d_(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Be("Request failed with status code "+n.status,[Be.ERR_BAD_REQUEST,Be.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function bM(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function SM(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,s=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[s];a||(a=u),n[o]=c,r[o]=u;let p=s,f=0;for(;p!==o;)f+=n[p++],p=p%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),u-ar)return o&&(clearTimeout(o),o=null),n=l,e.apply(null,arguments);o||(o=setTimeout(()=>(o=null,n=Date.now(),e.apply(null,arguments)),r-(l-n)))}}const Qd=(e,t,n=3)=>{let r=0;const o=SM(50,250);return CM(s=>{const a=s.loaded,l=s.lengthComputable?s.total:void 0,c=a-r,u=o(c),d=a<=l;r=a;const p={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-a)/u:void 0,event:s,lengthComputable:l!=null};p[t?"download":"upload"]=!0,e(p)},n)},jM=Pr.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(s){let a=s;return t&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(a){const l=V.isString(a)?o(a):a;return l.protocol===r.protocol&&l.host===r.host}}():function(){return function(){return!0}}(),_M=Pr.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const a=[e+"="+encodeURIComponent(t)];V.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),V.isString(r)&&a.push("path="+r),V.isString(o)&&a.push("domain="+o),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function EM(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function TM(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function f_(e,t){return e&&!EM(t)?TM(e,t):t}const Kw=e=>e instanceof Bn?{...e}:e;function va(e,t){t=t||{};const n={};function r(u,d,p){return V.isPlainObject(u)&&V.isPlainObject(d)?V.merge.call({caseless:p},u,d):V.isPlainObject(d)?V.merge({},d):V.isArray(d)?d.slice():d}function o(u,d,p){if(V.isUndefined(d)){if(!V.isUndefined(u))return r(void 0,u,p)}else return r(u,d,p)}function s(u,d){if(!V.isUndefined(d))return r(void 0,d)}function a(u,d){if(V.isUndefined(d)){if(!V.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,p){if(p in t)return r(u,d);if(p in e)return r(void 0,u)}const c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(u,d)=>o(Kw(u),Kw(d),!0)};return V.forEach(Object.keys(Object.assign({},e,t)),function(d){const p=c[d]||o,f=p(e[d],t[d],d);V.isUndefined(f)&&p!==l||(n[d]=f)}),n}const p_=e=>{const t=va({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:l}=t;t.headers=a=Bn.from(a),t.url=i_(f_(t.baseURL,t.url),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(V.isFormData(n)){if(Pr.hasStandardBrowserEnv||Pr.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[u,...d]=c?c.split(";").map(p=>p.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...d].join("; "))}}if(Pr.hasStandardBrowserEnv&&(r&&V.isFunction(r)&&(r=r(t)),r||r!==!1&&jM(t.url))){const u=o&&s&&_M.read(s);u&&a.set(o,u)}return t},kM=typeof XMLHttpRequest<"u",NM=kM&&function(e){return new Promise(function(n,r){const o=p_(e);let s=o.data;const a=Bn.from(o.headers).normalize();let{responseType:l}=o,c;function u(){o.cancelToken&&o.cancelToken.unsubscribe(c),o.signal&&o.signal.removeEventListener("abort",c)}let d=new XMLHttpRequest;d.open(o.method.toUpperCase(),o.url,!0),d.timeout=o.timeout;function p(){if(!d)return;const h=Bn.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),m={data:!l||l==="text"||l==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:h,config:e,request:d};d_(function(x){n(x),u()},function(x){r(x),u()},m),d=null}"onloadend"in d?d.onloadend=p:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(p)},d.onabort=function(){d&&(r(new Be("Request aborted",Be.ECONNABORTED,o,d)),d=null)},d.onerror=function(){r(new Be("Network Error",Be.ERR_NETWORK,o,d)),d=null},d.ontimeout=function(){let g=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const m=o.transitional||l_;o.timeoutErrorMessage&&(g=o.timeoutErrorMessage),r(new Be(g,m.clarifyTimeoutError?Be.ETIMEDOUT:Be.ECONNABORTED,o,d)),d=null},s===void 0&&a.setContentType(null),"setRequestHeader"in d&&V.forEach(a.toJSON(),function(g,m){d.setRequestHeader(m,g)}),V.isUndefined(o.withCredentials)||(d.withCredentials=!!o.withCredentials),l&&l!=="json"&&(d.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&d.addEventListener("progress",Qd(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",Qd(o.onUploadProgress)),(o.cancelToken||o.signal)&&(c=h=>{d&&(r(!h||h.type?new Bi(null,e,d):h),d.abort(),d=null)},o.cancelToken&&o.cancelToken.subscribe(c),o.signal&&(o.signal.aborted?c():o.signal.addEventListener("abort",c)));const f=bM(o.url);if(f&&Pr.protocols.indexOf(f)===-1){r(new Be("Unsupported protocol "+f+":",Be.ERR_BAD_REQUEST,e));return}d.send(s||null)})},RM=(e,t)=>{let n=new AbortController,r;const o=function(c){if(!r){r=!0,a();const u=c instanceof Error?c:this.reason;n.abort(u instanceof Be?u:new Bi(u instanceof Error?u.message:u))}};let s=t&&setTimeout(()=>{o(new Be(`timeout ${t} of ms exceeded`,Be.ETIMEDOUT))},t);const a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(c=>{c&&(c.removeEventListener?c.removeEventListener("abort",o):c.unsubscribe(o))}),e=null)};e.forEach(c=>c&&c.addEventListener&&c.addEventListener("abort",o));const{signal:l}=n;return l.unsubscribe=a,[l,()=>{s&&clearTimeout(s),s=null}]},PM=function*(e,t){let n=e.byteLength;if(!t||n{const s=IM(e,t,o);let a=0;return new ReadableStream({type:"bytes",async pull(l){const{done:c,value:u}=await s.next();if(c){l.close(),r();return}let d=u.byteLength;n&&n(a+=d),l.enqueue(new Uint8Array(u))},cancel(l){return r(l),s.return()}},{highWaterMark:2})},Zw=(e,t)=>{const n=e!=null;return r=>setTimeout(()=>t({lengthComputable:n,total:e,loaded:r}))},Xf=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",h_=Xf&&typeof ReadableStream=="function",om=Xf&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),DM=h_&&(()=>{let e=!1;const t=new Request(Pr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),Jw=64*1024,sm=h_&&!!(()=>{try{return V.isReadableStream(new Response("").body)}catch{}})(),ef={stream:sm&&(e=>e.body)};Xf&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!ef[t]&&(ef[t]=V.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new Be(`Response type '${t}' is not supported`,Be.ERR_NOT_SUPPORT,r)})})})(new Response);const OM=async e=>{if(e==null)return 0;if(V.isBlob(e))return e.size;if(V.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(V.isArrayBufferView(e))return e.byteLength;if(V.isURLSearchParams(e)&&(e=e+""),V.isString(e))return(await om(e)).byteLength},MM=async(e,t)=>{const n=V.toFiniteNumber(e.getContentLength());return n??OM(t)},AM=Xf&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:a,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:p="same-origin",fetchOptions:f}=p_(e);u=u?(u+"").toLowerCase():"text";let[h,g]=o||s||a?RM([o,s],a):[],m,w;const x=()=>{!m&&setTimeout(()=>{h&&h.unsubscribe()}),m=!0};let y;try{if(c&&DM&&n!=="get"&&n!=="head"&&(y=await MM(d,r))!==0){let S=new Request(t,{method:"POST",body:r,duplex:"half"}),k;V.isFormData(r)&&(k=S.headers.get("content-type"))&&d.setContentType(k),S.body&&(r=qw(S.body,Jw,Zw(y,Qd(c)),null,om))}V.isString(p)||(p=p?"cors":"omit"),w=new Request(t,{...f,signal:h,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",withCredentials:p});let b=await fetch(w);const C=sm&&(u==="stream"||u==="response");if(sm&&(l||C)){const S={};["status","statusText","headers"].forEach(E=>{S[E]=b[E]});const k=V.toFiniteNumber(b.headers.get("content-length"));b=new Response(qw(b.body,Jw,l&&Zw(k,Qd(l,!0)),C&&x,om),S)}u=u||"text";let j=await ef[V.findKey(ef,u)||"text"](b,e);return!C&&x(),g&&g(),await new Promise((S,k)=>{d_(S,k,{data:j,headers:Bn.from(b.headers),status:b.status,statusText:b.statusText,config:e,request:w})})}catch(b){throw x(),b&&b.name==="TypeError"&&/fetch/i.test(b.message)?Object.assign(new Be("Network Error",Be.ERR_NETWORK,e,w),{cause:b.cause||b}):Be.from(b,b&&b.code,e,w)}}),am={http:QO,xhr:NM,fetch:AM};V.forEach(am,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Yw=e=>`- ${e}`,FM=e=>V.isFunction(e)||e===null||e===!1,g_={getAdapter:e=>{e=V.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=t?s.length>1?`since : + */function bc(){return bc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[o]=e[o]);return n}function JD(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function YD(e,t){return e.button===0&&(!t||t==="_self")&&!JD(e)}const XD=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],QD="6";try{window.__reactRouterVersion=QD}catch{}function eO(e,t){return pD({basename:void 0,future:bc({},void 0,{v7_prependBasename:!0}),history:FI({window:void 0}),hydrationData:tO(),routes:e,mapRouteProperties:qD,unstable_dataStrategy:void 0,unstable_patchRoutesOnMiss:void 0,window:void 0}).initialize()}function tO(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=bc({},t,{errors:nO(t.errors)})),t}function nO(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Uv(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let s=window[o.__subType];if(typeof s=="function")try{let a=new s(o.message);a.stack="",n[r]=a}catch{}}if(n[r]==null){let s=new Error(o.message);s.stack="",n[r]=s}}else n[r]=o;return n}const rO=v.createContext({isTransitioning:!1}),oO=v.createContext(new Map),sO="startTransition",Aw=kf[sO],aO="flushSync",Fw=AI[aO];function iO(e){Aw?Aw(e):e()}function ml(e){Fw?Fw(e):e()}class lO{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function cO(e){let{fallbackElement:t,router:n,future:r}=e,[o,s]=v.useState(n.state),[a,l]=v.useState(),[c,u]=v.useState({isTransitioning:!1}),[d,p]=v.useState(),[f,h]=v.useState(),[g,m]=v.useState(),w=v.useRef(new Map),{v7_startTransition:x}=r||{},y=v.useCallback(E=>{x?iO(E):E()},[x]),b=v.useCallback((E,O)=>{let{deletedFetchers:F,unstable_flushSync:Z,unstable_viewTransitionOpts:I}=O;F.forEach(H=>w.current.delete(H)),E.fetchers.forEach((H,J)=>{H.data!==void 0&&w.current.set(J,H.data)});let q=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!I||q){Z?ml(()=>s(E)):y(()=>s(E));return}if(Z){ml(()=>{f&&(d&&d.resolve(),f.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:I.currentLocation,nextLocation:I.nextLocation})});let H=n.window.document.startViewTransition(()=>{ml(()=>s(E))});H.finished.finally(()=>{ml(()=>{p(void 0),h(void 0),l(void 0),u({isTransitioning:!1})})}),ml(()=>h(H));return}f?(d&&d.resolve(),f.skipTransition(),m({state:E,currentLocation:I.currentLocation,nextLocation:I.nextLocation})):(l(E),u({isTransitioning:!0,flushSync:!1,currentLocation:I.currentLocation,nextLocation:I.nextLocation}))},[n.window,f,d,w,y]);v.useLayoutEffect(()=>n.subscribe(b),[n,b]),v.useEffect(()=>{c.isTransitioning&&!c.flushSync&&p(new lO)},[c]),v.useEffect(()=>{if(d&&a&&n.window){let E=a,O=d.promise,F=n.window.document.startViewTransition(async()=>{y(()=>s(E)),await O});F.finished.finally(()=>{p(void 0),h(void 0),l(void 0),u({isTransitioning:!1})}),h(F)}},[y,a,d,n.window]),v.useEffect(()=>{d&&a&&o.location.key===a.location.key&&d.resolve()},[d,f,o.location,a]),v.useEffect(()=>{!c.isTransitioning&&g&&(l(g.state),u({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),m(void 0))},[c.isTransitioning,g]),v.useEffect(()=>{},[]);let C=v.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:E=>n.navigate(E),push:(E,O,F)=>n.navigate(E,{state:O,preventScrollReset:F==null?void 0:F.preventScrollReset}),replace:(E,O,F)=>n.navigate(E,{replace:!0,state:O,preventScrollReset:F==null?void 0:F.preventScrollReset})}),[n]),j=n.basename||"/",S=v.useMemo(()=>({router:n,navigator:C,static:!1,basename:j}),[n,C,j]),k=v.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return v.createElement(v.Fragment,null,v.createElement(Kf.Provider,{value:S},v.createElement(Uj.Provider,{value:o},v.createElement(oO.Provider,{value:w.current},v.createElement(rO.Provider,{value:c},v.createElement(KD,{basename:j,location:o.location,navigationType:o.historyAction,navigator:C,future:k},o.initialized||n.future.v7_partialHydration?v.createElement(uO,{routes:n.routes,future:n.future,state:o}):t))))),null)}const uO=v.memo(dO);function dO(e){let{routes:t,future:n,state:r}=e;return MD(t,void 0,r,n)}const fO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",pO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Lw=v.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:s,replace:a,state:l,target:c,to:u,preventScrollReset:d,unstable_viewTransition:p}=t,f=ZD(t,XD),{basename:h}=v.useContext(zs),g,m=!1;if(typeof u=="string"&&pO.test(u)&&(g=u,fO))try{let b=new URL(window.location.href),C=u.startsWith("//")?new URL(b.protocol+u):new URL(u),j=zi(C.pathname,h);C.origin===b.origin&&j!=null?u=j+C.search+C.hash:m=!0}catch{}let w=DD(u,{relative:o}),x=hO(u,{replace:a,state:l,target:c,preventScrollReset:d,relative:o,unstable_viewTransition:p});function y(b){r&&r(b),b.defaultPrevented||x(b)}return v.createElement("a",bc({},f,{href:g||w,onClick:m||s?r:y,ref:n,target:c}))});var $w;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})($w||($w={}));var zw;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(zw||(zw={}));function hO(e,t){let{target:n,replace:r,state:o,preventScrollReset:s,relative:a,unstable_viewTransition:l}=t===void 0?{}:t,c=ir(),u=eu(),d=Gj(e,{relative:a});return v.useCallback(p=>{if(YD(p,n)){p.preventDefault();let f=r!==void 0?r:ma(u)===ma(d);c(e,{replace:f,state:o,preventScrollReset:s,relative:a,unstable_viewTransition:l})}},[u,c,d,r,o,n,e,s,a,l])}const sn=({children:e})=>{const t=localStorage.getItem("apiUrl"),n=localStorage.getItem("token"),r=localStorage.getItem("version");return!t||!n||!r?i.jsx(qj,{to:"/manager/login"}):e},gO=({children:e})=>{const t=localStorage.getItem("apiUrl"),n=localStorage.getItem("token"),r=localStorage.getItem("version");return t&&n&&r?i.jsx(qj,{to:"/"}):e};function Zj(e,t){return function(){return e.apply(t,arguments)}}const{toString:mO}=Object.prototype,{getPrototypeOf:Wv}=Object,qf=(e=>t=>{const n=mO.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),$r=e=>(e=e.toLowerCase(),t=>qf(t)===e),Zf=e=>t=>typeof t===e,{isArray:Ui}=Array,Sc=Zf("undefined");function vO(e){return e!==null&&!Sc(e)&&e.constructor!==null&&!Sc(e.constructor)&&gr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Jj=$r("ArrayBuffer");function yO(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Jj(e.buffer),t}const xO=Zf("string"),gr=Zf("function"),Yj=Zf("number"),Jf=e=>e!==null&&typeof e=="object",wO=e=>e===!0||e===!1,gd=e=>{if(qf(e)!=="object")return!1;const t=Wv(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},bO=$r("Date"),SO=$r("File"),CO=$r("Blob"),jO=$r("FileList"),_O=e=>Jf(e)&&gr(e.pipe),EO=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||gr(e.append)&&((t=qf(e))==="formdata"||t==="object"&&gr(e.toString)&&e.toString()==="[object FormData]"))},TO=$r("URLSearchParams"),[kO,NO,RO,PO]=["ReadableStream","Request","Response","Headers"].map($r),IO=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tu(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,o;if(typeof e!="object"&&(e=[e]),Ui(e))for(r=0,o=e.length;r0;)if(o=n[r],t===o.toLowerCase())return o;return null}const Qj=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,e_=e=>!Sc(e)&&e!==Qj;function nm(){const{caseless:e}=e_(this)&&this||{},t={},n=(r,o)=>{const s=e&&Xj(t,o)||o;gd(t[s])&&gd(r)?t[s]=nm(t[s],r):gd(r)?t[s]=nm({},r):Ui(r)?t[s]=r.slice():t[s]=r};for(let r=0,o=arguments.length;r(tu(t,(o,s)=>{n&&gr(o)?e[s]=Zj(o,n):e[s]=o},{allOwnKeys:r}),e),OO=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),MO=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},AO=(e,t,n,r)=>{let o,s,a;const l={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],(!r||r(a,e,t))&&!l[a]&&(t[a]=e[a],l[a]=!0);e=n!==!1&&Wv(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},FO=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},LO=e=>{if(!e)return null;if(Ui(e))return e;let t=e.length;if(!Yj(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},$O=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Wv(Uint8Array)),zO=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=r.next())&&!o.done;){const s=o.value;t.call(e,s[0],s[1])}},VO=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},UO=$r("HTMLFormElement"),BO=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),Vw=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),HO=$r("RegExp"),t_=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};tu(n,(o,s)=>{let a;(a=t(o,s,e))!==!1&&(r[s]=a||o)}),Object.defineProperties(e,r)},GO=e=>{t_(e,(t,n)=>{if(gr(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(gr(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},WO=(e,t)=>{const n={},r=o=>{o.forEach(s=>{n[s]=!0})};return Ui(e)?r(e):r(String(e).split(t)),n},KO=()=>{},qO=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,wh="abcdefghijklmnopqrstuvwxyz",Uw="0123456789",n_={DIGIT:Uw,ALPHA:wh,ALPHA_DIGIT:wh+wh.toUpperCase()+Uw},ZO=(e=16,t=n_.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function JO(e){return!!(e&&gr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const YO=e=>{const t=new Array(10),n=(r,o)=>{if(Jf(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[o]=r;const s=Ui(r)?[]:{};return tu(r,(a,l)=>{const c=n(a,o+1);!Sc(c)&&(s[l]=c)}),t[o]=void 0,s}}return r};return n(e,0)},XO=$r("AsyncFunction"),QO=e=>e&&(Jf(e)||gr(e))&&gr(e.then)&&gr(e.catch),V={isArray:Ui,isArrayBuffer:Jj,isBuffer:vO,isFormData:EO,isArrayBufferView:yO,isString:xO,isNumber:Yj,isBoolean:wO,isObject:Jf,isPlainObject:gd,isReadableStream:kO,isRequest:NO,isResponse:RO,isHeaders:PO,isUndefined:Sc,isDate:bO,isFile:SO,isBlob:CO,isRegExp:HO,isFunction:gr,isStream:_O,isURLSearchParams:TO,isTypedArray:$O,isFileList:jO,forEach:tu,merge:nm,extend:DO,trim:IO,stripBOM:OO,inherits:MO,toFlatObject:AO,kindOf:qf,kindOfTest:$r,endsWith:FO,toArray:LO,forEachEntry:zO,matchAll:VO,isHTMLForm:UO,hasOwnProperty:Vw,hasOwnProp:Vw,reduceDescriptors:t_,freezeMethods:GO,toObjectSet:WO,toCamelCase:BO,noop:KO,toFiniteNumber:qO,findKey:Xj,global:Qj,isContextDefined:e_,ALPHABET:n_,generateString:ZO,isSpecCompliantForm:JO,toJSONObject:YO,isAsyncFn:XO,isThenable:QO};function Be(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}V.inherits(Be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:V.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const r_=Be.prototype,o_={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{o_[e]={value:e}});Object.defineProperties(Be,o_);Object.defineProperty(r_,"isAxiosError",{value:!0});Be.from=(e,t,n,r,o,s)=>{const a=Object.create(r_);return V.toFlatObject(e,a,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),Be.call(a,e.message,t,n,r,o),a.cause=e,a.name=e.name,s&&Object.assign(a,s),a};const eM=null;function rm(e){return V.isPlainObject(e)||V.isArray(e)}function s_(e){return V.endsWith(e,"[]")?e.slice(0,-2):e}function Bw(e,t,n){return e?e.concat(t).map(function(o,s){return o=s_(o),!n&&s?"["+o+"]":o}).join(n?".":""):t}function tM(e){return V.isArray(e)&&!e.some(rm)}const nM=V.toFlatObject(V,{},null,function(t){return/^is[A-Z]/.test(t)});function Yf(e,t,n){if(!V.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=V.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!V.isUndefined(w[m])});const r=n.metaTokens,o=n.visitor||d,s=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&V.isSpecCompliantForm(t);if(!V.isFunction(o))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(V.isDate(g))return g.toISOString();if(!c&&V.isBlob(g))throw new Be("Blob is not supported. Use a Buffer instead.");return V.isArrayBuffer(g)||V.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,m,w){let x=g;if(g&&!w&&typeof g=="object"){if(V.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(V.isArray(g)&&tM(g)||(V.isFileList(g)||V.endsWith(m,"[]"))&&(x=V.toArray(g)))return m=s_(m),x.forEach(function(b,C){!(V.isUndefined(b)||b===null)&&t.append(a===!0?Bw([m],C,s):a===null?m:m+"[]",u(b))}),!1}return rm(g)?!0:(t.append(Bw(w,m,s),u(g)),!1)}const p=[],f=Object.assign(nM,{defaultVisitor:d,convertValue:u,isVisitable:rm});function h(g,m){if(!V.isUndefined(g)){if(p.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));p.push(g),V.forEach(g,function(x,y){(!(V.isUndefined(x)||x===null)&&o.call(t,x,V.isString(y)?y.trim():y,m,f))===!0&&h(x,m?m.concat(y):[y])}),p.pop()}}if(!V.isObject(e))throw new TypeError("data must be an object");return h(e),t}function Hw(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Kv(e,t){this._pairs=[],e&&Yf(e,this,t)}const a_=Kv.prototype;a_.append=function(t,n){this._pairs.push([t,n])};a_.toString=function(t){const n=t?function(r){return t.call(this,r,Hw)}:Hw;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function rM(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function i_(e,t,n){if(!t)return e;const r=n&&n.encode||rM,o=n&&n.serialize;let s;if(o?s=o(t,n):s=V.isURLSearchParams(t)?t.toString():new Kv(t,n).toString(r),s){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Gw{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){V.forEach(this.handlers,function(r){r!==null&&t(r)})}}const l_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},oM=typeof URLSearchParams<"u"?URLSearchParams:Kv,sM=typeof FormData<"u"?FormData:null,aM=typeof Blob<"u"?Blob:null,iM={isBrowser:!0,classes:{URLSearchParams:oM,FormData:sM,Blob:aM},protocols:["http","https","file","blob","url","data"]},qv=typeof window<"u"&&typeof document<"u",lM=(e=>qv&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),cM=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",uM=qv&&window.location.href||"http://localhost",dM=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:qv,hasStandardBrowserEnv:lM,hasStandardBrowserWebWorkerEnv:cM,origin:uM},Symbol.toStringTag,{value:"Module"})),Pr={...dM,...iM};function fM(e,t){return Yf(e,new Pr.classes.URLSearchParams,Object.assign({visitor:function(n,r,o,s){return Pr.isNode&&V.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function pM(e){return V.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function hM(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r=n.length;return a=!a&&V.isArray(o)?o.length:a,c?(V.hasOwnProp(o,a)?o[a]=[o[a],r]:o[a]=r,!l):((!o[a]||!V.isObject(o[a]))&&(o[a]=[]),t(n,r,o[a],s)&&V.isArray(o[a])&&(o[a]=hM(o[a])),!l)}if(V.isFormData(e)&&V.isFunction(e.entries)){const n={};return V.forEachEntry(e,(r,o)=>{t(pM(r),o,n,0)}),n}return null}function gM(e,t,n){if(V.isString(e))try{return(t||JSON.parse)(e),V.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const nu={transitional:l_,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,s=V.isObject(t);if(s&&V.isHTMLForm(t)&&(t=new FormData(t)),V.isFormData(t))return o?JSON.stringify(c_(t)):t;if(V.isArrayBuffer(t)||V.isBuffer(t)||V.isStream(t)||V.isFile(t)||V.isBlob(t)||V.isReadableStream(t))return t;if(V.isArrayBufferView(t))return t.buffer;if(V.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return fM(t,this.formSerializer).toString();if((l=V.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Yf(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||o?(n.setContentType("application/json",!1),gM(t)):t}],transformResponse:[function(t){const n=this.transitional||nu.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(V.isResponse(t)||V.isReadableStream(t))return t;if(t&&V.isString(t)&&(r&&!this.responseType||o)){const a=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(l){if(a)throw l.name==="SyntaxError"?Be.from(l,Be.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Pr.classes.FormData,Blob:Pr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};V.forEach(["delete","get","head","post","put","patch"],e=>{nu.headers[e]={}});const mM=V.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),vM=e=>{const t={};let n,r,o;return e&&e.split(` +`).forEach(function(a){o=a.indexOf(":"),n=a.substring(0,o).trim().toLowerCase(),r=a.substring(o+1).trim(),!(!n||t[n]&&mM[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Ww=Symbol("internals");function vl(e){return e&&String(e).trim().toLowerCase()}function md(e){return e===!1||e==null?e:V.isArray(e)?e.map(md):String(e)}function yM(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const xM=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function bh(e,t,n,r,o){if(V.isFunction(r))return r.call(this,t,n);if(o&&(t=n),!!V.isString(t)){if(V.isString(r))return t.indexOf(r)!==-1;if(V.isRegExp(r))return r.test(t)}}function wM(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function bM(e,t){const n=V.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(o,s,a){return this[r].call(this,t,o,s,a)},configurable:!0})})}class Bn{constructor(t){t&&this.set(t)}set(t,n,r){const o=this;function s(l,c,u){const d=vl(c);if(!d)throw new Error("header name must be a non-empty string");const p=V.findKey(o,d);(!p||o[p]===void 0||u===!0||u===void 0&&o[p]!==!1)&&(o[p||c]=md(l))}const a=(l,c)=>V.forEach(l,(u,d)=>s(u,d,c));if(V.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(V.isString(t)&&(t=t.trim())&&!xM(t))a(vM(t),n);else if(V.isHeaders(t))for(const[l,c]of t.entries())s(c,l,r);else t!=null&&s(n,t,r);return this}get(t,n){if(t=vl(t),t){const r=V.findKey(this,t);if(r){const o=this[r];if(!n)return o;if(n===!0)return yM(o);if(V.isFunction(n))return n.call(this,o,r);if(V.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=vl(t),t){const r=V.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||bh(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let o=!1;function s(a){if(a=vl(a),a){const l=V.findKey(r,a);l&&(!n||bh(r,r[l],l,n))&&(delete r[l],o=!0)}}return V.isArray(t)?t.forEach(s):s(t),o}clear(t){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const s=n[r];(!t||bh(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){const n=this,r={};return V.forEach(this,(o,s)=>{const a=V.findKey(r,s);if(a){n[a]=md(o),delete n[s];return}const l=t?wM(s):String(s).trim();l!==s&&delete n[s],n[l]=md(o),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return V.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=t&&V.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[Ww]=this[Ww]={accessors:{}}).accessors,o=this.prototype;function s(a){const l=vl(a);r[l]||(bM(o,a),r[l]=!0)}return V.isArray(t)?t.forEach(s):s(t),this}}Bn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);V.reduceDescriptors(Bn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});V.freezeMethods(Bn);function Sh(e,t){const n=this||nu,r=t||n,o=Bn.from(r.headers);let s=r.data;return V.forEach(e,function(l){s=l.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function u_(e){return!!(e&&e.__CANCEL__)}function Bi(e,t,n){Be.call(this,e??"canceled",Be.ERR_CANCELED,t,n),this.name="CanceledError"}V.inherits(Bi,Be,{__CANCEL__:!0});function d_(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Be("Request failed with status code "+n.status,[Be.ERR_BAD_REQUEST,Be.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function SM(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function CM(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,s=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[s];a||(a=u),n[o]=c,r[o]=u;let p=s,f=0;for(;p!==o;)f+=n[p++],p=p%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),u-ar)return o&&(clearTimeout(o),o=null),n=l,e.apply(null,arguments);o||(o=setTimeout(()=>(o=null,n=Date.now(),e.apply(null,arguments)),r-(l-n)))}}const Qd=(e,t,n=3)=>{let r=0;const o=CM(50,250);return jM(s=>{const a=s.loaded,l=s.lengthComputable?s.total:void 0,c=a-r,u=o(c),d=a<=l;r=a;const p={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-a)/u:void 0,event:s,lengthComputable:l!=null};p[t?"download":"upload"]=!0,e(p)},n)},_M=Pr.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(s){let a=s;return t&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(a){const l=V.isString(a)?o(a):a;return l.protocol===r.protocol&&l.host===r.host}}():function(){return function(){return!0}}(),EM=Pr.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const a=[e+"="+encodeURIComponent(t)];V.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),V.isString(r)&&a.push("path="+r),V.isString(o)&&a.push("domain="+o),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function TM(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function kM(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function f_(e,t){return e&&!TM(t)?kM(e,t):t}const Kw=e=>e instanceof Bn?{...e}:e;function va(e,t){t=t||{};const n={};function r(u,d,p){return V.isPlainObject(u)&&V.isPlainObject(d)?V.merge.call({caseless:p},u,d):V.isPlainObject(d)?V.merge({},d):V.isArray(d)?d.slice():d}function o(u,d,p){if(V.isUndefined(d)){if(!V.isUndefined(u))return r(void 0,u,p)}else return r(u,d,p)}function s(u,d){if(!V.isUndefined(d))return r(void 0,d)}function a(u,d){if(V.isUndefined(d)){if(!V.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,p){if(p in t)return r(u,d);if(p in e)return r(void 0,u)}const c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(u,d)=>o(Kw(u),Kw(d),!0)};return V.forEach(Object.keys(Object.assign({},e,t)),function(d){const p=c[d]||o,f=p(e[d],t[d],d);V.isUndefined(f)&&p!==l||(n[d]=f)}),n}const p_=e=>{const t=va({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:l}=t;t.headers=a=Bn.from(a),t.url=i_(f_(t.baseURL,t.url),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(V.isFormData(n)){if(Pr.hasStandardBrowserEnv||Pr.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[u,...d]=c?c.split(";").map(p=>p.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...d].join("; "))}}if(Pr.hasStandardBrowserEnv&&(r&&V.isFunction(r)&&(r=r(t)),r||r!==!1&&_M(t.url))){const u=o&&s&&EM.read(s);u&&a.set(o,u)}return t},NM=typeof XMLHttpRequest<"u",RM=NM&&function(e){return new Promise(function(n,r){const o=p_(e);let s=o.data;const a=Bn.from(o.headers).normalize();let{responseType:l}=o,c;function u(){o.cancelToken&&o.cancelToken.unsubscribe(c),o.signal&&o.signal.removeEventListener("abort",c)}let d=new XMLHttpRequest;d.open(o.method.toUpperCase(),o.url,!0),d.timeout=o.timeout;function p(){if(!d)return;const h=Bn.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),m={data:!l||l==="text"||l==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:h,config:e,request:d};d_(function(x){n(x),u()},function(x){r(x),u()},m),d=null}"onloadend"in d?d.onloadend=p:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(p)},d.onabort=function(){d&&(r(new Be("Request aborted",Be.ECONNABORTED,o,d)),d=null)},d.onerror=function(){r(new Be("Network Error",Be.ERR_NETWORK,o,d)),d=null},d.ontimeout=function(){let g=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const m=o.transitional||l_;o.timeoutErrorMessage&&(g=o.timeoutErrorMessage),r(new Be(g,m.clarifyTimeoutError?Be.ETIMEDOUT:Be.ECONNABORTED,o,d)),d=null},s===void 0&&a.setContentType(null),"setRequestHeader"in d&&V.forEach(a.toJSON(),function(g,m){d.setRequestHeader(m,g)}),V.isUndefined(o.withCredentials)||(d.withCredentials=!!o.withCredentials),l&&l!=="json"&&(d.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&d.addEventListener("progress",Qd(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",Qd(o.onUploadProgress)),(o.cancelToken||o.signal)&&(c=h=>{d&&(r(!h||h.type?new Bi(null,e,d):h),d.abort(),d=null)},o.cancelToken&&o.cancelToken.subscribe(c),o.signal&&(o.signal.aborted?c():o.signal.addEventListener("abort",c)));const f=SM(o.url);if(f&&Pr.protocols.indexOf(f)===-1){r(new Be("Unsupported protocol "+f+":",Be.ERR_BAD_REQUEST,e));return}d.send(s||null)})},PM=(e,t)=>{let n=new AbortController,r;const o=function(c){if(!r){r=!0,a();const u=c instanceof Error?c:this.reason;n.abort(u instanceof Be?u:new Bi(u instanceof Error?u.message:u))}};let s=t&&setTimeout(()=>{o(new Be(`timeout ${t} of ms exceeded`,Be.ETIMEDOUT))},t);const a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(c=>{c&&(c.removeEventListener?c.removeEventListener("abort",o):c.unsubscribe(o))}),e=null)};e.forEach(c=>c&&c.addEventListener&&c.addEventListener("abort",o));const{signal:l}=n;return l.unsubscribe=a,[l,()=>{s&&clearTimeout(s),s=null}]},IM=function*(e,t){let n=e.byteLength;if(!t||n{const s=DM(e,t,o);let a=0;return new ReadableStream({type:"bytes",async pull(l){const{done:c,value:u}=await s.next();if(c){l.close(),r();return}let d=u.byteLength;n&&n(a+=d),l.enqueue(new Uint8Array(u))},cancel(l){return r(l),s.return()}},{highWaterMark:2})},Zw=(e,t)=>{const n=e!=null;return r=>setTimeout(()=>t({lengthComputable:n,total:e,loaded:r}))},Xf=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",h_=Xf&&typeof ReadableStream=="function",om=Xf&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),OM=h_&&(()=>{let e=!1;const t=new Request(Pr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),Jw=64*1024,sm=h_&&!!(()=>{try{return V.isReadableStream(new Response("").body)}catch{}})(),ef={stream:sm&&(e=>e.body)};Xf&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!ef[t]&&(ef[t]=V.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new Be(`Response type '${t}' is not supported`,Be.ERR_NOT_SUPPORT,r)})})})(new Response);const MM=async e=>{if(e==null)return 0;if(V.isBlob(e))return e.size;if(V.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(V.isArrayBufferView(e))return e.byteLength;if(V.isURLSearchParams(e)&&(e=e+""),V.isString(e))return(await om(e)).byteLength},AM=async(e,t)=>{const n=V.toFiniteNumber(e.getContentLength());return n??MM(t)},FM=Xf&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:a,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:p="same-origin",fetchOptions:f}=p_(e);u=u?(u+"").toLowerCase():"text";let[h,g]=o||s||a?PM([o,s],a):[],m,w;const x=()=>{!m&&setTimeout(()=>{h&&h.unsubscribe()}),m=!0};let y;try{if(c&&OM&&n!=="get"&&n!=="head"&&(y=await AM(d,r))!==0){let S=new Request(t,{method:"POST",body:r,duplex:"half"}),k;V.isFormData(r)&&(k=S.headers.get("content-type"))&&d.setContentType(k),S.body&&(r=qw(S.body,Jw,Zw(y,Qd(c)),null,om))}V.isString(p)||(p=p?"cors":"omit"),w=new Request(t,{...f,signal:h,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",withCredentials:p});let b=await fetch(w);const C=sm&&(u==="stream"||u==="response");if(sm&&(l||C)){const S={};["status","statusText","headers"].forEach(E=>{S[E]=b[E]});const k=V.toFiniteNumber(b.headers.get("content-length"));b=new Response(qw(b.body,Jw,l&&Zw(k,Qd(l,!0)),C&&x,om),S)}u=u||"text";let j=await ef[V.findKey(ef,u)||"text"](b,e);return!C&&x(),g&&g(),await new Promise((S,k)=>{d_(S,k,{data:j,headers:Bn.from(b.headers),status:b.status,statusText:b.statusText,config:e,request:w})})}catch(b){throw x(),b&&b.name==="TypeError"&&/fetch/i.test(b.message)?Object.assign(new Be("Network Error",Be.ERR_NETWORK,e,w),{cause:b.cause||b}):Be.from(b,b&&b.code,e,w)}}),am={http:eM,xhr:RM,fetch:FM};V.forEach(am,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Yw=e=>`- ${e}`,LM=e=>V.isFunction(e)||e===null||e===!1,g_={getAdapter:e=>{e=V.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=t?s.length>1?`since : `+s.map(Yw).join(` -`):" "+Yw(s[0]):"as no adapter specified";throw new Be("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:am};function Ch(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Bi(null,e)}function Xw(e){return Ch(e),e.headers=Bn.from(e.headers),e.data=Sh.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),g_.getAdapter(e.adapter||nu.adapter)(e).then(function(r){return Ch(e),r.data=Sh.call(e,e.transformResponse,r),r.headers=Bn.from(r.headers),r},function(r){return u_(r)||(Ch(e),r&&r.response&&(r.response.data=Sh.call(e,e.transformResponse,r.response),r.response.headers=Bn.from(r.response.headers))),Promise.reject(r)})}const m_="1.7.2",Zv={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Zv[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Qw={};Zv.transitional=function(t,n,r){function o(s,a){return"[Axios v"+m_+"] Transitional option '"+s+"'"+a+(r?". "+r:"")}return(s,a,l)=>{if(t===!1)throw new Be(o(a," has been removed"+(n?" in "+n:"")),Be.ERR_DEPRECATED);return n&&!Qw[a]&&(Qw[a]=!0,console.warn(o(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,a,l):!0}};function LM(e,t,n){if(typeof e!="object")throw new Be("options must be an object",Be.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],a=t[s];if(a){const l=e[s],c=l===void 0||a(l,s,e);if(c!==!0)throw new Be("option "+s+" must be "+c,Be.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Be("Unknown option "+s,Be.ERR_BAD_OPTION)}}const im={assertOptions:LM,validators:Zv},Xo=im.validators;class aa{constructor(t){this.defaults=t,this.interceptors={request:new Gw,response:new Gw}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=va(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&im.assertOptions(r,{silentJSONParsing:Xo.transitional(Xo.boolean),forcedJSONParsing:Xo.transitional(Xo.boolean),clarifyTimeoutError:Xo.transitional(Xo.boolean)},!1),o!=null&&(V.isFunction(o)?n.paramsSerializer={serialize:o}:im.assertOptions(o,{encode:Xo.function,serialize:Xo.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&V.merge(s.common,s[n.method]);s&&V.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=Bn.concat(a,s);const l=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,p=0,f;if(!c){const g=[Xw.bind(this),void 0];for(g.unshift.apply(g,l),g.push.apply(g,u),f=g.length,d=Promise.resolve(n);p{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const a=new Promise(l=>{r.subscribe(l),s=l}).then(o);return a.cancel=function(){r.unsubscribe(s)},a},t(function(s,a,l){r.reason||(r.reason=new Bi(s,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Jv(function(o){t=o}),cancel:t}}}function $M(e){return function(n){return e.apply(null,n)}}function zM(e){return V.isObject(e)&&e.isAxiosError===!0}const lm={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(lm).forEach(([e,t])=>{lm[t]=e});function v_(e){const t=new aa(e),n=Zj(aa.prototype.request,t);return V.extend(n,aa.prototype,t,{allOwnKeys:!0}),V.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return v_(va(e,o))},n}const Vt=v_(nu);Vt.Axios=aa;Vt.CanceledError=Bi;Vt.CancelToken=Jv;Vt.isCancel=u_;Vt.VERSION=m_;Vt.toFormData=Yf;Vt.AxiosError=Be;Vt.Cancel=Vt.CanceledError;Vt.all=function(t){return Promise.all(t)};Vt.spread=$M;Vt.isAxiosError=zM;Vt.mergeConfig=va;Vt.AxiosHeaders=Bn;Vt.formToJSON=e=>c_(V.isHTMLForm(e)?new FormData(e):e);Vt.getAdapter=g_.getAdapter;Vt.HttpStatusCode=lm;Vt.default=Vt;const VM=async(e,t)=>{try{const n=e.endsWith("/")?e.slice(0,-1):e;return localStorage.setItem("apiUrl",n),localStorage.setItem("token",t),!0}catch{return!1}},UM=async e=>(await Vt.get(`${e}/`)).data,y_=()=>{localStorage.removeItem("apiUrl"),localStorage.removeItem("token"),localStorage.removeItem("version")};/** +`):" "+Yw(s[0]):"as no adapter specified";throw new Be("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:am};function Ch(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Bi(null,e)}function Xw(e){return Ch(e),e.headers=Bn.from(e.headers),e.data=Sh.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),g_.getAdapter(e.adapter||nu.adapter)(e).then(function(r){return Ch(e),r.data=Sh.call(e,e.transformResponse,r),r.headers=Bn.from(r.headers),r},function(r){return u_(r)||(Ch(e),r&&r.response&&(r.response.data=Sh.call(e,e.transformResponse,r.response),r.response.headers=Bn.from(r.response.headers))),Promise.reject(r)})}const m_="1.7.2",Zv={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Zv[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Qw={};Zv.transitional=function(t,n,r){function o(s,a){return"[Axios v"+m_+"] Transitional option '"+s+"'"+a+(r?". "+r:"")}return(s,a,l)=>{if(t===!1)throw new Be(o(a," has been removed"+(n?" in "+n:"")),Be.ERR_DEPRECATED);return n&&!Qw[a]&&(Qw[a]=!0,console.warn(o(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,a,l):!0}};function $M(e,t,n){if(typeof e!="object")throw new Be("options must be an object",Be.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],a=t[s];if(a){const l=e[s],c=l===void 0||a(l,s,e);if(c!==!0)throw new Be("option "+s+" must be "+c,Be.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Be("Unknown option "+s,Be.ERR_BAD_OPTION)}}const im={assertOptions:$M,validators:Zv},Xo=im.validators;class aa{constructor(t){this.defaults=t,this.interceptors={request:new Gw,response:new Gw}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=va(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&im.assertOptions(r,{silentJSONParsing:Xo.transitional(Xo.boolean),forcedJSONParsing:Xo.transitional(Xo.boolean),clarifyTimeoutError:Xo.transitional(Xo.boolean)},!1),o!=null&&(V.isFunction(o)?n.paramsSerializer={serialize:o}:im.assertOptions(o,{encode:Xo.function,serialize:Xo.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&V.merge(s.common,s[n.method]);s&&V.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=Bn.concat(a,s);const l=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,p=0,f;if(!c){const g=[Xw.bind(this),void 0];for(g.unshift.apply(g,l),g.push.apply(g,u),f=g.length,d=Promise.resolve(n);p{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const a=new Promise(l=>{r.subscribe(l),s=l}).then(o);return a.cancel=function(){r.unsubscribe(s)},a},t(function(s,a,l){r.reason||(r.reason=new Bi(s,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Jv(function(o){t=o}),cancel:t}}}function zM(e){return function(n){return e.apply(null,n)}}function VM(e){return V.isObject(e)&&e.isAxiosError===!0}const lm={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(lm).forEach(([e,t])=>{lm[t]=e});function v_(e){const t=new aa(e),n=Zj(aa.prototype.request,t);return V.extend(n,aa.prototype,t,{allOwnKeys:!0}),V.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return v_(va(e,o))},n}const Vt=v_(nu);Vt.Axios=aa;Vt.CanceledError=Bi;Vt.CancelToken=Jv;Vt.isCancel=u_;Vt.VERSION=m_;Vt.toFormData=Yf;Vt.AxiosError=Be;Vt.Cancel=Vt.CanceledError;Vt.all=function(t){return Promise.all(t)};Vt.spread=zM;Vt.isAxiosError=VM;Vt.mergeConfig=va;Vt.AxiosHeaders=Bn;Vt.formToJSON=e=>c_(V.isHTMLForm(e)?new FormData(e):e);Vt.getAdapter=g_.getAdapter;Vt.HttpStatusCode=lm;Vt.default=Vt;const UM=async(e,t)=>{try{const n=e.endsWith("/")?e.slice(0,-1):e;return localStorage.setItem("apiUrl",n),localStorage.setItem("token",t),!0}catch{return!1}},BM=async e=>(await Vt.get(`${e}/`)).data,y_=()=>{localStorage.removeItem("apiUrl"),localStorage.removeItem("token"),localStorage.removeItem("version")};class zr{constructor(){this.apiInstance=Vt.create({timeout:1e4}),this.apiInstance.interceptors.request.use(async t=>{const n=localStorage.getItem("token");return n&&(t.headers.apikey=`${n}`),t},t=>Promise.reject(t))}getInstance(){const t=localStorage.getItem("apiUrl");return t&&(this.apiInstance.defaults.baseURL=t.toString()),this.apiInstance}}const Vo=new zr,HM=async e=>(await Vo.getInstance().post("/instance/create",e)).data,GM=async()=>(await Vo.getInstance().get("/instance/fetchInstances")).data,x_=async e=>(await Vo.getInstance().get(`/instance/fetchInstances?instanceId=${e}`)).data,WM=async e=>(await Vo.getInstance().post(`/instance/restart/${e}`)).data,w_=async e=>(await Vo.getInstance().delete(`/instance/logout/${e}`)).data,KM=async e=>(await Vo.getInstance().delete(`/instance/delete/${e}`)).data,e0=async(e,t,n)=>{let r=`/instance/connect/${e}`;return n&&(r+=`?number=${n}`),(await Vo.getInstance().get(r,{headers:{apikey:t}})).data},qM=async(e,t)=>(await Vo.getInstance().get(`/settings/find/${e}`,{headers:{apikey:t}})).data,ZM=async(e,t,n)=>(await Vo.getInstance().post(`/settings/set/${e}`,n,{headers:{apikey:t}})).data;/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),x_=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/** + */const JM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),b_=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var HM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var YM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const GM=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...l},c)=>v.createElement("svg",{ref:c,...HM,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:x_("lucide",o),...l},[...a.map(([u,d])=>v.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** + */const XM=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...l},c)=>v.createElement("svg",{ref:c,...YM,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:b_("lucide",o),...l},[...a.map(([u,d])=>v.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rt=(e,t)=>{const n=v.forwardRef(({className:r,...o},s)=>v.createElement(GM,{ref:s,iconNode:t,className:x_(`lucide-${BM(e)}`,r),...o}));return n.displayName=`${e}`,n};/** + */const rt=(e,t)=>{const n=v.forwardRef(({className:r,...o},s)=>v.createElement(XM,{ref:s,iconNode:t,className:b_(`lucide-${JM(e)}`,r),...o}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const WM=rt("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** + */const QM=rt("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const KM=rt("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const eA=rt("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const si=rt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const ai=rt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. @@ -116,22 +116,22 @@ Error generating stack: `+s.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qM=rt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const tA=rt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ZM=rt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + */const nA=rt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const JM=rt("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** + */const rA=rt("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const YM=rt("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const oA=rt("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. @@ -141,12 +141,12 @@ Error generating stack: `+s.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const XM=rt("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** + */const sA=rt("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const QM=rt("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const aA=rt("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. @@ -156,7 +156,7 @@ Error generating stack: `+s.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const w_=rt("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + */const S_=rt("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. @@ -166,7 +166,7 @@ Error generating stack: `+s.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const eA=rt("DoorOpen",[["path",{d:"M13 4h3a2 2 0 0 1 2 2v14",key:"hrm0s9"}],["path",{d:"M2 20h3",key:"1gaodv"}],["path",{d:"M13 20h9",key:"s90cdi"}],["path",{d:"M10 12v.01",key:"vx6srw"}],["path",{d:"M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z",key:"199qr4"}]]);/** + */const iA=rt("DoorOpen",[["path",{d:"M13 4h3a2 2 0 0 1 2 2v14",key:"hrm0s9"}],["path",{d:"M2 20h3",key:"1gaodv"}],["path",{d:"M13 20h9",key:"s90cdi"}],["path",{d:"M10 12v.01",key:"vx6srw"}],["path",{d:"M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z",key:"199qr4"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. @@ -176,32 +176,32 @@ Error generating stack: `+s.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const b_=rt("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** + */const C_=rt("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const S_=rt("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const j_=rt("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tA=rt("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/** + */const lA=rt("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nA=rt("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + */const cA=rt("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rA=rt("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + */const uA=rt("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const oA=rt("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** + */const dA=rt("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. @@ -211,7 +211,7 @@ Error generating stack: `+s.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sA=rt("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** + */const fA=rt("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. @@ -221,7 +221,7 @@ Error generating stack: `+s.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aA=rt("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** + */const pA=rt("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. @@ -241,27 +241,27 @@ Error generating stack: `+s.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const C_=rt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + */const __=rt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const iA=rt("Sparkle",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}]]);/** + */const hA=rt("Sparkle",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lA=rt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + */const gA=rt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-react v0.408.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cA=rt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function j_({perfil:e}){const t=ir(),n=()=>{y_(),t("/manager/login")},r=()=>{t("/manager/")};return i.jsxs("header",{children:[i.jsxs("a",{href:"#",onClick:r,className:"header-logo",children:[i.jsx("img",{src:"/assets/images/evolution-logo.png",alt:"Logo"}),i.jsx("span",{className:"header-title",children:"Evolution Manager"})]}),i.jsxs("div",{className:"header-buttons",children:[e&&i.jsx("button",{className:"profile-button",children:i.jsx("img",{src:"/assets/images/evolution-logo.png",alt:"Perfil",className:"profile-picture"})}),i.jsx("button",{onClick:n,className:"exit-button",children:i.jsx(eA,{size:"18"})})]})]})}const uA=[{id:"dashboard",title:"Visão Geral",icon:rA,path:"dashboard"},{navLabel:!0,title:"Configurações",icon:ru,children:[{id:"settings",title:"Comportamento",path:"settings"},{id:"openai",title:"OpenAI",path:"openai"},{id:"dify",title:"Dify",path:"dify"},{id:"webhook",title:"Webhook",path:"webhook"},{id:"websocket",title:"Websocket",path:"websocket"},{id:"rabbitmq",title:"RabbitMQ",path:"rabbitmq"},{id:"sqs",title:"Amazon SQS",path:"sqs"},{id:"chatwoot",title:"Chatwoot",path:"chatwoot"},{id:"typebot",title:"Typebot",path:"typebot"},{id:"proxy",title:"Proxy",path:"proxy"}]},{id:"documentation",title:"Documentação",icon:tA,link:"https://doc.evolution-api.com"},{id:"postman",title:"Postman",icon:YM,link:"https://evolution-api.com/postman"},{id:"discord",title:"Discord",icon:ey,link:"https://evolution-api.com/discord"},{id:"support-premium",title:"Support Premium",icon:oA,link:"https://evolution-api.com/suporte-pro"}];class zr{constructor(){this.apiInstance=Vt.create({timeout:1e4}),this.apiInstance.interceptors.request.use(async t=>{const n=localStorage.getItem("token");return n&&(t.headers.apikey=`${n}`),t},t=>Promise.reject(t))}getInstance(){const t=localStorage.getItem("apiUrl");return t&&(this.apiInstance.defaults.baseURL=t.toString()),this.apiInstance}}const Vo=new zr,dA=async e=>(await Vo.getInstance().post("/instance/create",e)).data,fA=async()=>(await Vo.getInstance().get("/instance/fetchInstances")).data,pA=async e=>(await Vo.getInstance().get(`/instance/fetchInstances?instanceId=${e}`)).data,hA=async e=>(await Vo.getInstance().post(`/instance/restart/${e}`)).data,__=async e=>(await Vo.getInstance().delete(`/instance/logout/${e}`)).data,gA=async e=>(await Vo.getInstance().delete(`/instance/delete/${e}`)).data,e0=async(e,t,n)=>{let r=`/instance/connect/${e}`;return n&&(r+=`?number=${n}`),(await Vo.getInstance().get(r,{headers:{apikey:t}})).data},mA=async(e,t)=>(await Vo.getInstance().get(`/settings/find/${e}`,{headers:{apikey:t}})).data,vA=async(e,t,n)=>(await Vo.getInstance().post(`/settings/set/${e}`,n,{headers:{apikey:t}})).data,E_=v.createContext(null),Tt=()=>{const e=v.useContext(E_);if(!e)throw new Error("useInstance must be used within an InstanceProvider");return e},yA=({children:e})=>{const{instanceId:t}=Vi(),[n,r]=v.useState(null);return v.useEffect(()=>{t&&(async s=>{try{const a=await pA(s);r(a[0]||null)}catch(a){console.error("Erro ao buscar dados:",a)}})(t)},[t]),i.jsx(E_.Provider,{value:{instance:n},children:e})};function Ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function xA(e,t){const n=v.createContext(t);function r(s){const{children:a,...l}=s,c=v.useMemo(()=>l,Object.values(l));return i.jsx(n.Provider,{value:c,children:a})}function o(s){const a=v.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return r.displayName=e+"Provider",[r,o]}function lo(e,t=[]){let n=[];function r(s,a){const l=v.createContext(a),c=n.length;n=[...n,a];function u(p){const{scope:f,children:h,...g}=p,m=(f==null?void 0:f[e][c])||l,w=v.useMemo(()=>g,Object.values(g));return i.jsx(m.Provider,{value:w,children:h})}function d(p,f){const h=(f==null?void 0:f[e][c])||l,g=v.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,d]}const o=()=>{const s=n.map(a=>v.createContext(a));return function(l){const c=(l==null?void 0:l[e])||s;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,wA(o,...t)]}function wA(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const p=c(s)[`__scope${u}`];return{...l,...p}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function xr(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function js({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=bA({defaultProp:t,onChange:n}),s=e!==void 0,a=s?e:r,l=xr(n),c=v.useCallback(u=>{if(s){const p=typeof u=="function"?u(e):u;p!==e&&l(p)}else o(u)},[s,e,o,l]);return[a,c]}function bA({defaultProp:e,onChange:t}){const n=v.useState(e),[r]=n,o=v.useRef(r),s=xr(t);return v.useEffect(()=>{o.current!==r&&(s(r),o.current=r)},[r,o,s]),n}var bn=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{};function SA(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function tp(...e){return t=>e.forEach(n=>SA(n,t))}function ut(...e){return v.useCallback(tp(...e),e)}var Do=v.forwardRef((e,t)=>{const{children:n,...r}=e,o=v.Children.toArray(n),s=o.find(jA);if(s){const a=s.props.children,l=o.map(c=>c===s?v.Children.count(a)>1?v.Children.only(null):v.isValidElement(a)?a.props.children:null:c);return i.jsx(cm,{...r,ref:t,children:v.isValidElement(a)?v.cloneElement(a,void 0,l):null})}return i.jsx(cm,{...r,ref:t,children:n})});Do.displayName="Slot";var cm=v.forwardRef((e,t)=>{const{children:n,...r}=e;if(v.isValidElement(n)){const o=EA(n);return v.cloneElement(n,{..._A(r,n.props),ref:t?tp(t,o):o})}return v.Children.count(n)>1?v.Children.only(null):null});cm.displayName="SlotClone";var CA=({children:e})=>i.jsx(i.Fragment,{children:e});function jA(e){return v.isValidElement(e)&&e.type===CA}function _A(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{s(...l),o(...l)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function EA(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var TA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ve=TA.reduce((e,t)=>{const n=v.forwardRef((r,o)=>{const{asChild:s,...a}=r,l=s?Do:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(l,{...a,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function T_(e,t){e&&Ls.flushSync(()=>e.dispatchEvent(t))}function kA(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var co=e=>{const{present:t,children:n}=e,r=NA(t),o=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=ut(r.ref,RA(o));return typeof n=="function"||r.isPresent?v.cloneElement(o,{ref:s}):null};co.displayName="Presence";function NA(e){const[t,n]=v.useState(),r=v.useRef({}),o=v.useRef(e),s=v.useRef("none"),a=e?"mounted":"unmounted",[l,c]=kA(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=$u(r.current);s.current=l==="mounted"?u:"none"},[l]),bn(()=>{const u=r.current,d=o.current;if(d!==e){const f=s.current,h=$u(u);e?c("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),bn(()=>{if(t){const u=p=>{const h=$u(r.current).includes(p.animationName);p.target===t&&h&&Ls.flushSync(()=>c("ANIMATION_END"))},d=p=>{p.target===t&&(s.current=$u(r.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function $u(e){return(e==null?void 0:e.animationName)||"none"}function RA(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var PA=kf.useId||(()=>{}),IA=0;function Ir(e){const[t,n]=v.useState(PA());return bn(()=>{n(r=>r??String(IA++))},[e]),t?`radix-${t}`:""}var ry="Collapsible",[DA,VK]=lo(ry),[OA,oy]=DA(ry),k_=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:a,...l}=e,[c=!1,u]=js({prop:r,defaultProp:o,onChange:a});return i.jsx(OA,{scope:n,disabled:s,contentId:Ir(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:i.jsx(Ve.div,{"data-state":ay(c),"data-disabled":s?"":void 0,...l,ref:t})})});k_.displayName=ry;var N_="CollapsibleTrigger",R_=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=oy(N_,n);return i.jsx(Ve.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ay(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:Ce(e.onClick,o.onOpenToggle)})});R_.displayName=N_;var sy="CollapsibleContent",P_=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=oy(sy,e.__scopeCollapsible);return i.jsx(co,{present:n||o.open,children:({present:s})=>i.jsx(MA,{...r,ref:t,present:s})})});P_.displayName=sy;var MA=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,a=oy(sy,n),[l,c]=v.useState(r),u=v.useRef(null),d=ut(t,u),p=v.useRef(0),f=p.current,h=v.useRef(0),g=h.current,m=a.open||l,w=v.useRef(m),x=v.useRef();return v.useEffect(()=>{const y=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(y)},[]),bn(()=>{const y=u.current;if(y){x.current=x.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const b=y.getBoundingClientRect();p.current=b.height,h.current=b.width,w.current||(y.style.transitionDuration=x.current.transitionDuration,y.style.animationName=x.current.animationName),c(r)}},[a.open,r]),i.jsx(Ve.div,{"data-state":ay(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:m&&o})});function ay(e){return e?"open":"closed"}var AA=k_;const FA=AA,LA=R_,$A=P_;function zA(){const e=ir(),{instance:t}=Tt(),n=r=>{!r||!t||(r.path&&e(`/manager/instance/${t.id}/${r.path}`),r.link&&window.open(r.link,"_blank"))};return i.jsx("menu",{className:"sidebar",children:i.jsx("ul",{className:"sidebar-nav",children:uA.map(r=>{const o=window.location.pathname;let s=!1;return r.path&&o.includes(r.path)?s=!0:s=!1,i.jsx("li",{className:"nav-item",children:r.children?i.jsxs(FA,{children:[i.jsxs(LA,{children:[r.icon?i.jsxs(i.Fragment,{children:[i.jsx(r.icon,{className:"nav-icon",size:"15"}),i.jsx("span",{className:"nav-title",children:r.title})]}):i.jsx("span",{className:"nav-label",children:r.title}),r.children&&i.jsx("span",{className:"nav-arrow",children:i.jsx(Qf,{size:"15"})})]}),i.jsx($A,{children:i.jsx("ul",{className:"sidebar-nav",children:r.children.map(a=>{const l=window.location.pathname;let c=!1;return a.path&&l.includes(a.path)?c=!0:c=!1,i.jsx("li",{className:"nav-item",children:i.jsx("button",{onClick:()=>n(a),className:c?"active":"",children:a.icon?i.jsxs(i.Fragment,{children:[i.jsx(a.icon,{className:"nav-icon",size:"15"}),i.jsx("span",{className:"nav-title",children:a.title})]}):i.jsx("span",{className:"nav-label",children:a.title})})},a.id)})})})]}):i.jsx("button",{onClick:()=>n(r),className:s?"active":"",children:r.icon?i.jsxs(i.Fragment,{children:[i.jsx(r.icon,{className:"nav-icon",size:"15"}),i.jsx("span",{className:"nav-title",children:r.title})]}):i.jsx("span",{className:"nav-label",children:r.title})})},r.id)})})})}const{createElement:Ni,createContext:VA,createRef:UK,forwardRef:I_,useCallback:Gn,useContext:D_,useEffect:ia,useImperativeHandle:O_,useLayoutEffect:UA,useMemo:BA,useRef:Fn,useState:Kl}=kf,t0=kf.useId,HA=UA,np=VA(null);np.displayName="PanelGroupContext";const la=HA,GA=typeof t0=="function"?t0:()=>null;let WA=0;function iy(e=null){const t=GA(),n=Fn(e||t||null);return n.current===null&&(n.current=""+WA++),e??n.current}function M_({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:s,id:a,maxSize:l,minSize:c,onCollapse:u,onExpand:d,onResize:p,order:f,style:h,tagName:g="div",...m}){const w=D_(np);if(w===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:y,getPanelSize:b,getPanelStyle:C,groupId:j,isPanelCollapsed:S,reevaluatePanelConstraints:k,registerPanel:E,resizePanel:O,unregisterPanel:F}=w,Z=iy(a),I=Fn({callbacks:{onCollapse:u,onExpand:d,onResize:p},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:l,minSize:c},id:Z,idIsFromProps:a!==void 0,order:f});Fn({didLogMissingDefaultSizeWarning:!1}),la(()=>{const{callbacks:H,constraints:J}=I.current,ne={...J};I.current.id=Z,I.current.idIsFromProps=a!==void 0,I.current.order=f,H.onCollapse=u,H.onExpand=d,H.onResize=p,J.collapsedSize=n,J.collapsible=r,J.defaultSize=o,J.maxSize=l,J.minSize=c,(ne.collapsedSize!==J.collapsedSize||ne.collapsible!==J.collapsible||ne.maxSize!==J.maxSize||ne.minSize!==J.minSize)&&k(I.current,ne)}),la(()=>{const H=I.current;return E(H),()=>{F(H)}},[f,Z,E,F]),O_(s,()=>({collapse:()=>{x(I.current)},expand:H=>{y(I.current,H)},getId(){return Z},getSize(){return b(I.current)},isCollapsed(){return S(I.current)},isExpanded(){return!S(I.current)},resize:H=>{O(I.current,H)}}),[x,y,b,S,Z,O]);const q=C(I.current,o);return Ni(g,{...m,children:e,className:t,id:a,style:{...q,...h},"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-group-id":j,"data-panel-id":Z,"data-panel-size":parseFloat(""+q.flexGrow).toFixed(1)})}const A_=I_((e,t)=>Ni(M_,{...e,forwardedRef:t}));M_.displayName="Panel";A_.displayName="forwardRef(Panel)";let um=null,ta=null;function KA(e,t){if(t){const n=(t&V_)!==0,r=(t&U_)!==0,o=(t&B_)!==0,s=(t&H_)!==0;if(n)return o?"se-resize":s?"ne-resize":"e-resize";if(r)return o?"sw-resize":s?"nw-resize":"w-resize";if(o)return"s-resize";if(s)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function qA(){ta!==null&&(document.head.removeChild(ta),um=null,ta=null)}function jh(e,t){const n=KA(e,t);um!==n&&(um=n,ta===null&&(ta=document.createElement("style"),document.head.appendChild(ta)),ta.innerHTML=`*{cursor: ${n}!important;}`)}function F_(e){return e.type==="keydown"}function L_(e){return e.type.startsWith("pointer")}function $_(e){return e.type.startsWith("mouse")}function rp(e){if(L_(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if($_(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function ZA(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function JA(e,t,n){return e.xt.x&&e.yt.y}function YA(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:o0(e),b:o0(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Ye(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:r0(n0(n.a)),b:r0(n0(n.b))};if(o.a===o.b){const s=r.childNodes,a={a:n.a.at(-1),b:n.b.at(-1)};let l=s.length;for(;l--;){const c=s[l];if(c===a.a)return 1;if(c===a.b)return-1}}return Math.sign(o.a-o.b)}const XA=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function QA(e){var t;const n=getComputedStyle((t=z_(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function eF(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||QA(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||XA.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function n0(e){let t=e.length;for(;t--;){const n=e[t];if(Ye(n,"Missing node"),eF(n))return n}return null}function r0(e){return e&&Number(getComputedStyle(e).zIndex)||0}function o0(e){const t=[];for(;e;)t.push(e),e=z_(e);return t}function z_(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const V_=1,U_=2,B_=4,H_=8,tF=ZA()==="coarse";let Dr=[],Cc=!1,is=new Map,op=new Map;const jc=new Set;function nF(e,t,n,r,o){var s;const{ownerDocument:a}=t,l={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},c=(s=is.get(a))!==null&&s!==void 0?s:0;return is.set(a,c+1),jc.add(l),tf(),function(){var d;op.delete(e),jc.delete(l);const p=(d=is.get(a))!==null&&d!==void 0?d:1;if(is.set(a,p-1),tf(),p===1&&is.delete(a),Dr.includes(l)){const f=Dr.indexOf(l);f>=0&&Dr.splice(f,1),cy()}}}function s0(e){const{target:t}=e,{x:n,y:r}=rp(e);Cc=!0,ly({target:t,x:n,y:r}),tf(),Dr.length>0&&(nf("down",e),e.preventDefault(),e.stopPropagation())}function yl(e){const{x:t,y:n}=rp(e);if(e.buttons===0&&(Cc=!1,nf("up",e)),!Cc){const{target:r}=e;ly({target:r,x:t,y:n})}nf("move",e),cy(),Dr.length>0&&e.preventDefault()}function Aa(e){const{target:t}=e,{x:n,y:r}=rp(e);op.clear(),Cc=!1,Dr.length>0&&e.preventDefault(),nf("up",e),ly({target:t,x:n,y:r}),cy(),tf()}function ly({target:e,x:t,y:n}){Dr.splice(0);let r=null;e instanceof HTMLElement&&(r=e),jc.forEach(o=>{const{element:s,hitAreaMargins:a}=o,l=s.getBoundingClientRect(),{bottom:c,left:u,right:d,top:p}=l,f=tF?a.coarse:a.fine;if(t>=u-f&&t<=d+f&&n>=p-f&&n<=c+f){if(r!==null&&s!==r&&!s.contains(r)&&!r.contains(s)&&YA(r,s)>0){let g=r,m=!1;for(;g&&!g.contains(s);){if(JA(g.getBoundingClientRect(),l)){m=!0;break}g=g.parentElement}if(m)return}Dr.push(o)}})}function _h(e,t){op.set(e,t)}function cy(){let e=!1,t=!1;Dr.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;op.forEach(r=>{n|=r}),e&&t?jh("intersection",n):e?jh("horizontal",n):t?jh("vertical",n):qA()}function tf(){is.forEach((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",Aa),n.removeEventListener("pointerdown",s0),n.removeEventListener("pointerleave",yl),n.removeEventListener("pointermove",yl)}),window.removeEventListener("pointerup",Aa),window.removeEventListener("pointercancel",Aa),jc.size>0&&(Cc?(Dr.length>0&&is.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",Aa),n.addEventListener("pointerleave",yl),n.addEventListener("pointermove",yl))}),window.addEventListener("pointerup",Aa),window.addEventListener("pointercancel",Aa)):is.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",s0,{capture:!0}),n.addEventListener("pointermove",yl))}))}function nf(e,t){jc.forEach(n=>{const{setResizeHandlerState:r}=n,o=Dr.includes(n);r(e,o,t)})}function Ye(e,t){if(!e)throw console.error(t),Error(t)}const uy=10;function ya(e,t,n=uy){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function wo(e,t,n=uy){return ya(e,t,n)===0}function qn(e,t,n){return ya(e,t,n)===0}function rF(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r0&&(e=e<0?0-x:x)}}}{const p=e<0?l:c,f=n[p];Ye(f,`No panel constraints found for index ${p}`);const{collapsedSize:h=0,collapsible:g,minSize:m=0}=f;if(g){const w=t[p];if(Ye(w!=null,`Previous layout not found for panel index ${p}`),qn(w,m)){const x=w-h;ya(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}}{const p=e<0?1:-1;let f=e<0?c:l,h=0;for(;;){const m=t[f];Ye(m!=null,`Previous layout not found for panel index ${f}`);const x=ai({panelConstraints:n,panelIndex:f,size:100})-m;if(h+=x,f+=p,f<0||f>=n.length)break}const g=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-g:g}{let f=e<0?l:c;for(;f>=0&&f=0))break;e<0?f--:f++}}if(rF(o,a))return o;{const p=e<0?c:l,f=t[p];Ye(f!=null,`Previous layout not found for panel index ${p}`);const h=f+u,g=ai({panelConstraints:n,panelIndex:p,size:h});if(a[p]=g,!qn(g,h)){let m=h-g,x=e<0?c:l;for(;x>=0&&x0?x--:x++}}}const d=a.reduce((p,f)=>f+p,0);return qn(d,100)?a:o}function oF({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,s=0,a=0;const l=n[0];Ye(l!=null,"No pivot index found"),t.forEach((p,f)=>{const{constraints:h}=p,{maxSize:g=100,minSize:m=0}=h;f===l?(r=m,o=g):(s+=m,a+=g)});const c=Math.min(o,100-s),u=Math.max(r,100-a),d=e[l];return{valueMax:c,valueMin:u,valueNow:d}}function _c(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function G_(e,t,n=document){const o=_c(e,n).findIndex(s=>s.getAttribute("data-panel-resize-handle-id")===t);return o??null}function W_(e,t,n){const r=G_(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function K_(e,t=document){var n;if(t instanceof HTMLElement&&(t==null||(n=t.dataset)===null||n===void 0?void 0:n.panelGroupId)==e)return t;const r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function sp(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function sF(e,t,n,r=document){var o,s,a,l;const c=sp(t,r),u=_c(e,r),d=c?u.indexOf(c):-1,p=(o=(s=n[d])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null,f=(a=(l=n[d+1])===null||l===void 0?void 0:l.id)!==null&&a!==void 0?a:null;return[p,f]}function aF({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:s,setLayout:a}){Fn({didWarnAboutMissingResizeHandle:!1}),la(()=>{if(!s)return;const l=_c(n,s);for(let c=0;c{l.forEach((c,u)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[n,r,o,s]),ia(()=>{if(!s)return;const l=t.current;Ye(l,"Eager values not found");const{panelDataArray:c}=l,u=K_(n,s);Ye(u!=null,`No group found for id "${n}"`);const d=_c(n,s);Ye(d,`No resize handles found for group id "${n}"`);const p=d.map(f=>{const h=f.getAttribute("data-panel-resize-handle-id");Ye(h,"Resize handle element has no handle id attribute");const[g,m]=sF(n,h,c,s);if(g==null||m==null)return()=>{};const w=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const y=c.findIndex(b=>b.id===g);if(y>=0){const b=c[y];Ye(b,`No panel data found for index ${y}`);const C=r[y],{collapsedSize:j=0,collapsible:S,minSize:k=0}=b.constraints;if(C!=null&&S){const E=Il({delta:qn(C,j)?k-j:j-C,initialLayout:r,panelConstraints:c.map(O=>O.constraints),pivotIndices:W_(n,h,s),prevLayout:r,trigger:"keyboard"});r!==E&&a(E)}}break}}};return f.addEventListener("keydown",w),()=>{f.removeEventListener("keydown",w)}});return()=>{p.forEach(f=>f())}},[s,e,t,n,r,o,a])}function a0(e,t){if(e.length!==t.length)return!1;for(let n=0;ns.constraints);let r=0,o=100;for(let s=0;s{const s=e[o];Ye(s,`Panel data not found for index ${o}`);const{callbacks:a,constraints:l,id:c}=s,{collapsedSize:u=0,collapsible:d}=l,p=n[c];if(p==null||r!==p){n[c]=r;const{onCollapse:f,onExpand:h,onResize:g}=a;g&&g(r,p),d&&(f||h)&&(h&&(p==null||wo(p,u))&&!wo(r,u)&&h(),f&&(p==null||!wo(p,u))&&wo(r,u)&&f())}})}function zu(e,t){if(e.length!==t.length)return!1;for(let n=0;n{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function i0(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Z_(e){return`react-resizable-panels:${e}`}function J_(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:s}=t;return o?r:s?`${s}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function Y_(e,t){try{const n=Z_(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function fF(e,t,n){var r,o;const s=(r=Y_(e,n))!==null&&r!==void 0?r:{},a=J_(t);return(o=s[a])!==null&&o!==void 0?o:null}function pF(e,t,n,r,o){var s;const a=Z_(e),l=J_(t),c=(s=Y_(e,o))!==null&&s!==void 0?s:{};c[l]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(a,JSON.stringify(c))}catch(u){console.error(u)}}function l0({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((s,a)=>s+a,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!qn(r,100))for(let s=0;s(i0(Dl),Dl.getItem(e)),setItem:(e,t)=>{i0(Dl),Dl.setItem(e,t)}},c0={};function X_({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:s=null,onLayout:a=null,keyboardResizeBy:l=null,storage:c=Dl,style:u,tagName:d="div",...p}){const f=iy(s),h=Fn(null),[g,m]=Kl(null),[w,x]=Kl([]),y=Fn({}),b=Fn(new Map),C=Fn(0),j=Fn({autoSaveId:e,direction:r,dragState:g,id:f,keyboardResizeBy:l,onLayout:a,storage:c}),S=Fn({layout:w,panelDataArray:[],panelDataArrayChanged:!1});Fn({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),O_(o,()=>({getId:()=>j.current.id,getLayout:()=>{const{layout:B}=S.current;return B},setLayout:B=>{const{onLayout:te}=j.current,{layout:X,panelDataArray:ie}=S.current,re=l0({layout:B,panelConstraints:ie.map(W=>W.constraints)});a0(X,re)||(x(re),S.current.layout=re,te&&te(re),Fa(ie,re,y.current))}}),[]),la(()=>{j.current.autoSaveId=e,j.current.direction=r,j.current.dragState=g,j.current.id=f,j.current.onLayout=a,j.current.storage=c}),aF({committedValuesRef:j,eagerValuesRef:S,groupId:f,layout:w,panelDataArray:S.current.panelDataArray,setLayout:x,panelGroupElement:h.current}),ia(()=>{const{panelDataArray:B}=S.current;if(e){if(w.length===0||w.length!==B.length)return;let te=c0[e];te==null&&(te=dF(pF,hF),c0[e]=te);const X=[...B],ie=new Map(b.current);te(e,X,ie,w,c)}},[e,w,c]),ia(()=>{});const k=Gn(B=>{const{onLayout:te}=j.current,{layout:X,panelDataArray:ie}=S.current;if(B.constraints.collapsible){const re=ie.map(Fe=>Fe.constraints),{collapsedSize:W=0,panelSize:we,pivotIndices:Re}=Hs(ie,B,X);if(Ye(we!=null,`Panel size not found for panel "${B.id}"`),!wo(we,W)){b.current.set(B.id,we);const Pe=Ha(ie,B)===ie.length-1?we-W:W-we,ge=Il({delta:Pe,initialLayout:X,panelConstraints:re,pivotIndices:Re,prevLayout:X,trigger:"imperative-api"});zu(X,ge)||(x(ge),S.current.layout=ge,te&&te(ge),Fa(ie,ge,y.current))}}},[]),E=Gn((B,te)=>{const{onLayout:X}=j.current,{layout:ie,panelDataArray:re}=S.current;if(B.constraints.collapsible){const W=re.map(Xe=>Xe.constraints),{collapsedSize:we=0,panelSize:Re=0,minSize:Fe=0,pivotIndices:Pe}=Hs(re,B,ie),ge=te??Fe;if(wo(Re,we)){const Xe=b.current.get(B.id),kt=Xe!=null&&Xe>=ge?Xe:ge,Lt=Ha(re,B)===re.length-1?Re-kt:kt-Re,Wt=Il({delta:Lt,initialLayout:ie,panelConstraints:W,pivotIndices:Pe,prevLayout:ie,trigger:"imperative-api"});zu(ie,Wt)||(x(Wt),S.current.layout=Wt,X&&X(Wt),Fa(re,Wt,y.current))}}},[]),O=Gn(B=>{const{layout:te,panelDataArray:X}=S.current,{panelSize:ie}=Hs(X,B,te);return Ye(ie!=null,`Panel size not found for panel "${B.id}"`),ie},[]),F=Gn((B,te)=>{const{panelDataArray:X}=S.current,ie=Ha(X,B);return uF({defaultSize:te,dragState:g,layout:w,panelData:X,panelIndex:ie})},[g,w]),Z=Gn(B=>{const{layout:te,panelDataArray:X}=S.current,{collapsedSize:ie=0,collapsible:re,panelSize:W}=Hs(X,B,te);return Ye(W!=null,`Panel size not found for panel "${B.id}"`),re===!0&&wo(W,ie)},[]),I=Gn(B=>{const{layout:te,panelDataArray:X}=S.current,{collapsedSize:ie=0,collapsible:re,panelSize:W}=Hs(X,B,te);return Ye(W!=null,`Panel size not found for panel "${B.id}"`),!re||ya(W,ie)>0},[]),q=Gn(B=>{const{panelDataArray:te}=S.current;te.push(B),te.sort((X,ie)=>{const re=X.order,W=ie.order;return re==null&&W==null?0:re==null?-1:W==null?1:re-W}),S.current.panelDataArrayChanged=!0},[]);la(()=>{if(S.current.panelDataArrayChanged){S.current.panelDataArrayChanged=!1;const{autoSaveId:B,onLayout:te,storage:X}=j.current,{layout:ie,panelDataArray:re}=S.current;let W=null;if(B){const Re=fF(B,re,X);Re&&(b.current=new Map(Object.entries(Re.expandToSizes)),W=Re.layout)}W==null&&(W=cF({panelDataArray:re}));const we=l0({layout:W,panelConstraints:re.map(Re=>Re.constraints)});a0(ie,we)||(x(we),S.current.layout=we,te&&te(we),Fa(re,we,y.current))}}),la(()=>{const B=S.current;return()=>{B.layout=[]}},[]);const H=Gn(B=>function(X){X.preventDefault();const ie=h.current;if(!ie)return()=>null;const{direction:re,dragState:W,id:we,keyboardResizeBy:Re,onLayout:Fe}=j.current,{layout:Pe,panelDataArray:ge}=S.current,{initialLayout:Xe}=W??{},kt=W_(we,B,ie);let Ut=lF(X,B,re,W,Re,ie);const Lt=re==="horizontal";document.dir==="rtl"&&Lt&&(Ut=-Ut);const Wt=ge.map(U=>U.constraints),_=Il({delta:Ut,initialLayout:Xe??Pe,panelConstraints:Wt,pivotIndices:kt,prevLayout:Pe,trigger:F_(X)?"keyboard":"mouse-or-touch"}),D=!zu(Pe,_);(L_(X)||$_(X))&&C.current!=Ut&&(C.current=Ut,D?_h(B,0):Lt?_h(B,Ut<0?V_:U_):_h(B,Ut<0?B_:H_)),D&&(x(_),S.current.layout=_,Fe&&Fe(_),Fa(ge,_,y.current))},[]),J=Gn((B,te)=>{const{onLayout:X}=j.current,{layout:ie,panelDataArray:re}=S.current,W=re.map(Xe=>Xe.constraints),{panelSize:we,pivotIndices:Re}=Hs(re,B,ie);Ye(we!=null,`Panel size not found for panel "${B.id}"`);const Pe=Ha(re,B)===re.length-1?we-te:te-we,ge=Il({delta:Pe,initialLayout:ie,panelConstraints:W,pivotIndices:Re,prevLayout:ie,trigger:"imperative-api"});zu(ie,ge)||(x(ge),S.current.layout=ge,X&&X(ge),Fa(re,ge,y.current))},[]),ne=Gn((B,te)=>{const{layout:X,panelDataArray:ie}=S.current,{collapsedSize:re=0,collapsible:W}=te,{collapsedSize:we=0,collapsible:Re,maxSize:Fe=100,minSize:Pe=0}=B.constraints,{panelSize:ge}=Hs(ie,B,X);ge!=null&&(W&&Re&&wo(ge,re)?wo(re,we)||J(B,we):geFe&&J(B,Fe))},[J]),K=Gn((B,te)=>{const{direction:X}=j.current,{layout:ie}=S.current;if(!h.current)return;const re=sp(B,h.current);Ye(re,`Drag handle element not found for id "${B}"`);const W=q_(X,te);m({dragHandleId:B,dragHandleRect:re.getBoundingClientRect(),initialCursorPosition:W,initialLayout:ie})},[]),z=Gn(()=>{m(null)},[]),L=Gn(B=>{const{panelDataArray:te}=S.current,X=Ha(te,B);X>=0&&(te.splice(X,1),delete y.current[B.id],S.current.panelDataArrayChanged=!0)},[]),ee=BA(()=>({collapsePanel:k,direction:r,dragState:g,expandPanel:E,getPanelSize:O,getPanelStyle:F,groupId:f,isPanelCollapsed:Z,isPanelExpanded:I,reevaluatePanelConstraints:ne,registerPanel:q,registerResizeHandle:H,resizePanel:J,startDragging:K,stopDragging:z,unregisterPanel:L,panelGroupElement:h.current}),[k,g,r,E,O,F,f,Z,I,ne,q,H,J,K,z,L]),fe={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Ni(np.Provider,{value:ee},Ni(d,{...p,children:t,className:n,id:s,ref:h,style:{...fe,...u},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":f}))}const Q_=I_((e,t)=>Ni(X_,{...e,forwardedRef:t}));X_.displayName="PanelGroup";Q_.displayName="forwardRef(PanelGroup)";function Ha(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Hs(e,t,n){const r=Ha(e,t),s=r===e.length-1?[r-1,r]:[r,r+1],a=n[r];return{...t.constraints,panelSize:a,pivotIndices:s}}function gF({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){ia(()=>{if(e||n==null||r==null)return;const o=sp(t,r);if(o==null)return;const s=a=>{if(!a.defaultPrevented)switch(a.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{a.preventDefault(),n(a);break}case"F6":{a.preventDefault();const l=o.getAttribute("data-panel-group-id");Ye(l,`No group element found for id "${l}"`);const c=_c(l,r),u=G_(l,t,r);Ye(u!==null,`No resize element found for id "${t}"`);const d=a.shiftKey?u>0?u-1:c.length-1:u+1{o.removeEventListener("keydown",s)}},[r,e,t,n])}function e1({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:s,onDragging:a,onFocus:l,style:c={},tabIndex:u=0,tagName:d="div",...p}){var f,h;const g=Fn(null),m=Fn({onDragging:a});ia(()=>{m.current.onDragging=a});const w=D_(np);if(w===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:x,groupId:y,registerResizeHandle:b,startDragging:C,stopDragging:j,panelGroupElement:S}=w,k=iy(o),[E,O]=Kl("inactive"),[F,Z]=Kl(!1),[I,q]=Kl(null),H=Fn({state:E});la(()=>{H.current.state=E}),ia(()=>{if(n)q(null);else{const z=b(k);q(()=>z)}},[n,k,b]);const J=(f=r==null?void 0:r.coarse)!==null&&f!==void 0?f:15,ne=(h=r==null?void 0:r.fine)!==null&&h!==void 0?h:5;return ia(()=>{if(n||I==null)return;const z=g.current;return Ye(z,"Element ref not attached"),nF(k,z,x,{coarse:J,fine:ne},(ee,fe,B)=>{if(fe)switch(ee){case"down":{O("drag"),C(k,B);const{onDragging:te}=m.current;te&&te(!0);break}case"move":{const{state:te}=H.current;te!=="drag"&&O("hover"),I(B);break}case"up":{O("hover"),j();const{onDragging:te}=m.current;te&&te(!1);break}}else O("inactive")})},[J,x,n,ne,b,k,I,C,j]),gF({disabled:n,handleId:k,resizeHandler:I,panelGroupElement:S}),Ni(d,{...p,children:e,className:t,id:o,onBlur:()=>{Z(!1),s==null||s()},onFocus:()=>{Z(!0),l==null||l()},ref:g,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...c},tabIndex:u,"data-panel-group-direction":x,"data-panel-group-id":y,"data-resize-handle":"","data-resize-handle-active":E==="drag"?"pointer":F?"keyboard":void 0,"data-resize-handle-state":E,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":k})}e1.displayName="PanelResizeHandle";function t1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;tl(s)))==null?void 0:a.classGroupId}const u0=/^\[(.+)\]$/;function vF(e){if(u0.test(e)){const t=u0.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function yF(e){const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return wF(Object.entries(e.classGroups),n).forEach(([s,a])=>{dm(a,r,s,t)}),r}function dm(e,t,n,r){e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:d0(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(xF(o)){dm(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,a])=>{dm(a,d0(t,s),n,r)})})}function d0(e,t){let n=e;return t.split(dy).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function xF(e){return e.isThemeGetter}function wF(e,t){return t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,l])=>[t+a,l])):s);return[n,o]}):e}function bF(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;function o(s,a){n.set(s,a),t++,t>e&&(t=0,r=n,n=new Map)}return{get(s){let a=n.get(s);if(a!==void 0)return a;if((a=r.get(s))!==void 0)return o(s,a),a},set(s,a){n.has(s)?n.set(s,a):o(s,a)}}}const r1="!";function SF(e){const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length;function a(l){const c=[];let u=0,d=0,p;for(let w=0;wd?p-d:void 0;return{modifiers:c,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:m}}return n?function(c){return n({className:c,parseClassName:a})}:a}function CF(e){if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t}function jF(e){return{cache:bF(e.cacheSize),parseClassName:SF(e),...mF(e)}}const _F=/\s+/;function EF(e,t){const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=new Set;return e.trim().split(_F).map(a=>{const{modifiers:l,hasImportantModifier:c,baseClassName:u,maybePostfixModifierPosition:d}=n(a);let p=!!d,f=r(p?u.substring(0,d):u);if(!f){if(!p)return{isTailwindClass:!1,originalClassName:a};if(f=r(u),!f)return{isTailwindClass:!1,originalClassName:a};p=!1}const h=CF(l).join(":");return{isTailwindClass:!0,modifierId:c?h+r1:h,classGroupId:f,originalClassName:a,hasPostfixModifier:p}}).reverse().filter(a=>{if(!a.isTailwindClass)return!0;const{modifierId:l,classGroupId:c,hasPostfixModifier:u}=a,d=l+c;return s.has(d)?!1:(s.add(d),o(c,u).forEach(p=>s.add(l+p)),!0)}).reverse().map(a=>a.originalClassName).join(" ")}function TF(){let e=0,t,n,r="";for(;ep(d),e());return n=jF(u),r=n.cache.get,o=n.cache.set,s=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=EF(c,n);return o(c,d),d}return function(){return s(TF.apply(null,arguments))}}function xt(e){const t=n=>n[e]||[];return t.isThemeGetter=!0,t}const s1=/^\[(?:([a-z-]+):)?(.+)\]$/i,NF=/^\d+\/\d+$/,RF=new Set(["px","full","screen"]),PF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,IF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,MF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function po(e){return na(e)||RF.has(e)||NF.test(e)}function Qo(e){return Hi(e,"length",BF)}function na(e){return!!e&&!Number.isNaN(Number(e))}function Vu(e){return Hi(e,"number",na)}function xl(e){return!!e&&Number.isInteger(Number(e))}function AF(e){return e.endsWith("%")&&na(e.slice(0,-1))}function We(e){return s1.test(e)}function es(e){return PF.test(e)}const FF=new Set(["length","size","percentage"]);function LF(e){return Hi(e,FF,a1)}function $F(e){return Hi(e,"position",a1)}const zF=new Set(["image","url"]);function VF(e){return Hi(e,zF,GF)}function UF(e){return Hi(e,"",HF)}function wl(){return!0}function Hi(e,t,n){const r=s1.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1}function BF(e){return IF.test(e)&&!DF.test(e)}function a1(){return!1}function HF(e){return OF.test(e)}function GF(e){return MF.test(e)}function WF(){const e=xt("colors"),t=xt("spacing"),n=xt("blur"),r=xt("brightness"),o=xt("borderColor"),s=xt("borderRadius"),a=xt("borderSpacing"),l=xt("borderWidth"),c=xt("contrast"),u=xt("grayscale"),d=xt("hueRotate"),p=xt("invert"),f=xt("gap"),h=xt("gradientColorStops"),g=xt("gradientColorStopPositions"),m=xt("inset"),w=xt("margin"),x=xt("opacity"),y=xt("padding"),b=xt("saturate"),C=xt("scale"),j=xt("sepia"),S=xt("skew"),k=xt("space"),E=xt("translate"),O=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],Z=()=>["auto",We,t],I=()=>[We,t],q=()=>["",po,Qo],H=()=>["auto",na,We],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ne=()=>["solid","dashed","dotted","double","none"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",We],ee=()=>["auto","avoid","all","avoid-page","page","left","right","column"],fe=()=>[na,Vu],B=()=>[na,We];return{cacheSize:500,separator:":",theme:{colors:[wl],spacing:[po,Qo],blur:["none","",es,We],brightness:fe(),borderColor:[e],borderRadius:["none","","full",es,We],borderSpacing:I(),borderWidth:q(),contrast:fe(),grayscale:L(),hueRotate:B(),invert:L(),gap:I(),gradientColorStops:[e],gradientColorStopPositions:[AF,Qo],inset:Z(),margin:Z(),opacity:fe(),padding:I(),saturate:fe(),scale:fe(),sepia:L(),skew:B(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",We]}],container:["container"],columns:[{columns:[es]}],"break-after":[{"break-after":ee()}],"break-before":[{"break-before":ee()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...J(),We]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",xl,We]}],basis:[{basis:Z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",We]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",xl,We]}],"grid-cols":[{"grid-cols":[wl]}],"col-start-end":[{col:["auto",{span:["full",xl,We]},We]}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":[wl]}],"row-start-end":[{row:["auto",{span:[xl,We]},We]}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",We]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",We]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",We,t]}],"min-w":[{"min-w":[We,t,"min","max","fit"]}],"max-w":[{"max-w":[We,t,"none","full","min","max","fit","prose",{screen:[es]},es]}],h:[{h:[We,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[We,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[We,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[We,t,"auto","min","max","fit"]}],"font-size":[{text:["base",es,Qo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Vu]}],"font-family":[{font:[wl]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",We]}],"line-clamp":[{"line-clamp":["none",na,Vu]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",po,We]}],"list-image":[{"list-image":["none",We]}],"list-style-type":[{list:["none","disc","decimal",We]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ne(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",po,Qo]}],"underline-offset":[{"underline-offset":["auto",po,We]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",We]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",We]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...J(),$F]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",LF]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VF]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...ne(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:ne()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...ne()]}],"outline-offset":[{"outline-offset":[po,We]}],"outline-w":[{outline:[po,Qo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[po,Qo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",es,UF]}],"shadow-color":[{shadow:[wl]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...K(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":K()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",es,We]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[b]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",We]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",We]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",We]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[xl,We]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",We]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",We]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",We]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[po,Qo,Vu]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const KF=kF(WF);function Ne(...e){return KF(Co(e))}const su=({className:e,...t})=>i.jsx(Q_,{className:Ne("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),ro=A_,au=({withHandle:e,className:t,...n})=>i.jsx(e1,{className:Ne("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&i.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:i.jsx(nA,{className:"h-2.5 w-2.5"})})});function gn({children:e}){return i.jsxs(yA,{children:[i.jsx(j_,{perfil:!0}),i.jsx("div",{className:"layout-general",children:i.jsx("div",{className:"instance-layout",children:i.jsxs(su,{direction:"horizontal",children:[i.jsx(ro,{defaultSize:15,children:i.jsx(zA,{})}),i.jsx(au,{withHandle:!0,className:"border border-black"}),i.jsx(ro,{children:e})]})})})]})}function i1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;ttypeof e=="boolean"?"".concat(e):e===0?"0":e,p0=qF,l1=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return p0(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,a=Object.keys(o).map(u=>{const d=n==null?void 0:n[u],p=s==null?void 0:s[u];if(d===null)return null;const f=f0(d)||f0(p);return o[u][f]}),l=n&&Object.entries(n).reduce((u,d)=>{let[p,f]=d;return f===void 0||(u[p]=f),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:p,className:f,...h}=d;return Object.entries(h).every(g=>{let[m,w]=g;return Array.isArray(w)?w.includes({...s,...l}[m]):{...s,...l}[m]===w})?[...u,p,f]:u},[]);return p0(e,a,c,n==null?void 0:n.class,n==null?void 0:n.className)},ZF=l1("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Te=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>{const a=r?Do:"button";return i.jsx(a,{className:Ne(ZF({variant:t,size:n,className:e})),ref:s,...o})});Te.displayName="Button";function c1(){return i.jsxs("footer",{className:"footer",children:[i.jsxs("div",{className:"footer-info",children:["Client Name: ",i.jsx("strong",{children:"Evolution Manager"})," Version:"," ",i.jsx("strong",{children:localStorage.getItem("version")})]}),i.jsxs("div",{className:"footer-buttons",children:[i.jsx(Te,{variant:"link",children:i.jsx("a",{href:"https://evolution-api.com/discord",target:"_blank",rel:"noopener noreferrer",children:"Discord"})}),i.jsx(Te,{variant:"link",children:i.jsx("a",{href:"https://evolution-api.com/postman",target:"_blank",rel:"noopener noreferrer",children:"Postman"})}),i.jsx(Te,{variant:"link",children:i.jsx("a",{href:"https://github.com/EvolutionAPI/evolution-api",target:"_blank",rel:"noopener noreferrer",children:"GitHub"})}),i.jsx(Te,{variant:"link",children:i.jsx("a",{href:"https://doc.evolution-api.com",target:"_blank",rel:"noopener noreferrer",children:"Docs"})})]})]})}function JF({children:e}){return i.jsxs("div",{className:"layout",children:[i.jsx(j_,{}),i.jsxs("div",{className:"layout-general",children:[i.jsx("main",{className:"content",children:e}),i.jsx(c1,{})]})]})}const gi=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Ne("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));gi.displayName="Card";const ql=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Ne("flex flex-col space-y-1.5 p-6",e),...t}));ql.displayName="CardHeader";const Zl=v.forwardRef(({className:e,...t},n)=>i.jsx("h3",{ref:n,className:Ne("text-2xl font-semibold leading-none tracking-tight",e),...t}));Zl.displayName="CardTitle";const u1=v.forwardRef(({className:e,...t},n)=>i.jsx("p",{ref:n,className:Ne("text-sm text-muted-foreground",e),...t}));u1.displayName="CardDescription";const Jl=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Ne("p-6 pt-0",e),...t}));Jl.displayName="CardContent";const d1=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Ne("flex items-center p-6 pt-0",e),...t}));d1.displayName="CardFooter";function YF(e,t=globalThis==null?void 0:globalThis.document){const n=xr(e);v.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var XF="DismissableLayer",fm="dismissableLayer.update",QF="dismissableLayer.pointerDownOutside",e2="dismissableLayer.focusOutside",h0,f1=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ap=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=v.useContext(f1),[d,p]=v.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=v.useState({}),g=ut(t,k=>p(k)),m=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=m.indexOf(w),y=d?m.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,C=y>=x,j=r2(k=>{const E=k.target,O=[...u.branches].some(F=>F.contains(E));!C||O||(o==null||o(k),a==null||a(k),k.defaultPrevented||l==null||l())},f),S=o2(k=>{const E=k.target;[...u.branches].some(F=>F.contains(E))||(s==null||s(k),a==null||a(k),k.defaultPrevented||l==null||l())},f);return YF(k=>{y===u.layers.size-1&&(r==null||r(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},f),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(h0=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),g0(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=h0)}},[d,f,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),g0())},[d,u]),v.useEffect(()=>{const k=()=>h({});return document.addEventListener(fm,k),()=>document.removeEventListener(fm,k)},[]),i.jsx(Ve.div,{...c,ref:g,style:{pointerEvents:b?C?"auto":"none":void 0,...e.style},onFocusCapture:Ce(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Ce(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Ce(e.onPointerDownCapture,j.onPointerDownCapture)})});ap.displayName=XF;var t2="DismissableLayerBranch",n2=v.forwardRef((e,t)=>{const n=v.useContext(f1),r=v.useRef(null),o=ut(t,r);return v.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),i.jsx(Ve.div,{...e,ref:o})});n2.displayName=t2;function r2(e,t=globalThis==null?void 0:globalThis.document){const n=xr(e),r=v.useRef(!1),o=v.useRef(()=>{});return v.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){p1(QF,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function o2(e,t=globalThis==null?void 0:globalThis.document){const n=xr(e),r=v.useRef(!1);return v.useEffect(()=>{const o=s=>{s.target&&!r.current&&p1(e2,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function g0(){const e=new CustomEvent(fm);document.dispatchEvent(e)}function p1(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?T_(o,s):o.dispatchEvent(s)}var Eh="focusScope.autoFocusOnMount",Th="focusScope.autoFocusOnUnmount",m0={bubbles:!1,cancelable:!0},s2="FocusScope",ip=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=e,[l,c]=v.useState(null),u=xr(o),d=xr(s),p=v.useRef(null),f=ut(t,m=>c(m)),h=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(b){if(h.paused||!l)return;const C=b.target;l.contains(C)?p.current=C:ns(p.current,{select:!0})},w=function(b){if(h.paused||!l)return;const C=b.relatedTarget;C!==null&&(l.contains(C)||ns(p.current,{select:!0}))},x=function(b){if(document.activeElement===document.body)for(const j of b)j.removedNodes.length>0&&ns(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",w);const y=new MutationObserver(x);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",w),y.disconnect()}}},[r,l,h.paused]),v.useEffect(()=>{if(l){y0.add(h);const m=document.activeElement;if(!l.contains(m)){const x=new CustomEvent(Eh,m0);l.addEventListener(Eh,u),l.dispatchEvent(x),x.defaultPrevented||(a2(d2(h1(l)),{select:!0}),document.activeElement===m&&ns(l))}return()=>{l.removeEventListener(Eh,u),setTimeout(()=>{const x=new CustomEvent(Th,m0);l.addEventListener(Th,d),l.dispatchEvent(x),x.defaultPrevented||ns(m??document.body,{select:!0}),l.removeEventListener(Th,d),y0.remove(h)},0)}}},[l,u,d,h]);const g=v.useCallback(m=>{if(!n&&!r||h.paused)return;const w=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,x=document.activeElement;if(w&&x){const y=m.currentTarget,[b,C]=i2(y);b&&C?!m.shiftKey&&x===C?(m.preventDefault(),n&&ns(b,{select:!0})):m.shiftKey&&x===b&&(m.preventDefault(),n&&ns(C,{select:!0})):x===y&&m.preventDefault()}},[n,r,h.paused]);return i.jsx(Ve.div,{tabIndex:-1,...a,ref:f,onKeyDown:g})});ip.displayName=s2;function a2(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ns(r,{select:t}),document.activeElement!==n)return}function i2(e){const t=h1(e),n=v0(t,e),r=v0(t.reverse(),e);return[n,r]}function h1(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function v0(e,t){for(const n of e)if(!l2(n,{upTo:t}))return n}function l2(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function c2(e){return e instanceof HTMLInputElement&&"select"in e}function ns(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&c2(e)&&t&&e.select()}}var y0=u2();function u2(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=x0(e,t),e.unshift(t)},remove(t){var n;e=x0(e,t),(n=e[0])==null||n.resume()}}}function x0(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function d2(e){return e.filter(t=>t.tagName!=="A")}var f2="Portal",lp=v.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,s]=v.useState(!1);bn(()=>s(!0),[]);const a=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?Pj.createPortal(i.jsx(Ve.div,{...r,ref:t}),a):null});lp.displayName=f2;var kh=0;function fy(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??w0()),document.body.insertAdjacentElement("beforeend",e[1]??w0()),kh++,()=>{kh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),kh--}},[])}function w0(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var Jr=function(){return Jr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r"u")return N2;var t=R2(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},I2=y1(),mi="data-scroll-locked",D2=function(e,t,n,r){var o=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),` + */const mA=rt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function E_({instanceId:e}){const t=ir(),n=()=>{y_(),t("/manager/login")},r=()=>{t("/manager/")},[o,s]=v.useState(null);return v.useEffect(()=>{e&&(async l=>{try{const c=await x_(l);s(c[0]||null)}catch(c){console.error("Erro ao buscar dados:",c)}})(e)},[e]),i.jsxs("header",{children:[i.jsxs("a",{href:"#",onClick:r,className:"header-logo",children:[i.jsx("img",{src:"/assets/images/evolution-logo.png",alt:"Logo"}),i.jsx("span",{className:"header-title",children:"Evolution Manager"})]}),i.jsxs("div",{className:"header-buttons",children:[e&&i.jsx("button",{className:"profile-button",children:i.jsx("img",{src:(o==null?void 0:o.profilePicUrl)||"/assets/images/evolution-logo.png",alt:"Perfil",className:"profile-picture"})}),i.jsx("button",{onClick:n,className:"exit-button",children:i.jsx(iA,{size:"18"})})]})]})}const vA=[{id:"dashboard",title:"Visão Geral",icon:uA,path:"dashboard"},{navLabel:!0,title:"Configurações",icon:ru,children:[{id:"settings",title:"Comportamento",path:"settings"},{id:"openai",title:"OpenAI",path:"openai"},{id:"dify",title:"Dify",path:"dify"},{id:"webhook",title:"Webhook",path:"webhook"},{id:"websocket",title:"Websocket",path:"websocket"},{id:"rabbitmq",title:"RabbitMQ",path:"rabbitmq"},{id:"sqs",title:"Amazon SQS",path:"sqs"},{id:"chatwoot",title:"Chatwoot",path:"chatwoot"},{id:"typebot",title:"Typebot",path:"typebot"},{id:"proxy",title:"Proxy",path:"proxy"}]},{id:"documentation",title:"Documentação",icon:lA,link:"https://doc.evolution-api.com"},{id:"postman",title:"Postman",icon:oA,link:"https://evolution-api.com/postman"},{id:"discord",title:"Discord",icon:ey,link:"https://evolution-api.com/discord"},{id:"support-premium",title:"Support Premium",icon:dA,link:"https://evolution-api.com/suporte-pro"}],T_=v.createContext(null),Tt=()=>{const e=v.useContext(T_);if(!e)throw new Error("useInstance must be used within an InstanceProvider");return e},yA=({children:e})=>{const{instanceId:t}=Ta(),[n,r]=v.useState(null);return v.useEffect(()=>{t&&(async s=>{try{const a=await x_(s);r(a[0]||null)}catch(a){console.error("Erro ao buscar dados:",a)}})(t)},[t]),i.jsx(T_.Provider,{value:{instance:n},children:e})};function Ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function xA(e,t){const n=v.createContext(t);function r(s){const{children:a,...l}=s,c=v.useMemo(()=>l,Object.values(l));return i.jsx(n.Provider,{value:c,children:a})}function o(s){const a=v.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return r.displayName=e+"Provider",[r,o]}function lo(e,t=[]){let n=[];function r(s,a){const l=v.createContext(a),c=n.length;n=[...n,a];function u(p){const{scope:f,children:h,...g}=p,m=(f==null?void 0:f[e][c])||l,w=v.useMemo(()=>g,Object.values(g));return i.jsx(m.Provider,{value:w,children:h})}function d(p,f){const h=(f==null?void 0:f[e][c])||l,g=v.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,d]}const o=()=>{const s=n.map(a=>v.createContext(a));return function(l){const c=(l==null?void 0:l[e])||s;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,wA(o,...t)]}function wA(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const p=c(s)[`__scope${u}`];return{...l,...p}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function xr(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function js({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=bA({defaultProp:t,onChange:n}),s=e!==void 0,a=s?e:r,l=xr(n),c=v.useCallback(u=>{if(s){const p=typeof u=="function"?u(e):u;p!==e&&l(p)}else o(u)},[s,e,o,l]);return[a,c]}function bA({defaultProp:e,onChange:t}){const n=v.useState(e),[r]=n,o=v.useRef(r),s=xr(t);return v.useEffect(()=>{o.current!==r&&(s(r),o.current=r)},[r,o,s]),n}var bn=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{};function SA(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function tp(...e){return t=>e.forEach(n=>SA(n,t))}function ut(...e){return v.useCallback(tp(...e),e)}var Do=v.forwardRef((e,t)=>{const{children:n,...r}=e,o=v.Children.toArray(n),s=o.find(jA);if(s){const a=s.props.children,l=o.map(c=>c===s?v.Children.count(a)>1?v.Children.only(null):v.isValidElement(a)?a.props.children:null:c);return i.jsx(cm,{...r,ref:t,children:v.isValidElement(a)?v.cloneElement(a,void 0,l):null})}return i.jsx(cm,{...r,ref:t,children:n})});Do.displayName="Slot";var cm=v.forwardRef((e,t)=>{const{children:n,...r}=e;if(v.isValidElement(n)){const o=EA(n);return v.cloneElement(n,{..._A(r,n.props),ref:t?tp(t,o):o})}return v.Children.count(n)>1?v.Children.only(null):null});cm.displayName="SlotClone";var CA=({children:e})=>i.jsx(i.Fragment,{children:e});function jA(e){return v.isValidElement(e)&&e.type===CA}function _A(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{s(...l),o(...l)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function EA(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var TA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ve=TA.reduce((e,t)=>{const n=v.forwardRef((r,o)=>{const{asChild:s,...a}=r,l=s?Do:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(l,{...a,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function k_(e,t){e&&Ls.flushSync(()=>e.dispatchEvent(t))}function kA(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var co=e=>{const{present:t,children:n}=e,r=NA(t),o=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=ut(r.ref,RA(o));return typeof n=="function"||r.isPresent?v.cloneElement(o,{ref:s}):null};co.displayName="Presence";function NA(e){const[t,n]=v.useState(),r=v.useRef({}),o=v.useRef(e),s=v.useRef("none"),a=e?"mounted":"unmounted",[l,c]=kA(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=$u(r.current);s.current=l==="mounted"?u:"none"},[l]),bn(()=>{const u=r.current,d=o.current;if(d!==e){const f=s.current,h=$u(u);e?c("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),bn(()=>{if(t){const u=p=>{const h=$u(r.current).includes(p.animationName);p.target===t&&h&&Ls.flushSync(()=>c("ANIMATION_END"))},d=p=>{p.target===t&&(s.current=$u(r.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function $u(e){return(e==null?void 0:e.animationName)||"none"}function RA(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var PA=kf.useId||(()=>{}),IA=0;function Ir(e){const[t,n]=v.useState(PA());return bn(()=>{n(r=>r??String(IA++))},[e]),t?`radix-${t}`:""}var ry="Collapsible",[DA,VK]=lo(ry),[OA,oy]=DA(ry),N_=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:a,...l}=e,[c=!1,u]=js({prop:r,defaultProp:o,onChange:a});return i.jsx(OA,{scope:n,disabled:s,contentId:Ir(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:i.jsx(Ve.div,{"data-state":ay(c),"data-disabled":s?"":void 0,...l,ref:t})})});N_.displayName=ry;var R_="CollapsibleTrigger",P_=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=oy(R_,n);return i.jsx(Ve.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ay(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:Ce(e.onClick,o.onOpenToggle)})});P_.displayName=R_;var sy="CollapsibleContent",I_=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=oy(sy,e.__scopeCollapsible);return i.jsx(co,{present:n||o.open,children:({present:s})=>i.jsx(MA,{...r,ref:t,present:s})})});I_.displayName=sy;var MA=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,a=oy(sy,n),[l,c]=v.useState(r),u=v.useRef(null),d=ut(t,u),p=v.useRef(0),f=p.current,h=v.useRef(0),g=h.current,m=a.open||l,w=v.useRef(m),x=v.useRef();return v.useEffect(()=>{const y=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(y)},[]),bn(()=>{const y=u.current;if(y){x.current=x.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const b=y.getBoundingClientRect();p.current=b.height,h.current=b.width,w.current||(y.style.transitionDuration=x.current.transitionDuration,y.style.animationName=x.current.animationName),c(r)}},[a.open,r]),i.jsx(Ve.div,{"data-state":ay(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:m&&o})});function ay(e){return e?"open":"closed"}var AA=N_;const FA=AA,LA=P_,$A=I_;function zA(){const e=ir(),{instance:t}=Tt(),n=r=>{!r||!t||(r.path&&e(`/manager/instance/${t.id}/${r.path}`),r.link&&window.open(r.link,"_blank"))};return i.jsx("menu",{className:"sidebar",children:i.jsx("ul",{className:"sidebar-nav",children:vA.map(r=>{const o=window.location.pathname;let s=!1;return r.path&&o.includes(r.path)?s=!0:s=!1,i.jsx("li",{className:"nav-item",children:r.children?i.jsxs(FA,{children:[i.jsxs(LA,{children:[r.icon?i.jsxs(i.Fragment,{children:[i.jsx(r.icon,{className:"nav-icon",size:"15"}),i.jsx("span",{className:"nav-title",children:r.title})]}):i.jsx("span",{className:"nav-label",children:r.title}),r.children&&i.jsx("span",{className:"nav-arrow",children:i.jsx(Qf,{size:"15"})})]}),i.jsx($A,{children:i.jsx("ul",{className:"sidebar-nav",children:r.children.map(a=>{const l=window.location.pathname;let c=!1;return a.path&&l.includes(a.path)?c=!0:c=!1,i.jsx("li",{className:"nav-item",children:i.jsx("button",{onClick:()=>n(a),className:c?"active":"",children:a.icon?i.jsxs(i.Fragment,{children:[i.jsx(a.icon,{className:"nav-icon",size:"15"}),i.jsx("span",{className:"nav-title",children:a.title})]}):i.jsx("span",{className:"nav-label",children:a.title})})},a.id)})})})]}):i.jsx("button",{onClick:()=>n(r),className:s?"active":"",children:r.icon?i.jsxs(i.Fragment,{children:[i.jsx(r.icon,{className:"nav-icon",size:"15"}),i.jsx("span",{className:"nav-title",children:r.title})]}):i.jsx("span",{className:"nav-label",children:r.title})})},r.id)})})})}const{createElement:Ri,createContext:VA,createRef:UK,forwardRef:D_,useCallback:Gn,useContext:O_,useEffect:ia,useImperativeHandle:M_,useLayoutEffect:UA,useMemo:BA,useRef:Fn,useState:Kl}=kf,t0=kf.useId,HA=UA,np=VA(null);np.displayName="PanelGroupContext";const la=HA,GA=typeof t0=="function"?t0:()=>null;let WA=0;function iy(e=null){const t=GA(),n=Fn(e||t||null);return n.current===null&&(n.current=""+WA++),e??n.current}function A_({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:s,id:a,maxSize:l,minSize:c,onCollapse:u,onExpand:d,onResize:p,order:f,style:h,tagName:g="div",...m}){const w=O_(np);if(w===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:y,getPanelSize:b,getPanelStyle:C,groupId:j,isPanelCollapsed:S,reevaluatePanelConstraints:k,registerPanel:E,resizePanel:O,unregisterPanel:F}=w,Z=iy(a),I=Fn({callbacks:{onCollapse:u,onExpand:d,onResize:p},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:l,minSize:c},id:Z,idIsFromProps:a!==void 0,order:f});Fn({didLogMissingDefaultSizeWarning:!1}),la(()=>{const{callbacks:H,constraints:J}=I.current,ne={...J};I.current.id=Z,I.current.idIsFromProps=a!==void 0,I.current.order=f,H.onCollapse=u,H.onExpand=d,H.onResize=p,J.collapsedSize=n,J.collapsible=r,J.defaultSize=o,J.maxSize=l,J.minSize=c,(ne.collapsedSize!==J.collapsedSize||ne.collapsible!==J.collapsible||ne.maxSize!==J.maxSize||ne.minSize!==J.minSize)&&k(I.current,ne)}),la(()=>{const H=I.current;return E(H),()=>{F(H)}},[f,Z,E,F]),M_(s,()=>({collapse:()=>{x(I.current)},expand:H=>{y(I.current,H)},getId(){return Z},getSize(){return b(I.current)},isCollapsed(){return S(I.current)},isExpanded(){return!S(I.current)},resize:H=>{O(I.current,H)}}),[x,y,b,S,Z,O]);const q=C(I.current,o);return Ri(g,{...m,children:e,className:t,id:a,style:{...q,...h},"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-group-id":j,"data-panel-id":Z,"data-panel-size":parseFloat(""+q.flexGrow).toFixed(1)})}const F_=D_((e,t)=>Ri(A_,{...e,forwardedRef:t}));A_.displayName="Panel";F_.displayName="forwardRef(Panel)";let um=null,ta=null;function KA(e,t){if(t){const n=(t&U_)!==0,r=(t&B_)!==0,o=(t&H_)!==0,s=(t&G_)!==0;if(n)return o?"se-resize":s?"ne-resize":"e-resize";if(r)return o?"sw-resize":s?"nw-resize":"w-resize";if(o)return"s-resize";if(s)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function qA(){ta!==null&&(document.head.removeChild(ta),um=null,ta=null)}function jh(e,t){const n=KA(e,t);um!==n&&(um=n,ta===null&&(ta=document.createElement("style"),document.head.appendChild(ta)),ta.innerHTML=`*{cursor: ${n}!important;}`)}function L_(e){return e.type==="keydown"}function $_(e){return e.type.startsWith("pointer")}function z_(e){return e.type.startsWith("mouse")}function rp(e){if($_(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(z_(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function ZA(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function JA(e,t,n){return e.xt.x&&e.yt.y}function YA(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:o0(e),b:o0(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Ye(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:r0(n0(n.a)),b:r0(n0(n.b))};if(o.a===o.b){const s=r.childNodes,a={a:n.a.at(-1),b:n.b.at(-1)};let l=s.length;for(;l--;){const c=s[l];if(c===a.a)return 1;if(c===a.b)return-1}}return Math.sign(o.a-o.b)}const XA=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function QA(e){var t;const n=getComputedStyle((t=V_(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function eF(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||QA(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||XA.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function n0(e){let t=e.length;for(;t--;){const n=e[t];if(Ye(n,"Missing node"),eF(n))return n}return null}function r0(e){return e&&Number(getComputedStyle(e).zIndex)||0}function o0(e){const t=[];for(;e;)t.push(e),e=V_(e);return t}function V_(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const U_=1,B_=2,H_=4,G_=8,tF=ZA()==="coarse";let Dr=[],Cc=!1,is=new Map,op=new Map;const jc=new Set;function nF(e,t,n,r,o){var s;const{ownerDocument:a}=t,l={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},c=(s=is.get(a))!==null&&s!==void 0?s:0;return is.set(a,c+1),jc.add(l),tf(),function(){var d;op.delete(e),jc.delete(l);const p=(d=is.get(a))!==null&&d!==void 0?d:1;if(is.set(a,p-1),tf(),p===1&&is.delete(a),Dr.includes(l)){const f=Dr.indexOf(l);f>=0&&Dr.splice(f,1),cy()}}}function s0(e){const{target:t}=e,{x:n,y:r}=rp(e);Cc=!0,ly({target:t,x:n,y:r}),tf(),Dr.length>0&&(nf("down",e),e.preventDefault(),e.stopPropagation())}function yl(e){const{x:t,y:n}=rp(e);if(e.buttons===0&&(Cc=!1,nf("up",e)),!Cc){const{target:r}=e;ly({target:r,x:t,y:n})}nf("move",e),cy(),Dr.length>0&&e.preventDefault()}function Fa(e){const{target:t}=e,{x:n,y:r}=rp(e);op.clear(),Cc=!1,Dr.length>0&&e.preventDefault(),nf("up",e),ly({target:t,x:n,y:r}),cy(),tf()}function ly({target:e,x:t,y:n}){Dr.splice(0);let r=null;e instanceof HTMLElement&&(r=e),jc.forEach(o=>{const{element:s,hitAreaMargins:a}=o,l=s.getBoundingClientRect(),{bottom:c,left:u,right:d,top:p}=l,f=tF?a.coarse:a.fine;if(t>=u-f&&t<=d+f&&n>=p-f&&n<=c+f){if(r!==null&&s!==r&&!s.contains(r)&&!r.contains(s)&&YA(r,s)>0){let g=r,m=!1;for(;g&&!g.contains(s);){if(JA(g.getBoundingClientRect(),l)){m=!0;break}g=g.parentElement}if(m)return}Dr.push(o)}})}function _h(e,t){op.set(e,t)}function cy(){let e=!1,t=!1;Dr.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;op.forEach(r=>{n|=r}),e&&t?jh("intersection",n):e?jh("horizontal",n):t?jh("vertical",n):qA()}function tf(){is.forEach((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",Fa),n.removeEventListener("pointerdown",s0),n.removeEventListener("pointerleave",yl),n.removeEventListener("pointermove",yl)}),window.removeEventListener("pointerup",Fa),window.removeEventListener("pointercancel",Fa),jc.size>0&&(Cc?(Dr.length>0&&is.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",Fa),n.addEventListener("pointerleave",yl),n.addEventListener("pointermove",yl))}),window.addEventListener("pointerup",Fa),window.addEventListener("pointercancel",Fa)):is.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",s0,{capture:!0}),n.addEventListener("pointermove",yl))}))}function nf(e,t){jc.forEach(n=>{const{setResizeHandlerState:r}=n,o=Dr.includes(n);r(e,o,t)})}function Ye(e,t){if(!e)throw console.error(t),Error(t)}const uy=10;function ya(e,t,n=uy){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function wo(e,t,n=uy){return ya(e,t,n)===0}function qn(e,t,n){return ya(e,t,n)===0}function rF(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r0&&(e=e<0?0-x:x)}}}{const p=e<0?l:c,f=n[p];Ye(f,`No panel constraints found for index ${p}`);const{collapsedSize:h=0,collapsible:g,minSize:m=0}=f;if(g){const w=t[p];if(Ye(w!=null,`Previous layout not found for panel index ${p}`),qn(w,m)){const x=w-h;ya(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}}{const p=e<0?1:-1;let f=e<0?c:l,h=0;for(;;){const m=t[f];Ye(m!=null,`Previous layout not found for panel index ${f}`);const x=ii({panelConstraints:n,panelIndex:f,size:100})-m;if(h+=x,f+=p,f<0||f>=n.length)break}const g=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-g:g}{let f=e<0?l:c;for(;f>=0&&f=0))break;e<0?f--:f++}}if(rF(o,a))return o;{const p=e<0?c:l,f=t[p];Ye(f!=null,`Previous layout not found for panel index ${p}`);const h=f+u,g=ii({panelConstraints:n,panelIndex:p,size:h});if(a[p]=g,!qn(g,h)){let m=h-g,x=e<0?c:l;for(;x>=0&&x0?x--:x++}}}const d=a.reduce((p,f)=>f+p,0);return qn(d,100)?a:o}function oF({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,s=0,a=0;const l=n[0];Ye(l!=null,"No pivot index found"),t.forEach((p,f)=>{const{constraints:h}=p,{maxSize:g=100,minSize:m=0}=h;f===l?(r=m,o=g):(s+=m,a+=g)});const c=Math.min(o,100-s),u=Math.max(r,100-a),d=e[l];return{valueMax:c,valueMin:u,valueNow:d}}function _c(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function W_(e,t,n=document){const o=_c(e,n).findIndex(s=>s.getAttribute("data-panel-resize-handle-id")===t);return o??null}function K_(e,t,n){const r=W_(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function q_(e,t=document){var n;if(t instanceof HTMLElement&&(t==null||(n=t.dataset)===null||n===void 0?void 0:n.panelGroupId)==e)return t;const r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function sp(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function sF(e,t,n,r=document){var o,s,a,l;const c=sp(t,r),u=_c(e,r),d=c?u.indexOf(c):-1,p=(o=(s=n[d])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null,f=(a=(l=n[d+1])===null||l===void 0?void 0:l.id)!==null&&a!==void 0?a:null;return[p,f]}function aF({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:s,setLayout:a}){Fn({didWarnAboutMissingResizeHandle:!1}),la(()=>{if(!s)return;const l=_c(n,s);for(let c=0;c{l.forEach((c,u)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[n,r,o,s]),ia(()=>{if(!s)return;const l=t.current;Ye(l,"Eager values not found");const{panelDataArray:c}=l,u=q_(n,s);Ye(u!=null,`No group found for id "${n}"`);const d=_c(n,s);Ye(d,`No resize handles found for group id "${n}"`);const p=d.map(f=>{const h=f.getAttribute("data-panel-resize-handle-id");Ye(h,"Resize handle element has no handle id attribute");const[g,m]=sF(n,h,c,s);if(g==null||m==null)return()=>{};const w=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const y=c.findIndex(b=>b.id===g);if(y>=0){const b=c[y];Ye(b,`No panel data found for index ${y}`);const C=r[y],{collapsedSize:j=0,collapsible:S,minSize:k=0}=b.constraints;if(C!=null&&S){const E=Il({delta:qn(C,j)?k-j:j-C,initialLayout:r,panelConstraints:c.map(O=>O.constraints),pivotIndices:K_(n,h,s),prevLayout:r,trigger:"keyboard"});r!==E&&a(E)}}break}}};return f.addEventListener("keydown",w),()=>{f.removeEventListener("keydown",w)}});return()=>{p.forEach(f=>f())}},[s,e,t,n,r,o,a])}function a0(e,t){if(e.length!==t.length)return!1;for(let n=0;ns.constraints);let r=0,o=100;for(let s=0;s{const s=e[o];Ye(s,`Panel data not found for index ${o}`);const{callbacks:a,constraints:l,id:c}=s,{collapsedSize:u=0,collapsible:d}=l,p=n[c];if(p==null||r!==p){n[c]=r;const{onCollapse:f,onExpand:h,onResize:g}=a;g&&g(r,p),d&&(f||h)&&(h&&(p==null||wo(p,u))&&!wo(r,u)&&h(),f&&(p==null||!wo(p,u))&&wo(r,u)&&f())}})}function zu(e,t){if(e.length!==t.length)return!1;for(let n=0;n{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function i0(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function J_(e){return`react-resizable-panels:${e}`}function Y_(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:s}=t;return o?r:s?`${s}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function X_(e,t){try{const n=J_(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function fF(e,t,n){var r,o;const s=(r=X_(e,n))!==null&&r!==void 0?r:{},a=Y_(t);return(o=s[a])!==null&&o!==void 0?o:null}function pF(e,t,n,r,o){var s;const a=J_(e),l=Y_(t),c=(s=X_(e,o))!==null&&s!==void 0?s:{};c[l]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(a,JSON.stringify(c))}catch(u){console.error(u)}}function l0({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((s,a)=>s+a,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!qn(r,100))for(let s=0;s(i0(Dl),Dl.getItem(e)),setItem:(e,t)=>{i0(Dl),Dl.setItem(e,t)}},c0={};function Q_({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:s=null,onLayout:a=null,keyboardResizeBy:l=null,storage:c=Dl,style:u,tagName:d="div",...p}){const f=iy(s),h=Fn(null),[g,m]=Kl(null),[w,x]=Kl([]),y=Fn({}),b=Fn(new Map),C=Fn(0),j=Fn({autoSaveId:e,direction:r,dragState:g,id:f,keyboardResizeBy:l,onLayout:a,storage:c}),S=Fn({layout:w,panelDataArray:[],panelDataArrayChanged:!1});Fn({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),M_(o,()=>({getId:()=>j.current.id,getLayout:()=>{const{layout:B}=S.current;return B},setLayout:B=>{const{onLayout:te}=j.current,{layout:X,panelDataArray:ie}=S.current,re=l0({layout:B,panelConstraints:ie.map(W=>W.constraints)});a0(X,re)||(x(re),S.current.layout=re,te&&te(re),La(ie,re,y.current))}}),[]),la(()=>{j.current.autoSaveId=e,j.current.direction=r,j.current.dragState=g,j.current.id=f,j.current.onLayout=a,j.current.storage=c}),aF({committedValuesRef:j,eagerValuesRef:S,groupId:f,layout:w,panelDataArray:S.current.panelDataArray,setLayout:x,panelGroupElement:h.current}),ia(()=>{const{panelDataArray:B}=S.current;if(e){if(w.length===0||w.length!==B.length)return;let te=c0[e];te==null&&(te=dF(pF,hF),c0[e]=te);const X=[...B],ie=new Map(b.current);te(e,X,ie,w,c)}},[e,w,c]),ia(()=>{});const k=Gn(B=>{const{onLayout:te}=j.current,{layout:X,panelDataArray:ie}=S.current;if(B.constraints.collapsible){const re=ie.map(Fe=>Fe.constraints),{collapsedSize:W=0,panelSize:we,pivotIndices:Re}=Hs(ie,B,X);if(Ye(we!=null,`Panel size not found for panel "${B.id}"`),!wo(we,W)){b.current.set(B.id,we);const Pe=Ga(ie,B)===ie.length-1?we-W:W-we,ge=Il({delta:Pe,initialLayout:X,panelConstraints:re,pivotIndices:Re,prevLayout:X,trigger:"imperative-api"});zu(X,ge)||(x(ge),S.current.layout=ge,te&&te(ge),La(ie,ge,y.current))}}},[]),E=Gn((B,te)=>{const{onLayout:X}=j.current,{layout:ie,panelDataArray:re}=S.current;if(B.constraints.collapsible){const W=re.map(Xe=>Xe.constraints),{collapsedSize:we=0,panelSize:Re=0,minSize:Fe=0,pivotIndices:Pe}=Hs(re,B,ie),ge=te??Fe;if(wo(Re,we)){const Xe=b.current.get(B.id),kt=Xe!=null&&Xe>=ge?Xe:ge,Lt=Ga(re,B)===re.length-1?Re-kt:kt-Re,Wt=Il({delta:Lt,initialLayout:ie,panelConstraints:W,pivotIndices:Pe,prevLayout:ie,trigger:"imperative-api"});zu(ie,Wt)||(x(Wt),S.current.layout=Wt,X&&X(Wt),La(re,Wt,y.current))}}},[]),O=Gn(B=>{const{layout:te,panelDataArray:X}=S.current,{panelSize:ie}=Hs(X,B,te);return Ye(ie!=null,`Panel size not found for panel "${B.id}"`),ie},[]),F=Gn((B,te)=>{const{panelDataArray:X}=S.current,ie=Ga(X,B);return uF({defaultSize:te,dragState:g,layout:w,panelData:X,panelIndex:ie})},[g,w]),Z=Gn(B=>{const{layout:te,panelDataArray:X}=S.current,{collapsedSize:ie=0,collapsible:re,panelSize:W}=Hs(X,B,te);return Ye(W!=null,`Panel size not found for panel "${B.id}"`),re===!0&&wo(W,ie)},[]),I=Gn(B=>{const{layout:te,panelDataArray:X}=S.current,{collapsedSize:ie=0,collapsible:re,panelSize:W}=Hs(X,B,te);return Ye(W!=null,`Panel size not found for panel "${B.id}"`),!re||ya(W,ie)>0},[]),q=Gn(B=>{const{panelDataArray:te}=S.current;te.push(B),te.sort((X,ie)=>{const re=X.order,W=ie.order;return re==null&&W==null?0:re==null?-1:W==null?1:re-W}),S.current.panelDataArrayChanged=!0},[]);la(()=>{if(S.current.panelDataArrayChanged){S.current.panelDataArrayChanged=!1;const{autoSaveId:B,onLayout:te,storage:X}=j.current,{layout:ie,panelDataArray:re}=S.current;let W=null;if(B){const Re=fF(B,re,X);Re&&(b.current=new Map(Object.entries(Re.expandToSizes)),W=Re.layout)}W==null&&(W=cF({panelDataArray:re}));const we=l0({layout:W,panelConstraints:re.map(Re=>Re.constraints)});a0(ie,we)||(x(we),S.current.layout=we,te&&te(we),La(re,we,y.current))}}),la(()=>{const B=S.current;return()=>{B.layout=[]}},[]);const H=Gn(B=>function(X){X.preventDefault();const ie=h.current;if(!ie)return()=>null;const{direction:re,dragState:W,id:we,keyboardResizeBy:Re,onLayout:Fe}=j.current,{layout:Pe,panelDataArray:ge}=S.current,{initialLayout:Xe}=W??{},kt=K_(we,B,ie);let Ut=lF(X,B,re,W,Re,ie);const Lt=re==="horizontal";document.dir==="rtl"&&Lt&&(Ut=-Ut);const Wt=ge.map(U=>U.constraints),_=Il({delta:Ut,initialLayout:Xe??Pe,panelConstraints:Wt,pivotIndices:kt,prevLayout:Pe,trigger:L_(X)?"keyboard":"mouse-or-touch"}),D=!zu(Pe,_);($_(X)||z_(X))&&C.current!=Ut&&(C.current=Ut,D?_h(B,0):Lt?_h(B,Ut<0?U_:B_):_h(B,Ut<0?H_:G_)),D&&(x(_),S.current.layout=_,Fe&&Fe(_),La(ge,_,y.current))},[]),J=Gn((B,te)=>{const{onLayout:X}=j.current,{layout:ie,panelDataArray:re}=S.current,W=re.map(Xe=>Xe.constraints),{panelSize:we,pivotIndices:Re}=Hs(re,B,ie);Ye(we!=null,`Panel size not found for panel "${B.id}"`);const Pe=Ga(re,B)===re.length-1?we-te:te-we,ge=Il({delta:Pe,initialLayout:ie,panelConstraints:W,pivotIndices:Re,prevLayout:ie,trigger:"imperative-api"});zu(ie,ge)||(x(ge),S.current.layout=ge,X&&X(ge),La(re,ge,y.current))},[]),ne=Gn((B,te)=>{const{layout:X,panelDataArray:ie}=S.current,{collapsedSize:re=0,collapsible:W}=te,{collapsedSize:we=0,collapsible:Re,maxSize:Fe=100,minSize:Pe=0}=B.constraints,{panelSize:ge}=Hs(ie,B,X);ge!=null&&(W&&Re&&wo(ge,re)?wo(re,we)||J(B,we):geFe&&J(B,Fe))},[J]),K=Gn((B,te)=>{const{direction:X}=j.current,{layout:ie}=S.current;if(!h.current)return;const re=sp(B,h.current);Ye(re,`Drag handle element not found for id "${B}"`);const W=Z_(X,te);m({dragHandleId:B,dragHandleRect:re.getBoundingClientRect(),initialCursorPosition:W,initialLayout:ie})},[]),z=Gn(()=>{m(null)},[]),L=Gn(B=>{const{panelDataArray:te}=S.current,X=Ga(te,B);X>=0&&(te.splice(X,1),delete y.current[B.id],S.current.panelDataArrayChanged=!0)},[]),ee=BA(()=>({collapsePanel:k,direction:r,dragState:g,expandPanel:E,getPanelSize:O,getPanelStyle:F,groupId:f,isPanelCollapsed:Z,isPanelExpanded:I,reevaluatePanelConstraints:ne,registerPanel:q,registerResizeHandle:H,resizePanel:J,startDragging:K,stopDragging:z,unregisterPanel:L,panelGroupElement:h.current}),[k,g,r,E,O,F,f,Z,I,ne,q,H,J,K,z,L]),fe={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Ri(np.Provider,{value:ee},Ri(d,{...p,children:t,className:n,id:s,ref:h,style:{...fe,...u},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":f}))}const e1=D_((e,t)=>Ri(Q_,{...e,forwardedRef:t}));Q_.displayName="PanelGroup";e1.displayName="forwardRef(PanelGroup)";function Ga(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Hs(e,t,n){const r=Ga(e,t),s=r===e.length-1?[r-1,r]:[r,r+1],a=n[r];return{...t.constraints,panelSize:a,pivotIndices:s}}function gF({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){ia(()=>{if(e||n==null||r==null)return;const o=sp(t,r);if(o==null)return;const s=a=>{if(!a.defaultPrevented)switch(a.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{a.preventDefault(),n(a);break}case"F6":{a.preventDefault();const l=o.getAttribute("data-panel-group-id");Ye(l,`No group element found for id "${l}"`);const c=_c(l,r),u=W_(l,t,r);Ye(u!==null,`No resize element found for id "${t}"`);const d=a.shiftKey?u>0?u-1:c.length-1:u+1{o.removeEventListener("keydown",s)}},[r,e,t,n])}function t1({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:s,onDragging:a,onFocus:l,style:c={},tabIndex:u=0,tagName:d="div",...p}){var f,h;const g=Fn(null),m=Fn({onDragging:a});ia(()=>{m.current.onDragging=a});const w=O_(np);if(w===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:x,groupId:y,registerResizeHandle:b,startDragging:C,stopDragging:j,panelGroupElement:S}=w,k=iy(o),[E,O]=Kl("inactive"),[F,Z]=Kl(!1),[I,q]=Kl(null),H=Fn({state:E});la(()=>{H.current.state=E}),ia(()=>{if(n)q(null);else{const z=b(k);q(()=>z)}},[n,k,b]);const J=(f=r==null?void 0:r.coarse)!==null&&f!==void 0?f:15,ne=(h=r==null?void 0:r.fine)!==null&&h!==void 0?h:5;return ia(()=>{if(n||I==null)return;const z=g.current;return Ye(z,"Element ref not attached"),nF(k,z,x,{coarse:J,fine:ne},(ee,fe,B)=>{if(fe)switch(ee){case"down":{O("drag"),C(k,B);const{onDragging:te}=m.current;te&&te(!0);break}case"move":{const{state:te}=H.current;te!=="drag"&&O("hover"),I(B);break}case"up":{O("hover"),j();const{onDragging:te}=m.current;te&&te(!1);break}}else O("inactive")})},[J,x,n,ne,b,k,I,C,j]),gF({disabled:n,handleId:k,resizeHandler:I,panelGroupElement:S}),Ri(d,{...p,children:e,className:t,id:o,onBlur:()=>{Z(!1),s==null||s()},onFocus:()=>{Z(!0),l==null||l()},ref:g,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...c},tabIndex:u,"data-panel-group-direction":x,"data-panel-group-id":y,"data-resize-handle":"","data-resize-handle-active":E==="drag"?"pointer":F?"keyboard":void 0,"data-resize-handle-state":E,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":k})}t1.displayName="PanelResizeHandle";function n1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;tl(s)))==null?void 0:a.classGroupId}const u0=/^\[(.+)\]$/;function vF(e){if(u0.test(e)){const t=u0.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function yF(e){const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return wF(Object.entries(e.classGroups),n).forEach(([s,a])=>{dm(a,r,s,t)}),r}function dm(e,t,n,r){e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:d0(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(xF(o)){dm(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,a])=>{dm(a,d0(t,s),n,r)})})}function d0(e,t){let n=e;return t.split(dy).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function xF(e){return e.isThemeGetter}function wF(e,t){return t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,l])=>[t+a,l])):s);return[n,o]}):e}function bF(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;function o(s,a){n.set(s,a),t++,t>e&&(t=0,r=n,n=new Map)}return{get(s){let a=n.get(s);if(a!==void 0)return a;if((a=r.get(s))!==void 0)return o(s,a),a},set(s,a){n.has(s)?n.set(s,a):o(s,a)}}}const o1="!";function SF(e){const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length;function a(l){const c=[];let u=0,d=0,p;for(let w=0;wd?p-d:void 0;return{modifiers:c,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:m}}return n?function(c){return n({className:c,parseClassName:a})}:a}function CF(e){if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t}function jF(e){return{cache:bF(e.cacheSize),parseClassName:SF(e),...mF(e)}}const _F=/\s+/;function EF(e,t){const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=new Set;return e.trim().split(_F).map(a=>{const{modifiers:l,hasImportantModifier:c,baseClassName:u,maybePostfixModifierPosition:d}=n(a);let p=!!d,f=r(p?u.substring(0,d):u);if(!f){if(!p)return{isTailwindClass:!1,originalClassName:a};if(f=r(u),!f)return{isTailwindClass:!1,originalClassName:a};p=!1}const h=CF(l).join(":");return{isTailwindClass:!0,modifierId:c?h+o1:h,classGroupId:f,originalClassName:a,hasPostfixModifier:p}}).reverse().filter(a=>{if(!a.isTailwindClass)return!0;const{modifierId:l,classGroupId:c,hasPostfixModifier:u}=a,d=l+c;return s.has(d)?!1:(s.add(d),o(c,u).forEach(p=>s.add(l+p)),!0)}).reverse().map(a=>a.originalClassName).join(" ")}function TF(){let e=0,t,n,r="";for(;ep(d),e());return n=jF(u),r=n.cache.get,o=n.cache.set,s=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=EF(c,n);return o(c,d),d}return function(){return s(TF.apply(null,arguments))}}function xt(e){const t=n=>n[e]||[];return t.isThemeGetter=!0,t}const a1=/^\[(?:([a-z-]+):)?(.+)\]$/i,NF=/^\d+\/\d+$/,RF=new Set(["px","full","screen"]),PF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,IF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,OF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,MF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function po(e){return na(e)||RF.has(e)||NF.test(e)}function Qo(e){return Hi(e,"length",BF)}function na(e){return!!e&&!Number.isNaN(Number(e))}function Vu(e){return Hi(e,"number",na)}function xl(e){return!!e&&Number.isInteger(Number(e))}function AF(e){return e.endsWith("%")&&na(e.slice(0,-1))}function We(e){return a1.test(e)}function es(e){return PF.test(e)}const FF=new Set(["length","size","percentage"]);function LF(e){return Hi(e,FF,i1)}function $F(e){return Hi(e,"position",i1)}const zF=new Set(["image","url"]);function VF(e){return Hi(e,zF,GF)}function UF(e){return Hi(e,"",HF)}function wl(){return!0}function Hi(e,t,n){const r=a1.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1}function BF(e){return IF.test(e)&&!DF.test(e)}function i1(){return!1}function HF(e){return OF.test(e)}function GF(e){return MF.test(e)}function WF(){const e=xt("colors"),t=xt("spacing"),n=xt("blur"),r=xt("brightness"),o=xt("borderColor"),s=xt("borderRadius"),a=xt("borderSpacing"),l=xt("borderWidth"),c=xt("contrast"),u=xt("grayscale"),d=xt("hueRotate"),p=xt("invert"),f=xt("gap"),h=xt("gradientColorStops"),g=xt("gradientColorStopPositions"),m=xt("inset"),w=xt("margin"),x=xt("opacity"),y=xt("padding"),b=xt("saturate"),C=xt("scale"),j=xt("sepia"),S=xt("skew"),k=xt("space"),E=xt("translate"),O=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],Z=()=>["auto",We,t],I=()=>[We,t],q=()=>["",po,Qo],H=()=>["auto",na,We],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ne=()=>["solid","dashed","dotted","double","none"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",We],ee=()=>["auto","avoid","all","avoid-page","page","left","right","column"],fe=()=>[na,Vu],B=()=>[na,We];return{cacheSize:500,separator:":",theme:{colors:[wl],spacing:[po,Qo],blur:["none","",es,We],brightness:fe(),borderColor:[e],borderRadius:["none","","full",es,We],borderSpacing:I(),borderWidth:q(),contrast:fe(),grayscale:L(),hueRotate:B(),invert:L(),gap:I(),gradientColorStops:[e],gradientColorStopPositions:[AF,Qo],inset:Z(),margin:Z(),opacity:fe(),padding:I(),saturate:fe(),scale:fe(),sepia:L(),skew:B(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",We]}],container:["container"],columns:[{columns:[es]}],"break-after":[{"break-after":ee()}],"break-before":[{"break-before":ee()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...J(),We]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",xl,We]}],basis:[{basis:Z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",We]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",xl,We]}],"grid-cols":[{"grid-cols":[wl]}],"col-start-end":[{col:["auto",{span:["full",xl,We]},We]}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":[wl]}],"row-start-end":[{row:["auto",{span:[xl,We]},We]}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",We]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",We]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",We,t]}],"min-w":[{"min-w":[We,t,"min","max","fit"]}],"max-w":[{"max-w":[We,t,"none","full","min","max","fit","prose",{screen:[es]},es]}],h:[{h:[We,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[We,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[We,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[We,t,"auto","min","max","fit"]}],"font-size":[{text:["base",es,Qo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Vu]}],"font-family":[{font:[wl]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",We]}],"line-clamp":[{"line-clamp":["none",na,Vu]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",po,We]}],"list-image":[{"list-image":["none",We]}],"list-style-type":[{list:["none","disc","decimal",We]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ne(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",po,Qo]}],"underline-offset":[{"underline-offset":["auto",po,We]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",We]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",We]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...J(),$F]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",LF]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VF]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...ne(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:ne()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...ne()]}],"outline-offset":[{"outline-offset":[po,We]}],"outline-w":[{outline:[po,Qo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[po,Qo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",es,UF]}],"shadow-color":[{shadow:[wl]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...K(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":K()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",es,We]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[p]}],saturate:[{saturate:[b]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",We]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",We]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",We]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[xl,We]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",We]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",We]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",We]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[po,Qo,Vu]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const KF=kF(WF);function Ne(...e){return KF(Co(e))}const su=({className:e,...t})=>i.jsx(e1,{className:Ne("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),ro=F_,au=({withHandle:e,className:t,...n})=>i.jsx(t1,{className:Ne("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&i.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:i.jsx(cA,{className:"h-2.5 w-2.5"})})});function gn({children:e}){const{instanceId:t}=Ta();return i.jsxs(yA,{children:[i.jsx(E_,{instanceId:t}),i.jsx("div",{className:"layout-general",children:i.jsx("div",{className:"instance-layout",children:i.jsxs(su,{direction:"horizontal",children:[i.jsx(ro,{defaultSize:15,children:i.jsx(zA,{})}),i.jsx(au,{withHandle:!0,className:"border border-black"}),i.jsx(ro,{children:e})]})})})]})}function l1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;ttypeof e=="boolean"?"".concat(e):e===0?"0":e,p0=qF,c1=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return p0(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,a=Object.keys(o).map(u=>{const d=n==null?void 0:n[u],p=s==null?void 0:s[u];if(d===null)return null;const f=f0(d)||f0(p);return o[u][f]}),l=n&&Object.entries(n).reduce((u,d)=>{let[p,f]=d;return f===void 0||(u[p]=f),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:p,className:f,...h}=d;return Object.entries(h).every(g=>{let[m,w]=g;return Array.isArray(w)?w.includes({...s,...l}[m]):{...s,...l}[m]===w})?[...u,p,f]:u},[]);return p0(e,a,c,n==null?void 0:n.class,n==null?void 0:n.className)},ZF=c1("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Te=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>{const a=r?Do:"button";return i.jsx(a,{className:Ne(ZF({variant:t,size:n,className:e})),ref:s,...o})});Te.displayName="Button";function u1(){return i.jsxs("footer",{className:"footer",children:[i.jsxs("div",{className:"footer-info",children:["Client Name: ",i.jsx("strong",{children:localStorage.getItem("clientName")})," Version:"," ",i.jsx("strong",{children:localStorage.getItem("version")})]}),i.jsxs("div",{className:"footer-buttons",children:[i.jsx(Te,{variant:"link",children:i.jsx("a",{href:"https://evolution-api.com/discord",target:"_blank",rel:"noopener noreferrer",children:"Discord"})}),i.jsx(Te,{variant:"link",children:i.jsx("a",{href:"https://evolution-api.com/postman",target:"_blank",rel:"noopener noreferrer",children:"Postman"})}),i.jsx(Te,{variant:"link",children:i.jsx("a",{href:"https://github.com/EvolutionAPI/evolution-api",target:"_blank",rel:"noopener noreferrer",children:"GitHub"})}),i.jsx(Te,{variant:"link",children:i.jsx("a",{href:"https://doc.evolution-api.com",target:"_blank",rel:"noopener noreferrer",children:"Docs"})})]})]})}function JF({children:e}){return i.jsxs("div",{className:"layout",children:[i.jsx(E_,{}),i.jsxs("div",{className:"layout-general",children:[i.jsx("main",{className:"content",children:e}),i.jsx(u1,{})]})]})}const mi=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Ne("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));mi.displayName="Card";const ql=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Ne("flex flex-col space-y-1.5 p-6",e),...t}));ql.displayName="CardHeader";const Zl=v.forwardRef(({className:e,...t},n)=>i.jsx("h3",{ref:n,className:Ne("text-2xl font-semibold leading-none tracking-tight",e),...t}));Zl.displayName="CardTitle";const d1=v.forwardRef(({className:e,...t},n)=>i.jsx("p",{ref:n,className:Ne("text-sm text-muted-foreground",e),...t}));d1.displayName="CardDescription";const Jl=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Ne("p-6 pt-0",e),...t}));Jl.displayName="CardContent";const f1=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Ne("flex items-center p-6 pt-0",e),...t}));f1.displayName="CardFooter";function YF(e,t=globalThis==null?void 0:globalThis.document){const n=xr(e);v.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var XF="DismissableLayer",fm="dismissableLayer.update",QF="dismissableLayer.pointerDownOutside",e2="dismissableLayer.focusOutside",h0,p1=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ap=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=v.useContext(p1),[d,p]=v.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=v.useState({}),g=ut(t,k=>p(k)),m=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=m.indexOf(w),y=d?m.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,C=y>=x,j=r2(k=>{const E=k.target,O=[...u.branches].some(F=>F.contains(E));!C||O||(o==null||o(k),a==null||a(k),k.defaultPrevented||l==null||l())},f),S=o2(k=>{const E=k.target;[...u.branches].some(F=>F.contains(E))||(s==null||s(k),a==null||a(k),k.defaultPrevented||l==null||l())},f);return YF(k=>{y===u.layers.size-1&&(r==null||r(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},f),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(h0=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),g0(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=h0)}},[d,f,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),g0())},[d,u]),v.useEffect(()=>{const k=()=>h({});return document.addEventListener(fm,k),()=>document.removeEventListener(fm,k)},[]),i.jsx(Ve.div,{...c,ref:g,style:{pointerEvents:b?C?"auto":"none":void 0,...e.style},onFocusCapture:Ce(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Ce(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Ce(e.onPointerDownCapture,j.onPointerDownCapture)})});ap.displayName=XF;var t2="DismissableLayerBranch",n2=v.forwardRef((e,t)=>{const n=v.useContext(p1),r=v.useRef(null),o=ut(t,r);return v.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),i.jsx(Ve.div,{...e,ref:o})});n2.displayName=t2;function r2(e,t=globalThis==null?void 0:globalThis.document){const n=xr(e),r=v.useRef(!1),o=v.useRef(()=>{});return v.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){h1(QF,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function o2(e,t=globalThis==null?void 0:globalThis.document){const n=xr(e),r=v.useRef(!1);return v.useEffect(()=>{const o=s=>{s.target&&!r.current&&h1(e2,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function g0(){const e=new CustomEvent(fm);document.dispatchEvent(e)}function h1(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?k_(o,s):o.dispatchEvent(s)}var Eh="focusScope.autoFocusOnMount",Th="focusScope.autoFocusOnUnmount",m0={bubbles:!1,cancelable:!0},s2="FocusScope",ip=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=e,[l,c]=v.useState(null),u=xr(o),d=xr(s),p=v.useRef(null),f=ut(t,m=>c(m)),h=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(b){if(h.paused||!l)return;const C=b.target;l.contains(C)?p.current=C:ns(p.current,{select:!0})},w=function(b){if(h.paused||!l)return;const C=b.relatedTarget;C!==null&&(l.contains(C)||ns(p.current,{select:!0}))},x=function(b){if(document.activeElement===document.body)for(const j of b)j.removedNodes.length>0&&ns(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",w);const y=new MutationObserver(x);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",w),y.disconnect()}}},[r,l,h.paused]),v.useEffect(()=>{if(l){y0.add(h);const m=document.activeElement;if(!l.contains(m)){const x=new CustomEvent(Eh,m0);l.addEventListener(Eh,u),l.dispatchEvent(x),x.defaultPrevented||(a2(d2(g1(l)),{select:!0}),document.activeElement===m&&ns(l))}return()=>{l.removeEventListener(Eh,u),setTimeout(()=>{const x=new CustomEvent(Th,m0);l.addEventListener(Th,d),l.dispatchEvent(x),x.defaultPrevented||ns(m??document.body,{select:!0}),l.removeEventListener(Th,d),y0.remove(h)},0)}}},[l,u,d,h]);const g=v.useCallback(m=>{if(!n&&!r||h.paused)return;const w=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,x=document.activeElement;if(w&&x){const y=m.currentTarget,[b,C]=i2(y);b&&C?!m.shiftKey&&x===C?(m.preventDefault(),n&&ns(b,{select:!0})):m.shiftKey&&x===b&&(m.preventDefault(),n&&ns(C,{select:!0})):x===y&&m.preventDefault()}},[n,r,h.paused]);return i.jsx(Ve.div,{tabIndex:-1,...a,ref:f,onKeyDown:g})});ip.displayName=s2;function a2(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ns(r,{select:t}),document.activeElement!==n)return}function i2(e){const t=g1(e),n=v0(t,e),r=v0(t.reverse(),e);return[n,r]}function g1(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function v0(e,t){for(const n of e)if(!l2(n,{upTo:t}))return n}function l2(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function c2(e){return e instanceof HTMLInputElement&&"select"in e}function ns(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&c2(e)&&t&&e.select()}}var y0=u2();function u2(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=x0(e,t),e.unshift(t)},remove(t){var n;e=x0(e,t),(n=e[0])==null||n.resume()}}}function x0(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function d2(e){return e.filter(t=>t.tagName!=="A")}var f2="Portal",lp=v.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,s]=v.useState(!1);bn(()=>s(!0),[]);const a=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?Pj.createPortal(i.jsx(Ve.div,{...r,ref:t}),a):null});lp.displayName=f2;var kh=0;function fy(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??w0()),document.body.insertAdjacentElement("beforeend",e[1]??w0()),kh++,()=>{kh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),kh--}},[])}function w0(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var Jr=function(){return Jr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r"u")return N2;var t=R2(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},I2=x1(),vi="data-scroll-locked",D2=function(e,t,n,r){var o=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),` .`.concat(h2,` { overflow: hidden `).concat(r,`; padding-right: `).concat(l,"px ").concat(r,`; } - body[`).concat(mi,`] { + body[`).concat(vi,`] { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` @@ -290,17 +290,17 @@ Error generating stack: `+s.message+` margin-right: 0 `).concat(r,`; } - body[`).concat(mi,`] { + body[`).concat(vi,`] { `).concat(g2,": ").concat(l,`px; } -`)},S0=function(){var e=parseInt(document.body.getAttribute(mi)||"0",10);return isFinite(e)?e:0},O2=function(){v.useEffect(function(){return document.body.setAttribute(mi,(S0()+1).toString()),function(){var e=S0()-1;e<=0?document.body.removeAttribute(mi):document.body.setAttribute(mi,e.toString())}},[])},M2=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;O2();var s=v.useMemo(function(){return P2(o)},[o]);return v.createElement(I2,{styles:D2(s,!t,o,n?"":"!important")})},pm=!1;if(typeof window<"u")try{var Uu=Object.defineProperty({},"passive",{get:function(){return pm=!0,!0}});window.addEventListener("test",Uu,Uu),window.removeEventListener("test",Uu,Uu)}catch{pm=!1}var La=pm?{passive:!1}:!1,A2=function(e){return e.tagName==="TEXTAREA"},x1=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!A2(e)&&n[t]==="visible")},F2=function(e){return x1(e,"overflowY")},L2=function(e){return x1(e,"overflowX")},C0=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=w1(e,r);if(o){var s=b1(e,r),a=s[1],l=s[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$2=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},z2=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},w1=function(e,t){return e==="v"?F2(t):L2(t)},b1=function(e,t){return e==="v"?$2(t):z2(t)},V2=function(e,t){return e==="h"&&t==="rtl"?-1:1},U2=function(e,t,n,r,o){var s=V2(e,window.getComputedStyle(t).direction),a=s*r,l=n.target,c=t.contains(l),u=!1,d=a>0,p=0,f=0;do{var h=b1(e,l),g=h[0],m=h[1],w=h[2],x=m-w-s*g;(g||x)&&w1(e,l)&&(p+=x,f+=g),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(Math.abs(p)<1||!o)||!d&&(Math.abs(f)<1||!o))&&(u=!0),u},Bu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},j0=function(e){return[e.deltaX,e.deltaY]},_0=function(e){return e&&"current"in e?e.current:e},B2=function(e,t){return e[0]===t[0]&&e[1]===t[1]},H2=function(e){return` +`)},S0=function(){var e=parseInt(document.body.getAttribute(vi)||"0",10);return isFinite(e)?e:0},O2=function(){v.useEffect(function(){return document.body.setAttribute(vi,(S0()+1).toString()),function(){var e=S0()-1;e<=0?document.body.removeAttribute(vi):document.body.setAttribute(vi,e.toString())}},[])},M2=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;O2();var s=v.useMemo(function(){return P2(o)},[o]);return v.createElement(I2,{styles:D2(s,!t,o,n?"":"!important")})},pm=!1;if(typeof window<"u")try{var Uu=Object.defineProperty({},"passive",{get:function(){return pm=!0,!0}});window.addEventListener("test",Uu,Uu),window.removeEventListener("test",Uu,Uu)}catch{pm=!1}var $a=pm?{passive:!1}:!1,A2=function(e){return e.tagName==="TEXTAREA"},w1=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!A2(e)&&n[t]==="visible")},F2=function(e){return w1(e,"overflowY")},L2=function(e){return w1(e,"overflowX")},C0=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=b1(e,r);if(o){var s=S1(e,r),a=s[1],l=s[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$2=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},z2=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},b1=function(e,t){return e==="v"?F2(t):L2(t)},S1=function(e,t){return e==="v"?$2(t):z2(t)},V2=function(e,t){return e==="h"&&t==="rtl"?-1:1},U2=function(e,t,n,r,o){var s=V2(e,window.getComputedStyle(t).direction),a=s*r,l=n.target,c=t.contains(l),u=!1,d=a>0,p=0,f=0;do{var h=S1(e,l),g=h[0],m=h[1],w=h[2],x=m-w-s*g;(g||x)&&b1(e,l)&&(p+=x,f+=g),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(Math.abs(p)<1||!o)||!d&&(Math.abs(f)<1||!o))&&(u=!0),u},Bu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},j0=function(e){return[e.deltaX,e.deltaY]},_0=function(e){return e&&"current"in e?e.current:e},B2=function(e,t){return e[0]===t[0]&&e[1]===t[1]},H2=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},G2=0,$a=[];function W2(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(G2++)[0],s=v.useState(y1)[0],a=v.useRef(e);v.useEffect(function(){a.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=p2([e.lockRef.current],(e.shards||[]).map(_0),!0).filter(Boolean);return m.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(m,w){if("touches"in m&&m.touches.length===2)return!a.current.allowPinchZoom;var x=Bu(m),y=n.current,b="deltaX"in m?m.deltaX:y[0]-x[0],C="deltaY"in m?m.deltaY:y[1]-x[1],j,S=m.target,k=Math.abs(b)>Math.abs(C)?"h":"v";if("touches"in m&&k==="h"&&S.type==="range")return!1;var E=C0(k,S);if(!E)return!0;if(E?j=k:(j=k==="v"?"h":"v",E=C0(k,S)),!E)return!1;if(!r.current&&"changedTouches"in m&&(b||C)&&(r.current=j),!j)return!0;var O=r.current||j;return U2(O,w,m,O==="h"?b:C,!0)},[]),c=v.useCallback(function(m){var w=m;if(!(!$a.length||$a[$a.length-1]!==s)){var x="deltaY"in w?j0(w):Bu(w),y=t.current.filter(function(j){return j.name===w.type&&(j.target===w.target||w.target===j.shadowParent)&&B2(j.delta,x)})[0];if(y&&y.should){w.cancelable&&w.preventDefault();return}if(!y){var b=(a.current.shards||[]).map(_0).filter(Boolean).filter(function(j){return j.contains(w.target)}),C=b.length>0?l(w,b[0]):!a.current.noIsolation;C&&w.cancelable&&w.preventDefault()}}},[]),u=v.useCallback(function(m,w,x,y){var b={name:m,delta:w,target:x,should:y,shadowParent:K2(x)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(C){return C!==b})},1)},[]),d=v.useCallback(function(m){n.current=Bu(m),r.current=void 0},[]),p=v.useCallback(function(m){u(m.type,j0(m),m.target,l(m,e.lockRef.current))},[]),f=v.useCallback(function(m){u(m.type,Bu(m),m.target,l(m,e.lockRef.current))},[]);v.useEffect(function(){return $a.push(s),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",c,La),document.addEventListener("touchmove",c,La),document.addEventListener("touchstart",d,La),function(){$a=$a.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,La),document.removeEventListener("touchmove",c,La),document.removeEventListener("touchstart",d,La)}},[]);var h=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(s,{styles:H2(o)}):null,h?v.createElement(M2,{gapMode:e.gapMode}):null)}function K2(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const q2=S2(v1,W2);var up=v.forwardRef(function(e,t){return v.createElement(cp,Jr({},e,{ref:t,sideCar:q2}))});up.classNames=cp.classNames;var Z2=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},za=new WeakMap,Hu=new WeakMap,Gu={},Ih=0,S1=function(e){return e&&(e.host||S1(e.parentNode))},J2=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=S1(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Y2=function(e,t,n,r){var o=J2(t,Array.isArray(e)?e:[e]);Gu[n]||(Gu[n]=new WeakMap);var s=Gu[n],a=[],l=new Set,c=new Set(o),u=function(p){!p||l.has(p)||(l.add(p),u(p.parentNode))};o.forEach(u);var d=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(f){if(l.has(f))d(f);else try{var h=f.getAttribute(r),g=h!==null&&h!=="false",m=(za.get(f)||0)+1,w=(s.get(f)||0)+1;za.set(f,m),s.set(f,w),a.push(f),m===1&&g&&Hu.set(f,!0),w===1&&f.setAttribute(n,"true"),g||f.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",f,x)}})};return d(t),l.clear(),Ih++,function(){a.forEach(function(p){var f=za.get(p)-1,h=s.get(p)-1;za.set(p,f),s.set(p,h),f||(Hu.has(p)||p.removeAttribute(r),Hu.delete(p)),h||p.removeAttribute(n)}),Ih--,Ih||(za=new WeakMap,za=new WeakMap,Hu=new WeakMap,Gu={})}},py=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Z2(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),Y2(r,o,n,"aria-hidden")):function(){return null}},hy="Dialog",[C1,BK]=lo(hy),[X2,Vr]=C1(hy),j1=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,l=v.useRef(null),c=v.useRef(null),[u=!1,d]=js({prop:r,defaultProp:o,onChange:s});return i.jsx(X2,{scope:t,triggerRef:l,contentRef:c,contentId:Ir(),titleId:Ir(),descriptionId:Ir(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(p=>!p),[d]),modal:a,children:n})};j1.displayName=hy;var _1="DialogTrigger",E1=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vr(_1,n),s=ut(t,o.triggerRef);return i.jsx(Ve.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":vy(o.open),...r,ref:s,onClick:Ce(e.onClick,o.onOpenToggle)})});E1.displayName=_1;var gy="DialogPortal",[Q2,T1]=C1(gy,{forceMount:void 0}),k1=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Vr(gy,t);return i.jsx(Q2,{scope:t,forceMount:n,children:v.Children.map(r,a=>i.jsx(co,{present:n||s.open,children:i.jsx(lp,{asChild:!0,container:o,children:a})}))})};k1.displayName=gy;var rf="DialogOverlay",N1=v.forwardRef((e,t)=>{const n=T1(rf,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Vr(rf,e.__scopeDialog);return s.modal?i.jsx(co,{present:r||s.open,children:i.jsx(eL,{...o,ref:t})}):null});N1.displayName=rf;var eL=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vr(rf,n);return i.jsx(up,{as:Do,allowPinchZoom:!0,shards:[o.contentRef],children:i.jsx(Ve.div,{"data-state":vy(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),xa="DialogContent",R1=v.forwardRef((e,t)=>{const n=T1(xa,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Vr(xa,e.__scopeDialog);return i.jsx(co,{present:r||s.open,children:s.modal?i.jsx(tL,{...o,ref:t}):i.jsx(nL,{...o,ref:t})})});R1.displayName=xa;var tL=v.forwardRef((e,t)=>{const n=Vr(xa,e.__scopeDialog),r=v.useRef(null),o=ut(t,n.contentRef,r);return v.useEffect(()=>{const s=r.current;if(s)return py(s)},[]),i.jsx(P1,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ce(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&s.preventDefault()}),onFocusOutside:Ce(e.onFocusOutside,s=>s.preventDefault())})}),nL=v.forwardRef((e,t)=>{const n=Vr(xa,e.__scopeDialog),r=v.useRef(!1),o=v.useRef(!1);return i.jsx(P1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,l;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),P1=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...a}=e,l=Vr(xa,n),c=v.useRef(null),u=ut(t,c);return fy(),i.jsxs(i.Fragment,{children:[i.jsx(ip,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:i.jsx(ap,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":vy(l.open),...a,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(rL,{titleId:l.titleId}),i.jsx(sL,{contentRef:c,descriptionId:l.descriptionId})]})]})}),my="DialogTitle",I1=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vr(my,n);return i.jsx(Ve.h2,{id:o.titleId,...r,ref:t})});I1.displayName=my;var D1="DialogDescription",O1=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vr(D1,n);return i.jsx(Ve.p,{id:o.descriptionId,...r,ref:t})});O1.displayName=D1;var M1="DialogClose",A1=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vr(M1,n);return i.jsx(Ve.button,{type:"button",...r,ref:t,onClick:Ce(e.onClick,()=>o.onOpenChange(!1))})});A1.displayName=M1;function vy(e){return e?"open":"closed"}var F1="DialogTitleWarning",[HK,L1]=xA(F1,{contentName:xa,titleName:my,docsSlug:"dialog"}),rL=({titleId:e})=>{const t=L1(F1),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. +`)},G2=0,za=[];function W2(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(G2++)[0],s=v.useState(x1)[0],a=v.useRef(e);v.useEffect(function(){a.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=p2([e.lockRef.current],(e.shards||[]).map(_0),!0).filter(Boolean);return m.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(m,w){if("touches"in m&&m.touches.length===2)return!a.current.allowPinchZoom;var x=Bu(m),y=n.current,b="deltaX"in m?m.deltaX:y[0]-x[0],C="deltaY"in m?m.deltaY:y[1]-x[1],j,S=m.target,k=Math.abs(b)>Math.abs(C)?"h":"v";if("touches"in m&&k==="h"&&S.type==="range")return!1;var E=C0(k,S);if(!E)return!0;if(E?j=k:(j=k==="v"?"h":"v",E=C0(k,S)),!E)return!1;if(!r.current&&"changedTouches"in m&&(b||C)&&(r.current=j),!j)return!0;var O=r.current||j;return U2(O,w,m,O==="h"?b:C,!0)},[]),c=v.useCallback(function(m){var w=m;if(!(!za.length||za[za.length-1]!==s)){var x="deltaY"in w?j0(w):Bu(w),y=t.current.filter(function(j){return j.name===w.type&&(j.target===w.target||w.target===j.shadowParent)&&B2(j.delta,x)})[0];if(y&&y.should){w.cancelable&&w.preventDefault();return}if(!y){var b=(a.current.shards||[]).map(_0).filter(Boolean).filter(function(j){return j.contains(w.target)}),C=b.length>0?l(w,b[0]):!a.current.noIsolation;C&&w.cancelable&&w.preventDefault()}}},[]),u=v.useCallback(function(m,w,x,y){var b={name:m,delta:w,target:x,should:y,shadowParent:K2(x)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(C){return C!==b})},1)},[]),d=v.useCallback(function(m){n.current=Bu(m),r.current=void 0},[]),p=v.useCallback(function(m){u(m.type,j0(m),m.target,l(m,e.lockRef.current))},[]),f=v.useCallback(function(m){u(m.type,Bu(m),m.target,l(m,e.lockRef.current))},[]);v.useEffect(function(){return za.push(s),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",c,$a),document.addEventListener("touchmove",c,$a),document.addEventListener("touchstart",d,$a),function(){za=za.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,$a),document.removeEventListener("touchmove",c,$a),document.removeEventListener("touchstart",d,$a)}},[]);var h=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(s,{styles:H2(o)}):null,h?v.createElement(M2,{gapMode:e.gapMode}):null)}function K2(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const q2=S2(y1,W2);var up=v.forwardRef(function(e,t){return v.createElement(cp,Jr({},e,{ref:t,sideCar:q2}))});up.classNames=cp.classNames;var Z2=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Va=new WeakMap,Hu=new WeakMap,Gu={},Ih=0,C1=function(e){return e&&(e.host||C1(e.parentNode))},J2=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=C1(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Y2=function(e,t,n,r){var o=J2(t,Array.isArray(e)?e:[e]);Gu[n]||(Gu[n]=new WeakMap);var s=Gu[n],a=[],l=new Set,c=new Set(o),u=function(p){!p||l.has(p)||(l.add(p),u(p.parentNode))};o.forEach(u);var d=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(f){if(l.has(f))d(f);else try{var h=f.getAttribute(r),g=h!==null&&h!=="false",m=(Va.get(f)||0)+1,w=(s.get(f)||0)+1;Va.set(f,m),s.set(f,w),a.push(f),m===1&&g&&Hu.set(f,!0),w===1&&f.setAttribute(n,"true"),g||f.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",f,x)}})};return d(t),l.clear(),Ih++,function(){a.forEach(function(p){var f=Va.get(p)-1,h=s.get(p)-1;Va.set(p,f),s.set(p,h),f||(Hu.has(p)||p.removeAttribute(r),Hu.delete(p)),h||p.removeAttribute(n)}),Ih--,Ih||(Va=new WeakMap,Va=new WeakMap,Hu=new WeakMap,Gu={})}},py=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Z2(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),Y2(r,o,n,"aria-hidden")):function(){return null}},hy="Dialog",[j1,BK]=lo(hy),[X2,Vr]=j1(hy),_1=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,l=v.useRef(null),c=v.useRef(null),[u=!1,d]=js({prop:r,defaultProp:o,onChange:s});return i.jsx(X2,{scope:t,triggerRef:l,contentRef:c,contentId:Ir(),titleId:Ir(),descriptionId:Ir(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(p=>!p),[d]),modal:a,children:n})};_1.displayName=hy;var E1="DialogTrigger",T1=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vr(E1,n),s=ut(t,o.triggerRef);return i.jsx(Ve.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":vy(o.open),...r,ref:s,onClick:Ce(e.onClick,o.onOpenToggle)})});T1.displayName=E1;var gy="DialogPortal",[Q2,k1]=j1(gy,{forceMount:void 0}),N1=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Vr(gy,t);return i.jsx(Q2,{scope:t,forceMount:n,children:v.Children.map(r,a=>i.jsx(co,{present:n||s.open,children:i.jsx(lp,{asChild:!0,container:o,children:a})}))})};N1.displayName=gy;var rf="DialogOverlay",R1=v.forwardRef((e,t)=>{const n=k1(rf,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Vr(rf,e.__scopeDialog);return s.modal?i.jsx(co,{present:r||s.open,children:i.jsx(eL,{...o,ref:t})}):null});R1.displayName=rf;var eL=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vr(rf,n);return i.jsx(up,{as:Do,allowPinchZoom:!0,shards:[o.contentRef],children:i.jsx(Ve.div,{"data-state":vy(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),xa="DialogContent",P1=v.forwardRef((e,t)=>{const n=k1(xa,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Vr(xa,e.__scopeDialog);return i.jsx(co,{present:r||s.open,children:s.modal?i.jsx(tL,{...o,ref:t}):i.jsx(nL,{...o,ref:t})})});P1.displayName=xa;var tL=v.forwardRef((e,t)=>{const n=Vr(xa,e.__scopeDialog),r=v.useRef(null),o=ut(t,n.contentRef,r);return v.useEffect(()=>{const s=r.current;if(s)return py(s)},[]),i.jsx(I1,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ce(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&s.preventDefault()}),onFocusOutside:Ce(e.onFocusOutside,s=>s.preventDefault())})}),nL=v.forwardRef((e,t)=>{const n=Vr(xa,e.__scopeDialog),r=v.useRef(!1),o=v.useRef(!1);return i.jsx(I1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,l;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),I1=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...a}=e,l=Vr(xa,n),c=v.useRef(null),u=ut(t,c);return fy(),i.jsxs(i.Fragment,{children:[i.jsx(ip,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:i.jsx(ap,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":vy(l.open),...a,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(rL,{titleId:l.titleId}),i.jsx(sL,{contentRef:c,descriptionId:l.descriptionId})]})]})}),my="DialogTitle",D1=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vr(my,n);return i.jsx(Ve.h2,{id:o.titleId,...r,ref:t})});D1.displayName=my;var O1="DialogDescription",M1=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vr(O1,n);return i.jsx(Ve.p,{id:o.descriptionId,...r,ref:t})});M1.displayName=O1;var A1="DialogClose",F1=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vr(A1,n);return i.jsx(Ve.button,{type:"button",...r,ref:t,onClick:Ce(e.onClick,()=>o.onOpenChange(!1))})});F1.displayName=A1;function vy(e){return e?"open":"closed"}var L1="DialogTitleWarning",[HK,$1]=xA(L1,{contentName:xa,titleName:my,docsSlug:"dialog"}),rL=({titleId:e})=>{const t=$1(L1),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},oL="DialogDescriptionWarning",sL=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${L1(oL).contentName}}.`;return v.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},aL=j1,iL=E1,lL=k1,$1=N1,z1=R1,V1=I1,U1=O1,cL=A1;const Sn=aL,Cn=iL,uL=lL,B1=v.forwardRef(({className:e,...t},n)=>i.jsx($1,{ref:n,className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));B1.displayName=$1.displayName;const un=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(uL,{children:[i.jsx(B1,{}),i.jsxs(z1,{ref:r,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,i.jsxs(cL,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[i.jsx(lA,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));un.displayName=z1.displayName;const dn=({className:e,...t})=>i.jsx("div",{className:Ne("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});dn.displayName="DialogHeader";const wr=({className:e,...t})=>i.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});wr.displayName="DialogFooter";const On=v.forwardRef(({className:e,...t},n)=>i.jsx(V1,{ref:n,className:Ne("text-lg font-semibold leading-none tracking-tight",e),...t}));On.displayName=V1.displayName;const Ri=v.forwardRef(({className:e,...t},n)=>i.jsx(U1,{ref:n,className:Ne("text-sm text-muted-foreground",e),...t}));Ri.displayName=U1.displayName;var iu=e=>e.type==="checkbox",ii=e=>e instanceof Date,kn=e=>e==null;const H1=e=>typeof e=="object";var Jt=e=>!kn(e)&&!Array.isArray(e)&&H1(e)&&!ii(e),G1=e=>Jt(e)&&e.target?iu(e.target)?e.target.checked:e.target.value:e,dL=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,W1=(e,t)=>e.has(dL(t)),fL=e=>{const t=e.constructor&&e.constructor.prototype;return Jt(t)&&t.hasOwnProperty("isPrototypeOf")},yy=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function An(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(yy&&(e instanceof Blob||e instanceof FileList))&&(n||Jt(e)))if(t=n?[]:{},!n&&!fL(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=An(e[r]));else return e;return t}var dp=e=>Array.isArray(e)?e.filter(Boolean):[],Ft=e=>e===void 0,ue=(e,t,n)=>{if(!t||!Jt(e))return n;const r=dp(t.split(/[,[\].]+?/)).reduce((o,s)=>kn(o)?o:o[s],e);return Ft(r)||r===e?Ft(e[t])?n:e[t]:r},Yr=e=>typeof e=="boolean",xy=e=>/^\w*$/.test(e),K1=e=>dp(e.replace(/["|']|\]/g,"").split(/\.|\[/)),at=(e,t,n)=>{let r=-1;const o=xy(t)?[t]:K1(t),s=o.length,a=s-1;for(;++rSe.useContext(q1),Uo=e=>{const{children:t,...n}=e;return Se.createElement(q1.Provider,{value:n},t)};var Z1=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const a=s;return t._proxyFormState[a]!==Tr.all&&(t._proxyFormState[a]=!r||Tr.all),n&&(n[a]=!0),e[a]}});return o},Wn=e=>Jt(e)&&!Object.keys(e).length,J1=(e,t,n,r)=>{n(e);const{name:o,...s}=e;return Wn(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(a=>t[a]===(!r||Tr.all))},Yl=e=>Array.isArray(e)?e:[e],Y1=(e,t,n)=>!e||!t||e===t||Yl(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function wy(e){const t=Se.useRef(e);t.current=e,Se.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function pL(e){const t=fp(),{control:n=t.control,disabled:r,name:o,exact:s}=e||{},[a,l]=Se.useState(n._formState),c=Se.useRef(!0),u=Se.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=Se.useRef(o);return d.current=o,wy({disabled:r,next:p=>c.current&&Y1(d.current,p.name,s)&&J1(p,u.current,n._updateFormState)&&l({...n._formState,...p}),subject:n._subjects.state}),Se.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),Z1(a,n,u.current,!1)}var Xr=e=>typeof e=="string",X1=(e,t,n,r,o)=>Xr(e)?(r&&t.watch.add(e),ue(n,e,o)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),ue(n,s))):(r&&(t.watchAll=!0),n);function hL(e){const t=fp(),{control:n=t.control,name:r,defaultValue:o,disabled:s,exact:a}=e||{},l=Se.useRef(r);l.current=r,wy({disabled:s,subject:n._subjects.values,next:d=>{Y1(l.current,d.name,a)&&u(An(X1(l.current,n._names,d.values||n._formValues,!1,o)))}});const[c,u]=Se.useState(n._getWatch(r,o));return Se.useEffect(()=>n._removeUnmounted()),c}function gL(e){const t=fp(),{name:n,disabled:r,control:o=t.control,shouldUnregister:s}=e,a=W1(o._names.array,n),l=hL({control:o,name:n,defaultValue:ue(o._formValues,n,ue(o._defaultValues,n,e.defaultValue)),exact:!0}),c=pL({control:o,name:n}),u=Se.useRef(o.register(n,{...e.rules,value:l,...Yr(e.disabled)?{disabled:e.disabled}:{}}));return Se.useEffect(()=>{const d=o._options.shouldUnregister||s,p=(f,h)=>{const g=ue(o._fields,f);g&&g._f&&(g._f.mount=h)};if(p(n,!0),d){const f=An(ue(o._options.defaultValues,n));at(o._defaultValues,n,f),Ft(ue(o._formValues,n))&&at(o._formValues,n,f)}return()=>{(a?d&&!o._state.action:d)?o.unregister(n):p(n,!1)}},[n,o,a,s]),Se.useEffect(()=>{ue(o._fields,n)&&o._updateDisabledField({disabled:r,fields:o._fields,name:n,value:ue(o._fields,n)._f.value})},[r,n,o]),{field:{name:n,value:l,...Yr(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:Se.useCallback(d=>u.current.onChange({target:{value:G1(d),name:n},type:of.CHANGE}),[n]),onBlur:Se.useCallback(()=>u.current.onBlur({target:{value:ue(o._formValues,n),name:n},type:of.BLUR}),[n,o]),ref:d=>{const p=ue(o._fields,n);p&&d&&(p._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:f=>d.setCustomValidity(f),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ue(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!ue(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ue(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!ue(c.validatingFields,n)},error:{enumerable:!0,get:()=>ue(c.errors,n)}})}}const mL=e=>e.render(gL(e));var Q1=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},E0=e=>({isOnSubmit:!e||e===Tr.onSubmit,isOnBlur:e===Tr.onBlur,isOnChange:e===Tr.onChange,isOnAll:e===Tr.all,isOnTouch:e===Tr.onTouched}),T0=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Xl=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const s=ue(e,o);if(s){const{_f:a,...l}=s;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],o)&&!r)break;if(a.ref&&t(a.ref,a.name)&&!r)break;Xl(l,t)}else Jt(l)&&Xl(l,t)}}};var vL=(e,t,n)=>{const r=Yl(ue(e,n));return at(r,"root",t[n]),at(e,n,r),e},by=e=>e.type==="file",ds=e=>typeof e=="function",sf=e=>{if(!yy)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},xd=e=>Xr(e),Sy=e=>e.type==="radio",af=e=>e instanceof RegExp;const k0={value:!1,isValid:!1},N0={value:!0,isValid:!0};var eE=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ft(e[0].attributes.value)?Ft(e[0].value)||e[0].value===""?N0:{value:e[0].value,isValid:!0}:N0:k0}return k0};const R0={isValid:!1,value:null};var tE=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,R0):R0;function P0(e,t,n="validate"){if(xd(e)||Array.isArray(e)&&e.every(xd)||Yr(e)&&!e)return{type:n,message:xd(e)?e:"",ref:t}}var Va=e=>Jt(e)&&!af(e)?e:{value:e,message:""},I0=async(e,t,n,r,o)=>{const{ref:s,refs:a,required:l,maxLength:c,minLength:u,min:d,max:p,pattern:f,validate:h,name:g,valueAsNumber:m,mount:w,disabled:x}=e._f,y=ue(t,g);if(!w||x)return{};const b=a?a[0]:s,C=I=>{r&&b.reportValidity&&(b.setCustomValidity(Yr(I)?"":I||""),b.reportValidity())},j={},S=Sy(s),k=iu(s),E=S||k,O=(m||by(s))&&Ft(s.value)&&Ft(y)||sf(s)&&s.value===""||y===""||Array.isArray(y)&&!y.length,F=Q1.bind(null,g,n,j),Z=(I,q,H,J=ho.maxLength,ne=ho.minLength)=>{const K=I?q:H;j[g]={type:I?J:ne,message:K,ref:s,...F(I?J:ne,K)}};if(o?!Array.isArray(y)||!y.length:l&&(!E&&(O||kn(y))||Yr(y)&&!y||k&&!eE(a).isValid||S&&!tE(a).isValid)){const{value:I,message:q}=xd(l)?{value:!!l,message:l}:Va(l);if(I&&(j[g]={type:ho.required,message:q,ref:b,...F(ho.required,q)},!n))return C(q),j}if(!O&&(!kn(d)||!kn(p))){let I,q;const H=Va(p),J=Va(d);if(!kn(y)&&!isNaN(y)){const ne=s.valueAsNumber||y&&+y;kn(H.value)||(I=ne>H.value),kn(J.value)||(q=nenew Date(new Date().toDateString()+" "+ee),z=s.type=="time",L=s.type=="week";Xr(H.value)&&y&&(I=z?K(y)>K(H.value):L?y>H.value:ne>new Date(H.value)),Xr(J.value)&&y&&(q=z?K(y)+I.value,J=!kn(q.value)&&y.length<+q.value;if((H||J)&&(Z(H,I.message,q.message),!n))return C(j[g].message),j}if(f&&!O&&Xr(y)){const{value:I,message:q}=Va(f);if(af(I)&&!y.match(I)&&(j[g]={type:ho.pattern,message:q,ref:s,...F(ho.pattern,q)},!n))return C(q),j}if(h){if(ds(h)){const I=await h(y,t),q=P0(I,b);if(q&&(j[g]={...q,...F(ho.validate,q.message)},!n))return C(q.message),j}else if(Jt(h)){let I={};for(const q in h){if(!Wn(I)&&!n)break;const H=P0(await h[q](y,t),b,q);H&&(I={...H,...F(q,H.message)},C(H.message),n&&(j[g]=I))}if(!Wn(I)&&(j[g]={ref:b,...I},!n))return j}}return C(!0),j};function yL(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},lf=e=>kn(e)||!H1(e);function ra(e,t){if(lf(e)||lf(t))return e===t;if(ii(e)&&ii(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const a=t[o];if(ii(s)&&ii(a)||Jt(s)&&Jt(a)||Array.isArray(s)&&Array.isArray(a)?!ra(s,a):s!==a)return!1}}return!0}var nE=e=>e.type==="select-multiple",wL=e=>Sy(e)||iu(e),Oh=e=>sf(e)&&e.isConnected,rE=e=>{for(const t in e)if(ds(e[t]))return!0;return!1};function cf(e,t={}){const n=Array.isArray(e);if(Jt(e)||n)for(const r in e)Array.isArray(e[r])||Jt(e[r])&&!rE(e[r])?(t[r]=Array.isArray(e[r])?[]:{},cf(e[r],t[r])):kn(e[r])||(t[r]=!0);return t}function oE(e,t,n){const r=Array.isArray(e);if(Jt(e)||r)for(const o in e)Array.isArray(e[o])||Jt(e[o])&&!rE(e[o])?Ft(t)||lf(n[o])?n[o]=Array.isArray(e[o])?cf(e[o],[]):{...cf(e[o])}:oE(e[o],kn(t)?{}:t[o],n[o]):n[o]=!ra(e[o],t[o]);return n}var Wu=(e,t)=>oE(e,t,cf(t)),sE=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Ft(e)?e:t?e===""?NaN:e&&+e:n&&Xr(e)?new Date(e):r?r(e):e;function Mh(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return by(t)?t.files:Sy(t)?tE(e.refs).value:nE(t)?[...t.selectedOptions].map(({value:n})=>n):iu(t)?eE(e.refs).value:sE(Ft(t.value)?e.ref.value:t.value,e)}var bL=(e,t,n,r)=>{const o={};for(const s of e){const a=ue(t,s);a&&at(o,s,a._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},bl=e=>Ft(e)?e:af(e)?e.source:Jt(e)?af(e.value)?e.value.source:e.value:e,SL=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function D0(e,t,n){const r=ue(e,n);if(r||xy(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const s=o.join("."),a=ue(t,s),l=ue(e,s);if(a&&!Array.isArray(a)&&n!==s)return{name:n};if(l&&l.type)return{name:s,error:l};o.pop()}return{name:n}}var CL=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,jL=(e,t)=>!dp(ue(e,t)).length&&Kt(e,t);const _L={mode:Tr.onSubmit,reValidateMode:Tr.onChange,shouldFocusError:!0};function EL(e={}){let t={..._L,...e},n={submitCount:0,isDirty:!1,isLoading:ds(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=Jt(t.defaultValues)||Jt(t.values)?An(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:An(o),a={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={values:Dh(),array:Dh(),state:Dh()},f=E0(t.mode),h=E0(t.reValidateMode),g=t.criteriaMode===Tr.all,m=_=>D=>{clearTimeout(u),u=setTimeout(_,D)},w=async _=>{if(d.isValid||_){const D=t.resolver?Wn((await E()).errors):await F(r,!0);D!==n.isValid&&p.state.next({isValid:D})}},x=(_,D)=>{(d.isValidating||d.validatingFields)&&((_||Array.from(l.mount)).forEach(U=>{U&&(D?at(n.validatingFields,U,D):Kt(n.validatingFields,U))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Wn(n.validatingFields)}))},y=(_,D=[],U,pe,le=!0,oe=!0)=>{if(pe&&U){if(a.action=!0,oe&&Array.isArray(ue(r,_))){const be=U(ue(r,_),pe.argA,pe.argB);le&&at(r,_,be)}if(oe&&Array.isArray(ue(n.errors,_))){const be=U(ue(n.errors,_),pe.argA,pe.argB);le&&at(n.errors,_,be),jL(n.errors,_)}if(d.touchedFields&&oe&&Array.isArray(ue(n.touchedFields,_))){const be=U(ue(n.touchedFields,_),pe.argA,pe.argB);le&&at(n.touchedFields,_,be)}d.dirtyFields&&(n.dirtyFields=Wu(o,s)),p.state.next({name:_,isDirty:I(_,D),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else at(s,_,D)},b=(_,D)=>{at(n.errors,_,D),p.state.next({errors:n.errors})},C=_=>{n.errors=_,p.state.next({errors:n.errors,isValid:!1})},j=(_,D,U,pe)=>{const le=ue(r,_);if(le){const oe=ue(s,_,Ft(U)?ue(o,_):U);Ft(oe)||pe&&pe.defaultChecked||D?at(s,_,D?oe:Mh(le._f)):J(_,oe),a.mount&&w()}},S=(_,D,U,pe,le)=>{let oe=!1,be=!1;const Je={name:_},yt=!!(ue(r,_)&&ue(r,_)._f&&ue(r,_)._f.disabled);if(!U||pe){d.isDirty&&(be=n.isDirty,n.isDirty=Je.isDirty=I(),oe=be!==Je.isDirty);const Yt=yt||ra(ue(o,_),D);be=!!(!yt&&ue(n.dirtyFields,_)),Yt||yt?Kt(n.dirtyFields,_):at(n.dirtyFields,_,!0),Je.dirtyFields=n.dirtyFields,oe=oe||d.dirtyFields&&be!==!Yt}if(U){const Yt=ue(n.touchedFields,_);Yt||(at(n.touchedFields,_,U),Je.touchedFields=n.touchedFields,oe=oe||d.touchedFields&&Yt!==U)}return oe&&le&&p.state.next(Je),oe?Je:{}},k=(_,D,U,pe)=>{const le=ue(n.errors,_),oe=d.isValid&&Yr(D)&&n.isValid!==D;if(e.delayError&&U?(c=m(()=>b(_,U)),c(e.delayError)):(clearTimeout(u),c=null,U?at(n.errors,_,U):Kt(n.errors,_)),(U?!ra(le,U):le)||!Wn(pe)||oe){const be={...pe,...oe&&Yr(D)?{isValid:D}:{},errors:n.errors,name:_};n={...n,...be},p.state.next(be)}},E=async _=>{x(_,!0);const D=await t.resolver(s,t.context,bL(_||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return x(_),D},O=async _=>{const{errors:D}=await E(_);if(_)for(const U of _){const pe=ue(D,U);pe?at(n.errors,U,pe):Kt(n.errors,U)}else n.errors=D;return D},F=async(_,D,U={valid:!0})=>{for(const pe in _){const le=_[pe];if(le){const{_f:oe,...be}=le;if(oe){const Je=l.array.has(oe.name);x([pe],!0);const yt=await I0(le,s,g,t.shouldUseNativeValidation&&!D,Je);if(x([pe]),yt[oe.name]&&(U.valid=!1,D))break;!D&&(ue(yt,oe.name)?Je?vL(n.errors,yt,oe.name):at(n.errors,oe.name,yt[oe.name]):Kt(n.errors,oe.name))}be&&await F(be,D,U)}}return U.valid},Z=()=>{for(const _ of l.unMount){const D=ue(r,_);D&&(D._f.refs?D._f.refs.every(U=>!Oh(U)):!Oh(D._f.ref))&&re(_)}l.unMount=new Set},I=(_,D)=>(_&&D&&at(s,_,D),!ra(fe(),o)),q=(_,D,U)=>X1(_,l,{...a.mount?s:Ft(D)?o:Xr(_)?{[_]:D}:D},U,D),H=_=>dp(ue(a.mount?s:o,_,e.shouldUnregister?ue(o,_,[]):[])),J=(_,D,U={})=>{const pe=ue(r,_);let le=D;if(pe){const oe=pe._f;oe&&(!oe.disabled&&at(s,_,sE(D,oe)),le=sf(oe.ref)&&kn(D)?"":D,nE(oe.ref)?[...oe.ref.options].forEach(be=>be.selected=le.includes(be.value)):oe.refs?iu(oe.ref)?oe.refs.length>1?oe.refs.forEach(be=>(!be.defaultChecked||!be.disabled)&&(be.checked=Array.isArray(le)?!!le.find(Je=>Je===be.value):le===be.value)):oe.refs[0]&&(oe.refs[0].checked=!!le):oe.refs.forEach(be=>be.checked=be.value===le):by(oe.ref)?oe.ref.value="":(oe.ref.value=le,oe.ref.type||p.values.next({name:_,values:{...s}})))}(U.shouldDirty||U.shouldTouch)&&S(_,le,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&ee(_)},ne=(_,D,U)=>{for(const pe in D){const le=D[pe],oe=`${_}.${pe}`,be=ue(r,oe);(l.array.has(_)||!lf(le)||be&&!be._f)&&!ii(le)?ne(oe,le,U):J(oe,le,U)}},K=(_,D,U={})=>{const pe=ue(r,_),le=l.array.has(_),oe=An(D);at(s,_,oe),le?(p.array.next({name:_,values:{...s}}),(d.isDirty||d.dirtyFields)&&U.shouldDirty&&p.state.next({name:_,dirtyFields:Wu(o,s),isDirty:I(_,oe)})):pe&&!pe._f&&!kn(oe)?ne(_,oe,U):J(_,oe,U),T0(_,l)&&p.state.next({...n}),p.values.next({name:a.mount?_:void 0,values:{...s}})},z=async _=>{a.mount=!0;const D=_.target;let U=D.name,pe=!0;const le=ue(r,U),oe=()=>D.type?Mh(le._f):G1(_),be=Je=>{pe=Number.isNaN(Je)||Je===ue(s,U,Je)};if(le){let Je,yt;const Yt=oe(),rn=_.type===of.BLUR||_.type===of.FOCUS_OUT,Xt=!SL(le._f)&&!t.resolver&&!ue(n.errors,U)&&!le._f.deps||CL(rn,ue(n.touchedFields,U),n.isSubmitted,h,f),qo=T0(U,l,rn);at(s,U,Yt),rn?(le._f.onBlur&&le._f.onBlur(_),c&&c(0)):le._f.onChange&&le._f.onChange(_);const Ur=S(U,Yt,rn,!1),Bs=!Wn(Ur)||qo;if(!rn&&p.values.next({name:U,type:_.type,values:{...s}}),Xt)return d.isValid&&w(),Bs&&p.state.next({name:U,...qo?{}:Ur});if(!rn&&qo&&p.state.next({...n}),t.resolver){const{errors:_n}=await E([U]);if(be(Yt),pe){const ce=D0(n.errors,r,U),ze=D0(_n,r,ce.name||U);Je=ze.error,U=ze.name,yt=Wn(_n)}}else x([U],!0),Je=(await I0(le,s,g,t.shouldUseNativeValidation))[U],x([U]),be(Yt),pe&&(Je?yt=!1:d.isValid&&(yt=await F(r,!0)));pe&&(le._f.deps&&ee(le._f.deps),k(U,yt,Je,Ur))}},L=(_,D)=>{if(ue(n.errors,D)&&_.focus)return _.focus(),1},ee=async(_,D={})=>{let U,pe;const le=Yl(_);if(t.resolver){const oe=await O(Ft(_)?_:le);U=Wn(oe),pe=_?!le.some(be=>ue(oe,be)):U}else _?(pe=(await Promise.all(le.map(async oe=>{const be=ue(r,oe);return await F(be&&be._f?{[oe]:be}:be)}))).every(Boolean),!(!pe&&!n.isValid)&&w()):pe=U=await F(r);return p.state.next({...!Xr(_)||d.isValid&&U!==n.isValid?{}:{name:_},...t.resolver||!_?{isValid:U}:{},errors:n.errors}),D.shouldFocus&&!pe&&Xl(r,L,_?le:l.mount),pe},fe=_=>{const D={...a.mount?s:o};return Ft(_)?D:Xr(_)?ue(D,_):_.map(U=>ue(D,U))},B=(_,D)=>({invalid:!!ue((D||n).errors,_),isDirty:!!ue((D||n).dirtyFields,_),error:ue((D||n).errors,_),isValidating:!!ue(n.validatingFields,_),isTouched:!!ue((D||n).touchedFields,_)}),te=_=>{_&&Yl(_).forEach(D=>Kt(n.errors,D)),p.state.next({errors:_?n.errors:{}})},X=(_,D,U)=>{const pe=(ue(r,_,{_f:{}})._f||{}).ref,le=ue(n.errors,_)||{},{ref:oe,message:be,type:Je,...yt}=le;at(n.errors,_,{...yt,...D,ref:pe}),p.state.next({name:_,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&pe&&pe.focus&&pe.focus()},ie=(_,D)=>ds(_)?p.values.subscribe({next:U=>_(q(void 0,D),U)}):q(_,D,!0),re=(_,D={})=>{for(const U of _?Yl(_):l.mount)l.mount.delete(U),l.array.delete(U),D.keepValue||(Kt(r,U),Kt(s,U)),!D.keepError&&Kt(n.errors,U),!D.keepDirty&&Kt(n.dirtyFields,U),!D.keepTouched&&Kt(n.touchedFields,U),!D.keepIsValidating&&Kt(n.validatingFields,U),!t.shouldUnregister&&!D.keepDefaultValue&&Kt(o,U);p.values.next({values:{...s}}),p.state.next({...n,...D.keepDirty?{isDirty:I()}:{}}),!D.keepIsValid&&w()},W=({disabled:_,name:D,field:U,fields:pe,value:le})=>{if(Yr(_)&&a.mount||_){const oe=_?void 0:Ft(le)?Mh(U?U._f:ue(pe,D)._f):le;at(s,D,oe),S(D,oe,!1,!1,!0)}},we=(_,D={})=>{let U=ue(r,_);const pe=Yr(D.disabled);return at(r,_,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:_}},name:_,mount:!0,...D}}),l.mount.add(_),U?W({field:U,disabled:D.disabled,name:_,value:D.value}):j(_,!0,D.value),{...pe?{disabled:D.disabled}:{},...t.progressive?{required:!!D.required,min:bl(D.min),max:bl(D.max),minLength:bl(D.minLength),maxLength:bl(D.maxLength),pattern:bl(D.pattern)}:{},name:_,onChange:z,onBlur:z,ref:le=>{if(le){we(_,D),U=ue(r,_);const oe=Ft(le.value)&&le.querySelectorAll&&le.querySelectorAll("input,select,textarea")[0]||le,be=wL(oe),Je=U._f.refs||[];if(be?Je.find(yt=>yt===oe):oe===U._f.ref)return;at(r,_,{_f:{...U._f,...be?{refs:[...Je.filter(Oh),oe,...Array.isArray(ue(o,_))?[{}]:[]],ref:{type:oe.type,name:_}}:{ref:oe}}}),j(_,!1,void 0,oe)}else U=ue(r,_,{}),U._f&&(U._f.mount=!1),(t.shouldUnregister||D.shouldUnregister)&&!(W1(l.array,_)&&a.action)&&l.unMount.add(_)}}},Re=()=>t.shouldFocusError&&Xl(r,L,l.mount),Fe=_=>{Yr(_)&&(p.state.next({disabled:_}),Xl(r,(D,U)=>{const pe=ue(r,U);pe&&(D.disabled=pe._f.disabled||_,Array.isArray(pe._f.refs)&&pe._f.refs.forEach(le=>{le.disabled=pe._f.disabled||_}))},0,!1))},Pe=(_,D)=>async U=>{let pe;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let le=An(s);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:oe,values:be}=await E();n.errors=oe,le=be}else await F(r);if(Kt(n.errors,"root"),Wn(n.errors)){p.state.next({errors:{}});try{await _(le,U)}catch(oe){pe=oe}}else D&&await D({...n.errors},U),Re(),setTimeout(Re);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Wn(n.errors)&&!pe,submitCount:n.submitCount+1,errors:n.errors}),pe)throw pe},ge=(_,D={})=>{ue(r,_)&&(Ft(D.defaultValue)?K(_,An(ue(o,_))):(K(_,D.defaultValue),at(o,_,An(D.defaultValue))),D.keepTouched||Kt(n.touchedFields,_),D.keepDirty||(Kt(n.dirtyFields,_),n.isDirty=D.defaultValue?I(_,An(ue(o,_))):I()),D.keepError||(Kt(n.errors,_),d.isValid&&w()),p.state.next({...n}))},Xe=(_,D={})=>{const U=_?An(_):o,pe=An(U),le=Wn(_),oe=le?o:pe;if(D.keepDefaultValues||(o=U),!D.keepValues){if(D.keepDirtyValues)for(const be of l.mount)ue(n.dirtyFields,be)?at(oe,be,ue(s,be)):K(be,ue(oe,be));else{if(yy&&Ft(_))for(const be of l.mount){const Je=ue(r,be);if(Je&&Je._f){const yt=Array.isArray(Je._f.refs)?Je._f.refs[0]:Je._f.ref;if(sf(yt)){const Yt=yt.closest("form");if(Yt){Yt.reset();break}}}}r={}}s=e.shouldUnregister?D.keepDefaultValues?An(o):{}:An(oe),p.array.next({values:{...oe}}),p.values.next({values:{...oe}})}l={mount:D.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!d.isValid||!!D.keepIsValid||!!D.keepDirtyValues,a.watch=!!e.shouldUnregister,p.state.next({submitCount:D.keepSubmitCount?n.submitCount:0,isDirty:le?!1:D.keepDirty?n.isDirty:!!(D.keepDefaultValues&&!ra(_,o)),isSubmitted:D.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:le?{}:D.keepDirtyValues?D.keepDefaultValues&&s?Wu(o,s):n.dirtyFields:D.keepDefaultValues&&_?Wu(o,_):D.keepDirty?n.dirtyFields:{},touchedFields:D.keepTouched?n.touchedFields:{},errors:D.keepErrors?n.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},kt=(_,D)=>Xe(ds(_)?_(s):_,D);return{control:{register:we,unregister:re,getFieldState:B,handleSubmit:Pe,setError:X,_executeSchema:E,_getWatch:q,_getDirty:I,_updateValid:w,_removeUnmounted:Z,_updateFieldArray:y,_updateDisabledField:W,_getFieldArray:H,_reset:Xe,_resetDefaultValues:()=>ds(t.defaultValues)&&t.defaultValues().then(_=>{kt(_,t.resetOptions),p.state.next({isLoading:!1})}),_updateFormState:_=>{n={...n,..._}},_disableForm:Fe,_subjects:p,_proxyFormState:d,_setErrors:C,get _fields(){return r},get _formValues(){return s},get _state(){return a},set _state(_){a=_},get _defaultValues(){return o},get _names(){return l},set _names(_){l=_},get _formState(){return n},set _formState(_){n=_},get _options(){return t},set _options(_){t={...t,..._}}},trigger:ee,register:we,handleSubmit:Pe,watch:ie,setValue:K,getValues:fe,reset:kt,resetField:ge,clearErrors:te,unregister:re,setError:X,setFocus:(_,D={})=>{const U=ue(r,_),pe=U&&U._f;if(pe){const le=pe.refs?pe.refs[0]:pe.ref;le.focus&&(le.focus(),D.shouldSelect&&le.select())}},getFieldState:B}}function tn(e={}){const t=Se.useRef(),n=Se.useRef(),[r,o]=Se.useState({isDirty:!1,isValidating:!1,isLoading:ds(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ds(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...EL(e),formState:r});const s=t.current.control;return s._options=e,wy({subject:s._subjects.state,next:a=>{J1(a,s._proxyFormState,s._updateFormState,!0)&&o({...s._formState})}}),Se.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),Se.useEffect(()=>{if(s._proxyFormState.isDirty){const a=s._getDirty();a!==r.isDirty&&s._subjects.state.next({isDirty:a})}},[s,r.isDirty]),Se.useEffect(()=>{e.values&&!ra(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,o(a=>({...a}))):s._resetDefaultValues()},[e.values,s]),Se.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),Se.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),Se.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),t.current.formState=Z1(r,s),t.current}var TL="Label",aE=v.forwardRef((e,t)=>i.jsx(Ve.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));aE.displayName=TL;var iE=aE;const kL=l1("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),fs=v.forwardRef(({className:e,...t},n)=>i.jsx(iE,{ref:n,className:Ne(kL(),e),...t}));fs.displayName=iE.displayName;const uo=Uo,lE=v.createContext({}),P=({...e})=>i.jsx(lE.Provider,{value:{name:e.name},children:i.jsx(mL,{...e})}),pp=()=>{const e=v.useContext(lE),t=v.useContext(cE),{getFieldState:n,formState:r}=fp(),o=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...o}},cE=v.createContext({}),M=v.forwardRef(({className:e,...t},n)=>{const r=v.useId();return i.jsx(cE.Provider,{value:{id:r},children:i.jsx("div",{ref:n,className:Ne("space-y-2",e),...t})})});M.displayName="FormItem";const A=v.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:o}=pp();return i.jsx(fs,{ref:n,className:Ne(r&&"text-destructive",e),htmlFor:o,...t})});A.displayName="FormLabel";const ae=v.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:o,formMessageId:s}=pp();return i.jsx(Do,{ref:t,id:r,"aria-describedby":n?`${o} ${s}`:`${o}`,"aria-invalid":!!n,...e})});ae.displayName="FormControl";const $t=v.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=pp();return i.jsx("p",{ref:n,id:r,className:Ne("text-sm text-muted-foreground",e),...t})});$t.displayName="FormDescription";const NL=v.forwardRef(({className:e,children:t,...n},r)=>{const{error:o,formMessageId:s}=pp(),a=o?String(o==null?void 0:o.message):t;return a?i.jsx("p",{ref:r,id:s,className:Ne("text-sm font-medium text-destructive",e),...n,children:a}):null});NL.displayName="FormMessage";const se=v.forwardRef(({className:e,type:t,...n},r)=>i.jsx("input",{type:t,className:Ne("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));se.displayName="Input";function O0(e,[t,n]){return Math.min(n,Math.max(t,e))}function Cy(e){const t=e+"CollectionProvider",[n,r]=lo(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=h=>{const{scope:g,children:m}=h,w=Se.useRef(null),x=Se.useRef(new Map).current;return i.jsx(o,{scope:g,itemMap:x,collectionRef:w,children:m})};a.displayName=t;const l=e+"CollectionSlot",c=Se.forwardRef((h,g)=>{const{scope:m,children:w}=h,x=s(l,m),y=ut(g,x.collectionRef);return i.jsx(Do,{ref:y,children:w})});c.displayName=l;const u=e+"CollectionItemSlot",d="data-radix-collection-item",p=Se.forwardRef((h,g)=>{const{scope:m,children:w,...x}=h,y=Se.useRef(null),b=ut(g,y),C=s(u,m);return Se.useEffect(()=>(C.itemMap.set(y,{ref:y,...x}),()=>void C.itemMap.delete(y))),i.jsx(Do,{[d]:"",ref:b,children:w})});p.displayName=u;function f(h){const g=s(e+"CollectionConsumer",h);return Se.useCallback(()=>{const w=g.collectionRef.current;if(!w)return[];const x=Array.from(w.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((C,j)=>x.indexOf(C.ref.current)-x.indexOf(j.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:a,Slot:c,ItemSlot:p},f,r]}var RL=v.createContext(void 0);function hp(e){const t=v.useContext(RL);return e||t||"ltr"}const PL=["top","right","bottom","left"],Qr=Math.min,Jn=Math.max,uf=Math.round,Ku=Math.floor,_s=e=>({x:e,y:e}),IL={left:"right",right:"left",bottom:"top",top:"bottom"},DL={start:"end",end:"start"};function hm(e,t,n){return Jn(e,Qr(t,n))}function Oo(e,t){return typeof e=="function"?e(t):e}function Mo(e){return e.split("-")[0]}function Gi(e){return e.split("-")[1]}function jy(e){return e==="x"?"y":"x"}function _y(e){return e==="y"?"height":"width"}function Es(e){return["top","bottom"].includes(Mo(e))?"y":"x"}function Ey(e){return jy(Es(e))}function OL(e,t,n){n===void 0&&(n=!1);const r=Gi(e),o=Ey(e),s=_y(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=df(a)),[a,df(a)]}function ML(e){const t=df(e);return[gm(e),t,gm(t)]}function gm(e){return e.replace(/start|end/g,t=>DL[t])}function AL(e,t,n){const r=["left","right"],o=["right","left"],s=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?s:a;default:return[]}}function FL(e,t,n,r){const o=Gi(e);let s=AL(Mo(e),n==="start",r);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(gm)))),s}function df(e){return e.replace(/left|right|bottom|top/g,t=>IL[t])}function LL(e){return{top:0,right:0,bottom:0,left:0,...e}}function uE(e){return typeof e!="number"?LL(e):{top:e,right:e,bottom:e,left:e}}function ff(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function M0(e,t,n){let{reference:r,floating:o}=e;const s=Es(t),a=Ey(t),l=_y(a),c=Mo(t),u=s==="y",d=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let h;switch(c){case"top":h={x:d,y:r.y-o.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:p};break;case"left":h={x:r.x-o.width,y:p};break;default:h={x:r.x,y:r.y}}switch(Gi(t)){case"start":h[a]-=f*(n&&u?-1:1);break;case"end":h[a]+=f*(n&&u?-1:1);break}return h}const $L=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,l=s.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:p}=M0(u,r,c),f=r,h={},g=0;for(let m=0;m({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=Oo(e,t)||{};if(u==null)return{};const p=uE(d),f={x:n,y:r},h=Ey(o),g=_y(h),m=await a.getDimensions(u),w=h==="y",x=w?"top":"left",y=w?"bottom":"right",b=w?"clientHeight":"clientWidth",C=s.reference[g]+s.reference[h]-f[h]-s.floating[g],j=f[h]-s.reference[h],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let k=S?S[b]:0;(!k||!await(a.isElement==null?void 0:a.isElement(S)))&&(k=l.floating[b]||s.floating[g]);const E=C/2-j/2,O=k/2-m[g]/2-1,F=Qr(p[x],O),Z=Qr(p[y],O),I=F,q=k-m[g]-Z,H=k/2-m[g]/2+E,J=hm(I,H,q),ne=!c.arrow&&Gi(o)!=null&&H!==J&&s.reference[g]/2-(HH<=0)){var Z,I;const H=(((Z=s.flip)==null?void 0:Z.index)||0)+1,J=k[H];if(J)return{data:{index:H,overflows:F},reset:{placement:J}};let ne=(I=F.filter(K=>K.overflows[0]<=0).sort((K,z)=>K.overflows[1]-z.overflows[1])[0])==null?void 0:I.placement;if(!ne)switch(h){case"bestFit":{var q;const K=(q=F.filter(z=>{if(S){const L=Es(z.placement);return L===y||L==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(L=>L>0).reduce((L,ee)=>L+ee,0)]).sort((z,L)=>z[1]-L[1])[0])==null?void 0:q[0];K&&(ne=K);break}case"initialPlacement":ne=l;break}if(o!==ne)return{reset:{placement:ne}}}return{}}}};function A0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function F0(e){return PL.some(t=>e[t]>=0)}const UL=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Oo(e,t);switch(r){case"referenceHidden":{const s=await Ec(t,{...o,elementContext:"reference"}),a=A0(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:F0(a)}}}case"escaped":{const s=await Ec(t,{...o,altBoundary:!0}),a=A0(s,n.floating);return{data:{escapedOffsets:a,escaped:F0(a)}}}default:return{}}}}};async function BL(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=Mo(n),l=Gi(n),c=Es(n)==="y",u=["left","top"].includes(a)?-1:1,d=s&&c?-1:1,p=Oo(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*d,y:f*u}:{x:f*u,y:h*d}}const HL=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:l}=t,c=await BL(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:a}}}}},GL=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:w=>{let{x,y}=w;return{x,y}}},...c}=Oo(e,t),u={x:n,y:r},d=await Ec(t,c),p=Es(Mo(o)),f=jy(p);let h=u[f],g=u[p];if(s){const w=f==="y"?"top":"left",x=f==="y"?"bottom":"right",y=h+d[w],b=h-d[x];h=hm(y,h,b)}if(a){const w=p==="y"?"top":"left",x=p==="y"?"bottom":"right",y=g+d[w],b=g-d[x];g=hm(y,g,b)}const m=l.fn({...t,[f]:h,[p]:g});return{...m,data:{x:m.x-n,y:m.y-r}}}}},WL=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Oo(e,t),d={x:n,y:r},p=Es(o),f=jy(p);let h=d[f],g=d[p];const m=Oo(l,t),w=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const b=f==="y"?"height":"width",C=s.reference[f]-s.floating[b]+w.mainAxis,j=s.reference[f]+s.reference[b]-w.mainAxis;hj&&(h=j)}if(u){var x,y;const b=f==="y"?"width":"height",C=["top","left"].includes(Mo(o)),j=s.reference[p]-s.floating[b]+(C&&((x=a.offset)==null?void 0:x[p])||0)+(C?0:w.crossAxis),S=s.reference[p]+s.reference[b]+(C?0:((y=a.offset)==null?void 0:y[p])||0)-(C?w.crossAxis:0);gS&&(g=S)}return{[f]:h,[p]:g}}}},KL=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:a=()=>{},...l}=Oo(e,t),c=await Ec(t,l),u=Mo(n),d=Gi(n),p=Es(n)==="y",{width:f,height:h}=r.floating;let g,m;u==="top"||u==="bottom"?(g=u,m=d===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(m=u,g=d==="end"?"top":"bottom");const w=h-c.top-c.bottom,x=f-c.left-c.right,y=Qr(h-c[g],w),b=Qr(f-c[m],x),C=!t.middlewareData.shift;let j=y,S=b;if(p?S=d||C?Qr(b,x):x:j=d||C?Qr(y,w):w,C&&!d){const E=Jn(c.left,0),O=Jn(c.right,0),F=Jn(c.top,0),Z=Jn(c.bottom,0);p?S=f-2*(E!==0||O!==0?E+O:Jn(c.left,c.right)):j=h-2*(F!==0||Z!==0?F+Z:Jn(c.top,c.bottom))}await a({...t,availableWidth:S,availableHeight:j});const k=await o.getDimensions(s.floating);return f!==k.width||h!==k.height?{reset:{rects:!0}}:{}}}};function Wi(e){return dE(e)?(e.nodeName||"").toLowerCase():"#document"}function er(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Bo(e){var t;return(t=(dE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function dE(e){return e instanceof Node||e instanceof er(e).Node}function oo(e){return e instanceof Element||e instanceof er(e).Element}function so(e){return e instanceof HTMLElement||e instanceof er(e).HTMLElement}function L0(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof er(e).ShadowRoot}function lu(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Fr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function qL(e){return["table","td","th"].includes(Wi(e))}function gp(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Ty(e){const t=ky(),n=Fr(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function ZL(e){let t=Ts(e);for(;so(t)&&!Pi(t);){if(gp(t))return null;if(Ty(t))return t;t=Ts(t)}return null}function ky(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Pi(e){return["html","body","#document"].includes(Wi(e))}function Fr(e){return er(e).getComputedStyle(e)}function mp(e){return oo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ts(e){if(Wi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||L0(e)&&e.host||Bo(e);return L0(t)?t.host:t}function fE(e){const t=Ts(e);return Pi(t)?e.ownerDocument?e.ownerDocument.body:e.body:so(t)&&lu(t)?t:fE(t)}function Tc(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=fE(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),a=er(o);return s?t.concat(a,a.visualViewport||[],lu(o)?o:[],a.frameElement&&n?Tc(a.frameElement):[]):t.concat(o,Tc(o,[],n))}function pE(e){const t=Fr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=so(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=uf(n)!==s||uf(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function Ny(e){return oo(e)?e:e.contextElement}function vi(e){const t=Ny(e);if(!so(t))return _s(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=pE(t);let a=(s?uf(n.width):n.width)/r,l=(s?uf(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const JL=_s(0);function hE(e){const t=er(e);return!ky()||!t.visualViewport?JL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function YL(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==er(e)?!1:t}function wa(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ny(e);let a=_s(1);t&&(r?oo(r)&&(a=vi(r)):a=vi(e));const l=YL(s,n,r)?hE(s):_s(0);let c=(o.left+l.x)/a.x,u=(o.top+l.y)/a.y,d=o.width/a.x,p=o.height/a.y;if(s){const f=er(s),h=r&&oo(r)?er(r):r;let g=f,m=g.frameElement;for(;m&&r&&h!==g;){const w=vi(m),x=m.getBoundingClientRect(),y=Fr(m),b=x.left+(m.clientLeft+parseFloat(y.paddingLeft))*w.x,C=x.top+(m.clientTop+parseFloat(y.paddingTop))*w.y;c*=w.x,u*=w.y,d*=w.x,p*=w.y,c+=b,u+=C,g=er(m),m=g.frameElement}}return ff({width:d,height:p,x:c,y:u})}function XL(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",a=Bo(r),l=t?gp(t.floating):!1;if(r===a||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=_s(1);const d=_s(0),p=so(r);if((p||!p&&!s)&&((Wi(r)!=="body"||lu(a))&&(c=mp(r)),so(r))){const f=wa(r);u=vi(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function QL(e){return Array.from(e.getClientRects())}function gE(e){return wa(Bo(e)).left+mp(e).scrollLeft}function e$(e){const t=Bo(e),n=mp(e),r=e.ownerDocument.body,o=Jn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Jn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+gE(e);const l=-n.scrollTop;return Fr(r).direction==="rtl"&&(a+=Jn(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:l}}function t$(e,t){const n=er(e),r=Bo(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,l=0,c=0;if(o){s=o.width,a=o.height;const u=ky();(!u||u&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}return{width:s,height:a,x:l,y:c}}function n$(e,t){const n=wa(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=so(e)?vi(e):_s(1),a=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:a,height:l,x:c,y:u}}function $0(e,t,n){let r;if(t==="viewport")r=t$(e,n);else if(t==="document")r=e$(Bo(e));else if(oo(t))r=n$(t,n);else{const o=hE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return ff(r)}function mE(e,t){const n=Ts(e);return n===t||!oo(n)||Pi(n)?!1:Fr(n).position==="fixed"||mE(n,t)}function r$(e,t){const n=t.get(e);if(n)return n;let r=Tc(e,[],!1).filter(l=>oo(l)&&Wi(l)!=="body"),o=null;const s=Fr(e).position==="fixed";let a=s?Ts(e):e;for(;oo(a)&&!Pi(a);){const l=Fr(a),c=Ty(a);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||lu(a)&&!c&&mE(e,a))?r=r.filter(d=>d!==a):o=l,a=Ts(a)}return t.set(e,r),r}function o$(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?gp(t)?[]:r$(t,this._c):[].concat(n),r],l=a[0],c=a.reduce((u,d)=>{const p=$0(t,d,o);return u.top=Jn(p.top,u.top),u.right=Qr(p.right,u.right),u.bottom=Qr(p.bottom,u.bottom),u.left=Jn(p.left,u.left),u},$0(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function s$(e){const{width:t,height:n}=pE(e);return{width:t,height:n}}function a$(e,t,n){const r=so(t),o=Bo(t),s=n==="fixed",a=wa(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=_s(0);if(r||!r&&!s)if((Wi(t)!=="body"||lu(o))&&(l=mp(t)),r){const p=wa(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&(c.x=gE(o));const u=a.left+l.scrollLeft-c.x,d=a.top+l.scrollTop-c.y;return{x:u,y:d,width:a.width,height:a.height}}function Ah(e){return Fr(e).position==="static"}function z0(e,t){return!so(e)||Fr(e).position==="fixed"?null:t?t(e):e.offsetParent}function vE(e,t){const n=er(e);if(gp(e))return n;if(!so(e)){let o=Ts(e);for(;o&&!Pi(o);){if(oo(o)&&!Ah(o))return o;o=Ts(o)}return n}let r=z0(e,t);for(;r&&qL(r)&&Ah(r);)r=z0(r,t);return r&&Pi(r)&&Ah(r)&&!Ty(r)?n:r||ZL(e)||n}const i$=async function(e){const t=this.getOffsetParent||vE,n=this.getDimensions,r=await n(e.floating);return{reference:a$(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function l$(e){return Fr(e).direction==="rtl"}const c$={convertOffsetParentRelativeRectToViewportRelativeRect:XL,getDocumentElement:Bo,getClippingRect:o$,getOffsetParent:vE,getElementRects:i$,getClientRects:QL,getDimensions:s$,getScale:vi,isElement:oo,isRTL:l$};function u$(e,t){let n=null,r;const o=Bo(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const{left:u,top:d,width:p,height:f}=e.getBoundingClientRect();if(l||t(),!p||!f)return;const h=Ku(d),g=Ku(o.clientWidth-(u+p)),m=Ku(o.clientHeight-(d+f)),w=Ku(u),y={rootMargin:-h+"px "+-g+"px "+-m+"px "+-w+"px",threshold:Jn(0,Qr(1,c))||1};let b=!0;function C(j){const S=j[0].intersectionRatio;if(S!==c){if(!b)return a();S?a(!1,S):r=setTimeout(()=>{a(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(C,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,y)}n.observe(e)}return a(!0),s}function d$(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Ny(e),d=o||s?[...u?Tc(u):[],...Tc(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const p=u&&l?u$(u,n):null;let f=-1,h=null;a&&(h=new ResizeObserver(x=>{let[y]=x;y&&y.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(t)})),n()}),u&&!c&&h.observe(u),h.observe(t));let g,m=c?wa(e):null;c&&w();function w(){const x=wa(e);m&&(x.x!==m.x||x.y!==m.y||x.width!==m.width||x.height!==m.height)&&n(),m=x,g=requestAnimationFrame(w)}return n(),()=>{var x;d.forEach(y=>{o&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),p==null||p(),(x=h)==null||x.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const f$=HL,p$=GL,h$=VL,g$=KL,m$=UL,V0=zL,v$=WL,y$=(e,t,n)=>{const r=new Map,o={platform:c$,...n},s={...o.platform,_c:r};return $L(e,t,{...o,platform:s})};var wd=typeof document<"u"?v.useLayoutEffect:v.useEffect;function pf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!pf(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!pf(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function yE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function U0(e,t){const n=yE(e);return Math.round(t*n)/n}function B0(e){const t=v.useRef(e);return wd(()=>{t.current=e}),t}function x$(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,p]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=v.useState(r);pf(f,r)||h(r);const[g,m]=v.useState(null),[w,x]=v.useState(null),y=v.useCallback(K=>{K!==S.current&&(S.current=K,m(K))},[]),b=v.useCallback(K=>{K!==k.current&&(k.current=K,x(K))},[]),C=s||g,j=a||w,S=v.useRef(null),k=v.useRef(null),E=v.useRef(d),O=c!=null,F=B0(c),Z=B0(o),I=v.useCallback(()=>{if(!S.current||!k.current)return;const K={placement:t,strategy:n,middleware:f};Z.current&&(K.platform=Z.current),y$(S.current,k.current,K).then(z=>{const L={...z,isPositioned:!0};q.current&&!pf(E.current,L)&&(E.current=L,Ls.flushSync(()=>{p(L)}))})},[f,t,n,Z]);wd(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(K=>({...K,isPositioned:!1})))},[u]);const q=v.useRef(!1);wd(()=>(q.current=!0,()=>{q.current=!1}),[]),wd(()=>{if(C&&(S.current=C),j&&(k.current=j),C&&j){if(F.current)return F.current(C,j,I);I()}},[C,j,I,F,O]);const H=v.useMemo(()=>({reference:S,floating:k,setReference:y,setFloating:b}),[y,b]),J=v.useMemo(()=>({reference:C,floating:j}),[C,j]),ne=v.useMemo(()=>{const K={position:n,left:0,top:0};if(!J.floating)return K;const z=U0(J.floating,d.x),L=U0(J.floating,d.y);return l?{...K,transform:"translate("+z+"px, "+L+"px)",...yE(J.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:z,top:L}},[n,l,J.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:I,refs:H,elements:J,floatingStyles:ne}),[d,I,H,J,ne])}const w$=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?V0({element:r.current,padding:o}).fn(n):{}:r?V0({element:r,padding:o}).fn(n):{}}}},b$=(e,t)=>({...f$(e),options:[e,t]}),S$=(e,t)=>({...p$(e),options:[e,t]}),C$=(e,t)=>({...v$(e),options:[e,t]}),j$=(e,t)=>({...h$(e),options:[e,t]}),_$=(e,t)=>({...g$(e),options:[e,t]}),E$=(e,t)=>({...m$(e),options:[e,t]}),T$=(e,t)=>({...w$(e),options:[e,t]});var k$="Arrow",xE=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return i.jsx(Ve.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});xE.displayName=k$;var N$=xE;function wE(e){const[t,n]=v.useState(void 0);return bn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Ry="Popper",[bE,vp]=lo(Ry),[R$,SE]=bE(Ry),CE=e=>{const{__scopePopper:t,children:n}=e,[r,o]=v.useState(null);return i.jsx(R$,{scope:t,anchor:r,onAnchorChange:o,children:n})};CE.displayName=Ry;var jE="PopperAnchor",_E=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=SE(jE,n),a=v.useRef(null),l=ut(t,a);return v.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||a.current)}),r?null:i.jsx(Ve.div,{...o,ref:l})});_E.displayName=jE;var Py="PopperContent",[P$,I$]=bE(Py),EE=v.forwardRef((e,t)=>{var W,we,Re,Fe,Pe,ge;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:p="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:g,...m}=e,w=SE(Py,n),[x,y]=v.useState(null),b=ut(t,Xe=>y(Xe)),[C,j]=v.useState(null),S=wE(C),k=(S==null?void 0:S.width)??0,E=(S==null?void 0:S.height)??0,O=r+(s!=="center"?"-"+s:""),F=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},Z=Array.isArray(u)?u:[u],I=Z.length>0,q={padding:F,boundary:Z.filter(O$),altBoundary:I},{refs:H,floatingStyles:J,placement:ne,isPositioned:K,middlewareData:z}=x$({strategy:"fixed",placement:O,whileElementsMounted:(...Xe)=>d$(...Xe,{animationFrame:h==="always"}),elements:{reference:w.anchor},middleware:[b$({mainAxis:o+E,alignmentAxis:a}),c&&S$({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?C$():void 0,...q}),c&&j$({...q}),_$({...q,apply:({elements:Xe,rects:kt,availableWidth:Ut,availableHeight:Lt})=>{const{width:Wt,height:_}=kt.reference,D=Xe.floating.style;D.setProperty("--radix-popper-available-width",`${Ut}px`),D.setProperty("--radix-popper-available-height",`${Lt}px`),D.setProperty("--radix-popper-anchor-width",`${Wt}px`),D.setProperty("--radix-popper-anchor-height",`${_}px`)}}),C&&T$({element:C,padding:l}),M$({arrowWidth:k,arrowHeight:E}),f&&E$({strategy:"referenceHidden",...q})]}),[L,ee]=NE(ne),fe=xr(g);bn(()=>{K&&(fe==null||fe())},[K,fe]);const B=(W=z.arrow)==null?void 0:W.x,te=(we=z.arrow)==null?void 0:we.y,X=((Re=z.arrow)==null?void 0:Re.centerOffset)!==0,[ie,re]=v.useState();return bn(()=>{x&&re(window.getComputedStyle(x).zIndex)},[x]),i.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...J,transform:K?J.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(Fe=z.transformOrigin)==null?void 0:Fe.x,(Pe=z.transformOrigin)==null?void 0:Pe.y].join(" "),...((ge=z.hide)==null?void 0:ge.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(P$,{scope:n,placedSide:L,onArrowChange:j,arrowX:B,arrowY:te,shouldHideArrow:X,children:i.jsx(Ve.div,{"data-side":L,"data-align":ee,...m,ref:b,style:{...m.style,animation:K?void 0:"none"}})})})});EE.displayName=Py;var TE="PopperArrow",D$={top:"bottom",right:"left",bottom:"top",left:"right"},kE=v.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=I$(TE,r),a=D$[s.placedSide];return i.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:i.jsx(N$,{...o,ref:n,style:{...o.style,display:"block"}})})});kE.displayName=TE;function O$(e){return e!==null}var M$=e=>({name:"transformOrigin",options:e,fn(t){var w,x,y;const{placement:n,rects:r,middlewareData:o}=t,a=((w=o.arrow)==null?void 0:w.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=NE(n),p={start:"0%",center:"50%",end:"100%"}[d],f=(((x=o.arrow)==null?void 0:x.x)??0)+l/2,h=(((y=o.arrow)==null?void 0:y.y)??0)+c/2;let g="",m="";return u==="bottom"?(g=a?p:`${f}px`,m=`${-c}px`):u==="top"?(g=a?p:`${f}px`,m=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=a?p:`${h}px`):u==="left"&&(g=`${r.floating.width+c}px`,m=a?p:`${h}px`),{data:{x:g,y:m}}}});function NE(e){const[t,n="center"]=e.split("-");return[t,n]}var RE=CE,PE=_E,IE=EE,DE=kE;function OE(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var A$="VisuallyHidden",ME=v.forwardRef((e,t)=>i.jsx(Ve.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));ME.displayName=A$;var F$=[" ","Enter","ArrowUp","ArrowDown"],L$=[" ","Enter"],cu="Select",[yp,xp,$$]=Cy(cu),[Ki,GK]=lo(cu,[$$,vp]),wp=vp(),[z$,Vs]=Ki(cu),[V$,U$]=Ki(cu),AE=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:a,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:p,disabled:f,required:h}=e,g=wp(t),[m,w]=v.useState(null),[x,y]=v.useState(null),[b,C]=v.useState(!1),j=hp(u),[S=!1,k]=js({prop:r,defaultProp:o,onChange:s}),[E,O]=js({prop:a,defaultProp:l,onChange:c}),F=v.useRef(null),Z=m?!!m.closest("form"):!0,[I,q]=v.useState(new Set),H=Array.from(I).map(J=>J.props.value).join(";");return i.jsx(RE,{...g,children:i.jsxs(z$,{required:h,scope:t,trigger:m,onTriggerChange:w,valueNode:x,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:C,contentId:Ir(),value:E,onValueChange:O,open:S,onOpenChange:k,dir:j,triggerPointerDownPosRef:F,disabled:f,children:[i.jsx(yp.Provider,{scope:t,children:i.jsx(V$,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(J=>{q(ne=>new Set(ne).add(J))},[]),onNativeOptionRemove:v.useCallback(J=>{q(ne=>{const K=new Set(ne);return K.delete(J),K})},[]),children:n})}),Z?i.jsxs(iT,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:p,value:E,onChange:J=>O(J.target.value),disabled:f,children:[E===void 0?i.jsx("option",{value:""}):null,Array.from(I)]},H):null]})})};AE.displayName=cu;var FE="SelectTrigger",LE=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=wp(n),a=Vs(FE,n),l=a.disabled||r,c=ut(t,a.onTriggerChange),u=xp(n),[d,p,f]=lT(g=>{const m=u().filter(y=>!y.disabled),w=m.find(y=>y.value===a.value),x=cT(m,g,w);x!==void 0&&a.onValueChange(x.value)}),h=()=>{l||(a.onOpenChange(!0),f())};return i.jsx(PE,{asChild:!0,...s,children:i.jsx(Ve.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":aT(a.value)?"":void 0,...o,ref:c,onClick:Ce(o.onClick,g=>{g.currentTarget.focus()}),onPointerDown:Ce(o.onPointerDown,g=>{const m=g.target;m.hasPointerCapture(g.pointerId)&&m.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&(h(),a.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)},g.preventDefault())}),onKeyDown:Ce(o.onKeyDown,g=>{const m=d.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&p(g.key),!(m&&g.key===" ")&&F$.includes(g.key)&&(h(),g.preventDefault())})})})});LE.displayName=FE;var $E="SelectValue",zE=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:a="",...l}=e,c=Vs($E,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,p=ut(t,c.onValueNodeChange);return bn(()=>{u(d)},[u,d]),i.jsx(Ve.span,{...l,ref:p,style:{pointerEvents:"none"},children:aT(c.value)?i.jsx(i.Fragment,{children:a}):s})});zE.displayName=$E;var B$="SelectIcon",VE=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return i.jsx(Ve.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});VE.displayName=B$;var H$="SelectPortal",UE=e=>i.jsx(lp,{asChild:!0,...e});UE.displayName=H$;var ba="SelectContent",BE=v.forwardRef((e,t)=>{const n=Vs(ba,e.__scopeSelect),[r,o]=v.useState();if(bn(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Ls.createPortal(i.jsx(HE,{scope:e.__scopeSelect,children:i.jsx(yp.Slot,{scope:e.__scopeSelect,children:i.jsx("div",{children:e.children})})}),s):null}return i.jsx(GE,{...e,ref:t})});BE.displayName=ba;var vo=10,[HE,Us]=Ki(ba),G$="SelectContentImpl",GE=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:f,collisionPadding:h,sticky:g,hideWhenDetached:m,avoidCollisions:w,...x}=e,y=Vs(ba,n),[b,C]=v.useState(null),[j,S]=v.useState(null),k=ut(t,W=>C(W)),[E,O]=v.useState(null),[F,Z]=v.useState(null),I=xp(n),[q,H]=v.useState(!1),J=v.useRef(!1);v.useEffect(()=>{if(b)return py(b)},[b]),fy();const ne=v.useCallback(W=>{const[we,...Re]=I().map(ge=>ge.ref.current),[Fe]=Re.slice(-1),Pe=document.activeElement;for(const ge of W)if(ge===Pe||(ge==null||ge.scrollIntoView({block:"nearest"}),ge===we&&j&&(j.scrollTop=0),ge===Fe&&j&&(j.scrollTop=j.scrollHeight),ge==null||ge.focus(),document.activeElement!==Pe))return},[I,j]),K=v.useCallback(()=>ne([E,b]),[ne,E,b]);v.useEffect(()=>{q&&K()},[q,K]);const{onOpenChange:z,triggerPointerDownPosRef:L}=y;v.useEffect(()=>{if(b){let W={x:0,y:0};const we=Fe=>{var Pe,ge;W={x:Math.abs(Math.round(Fe.pageX)-(((Pe=L.current)==null?void 0:Pe.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((ge=L.current)==null?void 0:ge.y)??0))}},Re=Fe=>{W.x<=10&&W.y<=10?Fe.preventDefault():b.contains(Fe.target)||z(!1),document.removeEventListener("pointermove",we),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",we),document.addEventListener("pointerup",Re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",we),document.removeEventListener("pointerup",Re,{capture:!0})}}},[b,z,L]),v.useEffect(()=>{const W=()=>z(!1);return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W)}},[z]);const[ee,fe]=lT(W=>{const we=I().filter(Pe=>!Pe.disabled),Re=we.find(Pe=>Pe.ref.current===document.activeElement),Fe=cT(we,W,Re);Fe&&setTimeout(()=>Fe.ref.current.focus())}),B=v.useCallback((W,we,Re)=>{const Fe=!J.current&&!Re;(y.value!==void 0&&y.value===we||Fe)&&(O(W),Fe&&(J.current=!0))},[y.value]),te=v.useCallback(()=>b==null?void 0:b.focus(),[b]),X=v.useCallback((W,we,Re)=>{const Fe=!J.current&&!Re;(y.value!==void 0&&y.value===we||Fe)&&Z(W)},[y.value]),ie=r==="popper"?mm:WE,re=ie===mm?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:f,collisionPadding:h,sticky:g,hideWhenDetached:m,avoidCollisions:w}:{};return i.jsx(HE,{scope:n,content:b,viewport:j,onViewportChange:S,itemRefCallback:B,selectedItem:E,onItemLeave:te,itemTextRefCallback:X,focusSelectedItem:K,selectedItemText:F,position:r,isPositioned:q,searchRef:ee,children:i.jsx(up,{as:Do,allowPinchZoom:!0,children:i.jsx(ip,{asChild:!0,trapped:y.open,onMountAutoFocus:W=>{W.preventDefault()},onUnmountAutoFocus:Ce(o,W=>{var we;(we=y.trigger)==null||we.focus({preventScroll:!0}),W.preventDefault()}),children:i.jsx(ap,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:i.jsx(ie,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:W=>W.preventDefault(),...x,...re,onPlaced:()=>H(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:Ce(x.onKeyDown,W=>{const we=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!we&&W.key.length===1&&fe(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let Fe=I().filter(Pe=>!Pe.disabled).map(Pe=>Pe.ref.current);if(["ArrowUp","End"].includes(W.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){const Pe=W.target,ge=Fe.indexOf(Pe);Fe=Fe.slice(ge+1)}setTimeout(()=>ne(Fe)),W.preventDefault()}})})})})})})});GE.displayName=G$;var W$="SelectItemAlignedPosition",WE=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=Vs(ba,n),a=Us(ba,n),[l,c]=v.useState(null),[u,d]=v.useState(null),p=ut(t,k=>d(k)),f=xp(n),h=v.useRef(!1),g=v.useRef(!0),{viewport:m,selectedItem:w,selectedItemText:x,focusSelectedItem:y}=a,b=v.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&m&&w&&x){const k=s.trigger.getBoundingClientRect(),E=u.getBoundingClientRect(),O=s.valueNode.getBoundingClientRect(),F=x.getBoundingClientRect();if(s.dir!=="rtl"){const Pe=F.left-E.left,ge=O.left-Pe,Xe=k.left-ge,kt=k.width+Xe,Ut=Math.max(kt,E.width),Lt=window.innerWidth-vo,Wt=O0(ge,[vo,Lt-Ut]);l.style.minWidth=kt+"px",l.style.left=Wt+"px"}else{const Pe=E.right-F.right,ge=window.innerWidth-O.right-Pe,Xe=window.innerWidth-k.right-ge,kt=k.width+Xe,Ut=Math.max(kt,E.width),Lt=window.innerWidth-vo,Wt=O0(ge,[vo,Lt-Ut]);l.style.minWidth=kt+"px",l.style.right=Wt+"px"}const Z=f(),I=window.innerHeight-vo*2,q=m.scrollHeight,H=window.getComputedStyle(u),J=parseInt(H.borderTopWidth,10),ne=parseInt(H.paddingTop,10),K=parseInt(H.borderBottomWidth,10),z=parseInt(H.paddingBottom,10),L=J+ne+q+z+K,ee=Math.min(w.offsetHeight*5,L),fe=window.getComputedStyle(m),B=parseInt(fe.paddingTop,10),te=parseInt(fe.paddingBottom,10),X=k.top+k.height/2-vo,ie=I-X,re=w.offsetHeight/2,W=w.offsetTop+re,we=J+ne+W,Re=L-we;if(we<=X){const Pe=w===Z[Z.length-1].ref.current;l.style.bottom="0px";const ge=u.clientHeight-m.offsetTop-m.offsetHeight,Xe=Math.max(ie,re+(Pe?te:0)+ge+K),kt=we+Xe;l.style.height=kt+"px"}else{const Pe=w===Z[0].ref.current;l.style.top="0px";const Xe=Math.max(X,J+m.offsetTop+(Pe?B:0)+re)+Re;l.style.height=Xe+"px",m.scrollTop=we-X+m.offsetTop}l.style.margin=`${vo}px 0`,l.style.minHeight=ee+"px",l.style.maxHeight=I+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[f,s.trigger,s.valueNode,l,u,m,w,x,s.dir,r]);bn(()=>b(),[b]);const[C,j]=v.useState();bn(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const S=v.useCallback(k=>{k&&g.current===!0&&(b(),y==null||y(),g.current=!1)},[b,y]);return i.jsx(q$,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:S,children:i.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:i.jsx(Ve.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});WE.displayName=W$;var K$="SelectPopperPosition",mm=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=vo,...s}=e,a=wp(n);return i.jsx(IE,{...a,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});mm.displayName=K$;var[q$,Iy]=Ki(ba,{}),vm="SelectViewport",KE=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=Us(vm,n),a=Iy(vm,n),l=ut(t,s.onViewportChange),c=v.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),i.jsx(yp.Slot,{scope:n,children:i.jsx(Ve.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"auto",...o.style},onScroll:Ce(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:f}=a;if(f!=null&&f.current&&p){const h=Math.abs(c.current-d.scrollTop);if(h>0){const g=window.innerHeight-vo*2,m=parseFloat(p.style.minHeight),w=parseFloat(p.style.height),x=Math.max(m,w);if(x0?C:0,p.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});KE.displayName=vm;var qE="SelectGroup",[Z$,J$]=Ki(qE),Y$=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ir();return i.jsx(Z$,{scope:n,id:o,children:i.jsx(Ve.div,{role:"group","aria-labelledby":o,...r,ref:t})})});Y$.displayName=qE;var ZE="SelectLabel",JE=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=J$(ZE,n);return i.jsx(Ve.div,{id:o.id,...r,ref:t})});JE.displayName=ZE;var hf="SelectItem",[X$,YE]=Ki(hf),XE=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...a}=e,l=Vs(hf,n),c=Us(hf,n),u=l.value===r,[d,p]=v.useState(s??""),[f,h]=v.useState(!1),g=ut(t,x=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,x,r,o)}),m=Ir(),w=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(X$,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:v.useCallback(x=>{p(y=>y||((x==null?void 0:x.textContent)??"").trim())},[]),children:i.jsx(yp.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:i.jsx(Ve.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:g,onFocus:Ce(a.onFocus,()=>h(!0)),onBlur:Ce(a.onBlur,()=>h(!1)),onPointerUp:Ce(a.onPointerUp,w),onPointerMove:Ce(a.onPointerMove,x=>{var y;o?(y=c.onItemLeave)==null||y.call(c):x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ce(a.onPointerLeave,x=>{var y;x.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:Ce(a.onKeyDown,x=>{var b;((b=c.searchRef)==null?void 0:b.current)!==""&&x.key===" "||(L$.includes(x.key)&&w(),x.key===" "&&x.preventDefault())})})})})});XE.displayName=hf;var Ol="SelectItemText",QE=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,a=Vs(Ol,n),l=Us(Ol,n),c=YE(Ol,n),u=U$(Ol,n),[d,p]=v.useState(null),f=ut(t,x=>p(x),c.onItemTextChange,x=>{var y;return(y=l.itemTextRefCallback)==null?void 0:y.call(l,x,c.value,c.disabled)}),h=d==null?void 0:d.textContent,g=v.useMemo(()=>i.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:w}=u;return bn(()=>(m(g),()=>w(g)),[m,w,g]),i.jsxs(i.Fragment,{children:[i.jsx(Ve.span,{id:c.textId,...s,ref:f}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Ls.createPortal(s.children,a.valueNode):null]})});QE.displayName=Ol;var eT="SelectItemIndicator",tT=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return YE(eT,n).isSelected?i.jsx(Ve.span,{"aria-hidden":!0,...r,ref:t}):null});tT.displayName=eT;var ym="SelectScrollUpButton",nT=v.forwardRef((e,t)=>{const n=Us(ym,e.__scopeSelect),r=Iy(ym,e.__scopeSelect),[o,s]=v.useState(!1),a=ut(t,r.onScrollButtonChange);return bn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?i.jsx(oT,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});nT.displayName=ym;var xm="SelectScrollDownButton",rT=v.forwardRef((e,t)=>{const n=Us(xm,e.__scopeSelect),r=Iy(xm,e.__scopeSelect),[o,s]=v.useState(!1),a=ut(t,r.onScrollButtonChange);return bn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?i.jsx(oT,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});rT.displayName=xm;var oT=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=Us("SelectScrollButton",n),a=v.useRef(null),l=xp(n),c=v.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),bn(()=>{var d;const u=l().find(p=>p.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),i.jsx(Ve.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Ce(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:Ce(o.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:Ce(o.onPointerLeave,()=>{c()})})}),Q$="SelectSeparator",sT=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return i.jsx(Ve.div,{"aria-hidden":!0,...r,ref:t})});sT.displayName=Q$;var wm="SelectArrow",e4=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=wp(n),s=Vs(wm,n),a=Us(wm,n);return s.open&&a.position==="popper"?i.jsx(DE,{...o,...r,ref:t}):null});e4.displayName=wm;function aT(e){return e===""||e===void 0}var iT=v.forwardRef((e,t)=>{const{value:n,...r}=e,o=v.useRef(null),s=ut(t,o),a=OE(n);return v.useEffect(()=>{const l=o.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==n&&d){const p=new Event("change",{bubbles:!0});d.call(l,n),l.dispatchEvent(p)}},[a,n]),i.jsx(ME,{asChild:!0,children:i.jsx("select",{...r,ref:s,defaultValue:n})})});iT.displayName="BubbleSelect";function lT(e){const t=xr(e),n=v.useRef(""),r=v.useRef(0),o=v.useCallback(a=>{const l=n.current+a;t(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),s=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function cT(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=t4(e,Math.max(s,0));o.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function t4(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var n4=AE,uT=LE,r4=zE,o4=VE,s4=UE,dT=BE,a4=KE,fT=JE,pT=XE,i4=QE,l4=tT,hT=nT,gT=rT,mT=sT;const St=n4,Ct=r4,mt=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(uT,{ref:r,className:Ne("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,i.jsx(o4,{asChild:!0,children:i.jsx(Qf,{className:"h-4 w-4 opacity-50"})})]}));mt.displayName=uT.displayName;const vT=v.forwardRef(({className:e,...t},n)=>i.jsx(hT,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(ZM,{className:"h-4 w-4"})}));vT.displayName=hT.displayName;const yT=v.forwardRef(({className:e,...t},n)=>i.jsx(gT,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(Qf,{className:"h-4 w-4"})}));yT.displayName=gT.displayName;const vt=v.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>i.jsx(s4,{children:i.jsxs(dT,{ref:o,className:Ne("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[i.jsx(vT,{}),i.jsx(a4,{className:Ne("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),i.jsx(yT,{})]})}));vt.displayName=dT.displayName;const c4=v.forwardRef(({className:e,...t},n)=>i.jsx(fT,{ref:n,className:Ne("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));c4.displayName=fT.displayName;const he=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(pT,{ref:r,className:Ne("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(l4,{children:i.jsx(si,{className:"h-4 w-4"})})}),i.jsx(i4,{children:t})]}));he.displayName=pT.displayName;const u4=v.forwardRef(({className:e,...t},n)=>i.jsx(mT,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",e),...t}));u4.displayName=mT.displayName;const kc=e=>typeof e=="number"&&!isNaN(e),ca=e=>typeof e=="string",Xn=e=>typeof e=="function",bd=e=>ca(e)||Xn(e)?e:null,bm=e=>v.isValidElement(e)||ca(e)||Xn(e)||kc(e);function d4(e,t,n){n===void 0&&(n=300);const{scrollHeight:r,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=r+"px",o.transition=`all ${n}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)})})}function bp(e){let{enter:t,exit:n,appendPosition:r=!1,collapse:o=!0,collapseDuration:s=300}=e;return function(a){let{children:l,position:c,preventExitTransition:u,done:d,nodeRef:p,isIn:f,playToast:h}=a;const g=r?`${t}--${c}`:t,m=r?`${n}--${c}`:n,w=v.useRef(0);return v.useLayoutEffect(()=>{const x=p.current,y=g.split(" "),b=C=>{C.target===p.current&&(h(),x.removeEventListener("animationend",b),x.removeEventListener("animationcancel",b),w.current===0&&C.type!=="animationcancel"&&x.classList.remove(...y))};x.classList.add(...y),x.addEventListener("animationend",b),x.addEventListener("animationcancel",b)},[]),v.useEffect(()=>{const x=p.current,y=()=>{x.removeEventListener("animationend",y),o?d4(x,d,s):d()};f||(u?y():(w.current=1,x.className+=` ${m}`,x.addEventListener("animationend",y)))},[f]),Se.createElement(Se.Fragment,null,l)}}function H0(e,t){return e!=null?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const Nn=new Map;let Nc=[];const Sm=new Set,f4=e=>Sm.forEach(t=>t(e)),xT=()=>Nn.size>0;function wT(e,t){var n;if(t)return!((n=Nn.get(t))==null||!n.isToastActive(e));let r=!1;return Nn.forEach(o=>{o.isToastActive(e)&&(r=!0)}),r}function bT(e,t){bm(e)&&(xT()||Nc.push({content:e,options:t}),Nn.forEach(n=>{n.buildToast(e,t)}))}function G0(e,t){Nn.forEach(n=>{t!=null&&t!=null&&t.containerId?(t==null?void 0:t.containerId)===n.id&&n.toggle(e,t==null?void 0:t.id):n.toggle(e,t==null?void 0:t.id)})}function p4(e){const{subscribe:t,getSnapshot:n,setProps:r}=v.useRef(function(s){const a=s.containerId||1;return{subscribe(l){const c=function(d,p,f){let h=1,g=0,m=[],w=[],x=[],y=p;const b=new Map,C=new Set,j=()=>{x=Array.from(b.values()),C.forEach(E=>E())},S=E=>{w=E==null?[]:w.filter(O=>O!==E),j()},k=E=>{const{toastId:O,onOpen:F,updateId:Z,children:I}=E.props,q=Z==null;E.staleId&&b.delete(E.staleId),b.set(O,E),w=[...w,E.props.toastId].filter(H=>H!==E.staleId),j(),f(H0(E,q?"added":"updated")),q&&Xn(F)&&F(v.isValidElement(I)&&I.props)};return{id:d,props:y,observe:E=>(C.add(E),()=>C.delete(E)),toggle:(E,O)=>{b.forEach(F=>{O!=null&&O!==F.props.toastId||Xn(F.toggle)&&F.toggle(E)})},removeToast:S,toasts:b,clearQueue:()=>{g-=m.length,m=[]},buildToast:(E,O)=>{if((B=>{let{containerId:te,toastId:X,updateId:ie}=B;const re=te?te!==d:d!==1,W=b.has(X)&&ie==null;return re||W})(O))return;const{toastId:F,updateId:Z,data:I,staleId:q,delay:H}=O,J=()=>{S(F)},ne=Z==null;ne&&g++;const K={...y,style:y.toastStyle,key:h++,...Object.fromEntries(Object.entries(O).filter(B=>{let[te,X]=B;return X!=null})),toastId:F,updateId:Z,data:I,closeToast:J,isIn:!1,className:bd(O.className||y.toastClassName),bodyClassName:bd(O.bodyClassName||y.bodyClassName),progressClassName:bd(O.progressClassName||y.progressClassName),autoClose:!O.isLoading&&(z=O.autoClose,L=y.autoClose,z===!1||kc(z)&&z>0?z:L),deleteToast(){const B=b.get(F),{onClose:te,children:X}=B.props;Xn(te)&&te(v.isValidElement(X)&&X.props),f(H0(B,"removed")),b.delete(F),g--,g<0&&(g=0),m.length>0?k(m.shift()):j()}};var z,L;K.closeButton=y.closeButton,O.closeButton===!1||bm(O.closeButton)?K.closeButton=O.closeButton:O.closeButton===!0&&(K.closeButton=!bm(y.closeButton)||y.closeButton);let ee=E;v.isValidElement(E)&&!ca(E.type)?ee=v.cloneElement(E,{closeToast:J,toastProps:K,data:I}):Xn(E)&&(ee=E({closeToast:J,toastProps:K,data:I}));const fe={content:ee,props:K,staleId:q};y.limit&&y.limit>0&&g>y.limit&&ne?m.push(fe):kc(H)?setTimeout(()=>{k(fe)},H):k(fe)},setProps(E){y=E},setToggle:(E,O)=>{b.get(E).toggle=O},isToastActive:E=>w.some(O=>O===E),getSnapshot:()=>y.newestOnTop?x.reverse():x}}(a,s,f4);Nn.set(a,c);const u=c.observe(l);return Nc.forEach(d=>bT(d.content,d.options)),Nc=[],()=>{u(),Nn.delete(a)}},setProps(l){var c;(c=Nn.get(a))==null||c.setProps(l)},getSnapshot(){var l;return(l=Nn.get(a))==null?void 0:l.getSnapshot()}}}(e)).current;r(e);const o=v.useSyncExternalStore(t,n,n);return{getToastToRender:function(s){if(!o)return[];const a=new Map;return o.forEach(l=>{const{position:c}=l.props;a.has(c)||a.set(c,[]),a.get(c).push(l)}),Array.from(a,l=>s(l[0],l[1]))},isToastActive:wT,count:o==null?void 0:o.length}}function h4(e){const[t,n]=v.useState(!1),[r,o]=v.useState(!1),s=v.useRef(null),a=v.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:l,pauseOnHover:c,closeToast:u,onClick:d,closeOnClick:p}=e;var f,h;function g(){n(!0)}function m(){n(!1)}function w(b){const C=s.current;a.canDrag&&C&&(a.didMove=!0,t&&m(),a.delta=e.draggableDirection==="x"?b.clientX-a.start:b.clientY-a.start,a.start!==b.clientX&&(a.canCloseOnClick=!1),C.style.transform=`translate3d(${e.draggableDirection==="x"?`${a.delta}px, var(--y)`:`0, calc(${a.delta}px + var(--y))`},0)`,C.style.opacity=""+(1-Math.abs(a.delta/a.removalDistance)))}function x(){document.removeEventListener("pointermove",w),document.removeEventListener("pointerup",x);const b=s.current;if(a.canDrag&&a.didMove&&b){if(a.canDrag=!1,Math.abs(a.delta)>a.removalDistance)return o(!0),e.closeToast(),void e.collapseAll();b.style.transition="transform 0.2s, opacity 0.2s",b.style.removeProperty("transform"),b.style.removeProperty("opacity")}}(h=Nn.get((f={id:e.toastId,containerId:e.containerId,fn:n}).containerId||1))==null||h.setToggle(f.id,f.fn),v.useEffect(()=>{if(e.pauseOnFocusLoss)return document.hasFocus()||m(),window.addEventListener("focus",g),window.addEventListener("blur",m),()=>{window.removeEventListener("focus",g),window.removeEventListener("blur",m)}},[e.pauseOnFocusLoss]);const y={onPointerDown:function(b){if(e.draggable===!0||e.draggable===b.pointerType){a.didMove=!1,document.addEventListener("pointermove",w),document.addEventListener("pointerup",x);const C=s.current;a.canCloseOnClick=!0,a.canDrag=!0,C.style.transition="none",e.draggableDirection==="x"?(a.start=b.clientX,a.removalDistance=C.offsetWidth*(e.draggablePercent/100)):(a.start=b.clientY,a.removalDistance=C.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent)/100)}},onPointerUp:function(b){const{top:C,bottom:j,left:S,right:k}=s.current.getBoundingClientRect();b.nativeEvent.type!=="touchend"&&e.pauseOnHover&&b.clientX>=S&&b.clientX<=k&&b.clientY>=C&&b.clientY<=j?m():g()}};return l&&c&&(y.onMouseEnter=m,e.stacked||(y.onMouseLeave=g)),p&&(y.onClick=b=>{d&&d(b),a.canCloseOnClick&&u()}),{playToast:g,pauseToast:m,isRunning:t,preventExitTransition:r,toastRef:s,eventHandlers:y}}function g4(e){let{delay:t,isRunning:n,closeToast:r,type:o="default",hide:s,className:a,style:l,controlledProgress:c,progress:u,rtl:d,isIn:p,theme:f}=e;const h=s||c&&u===0,g={...l,animationDuration:`${t}ms`,animationPlayState:n?"running":"paused"};c&&(g.transform=`scaleX(${u})`);const m=Co("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${f}`,`Toastify__progress-bar--${o}`,{"Toastify__progress-bar--rtl":d}),w=Xn(a)?a({rtl:d,type:o,defaultClassName:m}):Co(m,a),x={[c&&u>=1?"onTransitionEnd":"onAnimationEnd"]:c&&u<1?null:()=>{p&&r()}};return Se.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":h},Se.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${f} Toastify__progress-bar--${o}`}),Se.createElement("div",{role:"progressbar","aria-hidden":h?"true":"false","aria-label":"notification timer",className:w,style:g,...x}))}let m4=1;const ST=()=>""+m4++;function v4(e){return e&&(ca(e.toastId)||kc(e.toastId))?e.toastId:ST()}function Ql(e,t){return bT(e,t),t.toastId}function gf(e,t){return{...t,type:t&&t.type||e,toastId:v4(t)}}function qu(e){return(t,n)=>Ql(t,gf(e,n))}function lt(e,t){return Ql(e,gf("default",t))}lt.loading=(e,t)=>Ql(e,gf("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),lt.promise=function(e,t,n){let r,{pending:o,error:s,success:a}=t;o&&(r=ca(o)?lt.loading(o,n):lt.loading(o.render,{...n,...o}));const l={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},c=(d,p,f)=>{if(p==null)return void lt.dismiss(r);const h={type:d,...l,...n,data:f},g=ca(p)?{render:p}:p;return r?lt.update(r,{...h,...g}):lt(g.render,{...h,...g}),f},u=Xn(e)?e():e;return u.then(d=>c("success",a,d)).catch(d=>c("error",s,d)),u},lt.success=qu("success"),lt.info=qu("info"),lt.error=qu("error"),lt.warning=qu("warning"),lt.warn=lt.warning,lt.dark=(e,t)=>Ql(e,gf("default",{theme:"dark",...t})),lt.dismiss=function(e){(function(t){var n;if(xT()){if(t==null||ca(n=t)||kc(n))Nn.forEach(r=>{r.removeToast(t)});else if(t&&("containerId"in t||"id"in t)){const r=Nn.get(t.containerId);r?r.removeToast(t.id):Nn.forEach(o=>{o.removeToast(t.id)})}}else Nc=Nc.filter(r=>t!=null&&r.options.toastId!==t)})(e)},lt.clearWaitingQueue=function(e){e===void 0&&(e={}),Nn.forEach(t=>{!t.props.limit||e.containerId&&t.id!==e.containerId||t.clearQueue()})},lt.isActive=wT,lt.update=function(e,t){t===void 0&&(t={});const n=((r,o)=>{var s;let{containerId:a}=o;return(s=Nn.get(a||1))==null?void 0:s.toasts.get(r)})(e,t);if(n){const{props:r,content:o}=n,s={delay:100,...r,...t,toastId:t.toastId||e,updateId:ST()};s.toastId!==e&&(s.staleId=e);const a=s.render||o;delete s.render,Ql(a,s)}},lt.done=e=>{lt.update(e,{progress:1})},lt.onChange=function(e){return Sm.add(e),()=>{Sm.delete(e)}},lt.play=e=>G0(!0,e),lt.pause=e=>G0(!1,e);const y4=typeof window<"u"?v.useLayoutEffect:v.useEffect,Zu=e=>{let{theme:t,type:n,isLoading:r,...o}=e;return Se.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...o})},Fh={info:function(e){return Se.createElement(Zu,{...e},Se.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return Se.createElement(Zu,{...e},Se.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return Se.createElement(Zu,{...e},Se.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return Se.createElement(Zu,{...e},Se.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return Se.createElement("div",{className:"Toastify__spinner"})}},x4=e=>{const{isRunning:t,preventExitTransition:n,toastRef:r,eventHandlers:o,playToast:s}=h4(e),{closeButton:a,children:l,autoClose:c,onClick:u,type:d,hideProgressBar:p,closeToast:f,transition:h,position:g,className:m,style:w,bodyClassName:x,bodyStyle:y,progressClassName:b,progressStyle:C,updateId:j,role:S,progress:k,rtl:E,toastId:O,deleteToast:F,isIn:Z,isLoading:I,closeOnClick:q,theme:H}=e,J=Co("Toastify__toast",`Toastify__toast-theme--${H}`,`Toastify__toast--${d}`,{"Toastify__toast--rtl":E},{"Toastify__toast--close-on-click":q}),ne=Xn(m)?m({rtl:E,position:g,type:d,defaultClassName:J}):Co(J,m),K=function(fe){let{theme:B,type:te,isLoading:X,icon:ie}=fe,re=null;const W={theme:B,type:te};return ie===!1||(Xn(ie)?re=ie({...W,isLoading:X}):v.isValidElement(ie)?re=v.cloneElement(ie,W):X?re=Fh.spinner():(we=>we in Fh)(te)&&(re=Fh[te](W))),re}(e),z=!!k||!c,L={closeToast:f,type:d,theme:H};let ee=null;return a===!1||(ee=Xn(a)?a(L):v.isValidElement(a)?v.cloneElement(a,L):function(fe){let{closeToast:B,theme:te,ariaLabel:X="close"}=fe;return Se.createElement("button",{className:`Toastify__close-button Toastify__close-button--${te}`,type:"button",onClick:ie=>{ie.stopPropagation(),B(ie)},"aria-label":X},Se.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},Se.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}(L)),Se.createElement(h,{isIn:Z,done:F,position:g,preventExitTransition:n,nodeRef:r,playToast:s},Se.createElement("div",{id:O,onClick:u,"data-in":Z,className:ne,...o,style:w,ref:r},Se.createElement("div",{...Z&&{role:S},className:Xn(x)?x({type:d}):Co("Toastify__toast-body",x),style:y},K!=null&&Se.createElement("div",{className:Co("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!I})},K),Se.createElement("div",null,l)),ee,Se.createElement(g4,{...j&&!z?{key:`pb-${j}`}:{},rtl:E,theme:H,delay:c,isRunning:t,isIn:Z,closeToast:f,hide:p,type:d,style:C,className:b,controlledProgress:z,progress:k||0})))},Sp=function(e,t){return t===void 0&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},w4=bp(Sp("bounce",!0));bp(Sp("slide",!0));bp(Sp("zoom"));bp(Sp("flip"));const b4={position:"top-right",transition:w4,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function S4(e){let t={...b4,...e};const n=e.stacked,[r,o]=v.useState(!0),s=v.useRef(null),{getToastToRender:a,isToastActive:l,count:c}=p4(t),{className:u,style:d,rtl:p,containerId:f}=t;function h(m){const w=Co("Toastify__toast-container",`Toastify__toast-container--${m}`,{"Toastify__toast-container--rtl":p});return Xn(u)?u({position:m,rtl:p,defaultClassName:w}):Co(w,bd(u))}function g(){n&&(o(!0),lt.play())}return y4(()=>{if(n){var m;const w=s.current.querySelectorAll('[data-in="true"]'),x=12,y=(m=t.position)==null?void 0:m.includes("top");let b=0,C=0;Array.from(w).reverse().forEach((j,S)=>{const k=j;k.classList.add("Toastify__toast--stacked"),S>0&&(k.dataset.collapsed=`${r}`),k.dataset.pos||(k.dataset.pos=y?"top":"bot");const E=b*(r?.2:1)+(r?0:x*S);k.style.setProperty("--y",`${y?E:-1*E}px`),k.style.setProperty("--g",`${x}`),k.style.setProperty("--s",""+(1-(r?C:0))),b+=k.offsetHeight,C+=.025})}},[r,c,n]),Se.createElement("div",{ref:s,className:"Toastify",id:f,onMouseEnter:()=>{n&&(o(!1),lt.pause())},onMouseLeave:g},a((m,w)=>{const x=w.length?{...d}:{...d,pointerEvents:"none"};return Se.createElement("div",{className:h(m),style:x,key:`container-${m}`},w.map(y=>{let{content:b,props:C}=y;return Se.createElement(x4,{...C,stacked:n,collapseAll:g,isIn:l(C.toastId,C.containerId),style:C.style,key:`toast-${C.key}`},b)}))}))}class C4{constructor(){this.defaultOptions={position:"top-right",autoClose:5e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,theme:"colored"}}success(t,n){lt.success(t,{...this.defaultOptions,...n})}error(t,n){lt.error(t,{...this.defaultOptions,...n})}info(t,n){lt.info(t,{...this.defaultOptions,...n})}warning(t,n){lt.warning(t,{...this.defaultOptions,...n})}}const De=new C4,W0=(e,t,n)=>{if(e&&"reportValidity"in e){const r=ue(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},CT=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?W0(r.ref,n,e):r.refs&&r.refs.forEach(o=>W0(o,n,e))}},j4=(e,t)=>{t.shouldUseNativeValidation&&CT(e,t);const n={};for(const r in e){const o=ue(t.fields,r),s=Object.assign(e[r]||{},{ref:o&&o.ref});if(_4(t.names||Object.keys(e),r)){const a=Object.assign({},ue(n,r));at(a,"root",s),at(n,r,a)}else at(n,r,s)}return n},_4=(e,t)=>e.some(n=>n.startsWith(t+"."));var E4=function(e,t){for(var n={};e.length;){var r=e[0],o=r.code,s=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[a]={message:l.message,type:l.code}}else n[a]={message:s,type:o};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(p){return e.push(p)})}),t){var c=n[a].types,u=c&&c[r.code];n[a]=Q1(a,t,n,o,u?[].concat(u,r.message):r.message)}e.shift()}return n},nn=function(e,t,n){return n===void 0&&(n={}),function(r,o,s){try{return Promise.resolve(function(a,l){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return s.shouldUseNativeValidation&&CT({},s),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(a){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(a))return{values:{},errors:j4(E4(a.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw a}))}catch(a){return Promise.reject(a)}}},tt;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const a of o)s[a]=a;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),a={};for(const l of s)a[l]=o[l];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const a in o)Object.prototype.hasOwnProperty.call(o,a)&&s.push(a);return s},e.find=(o,s)=>{for(const a of o)if(s(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(tt||(tt={}));var Cm;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Cm||(Cm={}));const ye=tt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ls=e=>{switch(typeof e){case"undefined":return ye.undefined;case"string":return ye.string;case"number":return isNaN(e)?ye.nan:ye.number;case"boolean":return ye.boolean;case"function":return ye.function;case"bigint":return ye.bigint;case"symbol":return ye.symbol;case"object":return Array.isArray(e)?ye.array:e===null?ye.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ye.promise:typeof Map<"u"&&e instanceof Map?ye.map:typeof Set<"u"&&e instanceof Set?ye.set:typeof Date<"u"&&e instanceof Date?ye.date:ye.object;default:return ye.unknown}},Q=tt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),T4=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class tr extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let l=r,c=0;for(;cn.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}tr.create=e=>new tr(e);const Ii=(e,t)=>{let n;switch(e.code){case Q.invalid_type:e.received===ye.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,tt.jsonStringifyReplacer)}`;break;case Q.unrecognized_keys:n=`Unrecognized key(s) in object: ${tt.joinValues(e.keys,", ")}`;break;case Q.invalid_union:n="Invalid input";break;case Q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${tt.joinValues(e.options)}`;break;case Q.invalid_enum_value:n=`Invalid enum value. Expected ${tt.joinValues(e.options)}, received '${e.received}'`;break;case Q.invalid_arguments:n="Invalid function arguments";break;case Q.invalid_return_type:n="Invalid function return type";break;case Q.invalid_date:n="Invalid date";break;case Q.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:tt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Q.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Q.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Q.custom:n="Invalid input";break;case Q.invalid_intersection_types:n="Intersection results could not be merged";break;case Q.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Q.not_finite:n="Number must be finite";break;default:n=t.defaultError,tt.assertNever(e)}return{message:n}};let jT=Ii;function k4(e){jT=e}function mf(){return jT}const vf=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],a={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(a,{data:t,defaultError:l}).message;return{...o,path:s,message:l}},N4=[];function me(e,t){const n=mf(),r=vf({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Ii?void 0:Ii].filter(o=>!!o)});e.common.issues.push(r)}class jn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return $e;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,a=await o.value;r.push({key:s,value:a})}return jn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:a}=o;if(s.status==="aborted"||a.status==="aborted")return $e;s.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(r[s.value]=a.value)}return{status:t.value,value:r}}}const $e=Object.freeze({status:"aborted"}),li=e=>({status:"dirty",value:e}),Pn=e=>({status:"valid",value:e}),jm=e=>e.status==="aborted",_m=e=>e.status==="dirty",Rc=e=>e.status==="valid",Pc=e=>typeof Promise<"u"&&e instanceof Promise;function yf(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function _T(e,t,n,r,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Ee;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ee||(Ee={}));var Ml,Al;class ao{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const K0=(e,t)=>{if(Rc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new tr(e.common.issues);return this._error=n,this._error}}};function He(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,l)=>{var c,u;const{message:d}=e;return a.code==="invalid_enum_value"?{message:d??l.defaultError}:typeof l.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:l.defaultError}:a.code!=="invalid_type"?{message:l.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:l.defaultError}},description:o}}class qe{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return ls(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ls(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new jn,ctx:{common:t.parent.common,data:t.data,parsedType:ls(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Pc(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ls(t)},s=this._parseSync({data:t,path:o.path,parent:o});return K0(o,s)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ls(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(Pc(o)?o:Promise.resolve(o));return K0(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const a=t(o),l=()=>s.addIssue({code:Q.custom,...r(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(l(),!1)):a?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Lr({schema:this,typeName:Ae.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return no.create(this,this._def)}nullable(){return Ps.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Or.create(this,this._def)}promise(){return Oi.create(this,this._def)}or(t){return Mc.create([this,t],this._def)}and(t){return Ac.create(this,t,this._def)}transform(t){return new Lr({...He(this._def),schema:this,typeName:Ae.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Vc({...He(this._def),innerType:this,defaultValue:n,typeName:Ae.ZodDefault})}brand(){return new Dy({typeName:Ae.ZodBranded,type:this,...He(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Uc({...He(this._def),innerType:this,catchValue:n,typeName:Ae.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return uu.create(this,t)}readonly(){return Bc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const R4=/^c[^\s-]{8,}$/i,P4=/^[0-9a-z]+$/,I4=/^[0-9A-HJKMNP-TV-Z]{26}$/,D4=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,O4=/^[a-z0-9_-]{21}$/i,M4=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,A4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,F4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Lh;const L4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,$4=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,z4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ET="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",V4=new RegExp(`^${ET}$`);function TT(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function U4(e){return new RegExp(`^${TT(e)}$`)}function kT(e){let t=`${ET}T${TT(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function B4(e,t){return!!((t==="v4"||!t)&&L4.test(e)||(t==="v6"||!t)&&$4.test(e))}class kr extends qe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ye.string){const s=this._getOrReturnCtx(t);return me(s,{code:Q.invalid_type,expected:ye.string,received:s.parsedType}),$e}const r=new jn;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.lengths.value&&(o=this._getOrReturnCtx(t,o),me(o,{code:Q.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const a=t.data.length>s.value,l=t.data.lengtht.test(o),{validation:n,code:Q.invalid_string,...Ee.errToObj(r)})}_addCheck(t){return new kr({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ee.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ee.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ee.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ee.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ee.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ee.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ee.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ee.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ee.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ee.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...Ee.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Ee.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ee.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ee.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ee.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ee.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ee.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ee.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ee.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ee.errToObj(n)})}nonempty(t){return this.min(1,Ee.errToObj(t))}trim(){return new kr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new kr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new kr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new kr({checks:[],typeName:Ae.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...He(e)})};function H4(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=parseInt(e.toFixed(o).replace(".","")),a=parseInt(t.toFixed(o).replace(".",""));return s%a/Math.pow(10,o)}class ks extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ye.number){const s=this._getOrReturnCtx(t);return me(s,{code:Q.invalid_type,expected:ye.number,received:s.parsedType}),$e}let r;const o=new jn;for(const s of this._def.checks)s.kind==="int"?tt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),me(r,{code:Q.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.datas.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),me(r,{code:Q.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?H4(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),me(r,{code:Q.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),me(r,{code:Q.not_finite,message:s.message}),o.dirty()):tt.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ee.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ee.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ee.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ee.toString(n))}setLimit(t,n,r,o){return new ks({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ee.toString(o)}]})}_addCheck(t){return new ks({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ee.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ee.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ee.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ee.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ee.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ee.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ee.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ee.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ee.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&tt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew ks({checks:[],typeName:Ae.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...He(e)});class Ns extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==ye.bigint){const s=this._getOrReturnCtx(t);return me(s,{code:Q.invalid_type,expected:ye.bigint,received:s.parsedType}),$e}let r;const o=new jn;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.datas.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),me(r,{code:Q.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),me(r,{code:Q.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):tt.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ee.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ee.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ee.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ee.toString(n))}setLimit(t,n,r,o){return new Ns({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ee.toString(o)}]})}_addCheck(t){return new Ns({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ee.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ee.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ee.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ee.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ee.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Ns({checks:[],typeName:Ae.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...He(e)})};class Ic extends qe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ye.boolean){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.boolean,received:r.parsedType}),$e}return Pn(t.data)}}Ic.create=e=>new Ic({typeName:Ae.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...He(e)});class Sa extends qe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ye.date){const s=this._getOrReturnCtx(t);return me(s,{code:Q.invalid_type,expected:ye.date,received:s.parsedType}),$e}if(isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return me(s,{code:Q.invalid_date}),$e}const r=new jn;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()s.value&&(o=this._getOrReturnCtx(t,o),me(o,{code:Q.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):tt.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Sa({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ee.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ee.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Sa({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ae.ZodDate,...He(e)});class xf extends qe{_parse(t){if(this._getType(t)!==ye.symbol){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.symbol,received:r.parsedType}),$e}return Pn(t.data)}}xf.create=e=>new xf({typeName:Ae.ZodSymbol,...He(e)});class Dc extends qe{_parse(t){if(this._getType(t)!==ye.undefined){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.undefined,received:r.parsedType}),$e}return Pn(t.data)}}Dc.create=e=>new Dc({typeName:Ae.ZodUndefined,...He(e)});class Oc extends qe{_parse(t){if(this._getType(t)!==ye.null){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.null,received:r.parsedType}),$e}return Pn(t.data)}}Oc.create=e=>new Oc({typeName:Ae.ZodNull,...He(e)});class Di extends qe{constructor(){super(...arguments),this._any=!0}_parse(t){return Pn(t.data)}}Di.create=e=>new Di({typeName:Ae.ZodAny,...He(e)});class ua extends qe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Pn(t.data)}}ua.create=e=>new ua({typeName:Ae.ZodUnknown,...He(e)});class Ao extends qe{_parse(t){const n=this._getOrReturnCtx(t);return me(n,{code:Q.invalid_type,expected:ye.never,received:n.parsedType}),$e}}Ao.create=e=>new Ao({typeName:Ae.ZodNever,...He(e)});class wf extends qe{_parse(t){if(this._getType(t)!==ye.undefined){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.void,received:r.parsedType}),$e}return Pn(t.data)}}wf.create=e=>new wf({typeName:Ae.ZodVoid,...He(e)});class Or extends qe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==ye.array)return me(n,{code:Q.invalid_type,expected:ye.array,received:n.parsedType}),$e;if(o.exactLength!==null){const a=n.data.length>o.exactLength.value,l=n.data.lengtho.maxLength.value&&(me(n,{code:Q.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,l)=>o.type._parseAsync(new ao(n,a,n.path,l)))).then(a=>jn.mergeArray(r,a));const s=[...n.data].map((a,l)=>o.type._parseSync(new ao(n,a,n.path,l)));return jn.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new Or({...this._def,minLength:{value:t,message:Ee.toString(n)}})}max(t,n){return new Or({...this._def,maxLength:{value:t,message:Ee.toString(n)}})}length(t,n){return new Or({...this._def,exactLength:{value:t,message:Ee.toString(n)}})}nonempty(t){return this.min(1,t)}}Or.create=(e,t)=>new Or({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ae.ZodArray,...He(t)});function Ga(e){if(e instanceof Nt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=no.create(Ga(r))}return new Nt({...e._def,shape:()=>t})}else return e instanceof Or?new Or({...e._def,type:Ga(e.element)}):e instanceof no?no.create(Ga(e.unwrap())):e instanceof Ps?Ps.create(Ga(e.unwrap())):e instanceof io?io.create(e.items.map(t=>Ga(t))):e}class Nt extends qe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=tt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==ye.object){const u=this._getOrReturnCtx(t);return me(u,{code:Q.invalid_type,expected:ye.object,received:u.parsedType}),$e}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:a}=this._getCached(),l=[];if(!(this._def.catchall instanceof Ao&&this._def.unknownKeys==="strip"))for(const u in o.data)a.includes(u)||l.push(u);const c=[];for(const u of a){const d=s[u],p=o.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ao(o,p,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Ao){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(u==="strict")l.length>0&&(me(o,{code:Q.unrecognized_keys,keys:l}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const p=o.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new ao(o,p,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const p=await d.key,f=await d.value;u.push({key:p,value:f,alwaysSet:d.alwaysSet})}return u}).then(u=>jn.mergeObjectSync(r,u)):jn.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return Ee.errToObj,new Nt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,s,a,l;const c=(a=(s=(o=this._def).errorMap)===null||s===void 0?void 0:s.call(o,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=Ee.errToObj(t).message)!==null&&l!==void 0?l:c}:{message:c}}}:{}})}strip(){return new Nt({...this._def,unknownKeys:"strip"})}passthrough(){return new Nt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Nt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Nt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ae.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Nt({...this._def,catchall:t})}pick(t){const n={};return tt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Nt({...this._def,shape:()=>n})}omit(t){const n={};return tt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Nt({...this._def,shape:()=>n})}deepPartial(){return Ga(this)}partial(t){const n={};return tt.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new Nt({...this._def,shape:()=>n})}required(t){const n={};return tt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof no;)s=s._def.innerType;n[r]=s}}),new Nt({...this._def,shape:()=>n})}keyof(){return NT(tt.objectKeys(this.shape))}}Nt.create=(e,t)=>new Nt({shape:()=>e,unknownKeys:"strip",catchall:Ao.create(),typeName:Ae.ZodObject,...He(t)});Nt.strictCreate=(e,t)=>new Nt({shape:()=>e,unknownKeys:"strict",catchall:Ao.create(),typeName:Ae.ZodObject,...He(t)});Nt.lazycreate=(e,t)=>new Nt({shape:e,unknownKeys:"strip",catchall:Ao.create(),typeName:Ae.ZodObject,...He(t)});class Mc extends qe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const l of s)if(l.result.status==="valid")return l.result;for(const l of s)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const a=s.map(l=>new tr(l.ctx.common.issues));return me(n,{code:Q.invalid_union,unionErrors:a}),$e}if(n.common.async)return Promise.all(r.map(async s=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(o);{let s;const a=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const l=a.map(c=>new tr(c));return me(n,{code:Q.invalid_union,unionErrors:l}),$e}}get options(){return this._def.options}}Mc.create=(e,t)=>new Mc({options:e,typeName:Ae.ZodUnion,...He(t)});const go=e=>e instanceof Lc?go(e.schema):e instanceof Lr?go(e.innerType()):e instanceof $c?[e.value]:e instanceof Rs?e.options:e instanceof zc?tt.objectValues(e.enum):e instanceof Vc?go(e._def.innerType):e instanceof Dc?[void 0]:e instanceof Oc?[null]:e instanceof no?[void 0,...go(e.unwrap())]:e instanceof Ps?[null,...go(e.unwrap())]:e instanceof Dy||e instanceof Bc?go(e.unwrap()):e instanceof Uc?go(e._def.innerType):[];class Cp extends qe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.object)return me(n,{code:Q.invalid_type,expected:ye.object,received:n.parsedType}),$e;const r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(me(n,{code:Q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),$e)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const s of n){const a=go(s.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const l of a){if(o.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);o.set(l,s)}}return new Cp({typeName:Ae.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...He(r)})}}function Em(e,t){const n=ls(e),r=ls(t);if(e===t)return{valid:!0,data:e};if(n===ye.object&&r===ye.object){const o=tt.objectKeys(t),s=tt.objectKeys(e).filter(l=>o.indexOf(l)!==-1),a={...e,...t};for(const l of s){const c=Em(e[l],t[l]);if(!c.valid)return{valid:!1};a[l]=c.data}return{valid:!0,data:a}}else if(n===ye.array&&r===ye.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s{if(jm(s)||jm(a))return $e;const l=Em(s.value,a.value);return l.valid?((_m(s)||_m(a))&&n.dirty(),{status:n.value,value:l.data}):(me(r,{code:Q.invalid_intersection_types}),$e)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,a])=>o(s,a)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ac.create=(e,t,n)=>new Ac({left:e,right:t,typeName:Ae.ZodIntersection,...He(n)});class io extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.array)return me(r,{code:Q.invalid_type,expected:ye.array,received:r.parsedType}),$e;if(r.data.lengththis._def.items.length&&(me(r,{code:Q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new ao(r,a,r.path,l)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>jn.mergeArray(n,a)):jn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new io({...this._def,rest:t})}}io.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new io({items:e,typeName:Ae.ZodTuple,rest:null,...He(t)})};class Fc extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.object)return me(r,{code:Q.invalid_type,expected:ye.object,received:r.parsedType}),$e;const o=[],s=this._def.keyType,a=this._def.valueType;for(const l in r.data)o.push({key:s._parse(new ao(r,l,r.path,l)),value:a._parse(new ao(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?jn.mergeObjectAsync(n,o):jn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof qe?new Fc({keyType:t,valueType:n,typeName:Ae.ZodRecord,...He(r)}):new Fc({keyType:kr.create(),valueType:t,typeName:Ae.ZodRecord,...He(n)})}}class bf extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.map)return me(r,{code:Q.invalid_type,expected:ye.map,received:r.parsedType}),$e;const o=this._def.keyType,s=this._def.valueType,a=[...r.data.entries()].map(([l,c],u)=>({key:o._parse(new ao(r,l,r.path,[u,"key"])),value:s._parse(new ao(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of a){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return $e;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of a){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return $e;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}bf.create=(e,t,n)=>new bf({valueType:t,keyType:e,typeName:Ae.ZodMap,...He(n)});class Ca extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.set)return me(r,{code:Q.invalid_type,expected:ye.set,received:r.parsedType}),$e;const o=this._def;o.minSize!==null&&r.data.sizeo.maxSize.value&&(me(r,{code:Q.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function a(c){const u=new Set;for(const d of c){if(d.status==="aborted")return $e;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>s._parse(new ao(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>a(c)):a(l)}min(t,n){return new Ca({...this._def,minSize:{value:t,message:Ee.toString(n)}})}max(t,n){return new Ca({...this._def,maxSize:{value:t,message:Ee.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Ca.create=(e,t)=>new Ca({valueType:e,minSize:null,maxSize:null,typeName:Ae.ZodSet,...He(t)});class yi extends qe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.function)return me(n,{code:Q.invalid_type,expected:ye.function,received:n.parsedType}),$e;function r(l,c){return vf({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,mf(),Ii].filter(u=>!!u),issueData:{code:Q.invalid_arguments,argumentsError:c}})}function o(l,c){return vf({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,mf(),Ii].filter(u=>!!u),issueData:{code:Q.invalid_return_type,returnTypeError:c}})}const s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Oi){const l=this;return Pn(async function(...c){const u=new tr([]),d=await l._def.args.parseAsync(c,s).catch(h=>{throw u.addIssue(r(c,h)),u}),p=await Reflect.apply(a,this,d);return await l._def.returns._def.type.parseAsync(p,s).catch(h=>{throw u.addIssue(o(p,h)),u})})}else{const l=this;return Pn(function(...c){const u=l._def.args.safeParse(c,s);if(!u.success)throw new tr([r(c,u.error)]);const d=Reflect.apply(a,this,u.data),p=l._def.returns.safeParse(d,s);if(!p.success)throw new tr([o(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new yi({...this._def,args:io.create(t).rest(ua.create())})}returns(t){return new yi({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new yi({args:t||io.create([]).rest(ua.create()),returns:n||ua.create(),typeName:Ae.ZodFunction,...He(r)})}}class Lc extends qe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Lc.create=(e,t)=>new Lc({getter:e,typeName:Ae.ZodLazy,...He(t)});class $c extends qe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return me(n,{received:n.data,code:Q.invalid_literal,expected:this._def.value}),$e}return{status:"valid",value:t.data}}get value(){return this._def.value}}$c.create=(e,t)=>new $c({value:e,typeName:Ae.ZodLiteral,...He(t)});function NT(e,t){return new Rs({values:e,typeName:Ae.ZodEnum,...He(t)})}class Rs extends qe{constructor(){super(...arguments),Ml.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return me(n,{expected:tt.joinValues(r),received:n.parsedType,code:Q.invalid_type}),$e}if(yf(this,Ml)||_T(this,Ml,new Set(this._def.values)),!yf(this,Ml).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return me(n,{received:n.data,code:Q.invalid_enum_value,options:r}),$e}return Pn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Rs.create(t,{...this._def,...n})}exclude(t,n=this._def){return Rs.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ml=new WeakMap;Rs.create=NT;class zc extends qe{constructor(){super(...arguments),Al.set(this,void 0)}_parse(t){const n=tt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ye.string&&r.parsedType!==ye.number){const o=tt.objectValues(n);return me(r,{expected:tt.joinValues(o),received:r.parsedType,code:Q.invalid_type}),$e}if(yf(this,Al)||_T(this,Al,new Set(tt.getValidEnumValues(this._def.values))),!yf(this,Al).has(t.data)){const o=tt.objectValues(n);return me(r,{received:r.data,code:Q.invalid_enum_value,options:o}),$e}return Pn(t.data)}get enum(){return this._def.values}}Al=new WeakMap;zc.create=(e,t)=>new zc({values:e,typeName:Ae.ZodNativeEnum,...He(t)});class Oi extends qe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.promise&&n.common.async===!1)return me(n,{code:Q.invalid_type,expected:ye.promise,received:n.parsedType}),$e;const r=n.parsedType===ye.promise?n.data:Promise.resolve(n.data);return Pn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Oi.create=(e,t)=>new Oi({type:e,typeName:Ae.ZodPromise,...He(t)});class Lr extends qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:a=>{me(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const a=o.transform(r.data,s);if(r.common.async)return Promise.resolve(a).then(async l=>{if(n.value==="aborted")return $e;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?$e:c.status==="dirty"||n.value==="dirty"?li(c.value):c});{if(n.value==="aborted")return $e;const l=this._def.schema._parseSync({data:a,path:r.path,parent:r});return l.status==="aborted"?$e:l.status==="dirty"||n.value==="dirty"?li(l.value):l}}if(o.type==="refinement"){const a=l=>{const c=o.refinement(l,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?$e:(l.status==="dirty"&&n.dirty(),a(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?$e:(l.status==="dirty"&&n.dirty(),a(l.value).then(()=>({status:n.value,value:l.value}))))}if(o.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Rc(a))return a;const l=o.transform(a.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Rc(a)?Promise.resolve(o.transform(a.value,s)).then(l=>({status:n.value,value:l})):a);tt.assertNever(o)}}Lr.create=(e,t,n)=>new Lr({schema:e,typeName:Ae.ZodEffects,effect:t,...He(n)});Lr.createWithPreprocess=(e,t,n)=>new Lr({schema:t,effect:{type:"preprocess",transform:e},typeName:Ae.ZodEffects,...He(n)});class no extends qe{_parse(t){return this._getType(t)===ye.undefined?Pn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}no.create=(e,t)=>new no({innerType:e,typeName:Ae.ZodOptional,...He(t)});class Ps extends qe{_parse(t){return this._getType(t)===ye.null?Pn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ps.create=(e,t)=>new Ps({innerType:e,typeName:Ae.ZodNullable,...He(t)});class Vc extends qe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ye.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Vc.create=(e,t)=>new Vc({innerType:e,typeName:Ae.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...He(t)});class Uc extends qe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Pc(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new tr(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Uc.create=(e,t)=>new Uc({innerType:e,typeName:Ae.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...He(t)});class Sf extends qe{_parse(t){if(this._getType(t)!==ye.nan){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.nan,received:r.parsedType}),$e}return{status:"valid",value:t.data}}}Sf.create=e=>new Sf({typeName:Ae.ZodNaN,...He(e)});const G4=Symbol("zod_brand");class Dy extends qe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class uu extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?$e:s.status==="dirty"?(n.dirty(),li(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?$e:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new uu({in:t,out:n,typeName:Ae.ZodPipeline})}}class Bc extends qe{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Rc(o)&&(o.value=Object.freeze(o.value)),o);return Pc(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Bc.create=(e,t)=>new Bc({innerType:e,typeName:Ae.ZodReadonly,...He(t)});function RT(e,t={},n){return e?Di.create().superRefine((r,o)=>{var s,a;if(!e(r)){const l=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,c=(a=(s=l.fatal)!==null&&s!==void 0?s:n)!==null&&a!==void 0?a:!0,u=typeof l=="string"?{message:l}:l;o.addIssue({code:"custom",...u,fatal:c})}}):Di.create()}const W4={object:Nt.lazycreate};var Ae;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ae||(Ae={}));const K4=(e,t={message:`Input not instance of ${e.name}`})=>RT(n=>n instanceof e,t),PT=kr.create,IT=ks.create,q4=Sf.create,Z4=Ns.create,DT=Ic.create,J4=Sa.create,Y4=xf.create,X4=Dc.create,Q4=Oc.create,ez=Di.create,tz=ua.create,nz=Ao.create,rz=wf.create,oz=Or.create,sz=Nt.create,az=Nt.strictCreate,iz=Mc.create,lz=Cp.create,cz=Ac.create,uz=io.create,dz=Fc.create,fz=bf.create,pz=Ca.create,hz=yi.create,gz=Lc.create,mz=$c.create,vz=Rs.create,yz=zc.create,xz=Oi.create,q0=Lr.create,wz=no.create,bz=Ps.create,Sz=Lr.createWithPreprocess,Cz=uu.create,jz=()=>PT().optional(),_z=()=>IT().optional(),Ez=()=>DT().optional(),Tz={string:e=>kr.create({...e,coerce:!0}),number:e=>ks.create({...e,coerce:!0}),boolean:e=>Ic.create({...e,coerce:!0}),bigint:e=>Ns.create({...e,coerce:!0}),date:e=>Sa.create({...e,coerce:!0})},kz=$e;var T=Object.freeze({__proto__:null,defaultErrorMap:Ii,setErrorMap:k4,getErrorMap:mf,makeIssue:vf,EMPTY_PATH:N4,addIssueToContext:me,ParseStatus:jn,INVALID:$e,DIRTY:li,OK:Pn,isAborted:jm,isDirty:_m,isValid:Rc,isAsync:Pc,get util(){return tt},get objectUtil(){return Cm},ZodParsedType:ye,getParsedType:ls,ZodType:qe,datetimeRegex:kT,ZodString:kr,ZodNumber:ks,ZodBigInt:Ns,ZodBoolean:Ic,ZodDate:Sa,ZodSymbol:xf,ZodUndefined:Dc,ZodNull:Oc,ZodAny:Di,ZodUnknown:ua,ZodNever:Ao,ZodVoid:wf,ZodArray:Or,ZodObject:Nt,ZodUnion:Mc,ZodDiscriminatedUnion:Cp,ZodIntersection:Ac,ZodTuple:io,ZodRecord:Fc,ZodMap:bf,ZodSet:Ca,ZodFunction:yi,ZodLazy:Lc,ZodLiteral:$c,ZodEnum:Rs,ZodNativeEnum:zc,ZodPromise:Oi,ZodEffects:Lr,ZodTransformer:Lr,ZodOptional:no,ZodNullable:Ps,ZodDefault:Vc,ZodCatch:Uc,ZodNaN:Sf,BRAND:G4,ZodBranded:Dy,ZodPipeline:uu,ZodReadonly:Bc,custom:RT,Schema:qe,ZodSchema:qe,late:W4,get ZodFirstPartyTypeKind(){return Ae},coerce:Tz,any:ez,array:oz,bigint:Z4,boolean:DT,date:J4,discriminatedUnion:lz,effect:q0,enum:vz,function:hz,instanceof:K4,intersection:cz,lazy:gz,literal:mz,map:fz,nan:q4,nativeEnum:yz,never:nz,null:Q4,nullable:bz,number:IT,object:sz,oboolean:Ez,onumber:_z,optional:wz,ostring:jz,pipeline:Cz,preprocess:Sz,promise:xz,record:dz,set:pz,strictObject:az,string:PT,symbol:Y4,transformer:q0,tuple:uz,undefined:X4,union:iz,unknown:tz,void:rz,NEVER:kz,ZodIssueCode:Q,quotelessJson:T4,ZodError:tr});const Nz=T.object({name:T.string(),integration:T.string(),token:T.string(),number:T.string()});function Rz({resetTable:e}){const[t,n]=v.useState(!1),r=tn({resolver:nn(Nz),defaultValues:{name:"",integration:"WHATSAPP-BAILEYS",token:crypto.randomUUID().replace("-","").toLocaleUpperCase(),number:""}}),o=async a=>{var l,c,u;try{const d={instanceName:a.name,integration:a.integration,token:a.token===""?void 0:a.token,number:a.number===""?void 0:a.number};await dA(d),De.success("Instância criada com sucesso"),n(!1),s(),e()}catch(d){console.error("Erro ao criar instância:",d),De.error(`Erro ao criar : ${(u=(c=(l=d==null?void 0:d.response)==null?void 0:l.data)==null?void 0:c.response)==null?void 0:u.message}`)}},s=()=>{r.reset({name:"",integration:"WHATSAPP-BAILEYS",token:crypto.randomUUID().replace("-","").toLocaleUpperCase(),number:""})};return i.jsxs(Sn,{open:t,onOpenChange:n,children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",children:[i.jsx(ou,{})," Instância"]})}),i.jsxs(un,{className:"sm:max-w-[650px]",onCloseAutoFocus:s,children:[i.jsx(dn,{children:i.jsx(On,{children:"Nova Instância"})}),i.jsx(Uo,{...r,children:i.jsxs("form",{onSubmit:r.handleSubmit(o),className:"grid gap-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[i.jsx(fs,{htmlFor:"name",className:"text-right",children:"Nome"}),i.jsx(se,{id:"name",...r.register("name"),className:"col-span-3 border border-gray-600"})]}),i.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[i.jsx(fs,{htmlFor:"integration",className:"text-right",children:"Integração"}),i.jsx(P,{control:r.control,name:"integration",render:({field:a})=>i.jsx(M,{className:"col-span-3 w-full border border-gray-600",children:i.jsxs(St,{onValueChange:a.onChange,defaultValue:a.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma credencial"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"WHATSAPP-BAILEYS",children:"Baileys"}),i.jsx(he,{value:"WHATSAPP-BUSINESS",children:"Whatsapp Cloud API"})]})]})})})]}),i.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[i.jsx(fs,{htmlFor:"token",className:"text-right",children:"Token"}),i.jsx(se,{id:"token",...r.register("token"),className:"col-span-3 border border-gray-600"})]}),i.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[i.jsx(fs,{htmlFor:"number",className:"text-right",children:"Número"}),i.jsx(se,{id:"number",...r.register("number"),className:"col-span-3 border border-gray-600"})]}),i.jsx(wr,{children:i.jsx(Te,{type:"submit",children:"Salvar"})})]})})]})]})}const OT=e=>{navigator.clipboard.writeText(e),De.success("Copiado para a área de transferência")},$h=async e=>{try{const t=await fA();e(t)}catch(t){console.error("Erro ao buscar dados:",t)}};function Pz(){const[e,t]=v.useState(!1),[n,r]=v.useState([]),[o,s]=v.useState([]),[a,l]=v.useState([]),[c,u]=v.useState("all"),d=ir(),p=()=>{t(!e)},f=y=>()=>{d(`/manager/instance/${y}/dashboard`)};v.useEffect(()=>{(async()=>{await $h(b=>{r(b)})})()},[]);const h=y=>{switch(y){case"open":return i.jsxs("div",{className:"btn connected",children:["Conectada ",i.jsx("span",{className:"status-connected connected"})]});case"connecting":return i.jsxs("div",{className:"btn connected",children:["Conectando ",i.jsx("span",{className:"status-connecting connected"})]});case"closed":return i.jsxs("div",{className:"btn connected",children:["Desconectado ",i.jsx("span",{className:"status-disconnected connected"})]});default:return i.jsxs("div",{className:"btn connected",children:["Desconectado ",i.jsx("span",{className:"status-disconnected connected"})]})}},g=async()=>{await $h(y=>{r(y)})},m=async y=>{var b,C,j;s([...o,y]);try{try{await __(y)}catch(S){console.error("Erro ao fazer logout:",S)}await gA(y),await new Promise(S=>setTimeout(S,1e3)),g()}catch(S){console.error("Erro ao deletar instância:",S),De.error(`Erro ao deletar : ${(j=(C=(b=S==null?void 0:S.response)==null?void 0:b.data)==null?void 0:C.response)==null?void 0:j.message}`)}finally{s(o.filter(S=>S!==y))}},w=async y=>{if(y===""){await g();return}const b=n.filter(C=>C.name.toLowerCase().includes(y.toLowerCase()));r(b)},x=async y=>{if(u(y),y==="all"){await g();return}await $h(b=>{const C=b.filter(j=>j.connectionStatus===y);r(C)})};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"toolbar",children:[i.jsx("div",{className:"toolbar-title",children:i.jsx("h2",{children:"Instâncias"})}),i.jsxs("div",{className:"toolbar-buttons",children:[i.jsx(Te,{variant:"outline",className:"refresh-button",children:i.jsx(C_,{onClick:g,size:"20"})}),i.jsx(Rz,{resetTable:g})]})]}),i.jsxs("div",{className:"search",children:[i.jsx("div",{className:"search-bar",children:i.jsx("input",{type:"text",placeholder:"Pesquisar",onChange:y=>w(y.target.value)})}),i.jsxs("div",{className:"status-dropdown",children:[i.jsxs("button",{className:"dropdown-button",onClick:p,children:["Status ",i.jsx(JM,{size:"15"})]}),e&&i.jsxs("div",{className:"dropdown-menu",children:[i.jsxs("button",{className:`dropdown-item ${c==="all"?"active":""}`,onClick:()=>x("all"),children:["Todos",c==="all"&&i.jsx("span",{children:i.jsx(si,{size:"15",className:"ml-2"})})]}),i.jsxs("button",{onClick:()=>x("close"),className:`dropdown-item ${c==="close"?"active":""}`,children:["Desconectado",c==="close"&&i.jsx("span",{children:i.jsx(si,{size:"15",className:"ml-2"})})]}),i.jsxs("button",{onClick:()=>x("connecting"),className:`dropdown-item ${c==="connecting"?"active":""}`,children:["Conectando",c==="connecting"&&i.jsx("span",{children:i.jsx(si,{size:"15",className:"ml-2"})})]}),i.jsxs("button",{onClick:()=>x("open"),className:`dropdown-item ${c==="open"?"active":""}`,children:["Conectado",c==="open"&&i.jsx("span",{children:i.jsx(si,{size:"15",className:"ml-2"})})]})]})]})]}),i.jsx("main",{className:"instance-cards",children:n&&n.length>0&&Array.isArray(n)&&n.map(y=>{var b,C;return i.jsxs(gi,{className:"instance-card",children:[i.jsxs("div",{className:"card-header",children:[i.jsxs("div",{className:"card-id",children:[i.jsx("span",{children:a.includes(y.token)?y.token.substring(0,36)+"...":y.token.substring(0,36).split("").map(()=>"*").join("")}),i.jsx(w_,{className:"card-icon",size:"15",onClick:()=>{OT(y.token)}}),a.includes(y.token)?i.jsx(b_,{className:"card-icon",size:"15",onClick:()=>{l(a.filter(j=>j!==y.token))}}):i.jsx(S_,{className:"card-icon",size:"15",onClick:()=>{l([...a,y.token])}})]}),i.jsx("div",{className:"card-menu",onClick:f(y.id),children:i.jsx(ru,{className:"card-icon",size:"20"})})]}),i.jsxs("div",{className:"card-body",children:[i.jsxs("div",{className:"card-details",children:[i.jsx("p",{className:"instance-name",children:y.name}),i.jsx("p",{className:"instance-description",children:y.profileName})]}),i.jsx("div",{className:"card-contact",children:i.jsx("p",{children:y.ownerJid&&y.ownerJid.split("@")[0]})})]}),i.jsxs("div",{className:"card-footer",children:[i.jsxs("div",{className:"card-stats",children:[i.jsxs("div",{className:"stat",children:[i.jsx(XM,{className:"stat-icon",size:"20"}),i.jsx("span",{children:((b=y==null?void 0:y._count)==null?void 0:b.Contact)||0})]}),i.jsxs("div",{className:"stat",children:[i.jsx(ey,{className:"stat-icon",size:"20"}),i.jsx("span",{children:((C=y==null?void 0:y._count)==null?void 0:C.Message)||0})]})]}),i.jsxs("div",{className:"card-actions",children:[h(y.connectionStatus),i.jsx("button",{className:`btn disconnect ${o.includes(y.name)?"disabled":""}`,onClick:()=>m(y.name),disabled:o.includes(y.name),children:o.includes(y.name)?i.jsx("span",{children:"Deletando..."}):i.jsx("span",{children:"Deletar"})})]})]})]},y.id)})})]})}var zh="rovingFocusGroup.onEntryFocus",Iz={bubbles:!1,cancelable:!0},jp="RovingFocusGroup",[Tm,MT,Dz]=Cy(jp),[Oz,_p]=lo(jp,[Dz]),[Mz,Az]=Oz(jp),AT=v.forwardRef((e,t)=>i.jsx(Tm.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(Tm.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(Fz,{...e,ref:t})})}));AT.displayName=jp;var Fz=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...p}=e,f=v.useRef(null),h=ut(t,f),g=hp(s),[m=null,w]=js({prop:a,defaultProp:l,onChange:c}),[x,y]=v.useState(!1),b=xr(u),C=MT(n),j=v.useRef(!1),[S,k]=v.useState(0);return v.useEffect(()=>{const E=f.current;if(E)return E.addEventListener(zh,b),()=>E.removeEventListener(zh,b)},[b]),i.jsx(Mz,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:m,onItemFocus:v.useCallback(E=>w(E),[w]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>k(E=>E+1),[]),onFocusableItemRemove:v.useCallback(()=>k(E=>E-1),[]),children:i.jsx(Ve.div,{tabIndex:x||S===0?-1:0,"data-orientation":r,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:Ce(e.onMouseDown,()=>{j.current=!0}),onFocus:Ce(e.onFocus,E=>{const O=!j.current;if(E.target===E.currentTarget&&O&&!x){const F=new CustomEvent(zh,Iz);if(E.currentTarget.dispatchEvent(F),!F.defaultPrevented){const Z=C().filter(ne=>ne.focusable),I=Z.find(ne=>ne.active),q=Z.find(ne=>ne.id===m),J=[I,q,...Z].filter(Boolean).map(ne=>ne.ref.current);$T(J,d)}}j.current=!1}),onBlur:Ce(e.onBlur,()=>y(!1))})})}),FT="RovingFocusGroupItem",LT=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,...a}=e,l=Ir(),c=s||l,u=Az(FT,n),d=u.currentTabStopId===c,p=MT(n),{onFocusableItemAdd:f,onFocusableItemRemove:h}=u;return v.useEffect(()=>{if(r)return f(),()=>h()},[r,f,h]),i.jsx(Tm.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:i.jsx(Ve.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:Ce(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:Ce(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Ce(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=zz(g,u.orientation,u.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let x=p().filter(y=>y.focusable).map(y=>y.ref.current);if(m==="last")x.reverse();else if(m==="prev"||m==="next"){m==="prev"&&x.reverse();const y=x.indexOf(g.currentTarget);x=u.loop?Vz(x,y+1):x.slice(y+1)}setTimeout(()=>$T(x))}})})})});LT.displayName=FT;var Lz={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $z(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zz(e,t,n){const r=$z(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Lz[r]}function $T(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Vz(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var zT=AT,VT=LT,km=["Enter"," "],Uz=["ArrowDown","PageUp","Home"],UT=["ArrowUp","PageDown","End"],Bz=[...Uz,...UT],Hz={ltr:[...km,"ArrowRight"],rtl:[...km,"ArrowLeft"]},Gz={ltr:["ArrowLeft"],rtl:["ArrowRight"]},du="Menu",[Hc,Wz,Kz]=Cy(du),[Ta,BT]=lo(du,[Kz,vp,_p]),Ep=vp(),HT=_p(),[qz,ka]=Ta(du),[Zz,fu]=Ta(du),GT=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:a=!0}=e,l=Ep(t),[c,u]=v.useState(null),d=v.useRef(!1),p=xr(s),f=hp(o);return v.useEffect(()=>{const h=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),i.jsx(RE,{...l,children:i.jsx(qz,{scope:t,open:n,onOpenChange:p,content:c,onContentChange:u,children:i.jsx(Zz,{scope:t,onClose:v.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:d,dir:f,modal:a,children:r})})})};GT.displayName=du;var Jz="MenuAnchor",Oy=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ep(n);return i.jsx(PE,{...o,...r,ref:t})});Oy.displayName=Jz;var My="MenuPortal",[Yz,WT]=Ta(My,{forceMount:void 0}),KT=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=ka(My,t);return i.jsx(Yz,{scope:t,forceMount:n,children:i.jsx(co,{present:n||s.open,children:i.jsx(lp,{asChild:!0,container:o,children:r})})})};KT.displayName=My;var mr="MenuContent",[Xz,Ay]=Ta(mr),qT=v.forwardRef((e,t)=>{const n=WT(mr,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=ka(mr,e.__scopeMenu),a=fu(mr,e.__scopeMenu);return i.jsx(Hc.Provider,{scope:e.__scopeMenu,children:i.jsx(co,{present:r||s.open,children:i.jsx(Hc.Slot,{scope:e.__scopeMenu,children:a.modal?i.jsx(Qz,{...o,ref:t}):i.jsx(eV,{...o,ref:t})})})})}),Qz=v.forwardRef((e,t)=>{const n=ka(mr,e.__scopeMenu),r=v.useRef(null),o=ut(t,r);return v.useEffect(()=>{const s=r.current;if(s)return py(s)},[]),i.jsx(Fy,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ce(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),eV=v.forwardRef((e,t)=>{const n=ka(mr,e.__scopeMenu);return i.jsx(Fy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Fy=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:f,onDismiss:h,disableOutsideScroll:g,...m}=e,w=ka(mr,n),x=fu(mr,n),y=Ep(n),b=HT(n),C=Wz(n),[j,S]=v.useState(null),k=v.useRef(null),E=ut(t,k,w.onContentChange),O=v.useRef(0),F=v.useRef(""),Z=v.useRef(0),I=v.useRef(null),q=v.useRef("right"),H=v.useRef(0),J=g?up:v.Fragment,ne=g?{as:Do,allowPinchZoom:!0}:void 0,K=L=>{var W,we;const ee=F.current+L,fe=C().filter(Re=>!Re.disabled),B=document.activeElement,te=(W=fe.find(Re=>Re.ref.current===B))==null?void 0:W.textValue,X=fe.map(Re=>Re.textValue),ie=fV(X,ee,te),re=(we=fe.find(Re=>Re.textValue===ie))==null?void 0:we.ref.current;(function Re(Fe){F.current=Fe,window.clearTimeout(O.current),Fe!==""&&(O.current=window.setTimeout(()=>Re(""),1e3))})(ee),re&&setTimeout(()=>re.focus())};v.useEffect(()=>()=>window.clearTimeout(O.current),[]),fy();const z=v.useCallback(L=>{var fe,B;return q.current===((fe=I.current)==null?void 0:fe.side)&&hV(L,(B=I.current)==null?void 0:B.area)},[]);return i.jsx(Xz,{scope:n,searchRef:F,onItemEnter:v.useCallback(L=>{z(L)&&L.preventDefault()},[z]),onItemLeave:v.useCallback(L=>{var ee;z(L)||((ee=k.current)==null||ee.focus(),S(null))},[z]),onTriggerLeave:v.useCallback(L=>{z(L)&&L.preventDefault()},[z]),pointerGraceTimerRef:Z,onPointerGraceIntentChange:v.useCallback(L=>{I.current=L},[]),children:i.jsx(J,{...ne,children:i.jsx(ip,{asChild:!0,trapped:o,onMountAutoFocus:Ce(s,L=>{var ee;L.preventDefault(),(ee=k.current)==null||ee.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:i.jsx(ap,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:f,onDismiss:h,children:i.jsx(zT,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:S,onEntryFocus:Ce(c,L=>{x.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(IE,{role:"menu","aria-orientation":"vertical","data-state":uk(w.open),"data-radix-menu-content":"",dir:x.dir,...y,...m,ref:E,style:{outline:"none",...m.style},onKeyDown:Ce(m.onKeyDown,L=>{const fe=L.target.closest("[data-radix-menu-content]")===L.currentTarget,B=L.ctrlKey||L.altKey||L.metaKey,te=L.key.length===1;fe&&(L.key==="Tab"&&L.preventDefault(),!B&&te&&K(L.key));const X=k.current;if(L.target!==X||!Bz.includes(L.key))return;L.preventDefault();const re=C().filter(W=>!W.disabled).map(W=>W.ref.current);UT.includes(L.key)&&re.reverse(),uV(re)}),onBlur:Ce(e.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(O.current),F.current="")}),onPointerMove:Ce(e.onPointerMove,Gc(L=>{const ee=L.target,fe=H.current!==L.clientX;if(L.currentTarget.contains(ee)&&fe){const B=L.clientX>H.current?"right":"left";q.current=B,H.current=L.clientX}}))})})})})})})});qT.displayName=mr;var tV="MenuGroup",Ly=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Ve.div,{role:"group",...r,ref:t})});Ly.displayName=tV;var nV="MenuLabel",ZT=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Ve.div,{...r,ref:t})});ZT.displayName=nV;var Cf="MenuItem",Z0="menu.itemSelect",Tp=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=v.useRef(null),a=fu(Cf,e.__scopeMenu),l=Ay(Cf,e.__scopeMenu),c=ut(t,s),u=v.useRef(!1),d=()=>{const p=s.current;if(!n&&p){const f=new CustomEvent(Z0,{bubbles:!0,cancelable:!0});p.addEventListener(Z0,h=>r==null?void 0:r(h),{once:!0}),T_(p,f),f.defaultPrevented?u.current=!1:a.onClose()}};return i.jsx(JT,{...o,ref:c,disabled:n,onClick:Ce(e.onClick,d),onPointerDown:p=>{var f;(f=e.onPointerDown)==null||f.call(e,p),u.current=!0},onPointerUp:Ce(e.onPointerUp,p=>{var f;u.current||(f=p.currentTarget)==null||f.click()}),onKeyDown:Ce(e.onKeyDown,p=>{const f=l.searchRef.current!=="";n||f&&p.key===" "||km.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Tp.displayName=Cf;var JT=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,a=Ay(Cf,n),l=HT(n),c=v.useRef(null),u=ut(t,c),[d,p]=v.useState(!1),[f,h]=v.useState("");return v.useEffect(()=>{const g=c.current;g&&h((g.textContent??"").trim())},[s.children]),i.jsx(Hc.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:i.jsx(VT,{asChild:!0,...l,focusable:!r,children:i.jsx(Ve.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:Ce(e.onPointerMove,Gc(g=>{r?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ce(e.onPointerLeave,Gc(g=>a.onItemLeave(g))),onFocus:Ce(e.onFocus,()=>p(!0)),onBlur:Ce(e.onBlur,()=>p(!1))})})})}),rV="MenuCheckboxItem",YT=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return i.jsx(nk,{scope:e.__scopeMenu,checked:n,children:i.jsx(Tp,{role:"menuitemcheckbox","aria-checked":jf(n)?"mixed":n,...o,ref:t,"data-state":zy(n),onSelect:Ce(o.onSelect,()=>r==null?void 0:r(jf(n)?!0:!n),{checkForDefaultPrevented:!1})})})});YT.displayName=rV;var XT="MenuRadioGroup",[oV,sV]=Ta(XT,{value:void 0,onValueChange:()=>{}}),QT=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=xr(r);return i.jsx(oV,{scope:e.__scopeMenu,value:n,onValueChange:s,children:i.jsx(Ly,{...o,ref:t})})});QT.displayName=XT;var ek="MenuRadioItem",tk=v.forwardRef((e,t)=>{const{value:n,...r}=e,o=sV(ek,e.__scopeMenu),s=n===o.value;return i.jsx(nk,{scope:e.__scopeMenu,checked:s,children:i.jsx(Tp,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":zy(s),onSelect:Ce(r.onSelect,()=>{var a;return(a=o.onValueChange)==null?void 0:a.call(o,n)},{checkForDefaultPrevented:!1})})})});tk.displayName=ek;var $y="MenuItemIndicator",[nk,aV]=Ta($y,{checked:!1}),rk=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=aV($y,n);return i.jsx(co,{present:r||jf(s.checked)||s.checked===!0,children:i.jsx(Ve.span,{...o,ref:t,"data-state":zy(s.checked)})})});rk.displayName=$y;var iV="MenuSeparator",ok=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Ve.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});ok.displayName=iV;var lV="MenuArrow",sk=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ep(n);return i.jsx(DE,{...o,...r,ref:t})});sk.displayName=lV;var cV="MenuSub",[WK,ak]=Ta(cV),Fl="MenuSubTrigger",ik=v.forwardRef((e,t)=>{const n=ka(Fl,e.__scopeMenu),r=fu(Fl,e.__scopeMenu),o=ak(Fl,e.__scopeMenu),s=Ay(Fl,e.__scopeMenu),a=v.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const p=l.current;return()=>{window.clearTimeout(p),c(null)}},[l,c]),i.jsx(Oy,{asChild:!0,...u,children:i.jsx(JT,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":uk(n.open),...e,ref:tp(t,o.onTriggerChange),onClick:p=>{var f;(f=e.onClick)==null||f.call(e,p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ce(e.onPointerMove,Gc(p=>{s.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Ce(e.onPointerLeave,Gc(p=>{var h,g;d();const f=(h=n.content)==null?void 0:h.getBoundingClientRect();if(f){const m=(g=n.content)==null?void 0:g.dataset.side,w=m==="right",x=w?-5:5,y=f[w?"left":"right"],b=f[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:p.clientX+x,y:p.clientY},{x:y,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:y,y:f.bottom}],side:m}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(p),p.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ce(e.onKeyDown,p=>{var h;const f=s.searchRef.current!=="";e.disabled||f&&p.key===" "||Hz[r.dir].includes(p.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),p.preventDefault())})})})});ik.displayName=Fl;var lk="MenuSubContent",ck=v.forwardRef((e,t)=>{const n=WT(mr,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=ka(mr,e.__scopeMenu),a=fu(mr,e.__scopeMenu),l=ak(lk,e.__scopeMenu),c=v.useRef(null),u=ut(t,c);return i.jsx(Hc.Provider,{scope:e.__scopeMenu,children:i.jsx(co,{present:r||s.open,children:i.jsx(Hc.Slot,{scope:e.__scopeMenu,children:i.jsx(Fy,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var p;a.isUsingKeyboardRef.current&&((p=c.current)==null||p.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Ce(e.onFocusOutside,d=>{d.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ce(e.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:Ce(e.onKeyDown,d=>{var h;const p=d.currentTarget.contains(d.target),f=Gz[a.dir].includes(d.key);p&&f&&(s.onOpenChange(!1),(h=l.trigger)==null||h.focus(),d.preventDefault())})})})})})});ck.displayName=lk;function uk(e){return e?"open":"closed"}function jf(e){return e==="indeterminate"}function zy(e){return jf(e)?"indeterminate":e?"checked":"unchecked"}function uV(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function dV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function fV(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=dV(e,Math.max(s,0));o.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function pV(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,a=t.length-1;sr!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(o=!o)}return o}function hV(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return pV(n,t)}function Gc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var gV=GT,mV=Oy,vV=KT,yV=qT,xV=Ly,wV=ZT,bV=Tp,SV=YT,CV=QT,jV=tk,_V=rk,EV=ok,TV=sk,kV=ik,NV=ck,Vy="DropdownMenu",[RV,KK]=lo(Vy,[BT]),Mn=BT(),[PV,dk]=RV(Vy),Uy=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:a,modal:l=!0}=e,c=Mn(t),u=v.useRef(null),[d=!1,p]=js({prop:o,defaultProp:s,onChange:a});return i.jsx(PV,{scope:t,triggerId:Ir(),triggerRef:u,contentId:Ir(),open:d,onOpenChange:p,onOpenToggle:v.useCallback(()=>p(f=>!f),[p]),modal:l,children:i.jsx(gV,{...c,open:d,onOpenChange:p,dir:r,modal:l,children:n})})};Uy.displayName=Vy;var fk="DropdownMenuTrigger",By=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=dk(fk,n),a=Mn(n);return i.jsx(mV,{asChild:!0,...a,children:i.jsx(Ve.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:tp(t,s.triggerRef),onPointerDown:Ce(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(s.onOpenToggle(),s.open||l.preventDefault())}),onKeyDown:Ce(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&s.onOpenToggle(),l.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});By.displayName=fk;var IV="DropdownMenuPortal",pk=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Mn(t);return i.jsx(vV,{...r,...n})};pk.displayName=IV;var hk="DropdownMenuContent",gk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=dk(hk,n),s=Mn(n),a=v.useRef(!1);return i.jsx(yV,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:Ce(e.onCloseAutoFocus,l=>{var c;a.current||(c=o.triggerRef.current)==null||c.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:Ce(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!o.modal||d)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gk.displayName=hk;var DV="DropdownMenuGroup",OV=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(xV,{...o,...r,ref:t})});OV.displayName=DV;var MV="DropdownMenuLabel",mk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(wV,{...o,...r,ref:t})});mk.displayName=MV;var AV="DropdownMenuItem",vk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(bV,{...o,...r,ref:t})});vk.displayName=AV;var FV="DropdownMenuCheckboxItem",yk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(SV,{...o,...r,ref:t})});yk.displayName=FV;var LV="DropdownMenuRadioGroup",$V=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(CV,{...o,...r,ref:t})});$V.displayName=LV;var zV="DropdownMenuRadioItem",xk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(jV,{...o,...r,ref:t})});xk.displayName=zV;var VV="DropdownMenuItemIndicator",wk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(_V,{...o,...r,ref:t})});wk.displayName=VV;var UV="DropdownMenuSeparator",bk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(EV,{...o,...r,ref:t})});bk.displayName=UV;var BV="DropdownMenuArrow",HV=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(TV,{...o,...r,ref:t})});HV.displayName=BV;var GV="DropdownMenuSubTrigger",Sk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(kV,{...o,...r,ref:t})});Sk.displayName=GV;var WV="DropdownMenuSubContent",Ck=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(NV,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ck.displayName=WV;var KV=Uy,qV=By,ZV=pk,jk=gk,_k=mk,Ek=vk,Tk=yk,kk=xk,Nk=wk,Ho=bk,Rk=Sk,Pk=Ck;const kp=KV,Np=qV,JV=v.forwardRef(({className:e,inset:t,children:n,...r},o)=>i.jsxs(Rk,{ref:o,className:Ne("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,i.jsx(qM,{className:"ml-auto h-4 w-4"})]}));JV.displayName=Rk.displayName;const YV=v.forwardRef(({className:e,...t},n)=>i.jsx(Pk,{ref:n,className:Ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));YV.displayName=Pk.displayName;const qi=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>i.jsx(ZV,{children:i.jsx(jk,{ref:r,sideOffset:t,className:Ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));qi.displayName=jk.displayName;const xn=v.forwardRef(({className:e,inset:t,...n},r)=>i.jsx(Ek,{ref:r,className:Ne("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));xn.displayName=Ek.displayName;const XV=v.forwardRef(({className:e,children:t,checked:n,...r},o)=>i.jsxs(Tk,{ref:o,className:Ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(Nk,{children:i.jsx(si,{className:"h-4 w-4"})})}),t]}));XV.displayName=Tk.displayName;const QV=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(kk,{ref:r,className:Ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(Nk,{children:i.jsx(QM,{className:"h-2 w-2 fill-current"})})}),t]}));QV.displayName=kk.displayName;const pu=v.forwardRef(({className:e,inset:t,...n},r)=>i.jsx(_k,{ref:r,className:Ne("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));pu.displayName=_k.displayName;const Zi=v.forwardRef(({className:e,...t},n)=>i.jsx(Ho,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",e),...t}));Zi.displayName=Ho.displayName;const ko=v.forwardRef(({className:e,...t},n)=>i.jsx("textarea",{className:Ne("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));ko.displayName="Textarea";const Hy=new zr,e3=async e=>(await Hy.getInstance().post(`/chat/findChats/${e}`,{where:{}})).data,t3=async(e,t)=>(await Hy.getInstance().post(`/chat/findChats/${e}`,{where:{remoteJid:t}},{headers:{"Content-Type":"application/json"}})).data,n3=async(e,t)=>(await Hy.getInstance().post(`/chat/findMessages/${e}`,{where:{key:{remoteJid:t}}})).data;function r3({textareaRef:e,handleTextareaChange:t,textareaHeight:n,lastMessageRef:r,scrollToBottom:o}){const{instance:s}=Tt(),[a,l]=v.useState(null),[c,u]=v.useState([]),{remoteJid:d}=Vi();v.useEffect(()=>{const h=async(m,w)=>{try{const x=await t3(m,w);l(x[0])}catch(x){console.error("Erro ao buscar dados:",x)}},g=async(m,w)=>{try{const x=await n3(m,w);u(x.messages.records),o()}catch(x){console.error("Erro ao buscar dados:",x)}};s&&d&&(h(s.name,d),g(s.name,d))},[d,s,o]);const p=h=>i.jsx("div",{className:"bubble-right",children:i.jsx("div",{className:"flex items-start gap-4 self-end",children:i.jsx("div",{className:"grid gap-1",children:i.jsx("div",{className:"prose text-muted-foreground",children:i.jsx("div",{className:"bubble",children:JSON.stringify(h.message)})})})})}),f=h=>i.jsx("div",{className:"bubble-left",children:i.jsx("div",{className:"flex items-start gap-4",children:i.jsx("div",{className:"grid gap-1",children:i.jsx("div",{className:"prose text-muted-foreground",children:i.jsx("div",{className:"bubble",children:JSON.stringify(h.message)})})})})});return i.jsxs("div",{className:"min-h-screen flex flex-col",children:[i.jsx("div",{className:"sticky top-0 p-2",children:i.jsxs(Uy,{children:[i.jsx(By,{asChild:!0,children:i.jsxs(Te,{variant:"ghost",className:"gap-1 rounded-xl px-3 h-10 data-[state=open]:bg-muted text-lg",children:[(a==null?void 0:a.pushName)||(a==null?void 0:a.remoteJid.split("@")[0]),i.jsx(Qf,{className:"w-4 h-4 text-muted-foreground"})]})}),i.jsxs(qi,{align:"start",className:"max-w-[300px]",children:[i.jsxs(xn,{className:"items-start gap-2",children:[i.jsx(iA,{className:"w-4 h-4 mr-2 translate-y-1 shrink-0"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium",children:"GPT-4"}),i.jsx("div",{className:"text-muted-foreground/80",children:"With DALL-E, browsing and analysis. Limit 40 messages / 3 hours"})]})]}),i.jsx(Zi,{}),i.jsxs(xn,{className:"items-start gap-2",children:[i.jsx(cA,{className:"w-4 h-4 mr-2 translate-y-1 shrink-0"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium",children:"GPT-3"}),i.jsx("div",{className:"text-muted-foreground/80",children:"Great for everyday tasks"})]})]})]})]})}),i.jsxs("div",{className:"flex flex-col flex-1 max-w-4xl gap-8 px-4 mx-auto message-container overflow-y-auto",children:[c.map(h=>h.key.fromMe?p(h):f(h)),i.jsx("div",{ref:r})]}),i.jsx("div",{className:"max-w-2xl w-full sticky bottom-0 mx-auto py-2 flex flex-col gap-1.5 px-4 bg-background",children:i.jsxs("div",{className:"relative input-message",children:[i.jsxs(Te,{type:"button",size:"icon",className:"absolute w-8 h-8 bottom-3 left-3 rounded-full bg-transparent text-white hover:bg-transparent",children:[i.jsx(aA,{className:"w-4 h-4 text-white"}),i.jsx("span",{className:"sr-only",children:"Anexar"})]}),i.jsx(ko,{placeholder:"Enviar mensagem...",name:"message",id:"message",rows:1,ref:e,onChange:t,style:{height:n},className:"min-h-[48px] max-h-[240px] rounded-3xl resize-none p-4 pl-12 pr-16 border border-none shadow-sm"}),i.jsxs(Te,{type:"submit",size:"icon",className:"absolute w-8 h-8 bottom-3 right-3 rounded-full",children:[i.jsx(KM,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Enviar"})]})]})})]})}var Gy="Tabs",[o3,qK]=lo(Gy,[_p]),Ik=_p(),[s3,Wy]=o3(Gy),Dk=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:a="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=hp(l),[p,f]=js({prop:r,onChange:o,defaultProp:s});return i.jsx(s3,{scope:n,baseId:Ir(),value:p,onValueChange:f,orientation:a,dir:d,activationMode:c,children:i.jsx(Ve.div,{dir:d,"data-orientation":a,...u,ref:t})})});Dk.displayName=Gy;var Ok="TabsList",Mk=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=Wy(Ok,n),a=Ik(n);return i.jsx(zT,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:r,children:i.jsx(Ve.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Mk.displayName=Ok;var Ak="TabsTrigger",Fk=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,a=Wy(Ak,n),l=Ik(n),c=zk(a.baseId,r),u=Vk(a.baseId,r),d=r===a.value;return i.jsx(VT,{asChild:!0,...l,focusable:!o,active:d,children:i.jsx(Ve.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:Ce(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?a.onValueChange(r):p.preventDefault()}),onKeyDown:Ce(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&a.onValueChange(r)}),onFocus:Ce(e.onFocus,()=>{const p=a.activationMode!=="manual";!d&&!o&&p&&a.onValueChange(r)})})})});Fk.displayName=Ak;var Lk="TabsContent",$k=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...a}=e,l=Wy(Lk,n),c=zk(l.baseId,r),u=Vk(l.baseId,r),d=r===l.value,p=v.useRef(d);return v.useEffect(()=>{const f=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(f)},[]),i.jsx(co,{present:o||d,children:({present:f})=>i.jsx(Ve.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:u,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:f&&s})})});$k.displayName=Lk;function zk(e,t){return`${e}-trigger-${t}`}function Vk(e,t){return`${e}-content-${t}`}var a3=Dk,Uk=Mk,Bk=Fk,Hk=$k;const i3=a3,Gk=v.forwardRef(({className:e,...t},n)=>i.jsx(Uk,{ref:n,className:Ne("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Gk.displayName=Uk.displayName;const Nm=v.forwardRef(({className:e,...t},n)=>i.jsx(Bk,{ref:n,className:Ne("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Nm.displayName=Bk.displayName;const Rm=v.forwardRef(({className:e,...t},n)=>i.jsx(Hk,{ref:n,className:Ne("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Rm.displayName=Hk.displayName;function J0(){const e=v.useRef(null),[t]=v.useState("auto"),n=v.useRef(null),[r,o]=v.useState([]),{instance:s}=Tt(),{instanceId:a,remoteJid:l}=Vi(),c=ir(),u=()=>{e.current&&e.current.scrollIntoView({})},d=()=>{if(n.current){n.current.style.height="auto";const f=n.current.scrollHeight,g=parseInt(getComputedStyle(n.current).lineHeight)*10;n.current.style.height=`${Math.min(f,g)}px`}};v.useEffect(()=>{s&&(async h=>{try{const g=await e3(h);o(g)}catch(g){console.error("Erro ao buscar dados:",g)}})(s.name),u()},[s]);const p=f=>{c(`/manager/instance/${a}/chat/${f}`)};return i.jsxs(su,{direction:"horizontal",children:[i.jsx(ro,{defaultSize:20,children:i.jsxs("div",{className:"flex-col hidden gap-2 text-foreground bg-background md:flex",children:[i.jsx("div",{className:"sticky top-0 p-2",children:i.jsxs(Te,{variant:"ghost",className:"justify-start w-full gap-2 px-2 text-left",children:[i.jsx("div",{className:"flex items-center justify-center rounded-full w-7 h-7",children:i.jsx(ey,{className:"w-4 h-4"})}),i.jsx("div",{className:"overflow-hidden text-sm grow text-ellipsis whitespace-nowrap",children:"Chat"}),i.jsx(ou,{className:"w-4 h-4"})]})}),i.jsxs(i3,{defaultValue:"contacts",children:[i.jsxs(Gk,{className:"tabs-chat",children:[i.jsx(Nm,{value:"contacts",children:"Contatos"}),i.jsx(Nm,{value:"groups",children:"Grupos"})]}),i.jsx(Rm,{value:"contacts",children:i.jsx("div",{className:"flex-1 overflow-auto",children:i.jsxs("div",{className:"grid gap-1 p-2 text-foreground",children:[i.jsx("div",{className:"px-2 text-xs font-medium text-muted-foreground",children:"Contatos"}),r.map(f=>f.remoteJid.includes("@s.whatsapp.net")&&i.jsxs(Lw,{to:"#",onClick:()=>p(f.remoteJid),className:`flex items-center block p-2 overflow-hidden text-sm truncate transition-colors rounded-md whitespace-nowrap hover:bg-muted/50 chat-item border-b border-gray-600/50 ${l===f.remoteJid?"active":""}`,children:[i.jsx("span",{className:"chat-avatar mr-2",children:i.jsx("img",{src:f.profilePicUrl||"https://via.placeholder.com/150",alt:"Avatar",className:"w-8 h-8 rounded-full"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("span",{className:"chat-title block font-medium",children:f.pushName}),i.jsx("span",{className:"chat-description block text-xs text-gray-500",children:f.remoteJid.split("@")[0]})]})]}))]})})}),i.jsx(Rm,{value:"groups",children:i.jsx("div",{className:"flex-1 overflow-auto",children:i.jsx("div",{className:"grid gap-1 p-2 text-foreground",children:r.map(f=>f.remoteJid.includes("@g.us")&&i.jsxs(Lw,{to:"#",onClick:()=>p(f.remoteJid),className:`flex items-center block p-2 overflow-hidden text-sm truncate transition-colors rounded-md whitespace-nowrap hover:bg-muted/50 chat-item border-b border-gray-600/50 ${l===f.remoteJid?"active":""}`,children:[i.jsx("span",{className:"chat-avatar mr-2",children:i.jsx("img",{src:f.profilePicUrl||"https://via.placeholder.com/150",alt:"Avatar",className:"w-8 h-8 rounded-full"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("span",{className:"chat-title block font-medium",children:f.pushName}),i.jsx("span",{className:"chat-description block text-xs text-gray-500",children:f.remoteJid})]})]}))})})})]})]})}),i.jsx(au,{withHandle:!0,className:"border border-black"}),i.jsx(ro,{children:l&&i.jsx(r3,{textareaRef:n,handleTextareaChange:d,textareaHeight:t,lastMessageRef:e,scrollToBottom:u})})]})}var Ky="Switch",[l3,ZK]=lo(Ky),[c3,u3]=l3(Ky),Wk=v.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:s,required:a,disabled:l,value:c="on",onCheckedChange:u,...d}=e,[p,f]=v.useState(null),h=ut(t,y=>f(y)),g=v.useRef(!1),m=p?!!p.closest("form"):!0,[w=!1,x]=js({prop:o,defaultProp:s,onChange:u});return i.jsxs(c3,{scope:n,checked:w,disabled:l,children:[i.jsx(Ve.button,{type:"button",role:"switch","aria-checked":w,"aria-required":a,"data-state":Zk(w),"data-disabled":l?"":void 0,disabled:l,value:c,...d,ref:h,onClick:Ce(e.onClick,y=>{x(b=>!b),m&&(g.current=y.isPropagationStopped(),g.current||y.stopPropagation())})}),m&&i.jsx(d3,{control:p,bubbles:!g.current,name:r,value:c,checked:w,required:a,disabled:l,style:{transform:"translateX(-100%)"}})]})});Wk.displayName=Ky;var Kk="SwitchThumb",qk=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=u3(Kk,n);return i.jsx(Ve.span,{"data-state":Zk(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});qk.displayName=Kk;var d3=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,s=v.useRef(null),a=OE(n),l=wE(t);return v.useEffect(()=>{const c=s.current,u=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(u,"checked").set;if(a!==n&&p){const f=new Event("click",{bubbles:r});p.call(c,n),c.dispatchEvent(f)}},[a,n,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Zk(e){return e?"checked":"unchecked"}var Jk=Wk,f3=qk;const je=v.forwardRef(({className:e,...t},n)=>i.jsx(Jk,{className:Ne("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-slate-400",e),...t,ref:n,children:i.jsx(f3,{className:Ne("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));je.displayName=Jk.displayName;const Yk=new zr,p3=async(e,t)=>(await Yk.getInstance().get(`/chatwoot/find/${e}`,{headers:{apikey:t}})).data,h3=async(e,t,n)=>(await Yk.getInstance().post(`/chatwoot/set/${e}`,n,{headers:{apikey:t}})).data,g3=T.object({enabled:T.boolean(),accountId:T.string(),token:T.string(),url:T.string(),signMsg:T.boolean(),signDelimiter:T.string(),nameInbox:T.string(),organization:T.string(),logo:T.string(),reopenConversation:T.boolean(),conversationPending:T.boolean(),mergeBrazilContacts:T.boolean(),importContacts:T.boolean(),importMessages:T.boolean(),daysLimitImportMessages:T.string(),autoCreate:T.boolean()});function m3(){const{instance:e}=Tt(),[,t]=v.useState(!1),n=tn({resolver:nn(g3),defaultValues:{enabled:!0,accountId:"",token:"",url:"",signMsg:!0,signDelimiter:"\\n",nameInbox:"",organization:"",logo:"",reopenConversation:!0,conversationPending:!1,mergeBrazilContacts:!0,importContacts:!1,importMessages:!1,daysLimitImportMessages:"7",autoCreate:!0}});v.useEffect(()=>{(async()=>{if(e){t(!0);try{const s=await p3(e.name,e.token);n.reset(s)}catch(s){console.error("Erro ao buscar dados do chatwoot:",s)}finally{t(!1)}}})()},[e,n]);const r=async()=>{var s,a,l;if(!e)return;const o=n.getValues();t(!0);try{const c={enabled:o.enabled,accountId:o.accountId,token:o.token,url:o.url,signMsg:o.signMsg,signDelimiter:o.signDelimiter,nameInbox:o.nameInbox,organization:o.organization,logo:o.logo,reopenConversation:o.reopenConversation,conversationPending:o.conversationPending,mergeBrazilContacts:o.mergeBrazilContacts,importContacts:o.importContacts,importMessages:o.importMessages,daysLimitImportMessages:parseInt(o.daysLimitImportMessages,10),autoCreate:o.autoCreate};await h3(e.name,e.token,c),De.success("Chatwoot criado com sucesso")}catch(c){console.error("Erro ao criar chatwoot:",c),De.error(`Erro ao criar : ${(l=(a=(s=c==null?void 0:c.response)==null?void 0:s.data)==null?void 0:a.response)==null?void 0:l.message}`)}finally{t(!1)}};return i.jsx("main",{className:"main-content",children:i.jsx("div",{className:"form-container",children:i.jsx(uo,{...n,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Chatwoot"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:n.control,name:"enabled",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o chatwoot"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"url",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"URL do chatwoot"})}),i.jsx(P,{control:n.control,name:"accountId",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"ID da Conta"})}),i.jsx(P,{control:n.control,name:"token",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"Token da Conta",type:"password"})}),i.jsx(P,{control:n.control,name:"signMsg",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Assinar Mensagem"}),i.jsx($t,{children:"Assina mensagem com o nome do usuário do chatwoot"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"signDelimiter",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"Delimitador de Assinatura"})}),i.jsx(P,{control:n.control,name:"nameInbox",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"Nome da Caixa de Entrada"})}),i.jsx(P,{control:n.control,name:"organization",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"Nome da organização"})}),i.jsx(P,{control:n.control,name:"logo",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"URL do logo"})}),i.jsx(P,{control:n.control,name:"conversationPending",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Conversas Pendentes"}),i.jsx($t,{children:"Conversas iniciam como pendentes"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"reopenConversation",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Reabrir Conversa"}),i.jsx($t,{children:"Reabre conversa ao receber mensagem"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"importContacts",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Importar Contatos"}),i.jsx($t,{children:"Importa contatos da agenda do whatsapp ao conectar o qrcode"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"importMessages",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Importar Mensagens"}),i.jsx($t,{children:"Importa conversas e mensagens do whatsapp ao conectar o qrcode"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"daysLimitImportMessages",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"Limite de Dias para Importar Mensagens",type:"number"})}),i.jsx(P,{control:n.control,name:"autoCreate",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Criar Automaticamente"}),i.jsx($t,{children:"Cria automaticamente integração com chatwoot ao Salvar"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})})]})]}),i.jsx(Te,{type:"button",onClick:r,children:"Salvar"})]})})})})}const Fo=({size:e=45,className:t,...n})=>i.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,...n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Ne("animate-spin",t),children:i.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}),Y0=e=>{switch(e){case"open":return"status-connected";case"close":return"status-disconnected";case"connecting":return"status-connecting";default:return"status-disconnected"}},v3=e=>{switch(e){case"open":return"Conectado";case"close":return"Desconectado";case"connecting":return"Conectando";default:return"Desconectado"}};function y3(){var f,h,g;const[e,t]=v.useState(""),[n,r]=v.useState(""),o=localStorage.getItem("token"),[s,a]=v.useState([]),{instance:l}=Tt(),c=async m=>{try{await hA(m),window.location.reload()}catch(w){console.error("Erro ao reiniciar:",w)}},u=async m=>{try{await __(m),window.location.reload()}catch(w){console.error("Erro ao desconectar:",w)}},d=async(m,w)=>{try{if(t(""),!o){console.error("Token não encontrado.");return}if(w){const x=await e0(m,o,l==null?void 0:l.number);r(x.pairingCode)}else{const x=await e0(m,o);t(x.base64)}}catch(x){console.error("Erro ao conectar:",x)}},p=()=>{t(""),r(""),window.location.reload()};return l?i.jsxs(i.Fragment,{children:[i.jsx("main",{className:"dashboard-instance",children:i.jsxs("div",{className:"dashboard-card",children:[i.jsxs("div",{className:"dashboard-info",children:[i.jsxs("div",{className:`dashboard-status ${Y0(l.connectionStatus)}`,children:[i.jsx("i",{className:`status-icon ${Y0(l.connectionStatus)}`}),i.jsx("span",{className:"status-text",children:v3(l.connectionStatus)})]}),i.jsx("div",{className:"dashboard-name",children:l.name}),i.jsx("div",{className:"dashboard-description",children:l.ownerJid}),i.jsxs("div",{className:"card-id",children:[i.jsx("span",{children:s.includes(l.token)?l.token.substring(0,32)+"...":l.token.substring(0,32).split("").map(()=>"*").join("")}),i.jsx(w_,{className:"card-icon",size:"15",onClick:()=>{OT(l.token)}}),s.includes(l.token)?i.jsx(b_,{className:"card-icon",size:"15",onClick:()=>{a(s.filter(m=>m!==l.token))}}):i.jsx(S_,{className:"card-icon",size:"15",onClick:()=>{a([...s,l.token])}})]}),l.connectionStatus!=="open"&&i.jsxs("div",{className:"connection-warning",children:[i.jsx("span",{children:"Telefone não conectado"}),i.jsxs(Sn,{children:[i.jsx(Cn,{className:"connect-button",onClick:()=>d(l.name,!1),children:"Gerar QRCODE"}),i.jsx(un,{onCloseAutoFocus:p,children:i.jsx(dn,{children:i.jsx(Ri,{children:e?i.jsx("img",{src:e,alt:"QR Code",width:"500"}):i.jsx("img",{src:"/assets/images/evolution-logo.png",alt:"Carregando...",width:"500"})})})})]}),l.number&&i.jsxs(Sn,{children:[i.jsx(Cn,{className:"connect-code-button",onClick:()=>d(l.name,!0),children:"Solicitar Código"}),i.jsx(un,{onCloseAutoFocus:p,children:i.jsx(dn,{children:i.jsx(Ri,{children:n?i.jsxs("div",{className:"py-3",children:[i.jsx("p",{className:"text-center",children:i.jsx("strong",{children:"Código de emparelhamento:"})}),i.jsxs("p",{className:"text-center pairing-code",children:[n.substring(0,4),"-",n.substring(4,8)]})]}):i.jsx(Fo,{})})})})]})]})]}),i.jsxs("div",{className:"dashboard-actions",children:[i.jsx(Te,{variant:"outline",className:"refresh-button",children:i.jsx(C_,{onClick:window.location.reload,size:"20"})}),i.jsx(Te,{className:"action-button",onClick:()=>c(l.name),children:"REINICIAR"}),i.jsx(Te,{className:`action-button ${l.connectionStatus==="close"?"disabled":""}`,onClick:()=>u(l.name),disabled:l.connectionStatus==="close",children:"DESCONECTAR"})]})]},l.id)}),i.jsxs("main",{className:"instance-cards",children:[i.jsxs(gi,{className:"instance-card",children:[i.jsx(ql,{children:i.jsx(Zl,{children:"Contatos"})}),i.jsx(Jl,{children:((f=l==null?void 0:l._count)==null?void 0:f.Contact)||0})]}),i.jsxs(gi,{className:"instance-card",children:[i.jsx(ql,{children:i.jsx(Zl,{children:"Chats"})}),i.jsx(Jl,{children:((h=l==null?void 0:l._count)==null?void 0:h.Chat)||0})]}),i.jsxs(gi,{className:"instance-card",children:[i.jsx(ql,{children:i.jsx(Zl,{children:"Mensagens"})}),i.jsx(Jl,{children:((g=l==null?void 0:l._count)==null?void 0:g.Message)||0})]})]})]}):i.jsx(Fo,{})}var x3="Separator",X0="horizontal",w3=["horizontal","vertical"],Xk=v.forwardRef((e,t)=>{const{decorative:n,orientation:r=X0,...o}=e,s=b3(r)?r:X0,l=n?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return i.jsx(Ve.div,{"data-orientation":s,...l,...o,ref:t})});Xk.displayName=x3;function b3(e){return w3.includes(e)}var Qk=Xk;const Dt=v.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>i.jsx(Qk,{ref:o,decorative:n,orientation:t,className:Ne("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Dt.displayName=Qk.displayName;const br=new zr,eN=async(e,t)=>(await br.getInstance().get(`/openai/creds/${e}`,{headers:{apikey:t}})).data,S3=async(e,t,n)=>(await br.getInstance().post(`/openai/creds/${e}`,n,{headers:{apikey:t}})).data,C3=async(e,t)=>(await br.getInstance().delete(`/openai/creds/${e}/${t}`)).data,tN=async(e,t)=>(await br.getInstance().get(`/openai/find/${e}`,{headers:{apikey:t}})).data,j3=async(e,t,n)=>(await br.getInstance().get(`/openai/fetch/${n}/${e}`,{headers:{apikey:t}})).data,_3=async(e,t,n)=>(await br.getInstance().post(`/openai/create/${e}`,n,{headers:{apikey:t}})).data,E3=async(e,t,n,r)=>(await br.getInstance().put(`/openai/update/${n}/${e}`,r,{headers:{apikey:t}})).data,T3=async(e,t,n)=>(await br.getInstance().delete(`/openai/delete/${n}/${e}`,{headers:{apikey:t}})).data,k3=async(e,t)=>(await br.getInstance().get(`/openai/fetchSettings/${e}`,{headers:{apikey:t}})).data,N3=async(e,t,n)=>(await br.getInstance().post(`/openai/settings/${e}`,n,{headers:{apikey:t}})).data,R3=async(e,t,n)=>(await br.getInstance().get(`/openai/fetchSessions/${n}/${e}`,{headers:{apikey:t}})).data,P3=async(e,t,n,r)=>(await br.getInstance().post(`/openai/changeStatus/${e}`,{remoteJid:n,status:r},{headers:{apikey:t}})).data;/** +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},oL="DialogDescriptionWarning",sL=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$1(oL).contentName}}.`;return v.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},aL=_1,iL=T1,lL=N1,z1=R1,V1=P1,U1=D1,B1=M1,cL=F1;const Sn=aL,Cn=iL,uL=lL,H1=v.forwardRef(({className:e,...t},n)=>i.jsx(z1,{ref:n,className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));H1.displayName=z1.displayName;const un=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(uL,{children:[i.jsx(H1,{}),i.jsxs(V1,{ref:r,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,i.jsxs(cL,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[i.jsx(gA,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));un.displayName=V1.displayName;const dn=({className:e,...t})=>i.jsx("div",{className:Ne("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});dn.displayName="DialogHeader";const wr=({className:e,...t})=>i.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});wr.displayName="DialogFooter";const On=v.forwardRef(({className:e,...t},n)=>i.jsx(U1,{ref:n,className:Ne("text-lg font-semibold leading-none tracking-tight",e),...t}));On.displayName=U1.displayName;const Pi=v.forwardRef(({className:e,...t},n)=>i.jsx(B1,{ref:n,className:Ne("text-sm text-muted-foreground",e),...t}));Pi.displayName=B1.displayName;var iu=e=>e.type==="checkbox",li=e=>e instanceof Date,kn=e=>e==null;const G1=e=>typeof e=="object";var Jt=e=>!kn(e)&&!Array.isArray(e)&&G1(e)&&!li(e),W1=e=>Jt(e)&&e.target?iu(e.target)?e.target.checked:e.target.value:e,dL=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,K1=(e,t)=>e.has(dL(t)),fL=e=>{const t=e.constructor&&e.constructor.prototype;return Jt(t)&&t.hasOwnProperty("isPrototypeOf")},yy=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function An(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(yy&&(e instanceof Blob||e instanceof FileList))&&(n||Jt(e)))if(t=n?[]:{},!n&&!fL(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=An(e[r]));else return e;return t}var dp=e=>Array.isArray(e)?e.filter(Boolean):[],Ft=e=>e===void 0,ue=(e,t,n)=>{if(!t||!Jt(e))return n;const r=dp(t.split(/[,[\].]+?/)).reduce((o,s)=>kn(o)?o:o[s],e);return Ft(r)||r===e?Ft(e[t])?n:e[t]:r},Yr=e=>typeof e=="boolean",xy=e=>/^\w*$/.test(e),q1=e=>dp(e.replace(/["|']|\]/g,"").split(/\.|\[/)),at=(e,t,n)=>{let r=-1;const o=xy(t)?[t]:q1(t),s=o.length,a=s-1;for(;++rSe.useContext(Z1),Uo=e=>{const{children:t,...n}=e;return Se.createElement(Z1.Provider,{value:n},t)};var J1=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const a=s;return t._proxyFormState[a]!==Tr.all&&(t._proxyFormState[a]=!r||Tr.all),n&&(n[a]=!0),e[a]}});return o},Wn=e=>Jt(e)&&!Object.keys(e).length,Y1=(e,t,n,r)=>{n(e);const{name:o,...s}=e;return Wn(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(a=>t[a]===(!r||Tr.all))},Yl=e=>Array.isArray(e)?e:[e],X1=(e,t,n)=>!e||!t||e===t||Yl(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function wy(e){const t=Se.useRef(e);t.current=e,Se.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function pL(e){const t=fp(),{control:n=t.control,disabled:r,name:o,exact:s}=e||{},[a,l]=Se.useState(n._formState),c=Se.useRef(!0),u=Se.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=Se.useRef(o);return d.current=o,wy({disabled:r,next:p=>c.current&&X1(d.current,p.name,s)&&Y1(p,u.current,n._updateFormState)&&l({...n._formState,...p}),subject:n._subjects.state}),Se.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),J1(a,n,u.current,!1)}var Xr=e=>typeof e=="string",Q1=(e,t,n,r,o)=>Xr(e)?(r&&t.watch.add(e),ue(n,e,o)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),ue(n,s))):(r&&(t.watchAll=!0),n);function hL(e){const t=fp(),{control:n=t.control,name:r,defaultValue:o,disabled:s,exact:a}=e||{},l=Se.useRef(r);l.current=r,wy({disabled:s,subject:n._subjects.values,next:d=>{X1(l.current,d.name,a)&&u(An(Q1(l.current,n._names,d.values||n._formValues,!1,o)))}});const[c,u]=Se.useState(n._getWatch(r,o));return Se.useEffect(()=>n._removeUnmounted()),c}function gL(e){const t=fp(),{name:n,disabled:r,control:o=t.control,shouldUnregister:s}=e,a=K1(o._names.array,n),l=hL({control:o,name:n,defaultValue:ue(o._formValues,n,ue(o._defaultValues,n,e.defaultValue)),exact:!0}),c=pL({control:o,name:n}),u=Se.useRef(o.register(n,{...e.rules,value:l,...Yr(e.disabled)?{disabled:e.disabled}:{}}));return Se.useEffect(()=>{const d=o._options.shouldUnregister||s,p=(f,h)=>{const g=ue(o._fields,f);g&&g._f&&(g._f.mount=h)};if(p(n,!0),d){const f=An(ue(o._options.defaultValues,n));at(o._defaultValues,n,f),Ft(ue(o._formValues,n))&&at(o._formValues,n,f)}return()=>{(a?d&&!o._state.action:d)?o.unregister(n):p(n,!1)}},[n,o,a,s]),Se.useEffect(()=>{ue(o._fields,n)&&o._updateDisabledField({disabled:r,fields:o._fields,name:n,value:ue(o._fields,n)._f.value})},[r,n,o]),{field:{name:n,value:l,...Yr(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:Se.useCallback(d=>u.current.onChange({target:{value:W1(d),name:n},type:of.CHANGE}),[n]),onBlur:Se.useCallback(()=>u.current.onBlur({target:{value:ue(o._formValues,n),name:n},type:of.BLUR}),[n,o]),ref:d=>{const p=ue(o._fields,n);p&&d&&(p._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:f=>d.setCustomValidity(f),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ue(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!ue(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ue(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!ue(c.validatingFields,n)},error:{enumerable:!0,get:()=>ue(c.errors,n)}})}}const mL=e=>e.render(gL(e));var eE=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},E0=e=>({isOnSubmit:!e||e===Tr.onSubmit,isOnBlur:e===Tr.onBlur,isOnChange:e===Tr.onChange,isOnAll:e===Tr.all,isOnTouch:e===Tr.onTouched}),T0=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Xl=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const s=ue(e,o);if(s){const{_f:a,...l}=s;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],o)&&!r)break;if(a.ref&&t(a.ref,a.name)&&!r)break;Xl(l,t)}else Jt(l)&&Xl(l,t)}}};var vL=(e,t,n)=>{const r=Yl(ue(e,n));return at(r,"root",t[n]),at(e,n,r),e},by=e=>e.type==="file",ds=e=>typeof e=="function",sf=e=>{if(!yy)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},xd=e=>Xr(e),Sy=e=>e.type==="radio",af=e=>e instanceof RegExp;const k0={value:!1,isValid:!1},N0={value:!0,isValid:!0};var tE=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ft(e[0].attributes.value)?Ft(e[0].value)||e[0].value===""?N0:{value:e[0].value,isValid:!0}:N0:k0}return k0};const R0={isValid:!1,value:null};var nE=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,R0):R0;function P0(e,t,n="validate"){if(xd(e)||Array.isArray(e)&&e.every(xd)||Yr(e)&&!e)return{type:n,message:xd(e)?e:"",ref:t}}var Ua=e=>Jt(e)&&!af(e)?e:{value:e,message:""},I0=async(e,t,n,r,o)=>{const{ref:s,refs:a,required:l,maxLength:c,minLength:u,min:d,max:p,pattern:f,validate:h,name:g,valueAsNumber:m,mount:w,disabled:x}=e._f,y=ue(t,g);if(!w||x)return{};const b=a?a[0]:s,C=I=>{r&&b.reportValidity&&(b.setCustomValidity(Yr(I)?"":I||""),b.reportValidity())},j={},S=Sy(s),k=iu(s),E=S||k,O=(m||by(s))&&Ft(s.value)&&Ft(y)||sf(s)&&s.value===""||y===""||Array.isArray(y)&&!y.length,F=eE.bind(null,g,n,j),Z=(I,q,H,J=ho.maxLength,ne=ho.minLength)=>{const K=I?q:H;j[g]={type:I?J:ne,message:K,ref:s,...F(I?J:ne,K)}};if(o?!Array.isArray(y)||!y.length:l&&(!E&&(O||kn(y))||Yr(y)&&!y||k&&!tE(a).isValid||S&&!nE(a).isValid)){const{value:I,message:q}=xd(l)?{value:!!l,message:l}:Ua(l);if(I&&(j[g]={type:ho.required,message:q,ref:b,...F(ho.required,q)},!n))return C(q),j}if(!O&&(!kn(d)||!kn(p))){let I,q;const H=Ua(p),J=Ua(d);if(!kn(y)&&!isNaN(y)){const ne=s.valueAsNumber||y&&+y;kn(H.value)||(I=ne>H.value),kn(J.value)||(q=nenew Date(new Date().toDateString()+" "+ee),z=s.type=="time",L=s.type=="week";Xr(H.value)&&y&&(I=z?K(y)>K(H.value):L?y>H.value:ne>new Date(H.value)),Xr(J.value)&&y&&(q=z?K(y)+I.value,J=!kn(q.value)&&y.length<+q.value;if((H||J)&&(Z(H,I.message,q.message),!n))return C(j[g].message),j}if(f&&!O&&Xr(y)){const{value:I,message:q}=Ua(f);if(af(I)&&!y.match(I)&&(j[g]={type:ho.pattern,message:q,ref:s,...F(ho.pattern,q)},!n))return C(q),j}if(h){if(ds(h)){const I=await h(y,t),q=P0(I,b);if(q&&(j[g]={...q,...F(ho.validate,q.message)},!n))return C(q.message),j}else if(Jt(h)){let I={};for(const q in h){if(!Wn(I)&&!n)break;const H=P0(await h[q](y,t),b,q);H&&(I={...H,...F(q,H.message)},C(H.message),n&&(j[g]=I))}if(!Wn(I)&&(j[g]={ref:b,...I},!n))return j}}return C(!0),j};function yL(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},lf=e=>kn(e)||!G1(e);function ra(e,t){if(lf(e)||lf(t))return e===t;if(li(e)&&li(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const a=t[o];if(li(s)&&li(a)||Jt(s)&&Jt(a)||Array.isArray(s)&&Array.isArray(a)?!ra(s,a):s!==a)return!1}}return!0}var rE=e=>e.type==="select-multiple",wL=e=>Sy(e)||iu(e),Oh=e=>sf(e)&&e.isConnected,oE=e=>{for(const t in e)if(ds(e[t]))return!0;return!1};function cf(e,t={}){const n=Array.isArray(e);if(Jt(e)||n)for(const r in e)Array.isArray(e[r])||Jt(e[r])&&!oE(e[r])?(t[r]=Array.isArray(e[r])?[]:{},cf(e[r],t[r])):kn(e[r])||(t[r]=!0);return t}function sE(e,t,n){const r=Array.isArray(e);if(Jt(e)||r)for(const o in e)Array.isArray(e[o])||Jt(e[o])&&!oE(e[o])?Ft(t)||lf(n[o])?n[o]=Array.isArray(e[o])?cf(e[o],[]):{...cf(e[o])}:sE(e[o],kn(t)?{}:t[o],n[o]):n[o]=!ra(e[o],t[o]);return n}var Wu=(e,t)=>sE(e,t,cf(t)),aE=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Ft(e)?e:t?e===""?NaN:e&&+e:n&&Xr(e)?new Date(e):r?r(e):e;function Mh(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return by(t)?t.files:Sy(t)?nE(e.refs).value:rE(t)?[...t.selectedOptions].map(({value:n})=>n):iu(t)?tE(e.refs).value:aE(Ft(t.value)?e.ref.value:t.value,e)}var bL=(e,t,n,r)=>{const o={};for(const s of e){const a=ue(t,s);a&&at(o,s,a._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},bl=e=>Ft(e)?e:af(e)?e.source:Jt(e)?af(e.value)?e.value.source:e.value:e,SL=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function D0(e,t,n){const r=ue(e,n);if(r||xy(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const s=o.join("."),a=ue(t,s),l=ue(e,s);if(a&&!Array.isArray(a)&&n!==s)return{name:n};if(l&&l.type)return{name:s,error:l};o.pop()}return{name:n}}var CL=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,jL=(e,t)=>!dp(ue(e,t)).length&&Kt(e,t);const _L={mode:Tr.onSubmit,reValidateMode:Tr.onChange,shouldFocusError:!0};function EL(e={}){let t={..._L,...e},n={submitCount:0,isDirty:!1,isLoading:ds(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=Jt(t.defaultValues)||Jt(t.values)?An(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:An(o),a={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={values:Dh(),array:Dh(),state:Dh()},f=E0(t.mode),h=E0(t.reValidateMode),g=t.criteriaMode===Tr.all,m=_=>D=>{clearTimeout(u),u=setTimeout(_,D)},w=async _=>{if(d.isValid||_){const D=t.resolver?Wn((await E()).errors):await F(r,!0);D!==n.isValid&&p.state.next({isValid:D})}},x=(_,D)=>{(d.isValidating||d.validatingFields)&&((_||Array.from(l.mount)).forEach(U=>{U&&(D?at(n.validatingFields,U,D):Kt(n.validatingFields,U))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Wn(n.validatingFields)}))},y=(_,D=[],U,pe,le=!0,oe=!0)=>{if(pe&&U){if(a.action=!0,oe&&Array.isArray(ue(r,_))){const be=U(ue(r,_),pe.argA,pe.argB);le&&at(r,_,be)}if(oe&&Array.isArray(ue(n.errors,_))){const be=U(ue(n.errors,_),pe.argA,pe.argB);le&&at(n.errors,_,be),jL(n.errors,_)}if(d.touchedFields&&oe&&Array.isArray(ue(n.touchedFields,_))){const be=U(ue(n.touchedFields,_),pe.argA,pe.argB);le&&at(n.touchedFields,_,be)}d.dirtyFields&&(n.dirtyFields=Wu(o,s)),p.state.next({name:_,isDirty:I(_,D),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else at(s,_,D)},b=(_,D)=>{at(n.errors,_,D),p.state.next({errors:n.errors})},C=_=>{n.errors=_,p.state.next({errors:n.errors,isValid:!1})},j=(_,D,U,pe)=>{const le=ue(r,_);if(le){const oe=ue(s,_,Ft(U)?ue(o,_):U);Ft(oe)||pe&&pe.defaultChecked||D?at(s,_,D?oe:Mh(le._f)):J(_,oe),a.mount&&w()}},S=(_,D,U,pe,le)=>{let oe=!1,be=!1;const Je={name:_},yt=!!(ue(r,_)&&ue(r,_)._f&&ue(r,_)._f.disabled);if(!U||pe){d.isDirty&&(be=n.isDirty,n.isDirty=Je.isDirty=I(),oe=be!==Je.isDirty);const Yt=yt||ra(ue(o,_),D);be=!!(!yt&&ue(n.dirtyFields,_)),Yt||yt?Kt(n.dirtyFields,_):at(n.dirtyFields,_,!0),Je.dirtyFields=n.dirtyFields,oe=oe||d.dirtyFields&&be!==!Yt}if(U){const Yt=ue(n.touchedFields,_);Yt||(at(n.touchedFields,_,U),Je.touchedFields=n.touchedFields,oe=oe||d.touchedFields&&Yt!==U)}return oe&&le&&p.state.next(Je),oe?Je:{}},k=(_,D,U,pe)=>{const le=ue(n.errors,_),oe=d.isValid&&Yr(D)&&n.isValid!==D;if(e.delayError&&U?(c=m(()=>b(_,U)),c(e.delayError)):(clearTimeout(u),c=null,U?at(n.errors,_,U):Kt(n.errors,_)),(U?!ra(le,U):le)||!Wn(pe)||oe){const be={...pe,...oe&&Yr(D)?{isValid:D}:{},errors:n.errors,name:_};n={...n,...be},p.state.next(be)}},E=async _=>{x(_,!0);const D=await t.resolver(s,t.context,bL(_||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return x(_),D},O=async _=>{const{errors:D}=await E(_);if(_)for(const U of _){const pe=ue(D,U);pe?at(n.errors,U,pe):Kt(n.errors,U)}else n.errors=D;return D},F=async(_,D,U={valid:!0})=>{for(const pe in _){const le=_[pe];if(le){const{_f:oe,...be}=le;if(oe){const Je=l.array.has(oe.name);x([pe],!0);const yt=await I0(le,s,g,t.shouldUseNativeValidation&&!D,Je);if(x([pe]),yt[oe.name]&&(U.valid=!1,D))break;!D&&(ue(yt,oe.name)?Je?vL(n.errors,yt,oe.name):at(n.errors,oe.name,yt[oe.name]):Kt(n.errors,oe.name))}be&&await F(be,D,U)}}return U.valid},Z=()=>{for(const _ of l.unMount){const D=ue(r,_);D&&(D._f.refs?D._f.refs.every(U=>!Oh(U)):!Oh(D._f.ref))&&re(_)}l.unMount=new Set},I=(_,D)=>(_&&D&&at(s,_,D),!ra(fe(),o)),q=(_,D,U)=>Q1(_,l,{...a.mount?s:Ft(D)?o:Xr(_)?{[_]:D}:D},U,D),H=_=>dp(ue(a.mount?s:o,_,e.shouldUnregister?ue(o,_,[]):[])),J=(_,D,U={})=>{const pe=ue(r,_);let le=D;if(pe){const oe=pe._f;oe&&(!oe.disabled&&at(s,_,aE(D,oe)),le=sf(oe.ref)&&kn(D)?"":D,rE(oe.ref)?[...oe.ref.options].forEach(be=>be.selected=le.includes(be.value)):oe.refs?iu(oe.ref)?oe.refs.length>1?oe.refs.forEach(be=>(!be.defaultChecked||!be.disabled)&&(be.checked=Array.isArray(le)?!!le.find(Je=>Je===be.value):le===be.value)):oe.refs[0]&&(oe.refs[0].checked=!!le):oe.refs.forEach(be=>be.checked=be.value===le):by(oe.ref)?oe.ref.value="":(oe.ref.value=le,oe.ref.type||p.values.next({name:_,values:{...s}})))}(U.shouldDirty||U.shouldTouch)&&S(_,le,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&ee(_)},ne=(_,D,U)=>{for(const pe in D){const le=D[pe],oe=`${_}.${pe}`,be=ue(r,oe);(l.array.has(_)||!lf(le)||be&&!be._f)&&!li(le)?ne(oe,le,U):J(oe,le,U)}},K=(_,D,U={})=>{const pe=ue(r,_),le=l.array.has(_),oe=An(D);at(s,_,oe),le?(p.array.next({name:_,values:{...s}}),(d.isDirty||d.dirtyFields)&&U.shouldDirty&&p.state.next({name:_,dirtyFields:Wu(o,s),isDirty:I(_,oe)})):pe&&!pe._f&&!kn(oe)?ne(_,oe,U):J(_,oe,U),T0(_,l)&&p.state.next({...n}),p.values.next({name:a.mount?_:void 0,values:{...s}})},z=async _=>{a.mount=!0;const D=_.target;let U=D.name,pe=!0;const le=ue(r,U),oe=()=>D.type?Mh(le._f):W1(_),be=Je=>{pe=Number.isNaN(Je)||Je===ue(s,U,Je)};if(le){let Je,yt;const Yt=oe(),rn=_.type===of.BLUR||_.type===of.FOCUS_OUT,Xt=!SL(le._f)&&!t.resolver&&!ue(n.errors,U)&&!le._f.deps||CL(rn,ue(n.touchedFields,U),n.isSubmitted,h,f),qo=T0(U,l,rn);at(s,U,Yt),rn?(le._f.onBlur&&le._f.onBlur(_),c&&c(0)):le._f.onChange&&le._f.onChange(_);const Ur=S(U,Yt,rn,!1),Bs=!Wn(Ur)||qo;if(!rn&&p.values.next({name:U,type:_.type,values:{...s}}),Xt)return d.isValid&&w(),Bs&&p.state.next({name:U,...qo?{}:Ur});if(!rn&&qo&&p.state.next({...n}),t.resolver){const{errors:_n}=await E([U]);if(be(Yt),pe){const ce=D0(n.errors,r,U),ze=D0(_n,r,ce.name||U);Je=ze.error,U=ze.name,yt=Wn(_n)}}else x([U],!0),Je=(await I0(le,s,g,t.shouldUseNativeValidation))[U],x([U]),be(Yt),pe&&(Je?yt=!1:d.isValid&&(yt=await F(r,!0)));pe&&(le._f.deps&&ee(le._f.deps),k(U,yt,Je,Ur))}},L=(_,D)=>{if(ue(n.errors,D)&&_.focus)return _.focus(),1},ee=async(_,D={})=>{let U,pe;const le=Yl(_);if(t.resolver){const oe=await O(Ft(_)?_:le);U=Wn(oe),pe=_?!le.some(be=>ue(oe,be)):U}else _?(pe=(await Promise.all(le.map(async oe=>{const be=ue(r,oe);return await F(be&&be._f?{[oe]:be}:be)}))).every(Boolean),!(!pe&&!n.isValid)&&w()):pe=U=await F(r);return p.state.next({...!Xr(_)||d.isValid&&U!==n.isValid?{}:{name:_},...t.resolver||!_?{isValid:U}:{},errors:n.errors}),D.shouldFocus&&!pe&&Xl(r,L,_?le:l.mount),pe},fe=_=>{const D={...a.mount?s:o};return Ft(_)?D:Xr(_)?ue(D,_):_.map(U=>ue(D,U))},B=(_,D)=>({invalid:!!ue((D||n).errors,_),isDirty:!!ue((D||n).dirtyFields,_),error:ue((D||n).errors,_),isValidating:!!ue(n.validatingFields,_),isTouched:!!ue((D||n).touchedFields,_)}),te=_=>{_&&Yl(_).forEach(D=>Kt(n.errors,D)),p.state.next({errors:_?n.errors:{}})},X=(_,D,U)=>{const pe=(ue(r,_,{_f:{}})._f||{}).ref,le=ue(n.errors,_)||{},{ref:oe,message:be,type:Je,...yt}=le;at(n.errors,_,{...yt,...D,ref:pe}),p.state.next({name:_,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&pe&&pe.focus&&pe.focus()},ie=(_,D)=>ds(_)?p.values.subscribe({next:U=>_(q(void 0,D),U)}):q(_,D,!0),re=(_,D={})=>{for(const U of _?Yl(_):l.mount)l.mount.delete(U),l.array.delete(U),D.keepValue||(Kt(r,U),Kt(s,U)),!D.keepError&&Kt(n.errors,U),!D.keepDirty&&Kt(n.dirtyFields,U),!D.keepTouched&&Kt(n.touchedFields,U),!D.keepIsValidating&&Kt(n.validatingFields,U),!t.shouldUnregister&&!D.keepDefaultValue&&Kt(o,U);p.values.next({values:{...s}}),p.state.next({...n,...D.keepDirty?{isDirty:I()}:{}}),!D.keepIsValid&&w()},W=({disabled:_,name:D,field:U,fields:pe,value:le})=>{if(Yr(_)&&a.mount||_){const oe=_?void 0:Ft(le)?Mh(U?U._f:ue(pe,D)._f):le;at(s,D,oe),S(D,oe,!1,!1,!0)}},we=(_,D={})=>{let U=ue(r,_);const pe=Yr(D.disabled);return at(r,_,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:_}},name:_,mount:!0,...D}}),l.mount.add(_),U?W({field:U,disabled:D.disabled,name:_,value:D.value}):j(_,!0,D.value),{...pe?{disabled:D.disabled}:{},...t.progressive?{required:!!D.required,min:bl(D.min),max:bl(D.max),minLength:bl(D.minLength),maxLength:bl(D.maxLength),pattern:bl(D.pattern)}:{},name:_,onChange:z,onBlur:z,ref:le=>{if(le){we(_,D),U=ue(r,_);const oe=Ft(le.value)&&le.querySelectorAll&&le.querySelectorAll("input,select,textarea")[0]||le,be=wL(oe),Je=U._f.refs||[];if(be?Je.find(yt=>yt===oe):oe===U._f.ref)return;at(r,_,{_f:{...U._f,...be?{refs:[...Je.filter(Oh),oe,...Array.isArray(ue(o,_))?[{}]:[]],ref:{type:oe.type,name:_}}:{ref:oe}}}),j(_,!1,void 0,oe)}else U=ue(r,_,{}),U._f&&(U._f.mount=!1),(t.shouldUnregister||D.shouldUnregister)&&!(K1(l.array,_)&&a.action)&&l.unMount.add(_)}}},Re=()=>t.shouldFocusError&&Xl(r,L,l.mount),Fe=_=>{Yr(_)&&(p.state.next({disabled:_}),Xl(r,(D,U)=>{const pe=ue(r,U);pe&&(D.disabled=pe._f.disabled||_,Array.isArray(pe._f.refs)&&pe._f.refs.forEach(le=>{le.disabled=pe._f.disabled||_}))},0,!1))},Pe=(_,D)=>async U=>{let pe;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let le=An(s);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:oe,values:be}=await E();n.errors=oe,le=be}else await F(r);if(Kt(n.errors,"root"),Wn(n.errors)){p.state.next({errors:{}});try{await _(le,U)}catch(oe){pe=oe}}else D&&await D({...n.errors},U),Re(),setTimeout(Re);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Wn(n.errors)&&!pe,submitCount:n.submitCount+1,errors:n.errors}),pe)throw pe},ge=(_,D={})=>{ue(r,_)&&(Ft(D.defaultValue)?K(_,An(ue(o,_))):(K(_,D.defaultValue),at(o,_,An(D.defaultValue))),D.keepTouched||Kt(n.touchedFields,_),D.keepDirty||(Kt(n.dirtyFields,_),n.isDirty=D.defaultValue?I(_,An(ue(o,_))):I()),D.keepError||(Kt(n.errors,_),d.isValid&&w()),p.state.next({...n}))},Xe=(_,D={})=>{const U=_?An(_):o,pe=An(U),le=Wn(_),oe=le?o:pe;if(D.keepDefaultValues||(o=U),!D.keepValues){if(D.keepDirtyValues)for(const be of l.mount)ue(n.dirtyFields,be)?at(oe,be,ue(s,be)):K(be,ue(oe,be));else{if(yy&&Ft(_))for(const be of l.mount){const Je=ue(r,be);if(Je&&Je._f){const yt=Array.isArray(Je._f.refs)?Je._f.refs[0]:Je._f.ref;if(sf(yt)){const Yt=yt.closest("form");if(Yt){Yt.reset();break}}}}r={}}s=e.shouldUnregister?D.keepDefaultValues?An(o):{}:An(oe),p.array.next({values:{...oe}}),p.values.next({values:{...oe}})}l={mount:D.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!d.isValid||!!D.keepIsValid||!!D.keepDirtyValues,a.watch=!!e.shouldUnregister,p.state.next({submitCount:D.keepSubmitCount?n.submitCount:0,isDirty:le?!1:D.keepDirty?n.isDirty:!!(D.keepDefaultValues&&!ra(_,o)),isSubmitted:D.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:le?{}:D.keepDirtyValues?D.keepDefaultValues&&s?Wu(o,s):n.dirtyFields:D.keepDefaultValues&&_?Wu(o,_):D.keepDirty?n.dirtyFields:{},touchedFields:D.keepTouched?n.touchedFields:{},errors:D.keepErrors?n.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},kt=(_,D)=>Xe(ds(_)?_(s):_,D);return{control:{register:we,unregister:re,getFieldState:B,handleSubmit:Pe,setError:X,_executeSchema:E,_getWatch:q,_getDirty:I,_updateValid:w,_removeUnmounted:Z,_updateFieldArray:y,_updateDisabledField:W,_getFieldArray:H,_reset:Xe,_resetDefaultValues:()=>ds(t.defaultValues)&&t.defaultValues().then(_=>{kt(_,t.resetOptions),p.state.next({isLoading:!1})}),_updateFormState:_=>{n={...n,..._}},_disableForm:Fe,_subjects:p,_proxyFormState:d,_setErrors:C,get _fields(){return r},get _formValues(){return s},get _state(){return a},set _state(_){a=_},get _defaultValues(){return o},get _names(){return l},set _names(_){l=_},get _formState(){return n},set _formState(_){n=_},get _options(){return t},set _options(_){t={...t,..._}}},trigger:ee,register:we,handleSubmit:Pe,watch:ie,setValue:K,getValues:fe,reset:kt,resetField:ge,clearErrors:te,unregister:re,setError:X,setFocus:(_,D={})=>{const U=ue(r,_),pe=U&&U._f;if(pe){const le=pe.refs?pe.refs[0]:pe.ref;le.focus&&(le.focus(),D.shouldSelect&&le.select())}},getFieldState:B}}function tn(e={}){const t=Se.useRef(),n=Se.useRef(),[r,o]=Se.useState({isDirty:!1,isValidating:!1,isLoading:ds(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ds(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...EL(e),formState:r});const s=t.current.control;return s._options=e,wy({subject:s._subjects.state,next:a=>{Y1(a,s._proxyFormState,s._updateFormState,!0)&&o({...s._formState})}}),Se.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),Se.useEffect(()=>{if(s._proxyFormState.isDirty){const a=s._getDirty();a!==r.isDirty&&s._subjects.state.next({isDirty:a})}},[s,r.isDirty]),Se.useEffect(()=>{e.values&&!ra(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,o(a=>({...a}))):s._resetDefaultValues()},[e.values,s]),Se.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),Se.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),Se.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),t.current.formState=J1(r,s),t.current}var TL="Label",iE=v.forwardRef((e,t)=>i.jsx(Ve.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));iE.displayName=TL;var lE=iE;const kL=c1("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),fs=v.forwardRef(({className:e,...t},n)=>i.jsx(lE,{ref:n,className:Ne(kL(),e),...t}));fs.displayName=lE.displayName;const uo=Uo,cE=v.createContext({}),P=({...e})=>i.jsx(cE.Provider,{value:{name:e.name},children:i.jsx(mL,{...e})}),pp=()=>{const e=v.useContext(cE),t=v.useContext(uE),{getFieldState:n,formState:r}=fp(),o=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...o}},uE=v.createContext({}),M=v.forwardRef(({className:e,...t},n)=>{const r=v.useId();return i.jsx(uE.Provider,{value:{id:r},children:i.jsx("div",{ref:n,className:Ne("space-y-2",e),...t})})});M.displayName="FormItem";const A=v.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:o}=pp();return i.jsx(fs,{ref:n,className:Ne(r&&"text-destructive",e),htmlFor:o,...t})});A.displayName="FormLabel";const ae=v.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:o,formMessageId:s}=pp();return i.jsx(Do,{ref:t,id:r,"aria-describedby":n?`${o} ${s}`:`${o}`,"aria-invalid":!!n,...e})});ae.displayName="FormControl";const $t=v.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=pp();return i.jsx("p",{ref:n,id:r,className:Ne("text-sm text-muted-foreground",e),...t})});$t.displayName="FormDescription";const NL=v.forwardRef(({className:e,children:t,...n},r)=>{const{error:o,formMessageId:s}=pp(),a=o?String(o==null?void 0:o.message):t;return a?i.jsx("p",{ref:r,id:s,className:Ne("text-sm font-medium text-destructive",e),...n,children:a}):null});NL.displayName="FormMessage";const se=v.forwardRef(({className:e,type:t,...n},r)=>i.jsx("input",{type:t,className:Ne("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));se.displayName="Input";function O0(e,[t,n]){return Math.min(n,Math.max(t,e))}function Cy(e){const t=e+"CollectionProvider",[n,r]=lo(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=h=>{const{scope:g,children:m}=h,w=Se.useRef(null),x=Se.useRef(new Map).current;return i.jsx(o,{scope:g,itemMap:x,collectionRef:w,children:m})};a.displayName=t;const l=e+"CollectionSlot",c=Se.forwardRef((h,g)=>{const{scope:m,children:w}=h,x=s(l,m),y=ut(g,x.collectionRef);return i.jsx(Do,{ref:y,children:w})});c.displayName=l;const u=e+"CollectionItemSlot",d="data-radix-collection-item",p=Se.forwardRef((h,g)=>{const{scope:m,children:w,...x}=h,y=Se.useRef(null),b=ut(g,y),C=s(u,m);return Se.useEffect(()=>(C.itemMap.set(y,{ref:y,...x}),()=>void C.itemMap.delete(y))),i.jsx(Do,{[d]:"",ref:b,children:w})});p.displayName=u;function f(h){const g=s(e+"CollectionConsumer",h);return Se.useCallback(()=>{const w=g.collectionRef.current;if(!w)return[];const x=Array.from(w.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((C,j)=>x.indexOf(C.ref.current)-x.indexOf(j.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:a,Slot:c,ItemSlot:p},f,r]}var RL=v.createContext(void 0);function hp(e){const t=v.useContext(RL);return e||t||"ltr"}const PL=["top","right","bottom","left"],Qr=Math.min,Jn=Math.max,uf=Math.round,Ku=Math.floor,_s=e=>({x:e,y:e}),IL={left:"right",right:"left",bottom:"top",top:"bottom"},DL={start:"end",end:"start"};function hm(e,t,n){return Jn(e,Qr(t,n))}function Oo(e,t){return typeof e=="function"?e(t):e}function Mo(e){return e.split("-")[0]}function Gi(e){return e.split("-")[1]}function jy(e){return e==="x"?"y":"x"}function _y(e){return e==="y"?"height":"width"}function Es(e){return["top","bottom"].includes(Mo(e))?"y":"x"}function Ey(e){return jy(Es(e))}function OL(e,t,n){n===void 0&&(n=!1);const r=Gi(e),o=Ey(e),s=_y(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=df(a)),[a,df(a)]}function ML(e){const t=df(e);return[gm(e),t,gm(t)]}function gm(e){return e.replace(/start|end/g,t=>DL[t])}function AL(e,t,n){const r=["left","right"],o=["right","left"],s=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?s:a;default:return[]}}function FL(e,t,n,r){const o=Gi(e);let s=AL(Mo(e),n==="start",r);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(gm)))),s}function df(e){return e.replace(/left|right|bottom|top/g,t=>IL[t])}function LL(e){return{top:0,right:0,bottom:0,left:0,...e}}function dE(e){return typeof e!="number"?LL(e):{top:e,right:e,bottom:e,left:e}}function ff(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function M0(e,t,n){let{reference:r,floating:o}=e;const s=Es(t),a=Ey(t),l=_y(a),c=Mo(t),u=s==="y",d=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let h;switch(c){case"top":h={x:d,y:r.y-o.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:p};break;case"left":h={x:r.x-o.width,y:p};break;default:h={x:r.x,y:r.y}}switch(Gi(t)){case"start":h[a]-=f*(n&&u?-1:1);break;case"end":h[a]+=f*(n&&u?-1:1);break}return h}const $L=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,l=s.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:p}=M0(u,r,c),f=r,h={},g=0;for(let m=0;m({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=Oo(e,t)||{};if(u==null)return{};const p=dE(d),f={x:n,y:r},h=Ey(o),g=_y(h),m=await a.getDimensions(u),w=h==="y",x=w?"top":"left",y=w?"bottom":"right",b=w?"clientHeight":"clientWidth",C=s.reference[g]+s.reference[h]-f[h]-s.floating[g],j=f[h]-s.reference[h],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let k=S?S[b]:0;(!k||!await(a.isElement==null?void 0:a.isElement(S)))&&(k=l.floating[b]||s.floating[g]);const E=C/2-j/2,O=k/2-m[g]/2-1,F=Qr(p[x],O),Z=Qr(p[y],O),I=F,q=k-m[g]-Z,H=k/2-m[g]/2+E,J=hm(I,H,q),ne=!c.arrow&&Gi(o)!=null&&H!==J&&s.reference[g]/2-(HH<=0)){var Z,I;const H=(((Z=s.flip)==null?void 0:Z.index)||0)+1,J=k[H];if(J)return{data:{index:H,overflows:F},reset:{placement:J}};let ne=(I=F.filter(K=>K.overflows[0]<=0).sort((K,z)=>K.overflows[1]-z.overflows[1])[0])==null?void 0:I.placement;if(!ne)switch(h){case"bestFit":{var q;const K=(q=F.filter(z=>{if(S){const L=Es(z.placement);return L===y||L==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(L=>L>0).reduce((L,ee)=>L+ee,0)]).sort((z,L)=>z[1]-L[1])[0])==null?void 0:q[0];K&&(ne=K);break}case"initialPlacement":ne=l;break}if(o!==ne)return{reset:{placement:ne}}}return{}}}};function A0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function F0(e){return PL.some(t=>e[t]>=0)}const UL=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Oo(e,t);switch(r){case"referenceHidden":{const s=await Ec(t,{...o,elementContext:"reference"}),a=A0(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:F0(a)}}}case"escaped":{const s=await Ec(t,{...o,altBoundary:!0}),a=A0(s,n.floating);return{data:{escapedOffsets:a,escaped:F0(a)}}}default:return{}}}}};async function BL(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=Mo(n),l=Gi(n),c=Es(n)==="y",u=["left","top"].includes(a)?-1:1,d=s&&c?-1:1,p=Oo(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*d,y:f*u}:{x:f*u,y:h*d}}const HL=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:l}=t,c=await BL(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:a}}}}},GL=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:w=>{let{x,y}=w;return{x,y}}},...c}=Oo(e,t),u={x:n,y:r},d=await Ec(t,c),p=Es(Mo(o)),f=jy(p);let h=u[f],g=u[p];if(s){const w=f==="y"?"top":"left",x=f==="y"?"bottom":"right",y=h+d[w],b=h-d[x];h=hm(y,h,b)}if(a){const w=p==="y"?"top":"left",x=p==="y"?"bottom":"right",y=g+d[w],b=g-d[x];g=hm(y,g,b)}const m=l.fn({...t,[f]:h,[p]:g});return{...m,data:{x:m.x-n,y:m.y-r}}}}},WL=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Oo(e,t),d={x:n,y:r},p=Es(o),f=jy(p);let h=d[f],g=d[p];const m=Oo(l,t),w=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const b=f==="y"?"height":"width",C=s.reference[f]-s.floating[b]+w.mainAxis,j=s.reference[f]+s.reference[b]-w.mainAxis;hj&&(h=j)}if(u){var x,y;const b=f==="y"?"width":"height",C=["top","left"].includes(Mo(o)),j=s.reference[p]-s.floating[b]+(C&&((x=a.offset)==null?void 0:x[p])||0)+(C?0:w.crossAxis),S=s.reference[p]+s.reference[b]+(C?0:((y=a.offset)==null?void 0:y[p])||0)-(C?w.crossAxis:0);gS&&(g=S)}return{[f]:h,[p]:g}}}},KL=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:a=()=>{},...l}=Oo(e,t),c=await Ec(t,l),u=Mo(n),d=Gi(n),p=Es(n)==="y",{width:f,height:h}=r.floating;let g,m;u==="top"||u==="bottom"?(g=u,m=d===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(m=u,g=d==="end"?"top":"bottom");const w=h-c.top-c.bottom,x=f-c.left-c.right,y=Qr(h-c[g],w),b=Qr(f-c[m],x),C=!t.middlewareData.shift;let j=y,S=b;if(p?S=d||C?Qr(b,x):x:j=d||C?Qr(y,w):w,C&&!d){const E=Jn(c.left,0),O=Jn(c.right,0),F=Jn(c.top,0),Z=Jn(c.bottom,0);p?S=f-2*(E!==0||O!==0?E+O:Jn(c.left,c.right)):j=h-2*(F!==0||Z!==0?F+Z:Jn(c.top,c.bottom))}await a({...t,availableWidth:S,availableHeight:j});const k=await o.getDimensions(s.floating);return f!==k.width||h!==k.height?{reset:{rects:!0}}:{}}}};function Wi(e){return fE(e)?(e.nodeName||"").toLowerCase():"#document"}function er(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Bo(e){var t;return(t=(fE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fE(e){return e instanceof Node||e instanceof er(e).Node}function oo(e){return e instanceof Element||e instanceof er(e).Element}function so(e){return e instanceof HTMLElement||e instanceof er(e).HTMLElement}function L0(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof er(e).ShadowRoot}function lu(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Fr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function qL(e){return["table","td","th"].includes(Wi(e))}function gp(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Ty(e){const t=ky(),n=Fr(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function ZL(e){let t=Ts(e);for(;so(t)&&!Ii(t);){if(gp(t))return null;if(Ty(t))return t;t=Ts(t)}return null}function ky(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ii(e){return["html","body","#document"].includes(Wi(e))}function Fr(e){return er(e).getComputedStyle(e)}function mp(e){return oo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ts(e){if(Wi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||L0(e)&&e.host||Bo(e);return L0(t)?t.host:t}function pE(e){const t=Ts(e);return Ii(t)?e.ownerDocument?e.ownerDocument.body:e.body:so(t)&&lu(t)?t:pE(t)}function Tc(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=pE(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),a=er(o);return s?t.concat(a,a.visualViewport||[],lu(o)?o:[],a.frameElement&&n?Tc(a.frameElement):[]):t.concat(o,Tc(o,[],n))}function hE(e){const t=Fr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=so(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=uf(n)!==s||uf(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function Ny(e){return oo(e)?e:e.contextElement}function yi(e){const t=Ny(e);if(!so(t))return _s(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=hE(t);let a=(s?uf(n.width):n.width)/r,l=(s?uf(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const JL=_s(0);function gE(e){const t=er(e);return!ky()||!t.visualViewport?JL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function YL(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==er(e)?!1:t}function wa(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ny(e);let a=_s(1);t&&(r?oo(r)&&(a=yi(r)):a=yi(e));const l=YL(s,n,r)?gE(s):_s(0);let c=(o.left+l.x)/a.x,u=(o.top+l.y)/a.y,d=o.width/a.x,p=o.height/a.y;if(s){const f=er(s),h=r&&oo(r)?er(r):r;let g=f,m=g.frameElement;for(;m&&r&&h!==g;){const w=yi(m),x=m.getBoundingClientRect(),y=Fr(m),b=x.left+(m.clientLeft+parseFloat(y.paddingLeft))*w.x,C=x.top+(m.clientTop+parseFloat(y.paddingTop))*w.y;c*=w.x,u*=w.y,d*=w.x,p*=w.y,c+=b,u+=C,g=er(m),m=g.frameElement}}return ff({width:d,height:p,x:c,y:u})}function XL(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",a=Bo(r),l=t?gp(t.floating):!1;if(r===a||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=_s(1);const d=_s(0),p=so(r);if((p||!p&&!s)&&((Wi(r)!=="body"||lu(a))&&(c=mp(r)),so(r))){const f=wa(r);u=yi(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function QL(e){return Array.from(e.getClientRects())}function mE(e){return wa(Bo(e)).left+mp(e).scrollLeft}function e$(e){const t=Bo(e),n=mp(e),r=e.ownerDocument.body,o=Jn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Jn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+mE(e);const l=-n.scrollTop;return Fr(r).direction==="rtl"&&(a+=Jn(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:l}}function t$(e,t){const n=er(e),r=Bo(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,l=0,c=0;if(o){s=o.width,a=o.height;const u=ky();(!u||u&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}return{width:s,height:a,x:l,y:c}}function n$(e,t){const n=wa(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=so(e)?yi(e):_s(1),a=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:a,height:l,x:c,y:u}}function $0(e,t,n){let r;if(t==="viewport")r=t$(e,n);else if(t==="document")r=e$(Bo(e));else if(oo(t))r=n$(t,n);else{const o=gE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return ff(r)}function vE(e,t){const n=Ts(e);return n===t||!oo(n)||Ii(n)?!1:Fr(n).position==="fixed"||vE(n,t)}function r$(e,t){const n=t.get(e);if(n)return n;let r=Tc(e,[],!1).filter(l=>oo(l)&&Wi(l)!=="body"),o=null;const s=Fr(e).position==="fixed";let a=s?Ts(e):e;for(;oo(a)&&!Ii(a);){const l=Fr(a),c=Ty(a);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||lu(a)&&!c&&vE(e,a))?r=r.filter(d=>d!==a):o=l,a=Ts(a)}return t.set(e,r),r}function o$(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?gp(t)?[]:r$(t,this._c):[].concat(n),r],l=a[0],c=a.reduce((u,d)=>{const p=$0(t,d,o);return u.top=Jn(p.top,u.top),u.right=Qr(p.right,u.right),u.bottom=Qr(p.bottom,u.bottom),u.left=Jn(p.left,u.left),u},$0(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function s$(e){const{width:t,height:n}=hE(e);return{width:t,height:n}}function a$(e,t,n){const r=so(t),o=Bo(t),s=n==="fixed",a=wa(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=_s(0);if(r||!r&&!s)if((Wi(t)!=="body"||lu(o))&&(l=mp(t)),r){const p=wa(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&(c.x=mE(o));const u=a.left+l.scrollLeft-c.x,d=a.top+l.scrollTop-c.y;return{x:u,y:d,width:a.width,height:a.height}}function Ah(e){return Fr(e).position==="static"}function z0(e,t){return!so(e)||Fr(e).position==="fixed"?null:t?t(e):e.offsetParent}function yE(e,t){const n=er(e);if(gp(e))return n;if(!so(e)){let o=Ts(e);for(;o&&!Ii(o);){if(oo(o)&&!Ah(o))return o;o=Ts(o)}return n}let r=z0(e,t);for(;r&&qL(r)&&Ah(r);)r=z0(r,t);return r&&Ii(r)&&Ah(r)&&!Ty(r)?n:r||ZL(e)||n}const i$=async function(e){const t=this.getOffsetParent||yE,n=this.getDimensions,r=await n(e.floating);return{reference:a$(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function l$(e){return Fr(e).direction==="rtl"}const c$={convertOffsetParentRelativeRectToViewportRelativeRect:XL,getDocumentElement:Bo,getClippingRect:o$,getOffsetParent:yE,getElementRects:i$,getClientRects:QL,getDimensions:s$,getScale:yi,isElement:oo,isRTL:l$};function u$(e,t){let n=null,r;const o=Bo(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const{left:u,top:d,width:p,height:f}=e.getBoundingClientRect();if(l||t(),!p||!f)return;const h=Ku(d),g=Ku(o.clientWidth-(u+p)),m=Ku(o.clientHeight-(d+f)),w=Ku(u),y={rootMargin:-h+"px "+-g+"px "+-m+"px "+-w+"px",threshold:Jn(0,Qr(1,c))||1};let b=!0;function C(j){const S=j[0].intersectionRatio;if(S!==c){if(!b)return a();S?a(!1,S):r=setTimeout(()=>{a(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(C,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,y)}n.observe(e)}return a(!0),s}function d$(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Ny(e),d=o||s?[...u?Tc(u):[],...Tc(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const p=u&&l?u$(u,n):null;let f=-1,h=null;a&&(h=new ResizeObserver(x=>{let[y]=x;y&&y.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(t)})),n()}),u&&!c&&h.observe(u),h.observe(t));let g,m=c?wa(e):null;c&&w();function w(){const x=wa(e);m&&(x.x!==m.x||x.y!==m.y||x.width!==m.width||x.height!==m.height)&&n(),m=x,g=requestAnimationFrame(w)}return n(),()=>{var x;d.forEach(y=>{o&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),p==null||p(),(x=h)==null||x.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const f$=HL,p$=GL,h$=VL,g$=KL,m$=UL,V0=zL,v$=WL,y$=(e,t,n)=>{const r=new Map,o={platform:c$,...n},s={...o.platform,_c:r};return $L(e,t,{...o,platform:s})};var wd=typeof document<"u"?v.useLayoutEffect:v.useEffect;function pf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!pf(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!pf(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function xE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function U0(e,t){const n=xE(e);return Math.round(t*n)/n}function B0(e){const t=v.useRef(e);return wd(()=>{t.current=e}),t}function x$(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,p]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=v.useState(r);pf(f,r)||h(r);const[g,m]=v.useState(null),[w,x]=v.useState(null),y=v.useCallback(K=>{K!==S.current&&(S.current=K,m(K))},[]),b=v.useCallback(K=>{K!==k.current&&(k.current=K,x(K))},[]),C=s||g,j=a||w,S=v.useRef(null),k=v.useRef(null),E=v.useRef(d),O=c!=null,F=B0(c),Z=B0(o),I=v.useCallback(()=>{if(!S.current||!k.current)return;const K={placement:t,strategy:n,middleware:f};Z.current&&(K.platform=Z.current),y$(S.current,k.current,K).then(z=>{const L={...z,isPositioned:!0};q.current&&!pf(E.current,L)&&(E.current=L,Ls.flushSync(()=>{p(L)}))})},[f,t,n,Z]);wd(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(K=>({...K,isPositioned:!1})))},[u]);const q=v.useRef(!1);wd(()=>(q.current=!0,()=>{q.current=!1}),[]),wd(()=>{if(C&&(S.current=C),j&&(k.current=j),C&&j){if(F.current)return F.current(C,j,I);I()}},[C,j,I,F,O]);const H=v.useMemo(()=>({reference:S,floating:k,setReference:y,setFloating:b}),[y,b]),J=v.useMemo(()=>({reference:C,floating:j}),[C,j]),ne=v.useMemo(()=>{const K={position:n,left:0,top:0};if(!J.floating)return K;const z=U0(J.floating,d.x),L=U0(J.floating,d.y);return l?{...K,transform:"translate("+z+"px, "+L+"px)",...xE(J.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:z,top:L}},[n,l,J.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:I,refs:H,elements:J,floatingStyles:ne}),[d,I,H,J,ne])}const w$=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?V0({element:r.current,padding:o}).fn(n):{}:r?V0({element:r,padding:o}).fn(n):{}}}},b$=(e,t)=>({...f$(e),options:[e,t]}),S$=(e,t)=>({...p$(e),options:[e,t]}),C$=(e,t)=>({...v$(e),options:[e,t]}),j$=(e,t)=>({...h$(e),options:[e,t]}),_$=(e,t)=>({...g$(e),options:[e,t]}),E$=(e,t)=>({...m$(e),options:[e,t]}),T$=(e,t)=>({...w$(e),options:[e,t]});var k$="Arrow",wE=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return i.jsx(Ve.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});wE.displayName=k$;var N$=wE;function bE(e){const[t,n]=v.useState(void 0);return bn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Ry="Popper",[SE,vp]=lo(Ry),[R$,CE]=SE(Ry),jE=e=>{const{__scopePopper:t,children:n}=e,[r,o]=v.useState(null);return i.jsx(R$,{scope:t,anchor:r,onAnchorChange:o,children:n})};jE.displayName=Ry;var _E="PopperAnchor",EE=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=CE(_E,n),a=v.useRef(null),l=ut(t,a);return v.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||a.current)}),r?null:i.jsx(Ve.div,{...o,ref:l})});EE.displayName=_E;var Py="PopperContent",[P$,I$]=SE(Py),TE=v.forwardRef((e,t)=>{var W,we,Re,Fe,Pe,ge;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:p="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:g,...m}=e,w=CE(Py,n),[x,y]=v.useState(null),b=ut(t,Xe=>y(Xe)),[C,j]=v.useState(null),S=bE(C),k=(S==null?void 0:S.width)??0,E=(S==null?void 0:S.height)??0,O=r+(s!=="center"?"-"+s:""),F=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},Z=Array.isArray(u)?u:[u],I=Z.length>0,q={padding:F,boundary:Z.filter(O$),altBoundary:I},{refs:H,floatingStyles:J,placement:ne,isPositioned:K,middlewareData:z}=x$({strategy:"fixed",placement:O,whileElementsMounted:(...Xe)=>d$(...Xe,{animationFrame:h==="always"}),elements:{reference:w.anchor},middleware:[b$({mainAxis:o+E,alignmentAxis:a}),c&&S$({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?C$():void 0,...q}),c&&j$({...q}),_$({...q,apply:({elements:Xe,rects:kt,availableWidth:Ut,availableHeight:Lt})=>{const{width:Wt,height:_}=kt.reference,D=Xe.floating.style;D.setProperty("--radix-popper-available-width",`${Ut}px`),D.setProperty("--radix-popper-available-height",`${Lt}px`),D.setProperty("--radix-popper-anchor-width",`${Wt}px`),D.setProperty("--radix-popper-anchor-height",`${_}px`)}}),C&&T$({element:C,padding:l}),M$({arrowWidth:k,arrowHeight:E}),f&&E$({strategy:"referenceHidden",...q})]}),[L,ee]=RE(ne),fe=xr(g);bn(()=>{K&&(fe==null||fe())},[K,fe]);const B=(W=z.arrow)==null?void 0:W.x,te=(we=z.arrow)==null?void 0:we.y,X=((Re=z.arrow)==null?void 0:Re.centerOffset)!==0,[ie,re]=v.useState();return bn(()=>{x&&re(window.getComputedStyle(x).zIndex)},[x]),i.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...J,transform:K?J.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(Fe=z.transformOrigin)==null?void 0:Fe.x,(Pe=z.transformOrigin)==null?void 0:Pe.y].join(" "),...((ge=z.hide)==null?void 0:ge.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(P$,{scope:n,placedSide:L,onArrowChange:j,arrowX:B,arrowY:te,shouldHideArrow:X,children:i.jsx(Ve.div,{"data-side":L,"data-align":ee,...m,ref:b,style:{...m.style,animation:K?void 0:"none"}})})})});TE.displayName=Py;var kE="PopperArrow",D$={top:"bottom",right:"left",bottom:"top",left:"right"},NE=v.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=I$(kE,r),a=D$[s.placedSide];return i.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:i.jsx(N$,{...o,ref:n,style:{...o.style,display:"block"}})})});NE.displayName=kE;function O$(e){return e!==null}var M$=e=>({name:"transformOrigin",options:e,fn(t){var w,x,y;const{placement:n,rects:r,middlewareData:o}=t,a=((w=o.arrow)==null?void 0:w.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=RE(n),p={start:"0%",center:"50%",end:"100%"}[d],f=(((x=o.arrow)==null?void 0:x.x)??0)+l/2,h=(((y=o.arrow)==null?void 0:y.y)??0)+c/2;let g="",m="";return u==="bottom"?(g=a?p:`${f}px`,m=`${-c}px`):u==="top"?(g=a?p:`${f}px`,m=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=a?p:`${h}px`):u==="left"&&(g=`${r.floating.width+c}px`,m=a?p:`${h}px`),{data:{x:g,y:m}}}});function RE(e){const[t,n="center"]=e.split("-");return[t,n]}var PE=jE,IE=EE,DE=TE,OE=NE;function ME(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var A$="VisuallyHidden",AE=v.forwardRef((e,t)=>i.jsx(Ve.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));AE.displayName=A$;var F$=[" ","Enter","ArrowUp","ArrowDown"],L$=[" ","Enter"],cu="Select",[yp,xp,$$]=Cy(cu),[Ki,GK]=lo(cu,[$$,vp]),wp=vp(),[z$,Vs]=Ki(cu),[V$,U$]=Ki(cu),FE=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:a,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:p,disabled:f,required:h}=e,g=wp(t),[m,w]=v.useState(null),[x,y]=v.useState(null),[b,C]=v.useState(!1),j=hp(u),[S=!1,k]=js({prop:r,defaultProp:o,onChange:s}),[E,O]=js({prop:a,defaultProp:l,onChange:c}),F=v.useRef(null),Z=m?!!m.closest("form"):!0,[I,q]=v.useState(new Set),H=Array.from(I).map(J=>J.props.value).join(";");return i.jsx(PE,{...g,children:i.jsxs(z$,{required:h,scope:t,trigger:m,onTriggerChange:w,valueNode:x,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:C,contentId:Ir(),value:E,onValueChange:O,open:S,onOpenChange:k,dir:j,triggerPointerDownPosRef:F,disabled:f,children:[i.jsx(yp.Provider,{scope:t,children:i.jsx(V$,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(J=>{q(ne=>new Set(ne).add(J))},[]),onNativeOptionRemove:v.useCallback(J=>{q(ne=>{const K=new Set(ne);return K.delete(J),K})},[]),children:n})}),Z?i.jsxs(lT,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:p,value:E,onChange:J=>O(J.target.value),disabled:f,children:[E===void 0?i.jsx("option",{value:""}):null,Array.from(I)]},H):null]})})};FE.displayName=cu;var LE="SelectTrigger",$E=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=wp(n),a=Vs(LE,n),l=a.disabled||r,c=ut(t,a.onTriggerChange),u=xp(n),[d,p,f]=cT(g=>{const m=u().filter(y=>!y.disabled),w=m.find(y=>y.value===a.value),x=uT(m,g,w);x!==void 0&&a.onValueChange(x.value)}),h=()=>{l||(a.onOpenChange(!0),f())};return i.jsx(IE,{asChild:!0,...s,children:i.jsx(Ve.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":iT(a.value)?"":void 0,...o,ref:c,onClick:Ce(o.onClick,g=>{g.currentTarget.focus()}),onPointerDown:Ce(o.onPointerDown,g=>{const m=g.target;m.hasPointerCapture(g.pointerId)&&m.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&(h(),a.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)},g.preventDefault())}),onKeyDown:Ce(o.onKeyDown,g=>{const m=d.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&p(g.key),!(m&&g.key===" ")&&F$.includes(g.key)&&(h(),g.preventDefault())})})})});$E.displayName=LE;var zE="SelectValue",VE=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:a="",...l}=e,c=Vs(zE,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,p=ut(t,c.onValueNodeChange);return bn(()=>{u(d)},[u,d]),i.jsx(Ve.span,{...l,ref:p,style:{pointerEvents:"none"},children:iT(c.value)?i.jsx(i.Fragment,{children:a}):s})});VE.displayName=zE;var B$="SelectIcon",UE=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return i.jsx(Ve.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});UE.displayName=B$;var H$="SelectPortal",BE=e=>i.jsx(lp,{asChild:!0,...e});BE.displayName=H$;var ba="SelectContent",HE=v.forwardRef((e,t)=>{const n=Vs(ba,e.__scopeSelect),[r,o]=v.useState();if(bn(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Ls.createPortal(i.jsx(GE,{scope:e.__scopeSelect,children:i.jsx(yp.Slot,{scope:e.__scopeSelect,children:i.jsx("div",{children:e.children})})}),s):null}return i.jsx(WE,{...e,ref:t})});HE.displayName=ba;var vo=10,[GE,Us]=Ki(ba),G$="SelectContentImpl",WE=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:f,collisionPadding:h,sticky:g,hideWhenDetached:m,avoidCollisions:w,...x}=e,y=Vs(ba,n),[b,C]=v.useState(null),[j,S]=v.useState(null),k=ut(t,W=>C(W)),[E,O]=v.useState(null),[F,Z]=v.useState(null),I=xp(n),[q,H]=v.useState(!1),J=v.useRef(!1);v.useEffect(()=>{if(b)return py(b)},[b]),fy();const ne=v.useCallback(W=>{const[we,...Re]=I().map(ge=>ge.ref.current),[Fe]=Re.slice(-1),Pe=document.activeElement;for(const ge of W)if(ge===Pe||(ge==null||ge.scrollIntoView({block:"nearest"}),ge===we&&j&&(j.scrollTop=0),ge===Fe&&j&&(j.scrollTop=j.scrollHeight),ge==null||ge.focus(),document.activeElement!==Pe))return},[I,j]),K=v.useCallback(()=>ne([E,b]),[ne,E,b]);v.useEffect(()=>{q&&K()},[q,K]);const{onOpenChange:z,triggerPointerDownPosRef:L}=y;v.useEffect(()=>{if(b){let W={x:0,y:0};const we=Fe=>{var Pe,ge;W={x:Math.abs(Math.round(Fe.pageX)-(((Pe=L.current)==null?void 0:Pe.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((ge=L.current)==null?void 0:ge.y)??0))}},Re=Fe=>{W.x<=10&&W.y<=10?Fe.preventDefault():b.contains(Fe.target)||z(!1),document.removeEventListener("pointermove",we),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",we),document.addEventListener("pointerup",Re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",we),document.removeEventListener("pointerup",Re,{capture:!0})}}},[b,z,L]),v.useEffect(()=>{const W=()=>z(!1);return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W)}},[z]);const[ee,fe]=cT(W=>{const we=I().filter(Pe=>!Pe.disabled),Re=we.find(Pe=>Pe.ref.current===document.activeElement),Fe=uT(we,W,Re);Fe&&setTimeout(()=>Fe.ref.current.focus())}),B=v.useCallback((W,we,Re)=>{const Fe=!J.current&&!Re;(y.value!==void 0&&y.value===we||Fe)&&(O(W),Fe&&(J.current=!0))},[y.value]),te=v.useCallback(()=>b==null?void 0:b.focus(),[b]),X=v.useCallback((W,we,Re)=>{const Fe=!J.current&&!Re;(y.value!==void 0&&y.value===we||Fe)&&Z(W)},[y.value]),ie=r==="popper"?mm:KE,re=ie===mm?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:f,collisionPadding:h,sticky:g,hideWhenDetached:m,avoidCollisions:w}:{};return i.jsx(GE,{scope:n,content:b,viewport:j,onViewportChange:S,itemRefCallback:B,selectedItem:E,onItemLeave:te,itemTextRefCallback:X,focusSelectedItem:K,selectedItemText:F,position:r,isPositioned:q,searchRef:ee,children:i.jsx(up,{as:Do,allowPinchZoom:!0,children:i.jsx(ip,{asChild:!0,trapped:y.open,onMountAutoFocus:W=>{W.preventDefault()},onUnmountAutoFocus:Ce(o,W=>{var we;(we=y.trigger)==null||we.focus({preventScroll:!0}),W.preventDefault()}),children:i.jsx(ap,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:i.jsx(ie,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:W=>W.preventDefault(),...x,...re,onPlaced:()=>H(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:Ce(x.onKeyDown,W=>{const we=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!we&&W.key.length===1&&fe(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let Fe=I().filter(Pe=>!Pe.disabled).map(Pe=>Pe.ref.current);if(["ArrowUp","End"].includes(W.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){const Pe=W.target,ge=Fe.indexOf(Pe);Fe=Fe.slice(ge+1)}setTimeout(()=>ne(Fe)),W.preventDefault()}})})})})})})});WE.displayName=G$;var W$="SelectItemAlignedPosition",KE=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=Vs(ba,n),a=Us(ba,n),[l,c]=v.useState(null),[u,d]=v.useState(null),p=ut(t,k=>d(k)),f=xp(n),h=v.useRef(!1),g=v.useRef(!0),{viewport:m,selectedItem:w,selectedItemText:x,focusSelectedItem:y}=a,b=v.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&m&&w&&x){const k=s.trigger.getBoundingClientRect(),E=u.getBoundingClientRect(),O=s.valueNode.getBoundingClientRect(),F=x.getBoundingClientRect();if(s.dir!=="rtl"){const Pe=F.left-E.left,ge=O.left-Pe,Xe=k.left-ge,kt=k.width+Xe,Ut=Math.max(kt,E.width),Lt=window.innerWidth-vo,Wt=O0(ge,[vo,Lt-Ut]);l.style.minWidth=kt+"px",l.style.left=Wt+"px"}else{const Pe=E.right-F.right,ge=window.innerWidth-O.right-Pe,Xe=window.innerWidth-k.right-ge,kt=k.width+Xe,Ut=Math.max(kt,E.width),Lt=window.innerWidth-vo,Wt=O0(ge,[vo,Lt-Ut]);l.style.minWidth=kt+"px",l.style.right=Wt+"px"}const Z=f(),I=window.innerHeight-vo*2,q=m.scrollHeight,H=window.getComputedStyle(u),J=parseInt(H.borderTopWidth,10),ne=parseInt(H.paddingTop,10),K=parseInt(H.borderBottomWidth,10),z=parseInt(H.paddingBottom,10),L=J+ne+q+z+K,ee=Math.min(w.offsetHeight*5,L),fe=window.getComputedStyle(m),B=parseInt(fe.paddingTop,10),te=parseInt(fe.paddingBottom,10),X=k.top+k.height/2-vo,ie=I-X,re=w.offsetHeight/2,W=w.offsetTop+re,we=J+ne+W,Re=L-we;if(we<=X){const Pe=w===Z[Z.length-1].ref.current;l.style.bottom="0px";const ge=u.clientHeight-m.offsetTop-m.offsetHeight,Xe=Math.max(ie,re+(Pe?te:0)+ge+K),kt=we+Xe;l.style.height=kt+"px"}else{const Pe=w===Z[0].ref.current;l.style.top="0px";const Xe=Math.max(X,J+m.offsetTop+(Pe?B:0)+re)+Re;l.style.height=Xe+"px",m.scrollTop=we-X+m.offsetTop}l.style.margin=`${vo}px 0`,l.style.minHeight=ee+"px",l.style.maxHeight=I+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[f,s.trigger,s.valueNode,l,u,m,w,x,s.dir,r]);bn(()=>b(),[b]);const[C,j]=v.useState();bn(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const S=v.useCallback(k=>{k&&g.current===!0&&(b(),y==null||y(),g.current=!1)},[b,y]);return i.jsx(q$,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:S,children:i.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:i.jsx(Ve.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});KE.displayName=W$;var K$="SelectPopperPosition",mm=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=vo,...s}=e,a=wp(n);return i.jsx(DE,{...a,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});mm.displayName=K$;var[q$,Iy]=Ki(ba,{}),vm="SelectViewport",qE=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=Us(vm,n),a=Iy(vm,n),l=ut(t,s.onViewportChange),c=v.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),i.jsx(yp.Slot,{scope:n,children:i.jsx(Ve.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"auto",...o.style},onScroll:Ce(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:f}=a;if(f!=null&&f.current&&p){const h=Math.abs(c.current-d.scrollTop);if(h>0){const g=window.innerHeight-vo*2,m=parseFloat(p.style.minHeight),w=parseFloat(p.style.height),x=Math.max(m,w);if(x0?C:0,p.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});qE.displayName=vm;var ZE="SelectGroup",[Z$,J$]=Ki(ZE),Y$=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ir();return i.jsx(Z$,{scope:n,id:o,children:i.jsx(Ve.div,{role:"group","aria-labelledby":o,...r,ref:t})})});Y$.displayName=ZE;var JE="SelectLabel",YE=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=J$(JE,n);return i.jsx(Ve.div,{id:o.id,...r,ref:t})});YE.displayName=JE;var hf="SelectItem",[X$,XE]=Ki(hf),QE=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...a}=e,l=Vs(hf,n),c=Us(hf,n),u=l.value===r,[d,p]=v.useState(s??""),[f,h]=v.useState(!1),g=ut(t,x=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,x,r,o)}),m=Ir(),w=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(X$,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:v.useCallback(x=>{p(y=>y||((x==null?void 0:x.textContent)??"").trim())},[]),children:i.jsx(yp.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:i.jsx(Ve.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:g,onFocus:Ce(a.onFocus,()=>h(!0)),onBlur:Ce(a.onBlur,()=>h(!1)),onPointerUp:Ce(a.onPointerUp,w),onPointerMove:Ce(a.onPointerMove,x=>{var y;o?(y=c.onItemLeave)==null||y.call(c):x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ce(a.onPointerLeave,x=>{var y;x.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:Ce(a.onKeyDown,x=>{var b;((b=c.searchRef)==null?void 0:b.current)!==""&&x.key===" "||(L$.includes(x.key)&&w(),x.key===" "&&x.preventDefault())})})})})});QE.displayName=hf;var Ol="SelectItemText",eT=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,a=Vs(Ol,n),l=Us(Ol,n),c=XE(Ol,n),u=U$(Ol,n),[d,p]=v.useState(null),f=ut(t,x=>p(x),c.onItemTextChange,x=>{var y;return(y=l.itemTextRefCallback)==null?void 0:y.call(l,x,c.value,c.disabled)}),h=d==null?void 0:d.textContent,g=v.useMemo(()=>i.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:w}=u;return bn(()=>(m(g),()=>w(g)),[m,w,g]),i.jsxs(i.Fragment,{children:[i.jsx(Ve.span,{id:c.textId,...s,ref:f}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Ls.createPortal(s.children,a.valueNode):null]})});eT.displayName=Ol;var tT="SelectItemIndicator",nT=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return XE(tT,n).isSelected?i.jsx(Ve.span,{"aria-hidden":!0,...r,ref:t}):null});nT.displayName=tT;var ym="SelectScrollUpButton",rT=v.forwardRef((e,t)=>{const n=Us(ym,e.__scopeSelect),r=Iy(ym,e.__scopeSelect),[o,s]=v.useState(!1),a=ut(t,r.onScrollButtonChange);return bn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?i.jsx(sT,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});rT.displayName=ym;var xm="SelectScrollDownButton",oT=v.forwardRef((e,t)=>{const n=Us(xm,e.__scopeSelect),r=Iy(xm,e.__scopeSelect),[o,s]=v.useState(!1),a=ut(t,r.onScrollButtonChange);return bn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?i.jsx(sT,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});oT.displayName=xm;var sT=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=Us("SelectScrollButton",n),a=v.useRef(null),l=xp(n),c=v.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),bn(()=>{var d;const u=l().find(p=>p.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),i.jsx(Ve.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Ce(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:Ce(o.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:Ce(o.onPointerLeave,()=>{c()})})}),Q$="SelectSeparator",aT=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return i.jsx(Ve.div,{"aria-hidden":!0,...r,ref:t})});aT.displayName=Q$;var wm="SelectArrow",e4=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=wp(n),s=Vs(wm,n),a=Us(wm,n);return s.open&&a.position==="popper"?i.jsx(OE,{...o,...r,ref:t}):null});e4.displayName=wm;function iT(e){return e===""||e===void 0}var lT=v.forwardRef((e,t)=>{const{value:n,...r}=e,o=v.useRef(null),s=ut(t,o),a=ME(n);return v.useEffect(()=>{const l=o.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==n&&d){const p=new Event("change",{bubbles:!0});d.call(l,n),l.dispatchEvent(p)}},[a,n]),i.jsx(AE,{asChild:!0,children:i.jsx("select",{...r,ref:s,defaultValue:n})})});lT.displayName="BubbleSelect";function cT(e){const t=xr(e),n=v.useRef(""),r=v.useRef(0),o=v.useCallback(a=>{const l=n.current+a;t(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),s=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function uT(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=t4(e,Math.max(s,0));o.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function t4(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var n4=FE,dT=$E,r4=VE,o4=UE,s4=BE,fT=HE,a4=qE,pT=YE,hT=QE,i4=eT,l4=nT,gT=rT,mT=oT,vT=aT;const St=n4,Ct=r4,mt=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(dT,{ref:r,className:Ne("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,i.jsx(o4,{asChild:!0,children:i.jsx(Qf,{className:"h-4 w-4 opacity-50"})})]}));mt.displayName=dT.displayName;const yT=v.forwardRef(({className:e,...t},n)=>i.jsx(gT,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(nA,{className:"h-4 w-4"})}));yT.displayName=gT.displayName;const xT=v.forwardRef(({className:e,...t},n)=>i.jsx(mT,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(Qf,{className:"h-4 w-4"})}));xT.displayName=mT.displayName;const vt=v.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>i.jsx(s4,{children:i.jsxs(fT,{ref:o,className:Ne("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[i.jsx(yT,{}),i.jsx(a4,{className:Ne("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),i.jsx(xT,{})]})}));vt.displayName=fT.displayName;const c4=v.forwardRef(({className:e,...t},n)=>i.jsx(pT,{ref:n,className:Ne("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));c4.displayName=pT.displayName;const he=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(hT,{ref:r,className:Ne("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(l4,{children:i.jsx(ai,{className:"h-4 w-4"})})}),i.jsx(i4,{children:t})]}));he.displayName=hT.displayName;const u4=v.forwardRef(({className:e,...t},n)=>i.jsx(vT,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",e),...t}));u4.displayName=vT.displayName;const kc=e=>typeof e=="number"&&!isNaN(e),ca=e=>typeof e=="string",Xn=e=>typeof e=="function",bd=e=>ca(e)||Xn(e)?e:null,bm=e=>v.isValidElement(e)||ca(e)||Xn(e)||kc(e);function d4(e,t,n){n===void 0&&(n=300);const{scrollHeight:r,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=r+"px",o.transition=`all ${n}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)})})}function bp(e){let{enter:t,exit:n,appendPosition:r=!1,collapse:o=!0,collapseDuration:s=300}=e;return function(a){let{children:l,position:c,preventExitTransition:u,done:d,nodeRef:p,isIn:f,playToast:h}=a;const g=r?`${t}--${c}`:t,m=r?`${n}--${c}`:n,w=v.useRef(0);return v.useLayoutEffect(()=>{const x=p.current,y=g.split(" "),b=C=>{C.target===p.current&&(h(),x.removeEventListener("animationend",b),x.removeEventListener("animationcancel",b),w.current===0&&C.type!=="animationcancel"&&x.classList.remove(...y))};x.classList.add(...y),x.addEventListener("animationend",b),x.addEventListener("animationcancel",b)},[]),v.useEffect(()=>{const x=p.current,y=()=>{x.removeEventListener("animationend",y),o?d4(x,d,s):d()};f||(u?y():(w.current=1,x.className+=` ${m}`,x.addEventListener("animationend",y)))},[f]),Se.createElement(Se.Fragment,null,l)}}function H0(e,t){return e!=null?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const Nn=new Map;let Nc=[];const Sm=new Set,f4=e=>Sm.forEach(t=>t(e)),wT=()=>Nn.size>0;function bT(e,t){var n;if(t)return!((n=Nn.get(t))==null||!n.isToastActive(e));let r=!1;return Nn.forEach(o=>{o.isToastActive(e)&&(r=!0)}),r}function ST(e,t){bm(e)&&(wT()||Nc.push({content:e,options:t}),Nn.forEach(n=>{n.buildToast(e,t)}))}function G0(e,t){Nn.forEach(n=>{t!=null&&t!=null&&t.containerId?(t==null?void 0:t.containerId)===n.id&&n.toggle(e,t==null?void 0:t.id):n.toggle(e,t==null?void 0:t.id)})}function p4(e){const{subscribe:t,getSnapshot:n,setProps:r}=v.useRef(function(s){const a=s.containerId||1;return{subscribe(l){const c=function(d,p,f){let h=1,g=0,m=[],w=[],x=[],y=p;const b=new Map,C=new Set,j=()=>{x=Array.from(b.values()),C.forEach(E=>E())},S=E=>{w=E==null?[]:w.filter(O=>O!==E),j()},k=E=>{const{toastId:O,onOpen:F,updateId:Z,children:I}=E.props,q=Z==null;E.staleId&&b.delete(E.staleId),b.set(O,E),w=[...w,E.props.toastId].filter(H=>H!==E.staleId),j(),f(H0(E,q?"added":"updated")),q&&Xn(F)&&F(v.isValidElement(I)&&I.props)};return{id:d,props:y,observe:E=>(C.add(E),()=>C.delete(E)),toggle:(E,O)=>{b.forEach(F=>{O!=null&&O!==F.props.toastId||Xn(F.toggle)&&F.toggle(E)})},removeToast:S,toasts:b,clearQueue:()=>{g-=m.length,m=[]},buildToast:(E,O)=>{if((B=>{let{containerId:te,toastId:X,updateId:ie}=B;const re=te?te!==d:d!==1,W=b.has(X)&&ie==null;return re||W})(O))return;const{toastId:F,updateId:Z,data:I,staleId:q,delay:H}=O,J=()=>{S(F)},ne=Z==null;ne&&g++;const K={...y,style:y.toastStyle,key:h++,...Object.fromEntries(Object.entries(O).filter(B=>{let[te,X]=B;return X!=null})),toastId:F,updateId:Z,data:I,closeToast:J,isIn:!1,className:bd(O.className||y.toastClassName),bodyClassName:bd(O.bodyClassName||y.bodyClassName),progressClassName:bd(O.progressClassName||y.progressClassName),autoClose:!O.isLoading&&(z=O.autoClose,L=y.autoClose,z===!1||kc(z)&&z>0?z:L),deleteToast(){const B=b.get(F),{onClose:te,children:X}=B.props;Xn(te)&&te(v.isValidElement(X)&&X.props),f(H0(B,"removed")),b.delete(F),g--,g<0&&(g=0),m.length>0?k(m.shift()):j()}};var z,L;K.closeButton=y.closeButton,O.closeButton===!1||bm(O.closeButton)?K.closeButton=O.closeButton:O.closeButton===!0&&(K.closeButton=!bm(y.closeButton)||y.closeButton);let ee=E;v.isValidElement(E)&&!ca(E.type)?ee=v.cloneElement(E,{closeToast:J,toastProps:K,data:I}):Xn(E)&&(ee=E({closeToast:J,toastProps:K,data:I}));const fe={content:ee,props:K,staleId:q};y.limit&&y.limit>0&&g>y.limit&&ne?m.push(fe):kc(H)?setTimeout(()=>{k(fe)},H):k(fe)},setProps(E){y=E},setToggle:(E,O)=>{b.get(E).toggle=O},isToastActive:E=>w.some(O=>O===E),getSnapshot:()=>y.newestOnTop?x.reverse():x}}(a,s,f4);Nn.set(a,c);const u=c.observe(l);return Nc.forEach(d=>ST(d.content,d.options)),Nc=[],()=>{u(),Nn.delete(a)}},setProps(l){var c;(c=Nn.get(a))==null||c.setProps(l)},getSnapshot(){var l;return(l=Nn.get(a))==null?void 0:l.getSnapshot()}}}(e)).current;r(e);const o=v.useSyncExternalStore(t,n,n);return{getToastToRender:function(s){if(!o)return[];const a=new Map;return o.forEach(l=>{const{position:c}=l.props;a.has(c)||a.set(c,[]),a.get(c).push(l)}),Array.from(a,l=>s(l[0],l[1]))},isToastActive:bT,count:o==null?void 0:o.length}}function h4(e){const[t,n]=v.useState(!1),[r,o]=v.useState(!1),s=v.useRef(null),a=v.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:l,pauseOnHover:c,closeToast:u,onClick:d,closeOnClick:p}=e;var f,h;function g(){n(!0)}function m(){n(!1)}function w(b){const C=s.current;a.canDrag&&C&&(a.didMove=!0,t&&m(),a.delta=e.draggableDirection==="x"?b.clientX-a.start:b.clientY-a.start,a.start!==b.clientX&&(a.canCloseOnClick=!1),C.style.transform=`translate3d(${e.draggableDirection==="x"?`${a.delta}px, var(--y)`:`0, calc(${a.delta}px + var(--y))`},0)`,C.style.opacity=""+(1-Math.abs(a.delta/a.removalDistance)))}function x(){document.removeEventListener("pointermove",w),document.removeEventListener("pointerup",x);const b=s.current;if(a.canDrag&&a.didMove&&b){if(a.canDrag=!1,Math.abs(a.delta)>a.removalDistance)return o(!0),e.closeToast(),void e.collapseAll();b.style.transition="transform 0.2s, opacity 0.2s",b.style.removeProperty("transform"),b.style.removeProperty("opacity")}}(h=Nn.get((f={id:e.toastId,containerId:e.containerId,fn:n}).containerId||1))==null||h.setToggle(f.id,f.fn),v.useEffect(()=>{if(e.pauseOnFocusLoss)return document.hasFocus()||m(),window.addEventListener("focus",g),window.addEventListener("blur",m),()=>{window.removeEventListener("focus",g),window.removeEventListener("blur",m)}},[e.pauseOnFocusLoss]);const y={onPointerDown:function(b){if(e.draggable===!0||e.draggable===b.pointerType){a.didMove=!1,document.addEventListener("pointermove",w),document.addEventListener("pointerup",x);const C=s.current;a.canCloseOnClick=!0,a.canDrag=!0,C.style.transition="none",e.draggableDirection==="x"?(a.start=b.clientX,a.removalDistance=C.offsetWidth*(e.draggablePercent/100)):(a.start=b.clientY,a.removalDistance=C.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent)/100)}},onPointerUp:function(b){const{top:C,bottom:j,left:S,right:k}=s.current.getBoundingClientRect();b.nativeEvent.type!=="touchend"&&e.pauseOnHover&&b.clientX>=S&&b.clientX<=k&&b.clientY>=C&&b.clientY<=j?m():g()}};return l&&c&&(y.onMouseEnter=m,e.stacked||(y.onMouseLeave=g)),p&&(y.onClick=b=>{d&&d(b),a.canCloseOnClick&&u()}),{playToast:g,pauseToast:m,isRunning:t,preventExitTransition:r,toastRef:s,eventHandlers:y}}function g4(e){let{delay:t,isRunning:n,closeToast:r,type:o="default",hide:s,className:a,style:l,controlledProgress:c,progress:u,rtl:d,isIn:p,theme:f}=e;const h=s||c&&u===0,g={...l,animationDuration:`${t}ms`,animationPlayState:n?"running":"paused"};c&&(g.transform=`scaleX(${u})`);const m=Co("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${f}`,`Toastify__progress-bar--${o}`,{"Toastify__progress-bar--rtl":d}),w=Xn(a)?a({rtl:d,type:o,defaultClassName:m}):Co(m,a),x={[c&&u>=1?"onTransitionEnd":"onAnimationEnd"]:c&&u<1?null:()=>{p&&r()}};return Se.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":h},Se.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${f} Toastify__progress-bar--${o}`}),Se.createElement("div",{role:"progressbar","aria-hidden":h?"true":"false","aria-label":"notification timer",className:w,style:g,...x}))}let m4=1;const CT=()=>""+m4++;function v4(e){return e&&(ca(e.toastId)||kc(e.toastId))?e.toastId:CT()}function Ql(e,t){return ST(e,t),t.toastId}function gf(e,t){return{...t,type:t&&t.type||e,toastId:v4(t)}}function qu(e){return(t,n)=>Ql(t,gf(e,n))}function lt(e,t){return Ql(e,gf("default",t))}lt.loading=(e,t)=>Ql(e,gf("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),lt.promise=function(e,t,n){let r,{pending:o,error:s,success:a}=t;o&&(r=ca(o)?lt.loading(o,n):lt.loading(o.render,{...n,...o}));const l={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},c=(d,p,f)=>{if(p==null)return void lt.dismiss(r);const h={type:d,...l,...n,data:f},g=ca(p)?{render:p}:p;return r?lt.update(r,{...h,...g}):lt(g.render,{...h,...g}),f},u=Xn(e)?e():e;return u.then(d=>c("success",a,d)).catch(d=>c("error",s,d)),u},lt.success=qu("success"),lt.info=qu("info"),lt.error=qu("error"),lt.warning=qu("warning"),lt.warn=lt.warning,lt.dark=(e,t)=>Ql(e,gf("default",{theme:"dark",...t})),lt.dismiss=function(e){(function(t){var n;if(wT()){if(t==null||ca(n=t)||kc(n))Nn.forEach(r=>{r.removeToast(t)});else if(t&&("containerId"in t||"id"in t)){const r=Nn.get(t.containerId);r?r.removeToast(t.id):Nn.forEach(o=>{o.removeToast(t.id)})}}else Nc=Nc.filter(r=>t!=null&&r.options.toastId!==t)})(e)},lt.clearWaitingQueue=function(e){e===void 0&&(e={}),Nn.forEach(t=>{!t.props.limit||e.containerId&&t.id!==e.containerId||t.clearQueue()})},lt.isActive=bT,lt.update=function(e,t){t===void 0&&(t={});const n=((r,o)=>{var s;let{containerId:a}=o;return(s=Nn.get(a||1))==null?void 0:s.toasts.get(r)})(e,t);if(n){const{props:r,content:o}=n,s={delay:100,...r,...t,toastId:t.toastId||e,updateId:CT()};s.toastId!==e&&(s.staleId=e);const a=s.render||o;delete s.render,Ql(a,s)}},lt.done=e=>{lt.update(e,{progress:1})},lt.onChange=function(e){return Sm.add(e),()=>{Sm.delete(e)}},lt.play=e=>G0(!0,e),lt.pause=e=>G0(!1,e);const y4=typeof window<"u"?v.useLayoutEffect:v.useEffect,Zu=e=>{let{theme:t,type:n,isLoading:r,...o}=e;return Se.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...o})},Fh={info:function(e){return Se.createElement(Zu,{...e},Se.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return Se.createElement(Zu,{...e},Se.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return Se.createElement(Zu,{...e},Se.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return Se.createElement(Zu,{...e},Se.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return Se.createElement("div",{className:"Toastify__spinner"})}},x4=e=>{const{isRunning:t,preventExitTransition:n,toastRef:r,eventHandlers:o,playToast:s}=h4(e),{closeButton:a,children:l,autoClose:c,onClick:u,type:d,hideProgressBar:p,closeToast:f,transition:h,position:g,className:m,style:w,bodyClassName:x,bodyStyle:y,progressClassName:b,progressStyle:C,updateId:j,role:S,progress:k,rtl:E,toastId:O,deleteToast:F,isIn:Z,isLoading:I,closeOnClick:q,theme:H}=e,J=Co("Toastify__toast",`Toastify__toast-theme--${H}`,`Toastify__toast--${d}`,{"Toastify__toast--rtl":E},{"Toastify__toast--close-on-click":q}),ne=Xn(m)?m({rtl:E,position:g,type:d,defaultClassName:J}):Co(J,m),K=function(fe){let{theme:B,type:te,isLoading:X,icon:ie}=fe,re=null;const W={theme:B,type:te};return ie===!1||(Xn(ie)?re=ie({...W,isLoading:X}):v.isValidElement(ie)?re=v.cloneElement(ie,W):X?re=Fh.spinner():(we=>we in Fh)(te)&&(re=Fh[te](W))),re}(e),z=!!k||!c,L={closeToast:f,type:d,theme:H};let ee=null;return a===!1||(ee=Xn(a)?a(L):v.isValidElement(a)?v.cloneElement(a,L):function(fe){let{closeToast:B,theme:te,ariaLabel:X="close"}=fe;return Se.createElement("button",{className:`Toastify__close-button Toastify__close-button--${te}`,type:"button",onClick:ie=>{ie.stopPropagation(),B(ie)},"aria-label":X},Se.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},Se.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}(L)),Se.createElement(h,{isIn:Z,done:F,position:g,preventExitTransition:n,nodeRef:r,playToast:s},Se.createElement("div",{id:O,onClick:u,"data-in":Z,className:ne,...o,style:w,ref:r},Se.createElement("div",{...Z&&{role:S},className:Xn(x)?x({type:d}):Co("Toastify__toast-body",x),style:y},K!=null&&Se.createElement("div",{className:Co("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!I})},K),Se.createElement("div",null,l)),ee,Se.createElement(g4,{...j&&!z?{key:`pb-${j}`}:{},rtl:E,theme:H,delay:c,isRunning:t,isIn:Z,closeToast:f,hide:p,type:d,style:C,className:b,controlledProgress:z,progress:k||0})))},Sp=function(e,t){return t===void 0&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},w4=bp(Sp("bounce",!0));bp(Sp("slide",!0));bp(Sp("zoom"));bp(Sp("flip"));const b4={position:"top-right",transition:w4,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function S4(e){let t={...b4,...e};const n=e.stacked,[r,o]=v.useState(!0),s=v.useRef(null),{getToastToRender:a,isToastActive:l,count:c}=p4(t),{className:u,style:d,rtl:p,containerId:f}=t;function h(m){const w=Co("Toastify__toast-container",`Toastify__toast-container--${m}`,{"Toastify__toast-container--rtl":p});return Xn(u)?u({position:m,rtl:p,defaultClassName:w}):Co(w,bd(u))}function g(){n&&(o(!0),lt.play())}return y4(()=>{if(n){var m;const w=s.current.querySelectorAll('[data-in="true"]'),x=12,y=(m=t.position)==null?void 0:m.includes("top");let b=0,C=0;Array.from(w).reverse().forEach((j,S)=>{const k=j;k.classList.add("Toastify__toast--stacked"),S>0&&(k.dataset.collapsed=`${r}`),k.dataset.pos||(k.dataset.pos=y?"top":"bot");const E=b*(r?.2:1)+(r?0:x*S);k.style.setProperty("--y",`${y?E:-1*E}px`),k.style.setProperty("--g",`${x}`),k.style.setProperty("--s",""+(1-(r?C:0))),b+=k.offsetHeight,C+=.025})}},[r,c,n]),Se.createElement("div",{ref:s,className:"Toastify",id:f,onMouseEnter:()=>{n&&(o(!1),lt.pause())},onMouseLeave:g},a((m,w)=>{const x=w.length?{...d}:{...d,pointerEvents:"none"};return Se.createElement("div",{className:h(m),style:x,key:`container-${m}`},w.map(y=>{let{content:b,props:C}=y;return Se.createElement(x4,{...C,stacked:n,collapseAll:g,isIn:l(C.toastId,C.containerId),style:C.style,key:`toast-${C.key}`},b)}))}))}class C4{constructor(){this.defaultOptions={position:"top-right",autoClose:5e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,theme:"colored"}}success(t,n){lt.success(t,{...this.defaultOptions,...n})}error(t,n){lt.error(t,{...this.defaultOptions,...n})}info(t,n){lt.info(t,{...this.defaultOptions,...n})}warning(t,n){lt.warning(t,{...this.defaultOptions,...n})}}const De=new C4,W0=(e,t,n)=>{if(e&&"reportValidity"in e){const r=ue(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},jT=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?W0(r.ref,n,e):r.refs&&r.refs.forEach(o=>W0(o,n,e))}},j4=(e,t)=>{t.shouldUseNativeValidation&&jT(e,t);const n={};for(const r in e){const o=ue(t.fields,r),s=Object.assign(e[r]||{},{ref:o&&o.ref});if(_4(t.names||Object.keys(e),r)){const a=Object.assign({},ue(n,r));at(a,"root",s),at(n,r,a)}else at(n,r,s)}return n},_4=(e,t)=>e.some(n=>n.startsWith(t+"."));var E4=function(e,t){for(var n={};e.length;){var r=e[0],o=r.code,s=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[a]={message:l.message,type:l.code}}else n[a]={message:s,type:o};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(p){return e.push(p)})}),t){var c=n[a].types,u=c&&c[r.code];n[a]=eE(a,t,n,o,u?[].concat(u,r.message):r.message)}e.shift()}return n},nn=function(e,t,n){return n===void 0&&(n={}),function(r,o,s){try{return Promise.resolve(function(a,l){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return s.shouldUseNativeValidation&&jT({},s),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(a){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(a))return{values:{},errors:j4(E4(a.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw a}))}catch(a){return Promise.reject(a)}}},tt;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const a of o)s[a]=a;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),a={};for(const l of s)a[l]=o[l];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const a in o)Object.prototype.hasOwnProperty.call(o,a)&&s.push(a);return s},e.find=(o,s)=>{for(const a of o)if(s(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(tt||(tt={}));var Cm;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Cm||(Cm={}));const ye=tt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ls=e=>{switch(typeof e){case"undefined":return ye.undefined;case"string":return ye.string;case"number":return isNaN(e)?ye.nan:ye.number;case"boolean":return ye.boolean;case"function":return ye.function;case"bigint":return ye.bigint;case"symbol":return ye.symbol;case"object":return Array.isArray(e)?ye.array:e===null?ye.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ye.promise:typeof Map<"u"&&e instanceof Map?ye.map:typeof Set<"u"&&e instanceof Set?ye.set:typeof Date<"u"&&e instanceof Date?ye.date:ye.object;default:return ye.unknown}},Q=tt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),T4=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class tr extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let l=r,c=0;for(;cn.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}tr.create=e=>new tr(e);const Di=(e,t)=>{let n;switch(e.code){case Q.invalid_type:e.received===ye.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,tt.jsonStringifyReplacer)}`;break;case Q.unrecognized_keys:n=`Unrecognized key(s) in object: ${tt.joinValues(e.keys,", ")}`;break;case Q.invalid_union:n="Invalid input";break;case Q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${tt.joinValues(e.options)}`;break;case Q.invalid_enum_value:n=`Invalid enum value. Expected ${tt.joinValues(e.options)}, received '${e.received}'`;break;case Q.invalid_arguments:n="Invalid function arguments";break;case Q.invalid_return_type:n="Invalid function return type";break;case Q.invalid_date:n="Invalid date";break;case Q.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:tt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Q.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Q.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Q.custom:n="Invalid input";break;case Q.invalid_intersection_types:n="Intersection results could not be merged";break;case Q.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Q.not_finite:n="Number must be finite";break;default:n=t.defaultError,tt.assertNever(e)}return{message:n}};let _T=Di;function k4(e){_T=e}function mf(){return _T}const vf=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],a={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(a,{data:t,defaultError:l}).message;return{...o,path:s,message:l}},N4=[];function me(e,t){const n=mf(),r=vf({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Di?void 0:Di].filter(o=>!!o)});e.common.issues.push(r)}class jn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return $e;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,a=await o.value;r.push({key:s,value:a})}return jn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:a}=o;if(s.status==="aborted"||a.status==="aborted")return $e;s.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(r[s.value]=a.value)}return{status:t.value,value:r}}}const $e=Object.freeze({status:"aborted"}),ci=e=>({status:"dirty",value:e}),Pn=e=>({status:"valid",value:e}),jm=e=>e.status==="aborted",_m=e=>e.status==="dirty",Rc=e=>e.status==="valid",Pc=e=>typeof Promise<"u"&&e instanceof Promise;function yf(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function ET(e,t,n,r,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Ee;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ee||(Ee={}));var Ml,Al;class ao{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const K0=(e,t)=>{if(Rc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new tr(e.common.issues);return this._error=n,this._error}}};function He(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,l)=>{var c,u;const{message:d}=e;return a.code==="invalid_enum_value"?{message:d??l.defaultError}:typeof l.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:l.defaultError}:a.code!=="invalid_type"?{message:l.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:l.defaultError}},description:o}}class qe{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return ls(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ls(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new jn,ctx:{common:t.parent.common,data:t.data,parsedType:ls(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Pc(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ls(t)},s=this._parseSync({data:t,path:o.path,parent:o});return K0(o,s)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ls(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(Pc(o)?o:Promise.resolve(o));return K0(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const a=t(o),l=()=>s.addIssue({code:Q.custom,...r(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(l(),!1)):a?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Lr({schema:this,typeName:Ae.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return no.create(this,this._def)}nullable(){return Ps.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Or.create(this,this._def)}promise(){return Mi.create(this,this._def)}or(t){return Mc.create([this,t],this._def)}and(t){return Ac.create(this,t,this._def)}transform(t){return new Lr({...He(this._def),schema:this,typeName:Ae.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Vc({...He(this._def),innerType:this,defaultValue:n,typeName:Ae.ZodDefault})}brand(){return new Dy({typeName:Ae.ZodBranded,type:this,...He(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Uc({...He(this._def),innerType:this,catchValue:n,typeName:Ae.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return uu.create(this,t)}readonly(){return Bc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const R4=/^c[^\s-]{8,}$/i,P4=/^[0-9a-z]+$/,I4=/^[0-9A-HJKMNP-TV-Z]{26}$/,D4=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,O4=/^[a-z0-9_-]{21}$/i,M4=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,A4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,F4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Lh;const L4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,$4=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,z4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TT="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",V4=new RegExp(`^${TT}$`);function kT(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function U4(e){return new RegExp(`^${kT(e)}$`)}function NT(e){let t=`${TT}T${kT(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function B4(e,t){return!!((t==="v4"||!t)&&L4.test(e)||(t==="v6"||!t)&&$4.test(e))}class kr extends qe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ye.string){const s=this._getOrReturnCtx(t);return me(s,{code:Q.invalid_type,expected:ye.string,received:s.parsedType}),$e}const r=new jn;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.lengths.value&&(o=this._getOrReturnCtx(t,o),me(o,{code:Q.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const a=t.data.length>s.value,l=t.data.lengtht.test(o),{validation:n,code:Q.invalid_string,...Ee.errToObj(r)})}_addCheck(t){return new kr({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ee.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ee.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ee.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ee.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ee.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ee.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ee.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ee.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ee.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ee.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...Ee.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Ee.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ee.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ee.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ee.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ee.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ee.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ee.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ee.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ee.errToObj(n)})}nonempty(t){return this.min(1,Ee.errToObj(t))}trim(){return new kr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new kr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new kr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new kr({checks:[],typeName:Ae.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...He(e)})};function H4(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=parseInt(e.toFixed(o).replace(".","")),a=parseInt(t.toFixed(o).replace(".",""));return s%a/Math.pow(10,o)}class ks extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ye.number){const s=this._getOrReturnCtx(t);return me(s,{code:Q.invalid_type,expected:ye.number,received:s.parsedType}),$e}let r;const o=new jn;for(const s of this._def.checks)s.kind==="int"?tt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),me(r,{code:Q.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.datas.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),me(r,{code:Q.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?H4(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),me(r,{code:Q.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),me(r,{code:Q.not_finite,message:s.message}),o.dirty()):tt.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ee.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ee.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ee.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ee.toString(n))}setLimit(t,n,r,o){return new ks({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ee.toString(o)}]})}_addCheck(t){return new ks({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ee.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ee.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ee.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ee.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ee.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ee.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ee.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ee.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ee.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&tt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew ks({checks:[],typeName:Ae.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...He(e)});class Ns extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==ye.bigint){const s=this._getOrReturnCtx(t);return me(s,{code:Q.invalid_type,expected:ye.bigint,received:s.parsedType}),$e}let r;const o=new jn;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.datas.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),me(r,{code:Q.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),me(r,{code:Q.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):tt.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ee.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ee.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ee.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ee.toString(n))}setLimit(t,n,r,o){return new Ns({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ee.toString(o)}]})}_addCheck(t){return new Ns({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ee.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ee.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ee.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ee.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ee.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Ns({checks:[],typeName:Ae.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...He(e)})};class Ic extends qe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ye.boolean){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.boolean,received:r.parsedType}),$e}return Pn(t.data)}}Ic.create=e=>new Ic({typeName:Ae.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...He(e)});class Sa extends qe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ye.date){const s=this._getOrReturnCtx(t);return me(s,{code:Q.invalid_type,expected:ye.date,received:s.parsedType}),$e}if(isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return me(s,{code:Q.invalid_date}),$e}const r=new jn;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()s.value&&(o=this._getOrReturnCtx(t,o),me(o,{code:Q.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):tt.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Sa({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ee.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ee.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Sa({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ae.ZodDate,...He(e)});class xf extends qe{_parse(t){if(this._getType(t)!==ye.symbol){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.symbol,received:r.parsedType}),$e}return Pn(t.data)}}xf.create=e=>new xf({typeName:Ae.ZodSymbol,...He(e)});class Dc extends qe{_parse(t){if(this._getType(t)!==ye.undefined){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.undefined,received:r.parsedType}),$e}return Pn(t.data)}}Dc.create=e=>new Dc({typeName:Ae.ZodUndefined,...He(e)});class Oc extends qe{_parse(t){if(this._getType(t)!==ye.null){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.null,received:r.parsedType}),$e}return Pn(t.data)}}Oc.create=e=>new Oc({typeName:Ae.ZodNull,...He(e)});class Oi extends qe{constructor(){super(...arguments),this._any=!0}_parse(t){return Pn(t.data)}}Oi.create=e=>new Oi({typeName:Ae.ZodAny,...He(e)});class ua extends qe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Pn(t.data)}}ua.create=e=>new ua({typeName:Ae.ZodUnknown,...He(e)});class Ao extends qe{_parse(t){const n=this._getOrReturnCtx(t);return me(n,{code:Q.invalid_type,expected:ye.never,received:n.parsedType}),$e}}Ao.create=e=>new Ao({typeName:Ae.ZodNever,...He(e)});class wf extends qe{_parse(t){if(this._getType(t)!==ye.undefined){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.void,received:r.parsedType}),$e}return Pn(t.data)}}wf.create=e=>new wf({typeName:Ae.ZodVoid,...He(e)});class Or extends qe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==ye.array)return me(n,{code:Q.invalid_type,expected:ye.array,received:n.parsedType}),$e;if(o.exactLength!==null){const a=n.data.length>o.exactLength.value,l=n.data.lengtho.maxLength.value&&(me(n,{code:Q.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,l)=>o.type._parseAsync(new ao(n,a,n.path,l)))).then(a=>jn.mergeArray(r,a));const s=[...n.data].map((a,l)=>o.type._parseSync(new ao(n,a,n.path,l)));return jn.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new Or({...this._def,minLength:{value:t,message:Ee.toString(n)}})}max(t,n){return new Or({...this._def,maxLength:{value:t,message:Ee.toString(n)}})}length(t,n){return new Or({...this._def,exactLength:{value:t,message:Ee.toString(n)}})}nonempty(t){return this.min(1,t)}}Or.create=(e,t)=>new Or({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ae.ZodArray,...He(t)});function Wa(e){if(e instanceof Nt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=no.create(Wa(r))}return new Nt({...e._def,shape:()=>t})}else return e instanceof Or?new Or({...e._def,type:Wa(e.element)}):e instanceof no?no.create(Wa(e.unwrap())):e instanceof Ps?Ps.create(Wa(e.unwrap())):e instanceof io?io.create(e.items.map(t=>Wa(t))):e}class Nt extends qe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=tt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==ye.object){const u=this._getOrReturnCtx(t);return me(u,{code:Q.invalid_type,expected:ye.object,received:u.parsedType}),$e}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:a}=this._getCached(),l=[];if(!(this._def.catchall instanceof Ao&&this._def.unknownKeys==="strip"))for(const u in o.data)a.includes(u)||l.push(u);const c=[];for(const u of a){const d=s[u],p=o.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ao(o,p,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Ao){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(u==="strict")l.length>0&&(me(o,{code:Q.unrecognized_keys,keys:l}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const p=o.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new ao(o,p,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const p=await d.key,f=await d.value;u.push({key:p,value:f,alwaysSet:d.alwaysSet})}return u}).then(u=>jn.mergeObjectSync(r,u)):jn.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return Ee.errToObj,new Nt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,s,a,l;const c=(a=(s=(o=this._def).errorMap)===null||s===void 0?void 0:s.call(o,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=Ee.errToObj(t).message)!==null&&l!==void 0?l:c}:{message:c}}}:{}})}strip(){return new Nt({...this._def,unknownKeys:"strip"})}passthrough(){return new Nt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Nt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Nt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ae.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Nt({...this._def,catchall:t})}pick(t){const n={};return tt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Nt({...this._def,shape:()=>n})}omit(t){const n={};return tt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Nt({...this._def,shape:()=>n})}deepPartial(){return Wa(this)}partial(t){const n={};return tt.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new Nt({...this._def,shape:()=>n})}required(t){const n={};return tt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof no;)s=s._def.innerType;n[r]=s}}),new Nt({...this._def,shape:()=>n})}keyof(){return RT(tt.objectKeys(this.shape))}}Nt.create=(e,t)=>new Nt({shape:()=>e,unknownKeys:"strip",catchall:Ao.create(),typeName:Ae.ZodObject,...He(t)});Nt.strictCreate=(e,t)=>new Nt({shape:()=>e,unknownKeys:"strict",catchall:Ao.create(),typeName:Ae.ZodObject,...He(t)});Nt.lazycreate=(e,t)=>new Nt({shape:e,unknownKeys:"strip",catchall:Ao.create(),typeName:Ae.ZodObject,...He(t)});class Mc extends qe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const l of s)if(l.result.status==="valid")return l.result;for(const l of s)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const a=s.map(l=>new tr(l.ctx.common.issues));return me(n,{code:Q.invalid_union,unionErrors:a}),$e}if(n.common.async)return Promise.all(r.map(async s=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(o);{let s;const a=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const l=a.map(c=>new tr(c));return me(n,{code:Q.invalid_union,unionErrors:l}),$e}}get options(){return this._def.options}}Mc.create=(e,t)=>new Mc({options:e,typeName:Ae.ZodUnion,...He(t)});const go=e=>e instanceof Lc?go(e.schema):e instanceof Lr?go(e.innerType()):e instanceof $c?[e.value]:e instanceof Rs?e.options:e instanceof zc?tt.objectValues(e.enum):e instanceof Vc?go(e._def.innerType):e instanceof Dc?[void 0]:e instanceof Oc?[null]:e instanceof no?[void 0,...go(e.unwrap())]:e instanceof Ps?[null,...go(e.unwrap())]:e instanceof Dy||e instanceof Bc?go(e.unwrap()):e instanceof Uc?go(e._def.innerType):[];class Cp extends qe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.object)return me(n,{code:Q.invalid_type,expected:ye.object,received:n.parsedType}),$e;const r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(me(n,{code:Q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),$e)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const s of n){const a=go(s.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const l of a){if(o.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);o.set(l,s)}}return new Cp({typeName:Ae.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...He(r)})}}function Em(e,t){const n=ls(e),r=ls(t);if(e===t)return{valid:!0,data:e};if(n===ye.object&&r===ye.object){const o=tt.objectKeys(t),s=tt.objectKeys(e).filter(l=>o.indexOf(l)!==-1),a={...e,...t};for(const l of s){const c=Em(e[l],t[l]);if(!c.valid)return{valid:!1};a[l]=c.data}return{valid:!0,data:a}}else if(n===ye.array&&r===ye.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s{if(jm(s)||jm(a))return $e;const l=Em(s.value,a.value);return l.valid?((_m(s)||_m(a))&&n.dirty(),{status:n.value,value:l.data}):(me(r,{code:Q.invalid_intersection_types}),$e)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,a])=>o(s,a)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ac.create=(e,t,n)=>new Ac({left:e,right:t,typeName:Ae.ZodIntersection,...He(n)});class io extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.array)return me(r,{code:Q.invalid_type,expected:ye.array,received:r.parsedType}),$e;if(r.data.lengththis._def.items.length&&(me(r,{code:Q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new ao(r,a,r.path,l)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>jn.mergeArray(n,a)):jn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new io({...this._def,rest:t})}}io.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new io({items:e,typeName:Ae.ZodTuple,rest:null,...He(t)})};class Fc extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.object)return me(r,{code:Q.invalid_type,expected:ye.object,received:r.parsedType}),$e;const o=[],s=this._def.keyType,a=this._def.valueType;for(const l in r.data)o.push({key:s._parse(new ao(r,l,r.path,l)),value:a._parse(new ao(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?jn.mergeObjectAsync(n,o):jn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof qe?new Fc({keyType:t,valueType:n,typeName:Ae.ZodRecord,...He(r)}):new Fc({keyType:kr.create(),valueType:t,typeName:Ae.ZodRecord,...He(n)})}}class bf extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.map)return me(r,{code:Q.invalid_type,expected:ye.map,received:r.parsedType}),$e;const o=this._def.keyType,s=this._def.valueType,a=[...r.data.entries()].map(([l,c],u)=>({key:o._parse(new ao(r,l,r.path,[u,"key"])),value:s._parse(new ao(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of a){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return $e;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of a){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return $e;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}bf.create=(e,t,n)=>new bf({valueType:t,keyType:e,typeName:Ae.ZodMap,...He(n)});class Ca extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ye.set)return me(r,{code:Q.invalid_type,expected:ye.set,received:r.parsedType}),$e;const o=this._def;o.minSize!==null&&r.data.sizeo.maxSize.value&&(me(r,{code:Q.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function a(c){const u=new Set;for(const d of c){if(d.status==="aborted")return $e;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>s._parse(new ao(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>a(c)):a(l)}min(t,n){return new Ca({...this._def,minSize:{value:t,message:Ee.toString(n)}})}max(t,n){return new Ca({...this._def,maxSize:{value:t,message:Ee.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Ca.create=(e,t)=>new Ca({valueType:e,minSize:null,maxSize:null,typeName:Ae.ZodSet,...He(t)});class xi extends qe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.function)return me(n,{code:Q.invalid_type,expected:ye.function,received:n.parsedType}),$e;function r(l,c){return vf({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,mf(),Di].filter(u=>!!u),issueData:{code:Q.invalid_arguments,argumentsError:c}})}function o(l,c){return vf({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,mf(),Di].filter(u=>!!u),issueData:{code:Q.invalid_return_type,returnTypeError:c}})}const s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Mi){const l=this;return Pn(async function(...c){const u=new tr([]),d=await l._def.args.parseAsync(c,s).catch(h=>{throw u.addIssue(r(c,h)),u}),p=await Reflect.apply(a,this,d);return await l._def.returns._def.type.parseAsync(p,s).catch(h=>{throw u.addIssue(o(p,h)),u})})}else{const l=this;return Pn(function(...c){const u=l._def.args.safeParse(c,s);if(!u.success)throw new tr([r(c,u.error)]);const d=Reflect.apply(a,this,u.data),p=l._def.returns.safeParse(d,s);if(!p.success)throw new tr([o(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new xi({...this._def,args:io.create(t).rest(ua.create())})}returns(t){return new xi({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new xi({args:t||io.create([]).rest(ua.create()),returns:n||ua.create(),typeName:Ae.ZodFunction,...He(r)})}}class Lc extends qe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Lc.create=(e,t)=>new Lc({getter:e,typeName:Ae.ZodLazy,...He(t)});class $c extends qe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return me(n,{received:n.data,code:Q.invalid_literal,expected:this._def.value}),$e}return{status:"valid",value:t.data}}get value(){return this._def.value}}$c.create=(e,t)=>new $c({value:e,typeName:Ae.ZodLiteral,...He(t)});function RT(e,t){return new Rs({values:e,typeName:Ae.ZodEnum,...He(t)})}class Rs extends qe{constructor(){super(...arguments),Ml.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return me(n,{expected:tt.joinValues(r),received:n.parsedType,code:Q.invalid_type}),$e}if(yf(this,Ml)||ET(this,Ml,new Set(this._def.values)),!yf(this,Ml).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return me(n,{received:n.data,code:Q.invalid_enum_value,options:r}),$e}return Pn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Rs.create(t,{...this._def,...n})}exclude(t,n=this._def){return Rs.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ml=new WeakMap;Rs.create=RT;class zc extends qe{constructor(){super(...arguments),Al.set(this,void 0)}_parse(t){const n=tt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ye.string&&r.parsedType!==ye.number){const o=tt.objectValues(n);return me(r,{expected:tt.joinValues(o),received:r.parsedType,code:Q.invalid_type}),$e}if(yf(this,Al)||ET(this,Al,new Set(tt.getValidEnumValues(this._def.values))),!yf(this,Al).has(t.data)){const o=tt.objectValues(n);return me(r,{received:r.data,code:Q.invalid_enum_value,options:o}),$e}return Pn(t.data)}get enum(){return this._def.values}}Al=new WeakMap;zc.create=(e,t)=>new zc({values:e,typeName:Ae.ZodNativeEnum,...He(t)});class Mi extends qe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.promise&&n.common.async===!1)return me(n,{code:Q.invalid_type,expected:ye.promise,received:n.parsedType}),$e;const r=n.parsedType===ye.promise?n.data:Promise.resolve(n.data);return Pn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Mi.create=(e,t)=>new Mi({type:e,typeName:Ae.ZodPromise,...He(t)});class Lr extends qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:a=>{me(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const a=o.transform(r.data,s);if(r.common.async)return Promise.resolve(a).then(async l=>{if(n.value==="aborted")return $e;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?$e:c.status==="dirty"||n.value==="dirty"?ci(c.value):c});{if(n.value==="aborted")return $e;const l=this._def.schema._parseSync({data:a,path:r.path,parent:r});return l.status==="aborted"?$e:l.status==="dirty"||n.value==="dirty"?ci(l.value):l}}if(o.type==="refinement"){const a=l=>{const c=o.refinement(l,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?$e:(l.status==="dirty"&&n.dirty(),a(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?$e:(l.status==="dirty"&&n.dirty(),a(l.value).then(()=>({status:n.value,value:l.value}))))}if(o.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Rc(a))return a;const l=o.transform(a.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Rc(a)?Promise.resolve(o.transform(a.value,s)).then(l=>({status:n.value,value:l})):a);tt.assertNever(o)}}Lr.create=(e,t,n)=>new Lr({schema:e,typeName:Ae.ZodEffects,effect:t,...He(n)});Lr.createWithPreprocess=(e,t,n)=>new Lr({schema:t,effect:{type:"preprocess",transform:e},typeName:Ae.ZodEffects,...He(n)});class no extends qe{_parse(t){return this._getType(t)===ye.undefined?Pn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}no.create=(e,t)=>new no({innerType:e,typeName:Ae.ZodOptional,...He(t)});class Ps extends qe{_parse(t){return this._getType(t)===ye.null?Pn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ps.create=(e,t)=>new Ps({innerType:e,typeName:Ae.ZodNullable,...He(t)});class Vc extends qe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ye.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Vc.create=(e,t)=>new Vc({innerType:e,typeName:Ae.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...He(t)});class Uc extends qe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Pc(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new tr(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Uc.create=(e,t)=>new Uc({innerType:e,typeName:Ae.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...He(t)});class Sf extends qe{_parse(t){if(this._getType(t)!==ye.nan){const r=this._getOrReturnCtx(t);return me(r,{code:Q.invalid_type,expected:ye.nan,received:r.parsedType}),$e}return{status:"valid",value:t.data}}}Sf.create=e=>new Sf({typeName:Ae.ZodNaN,...He(e)});const G4=Symbol("zod_brand");class Dy extends qe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class uu extends qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?$e:s.status==="dirty"?(n.dirty(),ci(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?$e:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new uu({in:t,out:n,typeName:Ae.ZodPipeline})}}class Bc extends qe{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Rc(o)&&(o.value=Object.freeze(o.value)),o);return Pc(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Bc.create=(e,t)=>new Bc({innerType:e,typeName:Ae.ZodReadonly,...He(t)});function PT(e,t={},n){return e?Oi.create().superRefine((r,o)=>{var s,a;if(!e(r)){const l=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,c=(a=(s=l.fatal)!==null&&s!==void 0?s:n)!==null&&a!==void 0?a:!0,u=typeof l=="string"?{message:l}:l;o.addIssue({code:"custom",...u,fatal:c})}}):Oi.create()}const W4={object:Nt.lazycreate};var Ae;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ae||(Ae={}));const K4=(e,t={message:`Input not instance of ${e.name}`})=>PT(n=>n instanceof e,t),IT=kr.create,DT=ks.create,q4=Sf.create,Z4=Ns.create,OT=Ic.create,J4=Sa.create,Y4=xf.create,X4=Dc.create,Q4=Oc.create,ez=Oi.create,tz=ua.create,nz=Ao.create,rz=wf.create,oz=Or.create,sz=Nt.create,az=Nt.strictCreate,iz=Mc.create,lz=Cp.create,cz=Ac.create,uz=io.create,dz=Fc.create,fz=bf.create,pz=Ca.create,hz=xi.create,gz=Lc.create,mz=$c.create,vz=Rs.create,yz=zc.create,xz=Mi.create,q0=Lr.create,wz=no.create,bz=Ps.create,Sz=Lr.createWithPreprocess,Cz=uu.create,jz=()=>IT().optional(),_z=()=>DT().optional(),Ez=()=>OT().optional(),Tz={string:e=>kr.create({...e,coerce:!0}),number:e=>ks.create({...e,coerce:!0}),boolean:e=>Ic.create({...e,coerce:!0}),bigint:e=>Ns.create({...e,coerce:!0}),date:e=>Sa.create({...e,coerce:!0})},kz=$e;var T=Object.freeze({__proto__:null,defaultErrorMap:Di,setErrorMap:k4,getErrorMap:mf,makeIssue:vf,EMPTY_PATH:N4,addIssueToContext:me,ParseStatus:jn,INVALID:$e,DIRTY:ci,OK:Pn,isAborted:jm,isDirty:_m,isValid:Rc,isAsync:Pc,get util(){return tt},get objectUtil(){return Cm},ZodParsedType:ye,getParsedType:ls,ZodType:qe,datetimeRegex:NT,ZodString:kr,ZodNumber:ks,ZodBigInt:Ns,ZodBoolean:Ic,ZodDate:Sa,ZodSymbol:xf,ZodUndefined:Dc,ZodNull:Oc,ZodAny:Oi,ZodUnknown:ua,ZodNever:Ao,ZodVoid:wf,ZodArray:Or,ZodObject:Nt,ZodUnion:Mc,ZodDiscriminatedUnion:Cp,ZodIntersection:Ac,ZodTuple:io,ZodRecord:Fc,ZodMap:bf,ZodSet:Ca,ZodFunction:xi,ZodLazy:Lc,ZodLiteral:$c,ZodEnum:Rs,ZodNativeEnum:zc,ZodPromise:Mi,ZodEffects:Lr,ZodTransformer:Lr,ZodOptional:no,ZodNullable:Ps,ZodDefault:Vc,ZodCatch:Uc,ZodNaN:Sf,BRAND:G4,ZodBranded:Dy,ZodPipeline:uu,ZodReadonly:Bc,custom:PT,Schema:qe,ZodSchema:qe,late:W4,get ZodFirstPartyTypeKind(){return Ae},coerce:Tz,any:ez,array:oz,bigint:Z4,boolean:OT,date:J4,discriminatedUnion:lz,effect:q0,enum:vz,function:hz,instanceof:K4,intersection:cz,lazy:gz,literal:mz,map:fz,nan:q4,nativeEnum:yz,never:nz,null:Q4,nullable:bz,number:DT,object:sz,oboolean:Ez,onumber:_z,optional:wz,ostring:jz,pipeline:Cz,preprocess:Sz,promise:xz,record:dz,set:pz,strictObject:az,string:IT,symbol:Y4,transformer:q0,tuple:uz,undefined:X4,union:iz,unknown:tz,void:rz,NEVER:kz,ZodIssueCode:Q,quotelessJson:T4,ZodError:tr});const Nz=T.object({name:T.string(),integration:T.string(),token:T.string(),number:T.string()});function Rz({resetTable:e}){const[t,n]=v.useState(!1),r=tn({resolver:nn(Nz),defaultValues:{name:"",integration:"WHATSAPP-BAILEYS",token:crypto.randomUUID().replace("-","").toLocaleUpperCase(),number:""}}),o=async a=>{var l,c,u;try{const d={instanceName:a.name,integration:a.integration,token:a.token===""?void 0:a.token,number:a.number===""?void 0:a.number};await HM(d),De.success("Instância criada com sucesso"),n(!1),s(),e()}catch(d){console.error("Erro ao criar instância:",d),De.error(`Erro ao criar : ${(u=(c=(l=d==null?void 0:d.response)==null?void 0:l.data)==null?void 0:c.response)==null?void 0:u.message}`)}},s=()=>{r.reset({name:"",integration:"WHATSAPP-BAILEYS",token:crypto.randomUUID().replace("-","").toLocaleUpperCase(),number:""})};return i.jsxs(Sn,{open:t,onOpenChange:n,children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",children:[i.jsx(ou,{})," Instância"]})}),i.jsxs(un,{className:"sm:max-w-[650px]",onCloseAutoFocus:s,children:[i.jsx(dn,{children:i.jsx(On,{children:"Nova Instância"})}),i.jsx(Uo,{...r,children:i.jsxs("form",{onSubmit:r.handleSubmit(o),className:"grid gap-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[i.jsx(fs,{htmlFor:"name",className:"text-right",children:"Nome"}),i.jsx(se,{id:"name",...r.register("name"),className:"col-span-3 border border-gray-600"})]}),i.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[i.jsx(fs,{htmlFor:"integration",className:"text-right",children:"Integração"}),i.jsx(P,{control:r.control,name:"integration",render:({field:a})=>i.jsx(M,{className:"col-span-3 w-full border border-gray-600",children:i.jsxs(St,{onValueChange:a.onChange,defaultValue:a.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma credencial"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"WHATSAPP-BAILEYS",children:"Baileys"}),i.jsx(he,{value:"WHATSAPP-BUSINESS",children:"Whatsapp Cloud API"})]})]})})})]}),i.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[i.jsx(fs,{htmlFor:"token",className:"text-right",children:"Token"}),i.jsx(se,{id:"token",...r.register("token"),className:"col-span-3 border border-gray-600"})]}),i.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[i.jsx(fs,{htmlFor:"number",className:"text-right",children:"Número"}),i.jsx(se,{id:"number",...r.register("number"),className:"col-span-3 border border-gray-600"})]}),i.jsx(wr,{children:i.jsx(Te,{type:"submit",children:"Salvar"})})]})})]})]})}const MT=e=>{navigator.clipboard.writeText(e),De.success("Copiado para a área de transferência")},$h=async e=>{try{const t=await GM();e(t)}catch(t){console.error("Erro ao buscar dados:",t)}};function Pz(){const[e,t]=v.useState(!1),[n,r]=v.useState([]),[o,s]=v.useState([]),[a,l]=v.useState([]),[c,u]=v.useState("all"),d=ir(),p=()=>{t(!e)},f=y=>()=>{d(`/manager/instance/${y}/dashboard`)};v.useEffect(()=>{(async()=>{await $h(b=>{r(b)})})()},[]);const h=y=>{switch(y){case"open":return i.jsxs("div",{className:"btn connected",children:["Conectada ",i.jsx("span",{className:"status-connected connected"})]});case"connecting":return i.jsxs("div",{className:"btn connected",children:["Conectando ",i.jsx("span",{className:"status-connecting connected"})]});case"closed":return i.jsxs("div",{className:"btn connected",children:["Desconectado ",i.jsx("span",{className:"status-disconnected connected"})]});default:return i.jsxs("div",{className:"btn connected",children:["Desconectado ",i.jsx("span",{className:"status-disconnected connected"})]})}},g=async()=>{await $h(y=>{r(y)})},m=async y=>{var b,C,j;s([...o,y]);try{try{await w_(y)}catch(S){console.error("Erro ao fazer logout:",S)}await KM(y),await new Promise(S=>setTimeout(S,1e3)),g()}catch(S){console.error("Erro ao deletar instância:",S),De.error(`Erro ao deletar : ${(j=(C=(b=S==null?void 0:S.response)==null?void 0:b.data)==null?void 0:C.response)==null?void 0:j.message}`)}finally{s(o.filter(S=>S!==y))}},w=async y=>{if(y===""){await g();return}const b=n.filter(C=>C.name.toLowerCase().includes(y.toLowerCase()));r(b)},x=async y=>{if(u(y),y==="all"){await g();return}await $h(b=>{const C=b.filter(j=>j.connectionStatus===y);r(C)})};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"toolbar",children:[i.jsx("div",{className:"toolbar-title",children:i.jsx("h2",{children:"Instâncias"})}),i.jsxs("div",{className:"toolbar-buttons",children:[i.jsx(Te,{variant:"outline",className:"refresh-button",children:i.jsx(__,{onClick:g,size:"20"})}),i.jsx(Rz,{resetTable:g})]})]}),i.jsxs("div",{className:"search",children:[i.jsx("div",{className:"search-bar",children:i.jsx("input",{type:"text",placeholder:"Pesquisar",onChange:y=>w(y.target.value)})}),i.jsxs("div",{className:"status-dropdown",children:[i.jsxs("button",{className:"dropdown-button",onClick:p,children:["Status ",i.jsx(rA,{size:"15"})]}),e&&i.jsxs("div",{className:"dropdown-menu",children:[i.jsxs("button",{className:`dropdown-item ${c==="all"?"active":""}`,onClick:()=>x("all"),children:["Todos",c==="all"&&i.jsx("span",{children:i.jsx(ai,{size:"15",className:"ml-2"})})]}),i.jsxs("button",{onClick:()=>x("close"),className:`dropdown-item ${c==="close"?"active":""}`,children:["Desconectado",c==="close"&&i.jsx("span",{children:i.jsx(ai,{size:"15",className:"ml-2"})})]}),i.jsxs("button",{onClick:()=>x("connecting"),className:`dropdown-item ${c==="connecting"?"active":""}`,children:["Conectando",c==="connecting"&&i.jsx("span",{children:i.jsx(ai,{size:"15",className:"ml-2"})})]}),i.jsxs("button",{onClick:()=>x("open"),className:`dropdown-item ${c==="open"?"active":""}`,children:["Conectado",c==="open"&&i.jsx("span",{children:i.jsx(ai,{size:"15",className:"ml-2"})})]})]})]})]}),i.jsx("main",{className:"instance-cards",children:n&&n.length>0&&Array.isArray(n)&&n.map(y=>{var b,C;return i.jsxs(mi,{className:"instance-card",children:[i.jsxs("div",{className:"card-header",children:[i.jsxs("div",{className:"card-id",children:[i.jsx("span",{children:a.includes(y.token)?y.token.substring(0,36)+"...":y.token.substring(0,36).split("").map(()=>"*").join("")}),i.jsx(S_,{className:"card-icon",size:"15",onClick:()=>{MT(y.token)}}),a.includes(y.token)?i.jsx(C_,{className:"card-icon",size:"15",onClick:()=>{l(a.filter(j=>j!==y.token))}}):i.jsx(j_,{className:"card-icon",size:"15",onClick:()=>{l([...a,y.token])}})]}),i.jsx("div",{className:"card-menu",onClick:f(y.id),children:i.jsx(ru,{className:"card-icon",size:"20"})})]}),i.jsxs("div",{className:"card-body",children:[i.jsxs("div",{className:"card-details",children:[i.jsx("p",{className:"instance-name",children:y.name}),i.jsx("p",{className:"instance-description",children:y.profileName})]}),i.jsx("div",{className:"card-contact",children:i.jsx("p",{children:y.ownerJid&&y.ownerJid.split("@")[0]})})]}),i.jsxs("div",{className:"card-footer",children:[i.jsxs("div",{className:"card-stats",children:[i.jsxs("div",{className:"stat",children:[i.jsx(sA,{className:"stat-icon",size:"20"}),i.jsx("span",{children:((b=y==null?void 0:y._count)==null?void 0:b.Contact)||0})]}),i.jsxs("div",{className:"stat",children:[i.jsx(ey,{className:"stat-icon",size:"20"}),i.jsx("span",{children:((C=y==null?void 0:y._count)==null?void 0:C.Message)||0})]})]}),i.jsxs("div",{className:"card-actions",children:[h(y.connectionStatus),i.jsx("button",{className:`btn disconnect ${o.includes(y.name)?"disabled":""}`,onClick:()=>m(y.name),disabled:o.includes(y.name),children:o.includes(y.name)?i.jsx("span",{children:"Deletando..."}):i.jsx("span",{children:"Deletar"})})]})]})]},y.id)})})]})}var zh="rovingFocusGroup.onEntryFocus",Iz={bubbles:!1,cancelable:!0},jp="RovingFocusGroup",[Tm,AT,Dz]=Cy(jp),[Oz,_p]=lo(jp,[Dz]),[Mz,Az]=Oz(jp),FT=v.forwardRef((e,t)=>i.jsx(Tm.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(Tm.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(Fz,{...e,ref:t})})}));FT.displayName=jp;var Fz=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...p}=e,f=v.useRef(null),h=ut(t,f),g=hp(s),[m=null,w]=js({prop:a,defaultProp:l,onChange:c}),[x,y]=v.useState(!1),b=xr(u),C=AT(n),j=v.useRef(!1),[S,k]=v.useState(0);return v.useEffect(()=>{const E=f.current;if(E)return E.addEventListener(zh,b),()=>E.removeEventListener(zh,b)},[b]),i.jsx(Mz,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:m,onItemFocus:v.useCallback(E=>w(E),[w]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>k(E=>E+1),[]),onFocusableItemRemove:v.useCallback(()=>k(E=>E-1),[]),children:i.jsx(Ve.div,{tabIndex:x||S===0?-1:0,"data-orientation":r,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:Ce(e.onMouseDown,()=>{j.current=!0}),onFocus:Ce(e.onFocus,E=>{const O=!j.current;if(E.target===E.currentTarget&&O&&!x){const F=new CustomEvent(zh,Iz);if(E.currentTarget.dispatchEvent(F),!F.defaultPrevented){const Z=C().filter(ne=>ne.focusable),I=Z.find(ne=>ne.active),q=Z.find(ne=>ne.id===m),J=[I,q,...Z].filter(Boolean).map(ne=>ne.ref.current);zT(J,d)}}j.current=!1}),onBlur:Ce(e.onBlur,()=>y(!1))})})}),LT="RovingFocusGroupItem",$T=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,...a}=e,l=Ir(),c=s||l,u=Az(LT,n),d=u.currentTabStopId===c,p=AT(n),{onFocusableItemAdd:f,onFocusableItemRemove:h}=u;return v.useEffect(()=>{if(r)return f(),()=>h()},[r,f,h]),i.jsx(Tm.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:i.jsx(Ve.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:Ce(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:Ce(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Ce(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=zz(g,u.orientation,u.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let x=p().filter(y=>y.focusable).map(y=>y.ref.current);if(m==="last")x.reverse();else if(m==="prev"||m==="next"){m==="prev"&&x.reverse();const y=x.indexOf(g.currentTarget);x=u.loop?Vz(x,y+1):x.slice(y+1)}setTimeout(()=>zT(x))}})})})});$T.displayName=LT;var Lz={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $z(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zz(e,t,n){const r=$z(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Lz[r]}function zT(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Vz(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var VT=FT,UT=$T,km=["Enter"," "],Uz=["ArrowDown","PageUp","Home"],BT=["ArrowUp","PageDown","End"],Bz=[...Uz,...BT],Hz={ltr:[...km,"ArrowRight"],rtl:[...km,"ArrowLeft"]},Gz={ltr:["ArrowLeft"],rtl:["ArrowRight"]},du="Menu",[Hc,Wz,Kz]=Cy(du),[ka,HT]=lo(du,[Kz,vp,_p]),Ep=vp(),GT=_p(),[qz,Na]=ka(du),[Zz,fu]=ka(du),WT=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:a=!0}=e,l=Ep(t),[c,u]=v.useState(null),d=v.useRef(!1),p=xr(s),f=hp(o);return v.useEffect(()=>{const h=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),i.jsx(PE,{...l,children:i.jsx(qz,{scope:t,open:n,onOpenChange:p,content:c,onContentChange:u,children:i.jsx(Zz,{scope:t,onClose:v.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:d,dir:f,modal:a,children:r})})})};WT.displayName=du;var Jz="MenuAnchor",Oy=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ep(n);return i.jsx(IE,{...o,...r,ref:t})});Oy.displayName=Jz;var My="MenuPortal",[Yz,KT]=ka(My,{forceMount:void 0}),qT=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Na(My,t);return i.jsx(Yz,{scope:t,forceMount:n,children:i.jsx(co,{present:n||s.open,children:i.jsx(lp,{asChild:!0,container:o,children:r})})})};qT.displayName=My;var mr="MenuContent",[Xz,Ay]=ka(mr),ZT=v.forwardRef((e,t)=>{const n=KT(mr,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Na(mr,e.__scopeMenu),a=fu(mr,e.__scopeMenu);return i.jsx(Hc.Provider,{scope:e.__scopeMenu,children:i.jsx(co,{present:r||s.open,children:i.jsx(Hc.Slot,{scope:e.__scopeMenu,children:a.modal?i.jsx(Qz,{...o,ref:t}):i.jsx(eV,{...o,ref:t})})})})}),Qz=v.forwardRef((e,t)=>{const n=Na(mr,e.__scopeMenu),r=v.useRef(null),o=ut(t,r);return v.useEffect(()=>{const s=r.current;if(s)return py(s)},[]),i.jsx(Fy,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ce(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),eV=v.forwardRef((e,t)=>{const n=Na(mr,e.__scopeMenu);return i.jsx(Fy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Fy=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:f,onDismiss:h,disableOutsideScroll:g,...m}=e,w=Na(mr,n),x=fu(mr,n),y=Ep(n),b=GT(n),C=Wz(n),[j,S]=v.useState(null),k=v.useRef(null),E=ut(t,k,w.onContentChange),O=v.useRef(0),F=v.useRef(""),Z=v.useRef(0),I=v.useRef(null),q=v.useRef("right"),H=v.useRef(0),J=g?up:v.Fragment,ne=g?{as:Do,allowPinchZoom:!0}:void 0,K=L=>{var W,we;const ee=F.current+L,fe=C().filter(Re=>!Re.disabled),B=document.activeElement,te=(W=fe.find(Re=>Re.ref.current===B))==null?void 0:W.textValue,X=fe.map(Re=>Re.textValue),ie=fV(X,ee,te),re=(we=fe.find(Re=>Re.textValue===ie))==null?void 0:we.ref.current;(function Re(Fe){F.current=Fe,window.clearTimeout(O.current),Fe!==""&&(O.current=window.setTimeout(()=>Re(""),1e3))})(ee),re&&setTimeout(()=>re.focus())};v.useEffect(()=>()=>window.clearTimeout(O.current),[]),fy();const z=v.useCallback(L=>{var fe,B;return q.current===((fe=I.current)==null?void 0:fe.side)&&hV(L,(B=I.current)==null?void 0:B.area)},[]);return i.jsx(Xz,{scope:n,searchRef:F,onItemEnter:v.useCallback(L=>{z(L)&&L.preventDefault()},[z]),onItemLeave:v.useCallback(L=>{var ee;z(L)||((ee=k.current)==null||ee.focus(),S(null))},[z]),onTriggerLeave:v.useCallback(L=>{z(L)&&L.preventDefault()},[z]),pointerGraceTimerRef:Z,onPointerGraceIntentChange:v.useCallback(L=>{I.current=L},[]),children:i.jsx(J,{...ne,children:i.jsx(ip,{asChild:!0,trapped:o,onMountAutoFocus:Ce(s,L=>{var ee;L.preventDefault(),(ee=k.current)==null||ee.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:i.jsx(ap,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:f,onDismiss:h,children:i.jsx(VT,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:S,onEntryFocus:Ce(c,L=>{x.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(DE,{role:"menu","aria-orientation":"vertical","data-state":dk(w.open),"data-radix-menu-content":"",dir:x.dir,...y,...m,ref:E,style:{outline:"none",...m.style},onKeyDown:Ce(m.onKeyDown,L=>{const fe=L.target.closest("[data-radix-menu-content]")===L.currentTarget,B=L.ctrlKey||L.altKey||L.metaKey,te=L.key.length===1;fe&&(L.key==="Tab"&&L.preventDefault(),!B&&te&&K(L.key));const X=k.current;if(L.target!==X||!Bz.includes(L.key))return;L.preventDefault();const re=C().filter(W=>!W.disabled).map(W=>W.ref.current);BT.includes(L.key)&&re.reverse(),uV(re)}),onBlur:Ce(e.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(O.current),F.current="")}),onPointerMove:Ce(e.onPointerMove,Gc(L=>{const ee=L.target,fe=H.current!==L.clientX;if(L.currentTarget.contains(ee)&&fe){const B=L.clientX>H.current?"right":"left";q.current=B,H.current=L.clientX}}))})})})})})})});ZT.displayName=mr;var tV="MenuGroup",Ly=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Ve.div,{role:"group",...r,ref:t})});Ly.displayName=tV;var nV="MenuLabel",JT=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Ve.div,{...r,ref:t})});JT.displayName=nV;var Cf="MenuItem",Z0="menu.itemSelect",Tp=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=v.useRef(null),a=fu(Cf,e.__scopeMenu),l=Ay(Cf,e.__scopeMenu),c=ut(t,s),u=v.useRef(!1),d=()=>{const p=s.current;if(!n&&p){const f=new CustomEvent(Z0,{bubbles:!0,cancelable:!0});p.addEventListener(Z0,h=>r==null?void 0:r(h),{once:!0}),k_(p,f),f.defaultPrevented?u.current=!1:a.onClose()}};return i.jsx(YT,{...o,ref:c,disabled:n,onClick:Ce(e.onClick,d),onPointerDown:p=>{var f;(f=e.onPointerDown)==null||f.call(e,p),u.current=!0},onPointerUp:Ce(e.onPointerUp,p=>{var f;u.current||(f=p.currentTarget)==null||f.click()}),onKeyDown:Ce(e.onKeyDown,p=>{const f=l.searchRef.current!=="";n||f&&p.key===" "||km.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Tp.displayName=Cf;var YT=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,a=Ay(Cf,n),l=GT(n),c=v.useRef(null),u=ut(t,c),[d,p]=v.useState(!1),[f,h]=v.useState("");return v.useEffect(()=>{const g=c.current;g&&h((g.textContent??"").trim())},[s.children]),i.jsx(Hc.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:i.jsx(UT,{asChild:!0,...l,focusable:!r,children:i.jsx(Ve.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:Ce(e.onPointerMove,Gc(g=>{r?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ce(e.onPointerLeave,Gc(g=>a.onItemLeave(g))),onFocus:Ce(e.onFocus,()=>p(!0)),onBlur:Ce(e.onBlur,()=>p(!1))})})})}),rV="MenuCheckboxItem",XT=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return i.jsx(rk,{scope:e.__scopeMenu,checked:n,children:i.jsx(Tp,{role:"menuitemcheckbox","aria-checked":jf(n)?"mixed":n,...o,ref:t,"data-state":zy(n),onSelect:Ce(o.onSelect,()=>r==null?void 0:r(jf(n)?!0:!n),{checkForDefaultPrevented:!1})})})});XT.displayName=rV;var QT="MenuRadioGroup",[oV,sV]=ka(QT,{value:void 0,onValueChange:()=>{}}),ek=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=xr(r);return i.jsx(oV,{scope:e.__scopeMenu,value:n,onValueChange:s,children:i.jsx(Ly,{...o,ref:t})})});ek.displayName=QT;var tk="MenuRadioItem",nk=v.forwardRef((e,t)=>{const{value:n,...r}=e,o=sV(tk,e.__scopeMenu),s=n===o.value;return i.jsx(rk,{scope:e.__scopeMenu,checked:s,children:i.jsx(Tp,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":zy(s),onSelect:Ce(r.onSelect,()=>{var a;return(a=o.onValueChange)==null?void 0:a.call(o,n)},{checkForDefaultPrevented:!1})})})});nk.displayName=tk;var $y="MenuItemIndicator",[rk,aV]=ka($y,{checked:!1}),ok=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=aV($y,n);return i.jsx(co,{present:r||jf(s.checked)||s.checked===!0,children:i.jsx(Ve.span,{...o,ref:t,"data-state":zy(s.checked)})})});ok.displayName=$y;var iV="MenuSeparator",sk=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Ve.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});sk.displayName=iV;var lV="MenuArrow",ak=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ep(n);return i.jsx(OE,{...o,...r,ref:t})});ak.displayName=lV;var cV="MenuSub",[WK,ik]=ka(cV),Fl="MenuSubTrigger",lk=v.forwardRef((e,t)=>{const n=Na(Fl,e.__scopeMenu),r=fu(Fl,e.__scopeMenu),o=ik(Fl,e.__scopeMenu),s=Ay(Fl,e.__scopeMenu),a=v.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const p=l.current;return()=>{window.clearTimeout(p),c(null)}},[l,c]),i.jsx(Oy,{asChild:!0,...u,children:i.jsx(YT,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":dk(n.open),...e,ref:tp(t,o.onTriggerChange),onClick:p=>{var f;(f=e.onClick)==null||f.call(e,p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ce(e.onPointerMove,Gc(p=>{s.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Ce(e.onPointerLeave,Gc(p=>{var h,g;d();const f=(h=n.content)==null?void 0:h.getBoundingClientRect();if(f){const m=(g=n.content)==null?void 0:g.dataset.side,w=m==="right",x=w?-5:5,y=f[w?"left":"right"],b=f[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:p.clientX+x,y:p.clientY},{x:y,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:y,y:f.bottom}],side:m}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(p),p.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ce(e.onKeyDown,p=>{var h;const f=s.searchRef.current!=="";e.disabled||f&&p.key===" "||Hz[r.dir].includes(p.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),p.preventDefault())})})})});lk.displayName=Fl;var ck="MenuSubContent",uk=v.forwardRef((e,t)=>{const n=KT(mr,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Na(mr,e.__scopeMenu),a=fu(mr,e.__scopeMenu),l=ik(ck,e.__scopeMenu),c=v.useRef(null),u=ut(t,c);return i.jsx(Hc.Provider,{scope:e.__scopeMenu,children:i.jsx(co,{present:r||s.open,children:i.jsx(Hc.Slot,{scope:e.__scopeMenu,children:i.jsx(Fy,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var p;a.isUsingKeyboardRef.current&&((p=c.current)==null||p.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Ce(e.onFocusOutside,d=>{d.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ce(e.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:Ce(e.onKeyDown,d=>{var h;const p=d.currentTarget.contains(d.target),f=Gz[a.dir].includes(d.key);p&&f&&(s.onOpenChange(!1),(h=l.trigger)==null||h.focus(),d.preventDefault())})})})})})});uk.displayName=ck;function dk(e){return e?"open":"closed"}function jf(e){return e==="indeterminate"}function zy(e){return jf(e)?"indeterminate":e?"checked":"unchecked"}function uV(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function dV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function fV(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=dV(e,Math.max(s,0));o.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function pV(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,a=t.length-1;sr!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(o=!o)}return o}function hV(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return pV(n,t)}function Gc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var gV=WT,mV=Oy,vV=qT,yV=ZT,xV=Ly,wV=JT,bV=Tp,SV=XT,CV=ek,jV=nk,_V=ok,EV=sk,TV=ak,kV=lk,NV=uk,Vy="DropdownMenu",[RV,KK]=lo(Vy,[HT]),Mn=HT(),[PV,fk]=RV(Vy),Uy=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:a,modal:l=!0}=e,c=Mn(t),u=v.useRef(null),[d=!1,p]=js({prop:o,defaultProp:s,onChange:a});return i.jsx(PV,{scope:t,triggerId:Ir(),triggerRef:u,contentId:Ir(),open:d,onOpenChange:p,onOpenToggle:v.useCallback(()=>p(f=>!f),[p]),modal:l,children:i.jsx(gV,{...c,open:d,onOpenChange:p,dir:r,modal:l,children:n})})};Uy.displayName=Vy;var pk="DropdownMenuTrigger",By=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=fk(pk,n),a=Mn(n);return i.jsx(mV,{asChild:!0,...a,children:i.jsx(Ve.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:tp(t,s.triggerRef),onPointerDown:Ce(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(s.onOpenToggle(),s.open||l.preventDefault())}),onKeyDown:Ce(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&s.onOpenToggle(),l.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});By.displayName=pk;var IV="DropdownMenuPortal",hk=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Mn(t);return i.jsx(vV,{...r,...n})};hk.displayName=IV;var gk="DropdownMenuContent",mk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fk(gk,n),s=Mn(n),a=v.useRef(!1);return i.jsx(yV,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:Ce(e.onCloseAutoFocus,l=>{var c;a.current||(c=o.triggerRef.current)==null||c.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:Ce(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!o.modal||d)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mk.displayName=gk;var DV="DropdownMenuGroup",OV=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(xV,{...o,...r,ref:t})});OV.displayName=DV;var MV="DropdownMenuLabel",vk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(wV,{...o,...r,ref:t})});vk.displayName=MV;var AV="DropdownMenuItem",yk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(bV,{...o,...r,ref:t})});yk.displayName=AV;var FV="DropdownMenuCheckboxItem",xk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(SV,{...o,...r,ref:t})});xk.displayName=FV;var LV="DropdownMenuRadioGroup",$V=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(CV,{...o,...r,ref:t})});$V.displayName=LV;var zV="DropdownMenuRadioItem",wk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(jV,{...o,...r,ref:t})});wk.displayName=zV;var VV="DropdownMenuItemIndicator",bk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(_V,{...o,...r,ref:t})});bk.displayName=VV;var UV="DropdownMenuSeparator",Sk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(EV,{...o,...r,ref:t})});Sk.displayName=UV;var BV="DropdownMenuArrow",HV=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(TV,{...o,...r,ref:t})});HV.displayName=BV;var GV="DropdownMenuSubTrigger",Ck=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(kV,{...o,...r,ref:t})});Ck.displayName=GV;var WV="DropdownMenuSubContent",jk=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Mn(n);return i.jsx(NV,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});jk.displayName=WV;var KV=Uy,qV=By,ZV=hk,_k=mk,Ek=vk,Tk=yk,kk=xk,Nk=wk,Rk=bk,Ho=Sk,Pk=Ck,Ik=jk;const kp=KV,Np=qV,JV=v.forwardRef(({className:e,inset:t,children:n,...r},o)=>i.jsxs(Pk,{ref:o,className:Ne("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,i.jsx(tA,{className:"ml-auto h-4 w-4"})]}));JV.displayName=Pk.displayName;const YV=v.forwardRef(({className:e,...t},n)=>i.jsx(Ik,{ref:n,className:Ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));YV.displayName=Ik.displayName;const qi=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>i.jsx(ZV,{children:i.jsx(_k,{ref:r,sideOffset:t,className:Ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));qi.displayName=_k.displayName;const xn=v.forwardRef(({className:e,inset:t,...n},r)=>i.jsx(Tk,{ref:r,className:Ne("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));xn.displayName=Tk.displayName;const XV=v.forwardRef(({className:e,children:t,checked:n,...r},o)=>i.jsxs(kk,{ref:o,className:Ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(Rk,{children:i.jsx(ai,{className:"h-4 w-4"})})}),t]}));XV.displayName=kk.displayName;const QV=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(Nk,{ref:r,className:Ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(Rk,{children:i.jsx(aA,{className:"h-2 w-2 fill-current"})})}),t]}));QV.displayName=Nk.displayName;const pu=v.forwardRef(({className:e,inset:t,...n},r)=>i.jsx(Ek,{ref:r,className:Ne("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));pu.displayName=Ek.displayName;const Zi=v.forwardRef(({className:e,...t},n)=>i.jsx(Ho,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",e),...t}));Zi.displayName=Ho.displayName;const ko=v.forwardRef(({className:e,...t},n)=>i.jsx("textarea",{className:Ne("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));ko.displayName="Textarea";const Hy=new zr,e3=async e=>(await Hy.getInstance().post(`/chat/findChats/${e}`,{where:{}})).data,t3=async(e,t)=>(await Hy.getInstance().post(`/chat/findChats/${e}`,{where:{remoteJid:t}},{headers:{"Content-Type":"application/json"}})).data,n3=async(e,t)=>(await Hy.getInstance().post(`/chat/findMessages/${e}`,{where:{key:{remoteJid:t}}})).data;function r3({textareaRef:e,handleTextareaChange:t,textareaHeight:n,lastMessageRef:r,scrollToBottom:o}){const{instance:s}=Tt(),[a,l]=v.useState(null),[c,u]=v.useState([]),{remoteJid:d}=Ta();v.useEffect(()=>{const h=async(m,w)=>{try{const x=await t3(m,w);l(x[0])}catch(x){console.error("Erro ao buscar dados:",x)}},g=async(m,w)=>{try{const x=await n3(m,w);u(x.messages.records),o()}catch(x){console.error("Erro ao buscar dados:",x)}};s&&d&&(h(s.name,d),g(s.name,d))},[d,s,o]);const p=h=>i.jsx("div",{className:"bubble-right",children:i.jsx("div",{className:"flex items-start gap-4 self-end",children:i.jsx("div",{className:"grid gap-1",children:i.jsx("div",{className:"prose text-muted-foreground",children:i.jsx("div",{className:"bubble",children:JSON.stringify(h.message)})})})})}),f=h=>i.jsx("div",{className:"bubble-left",children:i.jsx("div",{className:"flex items-start gap-4",children:i.jsx("div",{className:"grid gap-1",children:i.jsx("div",{className:"prose text-muted-foreground",children:i.jsx("div",{className:"bubble",children:JSON.stringify(h.message)})})})})});return i.jsxs("div",{className:"min-h-screen flex flex-col",children:[i.jsx("div",{className:"sticky top-0 p-2",children:i.jsxs(Uy,{children:[i.jsx(By,{asChild:!0,children:i.jsxs(Te,{variant:"ghost",className:"gap-1 rounded-xl px-3 h-10 data-[state=open]:bg-muted text-lg",children:[(a==null?void 0:a.pushName)||(a==null?void 0:a.remoteJid.split("@")[0]),i.jsx(Qf,{className:"w-4 h-4 text-muted-foreground"})]})}),i.jsxs(qi,{align:"start",className:"max-w-[300px]",children:[i.jsxs(xn,{className:"items-start gap-2",children:[i.jsx(hA,{className:"w-4 h-4 mr-2 translate-y-1 shrink-0"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium",children:"GPT-4"}),i.jsx("div",{className:"text-muted-foreground/80",children:"With DALL-E, browsing and analysis. Limit 40 messages / 3 hours"})]})]}),i.jsx(Zi,{}),i.jsxs(xn,{className:"items-start gap-2",children:[i.jsx(mA,{className:"w-4 h-4 mr-2 translate-y-1 shrink-0"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium",children:"GPT-3"}),i.jsx("div",{className:"text-muted-foreground/80",children:"Great for everyday tasks"})]})]})]})]})}),i.jsxs("div",{className:"flex flex-col flex-1 max-w-4xl gap-8 px-4 mx-auto message-container overflow-y-auto",children:[c.map(h=>h.key.fromMe?p(h):f(h)),i.jsx("div",{ref:r})]}),i.jsx("div",{className:"max-w-2xl w-full sticky bottom-0 mx-auto py-2 flex flex-col gap-1.5 px-4 bg-background",children:i.jsxs("div",{className:"relative input-message",children:[i.jsxs(Te,{type:"button",size:"icon",className:"absolute w-8 h-8 bottom-3 left-3 rounded-full bg-transparent text-white hover:bg-transparent",children:[i.jsx(pA,{className:"w-4 h-4 text-white"}),i.jsx("span",{className:"sr-only",children:"Anexar"})]}),i.jsx(ko,{placeholder:"Enviar mensagem...",name:"message",id:"message",rows:1,ref:e,onChange:t,style:{height:n},className:"min-h-[48px] max-h-[240px] rounded-3xl resize-none p-4 pl-12 pr-16 border border-none shadow-sm"}),i.jsxs(Te,{type:"submit",size:"icon",className:"absolute w-8 h-8 bottom-3 right-3 rounded-full",children:[i.jsx(eA,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Enviar"})]})]})})]})}var Gy="Tabs",[o3,qK]=lo(Gy,[_p]),Dk=_p(),[s3,Wy]=o3(Gy),Ok=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:a="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=hp(l),[p,f]=js({prop:r,onChange:o,defaultProp:s});return i.jsx(s3,{scope:n,baseId:Ir(),value:p,onValueChange:f,orientation:a,dir:d,activationMode:c,children:i.jsx(Ve.div,{dir:d,"data-orientation":a,...u,ref:t})})});Ok.displayName=Gy;var Mk="TabsList",Ak=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=Wy(Mk,n),a=Dk(n);return i.jsx(VT,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:r,children:i.jsx(Ve.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Ak.displayName=Mk;var Fk="TabsTrigger",Lk=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,a=Wy(Fk,n),l=Dk(n),c=Vk(a.baseId,r),u=Uk(a.baseId,r),d=r===a.value;return i.jsx(UT,{asChild:!0,...l,focusable:!o,active:d,children:i.jsx(Ve.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:Ce(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?a.onValueChange(r):p.preventDefault()}),onKeyDown:Ce(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&a.onValueChange(r)}),onFocus:Ce(e.onFocus,()=>{const p=a.activationMode!=="manual";!d&&!o&&p&&a.onValueChange(r)})})})});Lk.displayName=Fk;var $k="TabsContent",zk=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...a}=e,l=Wy($k,n),c=Vk(l.baseId,r),u=Uk(l.baseId,r),d=r===l.value,p=v.useRef(d);return v.useEffect(()=>{const f=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(f)},[]),i.jsx(co,{present:o||d,children:({present:f})=>i.jsx(Ve.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:u,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:f&&s})})});zk.displayName=$k;function Vk(e,t){return`${e}-trigger-${t}`}function Uk(e,t){return`${e}-content-${t}`}var a3=Ok,Bk=Ak,Hk=Lk,Gk=zk;const i3=a3,Wk=v.forwardRef(({className:e,...t},n)=>i.jsx(Bk,{ref:n,className:Ne("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Wk.displayName=Bk.displayName;const Nm=v.forwardRef(({className:e,...t},n)=>i.jsx(Hk,{ref:n,className:Ne("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Nm.displayName=Hk.displayName;const Rm=v.forwardRef(({className:e,...t},n)=>i.jsx(Gk,{ref:n,className:Ne("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Rm.displayName=Gk.displayName;function J0(){const e=v.useRef(null),[t]=v.useState("auto"),n=v.useRef(null),[r,o]=v.useState([]),{instance:s}=Tt(),{instanceId:a,remoteJid:l}=Ta(),c=ir(),u=()=>{e.current&&e.current.scrollIntoView({})},d=()=>{if(n.current){n.current.style.height="auto";const f=n.current.scrollHeight,g=parseInt(getComputedStyle(n.current).lineHeight)*10;n.current.style.height=`${Math.min(f,g)}px`}};v.useEffect(()=>{s&&(async h=>{try{const g=await e3(h);o(g)}catch(g){console.error("Erro ao buscar dados:",g)}})(s.name),u()},[s]);const p=f=>{c(`/manager/instance/${a}/chat/${f}`)};return i.jsxs(su,{direction:"horizontal",children:[i.jsx(ro,{defaultSize:20,children:i.jsxs("div",{className:"flex-col hidden gap-2 text-foreground bg-background md:flex",children:[i.jsx("div",{className:"sticky top-0 p-2",children:i.jsxs(Te,{variant:"ghost",className:"justify-start w-full gap-2 px-2 text-left",children:[i.jsx("div",{className:"flex items-center justify-center rounded-full w-7 h-7",children:i.jsx(ey,{className:"w-4 h-4"})}),i.jsx("div",{className:"overflow-hidden text-sm grow text-ellipsis whitespace-nowrap",children:"Chat"}),i.jsx(ou,{className:"w-4 h-4"})]})}),i.jsxs(i3,{defaultValue:"contacts",children:[i.jsxs(Wk,{className:"tabs-chat",children:[i.jsx(Nm,{value:"contacts",children:"Contatos"}),i.jsx(Nm,{value:"groups",children:"Grupos"})]}),i.jsx(Rm,{value:"contacts",children:i.jsx("div",{className:"flex-1 overflow-auto",children:i.jsxs("div",{className:"grid gap-1 p-2 text-foreground",children:[i.jsx("div",{className:"px-2 text-xs font-medium text-muted-foreground",children:"Contatos"}),r.map(f=>f.remoteJid.includes("@s.whatsapp.net")&&i.jsxs(Lw,{to:"#",onClick:()=>p(f.remoteJid),className:`flex items-center block p-2 overflow-hidden text-sm truncate transition-colors rounded-md whitespace-nowrap hover:bg-muted/50 chat-item border-b border-gray-600/50 ${l===f.remoteJid?"active":""}`,children:[i.jsx("span",{className:"chat-avatar mr-2",children:i.jsx("img",{src:f.profilePicUrl||"https://via.placeholder.com/150",alt:"Avatar",className:"w-8 h-8 rounded-full"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("span",{className:"chat-title block font-medium",children:f.pushName}),i.jsx("span",{className:"chat-description block text-xs text-gray-500",children:f.remoteJid.split("@")[0]})]})]}))]})})}),i.jsx(Rm,{value:"groups",children:i.jsx("div",{className:"flex-1 overflow-auto",children:i.jsx("div",{className:"grid gap-1 p-2 text-foreground",children:r.map(f=>f.remoteJid.includes("@g.us")&&i.jsxs(Lw,{to:"#",onClick:()=>p(f.remoteJid),className:`flex items-center block p-2 overflow-hidden text-sm truncate transition-colors rounded-md whitespace-nowrap hover:bg-muted/50 chat-item border-b border-gray-600/50 ${l===f.remoteJid?"active":""}`,children:[i.jsx("span",{className:"chat-avatar mr-2",children:i.jsx("img",{src:f.profilePicUrl||"https://via.placeholder.com/150",alt:"Avatar",className:"w-8 h-8 rounded-full"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("span",{className:"chat-title block font-medium",children:f.pushName}),i.jsx("span",{className:"chat-description block text-xs text-gray-500",children:f.remoteJid})]})]}))})})})]})]})}),i.jsx(au,{withHandle:!0,className:"border border-black"}),i.jsx(ro,{children:l&&i.jsx(r3,{textareaRef:n,handleTextareaChange:d,textareaHeight:t,lastMessageRef:e,scrollToBottom:u})})]})}var Ky="Switch",[l3,ZK]=lo(Ky),[c3,u3]=l3(Ky),Kk=v.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:s,required:a,disabled:l,value:c="on",onCheckedChange:u,...d}=e,[p,f]=v.useState(null),h=ut(t,y=>f(y)),g=v.useRef(!1),m=p?!!p.closest("form"):!0,[w=!1,x]=js({prop:o,defaultProp:s,onChange:u});return i.jsxs(c3,{scope:n,checked:w,disabled:l,children:[i.jsx(Ve.button,{type:"button",role:"switch","aria-checked":w,"aria-required":a,"data-state":Jk(w),"data-disabled":l?"":void 0,disabled:l,value:c,...d,ref:h,onClick:Ce(e.onClick,y=>{x(b=>!b),m&&(g.current=y.isPropagationStopped(),g.current||y.stopPropagation())})}),m&&i.jsx(d3,{control:p,bubbles:!g.current,name:r,value:c,checked:w,required:a,disabled:l,style:{transform:"translateX(-100%)"}})]})});Kk.displayName=Ky;var qk="SwitchThumb",Zk=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=u3(qk,n);return i.jsx(Ve.span,{"data-state":Jk(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});Zk.displayName=qk;var d3=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,s=v.useRef(null),a=ME(n),l=bE(t);return v.useEffect(()=>{const c=s.current,u=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(u,"checked").set;if(a!==n&&p){const f=new Event("click",{bubbles:r});p.call(c,n),c.dispatchEvent(f)}},[a,n,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Jk(e){return e?"checked":"unchecked"}var Yk=Kk,f3=Zk;const je=v.forwardRef(({className:e,...t},n)=>i.jsx(Yk,{className:Ne("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-slate-400",e),...t,ref:n,children:i.jsx(f3,{className:Ne("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));je.displayName=Yk.displayName;const Xk=new zr,p3=async(e,t)=>(await Xk.getInstance().get(`/chatwoot/find/${e}`,{headers:{apikey:t}})).data,h3=async(e,t,n)=>(await Xk.getInstance().post(`/chatwoot/set/${e}`,n,{headers:{apikey:t}})).data,g3=T.object({enabled:T.boolean(),accountId:T.string(),token:T.string(),url:T.string(),signMsg:T.boolean(),signDelimiter:T.string(),nameInbox:T.string(),organization:T.string(),logo:T.string(),reopenConversation:T.boolean(),conversationPending:T.boolean(),mergeBrazilContacts:T.boolean(),importContacts:T.boolean(),importMessages:T.boolean(),daysLimitImportMessages:T.string(),autoCreate:T.boolean()});function m3(){const{instance:e}=Tt(),[,t]=v.useState(!1),n=tn({resolver:nn(g3),defaultValues:{enabled:!0,accountId:"",token:"",url:"",signMsg:!0,signDelimiter:"\\n",nameInbox:"",organization:"",logo:"",reopenConversation:!0,conversationPending:!1,mergeBrazilContacts:!0,importContacts:!1,importMessages:!1,daysLimitImportMessages:"7",autoCreate:!0}});v.useEffect(()=>{(async()=>{if(e){t(!0);try{const s=await p3(e.name,e.token);n.reset(s)}catch(s){console.error("Erro ao buscar dados do chatwoot:",s)}finally{t(!1)}}})()},[e,n]);const r=async()=>{var s,a,l;if(!e)return;const o=n.getValues();t(!0);try{const c={enabled:o.enabled,accountId:o.accountId,token:o.token,url:o.url,signMsg:o.signMsg,signDelimiter:o.signDelimiter,nameInbox:o.nameInbox,organization:o.organization,logo:o.logo,reopenConversation:o.reopenConversation,conversationPending:o.conversationPending,mergeBrazilContacts:o.mergeBrazilContacts,importContacts:o.importContacts,importMessages:o.importMessages,daysLimitImportMessages:parseInt(o.daysLimitImportMessages,10),autoCreate:o.autoCreate};await h3(e.name,e.token,c),De.success("Chatwoot criado com sucesso")}catch(c){console.error("Erro ao criar chatwoot:",c),De.error(`Erro ao criar : ${(l=(a=(s=c==null?void 0:c.response)==null?void 0:s.data)==null?void 0:a.response)==null?void 0:l.message}`)}finally{t(!1)}};return i.jsx("main",{className:"main-content",children:i.jsx("div",{className:"form-container",children:i.jsx(uo,{...n,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Chatwoot"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:n.control,name:"enabled",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o chatwoot"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"url",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"URL do chatwoot"})}),i.jsx(P,{control:n.control,name:"accountId",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"ID da Conta"})}),i.jsx(P,{control:n.control,name:"token",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"Token da Conta",type:"password"})}),i.jsx(P,{control:n.control,name:"signMsg",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Assinar Mensagem"}),i.jsx($t,{children:"Assina mensagem com o nome do usuário do chatwoot"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"signDelimiter",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"Delimitador de Assinatura"})}),i.jsx(P,{control:n.control,name:"nameInbox",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"Nome da Caixa de Entrada"})}),i.jsx(P,{control:n.control,name:"organization",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"Nome da organização"})}),i.jsx(P,{control:n.control,name:"logo",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"URL do logo"})}),i.jsx(P,{control:n.control,name:"conversationPending",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Conversas Pendentes"}),i.jsx($t,{children:"Conversas iniciam como pendentes"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"reopenConversation",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Reabrir Conversa"}),i.jsx($t,{children:"Reabre conversa ao receber mensagem"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"importContacts",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Importar Contatos"}),i.jsx($t,{children:"Importa contatos da agenda do whatsapp ao conectar o qrcode"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"importMessages",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Importar Mensagens"}),i.jsx($t,{children:"Importa conversas e mensagens do whatsapp ao conectar o qrcode"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})}),i.jsx(P,{control:n.control,name:"daysLimitImportMessages",render:({field:o})=>i.jsx(se,{...o,className:"border border-gray-600 w-full",placeholder:"Limite de Dias para Importar Mensagens",type:"number"})}),i.jsx(P,{control:n.control,name:"autoCreate",render:({field:o})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Criar Automaticamente"}),i.jsx($t,{children:"Cria automaticamente integração com chatwoot ao Salvar"})]}),i.jsx(ae,{children:i.jsx(je,{checked:o.value,onCheckedChange:o.onChange})})]})})]})]}),i.jsx(Te,{type:"button",onClick:r,children:"Salvar"})]})})})})}const Fo=({size:e=45,className:t,...n})=>i.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,...n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Ne("animate-spin",t),children:i.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}),Y0=e=>{switch(e){case"open":return"status-connected";case"close":return"status-disconnected";case"connecting":return"status-connecting";default:return"status-disconnected"}},v3=e=>{switch(e){case"open":return"Conectado";case"close":return"Desconectado";case"connecting":return"Conectando";default:return"Desconectado"}};function y3(){var f,h,g;const[e,t]=v.useState(""),[n,r]=v.useState(""),o=localStorage.getItem("token"),[s,a]=v.useState([]),{instance:l}=Tt(),c=async m=>{try{await WM(m),window.location.reload()}catch(w){console.error("Erro ao reiniciar:",w)}},u=async m=>{try{await w_(m),window.location.reload()}catch(w){console.error("Erro ao desconectar:",w)}},d=async(m,w)=>{try{if(t(""),!o){console.error("Token não encontrado.");return}if(w){const x=await e0(m,o,l==null?void 0:l.number);r(x.pairingCode)}else{const x=await e0(m,o);t(x.base64)}}catch(x){console.error("Erro ao conectar:",x)}},p=()=>{t(""),r(""),window.location.reload()};return l?i.jsxs(i.Fragment,{children:[i.jsx("main",{className:"dashboard-instance",children:i.jsxs("div",{className:"dashboard-card",children:[i.jsxs("div",{className:"dashboard-info",children:[i.jsxs("div",{className:`dashboard-status ${Y0(l.connectionStatus)}`,children:[i.jsx("i",{className:`status-icon ${Y0(l.connectionStatus)}`}),i.jsx("span",{className:"status-text",children:v3(l.connectionStatus)})]}),i.jsx("div",{className:"dashboard-name",children:l.name}),i.jsx("div",{className:"dashboard-description",children:l.ownerJid}),i.jsxs("div",{className:"card-id",children:[i.jsx("span",{children:s.includes(l.token)?l.token.substring(0,32)+"...":l.token.substring(0,32).split("").map(()=>"*").join("")}),i.jsx(S_,{className:"card-icon",size:"15",onClick:()=>{MT(l.token)}}),s.includes(l.token)?i.jsx(C_,{className:"card-icon",size:"15",onClick:()=>{a(s.filter(m=>m!==l.token))}}):i.jsx(j_,{className:"card-icon",size:"15",onClick:()=>{a([...s,l.token])}})]}),l.connectionStatus!=="open"&&i.jsxs("div",{className:"connection-warning",children:[i.jsx("span",{children:"Telefone não conectado"}),i.jsxs(Sn,{children:[i.jsx(Cn,{className:"connect-button",onClick:()=>d(l.name,!1),children:"Gerar QRCODE"}),i.jsx(un,{onCloseAutoFocus:p,children:i.jsx(dn,{children:i.jsx(Pi,{children:e?i.jsx("img",{src:e,alt:"QR Code",width:"500"}):i.jsx("img",{src:"/assets/images/evolution-logo.png",alt:"Carregando...",width:"500"})})})})]}),l.number&&i.jsxs(Sn,{children:[i.jsx(Cn,{className:"connect-code-button",onClick:()=>d(l.name,!0),children:"Solicitar Código"}),i.jsx(un,{onCloseAutoFocus:p,children:i.jsx(dn,{children:i.jsx(Pi,{children:n?i.jsxs("div",{className:"py-3",children:[i.jsx("p",{className:"text-center",children:i.jsx("strong",{children:"Código de emparelhamento:"})}),i.jsxs("p",{className:"text-center pairing-code",children:[n.substring(0,4),"-",n.substring(4,8)]})]}):i.jsx(Fo,{})})})})]})]})]}),i.jsxs("div",{className:"dashboard-actions",children:[i.jsx(Te,{variant:"outline",className:"refresh-button",children:i.jsx(__,{onClick:window.location.reload,size:"20"})}),i.jsx(Te,{className:"action-button",onClick:()=>c(l.name),children:"REINICIAR"}),i.jsx(Te,{className:`action-button ${l.connectionStatus==="close"?"disabled":""}`,onClick:()=>u(l.name),disabled:l.connectionStatus==="close",children:"DESCONECTAR"})]})]},l.id)}),i.jsxs("main",{className:"instance-cards",children:[i.jsxs(mi,{className:"instance-card",children:[i.jsx(ql,{children:i.jsx(Zl,{children:"Contatos"})}),i.jsx(Jl,{children:((f=l==null?void 0:l._count)==null?void 0:f.Contact)||0})]}),i.jsxs(mi,{className:"instance-card",children:[i.jsx(ql,{children:i.jsx(Zl,{children:"Chats"})}),i.jsx(Jl,{children:((h=l==null?void 0:l._count)==null?void 0:h.Chat)||0})]}),i.jsxs(mi,{className:"instance-card",children:[i.jsx(ql,{children:i.jsx(Zl,{children:"Mensagens"})}),i.jsx(Jl,{children:((g=l==null?void 0:l._count)==null?void 0:g.Message)||0})]})]})]}):i.jsx(Fo,{})}var x3="Separator",X0="horizontal",w3=["horizontal","vertical"],Qk=v.forwardRef((e,t)=>{const{decorative:n,orientation:r=X0,...o}=e,s=b3(r)?r:X0,l=n?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return i.jsx(Ve.div,{"data-orientation":s,...l,...o,ref:t})});Qk.displayName=x3;function b3(e){return w3.includes(e)}var eN=Qk;const Dt=v.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>i.jsx(eN,{ref:o,decorative:n,orientation:t,className:Ne("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Dt.displayName=eN.displayName;const br=new zr,tN=async(e,t)=>(await br.getInstance().get(`/openai/creds/${e}`,{headers:{apikey:t}})).data,S3=async(e,t,n)=>(await br.getInstance().post(`/openai/creds/${e}`,n,{headers:{apikey:t}})).data,C3=async(e,t)=>(await br.getInstance().delete(`/openai/creds/${e}/${t}`)).data,nN=async(e,t)=>(await br.getInstance().get(`/openai/find/${e}`,{headers:{apikey:t}})).data,j3=async(e,t,n)=>(await br.getInstance().get(`/openai/fetch/${n}/${e}`,{headers:{apikey:t}})).data,_3=async(e,t,n)=>(await br.getInstance().post(`/openai/create/${e}`,n,{headers:{apikey:t}})).data,E3=async(e,t,n,r)=>(await br.getInstance().put(`/openai/update/${n}/${e}`,r,{headers:{apikey:t}})).data,T3=async(e,t,n)=>(await br.getInstance().delete(`/openai/delete/${n}/${e}`,{headers:{apikey:t}})).data,k3=async(e,t)=>(await br.getInstance().get(`/openai/fetchSettings/${e}`,{headers:{apikey:t}})).data,N3=async(e,t,n)=>(await br.getInstance().post(`/openai/settings/${e}`,n,{headers:{apikey:t}})).data,R3=async(e,t,n)=>(await br.getInstance().get(`/openai/fetchSessions/${n}/${e}`,{headers:{apikey:t}})).data,P3=async(e,t,n,r)=>(await br.getInstance().post(`/openai/changeStatus/${e}`,{remoteJid:n,status:r},{headers:{apikey:t}})).data;/** * table-core * * Copyright (c) TanStack @@ -312,7 +312,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do */function ps(e,t){return typeof e=="function"?e(t):e}function or(e,t){return n=>{t.setState(r=>({...r,[e]:ps(n,r[e])}))}}function Rp(e){return e instanceof Function}function I3(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function D3(e,t){const n=[],r=o=>{o.forEach(s=>{n.push(s);const a=t(s);a!=null&&a.length&&r(a)})};return r(e),n}function Oe(e,t,n){let r=[],o;return s=>{let a;n.key&&n.debug&&(a=Date.now());const l=e(s);if(!(l.length!==r.length||l.some((d,p)=>r[p]!==d)))return o;r=l;let u;if(n.key&&n.debug&&(u=Date.now()),o=t(...l),n==null||n.onChange==null||n.onChange(o),n.key&&n.debug&&n!=null&&n.debug()){const d=Math.round((Date.now()-a)*100)/100,p=Math.round((Date.now()-u)*100)/100,f=p/16,h=(g,m)=>{for(g=String(g);g.length{var o;return(o=e==null?void 0:e.debugAll)!=null?o:e[t]},key:!1,onChange:r}}function O3(e,t,n,r){const o=()=>{var a;return(a=s.getValue())!=null?a:e.options.renderFallbackValue},s={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:o,getContext:Oe(()=>[e,n,t,s],(a,l,c,u)=>({table:a,column:l,row:c,cell:u,getValue:u.getValue,renderValue:u.renderValue}),Me(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(s,n,t,e)},{}),s}function M3(e,t,n,r){var o,s;const l={...e._getDefaultColumnDef(),...t},c=l.accessorKey;let u=(o=(s=l.id)!=null?s:c?c.replace(".","_"):void 0)!=null?o:typeof l.header=="string"?l.header:void 0,d;if(l.accessorFn?d=l.accessorFn:c&&(c.includes(".")?d=f=>{let h=f;for(const m of c.split(".")){var g;h=(g=h)==null?void 0:g[m]}return h}:d=f=>f[l.accessorKey]),!u)throw new Error;let p={id:`${String(u)}`,accessorFn:d,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:Oe(()=>[!0],()=>{var f;return[p,...(f=p.columns)==null?void 0:f.flatMap(h=>h.getFlatColumns())]},Me(e.options,"debugColumns")),getLeafColumns:Oe(()=>[e._getOrderColumnsFn()],f=>{var h;if((h=p.columns)!=null&&h.length){let g=p.columns.flatMap(m=>m.getLeafColumns());return f(g)}return[p]},Me(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(p,e);return p}const mn="debugHeaders";function Q0(e,t,n){var r;let s={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],l=c=>{c.subHeaders&&c.subHeaders.length&&c.subHeaders.map(l),a.push(c)};return l(s),a},getContext:()=>({table:e,header:s,column:t})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(s,e)}),s}const A3={createTable:e=>{e.getHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>{var s,a;const l=(s=r==null?void 0:r.map(p=>n.find(f=>f.id===p)).filter(Boolean))!=null?s:[],c=(a=o==null?void 0:o.map(p=>n.find(f=>f.id===p)).filter(Boolean))!=null?a:[],u=n.filter(p=>!(r!=null&&r.includes(p.id))&&!(o!=null&&o.includes(p.id)));return Ju(t,[...l,...u,...c],e)},Me(e.options,mn)),e.getCenterHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>(n=n.filter(s=>!(r!=null&&r.includes(s.id))&&!(o!=null&&o.includes(s.id))),Ju(t,n,e,"center")),Me(e.options,mn)),e.getLeftHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var o;const s=(o=r==null?void 0:r.map(a=>n.find(l=>l.id===a)).filter(Boolean))!=null?o:[];return Ju(t,s,e,"left")},Me(e.options,mn)),e.getRightHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var o;const s=(o=r==null?void 0:r.map(a=>n.find(l=>l.id===a)).filter(Boolean))!=null?o:[];return Ju(t,s,e,"right")},Me(e.options,mn)),e.getFooterGroups=Oe(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Me(e.options,mn)),e.getLeftFooterGroups=Oe(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Me(e.options,mn)),e.getCenterFooterGroups=Oe(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Me(e.options,mn)),e.getRightFooterGroups=Oe(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Me(e.options,mn)),e.getFlatHeaders=Oe(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,mn)),e.getLeftFlatHeaders=Oe(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,mn)),e.getCenterFlatHeaders=Oe(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,mn)),e.getRightFlatHeaders=Oe(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,mn)),e.getCenterLeafHeaders=Oe(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Me(e.options,mn)),e.getLeftLeafHeaders=Oe(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Me(e.options,mn)),e.getRightLeafHeaders=Oe(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Me(e.options,mn)),e.getLeafHeaders=Oe(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var o,s,a,l,c,u;return[...(o=(s=t[0])==null?void 0:s.headers)!=null?o:[],...(a=(l=n[0])==null?void 0:l.headers)!=null?a:[],...(c=(u=r[0])==null?void 0:u.headers)!=null?c:[]].map(d=>d.getLeafHeaders()).flat()},Me(e.options,mn))}};function Ju(e,t,n,r){var o,s;let a=0;const l=function(f,h){h===void 0&&(h=1),a=Math.max(a,h),f.filter(g=>g.getIsVisible()).forEach(g=>{var m;(m=g.columns)!=null&&m.length&&l(g.columns,h+1)},0)};l(e);let c=[];const u=(f,h)=>{const g={depth:h,id:[r,`${h}`].filter(Boolean).join("_"),headers:[]},m=[];f.forEach(w=>{const x=[...m].reverse()[0],y=w.column.depth===g.depth;let b,C=!1;if(y&&w.column.parent?b=w.column.parent:(b=w.column,C=!0),x&&(x==null?void 0:x.column)===b)x.subHeaders.push(w);else{const j=Q0(n,b,{id:[r,h,b.id,w==null?void 0:w.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${m.filter(S=>S.column===b).length}`:void 0,depth:h,index:m.length});j.subHeaders.push(w),m.push(j)}g.headers.push(w),w.headerGroup=g}),c.push(g),h>0&&u(m,h-1)},d=t.map((f,h)=>Q0(n,f,{depth:a,index:h}));u(d,a-1),c.reverse();const p=f=>f.filter(g=>g.column.getIsVisible()).map(g=>{let m=0,w=0,x=[0];g.subHeaders&&g.subHeaders.length?(x=[],p(g.subHeaders).forEach(b=>{let{colSpan:C,rowSpan:j}=b;m+=C,x.push(j)})):m=1;const y=Math.min(...x);return w=w+y,g.colSpan=m,g.rowSpan=w,{colSpan:m,rowSpan:w}});return p((o=(s=c[0])==null?void 0:s.headers)!=null?o:[]),c}const qy=(e,t,n,r,o,s,a)=>{let l={id:t,index:r,original:n,depth:o,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:c=>{if(l._valuesCache.hasOwnProperty(c))return l._valuesCache[c];const u=e.getColumn(c);if(u!=null&&u.accessorFn)return l._valuesCache[c]=u.accessorFn(l.original,r),l._valuesCache[c]},getUniqueValues:c=>{if(l._uniqueValuesCache.hasOwnProperty(c))return l._uniqueValuesCache[c];const u=e.getColumn(c);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(l._uniqueValuesCache[c]=u.columnDef.getUniqueValues(l.original,r),l._uniqueValuesCache[c]):(l._uniqueValuesCache[c]=[l.getValue(c)],l._uniqueValuesCache[c])},renderValue:c=>{var u;return(u=l.getValue(c))!=null?u:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>D3(l.subRows,c=>c.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let c=[],u=l;for(;;){const d=u.getParentRow();if(!d)break;c.push(d),u=d}return c.reverse()},getAllCells:Oe(()=>[e.getAllLeafColumns()],c=>c.map(u=>O3(e,l,u,u.id)),Me(e.options,"debugRows")),_getAllCellsByColumnId:Oe(()=>[l.getAllCells()],c=>c.reduce((u,d)=>(u[d.column.id]=d,u),{}),Me(e.options,"debugRows"))};for(let c=0;c{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},nN=(e,t,n)=>{var r;const o=n.toLowerCase();return!!(!((r=e.getValue(t))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(o))};nN.autoRemove=e=>Mr(e);const rN=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};rN.autoRemove=e=>Mr(e);const oN=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};oN.autoRemove=e=>Mr(e);const sN=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};sN.autoRemove=e=>Mr(e)||!(e!=null&&e.length);const aN=(e,t,n)=>!n.some(r=>{var o;return!((o=e.getValue(t))!=null&&o.includes(r))});aN.autoRemove=e=>Mr(e)||!(e!=null&&e.length);const iN=(e,t,n)=>n.some(r=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(r)});iN.autoRemove=e=>Mr(e)||!(e!=null&&e.length);const lN=(e,t,n)=>e.getValue(t)===n;lN.autoRemove=e=>Mr(e);const cN=(e,t,n)=>e.getValue(t)==n;cN.autoRemove=e=>Mr(e);const Zy=(e,t,n)=>{let[r,o]=n;const s=e.getValue(t);return s>=r&&s<=o};Zy.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,o=typeof n!="number"?parseFloat(n):n,s=t===null||Number.isNaN(r)?-1/0:r,a=n===null||Number.isNaN(o)?1/0:o;if(s>a){const l=s;s=a,a=l}return[s,a]};Zy.autoRemove=e=>Mr(e)||Mr(e[0])&&Mr(e[1]);const yo={includesString:nN,includesStringSensitive:rN,equalsString:oN,arrIncludes:sN,arrIncludesAll:aN,arrIncludesSome:iN,equals:lN,weakEquals:cN,inNumberRange:Zy};function Mr(e){return e==null||e===""}const L3={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:or("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?yo.includesString:typeof r=="number"?yo.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?yo.equals:Array.isArray(r)?yo.arrIncludes:yo.weakEquals},e.getFilterFn=()=>{var n,r;return Rp(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:yo[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,o;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const o=e.getFilterFn(),s=r==null?void 0:r.find(d=>d.id===e.id),a=ps(n,s?s.value:void 0);if(eb(o,a,e)){var l;return(l=r==null?void 0:r.filter(d=>d.id!==e.id))!=null?l:[]}const c={id:e.id,value:a};if(s){var u;return(u=r==null?void 0:r.map(d=>d.id===e.id?c:d))!=null?u:[]}return r!=null&&r.length?[...r,c]:[c]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=o=>{var s;return(s=ps(t,o))==null?void 0:s.filter(a=>{const l=n.find(c=>c.id===a.id);if(l){const c=l.getFilterFn();if(eb(c,a.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function eb(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const $3=(e,t,n)=>n.reduce((r,o)=>{const s=o.getValue(e);return r+(typeof s=="number"?s:0)},0),z3=(e,t,n)=>{let r;return n.forEach(o=>{const s=o.getValue(e);s!=null&&(r>s||r===void 0&&s>=s)&&(r=s)}),r},V3=(e,t,n)=>{let r;return n.forEach(o=>{const s=o.getValue(e);s!=null&&(r=s)&&(r=s)}),r},U3=(e,t,n)=>{let r,o;return n.forEach(s=>{const a=s.getValue(e);a!=null&&(r===void 0?a>=a&&(r=o=a):(r>a&&(r=a),o{let n=0,r=0;if(t.forEach(o=>{let s=o.getValue(e);s!=null&&(s=+s)>=s&&(++n,r+=s)}),n)return r/n},H3=(e,t)=>{if(!t.length)return;const n=t.map(s=>s.getValue(e));if(!I3(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),o=n.sort((s,a)=>s-a);return n.length%2!==0?o[r]:(o[r-1]+o[r])/2},G3=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),W3=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,K3=(e,t)=>t.length,Vh={sum:$3,min:z3,max:V3,extent:U3,mean:B3,median:H3,unique:G3,uniqueCount:W3,count:K3},q3={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:or("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Vh.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Vh.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return Rp(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Vh[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=n.subRows)!=null&&o.length)}}};function Z3(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(s=>!t.includes(s.id));return n==="remove"?r:[...t.map(s=>e.find(a=>a.id===s)).filter(Boolean),...r]}const J3={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:or("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Oe(n=>[ec(t,n)],n=>n.findIndex(r=>r.id===e.id),Me(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=ec(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const o=ec(t,n);return((r=o[o.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=Oe(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>o=>{let s=[];if(!(t!=null&&t.length))s=o;else{const a=[...t],l=[...o];for(;l.length&&a.length;){const c=a.shift(),u=l.findIndex(d=>d.id===c);u>-1&&s.push(l.splice(u,1)[0])}s=[...s,...l]}return Z3(s,n,r)},Me(e.options,"debugTable"))}},Uh=()=>({left:[],right:[]}),Y3={getInitialState:e=>({columnPinning:Uh(),...e}),getDefaultOptions:e=>({onColumnPinningChange:or("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(o=>o.id).filter(Boolean);t.setColumnPinning(o=>{var s,a;if(n==="right"){var l,c;return{left:((l=o==null?void 0:o.left)!=null?l:[]).filter(p=>!(r!=null&&r.includes(p))),right:[...((c=o==null?void 0:o.right)!=null?c:[]).filter(p=>!(r!=null&&r.includes(p))),...r]}}if(n==="left"){var u,d;return{left:[...((u=o==null?void 0:o.left)!=null?u:[]).filter(p=>!(r!=null&&r.includes(p))),...r],right:((d=o==null?void 0:o.right)!=null?d:[]).filter(p=>!(r!=null&&r.includes(p)))}}return{left:((s=o==null?void 0:o.left)!=null?s:[]).filter(p=>!(r!=null&&r.includes(p))),right:((a=o==null?void 0:o.right)!=null?a:[]).filter(p=>!(r!=null&&r.includes(p)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var o,s,a;return((o=r.columnDef.enablePinning)!=null?o:!0)&&((s=(a=t.options.enableColumnPinning)!=null?a:t.options.enablePinning)!=null?s:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(l=>l.id),{left:r,right:o}=t.getState().columnPinning,s=n.some(l=>r==null?void 0:r.includes(l)),a=n.some(l=>o==null?void 0:o.includes(l));return s?"left":a?"right":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();return o?(n=(r=t.getState().columnPinning)==null||(r=r[o])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,o)=>{const s=[...r??[],...o??[]];return n.filter(a=>!s.includes(a.column.id))},Me(t.options,"debugRows")),e.getLeftVisibleCells=Oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(s=>n.find(a=>a.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),Me(t.options,"debugRows")),e.getRightVisibleCells=Oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(s=>n.find(a=>a.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),Me(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?Uh():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:Uh())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var o,s;return!!((o=r.left)!=null&&o.length||(s=r.right)!=null&&s.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=Oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),Me(e.options,"debugColumns")),e.getRightLeafColumns=Oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),Me(e.options,"debugColumns")),e.getCenterLeafColumns=Oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const o=[...n??[],...r??[]];return t.filter(s=>!o.includes(s.id))},Me(e.options,"debugColumns"))}},Yu={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Bh=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),X3={getDefaultColumnDef:()=>Yu,getInitialState:e=>({columnSizing:{},columnSizingInfo:Bh(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:or("columnSizing",e),onColumnSizingInfoChange:or("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,o;const s=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Yu.minSize,(r=s??e.columnDef.size)!=null?r:Yu.size),(o=e.columnDef.maxSize)!=null?o:Yu.maxSize)},e.getStart=Oe(n=>[n,ec(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((o,s)=>o+s.getSize(),0),Me(t.options,"debugColumns")),e.getAfter=Oe(n=>[n,ec(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((o,s)=>o+s.getSize(),0),Me(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...o}=n;return o})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=o=>{if(o.subHeaders.length)o.subHeaders.forEach(r);else{var s;n+=(s=o.column.getSize())!=null?s:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),o=r==null?void 0:r.getCanResize();return s=>{if(!r||!o||(s.persist==null||s.persist(),Hh(s)&&s.touches&&s.touches.length>1))return;const a=e.getSize(),l=e?e.getLeafHeaders().map(x=>[x.column.id,x.column.getSize()]):[[r.id,r.getSize()]],c=Hh(s)?Math.round(s.touches[0].clientX):s.clientX,u={},d=(x,y)=>{typeof y=="number"&&(t.setColumnSizingInfo(b=>{var C,j;const S=t.options.columnResizeDirection==="rtl"?-1:1,k=(y-((C=b==null?void 0:b.startOffset)!=null?C:0))*S,E=Math.max(k/((j=b==null?void 0:b.startSize)!=null?j:0),-.999999);return b.columnSizingStart.forEach(O=>{let[F,Z]=O;u[F]=Math.round(Math.max(Z+Z*E,0)*100)/100}),{...b,deltaOffset:k,deltaPercentage:E}}),(t.options.columnResizeMode==="onChange"||x==="end")&&t.setColumnSizing(b=>({...b,...u})))},p=x=>d("move",x),f=x=>{d("end",x),t.setColumnSizingInfo(y=>({...y,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},h=n||typeof document<"u"?document:null,g={moveHandler:x=>p(x.clientX),upHandler:x=>{h==null||h.removeEventListener("mousemove",g.moveHandler),h==null||h.removeEventListener("mouseup",g.upHandler),f(x.clientX)}},m={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),p(x.touches[0].clientX),!1),upHandler:x=>{var y;h==null||h.removeEventListener("touchmove",m.moveHandler),h==null||h.removeEventListener("touchend",m.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),f((y=x.touches[0])==null?void 0:y.clientX)}},w=Q3()?{passive:!1}:!1;Hh(s)?(h==null||h.addEventListener("touchmove",m.moveHandler,w),h==null||h.addEventListener("touchend",m.upHandler,w)):(h==null||h.addEventListener("mousemove",g.moveHandler,w),h==null||h.addEventListener("mouseup",g.upHandler,w)),t.setColumnSizingInfo(x=>({...x,startOffset:c,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?Bh():(n=e.initialState.columnSizingInfo)!=null?n:Bh())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0}}};let Xu=null;function Q3(){if(typeof Xu=="boolean")return Xu;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Xu=e,Xu}function Hh(e){return e.type==="touchstart"}const eU={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:or("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const o=e.columns;return(n=o.length?o.some(s=>s.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Oe(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),Me(t.options,"debugRows")),e.getVisibleCells=Oe(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,o)=>[...n,...r,...o],Me(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>Oe(()=>[r(),r().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),Me(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,s)=>({...o,[s.id]:n||!(s.getCanHide!=null&&s.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function ec(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const tU={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},nU={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:or("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,o,s;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&((s=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?s:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>yo.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return Rp(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:yo[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},rU={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:or("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var o,s;e.setExpanded(r?{}:(o=(s=e.initialState)==null?void 0:s.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(s=>{const a=s.split(".");r=Math.max(r,a.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var o;const s=r===!0?!0:!!(r!=null&&r[e.id]);let a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(l=>{a[l]=!0}):a=r,n=(o=n)!=null?o:!s,!s&&n)return{...a,[e.id]:!0};if(s&&!n){const{[e.id]:l,...c}=a;return c}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},e.getCanExpand=()=>{var n,r,o;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},Pm=0,Im=10,Gh=()=>({pageIndex:Pm,pageSize:Im}),oU={getInitialState:e=>({...e,pagination:{...Gh(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:or("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const o=s=>ps(r,s);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=r=>{var o;e.setPagination(r?Gh():(o=e.initialState.pagination)!=null?o:Gh())},e.setPageIndex=r=>{e.setPagination(o=>{let s=ps(r,o.pageIndex);const a=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return s=Math.max(0,Math.min(s,a)),{...o,pageIndex:s}})},e.resetPageIndex=r=>{var o,s;e.setPageIndex(r?Pm:(o=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?o:Pm)},e.resetPageSize=r=>{var o,s;e.setPageSize(r?Im:(o=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?o:Im)},e.setPageSize=r=>{e.setPagination(o=>{const s=Math.max(1,ps(r,o.pageSize)),a=o.pageSize*o.pageIndex,l=Math.floor(a/s);return{...o,pageIndex:l,pageSize:s}})},e.setPageCount=r=>e.setPagination(o=>{var s;let a=ps(r,(s=e.options.pageCount)!=null?s:-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...o,pageCount:a}}),e.getPageOptions=Oe(()=>[e.getPageCount()],r=>{let o=[];return r&&r>0&&(o=[...new Array(r)].fill(null).map((s,a)=>a)),o},Me(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},Wh=()=>({top:[],bottom:[]}),sU={getInitialState:e=>({rowPinning:Wh(),...e}),getDefaultOptions:e=>({onRowPinningChange:or("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,o)=>{const s=r?e.getLeafRows().map(c=>{let{id:u}=c;return u}):[],a=o?e.getParentRows().map(c=>{let{id:u}=c;return u}):[],l=new Set([...a,e.id,...s]);t.setRowPinning(c=>{var u,d;if(n==="bottom"){var p,f;return{top:((p=c==null?void 0:c.top)!=null?p:[]).filter(m=>!(l!=null&&l.has(m))),bottom:[...((f=c==null?void 0:c.bottom)!=null?f:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)]}}if(n==="top"){var h,g;return{top:[...((h=c==null?void 0:c.top)!=null?h:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)],bottom:((g=c==null?void 0:c.bottom)!=null?g:[]).filter(m=>!(l!=null&&l.has(m)))}}return{top:((u=c==null?void 0:c.top)!=null?u:[]).filter(m=>!(l!=null&&l.has(m))),bottom:((d=c==null?void 0:c.bottom)!=null?d:[]).filter(m=>!(l!=null&&l.has(m)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:o}=t.options;return typeof r=="function"?r(e):(n=r??o)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:o}=t.getState().rowPinning,s=n.some(l=>r==null?void 0:r.includes(l)),a=n.some(l=>o==null?void 0:o.includes(l));return s?"top":a?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();if(!o)return-1;const s=(n=o==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(a=>{let{id:l}=a;return l});return(r=s==null?void 0:s.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?Wh():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:Wh())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var o,s;return!!((o=r.top)!=null&&o.length||(s=r.bottom)!=null&&s.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(n??[]).map(a=>{const l=e.getRow(a,!0);return l.getIsAllParentsExpanded()?l:null}):(n??[]).map(a=>t.find(l=>l.id===a))).filter(Boolean).map(a=>({...a,position:r}))},e.getTopRows=Oe(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),Me(e.options,"debugRows")),e.getBottomRows=Oe(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),Me(e.options,"debugRows")),e.getCenterRows=Oe(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const o=new Set([...n??[],...r??[]]);return t.filter(s=>!o.has(s.id))},Me(e.options,"debugRows"))}},aU={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:or("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(s=>{s.getCanSelect()&&(r[s.id]=!0)}):o.forEach(s=>{delete r[s.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach(s=>{Dm(o,s.id,r,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Oe(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Kh(e,n):{rows:[],flatRows:[],rowsById:{}},Me(e.options,"debugTable")),e.getFilteredSelectedRowModel=Oe(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Kh(e,n):{rows:[],flatRows:[],rowsById:{}},Me(e.options,"debugTable")),e.getGroupedSelectedRowModel=Oe(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Kh(e,n):{rows:[],flatRows:[],rowsById:{}},Me(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(o=>o.getCanSelect()&&!n[o.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(o=>!n[o.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const o=e.getIsSelected();t.setRowSelection(s=>{var a;if(n=typeof n<"u"?n:!o,e.getCanSelect()&&o===n)return s;const l={...s};return Dm(l,e.id,n,(a=r==null?void 0:r.selectChildren)!=null?a:!0,t),l})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return Jy(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Om(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Om(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var o;n&&e.toggleSelected((o=r.target)==null?void 0:o.checked)}}}},Dm=(e,t,n,r,o)=>{var s;const a=o.getRow(t,!0);n?(a.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),a.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(s=a.subRows)!=null&&s.length&&a.getCanSelectSubRows()&&a.subRows.forEach(l=>Dm(e,l.id,n,r,o))};function Kh(e,t){const n=e.getState().rowSelection,r=[],o={},s=function(a,l){return a.map(c=>{var u;const d=Jy(c,n);if(d&&(r.push(c),o[c.id]=c),(u=c.subRows)!=null&&u.length&&(c={...c,subRows:s(c.subRows)}),d)return c}).filter(Boolean)};return{rows:s(t.rows),flatRows:r,rowsById:o}}function Jy(e,t){var n;return(n=t[e.id])!=null?n:!1}function Om(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let o=!0,s=!1;return e.subRows.forEach(a=>{if(!(s&&!o)&&(a.getCanSelect()&&(Jy(a,t)?s=!0:o=!1),a.subRows&&a.subRows.length)){const l=Om(a,t);l==="all"?s=!0:(l==="some"&&(s=!0),o=!1)}}),o?"all":s?"some":!1}const Mm=/([0-9]+)/gm,iU=(e,t,n)=>uN(Is(e.getValue(n)).toLowerCase(),Is(t.getValue(n)).toLowerCase()),lU=(e,t,n)=>uN(Is(e.getValue(n)),Is(t.getValue(n))),cU=(e,t,n)=>Yy(Is(e.getValue(n)).toLowerCase(),Is(t.getValue(n)).toLowerCase()),uU=(e,t,n)=>Yy(Is(e.getValue(n)),Is(t.getValue(n))),dU=(e,t,n)=>{const r=e.getValue(n),o=t.getValue(n);return r>o?1:rYy(e.getValue(n),t.getValue(n));function Yy(e,t){return e===t?0:e>t?1:-1}function Is(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function uN(e,t){const n=e.split(Mm).filter(Boolean),r=t.split(Mm).filter(Boolean);for(;n.length&&r.length;){const o=n.shift(),s=r.shift(),a=parseInt(o,10),l=parseInt(s,10),c=[a,l].sort();if(isNaN(c[0])){if(o>s)return 1;if(s>o)return-1;continue}if(isNaN(c[1]))return isNaN(a)?-1:1;if(a>l)return 1;if(l>a)return-1}return n.length-r.length}const Sl={alphanumeric:iU,alphanumericCaseSensitive:lU,text:cU,textCaseSensitive:uU,datetime:dU,basic:fU},pU={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:or("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const o of n){const s=o==null?void 0:o.getValue(e.id);if(Object.prototype.toString.call(s)==="[object Date]")return Sl.datetime;if(typeof s=="string"&&(r=!0,s.split(Mm).length>1))return Sl.alphanumeric}return r?Sl.text:Sl.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return Rp(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Sl[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const o=e.getNextSortingOrder(),s=typeof n<"u"&&n!==null;t.setSorting(a=>{const l=a==null?void 0:a.find(h=>h.id===e.id),c=a==null?void 0:a.findIndex(h=>h.id===e.id);let u=[],d,p=s?n:o==="desc";if(a!=null&&a.length&&e.getCanMultiSort()&&r?l?d="toggle":d="add":a!=null&&a.length&&c!==a.length-1?d="replace":l?d="toggle":d="replace",d==="toggle"&&(s||o||(d="remove")),d==="add"){var f;u=[...a,{id:e.id,desc:p}],u.splice(0,u.length-((f=t.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else d==="toggle"?u=a.map(h=>h.id===e.id?{...h,desc:p}:h):d==="remove"?u=a.filter(h=>h.id!==e.id):u=[{id:e.id,desc:p}];return u})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,o;const s=e.getFirstSortDir(),a=e.getIsSorted();return a?a!==s&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(o=t.options.enableMultiRemove)!=null)||o)?!1:a==="desc"?"asc":"desc":s},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(o=>o.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},hU=[A3,eU,J3,Y3,F3,L3,tU,nU,pU,q3,rU,oU,sU,aU,X3];function gU(e){var t,n;const r=[...hU,...(t=e._features)!=null?t:[]];let o={_features:r};const s=o._features.reduce((f,h)=>Object.assign(f,h.getDefaultOptions==null?void 0:h.getDefaultOptions(o)),{}),a=f=>o.options.mergeOptions?o.options.mergeOptions(s,f):{...s,...f};let c={...{},...(n=e.initialState)!=null?n:{}};o._features.forEach(f=>{var h;c=(h=f.getInitialState==null?void 0:f.getInitialState(c))!=null?h:c});const u=[];let d=!1;const p={_features:r,options:{...s,...e},initialState:c,_queue:f=>{u.push(f),d||(d=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();d=!1}).catch(h=>setTimeout(()=>{throw h})))},reset:()=>{o.setState(o.initialState)},setOptions:f=>{const h=ps(f,o.options);o.options=a(h)},getState:()=>o.options.state,setState:f=>{o.options.onStateChange==null||o.options.onStateChange(f)},_getRowId:(f,h,g)=>{var m;return(m=o.options.getRowId==null?void 0:o.options.getRowId(f,h,g))!=null?m:`${g?[g.id,h].join("."):h}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(f,h)=>{let g=(h?o.getPrePaginationRowModel():o.getRowModel()).rowsById[f];if(!g&&(g=o.getCoreRowModel().rowsById[f],!g))throw new Error;return g},_getDefaultColumnDef:Oe(()=>[o.options.defaultColumn],f=>{var h;return f=(h=f)!=null?h:{},{header:g=>{const m=g.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:g=>{var m,w;return(m=(w=g.renderValue())==null||w.toString==null?void 0:w.toString())!=null?m:null},...o._features.reduce((g,m)=>Object.assign(g,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...f}},Me(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:Oe(()=>[o._getColumnDefs()],f=>{const h=function(g,m,w){return w===void 0&&(w=0),g.map(x=>{const y=M3(o,x,w,m),b=x;return y.columns=b.columns?h(b.columns,y,w+1):[],y})};return h(f)},Me(e,"debugColumns")),getAllFlatColumns:Oe(()=>[o.getAllColumns()],f=>f.flatMap(h=>h.getFlatColumns()),Me(e,"debugColumns")),_getAllFlatColumnsById:Oe(()=>[o.getAllFlatColumns()],f=>f.reduce((h,g)=>(h[g.id]=g,h),{}),Me(e,"debugColumns")),getAllLeafColumns:Oe(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(f,h)=>{let g=f.flatMap(m=>m.getLeafColumns());return h(g)},Me(e,"debugColumns")),getColumn:f=>o._getAllFlatColumnsById()[f]};Object.assign(o,p);for(let f=0;fOe(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(o,s,a){s===void 0&&(s=0);const l=[];for(let u=0;ue._autoResetPageIndex()))}function mU(e){const t=[],n=r=>{var o;t.push(r),(o=r.subRows)!=null&&o.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function vU(e,t,n){return n.options.filterFromLeafRows?yU(e,t,n):xU(e,t,n)}function yU(e,t,n){var r;const o=[],s={},a=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,l=function(c,u){u===void 0&&(u=0);const d=[];for(let f=0;fOe(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let f=0;f{var h;const g=e.getColumn(f.id);if(!g)return;const m=g.getFilterFn();m&&o.push({id:f.id,filterFn:m,resolvedValue:(h=m.resolveFilterValue==null?void 0:m.resolveFilterValue(f.value))!=null?h:f.value})});const a=(n??[]).map(f=>f.id),l=e.getGlobalFilterFn(),c=e.getAllLeafColumns().filter(f=>f.getCanGlobalFilter());r&&l&&c.length&&(a.push("__global__"),c.forEach(f=>{var h;s.push({id:f.id,filterFn:l,resolvedValue:(h=l.resolveFilterValue==null?void 0:l.resolveFilterValue(r))!=null?h:r})}));let u,d;for(let f=0;f{h.columnFiltersMeta[m]=w})}if(s.length){for(let g=0;g{h.columnFiltersMeta[m]=w})){h.columnFilters.__global__=!0;break}}h.columnFilters.__global__!==!0&&(h.columnFilters.__global__=!1)}}const p=f=>{for(let h=0;he._autoResetPageIndex()))}function Dp(e){return t=>Oe(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:o,pageIndex:s}=n;let{rows:a,flatRows:l,rowsById:c}=r;const u=o*s,d=u+o;a=a.slice(u,d);let p;t.options.paginateExpandedRows?p={rows:a,flatRows:l,rowsById:c}:p=mU({rows:a,flatRows:l,rowsById:c}),p.flatRows=[];const f=h=>{p.flatRows.push(h),h.subRows.length&&h.subRows.forEach(f)};return p.rows.forEach(f),p},Me(t.options,"debugTable"))}function Op(){return e=>Oe(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,o=[],s=r.filter(c=>{var u;return(u=e.getColumn(c.id))==null?void 0:u.getCanSort()}),a={};s.forEach(c=>{const u=e.getColumn(c.id);u&&(a[c.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const l=c=>{const u=c.map(d=>({...d}));return u.sort((d,p)=>{for(let h=0;h{var p;o.push(d),(p=d.subRows)!=null&&p.length&&(d.subRows=l(d.subRows))}),u};return{rows:l(n.rows),flatRows:o,rowsById:n.rowsById}},Me(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/** + color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,n==null?void 0:n.key)}return o}}function Me(e,t,n,r){return{debug:()=>{var o;return(o=e==null?void 0:e.debugAll)!=null?o:e[t]},key:!1,onChange:r}}function O3(e,t,n,r){const o=()=>{var a;return(a=s.getValue())!=null?a:e.options.renderFallbackValue},s={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:o,getContext:Oe(()=>[e,n,t,s],(a,l,c,u)=>({table:a,column:l,row:c,cell:u,getValue:u.getValue,renderValue:u.renderValue}),Me(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(s,n,t,e)},{}),s}function M3(e,t,n,r){var o,s;const l={...e._getDefaultColumnDef(),...t},c=l.accessorKey;let u=(o=(s=l.id)!=null?s:c?c.replace(".","_"):void 0)!=null?o:typeof l.header=="string"?l.header:void 0,d;if(l.accessorFn?d=l.accessorFn:c&&(c.includes(".")?d=f=>{let h=f;for(const m of c.split(".")){var g;h=(g=h)==null?void 0:g[m]}return h}:d=f=>f[l.accessorKey]),!u)throw new Error;let p={id:`${String(u)}`,accessorFn:d,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:Oe(()=>[!0],()=>{var f;return[p,...(f=p.columns)==null?void 0:f.flatMap(h=>h.getFlatColumns())]},Me(e.options,"debugColumns")),getLeafColumns:Oe(()=>[e._getOrderColumnsFn()],f=>{var h;if((h=p.columns)!=null&&h.length){let g=p.columns.flatMap(m=>m.getLeafColumns());return f(g)}return[p]},Me(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(p,e);return p}const mn="debugHeaders";function Q0(e,t,n){var r;let s={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],l=c=>{c.subHeaders&&c.subHeaders.length&&c.subHeaders.map(l),a.push(c)};return l(s),a},getContext:()=>({table:e,header:s,column:t})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(s,e)}),s}const A3={createTable:e=>{e.getHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>{var s,a;const l=(s=r==null?void 0:r.map(p=>n.find(f=>f.id===p)).filter(Boolean))!=null?s:[],c=(a=o==null?void 0:o.map(p=>n.find(f=>f.id===p)).filter(Boolean))!=null?a:[],u=n.filter(p=>!(r!=null&&r.includes(p.id))&&!(o!=null&&o.includes(p.id)));return Ju(t,[...l,...u,...c],e)},Me(e.options,mn)),e.getCenterHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>(n=n.filter(s=>!(r!=null&&r.includes(s.id))&&!(o!=null&&o.includes(s.id))),Ju(t,n,e,"center")),Me(e.options,mn)),e.getLeftHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var o;const s=(o=r==null?void 0:r.map(a=>n.find(l=>l.id===a)).filter(Boolean))!=null?o:[];return Ju(t,s,e,"left")},Me(e.options,mn)),e.getRightHeaderGroups=Oe(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var o;const s=(o=r==null?void 0:r.map(a=>n.find(l=>l.id===a)).filter(Boolean))!=null?o:[];return Ju(t,s,e,"right")},Me(e.options,mn)),e.getFooterGroups=Oe(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Me(e.options,mn)),e.getLeftFooterGroups=Oe(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Me(e.options,mn)),e.getCenterFooterGroups=Oe(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Me(e.options,mn)),e.getRightFooterGroups=Oe(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Me(e.options,mn)),e.getFlatHeaders=Oe(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,mn)),e.getLeftFlatHeaders=Oe(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,mn)),e.getCenterFlatHeaders=Oe(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,mn)),e.getRightFlatHeaders=Oe(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),Me(e.options,mn)),e.getCenterLeafHeaders=Oe(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Me(e.options,mn)),e.getLeftLeafHeaders=Oe(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Me(e.options,mn)),e.getRightLeafHeaders=Oe(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Me(e.options,mn)),e.getLeafHeaders=Oe(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var o,s,a,l,c,u;return[...(o=(s=t[0])==null?void 0:s.headers)!=null?o:[],...(a=(l=n[0])==null?void 0:l.headers)!=null?a:[],...(c=(u=r[0])==null?void 0:u.headers)!=null?c:[]].map(d=>d.getLeafHeaders()).flat()},Me(e.options,mn))}};function Ju(e,t,n,r){var o,s;let a=0;const l=function(f,h){h===void 0&&(h=1),a=Math.max(a,h),f.filter(g=>g.getIsVisible()).forEach(g=>{var m;(m=g.columns)!=null&&m.length&&l(g.columns,h+1)},0)};l(e);let c=[];const u=(f,h)=>{const g={depth:h,id:[r,`${h}`].filter(Boolean).join("_"),headers:[]},m=[];f.forEach(w=>{const x=[...m].reverse()[0],y=w.column.depth===g.depth;let b,C=!1;if(y&&w.column.parent?b=w.column.parent:(b=w.column,C=!0),x&&(x==null?void 0:x.column)===b)x.subHeaders.push(w);else{const j=Q0(n,b,{id:[r,h,b.id,w==null?void 0:w.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${m.filter(S=>S.column===b).length}`:void 0,depth:h,index:m.length});j.subHeaders.push(w),m.push(j)}g.headers.push(w),w.headerGroup=g}),c.push(g),h>0&&u(m,h-1)},d=t.map((f,h)=>Q0(n,f,{depth:a,index:h}));u(d,a-1),c.reverse();const p=f=>f.filter(g=>g.column.getIsVisible()).map(g=>{let m=0,w=0,x=[0];g.subHeaders&&g.subHeaders.length?(x=[],p(g.subHeaders).forEach(b=>{let{colSpan:C,rowSpan:j}=b;m+=C,x.push(j)})):m=1;const y=Math.min(...x);return w=w+y,g.colSpan=m,g.rowSpan=w,{colSpan:m,rowSpan:w}});return p((o=(s=c[0])==null?void 0:s.headers)!=null?o:[]),c}const qy=(e,t,n,r,o,s,a)=>{let l={id:t,index:r,original:n,depth:o,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:c=>{if(l._valuesCache.hasOwnProperty(c))return l._valuesCache[c];const u=e.getColumn(c);if(u!=null&&u.accessorFn)return l._valuesCache[c]=u.accessorFn(l.original,r),l._valuesCache[c]},getUniqueValues:c=>{if(l._uniqueValuesCache.hasOwnProperty(c))return l._uniqueValuesCache[c];const u=e.getColumn(c);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(l._uniqueValuesCache[c]=u.columnDef.getUniqueValues(l.original,r),l._uniqueValuesCache[c]):(l._uniqueValuesCache[c]=[l.getValue(c)],l._uniqueValuesCache[c])},renderValue:c=>{var u;return(u=l.getValue(c))!=null?u:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>D3(l.subRows,c=>c.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let c=[],u=l;for(;;){const d=u.getParentRow();if(!d)break;c.push(d),u=d}return c.reverse()},getAllCells:Oe(()=>[e.getAllLeafColumns()],c=>c.map(u=>O3(e,l,u,u.id)),Me(e.options,"debugRows")),_getAllCellsByColumnId:Oe(()=>[l.getAllCells()],c=>c.reduce((u,d)=>(u[d.column.id]=d,u),{}),Me(e.options,"debugRows"))};for(let c=0;c{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},rN=(e,t,n)=>{var r;const o=n.toLowerCase();return!!(!((r=e.getValue(t))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(o))};rN.autoRemove=e=>Mr(e);const oN=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};oN.autoRemove=e=>Mr(e);const sN=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};sN.autoRemove=e=>Mr(e);const aN=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};aN.autoRemove=e=>Mr(e)||!(e!=null&&e.length);const iN=(e,t,n)=>!n.some(r=>{var o;return!((o=e.getValue(t))!=null&&o.includes(r))});iN.autoRemove=e=>Mr(e)||!(e!=null&&e.length);const lN=(e,t,n)=>n.some(r=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(r)});lN.autoRemove=e=>Mr(e)||!(e!=null&&e.length);const cN=(e,t,n)=>e.getValue(t)===n;cN.autoRemove=e=>Mr(e);const uN=(e,t,n)=>e.getValue(t)==n;uN.autoRemove=e=>Mr(e);const Zy=(e,t,n)=>{let[r,o]=n;const s=e.getValue(t);return s>=r&&s<=o};Zy.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,o=typeof n!="number"?parseFloat(n):n,s=t===null||Number.isNaN(r)?-1/0:r,a=n===null||Number.isNaN(o)?1/0:o;if(s>a){const l=s;s=a,a=l}return[s,a]};Zy.autoRemove=e=>Mr(e)||Mr(e[0])&&Mr(e[1]);const yo={includesString:rN,includesStringSensitive:oN,equalsString:sN,arrIncludes:aN,arrIncludesAll:iN,arrIncludesSome:lN,equals:cN,weakEquals:uN,inNumberRange:Zy};function Mr(e){return e==null||e===""}const L3={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:or("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?yo.includesString:typeof r=="number"?yo.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?yo.equals:Array.isArray(r)?yo.arrIncludes:yo.weakEquals},e.getFilterFn=()=>{var n,r;return Rp(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:yo[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,o;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const o=e.getFilterFn(),s=r==null?void 0:r.find(d=>d.id===e.id),a=ps(n,s?s.value:void 0);if(eb(o,a,e)){var l;return(l=r==null?void 0:r.filter(d=>d.id!==e.id))!=null?l:[]}const c={id:e.id,value:a};if(s){var u;return(u=r==null?void 0:r.map(d=>d.id===e.id?c:d))!=null?u:[]}return r!=null&&r.length?[...r,c]:[c]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=o=>{var s;return(s=ps(t,o))==null?void 0:s.filter(a=>{const l=n.find(c=>c.id===a.id);if(l){const c=l.getFilterFn();if(eb(c,a.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function eb(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const $3=(e,t,n)=>n.reduce((r,o)=>{const s=o.getValue(e);return r+(typeof s=="number"?s:0)},0),z3=(e,t,n)=>{let r;return n.forEach(o=>{const s=o.getValue(e);s!=null&&(r>s||r===void 0&&s>=s)&&(r=s)}),r},V3=(e,t,n)=>{let r;return n.forEach(o=>{const s=o.getValue(e);s!=null&&(r=s)&&(r=s)}),r},U3=(e,t,n)=>{let r,o;return n.forEach(s=>{const a=s.getValue(e);a!=null&&(r===void 0?a>=a&&(r=o=a):(r>a&&(r=a),o{let n=0,r=0;if(t.forEach(o=>{let s=o.getValue(e);s!=null&&(s=+s)>=s&&(++n,r+=s)}),n)return r/n},H3=(e,t)=>{if(!t.length)return;const n=t.map(s=>s.getValue(e));if(!I3(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),o=n.sort((s,a)=>s-a);return n.length%2!==0?o[r]:(o[r-1]+o[r])/2},G3=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),W3=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,K3=(e,t)=>t.length,Vh={sum:$3,min:z3,max:V3,extent:U3,mean:B3,median:H3,unique:G3,uniqueCount:W3,count:K3},q3={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:or("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Vh.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Vh.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return Rp(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Vh[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=n.subRows)!=null&&o.length)}}};function Z3(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(s=>!t.includes(s.id));return n==="remove"?r:[...t.map(s=>e.find(a=>a.id===s)).filter(Boolean),...r]}const J3={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:or("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Oe(n=>[ec(t,n)],n=>n.findIndex(r=>r.id===e.id),Me(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=ec(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const o=ec(t,n);return((r=o[o.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=Oe(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>o=>{let s=[];if(!(t!=null&&t.length))s=o;else{const a=[...t],l=[...o];for(;l.length&&a.length;){const c=a.shift(),u=l.findIndex(d=>d.id===c);u>-1&&s.push(l.splice(u,1)[0])}s=[...s,...l]}return Z3(s,n,r)},Me(e.options,"debugTable"))}},Uh=()=>({left:[],right:[]}),Y3={getInitialState:e=>({columnPinning:Uh(),...e}),getDefaultOptions:e=>({onColumnPinningChange:or("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(o=>o.id).filter(Boolean);t.setColumnPinning(o=>{var s,a;if(n==="right"){var l,c;return{left:((l=o==null?void 0:o.left)!=null?l:[]).filter(p=>!(r!=null&&r.includes(p))),right:[...((c=o==null?void 0:o.right)!=null?c:[]).filter(p=>!(r!=null&&r.includes(p))),...r]}}if(n==="left"){var u,d;return{left:[...((u=o==null?void 0:o.left)!=null?u:[]).filter(p=>!(r!=null&&r.includes(p))),...r],right:((d=o==null?void 0:o.right)!=null?d:[]).filter(p=>!(r!=null&&r.includes(p)))}}return{left:((s=o==null?void 0:o.left)!=null?s:[]).filter(p=>!(r!=null&&r.includes(p))),right:((a=o==null?void 0:o.right)!=null?a:[]).filter(p=>!(r!=null&&r.includes(p)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var o,s,a;return((o=r.columnDef.enablePinning)!=null?o:!0)&&((s=(a=t.options.enableColumnPinning)!=null?a:t.options.enablePinning)!=null?s:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(l=>l.id),{left:r,right:o}=t.getState().columnPinning,s=n.some(l=>r==null?void 0:r.includes(l)),a=n.some(l=>o==null?void 0:o.includes(l));return s?"left":a?"right":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();return o?(n=(r=t.getState().columnPinning)==null||(r=r[o])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,o)=>{const s=[...r??[],...o??[]];return n.filter(a=>!s.includes(a.column.id))},Me(t.options,"debugRows")),e.getLeftVisibleCells=Oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(s=>n.find(a=>a.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),Me(t.options,"debugRows")),e.getRightVisibleCells=Oe(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(s=>n.find(a=>a.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),Me(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?Uh():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:Uh())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var o,s;return!!((o=r.left)!=null&&o.length||(s=r.right)!=null&&s.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=Oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),Me(e.options,"debugColumns")),e.getRightLeafColumns=Oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),Me(e.options,"debugColumns")),e.getCenterLeafColumns=Oe(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const o=[...n??[],...r??[]];return t.filter(s=>!o.includes(s.id))},Me(e.options,"debugColumns"))}},Yu={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Bh=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),X3={getDefaultColumnDef:()=>Yu,getInitialState:e=>({columnSizing:{},columnSizingInfo:Bh(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:or("columnSizing",e),onColumnSizingInfoChange:or("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,o;const s=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Yu.minSize,(r=s??e.columnDef.size)!=null?r:Yu.size),(o=e.columnDef.maxSize)!=null?o:Yu.maxSize)},e.getStart=Oe(n=>[n,ec(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((o,s)=>o+s.getSize(),0),Me(t.options,"debugColumns")),e.getAfter=Oe(n=>[n,ec(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((o,s)=>o+s.getSize(),0),Me(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...o}=n;return o})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=o=>{if(o.subHeaders.length)o.subHeaders.forEach(r);else{var s;n+=(s=o.column.getSize())!=null?s:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),o=r==null?void 0:r.getCanResize();return s=>{if(!r||!o||(s.persist==null||s.persist(),Hh(s)&&s.touches&&s.touches.length>1))return;const a=e.getSize(),l=e?e.getLeafHeaders().map(x=>[x.column.id,x.column.getSize()]):[[r.id,r.getSize()]],c=Hh(s)?Math.round(s.touches[0].clientX):s.clientX,u={},d=(x,y)=>{typeof y=="number"&&(t.setColumnSizingInfo(b=>{var C,j;const S=t.options.columnResizeDirection==="rtl"?-1:1,k=(y-((C=b==null?void 0:b.startOffset)!=null?C:0))*S,E=Math.max(k/((j=b==null?void 0:b.startSize)!=null?j:0),-.999999);return b.columnSizingStart.forEach(O=>{let[F,Z]=O;u[F]=Math.round(Math.max(Z+Z*E,0)*100)/100}),{...b,deltaOffset:k,deltaPercentage:E}}),(t.options.columnResizeMode==="onChange"||x==="end")&&t.setColumnSizing(b=>({...b,...u})))},p=x=>d("move",x),f=x=>{d("end",x),t.setColumnSizingInfo(y=>({...y,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},h=n||typeof document<"u"?document:null,g={moveHandler:x=>p(x.clientX),upHandler:x=>{h==null||h.removeEventListener("mousemove",g.moveHandler),h==null||h.removeEventListener("mouseup",g.upHandler),f(x.clientX)}},m={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),p(x.touches[0].clientX),!1),upHandler:x=>{var y;h==null||h.removeEventListener("touchmove",m.moveHandler),h==null||h.removeEventListener("touchend",m.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),f((y=x.touches[0])==null?void 0:y.clientX)}},w=Q3()?{passive:!1}:!1;Hh(s)?(h==null||h.addEventListener("touchmove",m.moveHandler,w),h==null||h.addEventListener("touchend",m.upHandler,w)):(h==null||h.addEventListener("mousemove",g.moveHandler,w),h==null||h.addEventListener("mouseup",g.upHandler,w)),t.setColumnSizingInfo(x=>({...x,startOffset:c,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?Bh():(n=e.initialState.columnSizingInfo)!=null?n:Bh())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0}}};let Xu=null;function Q3(){if(typeof Xu=="boolean")return Xu;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Xu=e,Xu}function Hh(e){return e.type==="touchstart"}const eU={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:or("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const o=e.columns;return(n=o.length?o.some(s=>s.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Oe(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),Me(t.options,"debugRows")),e.getVisibleCells=Oe(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,o)=>[...n,...r,...o],Me(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>Oe(()=>[r(),r().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),Me(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,s)=>({...o,[s.id]:n||!(s.getCanHide!=null&&s.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function ec(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const tU={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},nU={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:or("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,o,s;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&((s=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?s:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>yo.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return Rp(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:yo[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},rU={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:or("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var o,s;e.setExpanded(r?{}:(o=(s=e.initialState)==null?void 0:s.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(s=>{const a=s.split(".");r=Math.max(r,a.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var o;const s=r===!0?!0:!!(r!=null&&r[e.id]);let a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(l=>{a[l]=!0}):a=r,n=(o=n)!=null?o:!s,!s&&n)return{...a,[e.id]:!0};if(s&&!n){const{[e.id]:l,...c}=a;return c}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},e.getCanExpand=()=>{var n,r,o;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},Pm=0,Im=10,Gh=()=>({pageIndex:Pm,pageSize:Im}),oU={getInitialState:e=>({...e,pagination:{...Gh(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:or("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const o=s=>ps(r,s);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=r=>{var o;e.setPagination(r?Gh():(o=e.initialState.pagination)!=null?o:Gh())},e.setPageIndex=r=>{e.setPagination(o=>{let s=ps(r,o.pageIndex);const a=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return s=Math.max(0,Math.min(s,a)),{...o,pageIndex:s}})},e.resetPageIndex=r=>{var o,s;e.setPageIndex(r?Pm:(o=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?o:Pm)},e.resetPageSize=r=>{var o,s;e.setPageSize(r?Im:(o=(s=e.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?o:Im)},e.setPageSize=r=>{e.setPagination(o=>{const s=Math.max(1,ps(r,o.pageSize)),a=o.pageSize*o.pageIndex,l=Math.floor(a/s);return{...o,pageIndex:l,pageSize:s}})},e.setPageCount=r=>e.setPagination(o=>{var s;let a=ps(r,(s=e.options.pageCount)!=null?s:-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...o,pageCount:a}}),e.getPageOptions=Oe(()=>[e.getPageCount()],r=>{let o=[];return r&&r>0&&(o=[...new Array(r)].fill(null).map((s,a)=>a)),o},Me(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},Wh=()=>({top:[],bottom:[]}),sU={getInitialState:e=>({rowPinning:Wh(),...e}),getDefaultOptions:e=>({onRowPinningChange:or("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,o)=>{const s=r?e.getLeafRows().map(c=>{let{id:u}=c;return u}):[],a=o?e.getParentRows().map(c=>{let{id:u}=c;return u}):[],l=new Set([...a,e.id,...s]);t.setRowPinning(c=>{var u,d;if(n==="bottom"){var p,f;return{top:((p=c==null?void 0:c.top)!=null?p:[]).filter(m=>!(l!=null&&l.has(m))),bottom:[...((f=c==null?void 0:c.bottom)!=null?f:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)]}}if(n==="top"){var h,g;return{top:[...((h=c==null?void 0:c.top)!=null?h:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)],bottom:((g=c==null?void 0:c.bottom)!=null?g:[]).filter(m=>!(l!=null&&l.has(m)))}}return{top:((u=c==null?void 0:c.top)!=null?u:[]).filter(m=>!(l!=null&&l.has(m))),bottom:((d=c==null?void 0:c.bottom)!=null?d:[]).filter(m=>!(l!=null&&l.has(m)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:o}=t.options;return typeof r=="function"?r(e):(n=r??o)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:o}=t.getState().rowPinning,s=n.some(l=>r==null?void 0:r.includes(l)),a=n.some(l=>o==null?void 0:o.includes(l));return s?"top":a?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();if(!o)return-1;const s=(n=o==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(a=>{let{id:l}=a;return l});return(r=s==null?void 0:s.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?Wh():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:Wh())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var o,s;return!!((o=r.top)!=null&&o.length||(s=r.bottom)!=null&&s.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(n??[]).map(a=>{const l=e.getRow(a,!0);return l.getIsAllParentsExpanded()?l:null}):(n??[]).map(a=>t.find(l=>l.id===a))).filter(Boolean).map(a=>({...a,position:r}))},e.getTopRows=Oe(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),Me(e.options,"debugRows")),e.getBottomRows=Oe(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),Me(e.options,"debugRows")),e.getCenterRows=Oe(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const o=new Set([...n??[],...r??[]]);return t.filter(s=>!o.has(s.id))},Me(e.options,"debugRows"))}},aU={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:or("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(s=>{s.getCanSelect()&&(r[s.id]=!0)}):o.forEach(s=>{delete r[s.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach(s=>{Dm(o,s.id,r,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Oe(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Kh(e,n):{rows:[],flatRows:[],rowsById:{}},Me(e.options,"debugTable")),e.getFilteredSelectedRowModel=Oe(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Kh(e,n):{rows:[],flatRows:[],rowsById:{}},Me(e.options,"debugTable")),e.getGroupedSelectedRowModel=Oe(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Kh(e,n):{rows:[],flatRows:[],rowsById:{}},Me(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(o=>o.getCanSelect()&&!n[o.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(o=>!n[o.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const o=e.getIsSelected();t.setRowSelection(s=>{var a;if(n=typeof n<"u"?n:!o,e.getCanSelect()&&o===n)return s;const l={...s};return Dm(l,e.id,n,(a=r==null?void 0:r.selectChildren)!=null?a:!0,t),l})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return Jy(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Om(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Om(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var o;n&&e.toggleSelected((o=r.target)==null?void 0:o.checked)}}}},Dm=(e,t,n,r,o)=>{var s;const a=o.getRow(t,!0);n?(a.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),a.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(s=a.subRows)!=null&&s.length&&a.getCanSelectSubRows()&&a.subRows.forEach(l=>Dm(e,l.id,n,r,o))};function Kh(e,t){const n=e.getState().rowSelection,r=[],o={},s=function(a,l){return a.map(c=>{var u;const d=Jy(c,n);if(d&&(r.push(c),o[c.id]=c),(u=c.subRows)!=null&&u.length&&(c={...c,subRows:s(c.subRows)}),d)return c}).filter(Boolean)};return{rows:s(t.rows),flatRows:r,rowsById:o}}function Jy(e,t){var n;return(n=t[e.id])!=null?n:!1}function Om(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let o=!0,s=!1;return e.subRows.forEach(a=>{if(!(s&&!o)&&(a.getCanSelect()&&(Jy(a,t)?s=!0:o=!1),a.subRows&&a.subRows.length)){const l=Om(a,t);l==="all"?s=!0:(l==="some"&&(s=!0),o=!1)}}),o?"all":s?"some":!1}const Mm=/([0-9]+)/gm,iU=(e,t,n)=>dN(Is(e.getValue(n)).toLowerCase(),Is(t.getValue(n)).toLowerCase()),lU=(e,t,n)=>dN(Is(e.getValue(n)),Is(t.getValue(n))),cU=(e,t,n)=>Yy(Is(e.getValue(n)).toLowerCase(),Is(t.getValue(n)).toLowerCase()),uU=(e,t,n)=>Yy(Is(e.getValue(n)),Is(t.getValue(n))),dU=(e,t,n)=>{const r=e.getValue(n),o=t.getValue(n);return r>o?1:rYy(e.getValue(n),t.getValue(n));function Yy(e,t){return e===t?0:e>t?1:-1}function Is(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function dN(e,t){const n=e.split(Mm).filter(Boolean),r=t.split(Mm).filter(Boolean);for(;n.length&&r.length;){const o=n.shift(),s=r.shift(),a=parseInt(o,10),l=parseInt(s,10),c=[a,l].sort();if(isNaN(c[0])){if(o>s)return 1;if(s>o)return-1;continue}if(isNaN(c[1]))return isNaN(a)?-1:1;if(a>l)return 1;if(l>a)return-1}return n.length-r.length}const Sl={alphanumeric:iU,alphanumericCaseSensitive:lU,text:cU,textCaseSensitive:uU,datetime:dU,basic:fU},pU={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:or("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const o of n){const s=o==null?void 0:o.getValue(e.id);if(Object.prototype.toString.call(s)==="[object Date]")return Sl.datetime;if(typeof s=="string"&&(r=!0,s.split(Mm).length>1))return Sl.alphanumeric}return r?Sl.text:Sl.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return Rp(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Sl[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const o=e.getNextSortingOrder(),s=typeof n<"u"&&n!==null;t.setSorting(a=>{const l=a==null?void 0:a.find(h=>h.id===e.id),c=a==null?void 0:a.findIndex(h=>h.id===e.id);let u=[],d,p=s?n:o==="desc";if(a!=null&&a.length&&e.getCanMultiSort()&&r?l?d="toggle":d="add":a!=null&&a.length&&c!==a.length-1?d="replace":l?d="toggle":d="replace",d==="toggle"&&(s||o||(d="remove")),d==="add"){var f;u=[...a,{id:e.id,desc:p}],u.splice(0,u.length-((f=t.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else d==="toggle"?u=a.map(h=>h.id===e.id?{...h,desc:p}:h):d==="remove"?u=a.filter(h=>h.id!==e.id):u=[{id:e.id,desc:p}];return u})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,o;const s=e.getFirstSortDir(),a=e.getIsSorted();return a?a!==s&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(o=t.options.enableMultiRemove)!=null)||o)?!1:a==="desc"?"asc":"desc":s},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(o=>o.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},hU=[A3,eU,J3,Y3,F3,L3,tU,nU,pU,q3,rU,oU,sU,aU,X3];function gU(e){var t,n;const r=[...hU,...(t=e._features)!=null?t:[]];let o={_features:r};const s=o._features.reduce((f,h)=>Object.assign(f,h.getDefaultOptions==null?void 0:h.getDefaultOptions(o)),{}),a=f=>o.options.mergeOptions?o.options.mergeOptions(s,f):{...s,...f};let c={...{},...(n=e.initialState)!=null?n:{}};o._features.forEach(f=>{var h;c=(h=f.getInitialState==null?void 0:f.getInitialState(c))!=null?h:c});const u=[];let d=!1;const p={_features:r,options:{...s,...e},initialState:c,_queue:f=>{u.push(f),d||(d=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();d=!1}).catch(h=>setTimeout(()=>{throw h})))},reset:()=>{o.setState(o.initialState)},setOptions:f=>{const h=ps(f,o.options);o.options=a(h)},getState:()=>o.options.state,setState:f=>{o.options.onStateChange==null||o.options.onStateChange(f)},_getRowId:(f,h,g)=>{var m;return(m=o.options.getRowId==null?void 0:o.options.getRowId(f,h,g))!=null?m:`${g?[g.id,h].join("."):h}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(f,h)=>{let g=(h?o.getPrePaginationRowModel():o.getRowModel()).rowsById[f];if(!g&&(g=o.getCoreRowModel().rowsById[f],!g))throw new Error;return g},_getDefaultColumnDef:Oe(()=>[o.options.defaultColumn],f=>{var h;return f=(h=f)!=null?h:{},{header:g=>{const m=g.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:g=>{var m,w;return(m=(w=g.renderValue())==null||w.toString==null?void 0:w.toString())!=null?m:null},...o._features.reduce((g,m)=>Object.assign(g,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...f}},Me(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:Oe(()=>[o._getColumnDefs()],f=>{const h=function(g,m,w){return w===void 0&&(w=0),g.map(x=>{const y=M3(o,x,w,m),b=x;return y.columns=b.columns?h(b.columns,y,w+1):[],y})};return h(f)},Me(e,"debugColumns")),getAllFlatColumns:Oe(()=>[o.getAllColumns()],f=>f.flatMap(h=>h.getFlatColumns()),Me(e,"debugColumns")),_getAllFlatColumnsById:Oe(()=>[o.getAllFlatColumns()],f=>f.reduce((h,g)=>(h[g.id]=g,h),{}),Me(e,"debugColumns")),getAllLeafColumns:Oe(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(f,h)=>{let g=f.flatMap(m=>m.getLeafColumns());return h(g)},Me(e,"debugColumns")),getColumn:f=>o._getAllFlatColumnsById()[f]};Object.assign(o,p);for(let f=0;fOe(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(o,s,a){s===void 0&&(s=0);const l=[];for(let u=0;ue._autoResetPageIndex()))}function mU(e){const t=[],n=r=>{var o;t.push(r),(o=r.subRows)!=null&&o.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function vU(e,t,n){return n.options.filterFromLeafRows?yU(e,t,n):xU(e,t,n)}function yU(e,t,n){var r;const o=[],s={},a=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,l=function(c,u){u===void 0&&(u=0);const d=[];for(let f=0;fOe(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let f=0;f{var h;const g=e.getColumn(f.id);if(!g)return;const m=g.getFilterFn();m&&o.push({id:f.id,filterFn:m,resolvedValue:(h=m.resolveFilterValue==null?void 0:m.resolveFilterValue(f.value))!=null?h:f.value})});const a=(n??[]).map(f=>f.id),l=e.getGlobalFilterFn(),c=e.getAllLeafColumns().filter(f=>f.getCanGlobalFilter());r&&l&&c.length&&(a.push("__global__"),c.forEach(f=>{var h;s.push({id:f.id,filterFn:l,resolvedValue:(h=l.resolveFilterValue==null?void 0:l.resolveFilterValue(r))!=null?h:r})}));let u,d;for(let f=0;f{h.columnFiltersMeta[m]=w})}if(s.length){for(let g=0;g{h.columnFiltersMeta[m]=w})){h.columnFilters.__global__=!0;break}}h.columnFilters.__global__!==!0&&(h.columnFilters.__global__=!1)}}const p=f=>{for(let h=0;he._autoResetPageIndex()))}function Dp(e){return t=>Oe(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:o,pageIndex:s}=n;let{rows:a,flatRows:l,rowsById:c}=r;const u=o*s,d=u+o;a=a.slice(u,d);let p;t.options.paginateExpandedRows?p={rows:a,flatRows:l,rowsById:c}:p=mU({rows:a,flatRows:l,rowsById:c}),p.flatRows=[];const f=h=>{p.flatRows.push(h),h.subRows.length&&h.subRows.forEach(f)};return p.rows.forEach(f),p},Me(t.options,"debugTable"))}function Op(){return e=>Oe(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,o=[],s=r.filter(c=>{var u;return(u=e.getColumn(c.id))==null?void 0:u.getCanSort()}),a={};s.forEach(c=>{const u=e.getColumn(c.id);u&&(a[c.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const l=c=>{const u=c.map(d=>({...d}));return u.sort((d,p)=>{for(let h=0;h{var p;o.push(d),(p=d.subRows)!=null&&p.length&&(d.subRows=l(d.subRows))}),u};return{rows:l(n.rows),flatRows:o,rowsById:n.rowsById}},Me(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/** * react-table * * Copyright (c) TanStack @@ -321,15 +321,15 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Ds(e,t){return e?wU(e)?v.createElement(e,t):e:null}function wU(e){return bU(e)||typeof e=="function"||SU(e)}function bU(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function SU(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Mp(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=v.useState(()=>({current:gU(t)})),[r,o]=v.useState(()=>n.current.initialState);return n.current.setOptions(s=>({...s,...e,state:{...r,...e.state},onStateChange:a=>{o(a),e.onStateChange==null||e.onStateChange(a)}})),n.current}const hu=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{className:"relative w-full overflow-auto",children:i.jsx("table",{ref:n,className:Ne("w-full caption-bottom text-sm",e),...t})}));hu.displayName="Table";const gu=v.forwardRef(({className:e,...t},n)=>i.jsx("thead",{ref:n,className:Ne("[&_tr]:border-b",e),...t}));gu.displayName="TableHeader";const mu=v.forwardRef(({className:e,...t},n)=>i.jsx("tbody",{ref:n,className:Ne("[&_tr:last-child]:border-0",e),...t}));mu.displayName="TableBody";const CU=v.forwardRef(({className:e,...t},n)=>i.jsx("tfoot",{ref:n,className:Ne("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));CU.displayName="TableFooter";const nr=v.forwardRef(({className:e,...t},n)=>i.jsx("tr",{ref:n,className:Ne("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));nr.displayName="TableRow";const vu=v.forwardRef(({className:e,...t},n)=>i.jsx("th",{ref:n,className:Ne("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));vu.displayName="TableHead";const Lo=v.forwardRef(({className:e,...t},n)=>i.jsx("td",{ref:n,className:Ne("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Lo.displayName="TableCell";const jU=v.forwardRef(({className:e,...t},n)=>i.jsx("caption",{ref:n,className:Ne("mt-4 text-sm text-muted-foreground",e),...t}));jU.displayName="TableCaption";const tb=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await R3(e.name,r,t);n(o)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar sessões:",r)}};function _U({openaiBotId:e}){var d,p;const{instance:t}=Tt(),[n,r]=v.useState([]),[o,s]=v.useState([]);v.useEffect(()=>{tb(t,e,s)},[t,e]);function a(){tb(t,e,s)}const l=async(f,h)=>{var g,m,w;try{if(!t)return;await P3(t.name,t.token,f,h),De.success("Status alterado com sucesso."),a()}catch(x){console.error("Erro ao atualizar:",x),De.error(`Erro ao atualizar : ${(w=(m=(g=x==null?void 0:x.response)==null?void 0:g.data)==null?void 0:m.response)==null?void 0:w.message}`)}},c=[{accessorKey:"remoteJid",header:()=>i.jsx("div",{className:"text-center",children:"Remote Jid"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("remoteJid")})},{accessorKey:"sessionId",header:()=>i.jsx("div",{className:"text-center",children:"Session ID"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("sessionId")})},{accessorKey:"status",header:()=>i.jsx("div",{className:"text-center",children:"Status"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("status")})},{id:"actions",enableHiding:!1,cell:({row:f})=>{const h=f.original;return i.jsxs(kp,{children:[i.jsx(Np,{asChild:!0,children:i.jsxs(Te,{variant:"ghost",className:"h-8 w-8 p-0",children:[i.jsx("span",{className:"sr-only",children:"Open menu"}),i.jsx(ep,{className:"h-4 w-4"})]})}),i.jsxs(qi,{align:"end",children:[i.jsx(pu,{children:"Actions"}),i.jsx(Zi,{}),h.status!=="opened"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"opened"),children:[i.jsx(ny,{className:"w-4 h-4 mr-2"}),"Abrir"]}),h.status!=="paused"&&h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"paused"),children:[i.jsx(ty,{className:"w-4 h-4 mr-2"}),"Pausar"]}),h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"closed"),children:[i.jsx(Yv,{className:"w-4 h-4 mr-2"}),"Fechar"]}),i.jsxs(xn,{onClick:()=>l(h.remoteJid,"delete"),children:[i.jsx(Xv,{className:"w-4 h-4 mr-2"}),"Excluir"]})]})]})}}],u=Mp({data:o,columns:c,onSortingChange:r,getCoreRowModel:Pp(),getPaginationRowModel:Dp(),getSortedRowModel:Op(),getFilteredRowModel:Ip(),state:{sorting:n}});return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5 text-white",children:[i.jsx(Qv,{})," Sessões"]})}),i.jsxs(un,{className:"sm:max-w-[950px] overflow-y-auto",onCloseAutoFocus:a,children:[i.jsx(dn,{children:i.jsx(On,{children:"Sessões"})}),i.jsxs("div",{children:[i.jsx(se,{placeholder:"Search by remoteJid...",value:((d=u.getColumn("remoteJid"))==null?void 0:d.getFilterValue())??"",onChange:f=>{var h;return(h=u.getColumn("remoteJid"))==null?void 0:h.setFilterValue(f.target.value)},className:"max-w-sm border border-gray-300 rounded-md"}),i.jsxs(hu,{children:[i.jsx(gu,{children:u.getHeaderGroups().map(f=>i.jsx(nr,{children:f.headers.map(h=>i.jsx(vu,{children:h.isPlaceholder?null:Ds(h.column.columnDef.header,h.getContext())},h.id))},f.id))}),i.jsx(mu,{children:(p=u.getRowModel().rows)!=null&&p.length?u.getRowModel().rows.map(f=>i.jsx(nr,{"data-state":f.getIsSelected()&&"selected",children:f.getVisibleCells().map(h=>i.jsx(Lo,{children:Ds(h.column.columnDef.cell,h.getContext())},h.id))},f.id)):i.jsx(nr,{children:i.jsx(Lo,{colSpan:c.length,className:"h-24 text-center",children:"No results."})})})]})]})]})]})}const EU=T.object({enabled:T.boolean(),openaiCredsId:T.string(),botType:T.string(),assistantId:T.string(),model:T.string(),systemMessages:T.string(),assistantMessages:T.string(),userMessages:T.string(),maxTokens:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string())});function TU({openaiBotId:e,instance:t,creds:n,resetTable:r}){const[,o]=v.useState(""),[s,a]=v.useState(!0),[l,c]=v.useState(!1),u=ir(),d=tn({resolver:nn(EU),defaultValues:{enabled:!0,openaiCredsId:"",botType:"assistant",assistantId:"",model:"gpt-3.5-turbo",systemMessages:"",assistantMessages:"",userMessages:"",maxTokens:"300",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0"}});v.useEffect(()=>{(async()=>{try{const g=localStorage.getItem("token");if(g&&t&&t.name&&e){o(g);const m=await j3(t.name,g,e);d.reset({enabled:m.enabled,openaiCredsId:m.openaiCredsId,botType:m.botType,assistantId:m.assistantId,model:m.model,systemMessages:m.systemMessages.toString(),assistantMessages:m.assistantMessages.toString(),userMessages:m.userMessages.toString(),maxTokens:m.maxTokens.toString(),triggerType:m.triggerType,triggerOperator:m.triggerOperator,triggerValue:m.triggerValue,expire:m.expire.toString(),keywordFinish:m.keywordFinish,delayMessage:m.delayMessage.toString(),unknownMessage:m.unknownMessage,listeningFromMe:m.listeningFromMe,stopBotFromMe:m.stopBotFromMe,keepOpen:m.keepOpen,debounceTime:m.debounceTime.toString()})}else console.error("Token ou nome da instância não encontrados.");a(!1)}catch(g){console.error("Erro ao carregar configurações:",g),a(!1)}})()},[d,t,e]);const p=async()=>{var h,g,m;try{const w=d.getValues(),x=localStorage.getItem("token");if(x&&t&&t.name&&e){const y={enabled:w.enabled,openaiCredsId:w.openaiCredsId,botType:w.botType,assistantId:w.assistantId,model:w.model,systemMessages:[w.systemMessages],assistantMessages:[w.assistantMessages],userMessages:[w.userMessages],maxTokens:parseInt(w.maxTokens,10),triggerType:w.triggerType,triggerOperator:w.triggerOperator||"",triggerValue:w.triggerValue||"",expire:parseInt(w.expire,10),keywordFinish:w.keywordFinish,delayMessage:parseInt(w.delayMessage,10),unknownMessage:w.unknownMessage,listeningFromMe:w.listeningFromMe,stopBotFromMe:w.stopBotFromMe,keepOpen:w.keepOpen,debounceTime:parseInt(w.debounceTime,10)};await E3(t.name,x,e,y),De.success("Bot atualizado com sucesso.")}else console.error("Token ou nome da instância não encontrados.")}catch(w){console.error("Erro ao atualizar bot:",w),De.error(`Erro ao atualizar : ${(m=(g=(h=w==null?void 0:w.response)==null?void 0:h.data)==null?void 0:g.response)==null?void 0:m.message}`)}},f=async()=>{try{const h=localStorage.getItem("token");h&&t&&t.name&&e?(await T3(t.name,h,e),De.success("Bot excluído com sucesso."),c(!1),r(),u(`/manager/instance/${t.id}/openai`)):console.error("Token ou nome da instância não encontrados.")}catch(h){console.error("Erro ao excluir bot:",h)}};return i.jsxs("div",{className:"form",children:[s&&i.jsx(Fo,{}),!s&&i.jsx(uo,{...d,children:i.jsxs("form",{onSubmit:d.handleSubmit(p),className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Openai"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:d.control,name:"enabled",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx(P,{control:d.control,name:"openaiCredsId",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Credencial"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma credencial"})})}),i.jsx(vt,{className:"border border-gray-600",children:n.map(g=>i.jsx(he,{value:`${g.id}`,children:g.name?g.name:g.apiKey.substring(0,15)+"..."},g.id))})]})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Openai Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:d.control,name:"botType",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de Bot"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma tipo de bot"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"assistant",children:"Assistente"}),i.jsx(he,{value:"chatCompletion",children:"Chat Completion"})]})]})]})}),d.watch("botType")==="assistant"&&i.jsx(P,{control:d.control,name:"assistantId",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"ID do Assistente"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"ID do Assistente"})]})}),d.watch("botType")==="chatCompletion"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:d.control,name:"model",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Modelo de Linguagem"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um modelo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"gpt-4o",children:"gpt-4o"}),i.jsx(he,{value:"gpt-3.5-turbo",children:"gpt-3.5-turbo"})]})]})]})}),i.jsx(P,{control:d.control,name:"systemMessages",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Sistem"}),i.jsx(ko,{...h,className:"border border-gray-600 w-full",placeholder:"Mensagem do Sistem"})]})}),i.jsx(P,{control:d.control,name:"assistantMessages",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Asistente"}),i.jsx(ko,{...h,className:"border border-gray-600 w-full",placeholder:"Mensagem do Asistente"})]})}),i.jsx(P,{control:d.control,name:"userMessages",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Usuário"}),i.jsx(ko,{...h,className:"border border-gray-600 w-full",placeholder:"Mensagem do Usuário"})]})}),i.jsx(P,{control:d.control,name:"maxTokens",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Máximo de tokens"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Máximo de tokens",type:"number"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:d.control,name:"triggerType",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),d.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:d.control,name:"triggerOperator",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:d.control,name:"triggerValue",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:d.control,name:"expire",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:d.control,name:"keywordFinish",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:d.control,name:"delayMessage",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:d.control,name:"unknownMessage",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:d.control,name:"listeningFromMe",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:d.control,name:"stopBotFromMe",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:d.control,name:"keepOpen",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:d.control,name:"debounceTime",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})]}),i.jsx("div",{children:i.jsx(_U,{openaiBotId:e})}),i.jsx(Te,{className:"bg-blue-400 hover:bg-blue-600 text-white",onClick:p,children:"Atualizar"}),i.jsxs(Sn,{open:l,onOpenChange:c,children:[i.jsx(Cn,{asChild:!0,children:i.jsx(Te,{variant:"secondary",className:"ml-2 bg-red-400 hover:bg-red-600",children:"Excluir"})}),i.jsx(un,{children:i.jsxs(dn,{children:[i.jsx(On,{children:"Tem certeza que deseja excluir?"}),i.jsx(Ri,{children:"Esta ação não pode ser desfeita."}),i.jsxs(wr,{children:[i.jsx(Te,{variant:"default",className:"bg-red-400 hover:bg-red-600 text-white",onClick:f,children:"Exluir"}),i.jsx(Te,{variant:"outline",onClick:()=>c(!1),children:"Cancelar"})]})]})})]})]})})]})}const kU=T.object({enabled:T.boolean(),openaiCredsId:T.string(),botType:T.string(),assistantId:T.string(),model:T.string(),systemMessages:T.string(),assistantMessages:T.string(),userMessages:T.string(),maxTokens:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string()});function NU({creds:e,resetTable:t}){const{instance:n}=Tt(),[r,o]=v.useState(!1),[s,a]=v.useState(!1),l=tn({resolver:nn(kU),defaultValues:{enabled:!0,openaiCredsId:"",botType:"assistant",assistantId:"",model:"gpt-3.5-turbo",systemMessages:"",assistantMessages:"",userMessages:"",maxTokens:"300",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0"}}),c=async d=>{var p,f,h;try{if(!n||!n.name)throw new Error("Nome da instância não encontrado.");o(!0);const g={enabled:d.enabled,openaiCredsId:d.openaiCredsId,botType:d.botType,assistantId:d.assistantId,model:d.model,systemMessages:[d.systemMessages],assistantMessages:[d.assistantMessages],userMessages:[d.userMessages],maxTokens:parseInt(d.maxTokens,10),triggerType:d.triggerType,triggerOperator:d.triggerOperator||"",triggerValue:d.triggerValue||"",expire:parseInt(d.expire,10),keywordFinish:d.keywordFinish,delayMessage:parseInt(d.delayMessage,10),unknownMessage:d.unknownMessage,listeningFromMe:d.listeningFromMe,stopBotFromMe:d.stopBotFromMe,keepOpen:d.keepOpen,debounceTime:parseInt(d.debounceTime,10)};await _3(n.name,n.token,g),De.success("Bot criado com sucesso!"),a(!1),u(),t()}catch(g){console.error("Erro ao criar bot:",g),De.error(`Erro ao criar : ${(h=(f=(p=g==null?void 0:g.response)==null?void 0:p.data)==null?void 0:f.response)==null?void 0:h.message}`)}finally{o(!1)}};function u(){l.reset()}return i.jsxs(Sn,{open:s,onOpenChange:a,children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ou,{})," Openai Bot"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:u,children:[i.jsx(dn,{children:i.jsx(On,{children:"Novo Openai Bot"})}),i.jsx(Uo,{...l,children:i.jsxs("form",{onSubmit:l.handleSubmit(c),className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:l.control,name:"enabled",render:({field:d})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:d.value,onCheckedChange:d.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx(P,{control:l.control,name:"openaiCredsId",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Credencial"}),i.jsxs(St,{onValueChange:d.onChange,defaultValue:d.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma credencial"})})}),i.jsx(vt,{className:"border border-gray-600",children:e.map(p=>i.jsx(he,{value:`${p.id}`,children:p.name?p.name:p.apiKey.substring(0,15)+"..."},p.id))})]})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Openai Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:l.control,name:"botType",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de Bot"}),i.jsxs(St,{onValueChange:d.onChange,defaultValue:d.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma tipo de bot"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"assistant",children:"Assistente"}),i.jsx(he,{value:"chatCompletion",children:"Chat Completion"})]})]})]})}),l.watch("botType")==="assistant"&&i.jsx(P,{control:l.control,name:"assistantId",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"ID do Assistente"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"ID do Assistente"})]})}),l.watch("botType")==="chatCompletion"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:l.control,name:"model",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Modelo de Linguagem"}),i.jsxs(St,{onValueChange:d.onChange,defaultValue:d.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um modelo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"gpt-4o",children:"gpt-4o"}),i.jsx(he,{value:"gpt-3.5-turbo",children:"gpt-3.5-turbo"})]})]})]})}),i.jsx(P,{control:l.control,name:"systemMessages",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Sistem"}),i.jsx(ko,{...d,className:"border border-gray-600 w-full",placeholder:"Mensagem do Sistem"})]})}),i.jsx(P,{control:l.control,name:"assistantMessages",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Asistente"}),i.jsx(ko,{...d,className:"border border-gray-600 w-full",placeholder:"Mensagem do Asistente"})]})}),i.jsx(P,{control:l.control,name:"userMessages",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Usuário"}),i.jsx(ko,{...d,className:"border border-gray-600 w-full",placeholder:"Mensagem do Usuário"})]})}),i.jsx(P,{control:l.control,name:"maxTokens",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Máximo de tokens"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Máximo de tokens",type:"number"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:l.control,name:"triggerType",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:d.onChange,defaultValue:d.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),l.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:l.control,name:"triggerOperator",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:d.onChange,defaultValue:d.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:l.control,name:"triggerValue",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:l.control,name:"expire",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:l.control,name:"keywordFinish",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:l.control,name:"delayMessage",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:l.control,name:"unknownMessage",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:l.control,name:"listeningFromMe",render:({field:d})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:d.value,onCheckedChange:d.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:l.control,name:"stopBotFromMe",render:({field:d})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:d.value,onCheckedChange:d.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:l.control,name:"keepOpen",render:({field:d})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:d.value,onCheckedChange:d.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:l.control,name:"debounceTime",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{disabled:r,variant:"default",type:"submit",children:"Salvar"})})]})})]})]})}const RU=T.object({name:T.string(),apiKey:T.string()}),qh=async(e,t)=>{try{const n=localStorage.getItem("token");if(n&&e&&e.name){const r=await eN(e.name,n);t(r)}else console.error("Token ou nome da instância não encontrados.")}catch(n){console.error("Erro ao carregar configurações:",n)}};function PU(){var h;const{instance:e}=Tt(),[t,n]=v.useState(!1),[r,o]=v.useState([]),[s,a]=v.useState([]),l=tn({resolver:nn(RU),defaultValues:{name:"",apiKey:""}});v.useEffect(()=>{qh(e,a)},[e]);const c=async g=>{var m,w,x;try{if(!e||!e.name)throw new Error("Nome da instância não encontrado.");const y={name:g.name,apiKey:g.apiKey};await S3(e.name,e.token,y),De.success("Credencial criada com sucesso!"),u()}catch(y){console.error("Erro ao criar bot:",y),De.error(`Erro ao criar : ${(x=(w=(m=y==null?void 0:y.response)==null?void 0:m.data)==null?void 0:w.response)==null?void 0:x.message}`)}};function u(){l.reset(),qh(e,a)}const d=async g=>{var m,w,x;try{await C3(g,e==null?void 0:e.name),De.success("Credencial excluída com sucesso!"),qh(e,a)}catch(y){console.error("Erro ao excluir credencial:",y),De.error(`Erro ao excluir credencial: ${(x=(w=(m=y==null?void 0:y.response)==null?void 0:m.data)==null?void 0:w.response)==null?void 0:x.message}`)}},p=[{accessorKey:"name",header:({column:g})=>i.jsxs(Te,{variant:"ghost",onClick:()=>g.toggleSorting(g.getIsSorted()==="asc"),children:["Nome",i.jsx(WM,{className:"ml-2 h-4 w-4"})]}),cell:({row:g})=>i.jsx("div",{children:g.getValue("name")})},{accessorKey:"apiKey",header:()=>i.jsx("div",{className:"text-right",children:"Api Key"}),cell:({row:g})=>i.jsxs("div",{children:[`${g.getValue("apiKey")}`.slice(0,20),"..."]})},{id:"actions",enableHiding:!1,cell:({row:g})=>{const m=g.original;return i.jsxs(kp,{children:[i.jsx(Np,{asChild:!0,children:i.jsxs(Te,{variant:"ghost",className:"h-8 w-8 p-0",children:[i.jsx("span",{className:"sr-only",children:"Open menu"}),i.jsx(ep,{className:"h-4 w-4"})]})}),i.jsxs(qi,{align:"end",children:[i.jsx(pu,{children:"Actions"}),i.jsx(Zi,{}),i.jsx(xn,{onClick:()=>d(m.id),children:"Excluir"})]})]})}}],f=Mp({data:s,columns:p,onSortingChange:o,getCoreRowModel:Pp(),getPaginationRowModel:Dp(),getSortedRowModel:Op(),getFilteredRowModel:Ip(),state:{sorting:r}});return i.jsxs(Sn,{open:t,onOpenChange:n,children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(sA,{})," Credenciais"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:u,children:[i.jsx(dn,{children:i.jsx(On,{children:"Credenciais"})}),i.jsx(Uo,{...l,children:i.jsxs("form",{onSubmit:l.handleSubmit(c),className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:l.control,name:"name",render:({field:g})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Nome"}),i.jsx(se,{...g,className:"border border-gray-600 w-full",placeholder:"Nome"})]})}),i.jsx(P,{control:l.control,name:"apiKey",render:({field:g})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Api Key"}),i.jsx(se,{...g,className:"border border-gray-600 w-full",placeholder:"Api Key",type:"password"})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{variant:"default",type:"submit",children:"Salvar"})})]})}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx("div",{children:i.jsxs(hu,{children:[i.jsx(gu,{children:f.getHeaderGroups().map(g=>i.jsx(nr,{children:g.headers.map(m=>i.jsx(vu,{children:m.isPlaceholder?null:Ds(m.column.columnDef.header,m.getContext())},m.id))},g.id))}),i.jsx(mu,{children:(h=f.getRowModel().rows)!=null&&h.length?f.getRowModel().rows.map(g=>i.jsx(nr,{"data-state":g.getIsSelected()&&"selected",children:g.getVisibleCells().map(m=>i.jsx(Lo,{children:Ds(m.column.columnDef.cell,m.getContext())},m.id))},g.id)):i.jsx(nr,{children:i.jsx(Lo,{colSpan:p.length,className:"h-24 text-center",children:"No results."})})})]})})]})]})}var dN=v.createContext({dragDropManager:void 0}),fr;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(fr||(fr={}));function Ue(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o-1})}var AU={type:Xy,payload:{clientOffset:null,sourceClientOffset:null}};function FU(e){return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},o=r.publishSource,s=o===void 0?!0:o,a=r.clientOffset,l=r.getSourceClientOffset,c=e.getMonitor(),u=e.getRegistry();e.dispatch(nb(a)),LU(n,c,u);var d=VU(n,c);if(d===null){e.dispatch(AU);return}var p=null;if(a){if(!l)throw new Error("getSourceClientOffset must be defined");$U(l),p=l(d)}e.dispatch(nb(a,p));var f=u.getSource(d),h=f.beginDrag(c,d);if(h!=null){zU(h),u.pinSource(d);var g=u.getSourceType(d);return{type:Ap,payload:{itemType:g,item:h,sourceId:d,clientOffset:a||null,sourceClientOffset:p||null,isSourcePublic:!!s}}}}}function LU(e,t,n){Ue(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(r){Ue(n.getSource(r),"Expected sourceIds to be registered.")})}function $U(e){Ue(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function zU(e){Ue(fN(e),"Item must be an object.")}function VU(e,t){for(var n=null,r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function UU(e){return function(){var n=e.getMonitor();if(n.isDragging())return{type:Qy}}}function Am(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(n){return n===t}):e===t}function BU(e){return function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=r.clientOffset;HU(n);var s=n.slice(0),a=e.getMonitor(),l=e.getRegistry();GU(s,a,l);var c=a.getItemType();return WU(s,l,c),KU(s,a,l),{type:Fp,payload:{targetIds:s,clientOffset:o||null}}}}function HU(e){Ue(Array.isArray(e),"Expected targetIds to be an array.")}function GU(e,t,n){Ue(t.isDragging(),"Cannot call hover while not dragging."),Ue(!t.didDrop(),"Cannot call hover after drop.");for(var r=0;r=0;r--){var o=e[r],s=t.getTargetType(o);Am(s,n)||e.splice(r,1)}}function KU(e,t,n){e.forEach(function(r){var o=n.getTarget(r);o.hover(t,r)})}function rb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ob(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:{},r=e.getMonitor(),o=e.getRegistry();JU(r);var s=QU(r);s.forEach(function(a,l){var c=YU(a,l,o,r),u={type:Lp,payload:{dropResult:ob(ob({},n),c)}};e.dispatch(u)})}}function JU(e){Ue(e.isDragging(),"Cannot call drop while not dragging."),Ue(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function YU(e,t,n,r){var o=n.getTarget(e),s=o?o.drop(r,e):void 0;return XU(s),typeof s>"u"&&(s=t===0?{}:r.getDropResult()),s}function XU(e){Ue(typeof e>"u"||fN(e),"Drop result must either be an object or undefined.")}function QU(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function e5(e){return function(){var n=e.getMonitor(),r=e.getRegistry();t5(n);var o=n.getSourceId();if(o!=null){var s=r.getSource(o,!0);s.endDrag(n,o),r.unpinSource()}return{type:$p}}}function t5(e){Ue(e.isDragging(),"Cannot call endDrag while not dragging.")}function n5(e){return{beginDrag:FU(e),publishDragSource:UU(e),hover:BU(e),drop:ZU(e),endDrag:e5(e)}}function r5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o5(e,t){for(var n=0;n0;r.backend&&(o&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!o&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))}),this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}return s5(e,[{key:"receiveBackend",value:function(n){this.backend=n}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var n=this,r=this.store.dispatch;function o(a){return function(){for(var l=arguments.length,c=new Array(l),u=0;u"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(lr(1));return n(pN)(e,t)}if(typeof e!="function")throw new Error(lr(2));var o=e,s=t,a=[],l=a,c=!1;function u(){l===a&&(l=a.slice())}function d(){if(c)throw new Error(lr(3));return s}function p(m){if(typeof m!="function")throw new Error(lr(4));if(c)throw new Error(lr(5));var w=!0;return u(),l.push(m),function(){if(w){if(c)throw new Error(lr(6));w=!1,u();var y=l.indexOf(m);l.splice(y,1),a=null}}}function f(m){if(!i5(m))throw new Error(lr(7));if(typeof m.type>"u")throw new Error(lr(8));if(c)throw new Error(lr(9));try{c=!0,s=o(s,m)}finally{c=!1}for(var w=a=l,x=0;x2&&arguments[2]!==void 0?arguments[2]:l5;if(e.length!==t.length)return!1;for(var r=0;r0&&arguments[0]!==void 0?arguments[0]:cb,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case Xy:case Ap:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case Fp:return c5(e.clientOffset,n.clientOffset)?e:lb(lb({},e),{},{clientOffset:n.clientOffset});case $p:case Lp:return cb;default:return e}}var ex="dnd-core/ADD_SOURCE",tx="dnd-core/ADD_TARGET",nx="dnd-core/REMOVE_SOURCE",zp="dnd-core/REMOVE_TARGET";function p5(e){return{type:ex,payload:{sourceId:e}}}function h5(e){return{type:tx,payload:{targetId:e}}}function g5(e){return{type:nx,payload:{sourceId:e}}}function m5(e){return{type:zp,payload:{targetId:e}}}function ub(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function cr(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:y5,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case Ap:return cr(cr({},e),{},{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case Qy:return cr(cr({},e),{},{isSourcePublic:!0});case Fp:return cr(cr({},e),{},{targetIds:n.targetIds});case zp:return e.targetIds.indexOf(n.targetId)===-1?e:cr(cr({},e),{},{targetIds:DU(e.targetIds,n.targetId)});case Lp:return cr(cr({},e),{},{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case $p:return cr(cr({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function w5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case ex:case tx:return e+1;case nx:case zp:return e-1;default:return e}}var _f=[],rx=[];_f.__IS_NONE__=!0;rx.__IS_ALL__=!0;function b5(e,t){if(e===_f)return!1;if(e===rx||typeof t>"u")return!0;var n=MU(t,e);return n.length>0}function S5(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Fp:break;case ex:case tx:case zp:case nx:return _f;case Ap:case Qy:case $p:case Lp:default:return rx}var t=e.payload,n=t.targetIds,r=n===void 0?[]:n,o=t.prevTargetIds,s=o===void 0?[]:o,a=OU(r,s),l=a.length>0||!u5(r,s);if(!l)return _f;var c=s[s.length-1],u=r[r.length-1];return c!==u&&(c&&a.push(c),u&&a.push(u)),a}function C5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function db(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function fb(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:S5(e.dirtyHandlerIds,{type:t.type,payload:fb(fb({},t.payload),{},{prevTargetIds:IU(e,"dragOperation.targetIds",[])})}),dragOffset:f5(e.dragOffset,t),refCount:w5(e.refCount,t),dragOperation:x5(e.dragOperation,t),stateId:C5(e.stateId)}}function E5(e,t){return{x:e.x+t.x,y:e.y+t.y}}function hN(e,t){return{x:e.x-t.x,y:e.y-t.y}}function T5(e){var t=e.clientOffset,n=e.initialClientOffset,r=e.initialSourceClientOffset;return!t||!n||!r?null:hN(E5(t,r),n)}function k5(e){var t=e.clientOffset,n=e.initialClientOffset;return!t||!n?null:hN(t,n)}function N5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R5(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},s=o.handlerIds;Ue(typeof n=="function","listener must be a function."),Ue(typeof s>"u"||Array.isArray(s),"handlerIds, when specified, must be an array of strings.");var a=this.store.getState().stateId,l=function(){var u=r.store.getState(),d=u.stateId;try{var p=d===a||d===a+1&&!b5(u.dirtyHandlerIds,s);p||n()}finally{a=d}};return this.store.subscribe(l)}},{key:"subscribeToOffsetChange",value:function(n){var r=this;Ue(typeof n=="function","listener must be a function.");var o=this.store.getState().dragOffset,s=function(){var l=r.store.getState().dragOffset;l!==o&&(o=l,n())};return this.store.subscribe(s)}},{key:"canDragSource",value:function(n){if(!n)return!1;var r=this.registry.getSource(n);return Ue(r,"Expected to find a valid source. sourceId=".concat(n)),this.isDragging()?!1:r.canDrag(this,n)}},{key:"canDropOnTarget",value:function(n){if(!n)return!1;var r=this.registry.getTarget(n);if(Ue(r,"Expected to find a valid target. targetId=".concat(n)),!this.isDragging()||this.didDrop())return!1;var o=this.registry.getTargetType(n),s=this.getItemType();return Am(o,s)&&r.canDrop(this,n)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(n){if(!n)return!1;var r=this.registry.getSource(n,!0);if(Ue(r,"Expected to find a valid source. sourceId=".concat(n)),!this.isDragging()||!this.isSourcePublic())return!1;var o=this.registry.getSourceType(n),s=this.getItemType();return o!==s?!1:r.isDragging(this,n)}},{key:"isOverTarget",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!n)return!1;var o=r.shallow;if(!this.isDragging())return!1;var s=this.registry.getTargetType(n),a=this.getItemType();if(a&&!Am(s,a))return!1;var l=this.getTargetIds();if(!l.length)return!1;var c=l.indexOf(n);return o?c===l.length-1:c>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return T5(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return k5(this.store.getState().dragOffset)}}]),e}(),D5=0;function O5(){return D5++}function Cd(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Cd=function(n){return typeof n}:Cd=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Cd(e)}function M5(e){Ue(typeof e.canDrag=="function","Expected canDrag to be a function."),Ue(typeof e.beginDrag=="function","Expected beginDrag to be a function."),Ue(typeof e.endDrag=="function","Expected endDrag to be a function.")}function A5(e){Ue(typeof e.canDrop=="function","Expected canDrop to be a function."),Ue(typeof e.hover=="function","Expected hover to be a function."),Ue(typeof e.drop=="function","Expected beginDrag to be a function.")}function Fm(e,t){if(t&&Array.isArray(e)){e.forEach(function(n){return Fm(n,!1)});return}Ue(typeof e=="string"||Cd(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const hb=typeof global<"u"?global:self,gN=hb.MutationObserver||hb.WebKitMutationObserver;function mN(e){return function(){const n=setTimeout(o,0),r=setInterval(o,50);function o(){clearTimeout(n),clearInterval(r),e()}}}function F5(e){let t=1;const n=new gN(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}const L5=typeof gN=="function"?F5:mN;class $5{enqueueTask(t){const{queue:n,requestFlush:r}=this;n.length||(r(),this.flushing=!0),n[n.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.indexthis.capacity){for(let r=0,o=t.length-this.index;r{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=L5(this.flush),this.requestErrorThrow=mN(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class z5{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,n){this.onError=t,this.release=n,this.task=null}}class V5{create(t){const n=this.freeTasks,r=n.length?n.pop():new z5(this.onError,o=>n[n.length]=o);return r.task=t,r}constructor(t){this.onError=t,this.freeTasks=[]}}const vN=new $5,U5=new V5(vN.registerPendingError);function B5(e){vN.enqueueTask(U5.create(e))}function H5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G5(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:!1;Ue(this.isSourceId(n),"Expected a valid source ID.");var o=r&&n===this.pinnedSourceId,s=o?this.pinnedSource:this.dragSources.get(n);return s}},{key:"getTarget",value:function(n){return Ue(this.isTargetId(n),"Expected a valid target ID."),this.dropTargets.get(n)}},{key:"getSourceType",value:function(n){return Ue(this.isSourceId(n),"Expected a valid source ID."),this.types.get(n)}},{key:"getTargetType",value:function(n){return Ue(this.isTargetId(n),"Expected a valid target ID."),this.types.get(n)}},{key:"isSourceId",value:function(n){var r=mb(n);return r===fr.SOURCE}},{key:"isTargetId",value:function(n){var r=mb(n);return r===fr.TARGET}},{key:"removeSource",value:function(n){var r=this;Ue(this.getSource(n),"Expected an existing source."),this.store.dispatch(g5(n)),B5(function(){r.dragSources.delete(n),r.types.delete(n)})}},{key:"removeTarget",value:function(n){Ue(this.getTarget(n),"Expected an existing target."),this.store.dispatch(m5(n)),this.dropTargets.delete(n),this.types.delete(n)}},{key:"pinSource",value:function(n){var r=this.getSource(n);Ue(r,"Expected an existing source."),this.pinnedSourceId=n,this.pinnedSource=r}},{key:"unpinSource",value:function(){Ue(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(n,r,o){var s=X5(n);return this.types.set(s,r),n===fr.SOURCE?this.dragSources.set(s,o):n===fr.TARGET&&this.dropTargets.set(s,o),s}}]),e}();function eB(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=tB(r),s=new I5(o,new Q5(o)),a=new a5(o,s),l=e(a,t,n);return a.receiveBackend(l),a}function tB(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return pN(_5,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var nB=["children"];function rB(e,t){return iB(e)||aB(e,t)||sB(e,t)||oB()}function oB(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sB(e,t){if(e){if(typeof e=="string")return yb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yb(e,t)}}function yb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function cB(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var xb=0,jd=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),uB=v.memo(function(t){var n=t.children,r=lB(t,nB),o=dB(r),s=rB(o,2),a=s[0],l=s[1];return v.useEffect(function(){if(l){var c=yN();return++xb,function(){--xb===0&&(c[jd]=null)}}},[]),i.jsx(dN.Provider,Object.assign({value:a},{children:n}),void 0)});function dB(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var n=fB(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[n,r]}function fB(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:yN(),n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=t;return o[jd]||(o[jd]={dragDropManager:eB(e,t,n,r)}),o[jd]}function yN(){return typeof global<"u"?global:window}function pB(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hB(e,t){for(var n=0;n, or turn it into a ")+"drag source or a drop target itself.")}}function SB(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!v.isValidElement(t)){var r=t;return e(r,n),r}var o=t;bB(o);var s=n?function(a){return e(a,n)}:e;return CB(o,s)}}function xN(e){var t={};return Object.keys(e).forEach(function(n){var r=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{var o=SB(r);t[n]=function(){return o}}}),t}function Sb(e,t){typeof e=="function"?e(t):e.current=t}function CB(e,t){var n=e.ref;return Ue(typeof n!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?v.cloneElement(e,{ref:function(o){Sb(n,o),Sb(t,o)}}):v.cloneElement(e,{ref:t})}function _d(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_d=function(n){return typeof n}:_d=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},_d(e)}function Lm(e){return e!==null&&_d(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function $m(e,t,n,r){var o=void 0;if(o!==void 0)return!!o;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var s=Object.keys(e),a=Object.keys(t);if(s.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),c=0;c{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function SU(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Mp(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=v.useState(()=>({current:gU(t)})),[r,o]=v.useState(()=>n.current.initialState);return n.current.setOptions(s=>({...s,...e,state:{...r,...e.state},onStateChange:a=>{o(a),e.onStateChange==null||e.onStateChange(a)}})),n.current}const hu=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{className:"relative w-full overflow-auto",children:i.jsx("table",{ref:n,className:Ne("w-full caption-bottom text-sm",e),...t})}));hu.displayName="Table";const gu=v.forwardRef(({className:e,...t},n)=>i.jsx("thead",{ref:n,className:Ne("[&_tr]:border-b",e),...t}));gu.displayName="TableHeader";const mu=v.forwardRef(({className:e,...t},n)=>i.jsx("tbody",{ref:n,className:Ne("[&_tr:last-child]:border-0",e),...t}));mu.displayName="TableBody";const CU=v.forwardRef(({className:e,...t},n)=>i.jsx("tfoot",{ref:n,className:Ne("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));CU.displayName="TableFooter";const nr=v.forwardRef(({className:e,...t},n)=>i.jsx("tr",{ref:n,className:Ne("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));nr.displayName="TableRow";const vu=v.forwardRef(({className:e,...t},n)=>i.jsx("th",{ref:n,className:Ne("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));vu.displayName="TableHead";const Lo=v.forwardRef(({className:e,...t},n)=>i.jsx("td",{ref:n,className:Ne("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Lo.displayName="TableCell";const jU=v.forwardRef(({className:e,...t},n)=>i.jsx("caption",{ref:n,className:Ne("mt-4 text-sm text-muted-foreground",e),...t}));jU.displayName="TableCaption";const tb=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await R3(e.name,r,t);n(o)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar sessões:",r)}};function _U({openaiBotId:e}){var d,p;const{instance:t}=Tt(),[n,r]=v.useState([]),[o,s]=v.useState([]);v.useEffect(()=>{tb(t,e,s)},[t,e]);function a(){tb(t,e,s)}const l=async(f,h)=>{var g,m,w;try{if(!t)return;await P3(t.name,t.token,f,h),De.success("Status alterado com sucesso."),a()}catch(x){console.error("Erro ao atualizar:",x),De.error(`Erro ao atualizar : ${(w=(m=(g=x==null?void 0:x.response)==null?void 0:g.data)==null?void 0:m.response)==null?void 0:w.message}`)}},c=[{accessorKey:"remoteJid",header:()=>i.jsx("div",{className:"text-center",children:"Remote Jid"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("remoteJid")})},{accessorKey:"sessionId",header:()=>i.jsx("div",{className:"text-center",children:"Session ID"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("sessionId")})},{accessorKey:"status",header:()=>i.jsx("div",{className:"text-center",children:"Status"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("status")})},{id:"actions",enableHiding:!1,cell:({row:f})=>{const h=f.original;return i.jsxs(kp,{children:[i.jsx(Np,{asChild:!0,children:i.jsxs(Te,{variant:"ghost",className:"h-8 w-8 p-0",children:[i.jsx("span",{className:"sr-only",children:"Open menu"}),i.jsx(ep,{className:"h-4 w-4"})]})}),i.jsxs(qi,{align:"end",children:[i.jsx(pu,{children:"Actions"}),i.jsx(Zi,{}),h.status!=="opened"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"opened"),children:[i.jsx(ny,{className:"w-4 h-4 mr-2"}),"Abrir"]}),h.status!=="paused"&&h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"paused"),children:[i.jsx(ty,{className:"w-4 h-4 mr-2"}),"Pausar"]}),h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"closed"),children:[i.jsx(Yv,{className:"w-4 h-4 mr-2"}),"Fechar"]}),i.jsxs(xn,{onClick:()=>l(h.remoteJid,"delete"),children:[i.jsx(Xv,{className:"w-4 h-4 mr-2"}),"Excluir"]})]})]})}}],u=Mp({data:o,columns:c,onSortingChange:r,getCoreRowModel:Pp(),getPaginationRowModel:Dp(),getSortedRowModel:Op(),getFilteredRowModel:Ip(),state:{sorting:n}});return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5 text-white",children:[i.jsx(Qv,{})," Sessões"]})}),i.jsxs(un,{className:"sm:max-w-[950px] overflow-y-auto",onCloseAutoFocus:a,children:[i.jsx(dn,{children:i.jsx(On,{children:"Sessões"})}),i.jsxs("div",{children:[i.jsx(se,{placeholder:"Search by remoteJid...",value:((d=u.getColumn("remoteJid"))==null?void 0:d.getFilterValue())??"",onChange:f=>{var h;return(h=u.getColumn("remoteJid"))==null?void 0:h.setFilterValue(f.target.value)},className:"max-w-sm border border-gray-300 rounded-md"}),i.jsxs(hu,{children:[i.jsx(gu,{children:u.getHeaderGroups().map(f=>i.jsx(nr,{children:f.headers.map(h=>i.jsx(vu,{children:h.isPlaceholder?null:Ds(h.column.columnDef.header,h.getContext())},h.id))},f.id))}),i.jsx(mu,{children:(p=u.getRowModel().rows)!=null&&p.length?u.getRowModel().rows.map(f=>i.jsx(nr,{"data-state":f.getIsSelected()&&"selected",children:f.getVisibleCells().map(h=>i.jsx(Lo,{children:Ds(h.column.columnDef.cell,h.getContext())},h.id))},f.id)):i.jsx(nr,{children:i.jsx(Lo,{colSpan:c.length,className:"h-24 text-center",children:"No results."})})})]})]})]})]})}const EU=T.object({enabled:T.boolean(),openaiCredsId:T.string(),botType:T.string(),assistantId:T.string(),model:T.string(),systemMessages:T.string(),assistantMessages:T.string(),userMessages:T.string(),maxTokens:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string())});function TU({openaiBotId:e,instance:t,creds:n,resetTable:r}){const[,o]=v.useState(""),[s,a]=v.useState(!0),[l,c]=v.useState(!1),u=ir(),d=tn({resolver:nn(EU),defaultValues:{enabled:!0,openaiCredsId:"",botType:"assistant",assistantId:"",model:"gpt-3.5-turbo",systemMessages:"",assistantMessages:"",userMessages:"",maxTokens:"300",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0"}});v.useEffect(()=>{(async()=>{try{const g=localStorage.getItem("token");if(g&&t&&t.name&&e){o(g);const m=await j3(t.name,g,e);d.reset({enabled:m.enabled,openaiCredsId:m.openaiCredsId,botType:m.botType,assistantId:m.assistantId,model:m.model,systemMessages:m.systemMessages.toString(),assistantMessages:m.assistantMessages.toString(),userMessages:m.userMessages.toString(),maxTokens:m.maxTokens.toString(),triggerType:m.triggerType,triggerOperator:m.triggerOperator,triggerValue:m.triggerValue,expire:m.expire.toString(),keywordFinish:m.keywordFinish,delayMessage:m.delayMessage.toString(),unknownMessage:m.unknownMessage,listeningFromMe:m.listeningFromMe,stopBotFromMe:m.stopBotFromMe,keepOpen:m.keepOpen,debounceTime:m.debounceTime.toString()})}else console.error("Token ou nome da instância não encontrados.");a(!1)}catch(g){console.error("Erro ao carregar configurações:",g),a(!1)}})()},[d,t,e]);const p=async()=>{var h,g,m;try{const w=d.getValues(),x=localStorage.getItem("token");if(x&&t&&t.name&&e){const y={enabled:w.enabled,openaiCredsId:w.openaiCredsId,botType:w.botType,assistantId:w.assistantId,model:w.model,systemMessages:[w.systemMessages],assistantMessages:[w.assistantMessages],userMessages:[w.userMessages],maxTokens:parseInt(w.maxTokens,10),triggerType:w.triggerType,triggerOperator:w.triggerOperator||"",triggerValue:w.triggerValue||"",expire:parseInt(w.expire,10),keywordFinish:w.keywordFinish,delayMessage:parseInt(w.delayMessage,10),unknownMessage:w.unknownMessage,listeningFromMe:w.listeningFromMe,stopBotFromMe:w.stopBotFromMe,keepOpen:w.keepOpen,debounceTime:parseInt(w.debounceTime,10)};await E3(t.name,x,e,y),De.success("Bot atualizado com sucesso.")}else console.error("Token ou nome da instância não encontrados.")}catch(w){console.error("Erro ao atualizar bot:",w),De.error(`Erro ao atualizar : ${(m=(g=(h=w==null?void 0:w.response)==null?void 0:h.data)==null?void 0:g.response)==null?void 0:m.message}`)}},f=async()=>{try{const h=localStorage.getItem("token");h&&t&&t.name&&e?(await T3(t.name,h,e),De.success("Bot excluído com sucesso."),c(!1),r(),u(`/manager/instance/${t.id}/openai`)):console.error("Token ou nome da instância não encontrados.")}catch(h){console.error("Erro ao excluir bot:",h)}};return i.jsxs("div",{className:"form",children:[s&&i.jsx(Fo,{}),!s&&i.jsx(uo,{...d,children:i.jsxs("form",{onSubmit:d.handleSubmit(p),className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Openai"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:d.control,name:"enabled",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx(P,{control:d.control,name:"openaiCredsId",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Credencial"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma credencial"})})}),i.jsx(vt,{className:"border border-gray-600",children:n.map(g=>i.jsx(he,{value:`${g.id}`,children:g.name?g.name:g.apiKey.substring(0,15)+"..."},g.id))})]})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Openai Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:d.control,name:"botType",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de Bot"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma tipo de bot"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"assistant",children:"Assistente"}),i.jsx(he,{value:"chatCompletion",children:"Chat Completion"})]})]})]})}),d.watch("botType")==="assistant"&&i.jsx(P,{control:d.control,name:"assistantId",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"ID do Assistente"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"ID do Assistente"})]})}),d.watch("botType")==="chatCompletion"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:d.control,name:"model",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Modelo de Linguagem"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um modelo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"gpt-4o",children:"gpt-4o"}),i.jsx(he,{value:"gpt-3.5-turbo",children:"gpt-3.5-turbo"})]})]})]})}),i.jsx(P,{control:d.control,name:"systemMessages",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Sistem"}),i.jsx(ko,{...h,className:"border border-gray-600 w-full",placeholder:"Mensagem do Sistem"})]})}),i.jsx(P,{control:d.control,name:"assistantMessages",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Asistente"}),i.jsx(ko,{...h,className:"border border-gray-600 w-full",placeholder:"Mensagem do Asistente"})]})}),i.jsx(P,{control:d.control,name:"userMessages",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Usuário"}),i.jsx(ko,{...h,className:"border border-gray-600 w-full",placeholder:"Mensagem do Usuário"})]})}),i.jsx(P,{control:d.control,name:"maxTokens",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Máximo de tokens"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Máximo de tokens",type:"number"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:d.control,name:"triggerType",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),d.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:d.control,name:"triggerOperator",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:d.control,name:"triggerValue",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:d.control,name:"expire",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:d.control,name:"keywordFinish",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:d.control,name:"delayMessage",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:d.control,name:"unknownMessage",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:d.control,name:"listeningFromMe",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:d.control,name:"stopBotFromMe",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:d.control,name:"keepOpen",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:d.control,name:"debounceTime",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})]}),i.jsx("div",{children:i.jsx(_U,{openaiBotId:e})}),i.jsx(Te,{className:"bg-blue-400 hover:bg-blue-600 text-white",onClick:p,children:"Atualizar"}),i.jsxs(Sn,{open:l,onOpenChange:c,children:[i.jsx(Cn,{asChild:!0,children:i.jsx(Te,{variant:"secondary",className:"ml-2 bg-red-400 hover:bg-red-600",children:"Excluir"})}),i.jsx(un,{children:i.jsxs(dn,{children:[i.jsx(On,{children:"Tem certeza que deseja excluir?"}),i.jsx(Pi,{children:"Esta ação não pode ser desfeita."}),i.jsxs(wr,{children:[i.jsx(Te,{variant:"default",className:"bg-red-400 hover:bg-red-600 text-white",onClick:f,children:"Exluir"}),i.jsx(Te,{variant:"outline",onClick:()=>c(!1),children:"Cancelar"})]})]})})]})]})})]})}const kU=T.object({enabled:T.boolean(),openaiCredsId:T.string(),botType:T.string(),assistantId:T.string(),model:T.string(),systemMessages:T.string(),assistantMessages:T.string(),userMessages:T.string(),maxTokens:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string()});function NU({creds:e,resetTable:t}){const{instance:n}=Tt(),[r,o]=v.useState(!1),[s,a]=v.useState(!1),l=tn({resolver:nn(kU),defaultValues:{enabled:!0,openaiCredsId:"",botType:"assistant",assistantId:"",model:"gpt-3.5-turbo",systemMessages:"",assistantMessages:"",userMessages:"",maxTokens:"300",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0"}}),c=async d=>{var p,f,h;try{if(!n||!n.name)throw new Error("Nome da instância não encontrado.");o(!0);const g={enabled:d.enabled,openaiCredsId:d.openaiCredsId,botType:d.botType,assistantId:d.assistantId,model:d.model,systemMessages:[d.systemMessages],assistantMessages:[d.assistantMessages],userMessages:[d.userMessages],maxTokens:parseInt(d.maxTokens,10),triggerType:d.triggerType,triggerOperator:d.triggerOperator||"",triggerValue:d.triggerValue||"",expire:parseInt(d.expire,10),keywordFinish:d.keywordFinish,delayMessage:parseInt(d.delayMessage,10),unknownMessage:d.unknownMessage,listeningFromMe:d.listeningFromMe,stopBotFromMe:d.stopBotFromMe,keepOpen:d.keepOpen,debounceTime:parseInt(d.debounceTime,10)};await _3(n.name,n.token,g),De.success("Bot criado com sucesso!"),a(!1),u(),t()}catch(g){console.error("Erro ao criar bot:",g),De.error(`Erro ao criar : ${(h=(f=(p=g==null?void 0:g.response)==null?void 0:p.data)==null?void 0:f.response)==null?void 0:h.message}`)}finally{o(!1)}};function u(){l.reset()}return i.jsxs(Sn,{open:s,onOpenChange:a,children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ou,{})," Openai Bot"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:u,children:[i.jsx(dn,{children:i.jsx(On,{children:"Novo Openai Bot"})}),i.jsx(Uo,{...l,children:i.jsxs("form",{onSubmit:l.handleSubmit(c),className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:l.control,name:"enabled",render:({field:d})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:d.value,onCheckedChange:d.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx(P,{control:l.control,name:"openaiCredsId",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Credencial"}),i.jsxs(St,{onValueChange:d.onChange,defaultValue:d.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma credencial"})})}),i.jsx(vt,{className:"border border-gray-600",children:e.map(p=>i.jsx(he,{value:`${p.id}`,children:p.name?p.name:p.apiKey.substring(0,15)+"..."},p.id))})]})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Openai Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:l.control,name:"botType",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de Bot"}),i.jsxs(St,{onValueChange:d.onChange,defaultValue:d.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma tipo de bot"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"assistant",children:"Assistente"}),i.jsx(he,{value:"chatCompletion",children:"Chat Completion"})]})]})]})}),l.watch("botType")==="assistant"&&i.jsx(P,{control:l.control,name:"assistantId",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"ID do Assistente"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"ID do Assistente"})]})}),l.watch("botType")==="chatCompletion"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:l.control,name:"model",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Modelo de Linguagem"}),i.jsxs(St,{onValueChange:d.onChange,defaultValue:d.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um modelo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"gpt-4o",children:"gpt-4o"}),i.jsx(he,{value:"gpt-3.5-turbo",children:"gpt-3.5-turbo"})]})]})]})}),i.jsx(P,{control:l.control,name:"systemMessages",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Sistem"}),i.jsx(ko,{...d,className:"border border-gray-600 w-full",placeholder:"Mensagem do Sistem"})]})}),i.jsx(P,{control:l.control,name:"assistantMessages",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Asistente"}),i.jsx(ko,{...d,className:"border border-gray-600 w-full",placeholder:"Mensagem do Asistente"})]})}),i.jsx(P,{control:l.control,name:"userMessages",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem do Usuário"}),i.jsx(ko,{...d,className:"border border-gray-600 w-full",placeholder:"Mensagem do Usuário"})]})}),i.jsx(P,{control:l.control,name:"maxTokens",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Máximo de tokens"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Máximo de tokens",type:"number"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:l.control,name:"triggerType",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:d.onChange,defaultValue:d.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),l.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:l.control,name:"triggerOperator",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:d.onChange,defaultValue:d.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:l.control,name:"triggerValue",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:l.control,name:"expire",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:l.control,name:"keywordFinish",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:l.control,name:"delayMessage",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:l.control,name:"unknownMessage",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:l.control,name:"listeningFromMe",render:({field:d})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:d.value,onCheckedChange:d.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:l.control,name:"stopBotFromMe",render:({field:d})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:d.value,onCheckedChange:d.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:l.control,name:"keepOpen",render:({field:d})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:d.value,onCheckedChange:d.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:l.control,name:"debounceTime",render:({field:d})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...d,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{disabled:r,variant:"default",type:"submit",children:"Salvar"})})]})})]})]})}const RU=T.object({name:T.string(),apiKey:T.string()}),qh=async(e,t)=>{try{const n=localStorage.getItem("token");if(n&&e&&e.name){const r=await tN(e.name,n);t(r)}else console.error("Token ou nome da instância não encontrados.")}catch(n){console.error("Erro ao carregar configurações:",n)}};function PU(){var h;const{instance:e}=Tt(),[t,n]=v.useState(!1),[r,o]=v.useState([]),[s,a]=v.useState([]),l=tn({resolver:nn(RU),defaultValues:{name:"",apiKey:""}});v.useEffect(()=>{qh(e,a)},[e]);const c=async g=>{var m,w,x;try{if(!e||!e.name)throw new Error("Nome da instância não encontrado.");const y={name:g.name,apiKey:g.apiKey};await S3(e.name,e.token,y),De.success("Credencial criada com sucesso!"),u()}catch(y){console.error("Erro ao criar bot:",y),De.error(`Erro ao criar : ${(x=(w=(m=y==null?void 0:y.response)==null?void 0:m.data)==null?void 0:w.response)==null?void 0:x.message}`)}};function u(){l.reset(),qh(e,a)}const d=async g=>{var m,w,x;try{await C3(g,e==null?void 0:e.name),De.success("Credencial excluída com sucesso!"),qh(e,a)}catch(y){console.error("Erro ao excluir credencial:",y),De.error(`Erro ao excluir credencial: ${(x=(w=(m=y==null?void 0:y.response)==null?void 0:m.data)==null?void 0:w.response)==null?void 0:x.message}`)}},p=[{accessorKey:"name",header:({column:g})=>i.jsxs(Te,{variant:"ghost",onClick:()=>g.toggleSorting(g.getIsSorted()==="asc"),children:["Nome",i.jsx(QM,{className:"ml-2 h-4 w-4"})]}),cell:({row:g})=>i.jsx("div",{children:g.getValue("name")})},{accessorKey:"apiKey",header:()=>i.jsx("div",{className:"text-right",children:"Api Key"}),cell:({row:g})=>i.jsxs("div",{children:[`${g.getValue("apiKey")}`.slice(0,20),"..."]})},{id:"actions",enableHiding:!1,cell:({row:g})=>{const m=g.original;return i.jsxs(kp,{children:[i.jsx(Np,{asChild:!0,children:i.jsxs(Te,{variant:"ghost",className:"h-8 w-8 p-0",children:[i.jsx("span",{className:"sr-only",children:"Open menu"}),i.jsx(ep,{className:"h-4 w-4"})]})}),i.jsxs(qi,{align:"end",children:[i.jsx(pu,{children:"Actions"}),i.jsx(Zi,{}),i.jsx(xn,{onClick:()=>d(m.id),children:"Excluir"})]})]})}}],f=Mp({data:s,columns:p,onSortingChange:o,getCoreRowModel:Pp(),getPaginationRowModel:Dp(),getSortedRowModel:Op(),getFilteredRowModel:Ip(),state:{sorting:r}});return i.jsxs(Sn,{open:t,onOpenChange:n,children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(fA,{})," Credenciais"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:u,children:[i.jsx(dn,{children:i.jsx(On,{children:"Credenciais"})}),i.jsx(Uo,{...l,children:i.jsxs("form",{onSubmit:l.handleSubmit(c),className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:l.control,name:"name",render:({field:g})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Nome"}),i.jsx(se,{...g,className:"border border-gray-600 w-full",placeholder:"Nome"})]})}),i.jsx(P,{control:l.control,name:"apiKey",render:({field:g})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Api Key"}),i.jsx(se,{...g,className:"border border-gray-600 w-full",placeholder:"Api Key",type:"password"})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{variant:"default",type:"submit",children:"Salvar"})})]})}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx("div",{children:i.jsxs(hu,{children:[i.jsx(gu,{children:f.getHeaderGroups().map(g=>i.jsx(nr,{children:g.headers.map(m=>i.jsx(vu,{children:m.isPlaceholder?null:Ds(m.column.columnDef.header,m.getContext())},m.id))},g.id))}),i.jsx(mu,{children:(h=f.getRowModel().rows)!=null&&h.length?f.getRowModel().rows.map(g=>i.jsx(nr,{"data-state":g.getIsSelected()&&"selected",children:g.getVisibleCells().map(m=>i.jsx(Lo,{children:Ds(m.column.columnDef.cell,m.getContext())},m.id))},g.id)):i.jsx(nr,{children:i.jsx(Lo,{colSpan:p.length,className:"h-24 text-center",children:"No results."})})})]})})]})]})}var fN=v.createContext({dragDropManager:void 0}),fr;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(fr||(fr={}));function Ue(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o-1})}var AU={type:Xy,payload:{clientOffset:null,sourceClientOffset:null}};function FU(e){return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},o=r.publishSource,s=o===void 0?!0:o,a=r.clientOffset,l=r.getSourceClientOffset,c=e.getMonitor(),u=e.getRegistry();e.dispatch(nb(a)),LU(n,c,u);var d=VU(n,c);if(d===null){e.dispatch(AU);return}var p=null;if(a){if(!l)throw new Error("getSourceClientOffset must be defined");$U(l),p=l(d)}e.dispatch(nb(a,p));var f=u.getSource(d),h=f.beginDrag(c,d);if(h!=null){zU(h),u.pinSource(d);var g=u.getSourceType(d);return{type:Ap,payload:{itemType:g,item:h,sourceId:d,clientOffset:a||null,sourceClientOffset:p||null,isSourcePublic:!!s}}}}}function LU(e,t,n){Ue(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(r){Ue(n.getSource(r),"Expected sourceIds to be registered.")})}function $U(e){Ue(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function zU(e){Ue(pN(e),"Item must be an object.")}function VU(e,t){for(var n=null,r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function UU(e){return function(){var n=e.getMonitor();if(n.isDragging())return{type:Qy}}}function Am(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(n){return n===t}):e===t}function BU(e){return function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=r.clientOffset;HU(n);var s=n.slice(0),a=e.getMonitor(),l=e.getRegistry();GU(s,a,l);var c=a.getItemType();return WU(s,l,c),KU(s,a,l),{type:Fp,payload:{targetIds:s,clientOffset:o||null}}}}function HU(e){Ue(Array.isArray(e),"Expected targetIds to be an array.")}function GU(e,t,n){Ue(t.isDragging(),"Cannot call hover while not dragging."),Ue(!t.didDrop(),"Cannot call hover after drop.");for(var r=0;r=0;r--){var o=e[r],s=t.getTargetType(o);Am(s,n)||e.splice(r,1)}}function KU(e,t,n){e.forEach(function(r){var o=n.getTarget(r);o.hover(t,r)})}function rb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ob(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:{},r=e.getMonitor(),o=e.getRegistry();JU(r);var s=QU(r);s.forEach(function(a,l){var c=YU(a,l,o,r),u={type:Lp,payload:{dropResult:ob(ob({},n),c)}};e.dispatch(u)})}}function JU(e){Ue(e.isDragging(),"Cannot call drop while not dragging."),Ue(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function YU(e,t,n,r){var o=n.getTarget(e),s=o?o.drop(r,e):void 0;return XU(s),typeof s>"u"&&(s=t===0?{}:r.getDropResult()),s}function XU(e){Ue(typeof e>"u"||pN(e),"Drop result must either be an object or undefined.")}function QU(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function e5(e){return function(){var n=e.getMonitor(),r=e.getRegistry();t5(n);var o=n.getSourceId();if(o!=null){var s=r.getSource(o,!0);s.endDrag(n,o),r.unpinSource()}return{type:$p}}}function t5(e){Ue(e.isDragging(),"Cannot call endDrag while not dragging.")}function n5(e){return{beginDrag:FU(e),publishDragSource:UU(e),hover:BU(e),drop:ZU(e),endDrag:e5(e)}}function r5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o5(e,t){for(var n=0;n0;r.backend&&(o&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!o&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))}),this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}return s5(e,[{key:"receiveBackend",value:function(n){this.backend=n}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var n=this,r=this.store.dispatch;function o(a){return function(){for(var l=arguments.length,c=new Array(l),u=0;u"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(lr(1));return n(hN)(e,t)}if(typeof e!="function")throw new Error(lr(2));var o=e,s=t,a=[],l=a,c=!1;function u(){l===a&&(l=a.slice())}function d(){if(c)throw new Error(lr(3));return s}function p(m){if(typeof m!="function")throw new Error(lr(4));if(c)throw new Error(lr(5));var w=!0;return u(),l.push(m),function(){if(w){if(c)throw new Error(lr(6));w=!1,u();var y=l.indexOf(m);l.splice(y,1),a=null}}}function f(m){if(!i5(m))throw new Error(lr(7));if(typeof m.type>"u")throw new Error(lr(8));if(c)throw new Error(lr(9));try{c=!0,s=o(s,m)}finally{c=!1}for(var w=a=l,x=0;x2&&arguments[2]!==void 0?arguments[2]:l5;if(e.length!==t.length)return!1;for(var r=0;r0&&arguments[0]!==void 0?arguments[0]:cb,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case Xy:case Ap:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case Fp:return c5(e.clientOffset,n.clientOffset)?e:lb(lb({},e),{},{clientOffset:n.clientOffset});case $p:case Lp:return cb;default:return e}}var ex="dnd-core/ADD_SOURCE",tx="dnd-core/ADD_TARGET",nx="dnd-core/REMOVE_SOURCE",zp="dnd-core/REMOVE_TARGET";function p5(e){return{type:ex,payload:{sourceId:e}}}function h5(e){return{type:tx,payload:{targetId:e}}}function g5(e){return{type:nx,payload:{sourceId:e}}}function m5(e){return{type:zp,payload:{targetId:e}}}function ub(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function cr(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:y5,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case Ap:return cr(cr({},e),{},{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case Qy:return cr(cr({},e),{},{isSourcePublic:!0});case Fp:return cr(cr({},e),{},{targetIds:n.targetIds});case zp:return e.targetIds.indexOf(n.targetId)===-1?e:cr(cr({},e),{},{targetIds:DU(e.targetIds,n.targetId)});case Lp:return cr(cr({},e),{},{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case $p:return cr(cr({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function w5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case ex:case tx:return e+1;case nx:case zp:return e-1;default:return e}}var _f=[],rx=[];_f.__IS_NONE__=!0;rx.__IS_ALL__=!0;function b5(e,t){if(e===_f)return!1;if(e===rx||typeof t>"u")return!0;var n=MU(t,e);return n.length>0}function S5(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Fp:break;case ex:case tx:case zp:case nx:return _f;case Ap:case Qy:case $p:case Lp:default:return rx}var t=e.payload,n=t.targetIds,r=n===void 0?[]:n,o=t.prevTargetIds,s=o===void 0?[]:o,a=OU(r,s),l=a.length>0||!u5(r,s);if(!l)return _f;var c=s[s.length-1],u=r[r.length-1];return c!==u&&(c&&a.push(c),u&&a.push(u)),a}function C5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function db(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function fb(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:S5(e.dirtyHandlerIds,{type:t.type,payload:fb(fb({},t.payload),{},{prevTargetIds:IU(e,"dragOperation.targetIds",[])})}),dragOffset:f5(e.dragOffset,t),refCount:w5(e.refCount,t),dragOperation:x5(e.dragOperation,t),stateId:C5(e.stateId)}}function E5(e,t){return{x:e.x+t.x,y:e.y+t.y}}function gN(e,t){return{x:e.x-t.x,y:e.y-t.y}}function T5(e){var t=e.clientOffset,n=e.initialClientOffset,r=e.initialSourceClientOffset;return!t||!n||!r?null:gN(E5(t,r),n)}function k5(e){var t=e.clientOffset,n=e.initialClientOffset;return!t||!n?null:gN(t,n)}function N5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R5(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},s=o.handlerIds;Ue(typeof n=="function","listener must be a function."),Ue(typeof s>"u"||Array.isArray(s),"handlerIds, when specified, must be an array of strings.");var a=this.store.getState().stateId,l=function(){var u=r.store.getState(),d=u.stateId;try{var p=d===a||d===a+1&&!b5(u.dirtyHandlerIds,s);p||n()}finally{a=d}};return this.store.subscribe(l)}},{key:"subscribeToOffsetChange",value:function(n){var r=this;Ue(typeof n=="function","listener must be a function.");var o=this.store.getState().dragOffset,s=function(){var l=r.store.getState().dragOffset;l!==o&&(o=l,n())};return this.store.subscribe(s)}},{key:"canDragSource",value:function(n){if(!n)return!1;var r=this.registry.getSource(n);return Ue(r,"Expected to find a valid source. sourceId=".concat(n)),this.isDragging()?!1:r.canDrag(this,n)}},{key:"canDropOnTarget",value:function(n){if(!n)return!1;var r=this.registry.getTarget(n);if(Ue(r,"Expected to find a valid target. targetId=".concat(n)),!this.isDragging()||this.didDrop())return!1;var o=this.registry.getTargetType(n),s=this.getItemType();return Am(o,s)&&r.canDrop(this,n)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(n){if(!n)return!1;var r=this.registry.getSource(n,!0);if(Ue(r,"Expected to find a valid source. sourceId=".concat(n)),!this.isDragging()||!this.isSourcePublic())return!1;var o=this.registry.getSourceType(n),s=this.getItemType();return o!==s?!1:r.isDragging(this,n)}},{key:"isOverTarget",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!n)return!1;var o=r.shallow;if(!this.isDragging())return!1;var s=this.registry.getTargetType(n),a=this.getItemType();if(a&&!Am(s,a))return!1;var l=this.getTargetIds();if(!l.length)return!1;var c=l.indexOf(n);return o?c===l.length-1:c>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return T5(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return k5(this.store.getState().dragOffset)}}]),e}(),D5=0;function O5(){return D5++}function Cd(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Cd=function(n){return typeof n}:Cd=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Cd(e)}function M5(e){Ue(typeof e.canDrag=="function","Expected canDrag to be a function."),Ue(typeof e.beginDrag=="function","Expected beginDrag to be a function."),Ue(typeof e.endDrag=="function","Expected endDrag to be a function.")}function A5(e){Ue(typeof e.canDrop=="function","Expected canDrop to be a function."),Ue(typeof e.hover=="function","Expected hover to be a function."),Ue(typeof e.drop=="function","Expected beginDrag to be a function.")}function Fm(e,t){if(t&&Array.isArray(e)){e.forEach(function(n){return Fm(n,!1)});return}Ue(typeof e=="string"||Cd(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const hb=typeof global<"u"?global:self,mN=hb.MutationObserver||hb.WebKitMutationObserver;function vN(e){return function(){const n=setTimeout(o,0),r=setInterval(o,50);function o(){clearTimeout(n),clearInterval(r),e()}}}function F5(e){let t=1;const n=new mN(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}const L5=typeof mN=="function"?F5:vN;class $5{enqueueTask(t){const{queue:n,requestFlush:r}=this;n.length||(r(),this.flushing=!0),n[n.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.indexthis.capacity){for(let r=0,o=t.length-this.index;r{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=L5(this.flush),this.requestErrorThrow=vN(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class z5{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,n){this.onError=t,this.release=n,this.task=null}}class V5{create(t){const n=this.freeTasks,r=n.length?n.pop():new z5(this.onError,o=>n[n.length]=o);return r.task=t,r}constructor(t){this.onError=t,this.freeTasks=[]}}const yN=new $5,U5=new V5(yN.registerPendingError);function B5(e){yN.enqueueTask(U5.create(e))}function H5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G5(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:!1;Ue(this.isSourceId(n),"Expected a valid source ID.");var o=r&&n===this.pinnedSourceId,s=o?this.pinnedSource:this.dragSources.get(n);return s}},{key:"getTarget",value:function(n){return Ue(this.isTargetId(n),"Expected a valid target ID."),this.dropTargets.get(n)}},{key:"getSourceType",value:function(n){return Ue(this.isSourceId(n),"Expected a valid source ID."),this.types.get(n)}},{key:"getTargetType",value:function(n){return Ue(this.isTargetId(n),"Expected a valid target ID."),this.types.get(n)}},{key:"isSourceId",value:function(n){var r=mb(n);return r===fr.SOURCE}},{key:"isTargetId",value:function(n){var r=mb(n);return r===fr.TARGET}},{key:"removeSource",value:function(n){var r=this;Ue(this.getSource(n),"Expected an existing source."),this.store.dispatch(g5(n)),B5(function(){r.dragSources.delete(n),r.types.delete(n)})}},{key:"removeTarget",value:function(n){Ue(this.getTarget(n),"Expected an existing target."),this.store.dispatch(m5(n)),this.dropTargets.delete(n),this.types.delete(n)}},{key:"pinSource",value:function(n){var r=this.getSource(n);Ue(r,"Expected an existing source."),this.pinnedSourceId=n,this.pinnedSource=r}},{key:"unpinSource",value:function(){Ue(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(n,r,o){var s=X5(n);return this.types.set(s,r),n===fr.SOURCE?this.dragSources.set(s,o):n===fr.TARGET&&this.dropTargets.set(s,o),s}}]),e}();function eB(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=tB(r),s=new I5(o,new Q5(o)),a=new a5(o,s),l=e(a,t,n);return a.receiveBackend(l),a}function tB(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return hN(_5,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var nB=["children"];function rB(e,t){return iB(e)||aB(e,t)||sB(e,t)||oB()}function oB(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sB(e,t){if(e){if(typeof e=="string")return yb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yb(e,t)}}function yb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function cB(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var xb=0,jd=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),uB=v.memo(function(t){var n=t.children,r=lB(t,nB),o=dB(r),s=rB(o,2),a=s[0],l=s[1];return v.useEffect(function(){if(l){var c=xN();return++xb,function(){--xb===0&&(c[jd]=null)}}},[]),i.jsx(fN.Provider,Object.assign({value:a},{children:n}),void 0)});function dB(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var n=fB(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[n,r]}function fB(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:xN(),n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=t;return o[jd]||(o[jd]={dragDropManager:eB(e,t,n,r)}),o[jd]}function xN(){return typeof global<"u"?global:window}function pB(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hB(e,t){for(var n=0;n, or turn it into a ")+"drag source or a drop target itself.")}}function SB(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!v.isValidElement(t)){var r=t;return e(r,n),r}var o=t;bB(o);var s=n?function(a){return e(a,n)}:e;return CB(o,s)}}function wN(e){var t={};return Object.keys(e).forEach(function(n){var r=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{var o=SB(r);t[n]=function(){return o}}}),t}function Sb(e,t){typeof e=="function"?e(t):e.current=t}function CB(e,t){var n=e.ref;return Ue(typeof n!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?v.cloneElement(e,{ref:function(o){Sb(n,o),Sb(t,o)}}):v.cloneElement(e,{ref:t})}function _d(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_d=function(n){return typeof n}:_d=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},_d(e)}function Lm(e){return e!==null&&_d(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function $m(e,t,n,r){var o=void 0;if(o!==void 0)return!!o;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var s=Object.keys(e),a=Object.keys(t);if(s.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),c=0;ce.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0}},{key:"leave",value:function(n){var r=this.entered.length;return this.entered=I6(this.entered.filter(this.isNodeInDocument),n),r>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),L6=SN(function(){return/firefox/i.test(navigator.userAgent)}),CN=SN(function(){return!!window.safari});function $6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z6(e,t){for(var n=0;nn)d=p-1;else return o[p]}c=Math.max(0,d);var h=n-r[c],g=h*h;return o[c]+s[c]*h+a[c]*g+l[c]*h*g}}]),e}(),U6=1;function jN(e){var t=e.nodeType===U6?e:e.parentElement;if(!t)return null;var n=t.getBoundingClientRect(),r=n.top,o=n.left;return{x:o,y:r}}function Qu(e){return{x:e.clientX,y:e.clientY}}function B6(e){var t;return e.nodeName==="IMG"&&(L6()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function H6(e,t,n,r){var o=e?t.width:n,s=e?t.height:r;return CN()&&e&&(s/=window.devicePixelRatio,o/=window.devicePixelRatio),{dragPreviewWidth:o,dragPreviewHeight:s}}function G6(e,t,n,r,o){var s=B6(t),a=s?e:t,l=jN(a),c={x:n.x-l.x,y:n.y-l.y},u=e.offsetWidth,d=e.offsetHeight,p=r.anchorX,f=r.anchorY,h=H6(s,t,u,d),g=h.dragPreviewWidth,m=h.dragPreviewHeight,w=function(){var k=new Nb([0,.5,1],[c.y,c.y/d*m,c.y+m-d]),E=k.interpolate(f);return CN()&&s&&(E+=(window.devicePixelRatio-1)*m),E},x=function(){var k=new Nb([0,.5,1],[c.x,c.x/u*g,c.x+g-u]);return k.interpolate(p)},y=o.offsetX,b=o.offsetY,C=y===0||y,j=b===0||b;return{x:C?y:x(),y:j?b:w()}}var _N="__NATIVE_FILE__",EN="__NATIVE_URL__",TN="__NATIVE_TEXT__",kN="__NATIVE_HTML__";const Rb=Object.freeze(Object.defineProperty({__proto__:null,FILE:_N,HTML:kN,TEXT:TN,URL:EN},Symbol.toStringTag,{value:"Module"}));function eg(e,t,n){var r=t.reduce(function(o,s){return o||e.getData(s)},"");return r??n}var Ba;function ed(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vm=(Ba={},ed(Ba,_N,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),ed(Ba,kN,{exposeProperties:{html:function(t,n){return eg(t,n,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),ed(Ba,EN,{exposeProperties:{urls:function(t,n){return eg(t,n,"").split(` -`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),ed(Ba,TN,{exposeProperties:{text:function(t,n){return eg(t,n,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),Ba);function W6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K6(e,t){for(var n=0;n-1})})[0]||null}function Y6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X6(e,t){for(var n=0;n0&&o.actions.hover(a,{clientOffset:Qu(s)});var l=a.some(function(c){return o.monitor.canDropOnTarget(c)});l&&(s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect=o.getCurrentDropEffect()))}}),Qe(this,"handleTopDragOverCapture",function(){o.dragOverTargetIds=[]}),Qe(this,"handleTopDragOver",function(s){var a=o.dragOverTargetIds;if(o.dragOverTargetIds=[],!o.monitor.isDragging()){s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect="none");return}o.altKeyPressed=s.altKey,o.lastClientOffset=Qu(s),o.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(o.hoverRafId=requestAnimationFrame(function(){o.monitor.isDragging()&&o.actions.hover(a||[],{clientOffset:o.lastClientOffset}),o.hoverRafId=null}));var l=(a||[]).some(function(c){return o.monitor.canDropOnTarget(c)});l?(s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect=o.getCurrentDropEffect())):o.isDraggingNativeItem()?s.preventDefault():(s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect="none"))}),Qe(this,"handleTopDragLeaveCapture",function(s){o.isDraggingNativeItem()&&s.preventDefault();var a=o.enterLeaveCounter.leave(s.target);a&&o.isDraggingNativeItem()&&setTimeout(function(){return o.endDragNativeItem()},0)}),Qe(this,"handleTopDropCapture",function(s){if(o.dropTargetIds=[],o.isDraggingNativeItem()){var a;s.preventDefault(),(a=o.currentNativeSource)===null||a===void 0||a.loadDataTransfer(s.dataTransfer)}else tg(s.dataTransfer)&&s.preventDefault();o.enterLeaveCounter.reset()}),Qe(this,"handleTopDrop",function(s){var a=o.dropTargetIds;o.dropTargetIds=[],o.actions.hover(a,{clientOffset:Qu(s)}),o.actions.drop({dropEffect:o.getCurrentDropEffect()}),o.isDraggingNativeItem()?o.endDragNativeItem():o.monitor.isDragging()&&o.actions.endDrag()}),Qe(this,"handleSelectStart",function(s){var a=s.target;typeof a.dragDrop=="function"&&(a.tagName==="INPUT"||a.tagName==="SELECT"||a.tagName==="TEXTAREA"||a.isContentEditable||(s.preventDefault(),a.dragDrop()))}),this.options=new eH(n,r),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new F6(this.isNodeInDocument)}return rH(e,[{key:"profile",value:function(){var n,r;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((n=this.dragStartSourceIds)===null||n===void 0?void 0:n.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((r=this.dragOverTargetIds)===null||r===void 0?void 0:r.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var n=this.rootElement;if(n!==void 0){if(n.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");n.__isReactDndBackendSetUp=!0,this.addEventListeners(n)}}},{key:"teardown",value:function(){var n=this.rootElement;if(n!==void 0&&(n.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var r;(r=this.window)===null||r===void 0||r.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:"connectDragPreview",value:function(n,r,o){var s=this;return this.sourcePreviewNodeOptions.set(n,o),this.sourcePreviewNodes.set(n,r),function(){s.sourcePreviewNodes.delete(n),s.sourcePreviewNodeOptions.delete(n)}}},{key:"connectDragSource",value:function(n,r,o){var s=this;this.sourceNodes.set(n,r),this.sourceNodeOptions.set(n,o);var a=function(u){return s.handleDragStart(u,n)},l=function(u){return s.handleSelectStart(u)};return r.setAttribute("draggable","true"),r.addEventListener("dragstart",a),r.addEventListener("selectstart",l),function(){s.sourceNodes.delete(n),s.sourceNodeOptions.delete(n),r.removeEventListener("dragstart",a),r.removeEventListener("selectstart",l),r.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(n,r){var o=this,s=function(u){return o.handleDragEnter(u,n)},a=function(u){return o.handleDragOver(u,n)},l=function(u){return o.handleDrop(u,n)};return r.addEventListener("dragenter",s),r.addEventListener("dragover",a),r.addEventListener("drop",l),function(){r.removeEventListener("dragenter",s),r.removeEventListener("dragover",a),r.removeEventListener("drop",l)}}},{key:"addEventListeners",value:function(n){n.addEventListener&&(n.addEventListener("dragstart",this.handleTopDragStart),n.addEventListener("dragstart",this.handleTopDragStartCapture,!0),n.addEventListener("dragend",this.handleTopDragEndCapture,!0),n.addEventListener("dragenter",this.handleTopDragEnter),n.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),n.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),n.addEventListener("dragover",this.handleTopDragOver),n.addEventListener("dragover",this.handleTopDragOverCapture,!0),n.addEventListener("drop",this.handleTopDrop),n.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(n){n.removeEventListener&&(n.removeEventListener("dragstart",this.handleTopDragStart),n.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),n.removeEventListener("dragend",this.handleTopDragEndCapture,!0),n.removeEventListener("dragenter",this.handleTopDragEnter),n.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),n.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),n.removeEventListener("dragover",this.handleTopDragOver),n.removeEventListener("dragover",this.handleTopDragOverCapture,!0),n.removeEventListener("drop",this.handleTopDrop),n.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var n=this.monitor.getSourceId(),r=this.sourceNodeOptions.get(n);return Db({dropEffect:this.altKeyPressed?"copy":"move"},r||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var n=this.monitor.getSourceId(),r=this.sourcePreviewNodeOptions.get(n);return Db({anchorX:.5,anchorY:.5,captureDraggingState:!1},r||{})}},{key:"isDraggingNativeItem",value:function(){var n=this.monitor.getItemType();return Object.keys(Rb).some(function(r){return Rb[r]===n})}},{key:"beginDragNativeItem",value:function(n,r){this.clearCurrentDragSourceNode(),this.currentNativeSource=J6(n,r),this.currentNativeHandle=this.registry.addSource(n,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(n){var r=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=n;var o=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var s;return(s=r.rootElement)===null||s===void 0?void 0:s.addEventListener("mousemove",r.endDragIfSourceWasRemovedFromDOM,!0)},o)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var n;(n=this.window)===null||n===void 0||n.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(n,r){n.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(r))}},{key:"handleDragEnter",value:function(n,r){this.dragEnterTargetIds.unshift(r)}},{key:"handleDragOver",value:function(n,r){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(r)}},{key:"handleDrop",value:function(n,r){this.dropTargetIds.unshift(r)}}]),e}(),sH=function(t,n,r){return new oH(t,n,r)},aH=Object.create,NN=Object.defineProperty,iH=Object.getOwnPropertyDescriptor,RN=Object.getOwnPropertyNames,lH=Object.getPrototypeOf,cH=Object.prototype.hasOwnProperty,uH=(e,t)=>function(){return t||(0,e[RN(e)[0]])((t={exports:{}}).exports,t),t.exports},dH=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of RN(t))!cH.call(e,o)&&o!==n&&NN(e,o,{get:()=>t[o],enumerable:!(r=iH(t,o))||r.enumerable});return e},PN=(e,t,n)=>(n=e!=null?aH(lH(e)):{},dH(NN(n,"default",{value:e,enumerable:!0}),e)),IN=uH({"node_modules/classnames/index.js"(e,t){(function(){var n={}.hasOwnProperty;function r(){for(var o=[],s=0;s-1}var w8=x8,b8=9007199254740991,S8=/^(?:0|[1-9]\d*)$/;function C8(e,t){var n=typeof e;return t=t??b8,!!t&&(n=="number"||n!="symbol"&&S8.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=E8}var $N=T8;function k8(e){return e!=null&&$N(e.length)&&!FN(e)}var N8=k8,R8=Object.prototype;function P8(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||R8;return e===n}var I8=P8;function D8(e,t){for(var n=-1,r=Array(e);++n-1}var u9=c9;function d9(e,t){var n=this.__data__,r=Vp(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var f9=d9;function el(e){var t=-1,n=e==null?0:e.length;for(this.clear();++tl))return!1;var u=s.get(e),d=s.get(t);if(u&&d)return u==t&&d==e;var p=-1,f=!0,h=n&xG?new WN:void 0;for(s.set(e,t),s.set(t,e);++p":">",'"':""","'":"'"},XG=P9(YG),QG=XG,JN=/[&<>"']/g,eW=RegExp(JN.source);function tW(e){return e=GN(e),e&&eW.test(e)?e.replace(JN,QG):e}var nW=tW,YN=/[\\^$.*+?()[\]{}|]/g,rW=RegExp(YN.source);function oW(e){return e=GN(e),e&&rW.test(e)?e.replace(YN,"\\$&"):e}var sW=oW;function aW(e,t){return qG(e,t)}var iW=aW,lW=1/0,cW=wi&&1/ox(new wi([,-0]))[1]==lW?function(e){return new wi(e)}:u8,uW=cW,dW=200;function fW(e,t,n){var r=-1,o=w8,s=e.length,a=!0,l=[],c=l;if(n)a=!1,o=JG;else if(s>=dW){var u=t?null:uW(e);if(u)return ox(u);a=!1,o=KN,c=new WN}else c=t?[]:l;e:for(;++ri.jsx("button",{className:e.classNames.clearAll,onClick:e.onClick,children:"Clear all"}),vW=mW,yW=(e,t)=>{const n=t.offsetHeight,r=e.offsetHeight,o=e.offsetTop-t.scrollTop;o+r>=n?t.scrollTop+=o-n+r:o<0&&(t.scrollTop+=o)},Wm=(e,t,n,r)=>typeof r=="function"?r(e):e.length>=t&&n,xW=e=>{const t=v.createRef(),{labelField:n,minQueryLength:r,isFocused:o,classNames:s,selectedIndex:a,query:l}=e;v.useEffect(()=>{if(!t.current)return;const p=t.current.querySelector(`.${s.activeSuggestion}`);p&&yW(p,t.current)},[a]);const c=(p,f)=>{const h=f.trim().replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),{[n]:g}=p;return{__html:g.replace(RegExp(h,"gi"),m=>`${nW(m)}`)}},u=(p,f)=>typeof e.renderSuggestion=="function"?e.renderSuggestion(p,f):i.jsx("span",{dangerouslySetInnerHTML:c(p,f)}),d=e.suggestions.map((p,f)=>i.jsx("li",{onMouseDown:e.handleClick.bind(null,f),onTouchStart:e.handleClick.bind(null,f),onMouseOver:e.handleHover.bind(null,f),className:f===e.selectedIndex?e.classNames.activeSuggestion:"",children:u(p,e.query)},f));return d.length===0||!Wm(l,r||2,o,e.shouldRenderSuggestions)?null:i.jsx("div",{ref:t,className:s.suggestions,"data-testid":"suggestions",children:i.jsxs("ul",{children:[" ",d," "]})})},wW=(e,t)=>{const{query:n,minQueryLength:r=2,isFocused:o,suggestions:s}=t;return!!(e.isFocused===o&&iW(e.suggestions,s)&&Wm(n,r,o,t.shouldRenderSuggestions)===Wm(e.query,e.minQueryLength??2,e.isFocused,e.shouldRenderSuggestions)&&e.selectedIndex===t.selectedIndex)},bW=v.memo(xW,wW),SW=bW,CW=PN(IN()),jW=PN(IN());function _W(e){const t=e.map(r=>{const o=r-48*Math.floor(r/48);return String.fromCharCode(96<=r?o:r)}).join(""),n=sW(t);return new RegExp(`[${n}]+`)}function EW(e){switch(e){case Zs.ENTER:return[10,13];case Zs.TAB:return 9;case Zs.COMMA:return 188;case Zs.SPACE:return 32;case Zs.SEMICOLON:return 186;default:return 0}}function sS(e){const{moveTag:t,readOnly:n,allowDragDrop:r}=e;return t!==void 0&&!n&&r}function TW(e){const{readOnly:t,allowDragDrop:n}=e;return!t&&n}var kW=e=>{const{readOnly:t,removeComponent:n,onRemove:r,className:o,tag:s,index:a}=e,l=u=>{if(xi.ENTER.includes(u.keyCode)||u.keyCode===xi.SPACE){u.preventDefault(),u.stopPropagation();return}u.keyCode===xi.BACKSPACE&&r(u)};if(t)return i.jsx("span",{});const c=`Tag at index ${a} with value ${s.id} focussed. Press backspace to remove`;if(n){const u=n;return i.jsx(u,{"data-testid":"remove",onRemove:r,onKeyDown:l,className:o,"aria-label":c,tag:s,index:a})}return i.jsx("button",{"data-testid":"remove",onClick:r,onKeyDown:l,className:o,type:"button","aria-label":c,children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"12",width:"12",fill:"#fff",children:i.jsx("path",{d:"M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z"})})})},NW=kW,aS={TAG:"tag"},RW=e=>{const t=v.useRef(null),{readOnly:n=!1,tag:r,classNames:o,index:s,moveTag:a,allowDragDrop:l=!0,labelField:c="text",tags:u}=e,[{isDragging:d},p]=g6(()=>({type:aS.TAG,collect:w=>({isDragging:!!w.isDragging()}),item:e,canDrag:()=>sS({moveTag:a,readOnly:n,allowDragDrop:l})}),[u]),[,f]=P6(()=>({accept:aS.TAG,drop:w=>{var b;const x=w.index,y=s;x!==y&&((b=e==null?void 0:e.moveTag)==null||b.call(e,x,y))},canDrop:w=>TW(w)}),[u]);p(f(t));const h=e.tag[c],{className:g=""}=r,m=d?0:1;return i.jsxs("span",{ref:t,className:(0,jW.default)("tag-wrapper",o.tag,g),style:{opacity:m,cursor:sS({moveTag:a,readOnly:n,allowDragDrop:l})?"move":"auto"},"data-testid":"tag",onClick:e.onTagClicked,onTouchStart:e.onTagClicked,children:[h,i.jsx(NW,{tag:e.tag,className:o.remove,removeComponent:e.removeComponent,onRemove:e.onDelete,readOnly:n,index:s})]})},PW=e=>{const{autofocus:t,autoFocus:n,readOnly:r,labelField:o,allowDeleteFromEmptyInput:s,allowAdditionFromPaste:a,allowDragDrop:l,minQueryLength:c,shouldRenderSuggestions:u,removeComponent:d,autocomplete:p,inline:f,maxTags:h,allowUnique:g,editable:m,placeholder:w,delimiters:x,separators:y,tags:b,inputFieldPosition:C,inputProps:j,classNames:S,maxLength:k,inputValue:E,clearAll:O}=e,[F,Z]=v.useState(e.suggestions),[I,q]=v.useState(""),[H,J]=v.useState(!1),[ne,K]=v.useState(-1),[z,L]=v.useState(!1),[ee,fe]=v.useState(""),[B,te]=v.useState(-1),[X,ie]=v.useState(""),re=v.createRef(),W=v.useRef(null),we=v.useRef(null);v.useEffect(()=>{x.length&&console.warn("[Deprecation] The delimiters prop is deprecated and will be removed in v7.x.x, please use separators instead. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/960")},[]),v.useEffect(()=>{typeof f<"u"&&console.warn("[Deprecation] The inline attribute is deprecated and will be removed in v7.x.x, please use inputFieldPosition instead.")},[f]),v.useEffect(()=>{typeof t<"u"&&console.warn("[Deprecated] autofocus prop will be removed in 7.x so please migrate to autoFocus prop."),(t||n&&t!==!1)&&!r&&Pe()},[n,n,r]),v.useEffect(()=>{Lt()},[I,e.suggestions]);const Re=ce=>{let ze=e.suggestions.slice();if(g){const fn=b.map(Br=>Br.id.trim().toLowerCase());ze=ze.filter(Br=>!fn.includes(Br.id.toLowerCase()))}if(e.handleFilterSuggestions)return e.handleFilterSuggestions(ce,ze);const pt=ze.filter(fn=>Fe(ce,fn)===0),ot=ze.filter(fn=>Fe(ce,fn)>0);return pt.concat(ot)},Fe=(ce,ze)=>ze[o].toLowerCase().indexOf(ce.toLowerCase()),Pe=()=>{q(""),W.current&&(W.current.value="",W.current.focus())},ge=(ce,ze)=>{var ot;ze.preventDefault(),ze.stopPropagation();const pt=b.slice();pt.length!==0&&(ie(""),(ot=e==null?void 0:e.handleDelete)==null||ot.call(e,ce,ze),Xe(ce,pt))},Xe=(ce,ze)=>{var fn;if(!(re!=null&&re.current))return;const pt=re.current.querySelectorAll(".ReactTags__remove");let ot="";ce===0&&ze.length>1?(ot=`Tag at index ${ce} with value ${ze[ce].id} deleted. Tag at index 0 with value ${ze[1].id} focussed. Press backspace to remove`,pt[0].focus()):ce>0?(ot=`Tag at index ${ce} with value ${ze[ce].id} deleted. Tag at index ${ce-1} with value ${ze[ce-1].id} focussed. Press backspace to remove`,pt[ce-1].focus()):(ot=`Tag at index ${ce} with value ${ze[ce].id} deleted. Input focussed. Press enter to add a new tag`,(fn=W.current)==null||fn.focus()),fe(ot)},kt=(ce,ze,pt)=>{var ot,fn;r||(m&&(te(ce),q(ze[o]),(ot=we.current)==null||ot.focus()),(fn=e.handleTagClick)==null||fn.call(e,ce,pt))},Ut=ce=>{e.handleInputChange&&e.handleInputChange(ce.target.value,ce);const ze=ce.target.value.trim();q(ze)},Lt=()=>{const ce=Re(I);Z(ce),K(ne>=ce.length?ce.length-1:ne)},Wt=ce=>{const ze=ce.target.value;e.handleInputFocus&&e.handleInputFocus(ze,ce),J(!0)},_=ce=>{const ze=ce.target.value;e.handleInputBlur&&(e.handleInputBlur(ze,ce),W.current&&(W.current.value="")),J(!1),te(-1)},D=ce=>{if(ce.key==="Escape"&&(ce.preventDefault(),ce.stopPropagation(),K(-1),L(!1),Z([]),te(-1)),(y.indexOf(ce.key)!==-1||x.indexOf(ce.keyCode)!==-1)&&!ce.shiftKey){(ce.keyCode!==xi.TAB||I!=="")&&ce.preventDefault();const ze=z&&ne!==-1?F[ne]:{id:I.trim(),[o]:I.trim(),className:""};Object.keys(ze)&&le(ze)}ce.key==="Backspace"&&I===""&&(s||C===_l.INLINE)&&ge(b.length-1,ce),ce.keyCode===xi.UP_ARROW&&(ce.preventDefault(),K(ne<=0?F.length-1:ne-1),L(!0)),ce.keyCode===xi.DOWN_ARROW&&(ce.preventDefault(),L(!0),F.length===0?K(-1):K((ne+1)%F.length))},U=()=>h&&b.length>=h,pe=ce=>{if(!a)return;if(U()){ie(Mb.TAG_LIMIT),Pe();return}ie(""),ce.preventDefault();const ze=ce.clipboardData||window.clipboardData,pt=ze.getData("text"),{maxLength:ot=pt.length}=e,fn=Math.min(ot,pt.length),Br=ze.getData("text").substr(0,fn);let Zo=x;y.length&&(Zo=[],y.forEach(Hr=>{const ol=EW(Hr);Array.isArray(ol)?Zo=[...Zo,...ol]:Zo.push(ol)}));const rl=_W(Zo),Ra=Br.split(rl).map(Hr=>Hr.trim());gW(Ra).forEach(Hr=>le({id:Hr.trim(),[o]:Hr.trim(),className:""}))},le=ce=>{var pt;if(!ce.id||!ce[o])return;if(B===-1){if(U()){ie(Mb.TAG_LIMIT),Pe();return}ie("")}const ze=b.map(ot=>ot.id.toLowerCase());if(!(g&&ze.indexOf(ce.id.trim().toLowerCase())>=0)){if(p){const ot=Re(ce[o]);console.warn("[Deprecation] The autocomplete prop will be removed in 7.x to simplify the integration and make it more intutive. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/949"),(p===1&&ot.length===1||p===!0&&ot.length)&&(ce=ot[0])}B!==-1&&e.onTagUpdate?e.onTagUpdate(B,ce):(pt=e==null?void 0:e.handleAddition)==null||pt.call(e,ce),q(""),L(!1),K(-1),te(-1),Pe()}},oe=ce=>{le(F[ce])},be=()=>{e.onClearAll&&e.onClearAll(),ie(""),Pe()},Je=ce=>{K(ce),L(!0)},yt=(ce,ze)=>{var ot;const pt=b[ce];(ot=e==null?void 0:e.handleDrag)==null||ot.call(e,pt,ce,ze)},rn=(()=>{const ce={...Ob,...e.classNames};return b.map((ze,pt)=>i.jsx(v.Fragment,{children:B===pt?i.jsx("div",{className:ce.editTagInput,children:i.jsx("input",{ref:ot=>{we.current=ot},onFocus:Wt,value:I,onChange:Ut,onKeyDown:D,onBlur:_,className:ce.editTagInputField,onPaste:pe,"data-testid":"tag-edit"})}):i.jsx(RW,{index:pt,tag:ze,tags:b,labelField:o,onDelete:ot=>ge(pt,ot),moveTag:l?yt:void 0,removeComponent:d,onTagClicked:ot=>kt(pt,ze,ot),readOnly:r,classNames:ce,allowDragDrop:l})},pt))})(),Xt={...Ob,...S},{name:qo,id:Ur}=e,Bs=f===!1?_l.BOTTOM:C,_n=r?null:i.jsxs("div",{className:Xt.tagInput,children:[i.jsx("input",{...j,ref:ce=>{W.current=ce},className:Xt.tagInputField,type:"text",placeholder:w,"aria-label":w,onFocus:Wt,onBlur:_,onChange:Ut,onKeyDown:D,onPaste:pe,name:qo,id:Ur,maxLength:k,value:E,"data-automation":"input","data-testid":"input"}),i.jsx(SW,{query:I.trim(),suggestions:F,labelField:o,selectedIndex:ne,handleClick:oe,handleHover:Je,minQueryLength:c,shouldRenderSuggestions:u,isFocused:H,classNames:Xt,renderSuggestion:e.renderSuggestion}),O&&b.length>0&&i.jsx(vW,{classNames:Xt,onClick:be}),X&&i.jsxs("div",{"data-testid":"error",className:"ReactTags__error",children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"24",width:"24",fill:"#e03131",children:i.jsx("path",{d:"M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"})}),X]})]});return i.jsxs("div",{className:(0,CW.default)(Xt.tags,"react-tags-wrapper"),ref:re,children:[i.jsx("p",{role:"alert",className:"sr-only",style:{position:"absolute",overflow:"hidden",clip:"rect(0 0 0 0)",margin:"-1px",padding:0,width:"1px",height:"1px",border:0},children:ee}),Bs===_l.TOP&&_n,i.jsxs("div",{className:Xt.selected,children:[rn,Bs===_l.INLINE&&_n]}),Bs===_l.BOTTOM&&_n]})},IW=PW,DW=e=>{var X;const{placeholder:t=fH,labelField:n=pH,suggestions:r=[],delimiters:o=[],separators:s=(X=e.delimiters)!=null&&X.length?[]:[Zs.ENTER,Zs.TAB],autofocus:a,autoFocus:l=!0,inline:c,inputFieldPosition:u="inline",allowDeleteFromEmptyInput:d=!1,allowAdditionFromPaste:p=!0,autocomplete:f=!1,readOnly:h=!1,allowUnique:g=!0,allowDragDrop:m=!0,tags:w=[],inputProps:x={},editable:y=!1,clearAll:b=!1,handleDelete:C,handleAddition:j,onTagUpdate:S,handleDrag:k,handleFilterSuggestions:E,handleTagClick:O,handleInputChange:F,handleInputFocus:Z,handleInputBlur:I,minQueryLength:q,shouldRenderSuggestions:H,removeComponent:J,onClearAll:ne,classNames:K,name:z,id:L,maxLength:ee,inputValue:fe,maxTags:B,renderSuggestion:te}=e;return i.jsx(IW,{placeholder:t,labelField:n,suggestions:r,delimiters:o,separators:s,autofocus:a,autoFocus:l,inline:c,inputFieldPosition:u,allowDeleteFromEmptyInput:d,allowAdditionFromPaste:p,autocomplete:f,readOnly:h,allowUnique:g,allowDragDrop:m,tags:w,inputProps:x,editable:y,clearAll:b,handleDelete:C,handleAddition:j,onTagUpdate:S,handleDrag:k,handleFilterSuggestions:E,handleTagClick:O,handleInputChange:F,handleInputFocus:Z,handleInputBlur:I,minQueryLength:q,shouldRenderSuggestions:H,removeComponent:J,onClearAll:ne,classNames:K,name:z,id:L,maxLength:ee,inputValue:fe,maxTags:B,renderSuggestion:te})},sx=({...e})=>i.jsx(uB,{backend:sH,children:i.jsx(DW,{...e})});/*! Bundled license information: +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c6(e,t){if(e){if(typeof e=="string")return _b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _b(e,t)}}function _b(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0}},{key:"leave",value:function(n){var r=this.entered.length;return this.entered=I6(this.entered.filter(this.isNodeInDocument),n),r>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),L6=CN(function(){return/firefox/i.test(navigator.userAgent)}),jN=CN(function(){return!!window.safari});function $6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z6(e,t){for(var n=0;nn)d=p-1;else return o[p]}c=Math.max(0,d);var h=n-r[c],g=h*h;return o[c]+s[c]*h+a[c]*g+l[c]*h*g}}]),e}(),U6=1;function _N(e){var t=e.nodeType===U6?e:e.parentElement;if(!t)return null;var n=t.getBoundingClientRect(),r=n.top,o=n.left;return{x:o,y:r}}function Qu(e){return{x:e.clientX,y:e.clientY}}function B6(e){var t;return e.nodeName==="IMG"&&(L6()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function H6(e,t,n,r){var o=e?t.width:n,s=e?t.height:r;return jN()&&e&&(s/=window.devicePixelRatio,o/=window.devicePixelRatio),{dragPreviewWidth:o,dragPreviewHeight:s}}function G6(e,t,n,r,o){var s=B6(t),a=s?e:t,l=_N(a),c={x:n.x-l.x,y:n.y-l.y},u=e.offsetWidth,d=e.offsetHeight,p=r.anchorX,f=r.anchorY,h=H6(s,t,u,d),g=h.dragPreviewWidth,m=h.dragPreviewHeight,w=function(){var k=new Nb([0,.5,1],[c.y,c.y/d*m,c.y+m-d]),E=k.interpolate(f);return jN()&&s&&(E+=(window.devicePixelRatio-1)*m),E},x=function(){var k=new Nb([0,.5,1],[c.x,c.x/u*g,c.x+g-u]);return k.interpolate(p)},y=o.offsetX,b=o.offsetY,C=y===0||y,j=b===0||b;return{x:C?y:x(),y:j?b:w()}}var EN="__NATIVE_FILE__",TN="__NATIVE_URL__",kN="__NATIVE_TEXT__",NN="__NATIVE_HTML__";const Rb=Object.freeze(Object.defineProperty({__proto__:null,FILE:EN,HTML:NN,TEXT:kN,URL:TN},Symbol.toStringTag,{value:"Module"}));function eg(e,t,n){var r=t.reduce(function(o,s){return o||e.getData(s)},"");return r??n}var Ha;function ed(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vm=(Ha={},ed(Ha,EN,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),ed(Ha,NN,{exposeProperties:{html:function(t,n){return eg(t,n,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),ed(Ha,TN,{exposeProperties:{urls:function(t,n){return eg(t,n,"").split(` +`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),ed(Ha,kN,{exposeProperties:{text:function(t,n){return eg(t,n,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),Ha);function W6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K6(e,t){for(var n=0;n-1})})[0]||null}function Y6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X6(e,t){for(var n=0;n0&&o.actions.hover(a,{clientOffset:Qu(s)});var l=a.some(function(c){return o.monitor.canDropOnTarget(c)});l&&(s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect=o.getCurrentDropEffect()))}}),Qe(this,"handleTopDragOverCapture",function(){o.dragOverTargetIds=[]}),Qe(this,"handleTopDragOver",function(s){var a=o.dragOverTargetIds;if(o.dragOverTargetIds=[],!o.monitor.isDragging()){s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect="none");return}o.altKeyPressed=s.altKey,o.lastClientOffset=Qu(s),o.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(o.hoverRafId=requestAnimationFrame(function(){o.monitor.isDragging()&&o.actions.hover(a||[],{clientOffset:o.lastClientOffset}),o.hoverRafId=null}));var l=(a||[]).some(function(c){return o.monitor.canDropOnTarget(c)});l?(s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect=o.getCurrentDropEffect())):o.isDraggingNativeItem()?s.preventDefault():(s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect="none"))}),Qe(this,"handleTopDragLeaveCapture",function(s){o.isDraggingNativeItem()&&s.preventDefault();var a=o.enterLeaveCounter.leave(s.target);a&&o.isDraggingNativeItem()&&setTimeout(function(){return o.endDragNativeItem()},0)}),Qe(this,"handleTopDropCapture",function(s){if(o.dropTargetIds=[],o.isDraggingNativeItem()){var a;s.preventDefault(),(a=o.currentNativeSource)===null||a===void 0||a.loadDataTransfer(s.dataTransfer)}else tg(s.dataTransfer)&&s.preventDefault();o.enterLeaveCounter.reset()}),Qe(this,"handleTopDrop",function(s){var a=o.dropTargetIds;o.dropTargetIds=[],o.actions.hover(a,{clientOffset:Qu(s)}),o.actions.drop({dropEffect:o.getCurrentDropEffect()}),o.isDraggingNativeItem()?o.endDragNativeItem():o.monitor.isDragging()&&o.actions.endDrag()}),Qe(this,"handleSelectStart",function(s){var a=s.target;typeof a.dragDrop=="function"&&(a.tagName==="INPUT"||a.tagName==="SELECT"||a.tagName==="TEXTAREA"||a.isContentEditable||(s.preventDefault(),a.dragDrop()))}),this.options=new eH(n,r),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new F6(this.isNodeInDocument)}return rH(e,[{key:"profile",value:function(){var n,r;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((n=this.dragStartSourceIds)===null||n===void 0?void 0:n.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((r=this.dragOverTargetIds)===null||r===void 0?void 0:r.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var n=this.rootElement;if(n!==void 0){if(n.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");n.__isReactDndBackendSetUp=!0,this.addEventListeners(n)}}},{key:"teardown",value:function(){var n=this.rootElement;if(n!==void 0&&(n.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var r;(r=this.window)===null||r===void 0||r.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:"connectDragPreview",value:function(n,r,o){var s=this;return this.sourcePreviewNodeOptions.set(n,o),this.sourcePreviewNodes.set(n,r),function(){s.sourcePreviewNodes.delete(n),s.sourcePreviewNodeOptions.delete(n)}}},{key:"connectDragSource",value:function(n,r,o){var s=this;this.sourceNodes.set(n,r),this.sourceNodeOptions.set(n,o);var a=function(u){return s.handleDragStart(u,n)},l=function(u){return s.handleSelectStart(u)};return r.setAttribute("draggable","true"),r.addEventListener("dragstart",a),r.addEventListener("selectstart",l),function(){s.sourceNodes.delete(n),s.sourceNodeOptions.delete(n),r.removeEventListener("dragstart",a),r.removeEventListener("selectstart",l),r.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(n,r){var o=this,s=function(u){return o.handleDragEnter(u,n)},a=function(u){return o.handleDragOver(u,n)},l=function(u){return o.handleDrop(u,n)};return r.addEventListener("dragenter",s),r.addEventListener("dragover",a),r.addEventListener("drop",l),function(){r.removeEventListener("dragenter",s),r.removeEventListener("dragover",a),r.removeEventListener("drop",l)}}},{key:"addEventListeners",value:function(n){n.addEventListener&&(n.addEventListener("dragstart",this.handleTopDragStart),n.addEventListener("dragstart",this.handleTopDragStartCapture,!0),n.addEventListener("dragend",this.handleTopDragEndCapture,!0),n.addEventListener("dragenter",this.handleTopDragEnter),n.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),n.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),n.addEventListener("dragover",this.handleTopDragOver),n.addEventListener("dragover",this.handleTopDragOverCapture,!0),n.addEventListener("drop",this.handleTopDrop),n.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(n){n.removeEventListener&&(n.removeEventListener("dragstart",this.handleTopDragStart),n.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),n.removeEventListener("dragend",this.handleTopDragEndCapture,!0),n.removeEventListener("dragenter",this.handleTopDragEnter),n.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),n.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),n.removeEventListener("dragover",this.handleTopDragOver),n.removeEventListener("dragover",this.handleTopDragOverCapture,!0),n.removeEventListener("drop",this.handleTopDrop),n.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var n=this.monitor.getSourceId(),r=this.sourceNodeOptions.get(n);return Db({dropEffect:this.altKeyPressed?"copy":"move"},r||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var n=this.monitor.getSourceId(),r=this.sourcePreviewNodeOptions.get(n);return Db({anchorX:.5,anchorY:.5,captureDraggingState:!1},r||{})}},{key:"isDraggingNativeItem",value:function(){var n=this.monitor.getItemType();return Object.keys(Rb).some(function(r){return Rb[r]===n})}},{key:"beginDragNativeItem",value:function(n,r){this.clearCurrentDragSourceNode(),this.currentNativeSource=J6(n,r),this.currentNativeHandle=this.registry.addSource(n,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(n){var r=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=n;var o=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var s;return(s=r.rootElement)===null||s===void 0?void 0:s.addEventListener("mousemove",r.endDragIfSourceWasRemovedFromDOM,!0)},o)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var n;(n=this.window)===null||n===void 0||n.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(n,r){n.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(r))}},{key:"handleDragEnter",value:function(n,r){this.dragEnterTargetIds.unshift(r)}},{key:"handleDragOver",value:function(n,r){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(r)}},{key:"handleDrop",value:function(n,r){this.dropTargetIds.unshift(r)}}]),e}(),sH=function(t,n,r){return new oH(t,n,r)},aH=Object.create,RN=Object.defineProperty,iH=Object.getOwnPropertyDescriptor,PN=Object.getOwnPropertyNames,lH=Object.getPrototypeOf,cH=Object.prototype.hasOwnProperty,uH=(e,t)=>function(){return t||(0,e[PN(e)[0]])((t={exports:{}}).exports,t),t.exports},dH=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of PN(t))!cH.call(e,o)&&o!==n&&RN(e,o,{get:()=>t[o],enumerable:!(r=iH(t,o))||r.enumerable});return e},IN=(e,t,n)=>(n=e!=null?aH(lH(e)):{},dH(RN(n,"default",{value:e,enumerable:!0}),e)),DN=uH({"node_modules/classnames/index.js"(e,t){(function(){var n={}.hasOwnProperty;function r(){for(var o=[],s=0;s-1}var w8=x8,b8=9007199254740991,S8=/^(?:0|[1-9]\d*)$/;function C8(e,t){var n=typeof e;return t=t??b8,!!t&&(n=="number"||n!="symbol"&&S8.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=E8}var zN=T8;function k8(e){return e!=null&&zN(e.length)&&!LN(e)}var N8=k8,R8=Object.prototype;function P8(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||R8;return e===n}var I8=P8;function D8(e,t){for(var n=-1,r=Array(e);++n-1}var u9=c9;function d9(e,t){var n=this.__data__,r=Vp(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var f9=d9;function el(e){var t=-1,n=e==null?0:e.length;for(this.clear();++tl))return!1;var u=s.get(e),d=s.get(t);if(u&&d)return u==t&&d==e;var p=-1,f=!0,h=n&xG?new KN:void 0;for(s.set(e,t),s.set(t,e);++p":">",'"':""","'":"'"},XG=P9(YG),QG=XG,YN=/[&<>"']/g,eW=RegExp(YN.source);function tW(e){return e=WN(e),e&&eW.test(e)?e.replace(YN,QG):e}var nW=tW,XN=/[\\^$.*+?()[\]{}|]/g,rW=RegExp(XN.source);function oW(e){return e=WN(e),e&&rW.test(e)?e.replace(XN,"\\$&"):e}var sW=oW;function aW(e,t){return qG(e,t)}var iW=aW,lW=1/0,cW=bi&&1/ox(new bi([,-0]))[1]==lW?function(e){return new bi(e)}:u8,uW=cW,dW=200;function fW(e,t,n){var r=-1,o=w8,s=e.length,a=!0,l=[],c=l;if(n)a=!1,o=JG;else if(s>=dW){var u=t?null:uW(e);if(u)return ox(u);a=!1,o=qN,c=new KN}else c=t?[]:l;e:for(;++ri.jsx("button",{className:e.classNames.clearAll,onClick:e.onClick,children:"Clear all"}),vW=mW,yW=(e,t)=>{const n=t.offsetHeight,r=e.offsetHeight,o=e.offsetTop-t.scrollTop;o+r>=n?t.scrollTop+=o-n+r:o<0&&(t.scrollTop+=o)},Wm=(e,t,n,r)=>typeof r=="function"?r(e):e.length>=t&&n,xW=e=>{const t=v.createRef(),{labelField:n,minQueryLength:r,isFocused:o,classNames:s,selectedIndex:a,query:l}=e;v.useEffect(()=>{if(!t.current)return;const p=t.current.querySelector(`.${s.activeSuggestion}`);p&&yW(p,t.current)},[a]);const c=(p,f)=>{const h=f.trim().replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),{[n]:g}=p;return{__html:g.replace(RegExp(h,"gi"),m=>`${nW(m)}`)}},u=(p,f)=>typeof e.renderSuggestion=="function"?e.renderSuggestion(p,f):i.jsx("span",{dangerouslySetInnerHTML:c(p,f)}),d=e.suggestions.map((p,f)=>i.jsx("li",{onMouseDown:e.handleClick.bind(null,f),onTouchStart:e.handleClick.bind(null,f),onMouseOver:e.handleHover.bind(null,f),className:f===e.selectedIndex?e.classNames.activeSuggestion:"",children:u(p,e.query)},f));return d.length===0||!Wm(l,r||2,o,e.shouldRenderSuggestions)?null:i.jsx("div",{ref:t,className:s.suggestions,"data-testid":"suggestions",children:i.jsxs("ul",{children:[" ",d," "]})})},wW=(e,t)=>{const{query:n,minQueryLength:r=2,isFocused:o,suggestions:s}=t;return!!(e.isFocused===o&&iW(e.suggestions,s)&&Wm(n,r,o,t.shouldRenderSuggestions)===Wm(e.query,e.minQueryLength??2,e.isFocused,e.shouldRenderSuggestions)&&e.selectedIndex===t.selectedIndex)},bW=v.memo(xW,wW),SW=bW,CW=IN(DN()),jW=IN(DN());function _W(e){const t=e.map(r=>{const o=r-48*Math.floor(r/48);return String.fromCharCode(96<=r?o:r)}).join(""),n=sW(t);return new RegExp(`[${n}]+`)}function EW(e){switch(e){case Zs.ENTER:return[10,13];case Zs.TAB:return 9;case Zs.COMMA:return 188;case Zs.SPACE:return 32;case Zs.SEMICOLON:return 186;default:return 0}}function sS(e){const{moveTag:t,readOnly:n,allowDragDrop:r}=e;return t!==void 0&&!n&&r}function TW(e){const{readOnly:t,allowDragDrop:n}=e;return!t&&n}var kW=e=>{const{readOnly:t,removeComponent:n,onRemove:r,className:o,tag:s,index:a}=e,l=u=>{if(wi.ENTER.includes(u.keyCode)||u.keyCode===wi.SPACE){u.preventDefault(),u.stopPropagation();return}u.keyCode===wi.BACKSPACE&&r(u)};if(t)return i.jsx("span",{});const c=`Tag at index ${a} with value ${s.id} focussed. Press backspace to remove`;if(n){const u=n;return i.jsx(u,{"data-testid":"remove",onRemove:r,onKeyDown:l,className:o,"aria-label":c,tag:s,index:a})}return i.jsx("button",{"data-testid":"remove",onClick:r,onKeyDown:l,className:o,type:"button","aria-label":c,children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"12",width:"12",fill:"#fff",children:i.jsx("path",{d:"M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z"})})})},NW=kW,aS={TAG:"tag"},RW=e=>{const t=v.useRef(null),{readOnly:n=!1,tag:r,classNames:o,index:s,moveTag:a,allowDragDrop:l=!0,labelField:c="text",tags:u}=e,[{isDragging:d},p]=g6(()=>({type:aS.TAG,collect:w=>({isDragging:!!w.isDragging()}),item:e,canDrag:()=>sS({moveTag:a,readOnly:n,allowDragDrop:l})}),[u]),[,f]=P6(()=>({accept:aS.TAG,drop:w=>{var b;const x=w.index,y=s;x!==y&&((b=e==null?void 0:e.moveTag)==null||b.call(e,x,y))},canDrop:w=>TW(w)}),[u]);p(f(t));const h=e.tag[c],{className:g=""}=r,m=d?0:1;return i.jsxs("span",{ref:t,className:(0,jW.default)("tag-wrapper",o.tag,g),style:{opacity:m,cursor:sS({moveTag:a,readOnly:n,allowDragDrop:l})?"move":"auto"},"data-testid":"tag",onClick:e.onTagClicked,onTouchStart:e.onTagClicked,children:[h,i.jsx(NW,{tag:e.tag,className:o.remove,removeComponent:e.removeComponent,onRemove:e.onDelete,readOnly:n,index:s})]})},PW=e=>{const{autofocus:t,autoFocus:n,readOnly:r,labelField:o,allowDeleteFromEmptyInput:s,allowAdditionFromPaste:a,allowDragDrop:l,minQueryLength:c,shouldRenderSuggestions:u,removeComponent:d,autocomplete:p,inline:f,maxTags:h,allowUnique:g,editable:m,placeholder:w,delimiters:x,separators:y,tags:b,inputFieldPosition:C,inputProps:j,classNames:S,maxLength:k,inputValue:E,clearAll:O}=e,[F,Z]=v.useState(e.suggestions),[I,q]=v.useState(""),[H,J]=v.useState(!1),[ne,K]=v.useState(-1),[z,L]=v.useState(!1),[ee,fe]=v.useState(""),[B,te]=v.useState(-1),[X,ie]=v.useState(""),re=v.createRef(),W=v.useRef(null),we=v.useRef(null);v.useEffect(()=>{x.length&&console.warn("[Deprecation] The delimiters prop is deprecated and will be removed in v7.x.x, please use separators instead. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/960")},[]),v.useEffect(()=>{typeof f<"u"&&console.warn("[Deprecation] The inline attribute is deprecated and will be removed in v7.x.x, please use inputFieldPosition instead.")},[f]),v.useEffect(()=>{typeof t<"u"&&console.warn("[Deprecated] autofocus prop will be removed in 7.x so please migrate to autoFocus prop."),(t||n&&t!==!1)&&!r&&Pe()},[n,n,r]),v.useEffect(()=>{Lt()},[I,e.suggestions]);const Re=ce=>{let ze=e.suggestions.slice();if(g){const fn=b.map(Br=>Br.id.trim().toLowerCase());ze=ze.filter(Br=>!fn.includes(Br.id.toLowerCase()))}if(e.handleFilterSuggestions)return e.handleFilterSuggestions(ce,ze);const pt=ze.filter(fn=>Fe(ce,fn)===0),ot=ze.filter(fn=>Fe(ce,fn)>0);return pt.concat(ot)},Fe=(ce,ze)=>ze[o].toLowerCase().indexOf(ce.toLowerCase()),Pe=()=>{q(""),W.current&&(W.current.value="",W.current.focus())},ge=(ce,ze)=>{var ot;ze.preventDefault(),ze.stopPropagation();const pt=b.slice();pt.length!==0&&(ie(""),(ot=e==null?void 0:e.handleDelete)==null||ot.call(e,ce,ze),Xe(ce,pt))},Xe=(ce,ze)=>{var fn;if(!(re!=null&&re.current))return;const pt=re.current.querySelectorAll(".ReactTags__remove");let ot="";ce===0&&ze.length>1?(ot=`Tag at index ${ce} with value ${ze[ce].id} deleted. Tag at index 0 with value ${ze[1].id} focussed. Press backspace to remove`,pt[0].focus()):ce>0?(ot=`Tag at index ${ce} with value ${ze[ce].id} deleted. Tag at index ${ce-1} with value ${ze[ce-1].id} focussed. Press backspace to remove`,pt[ce-1].focus()):(ot=`Tag at index ${ce} with value ${ze[ce].id} deleted. Input focussed. Press enter to add a new tag`,(fn=W.current)==null||fn.focus()),fe(ot)},kt=(ce,ze,pt)=>{var ot,fn;r||(m&&(te(ce),q(ze[o]),(ot=we.current)==null||ot.focus()),(fn=e.handleTagClick)==null||fn.call(e,ce,pt))},Ut=ce=>{e.handleInputChange&&e.handleInputChange(ce.target.value,ce);const ze=ce.target.value.trim();q(ze)},Lt=()=>{const ce=Re(I);Z(ce),K(ne>=ce.length?ce.length-1:ne)},Wt=ce=>{const ze=ce.target.value;e.handleInputFocus&&e.handleInputFocus(ze,ce),J(!0)},_=ce=>{const ze=ce.target.value;e.handleInputBlur&&(e.handleInputBlur(ze,ce),W.current&&(W.current.value="")),J(!1),te(-1)},D=ce=>{if(ce.key==="Escape"&&(ce.preventDefault(),ce.stopPropagation(),K(-1),L(!1),Z([]),te(-1)),(y.indexOf(ce.key)!==-1||x.indexOf(ce.keyCode)!==-1)&&!ce.shiftKey){(ce.keyCode!==wi.TAB||I!=="")&&ce.preventDefault();const ze=z&&ne!==-1?F[ne]:{id:I.trim(),[o]:I.trim(),className:""};Object.keys(ze)&&le(ze)}ce.key==="Backspace"&&I===""&&(s||C===_l.INLINE)&&ge(b.length-1,ce),ce.keyCode===wi.UP_ARROW&&(ce.preventDefault(),K(ne<=0?F.length-1:ne-1),L(!0)),ce.keyCode===wi.DOWN_ARROW&&(ce.preventDefault(),L(!0),F.length===0?K(-1):K((ne+1)%F.length))},U=()=>h&&b.length>=h,pe=ce=>{if(!a)return;if(U()){ie(Mb.TAG_LIMIT),Pe();return}ie(""),ce.preventDefault();const ze=ce.clipboardData||window.clipboardData,pt=ze.getData("text"),{maxLength:ot=pt.length}=e,fn=Math.min(ot,pt.length),Br=ze.getData("text").substr(0,fn);let Zo=x;y.length&&(Zo=[],y.forEach(Hr=>{const ol=EW(Hr);Array.isArray(ol)?Zo=[...Zo,...ol]:Zo.push(ol)}));const rl=_W(Zo),Pa=Br.split(rl).map(Hr=>Hr.trim());gW(Pa).forEach(Hr=>le({id:Hr.trim(),[o]:Hr.trim(),className:""}))},le=ce=>{var pt;if(!ce.id||!ce[o])return;if(B===-1){if(U()){ie(Mb.TAG_LIMIT),Pe();return}ie("")}const ze=b.map(ot=>ot.id.toLowerCase());if(!(g&&ze.indexOf(ce.id.trim().toLowerCase())>=0)){if(p){const ot=Re(ce[o]);console.warn("[Deprecation] The autocomplete prop will be removed in 7.x to simplify the integration and make it more intutive. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/949"),(p===1&&ot.length===1||p===!0&&ot.length)&&(ce=ot[0])}B!==-1&&e.onTagUpdate?e.onTagUpdate(B,ce):(pt=e==null?void 0:e.handleAddition)==null||pt.call(e,ce),q(""),L(!1),K(-1),te(-1),Pe()}},oe=ce=>{le(F[ce])},be=()=>{e.onClearAll&&e.onClearAll(),ie(""),Pe()},Je=ce=>{K(ce),L(!0)},yt=(ce,ze)=>{var ot;const pt=b[ce];(ot=e==null?void 0:e.handleDrag)==null||ot.call(e,pt,ce,ze)},rn=(()=>{const ce={...Ob,...e.classNames};return b.map((ze,pt)=>i.jsx(v.Fragment,{children:B===pt?i.jsx("div",{className:ce.editTagInput,children:i.jsx("input",{ref:ot=>{we.current=ot},onFocus:Wt,value:I,onChange:Ut,onKeyDown:D,onBlur:_,className:ce.editTagInputField,onPaste:pe,"data-testid":"tag-edit"})}):i.jsx(RW,{index:pt,tag:ze,tags:b,labelField:o,onDelete:ot=>ge(pt,ot),moveTag:l?yt:void 0,removeComponent:d,onTagClicked:ot=>kt(pt,ze,ot),readOnly:r,classNames:ce,allowDragDrop:l})},pt))})(),Xt={...Ob,...S},{name:qo,id:Ur}=e,Bs=f===!1?_l.BOTTOM:C,_n=r?null:i.jsxs("div",{className:Xt.tagInput,children:[i.jsx("input",{...j,ref:ce=>{W.current=ce},className:Xt.tagInputField,type:"text",placeholder:w,"aria-label":w,onFocus:Wt,onBlur:_,onChange:Ut,onKeyDown:D,onPaste:pe,name:qo,id:Ur,maxLength:k,value:E,"data-automation":"input","data-testid":"input"}),i.jsx(SW,{query:I.trim(),suggestions:F,labelField:o,selectedIndex:ne,handleClick:oe,handleHover:Je,minQueryLength:c,shouldRenderSuggestions:u,isFocused:H,classNames:Xt,renderSuggestion:e.renderSuggestion}),O&&b.length>0&&i.jsx(vW,{classNames:Xt,onClick:be}),X&&i.jsxs("div",{"data-testid":"error",className:"ReactTags__error",children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"24",width:"24",fill:"#e03131",children:i.jsx("path",{d:"M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"})}),X]})]});return i.jsxs("div",{className:(0,CW.default)(Xt.tags,"react-tags-wrapper"),ref:re,children:[i.jsx("p",{role:"alert",className:"sr-only",style:{position:"absolute",overflow:"hidden",clip:"rect(0 0 0 0)",margin:"-1px",padding:0,width:"1px",height:"1px",border:0},children:ee}),Bs===_l.TOP&&_n,i.jsxs("div",{className:Xt.selected,children:[rn,Bs===_l.INLINE&&_n]}),Bs===_l.BOTTOM&&_n]})},IW=PW,DW=e=>{var X;const{placeholder:t=fH,labelField:n=pH,suggestions:r=[],delimiters:o=[],separators:s=(X=e.delimiters)!=null&&X.length?[]:[Zs.ENTER,Zs.TAB],autofocus:a,autoFocus:l=!0,inline:c,inputFieldPosition:u="inline",allowDeleteFromEmptyInput:d=!1,allowAdditionFromPaste:p=!0,autocomplete:f=!1,readOnly:h=!1,allowUnique:g=!0,allowDragDrop:m=!0,tags:w=[],inputProps:x={},editable:y=!1,clearAll:b=!1,handleDelete:C,handleAddition:j,onTagUpdate:S,handleDrag:k,handleFilterSuggestions:E,handleTagClick:O,handleInputChange:F,handleInputFocus:Z,handleInputBlur:I,minQueryLength:q,shouldRenderSuggestions:H,removeComponent:J,onClearAll:ne,classNames:K,name:z,id:L,maxLength:ee,inputValue:fe,maxTags:B,renderSuggestion:te}=e;return i.jsx(IW,{placeholder:t,labelField:n,suggestions:r,delimiters:o,separators:s,autofocus:a,autoFocus:l,inline:c,inputFieldPosition:u,allowDeleteFromEmptyInput:d,allowAdditionFromPaste:p,autocomplete:f,readOnly:h,allowUnique:g,allowDragDrop:m,tags:w,inputProps:x,editable:y,clearAll:b,handleDelete:C,handleAddition:j,onTagUpdate:S,handleDrag:k,handleFilterSuggestions:E,handleTagClick:O,handleInputChange:F,handleInputFocus:Z,handleInputBlur:I,minQueryLength:q,shouldRenderSuggestions:H,removeComponent:J,onClearAll:ne,classNames:K,name:z,id:L,maxLength:ee,inputValue:fe,maxTags:B,renderSuggestion:te})},sx=({...e})=>i.jsx(uB,{backend:sH,children:i.jsx(DW,{...e})});/*! Bundled license information: classnames/index.js: (*! @@ -348,4 +348,4 @@ lodash-es/lodash.js: * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors *) -*/const OW=T.object({openaiCredsId:T.string(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string()),openaiIdFallback:T.string().optional()}),iS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await k3(e.name,r);t(o);const s=await tN(e.name,r);n(s)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar configurações:",r)}};function MW({creds:e}){const{instance:t}=Tt(),[n,r]=v.useState([]),[o,s]=v.useState(),[a,l]=v.useState([]),c=h=>{r(n.filter((g,m)=>m!==h))},u=h=>{r([...n,h])},d=tn({resolver:nn(OW),defaultValues:{openaiCredsId:"",expire:"0",keywordFinish:"#SAIR",delayMessage:"1000",unknownMessage:"Mensagem não reconhecida",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0",ignoreJids:[],openaiIdFallback:void 0}});v.useEffect(()=>{iS(t,s,l)},[t]),v.useEffect(()=>{var h;o&&(d.reset({openaiCredsId:o.openaiCredsId,expire:o!=null&&o.expire?o.expire.toString():"0",keywordFinish:o.keywordFinish,delayMessage:o.delayMessage?o.delayMessage.toString():"0",unknownMessage:o.unknownMessage,listeningFromMe:o.listeningFromMe,stopBotFromMe:o.stopBotFromMe,keepOpen:o.keepOpen,debounceTime:o.debounceTime?o.debounceTime.toString():"0",ignoreJids:o.ignoreJids,openaiIdFallback:o.openaiIdFallback}),r(((h=o.ignoreJids)==null?void 0:h.map(g=>({id:g,text:g,className:""})))||[]))},[o]);const p=async()=>{var h,g,m;try{const w=d.getValues();if(!t||!t.name)throw new Error("Nome da instância não encontrado.");const x={openaiCredsId:w.openaiCredsId,expire:parseInt(w.expire),keywordFinish:w.keywordFinish,delayMessage:parseInt(w.delayMessage),unknownMessage:w.unknownMessage,listeningFromMe:w.listeningFromMe,stopBotFromMe:w.stopBotFromMe,keepOpen:w.keepOpen,debounceTime:parseInt(w.debounceTime),openaiIdFallback:w.openaiIdFallback||void 0,ignoreJids:n.map(y=>y.text)};await N3(t.name,t.token,x),De.success("Configuração salva com sucesso!")}catch(w){console.error("Erro ao criar bot:",w),De.error(`Erro ao criar : ${(m=(g=(h=w==null?void 0:w.response)==null?void 0:h.data)==null?void 0:g.response)==null?void 0:m.message}`)}};function f(){iS(t,s,l)}return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ru,{})," Configurações Padrão"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:f,children:[i.jsx(dn,{children:i.jsx(On,{children:"Configurações Padrão"})}),i.jsx(Uo,{...d,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:d.control,name:"openaiCredsId",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Credencial"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma credencial"})})}),i.jsx(vt,{className:"border border-gray-600",children:e.map(g=>i.jsx(he,{value:`${g.id}`,children:g.name?g.name:g.apiKey.substring(0,15)+"..."},g.id))})]})]})}),i.jsx(P,{control:d.control,name:"openaiIdFallback",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Bot Fallback"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um bot"})})}),i.jsx(vt,{className:"border border-gray-600",children:a&&a.length>0&&a.map(g=>i.jsx(he,{value:`${g.id}`,children:g.id},g.id))})]})]})}),i.jsx(P,{control:d.control,name:"expire",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:d.control,name:"keywordFinish",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:d.control,name:"delayMessage",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:d.control,name:"unknownMessage",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:d.control,name:"listeningFromMe",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:d.control,name:"stopBotFromMe",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:d.control,name:"keepOpen",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:d.control,name:"debounceTime",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})}),i.jsx(P,{control:d.control,name:"ignoreJids",render:({field:h})=>i.jsxs("div",{className:"pb-4",children:[i.jsx("label",{className:"block text-sm font-medium",children:"Ignorar JIDs"}),i.jsx(sx,{tags:n,handleDelete:c,handleAddition:u,inputFieldPosition:"bottom",placeholder:"Adicionar JIDs ex: 1234567890@s.whatsapp.net",autoFocus:!1,classNames:{tags:"tagsClass",tagInput:"tagInputClass",tagInputField:"tagInputFieldClass",selected:"selectedClass",tag:"tagClass",remove:"removeClass",suggestions:"suggestionsClass",activeSuggestion:"activeSuggestionClass",editTagInput:"editTagInputClass",editTagInputField:"editTagInputFieldClass",clearAll:"clearAllClass"}}),i.jsx("input",{type:"hidden",...h,value:n.map(g=>g.text).join(",")})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{variant:"default",type:"button",onClick:p,children:"Salvar"})})]})})]})]})}const lS=async(e,t,n,r)=>{try{const o=localStorage.getItem("token");if(o&&e&&e.name){const s=await tN(e.name,o);t(s);const a=await eN(e.name,o);n(a)}else console.error("Token ou nome da instância não encontrados.");r(!1)}catch(o){console.error("Erro ao carregar configurações:",o),r(!1)}};function cS(){const{instance:e}=Tt(),{openaiBotId:t}=Vi(),[n,r]=v.useState(!0),[o,s]=v.useState([]),[a,l]=v.useState([]),c=ir();v.useEffect(()=>{lS(e,s,l,r)},[e]);const u=p=>{e&&c(`/manager/instance/${e.id}/openai/${p}`)},d=()=>{lS(e,s,l,r)};return i.jsxs("main",{className:"main-table pt-5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"ml-5 mb-1 text-lg font-medium",children:"Openai Bots"}),i.jsxs("div",{children:[i.jsx(MW,{creds:a}),i.jsx(PU,{}),i.jsx(NU,{resetTable:d,creds:a})]})]}),i.jsx(Dt,{className:"mt-4 border border-black"}),i.jsxs(su,{direction:"horizontal",children:[i.jsx(ro,{defaultSize:35,className:"p-5",children:i.jsx("div",{className:"table",children:n?i.jsx(Fo,{}):i.jsx(i.Fragment,{children:o&&o.length>0?o.map(p=>i.jsxs("div",{className:`table-item ${p.id===t?"selected":""}`,onClick:()=>u(`${p.id}`),children:[i.jsx("h3",{className:"table-item-title",children:p.id}),i.jsx("p",{className:"table-item-description",children:p.botType})]})):i.jsx("p",{children:"Nenhum bot encontrado."})})})}),i.jsx(au,{withHandle:!0,className:"border border-black"}),i.jsx(ro,{className:"",children:t&&i.jsx(TU,{creds:a,openaiBotId:t,instance:e,resetTable:d})})]})]})}const XN=new zr,AW=async(e,t)=>(await XN.getInstance().get(`/proxy/find/${e}`,{headers:{apikey:t}})).data,FW=async(e,t,n)=>(await XN.getInstance().post(`/proxy/set/${e}`,n,{headers:{apikey:t}})).data,LW=T.object({enabled:T.boolean(),host:T.string(),port:T.string(),protocol:T.string(),username:T.string(),password:T.string()});function $W(){const{instance:e}=Tt(),[t,n]=v.useState(!1),r=tn({resolver:nn(LW),defaultValues:{enabled:!1,host:"",port:"",protocol:"http",username:"",password:""}});v.useEffect(()=>{(async()=>{if(e){n(!0);try{const a=await AW(e.name,e.token);r.reset(a)}catch(a){console.error("Erro ao buscar dados do proxy:",a)}finally{n(!1)}}})()},[e,r]);const o=async()=>{var a,l,c;if(!e)return;const s=r.getValues();n(!0);try{const u={enabled:s.enabled,host:s.host,port:s.port,protocol:s.protocol,username:s.username,password:s.password};await FW(e.name,e.token,u),De.success("Proxy criado com sucesso")}catch(u){console.error("Erro ao criar proxy:",u),De.error(`Erro ao criar : ${(c=(l=(a=u==null?void 0:u.response)==null?void 0:a.data)==null?void 0:l.response)==null?void 0:c.message}`)}finally{n(!1)}};return i.jsx("main",{className:"main-content",children:i.jsx(uo,{...r,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Proxy"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:r.control,name:"enabled",render:({field:s})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o proxy"})]}),i.jsx(ae,{children:i.jsx(je,{checked:s.value,onCheckedChange:s.onChange})})]})}),i.jsx(P,{control:r.control,name:"host",render:({field:s})=>i.jsx(se,{...s,className:"border border-gray-600 w-full",placeholder:"Host"})}),i.jsx(P,{control:r.control,name:"port",render:({field:s})=>i.jsx(se,{...s,className:"border border-gray-600 w-full",placeholder:"Porta",type:"number"})}),i.jsx(P,{control:r.control,name:"protocol",render:({field:s})=>i.jsx(se,{...s,className:"border border-gray-600 w-full",placeholder:"Protocolo"})}),i.jsx(P,{control:r.control,name:"username",render:({field:s})=>i.jsx(se,{...s,className:"border border-gray-600 w-full",placeholder:"Usuário"})}),i.jsx(P,{control:r.control,name:"password",render:({field:s})=>i.jsx(se,{...s,className:"border border-gray-600 w-full",placeholder:"Senha",type:"password"})})]})]}),i.jsx(Te,{disabled:t,onClick:o,children:t?"Salvando...":"Salvar"})]})})})}const QN=new zr,zW=async(e,t)=>(await QN.getInstance().get(`/rabbitmq/find/${e}`,{headers:{apikey:t}})).data,VW=async(e,t,n)=>(await QN.getInstance().post(`/rabbitmq/set/${e}`,n,{headers:{apikey:t}})).data,UW=T.object({enabled:T.boolean(),events:T.array(T.string())});function BW(){const{instance:e}=Tt(),[t,n]=v.useState(!1),r=tn({resolver:nn(UW),defaultValues:{enabled:!1,events:[]}});v.useEffect(()=>{(async()=>{if(e){n(!0);try{const l=await zW(e.name,e.token);r.reset(l)}catch(l){console.error("Erro ao buscar dados do rabbitmq:",l)}finally{n(!1)}}})()},[e,r]);const o=async()=>{var l,c,u;if(!e)return;const a=r.getValues();n(!0);try{const d={enabled:a.enabled,events:a.events};await VW(e.name,e.token,d),De.success("Rabbitmq criado com sucesso")}catch(d){console.error("Erro ao criar rabbitmq:",d),De.error(`Erro ao criar : ${(u=(c=(l=d==null?void 0:d.response)==null?void 0:l.data)==null?void 0:c.response)==null?void 0:u.message}`)}finally{n(!1)}},s=["APPLICATION_STARTUP","QRCODE_UPDATED","MESSAGES_SET","MESSAGES_UPSERT","MESSAGES_UPDATE","MESSAGES_DELETE","SEND_MESSAGE","CONTACTS_SET","CONTACTS_UPSERT","CONTACTS_UPDATE","PRESENCE_UPDATE","CHATS_SET","CHATS_UPSERT","CHATS_UPDATE","CHATS_DELETE","GROUPS_UPSERT","GROUP_UPDATE","GROUP_PARTICIPANTS_UPDATE","CONNECTION_UPDATE","LABELS_EDIT","LABELS_ASSOCIATION","CALL","TYPEBOT_START","TYPEBOT_CHANGE_STATUS"];return i.jsx("main",{className:"main-content",children:i.jsx(uo,{...r,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Rabbitmq"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:r.control,name:"enabled",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o rabbitmq"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"events",render:({field:a})=>i.jsxs(M,{className:"flex flex-col",children:[i.jsx(A,{children:"Eventos"}),i.jsx(ae,{children:i.jsx(i.Fragment,{children:s.map(l=>i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsx("span",{children:l}),i.jsx(je,{checked:a.value.includes(l),onCheckedChange:c=>{c?a.onChange([...a.value,l]):a.onChange(a.value.filter(u=>u!==l))}})]},l))})})]})})]})]}),i.jsx(Te,{disabled:t,onClick:o,children:t?"Salvando...":"Salvar"})]})})})}const HW=T.object({rejectCall:T.boolean(),msgCall:T.string().optional(),groupsIgnore:T.boolean(),alwaysOnline:T.boolean(),readMessages:T.boolean(),syncFullHistory:T.boolean(),readStatus:T.boolean()});function GW(){const[e,t]=v.useState(!0),[n,r]=v.useState(!1),[o,s]=v.useState(""),{instance:a}=Tt(),l=tn({resolver:nn(HW),defaultValues:{rejectCall:!1,msgCall:"",groupsIgnore:!1,alwaysOnline:!1,readMessages:!1,syncFullHistory:!1,readStatus:!1}});v.useEffect(()=>{(async()=>{try{if(a&&a.name&&a.token){s(a.token);const d=await mA(a.name,a.token);l.reset({rejectCall:d.rejectCall,msgCall:d.msgCall||"",groupsIgnore:d.groupsIgnore,alwaysOnline:d.alwaysOnline,readMessages:d.readMessages,syncFullHistory:d.syncFullHistory,readStatus:d.readStatus})}else console.error("Token ou nome da instância não encontrados.");t(!1)}catch(d){console.error("Erro ao carregar configurações:",d),t(!1)}})()},[l,a]);const c=async u=>{try{if(!a||!a.name)throw new Error("Nome da instância não encontrado.");r(!0);const d={rejectCall:u.rejectCall,msgCall:u.msgCall,groupsIgnore:u.groupsIgnore,alwaysOnline:u.alwaysOnline,readMessages:u.readMessages,syncFullHistory:u.syncFullHistory,readStatus:u.readStatus};await vA(a.name,o,d),De.success("Configurações atualizadas com sucesso!")}catch(d){console.error("Erro ao atualizar configurações:",d),De.error("Erro ao atualizar configurações.")}finally{r(!1)}};return e?i.jsx(Fo,{}):i.jsx("main",{className:"main-content",children:i.jsx(uo,{...l,children:i.jsxs("form",{onSubmit:l.handleSubmit(c),className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Comportamento"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:l.control,name:"rejectCall",render:({field:u})=>i.jsxs(M,{className:"flex flex-col items-start rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"flex flex-row items-center justify-between w-full",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Rejeitar Chamadas"}),i.jsx($t,{children:"Rejeitas chamadas de voz e vídeo no Whatsapp"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]}),u.value&&i.jsx("div",{className:"w-full mt-4",children:i.jsx(P,{control:l.control,name:"msgCall",render:({field:d})=>i.jsx(ae,{children:i.jsx(ko,{...d,placeholder:"Mensagem ao rejeitar chamada",className:"border border-gray-600 w-full"})})})})]})}),i.jsx(P,{control:l.control,name:"groupsIgnore",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ignorar Grupos"}),i.jsx($t,{children:"Ignora eventos de grupos no Whatsapp"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]})}),i.jsx(P,{control:l.control,name:"alwaysOnline",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Sempre Online"}),i.jsx($t,{children:"Mantém o Whatsapp sempre online"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]})}),i.jsx(P,{control:l.control,name:"readMessages",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Visualizar Mensagens"}),i.jsx($t,{children:"Visualiza mensagens automaticamente"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]})}),i.jsx(P,{control:l.control,name:"syncFullHistory",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Sincronizar Histórico Completo"}),i.jsx($t,{children:"Sincroniza o histórico completo de mensagens ao ler o qrcode"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]})}),i.jsx(P,{control:l.control,name:"readStatus",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Visualizar Status"}),i.jsx($t,{children:"Recebe eventos dos broadcasts e visualiza todos os status"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]})})]})]}),i.jsx(Te,{type:"submit",disabled:n,children:n?"Salvando...":"Salvar"})]})})})}const eR=new zr,WW=async(e,t)=>(await eR.getInstance().get(`/sqs/find/${e}`,{headers:{apikey:t}})).data,KW=async(e,t,n)=>(await eR.getInstance().post(`/sqs/set/${e}`,n,{headers:{apikey:t}})).data,qW=T.object({enabled:T.boolean(),events:T.array(T.string())});function ZW(){const{instance:e}=Tt(),[t,n]=v.useState(!1),r=tn({resolver:nn(qW),defaultValues:{enabled:!1,events:[]}});v.useEffect(()=>{(async()=>{if(e){n(!0);try{const l=await WW(e.name,e.token);r.reset(l)}catch(l){console.error("Erro ao buscar dados do sqs:",l)}finally{n(!1)}}})()},[e,r]);const o=async()=>{var l,c,u;if(!e)return;const a=r.getValues();n(!0);try{const d={enabled:a.enabled,events:a.events};await KW(e.name,e.token,d),De.success("Sqs criado com sucesso")}catch(d){console.error("Erro ao criar sqs:",d),De.error(`Erro ao criar : ${(u=(c=(l=d==null?void 0:d.response)==null?void 0:l.data)==null?void 0:c.response)==null?void 0:u.message}`)}finally{n(!1)}},s=["APPLICATION_STARTUP","QRCODE_UPDATED","MESSAGES_SET","MESSAGES_UPSERT","MESSAGES_UPDATE","MESSAGES_DELETE","SEND_MESSAGE","CONTACTS_SET","CONTACTS_UPSERT","CONTACTS_UPDATE","PRESENCE_UPDATE","CHATS_SET","CHATS_UPSERT","CHATS_UPDATE","CHATS_DELETE","GROUPS_UPSERT","GROUP_UPDATE","GROUP_PARTICIPANTS_UPDATE","CONNECTION_UPDATE","LABELS_EDIT","LABELS_ASSOCIATION","CALL","TYPEBOT_START","TYPEBOT_CHANGE_STATUS"];return i.jsx("main",{className:"main-content",children:i.jsx(uo,{...r,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Sqs"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:r.control,name:"enabled",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o sqs"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"events",render:({field:a})=>i.jsxs(M,{className:"flex flex-col",children:[i.jsx(A,{children:"Eventos"}),i.jsx(ae,{children:i.jsx(i.Fragment,{children:s.map(l=>i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsx("span",{children:l}),i.jsx(je,{checked:a.value.includes(l),onCheckedChange:c=>{c?a.onChange([...a.value,l]):a.onChange(a.value.filter(u=>u!==l))}})]},l))})})]})})]})]}),i.jsx(Te,{disabled:t,onClick:o,children:t?"Salvando...":"Salvar"})]})})})}const Wo=new zr,tR=async(e,t)=>(await Wo.getInstance().get(`/typebot/find/${e}`,{headers:{apikey:t}})).data,JW=async(e,t,n)=>(await Wo.getInstance().get(`/typebot/fetch/${n}/${e}`,{headers:{apikey:t}})).data,YW=async(e,t,n)=>(await Wo.getInstance().post(`/typebot/create/${e}`,n,{headers:{apikey:t}})).data,XW=async(e,t,n,r)=>(await Wo.getInstance().put(`/typebot/update/${n}/${e}`,r,{headers:{apikey:t}})).data,QW=async(e,t,n)=>(await Wo.getInstance().delete(`/typebot/delete/${n}/${e}`,{headers:{apikey:t}})).data,eK=async(e,t)=>(await Wo.getInstance().get(`/typebot/fetchSettings/${e}`,{headers:{apikey:t}})).data,tK=async(e,t,n)=>(await Wo.getInstance().post(`/typebot/settings/${e}`,n,{headers:{apikey:t}})).data,nK=async(e,t,n)=>(await Wo.getInstance().get(`/typebot/fetchSessions/${n}/${e}`,{headers:{apikey:t}})).data,rK=async(e,t,n,r)=>(await Wo.getInstance().post(`/typebot/changeStatus/${e}`,{remoteJid:n,status:r},{headers:{apikey:t}})).data,oK=T.object({enabled:T.boolean(),url:T.string().url(),typebot:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string())});function sK({resetTable:e}){const{instance:t}=Tt(),[n,r]=v.useState(!1),[o,s]=v.useState(!1),a=tn({resolver:nn(oK),defaultValues:{enabled:!0,url:"",typebot:"",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0",ignoreJids:[]}}),l=async u=>{var d,p,f;try{if(!t||!t.name)throw new Error("Nome da instância não encontrado.");r(!0);const h={enabled:u.enabled,url:u.url,typebot:u.typebot,triggerType:u.triggerType,triggerOperator:u.triggerOperator||"",triggerValue:u.triggerValue||"",expire:parseInt(u.expire,10),keywordFinish:u.keywordFinish,delayMessage:parseInt(u.delayMessage,10),unknownMessage:u.unknownMessage,listeningFromMe:u.listeningFromMe,stopBotFromMe:u.stopBotFromMe,keepOpen:u.keepOpen,debounceTime:parseInt(u.debounceTime,10)};await YW(t.name,t.token,h),De.success("Typebot criado com sucesso!"),s(!1),c(),e()}catch(h){console.error("Erro ao criar typebot:",h),De.error(`Erro ao criar : ${(f=(p=(d=h==null?void 0:h.response)==null?void 0:d.data)==null?void 0:p.response)==null?void 0:f.message}`)}finally{r(!1)}};function c(){a.reset()}return i.jsxs(Sn,{open:o,onOpenChange:s,children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ou,{})," Typebot"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:c,children:[i.jsx(dn,{children:i.jsx(On,{children:"Novo Typebot"})}),i.jsx(Uo,{...a,children:i.jsxs("form",{onSubmit:a.handleSubmit(l),className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:a.control,name:"enabled",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Typebot Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"url",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"URL da API do Typebot"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"URL da API do Typebot"})]})}),i.jsx(P,{control:a.control,name:"typebot",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Nome do Typebot"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Nome do Typebot"})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"triggerType",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:u.onChange,defaultValue:u.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),a.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:a.control,name:"triggerOperator",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:u.onChange,defaultValue:u.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:a.control,name:"triggerValue",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"expire",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:a.control,name:"keywordFinish",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:a.control,name:"delayMessage",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:a.control,name:"unknownMessage",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:a.control,name:"listeningFromMe",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:a.control,name:"stopBotFromMe",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:a.control,name:"keepOpen",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:a.control,name:"debounceTime",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{disabled:n,variant:"default",type:"submit",children:"Salvar"})})]})})]})]})}const uS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await nK(e.name,r,t);n(o)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar sessões:",r)}};function aK({typebotId:e}){var d,p;const{instance:t}=Tt(),[n,r]=v.useState([]),[o,s]=v.useState([]);v.useEffect(()=>{uS(t,e,s)},[t,e]);function a(){uS(t,e,s)}const l=async(f,h)=>{var g,m,w;try{if(!t)return;await rK(t.name,t.token,f,h),De.success("Status alterado com sucesso."),a()}catch(x){console.error("Erro ao atualizar:",x),De.error(`Erro ao atualizar : ${(w=(m=(g=x==null?void 0:x.response)==null?void 0:g.data)==null?void 0:m.response)==null?void 0:w.message}`)}},c=[{accessorKey:"remoteJid",header:()=>i.jsx("div",{className:"text-center",children:"Remote Jid"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("remoteJid")})},{accessorKey:"pushName",header:()=>i.jsx("div",{className:"text-center",children:"Push Name"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("pushName")})},{accessorKey:"sessionId",header:()=>i.jsx("div",{className:"text-center",children:"Session ID"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("sessionId")})},{accessorKey:"status",header:()=>i.jsx("div",{className:"text-center",children:"Status"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("status")})},{id:"actions",enableHiding:!1,cell:({row:f})=>{const h=f.original;return i.jsxs(kp,{children:[i.jsx(Np,{asChild:!0,children:i.jsxs(Te,{variant:"ghost",className:"h-8 w-8 p-0",children:[i.jsx("span",{className:"sr-only",children:"Open menu"}),i.jsx(ep,{className:"h-4 w-4"})]})}),i.jsxs(qi,{align:"end",children:[i.jsx(pu,{children:"Actions"}),i.jsx(Zi,{}),h.status!=="opened"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"opened"),children:[i.jsx(ny,{className:"w-4 h-4 mr-2"}),"Abrir"]}),h.status!=="paused"&&h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"paused"),children:[i.jsx(ty,{className:"w-4 h-4 mr-2"}),"Pausar"]}),h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"closed"),children:[i.jsx(Yv,{className:"w-4 h-4 mr-2"}),"Fechar"]}),i.jsxs(xn,{onClick:()=>l(h.remoteJid,"delete"),children:[i.jsx(Xv,{className:"w-4 h-4 mr-2"}),"Excluir"]})]})]})}}],u=Mp({data:o,columns:c,onSortingChange:r,getCoreRowModel:Pp(),getPaginationRowModel:Dp(),getSortedRowModel:Op(),getFilteredRowModel:Ip(),state:{sorting:n}});return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5 text-white",children:[i.jsx(Qv,{})," Sessões"]})}),i.jsxs(un,{className:"sm:max-w-[950px] overflow-y-auto",onCloseAutoFocus:a,children:[i.jsx(dn,{children:i.jsx(On,{children:"Sessões"})}),i.jsxs("div",{children:[i.jsx(se,{placeholder:"Search by remoteJid...",value:((d=u.getColumn("remoteJid"))==null?void 0:d.getFilterValue())??"",onChange:f=>{var h;return(h=u.getColumn("remoteJid"))==null?void 0:h.setFilterValue(f.target.value)},className:"max-w-sm border border-gray-300 rounded-md"}),i.jsxs(hu,{children:[i.jsx(gu,{children:u.getHeaderGroups().map(f=>i.jsx(nr,{children:f.headers.map(h=>i.jsx(vu,{children:h.isPlaceholder?null:Ds(h.column.columnDef.header,h.getContext())},h.id))},f.id))}),i.jsx(mu,{children:(p=u.getRowModel().rows)!=null&&p.length?u.getRowModel().rows.map(f=>i.jsx(nr,{"data-state":f.getIsSelected()&&"selected",children:f.getVisibleCells().map(h=>i.jsx(Lo,{children:Ds(h.column.columnDef.cell,h.getContext())},h.id))},f.id)):i.jsx(nr,{children:i.jsx(Lo,{colSpan:c.length,className:"h-24 text-center",children:"No results."})})})]})]})]})]})}const iK=T.object({enabled:T.boolean(),url:T.string().url(),typebot:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string())});function lK({typebotId:e,instance:t,resetTable:n}){const[,r]=v.useState(""),[o,s]=v.useState(!0),[a,l]=v.useState(!1),c=ir(),u=tn({resolver:nn(iK),defaultValues:{enabled:!0,url:"",typebot:"",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0",ignoreJids:[]}});v.useEffect(()=>{(async()=>{try{const h=localStorage.getItem("token");if(h&&t&&t.name&&e){r(h);const g=await JW(t.name,h,e);u.reset({enabled:g.enabled,url:g.url,typebot:g.typebot,triggerType:g.triggerType,triggerOperator:g.triggerOperator,triggerValue:g.triggerValue,expire:g.expire.toString(),keywordFinish:g.keywordFinish,delayMessage:g.delayMessage.toString(),unknownMessage:g.unknownMessage,listeningFromMe:g.listeningFromMe,stopBotFromMe:g.stopBotFromMe,keepOpen:g.keepOpen,debounceTime:g.debounceTime.toString()})}else console.error("Token ou nome da instância não encontrados.");s(!1)}catch(h){console.error("Erro ao carregar configurações:",h),s(!1)}})()},[u,t,e]);const d=async()=>{var f,h,g;try{const m=u.getValues(),w=localStorage.getItem("token");if(w&&t&&t.name&&e){const x={enabled:m.enabled,url:m.url,typebot:m.typebot,triggerType:m.triggerType,triggerOperator:m.triggerOperator||"",triggerValue:m.triggerValue||"",expire:parseInt(m.expire,10),keywordFinish:m.keywordFinish,delayMessage:parseInt(m.delayMessage,10),unknownMessage:m.unknownMessage,listeningFromMe:m.listeningFromMe,stopBotFromMe:m.stopBotFromMe,keepOpen:m.keepOpen,debounceTime:parseInt(m.debounceTime,10)};await XW(t.name,w,e,x),De.success("Typebot atualizado com sucesso.")}else console.error("Token ou nome da instância não encontrados.")}catch(m){console.error("Erro ao atualizar typebot:",m),De.error(`Erro ao atualizar : ${(g=(h=(f=m==null?void 0:m.response)==null?void 0:f.data)==null?void 0:h.response)==null?void 0:g.message}`)}},p=async()=>{try{const f=localStorage.getItem("token");f&&t&&t.name&&e?(await QW(t.name,f,e),De.success("Typebot excluído com sucesso."),l(!1),n(),c(`/manager/instance/${t.id}/typebot`)):console.error("Token ou nome da instância não encontrados.")}catch(f){console.error("Erro ao excluir typebot:",f)}};return i.jsxs("div",{className:"form",children:[o&&i.jsx(Fo,{}),!o&&i.jsx(uo,{...u,children:i.jsxs("form",{onSubmit:u.handleSubmit(d),className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Typebot"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:u.control,name:"enabled",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Typebot Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"url",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"URL da API do Typebot"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"URL da API do Typebot"})]})}),i.jsx(P,{control:u.control,name:"typebot",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Nome do Typebot"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Nome do Typebot"})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"triggerType",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),u.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:u.control,name:"triggerOperator",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:u.control,name:"triggerValue",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"expire",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:u.control,name:"keywordFinish",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:u.control,name:"delayMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:u.control,name:"unknownMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:u.control,name:"listeningFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:u.control,name:"stopBotFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:u.control,name:"keepOpen",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:u.control,name:"debounceTime",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})]}),i.jsx("div",{children:i.jsx(aK,{typebotId:e})}),i.jsx(Te,{className:"bg-blue-400 hover:bg-blue-600 text-white",onClick:d,children:"Atualizar"}),i.jsxs(Sn,{open:a,onOpenChange:l,children:[i.jsx(Cn,{asChild:!0,children:i.jsx(Te,{variant:"secondary",className:"ml-2 bg-red-400 hover:bg-red-600",children:"Excluir"})}),i.jsx(un,{children:i.jsxs(dn,{children:[i.jsx(On,{children:"Tem certeza que deseja excluir?"}),i.jsx(Ri,{children:"Esta ação não pode ser desfeita."}),i.jsxs(wr,{children:[i.jsx(Te,{variant:"default",className:"bg-red-400 hover:bg-red-600 text-white",onClick:p,children:"Exluir"}),i.jsx(Te,{variant:"outline",onClick:()=>l(!1),children:"Cancelar"})]})]})})]})]})})]})}const cK=T.object({expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string()),typebotIdFallback:T.string().optional()}),dS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await eK(e.name,r);t(o);const s=await tR(e.name,r);n(s)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar configurações:",r)}};function uK(){const{instance:e}=Tt(),[t,n]=v.useState([]),[r,o]=v.useState(),[s,a]=v.useState([]),l=f=>{n(t.filter((h,g)=>g!==f))},c=f=>{n([...t,f])},u=tn({resolver:nn(cK),defaultValues:{expire:"0",keywordFinish:"#SAIR",delayMessage:"1000",unknownMessage:"Mensagem não reconhecida",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0",ignoreJids:[],typebotIdFallback:void 0}});v.useEffect(()=>{dS(e,o,a)},[e]),v.useEffect(()=>{var f;r&&(u.reset({expire:r!=null&&r.expire?r.expire.toString():"0",keywordFinish:r.keywordFinish,delayMessage:r.delayMessage?r.delayMessage.toString():"0",unknownMessage:r.unknownMessage,listeningFromMe:r.listeningFromMe,stopBotFromMe:r.stopBotFromMe,keepOpen:r.keepOpen,debounceTime:r.debounceTime?r.debounceTime.toString():"0",ignoreJids:r.ignoreJids,typebotIdFallback:r.typebotIdFallback}),n(((f=r.ignoreJids)==null?void 0:f.map(h=>({id:h,text:h,className:""})))||[]))},[r]);const d=async()=>{var f,h,g;try{const m=u.getValues();if(!e||!e.name)throw new Error("Nome da instância não encontrado.");const w={expire:parseInt(m.expire),keywordFinish:m.keywordFinish,delayMessage:parseInt(m.delayMessage),unknownMessage:m.unknownMessage,listeningFromMe:m.listeningFromMe,stopBotFromMe:m.stopBotFromMe,keepOpen:m.keepOpen,debounceTime:parseInt(m.debounceTime),typebotIdFallback:m.typebotIdFallback||void 0,ignoreJids:t.map(x=>x.text)};await tK(e.name,e.token,w),De.success("Configuração salva com sucesso!")}catch(m){console.error("Erro ao criar bot:",m),De.error(`Erro ao criar : ${(g=(h=(f=m==null?void 0:m.response)==null?void 0:f.data)==null?void 0:h.response)==null?void 0:g.message}`)}};function p(){dS(e,o,a)}return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ru,{})," Configurações Padrão"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:p,children:[i.jsx(dn,{children:i.jsx(On,{children:"Configurações Padrão"})}),i.jsx(Uo,{...u,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:u.control,name:"typebotIdFallback",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Typebot Fallback"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um typebot"})})}),i.jsx(vt,{className:"border border-gray-600",children:s.map(h=>i.jsx(he,{value:`${h.id}`,children:h.typebot},h.id))})]})]})}),i.jsx(P,{control:u.control,name:"expire",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:u.control,name:"keywordFinish",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:u.control,name:"delayMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:u.control,name:"unknownMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:u.control,name:"listeningFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:u.control,name:"stopBotFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:u.control,name:"keepOpen",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:u.control,name:"debounceTime",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})}),i.jsx(P,{control:u.control,name:"ignoreJids",render:({field:f})=>i.jsxs("div",{className:"pb-4",children:[i.jsx("label",{className:"block text-sm font-medium",children:"Ignorar JIDs"}),i.jsx(sx,{tags:t,handleDelete:l,handleAddition:c,inputFieldPosition:"bottom",placeholder:"Adicionar JIDs ex: 1234567890@s.whatsapp.net",autoFocus:!1,classNames:{tags:"tagsClass",tagInput:"tagInputClass",tagInputField:"tagInputFieldClass",selected:"selectedClass",tag:"tagClass",remove:"removeClass",suggestions:"suggestionsClass",activeSuggestion:"activeSuggestionClass",editTagInput:"editTagInputClass",editTagInputField:"editTagInputFieldClass",clearAll:"clearAllClass"}}),i.jsx("input",{type:"hidden",...f,value:t.map(h=>h.text).join(",")})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{variant:"default",type:"button",onClick:d,children:"Salvar"})})]})})]})]})}const fS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await tR(e.name,r);t(o)}else console.error("Token ou nome da instância não encontrados.");n(!1)}catch(r){console.error("Erro ao carregar configurações:",r),n(!1)}};function pS(){const{instance:e}=Tt(),{typebotId:t}=Vi(),[n,r]=v.useState(!0),[o,s]=v.useState([]),a=ir();v.useEffect(()=>{fS(e,s,r)},[e]);const l=u=>{e&&a(`/manager/instance/${e.id}/typebot/${u}`)},c=()=>{fS(e,s,r)};return i.jsxs("main",{className:"main-table pt-5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"ml-5 mb-1 text-lg font-medium",children:"Typebots"}),i.jsxs("div",{children:[i.jsx(uK,{}),i.jsx(sK,{resetTable:c})]})]}),i.jsx(Dt,{className:"mt-4 border border-black"}),i.jsxs(su,{direction:"horizontal",children:[i.jsx(ro,{defaultSize:35,className:"p-5",children:i.jsx("div",{className:"table",children:n?i.jsx(Fo,{}):i.jsx(i.Fragment,{children:o&&o.length>0?o.map(u=>i.jsxs("div",{className:`table-item ${u.id===t?"selected":""}`,onClick:()=>l(`${u.id}`),children:[i.jsx("h3",{className:"table-item-title",children:u.url}),i.jsx("p",{className:"table-item-description",children:u.typebot})]})):i.jsx("p",{children:"Nenhum typebot encontrado."})})})}),i.jsx(au,{withHandle:!0,className:"border border-black"}),i.jsx(ro,{className:"",children:t&&i.jsx(lK,{typebotId:t,instance:e,resetTable:c})})]})]})}const Ko=new zr,nR=async(e,t)=>(await Ko.getInstance().get(`/dify/find/${e}`,{headers:{apikey:t}})).data,dK=async(e,t,n)=>(await Ko.getInstance().get(`/dify/fetch/${n}/${e}`,{headers:{apikey:t}})).data,fK=async(e,t,n)=>(await Ko.getInstance().post(`/dify/create/${e}`,n,{headers:{apikey:t}})).data,pK=async(e,t,n,r)=>(await Ko.getInstance().put(`/dify/update/${n}/${e}`,r,{headers:{apikey:t}})).data,hK=async(e,t,n)=>(await Ko.getInstance().delete(`/dify/delete/${n}/${e}`,{headers:{apikey:t}})).data,gK=async(e,t)=>(await Ko.getInstance().get(`/dify/fetchSettings/${e}`,{headers:{apikey:t}})).data,mK=async(e,t,n)=>(await Ko.getInstance().post(`/dify/settings/${e}`,n,{headers:{apikey:t}})).data,vK=async(e,t,n)=>(await Ko.getInstance().get(`/dify/fetchSessions/${n}/${e}`,{headers:{apikey:t}})).data,yK=async(e,t,n,r)=>(await Ko.getInstance().post(`/dify/changeStatus/${e}`,{remoteJid:n,status:r},{headers:{apikey:t}})).data,hS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await vK(e.name,r,t);n(o)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar sessões:",r)}};function xK({difyId:e}){var d,p;const{instance:t}=Tt(),[n,r]=v.useState([]),[o,s]=v.useState([]);v.useEffect(()=>{hS(t,e,s)},[t,e]);function a(){hS(t,e,s)}const l=async(f,h)=>{var g,m,w;try{if(!t)return;await yK(t.name,t.token,f,h),De.success("Status alterado com sucesso."),a()}catch(x){console.error("Erro ao atualizar:",x),De.error(`Erro ao atualizar : ${(w=(m=(g=x==null?void 0:x.response)==null?void 0:g.data)==null?void 0:m.response)==null?void 0:w.message}`)}},c=[{accessorKey:"remoteJid",header:()=>i.jsx("div",{className:"text-center",children:"Remote Jid"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("remoteJid")})},{accessorKey:"sessionId",header:()=>i.jsx("div",{className:"text-center",children:"Session ID"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("sessionId")})},{accessorKey:"status",header:()=>i.jsx("div",{className:"text-center",children:"Status"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("status")})},{id:"actions",enableHiding:!1,cell:({row:f})=>{const h=f.original;return i.jsxs(kp,{children:[i.jsx(Np,{asChild:!0,children:i.jsxs(Te,{variant:"ghost",className:"h-8 w-8 p-0",children:[i.jsx("span",{className:"sr-only",children:"Open menu"}),i.jsx(ep,{className:"h-4 w-4"})]})}),i.jsxs(qi,{align:"end",children:[i.jsx(pu,{children:"Actions"}),i.jsx(Zi,{}),h.status!=="opened"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"opened"),children:[i.jsx(ny,{className:"w-4 h-4 mr-2"}),"Abrir"]}),h.status!=="paused"&&h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"paused"),children:[i.jsx(ty,{className:"w-4 h-4 mr-2"}),"Pausar"]}),h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"closed"),children:[i.jsx(Yv,{className:"w-4 h-4 mr-2"}),"Fechar"]}),i.jsxs(xn,{onClick:()=>l(h.remoteJid,"delete"),children:[i.jsx(Xv,{className:"w-4 h-4 mr-2"}),"Excluir"]})]})]})}}],u=Mp({data:o,columns:c,onSortingChange:r,getCoreRowModel:Pp(),getPaginationRowModel:Dp(),getSortedRowModel:Op(),getFilteredRowModel:Ip(),state:{sorting:n}});return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5 text-white",children:[i.jsx(Qv,{})," Sessões"]})}),i.jsxs(un,{className:"sm:max-w-[950px] overflow-y-auto",onCloseAutoFocus:a,children:[i.jsx(dn,{children:i.jsx(On,{children:"Sessões"})}),i.jsxs("div",{children:[i.jsx(se,{placeholder:"Search by remoteJid...",value:((d=u.getColumn("remoteJid"))==null?void 0:d.getFilterValue())??"",onChange:f=>{var h;return(h=u.getColumn("remoteJid"))==null?void 0:h.setFilterValue(f.target.value)},className:"max-w-sm border border-gray-300 rounded-md"}),i.jsxs(hu,{children:[i.jsx(gu,{children:u.getHeaderGroups().map(f=>i.jsx(nr,{children:f.headers.map(h=>i.jsx(vu,{children:h.isPlaceholder?null:Ds(h.column.columnDef.header,h.getContext())},h.id))},f.id))}),i.jsx(mu,{children:(p=u.getRowModel().rows)!=null&&p.length?u.getRowModel().rows.map(f=>i.jsx(nr,{"data-state":f.getIsSelected()&&"selected",children:f.getVisibleCells().map(h=>i.jsx(Lo,{children:Ds(h.column.columnDef.cell,h.getContext())},h.id))},f.id)):i.jsx(nr,{children:i.jsx(Lo,{colSpan:c.length,className:"h-24 text-center",children:"No results."})})})]})]})]})]})}const wK=T.object({enabled:T.boolean(),botType:T.string(),apiUrl:T.string(),apiKey:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string()});function bK({difyId:e,instance:t,resetTable:n}){const[,r]=v.useState(""),[o,s]=v.useState(!0),[a,l]=v.useState(!1),c=ir(),u=tn({resolver:nn(wK),defaultValues:{enabled:!0,botType:"chatBot",apiUrl:"",apiKey:"",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0"}});v.useEffect(()=>{(async()=>{try{const h=localStorage.getItem("token");if(h&&t&&t.name&&e){r(h);const g=await dK(t.name,h,e);u.reset({enabled:g.enabled,botType:g.botType,apiUrl:g.apiUrl,apiKey:g.apiKey,triggerType:g.triggerType,triggerOperator:g.triggerOperator,triggerValue:g.triggerValue,expire:g.expire.toString(),keywordFinish:g.keywordFinish,delayMessage:g.delayMessage.toString(),unknownMessage:g.unknownMessage,listeningFromMe:g.listeningFromMe,stopBotFromMe:g.stopBotFromMe,keepOpen:g.keepOpen,debounceTime:g.debounceTime.toString()})}else console.error("Token ou nome da instância não encontrados.");s(!1)}catch(h){console.error("Erro ao carregar configurações:",h),s(!1)}})()},[u,t,e]);const d=async()=>{var f,h,g;try{const m=u.getValues(),w=localStorage.getItem("token");if(w&&t&&t.name&&e){const x={enabled:m.enabled,botType:m.botType,apiUrl:m.apiUrl,apiKey:m.apiKey,triggerType:m.triggerType,triggerOperator:m.triggerOperator||"",triggerValue:m.triggerValue||"",expire:parseInt(m.expire,10),keywordFinish:m.keywordFinish,delayMessage:parseInt(m.delayMessage,10),unknownMessage:m.unknownMessage,listeningFromMe:m.listeningFromMe,stopBotFromMe:m.stopBotFromMe,keepOpen:m.keepOpen,debounceTime:parseInt(m.debounceTime,10)};await pK(t.name,w,e,x),De.success("Dify atualizado com sucesso.")}else console.error("Token ou nome da instância não encontrados.")}catch(m){console.error("Erro ao atualizar bot:",m),De.error(`Erro ao atualizar : ${(g=(h=(f=m==null?void 0:m.response)==null?void 0:f.data)==null?void 0:h.response)==null?void 0:g.message}`)}},p=async()=>{try{const f=localStorage.getItem("token");f&&t&&t.name&&e?(await hK(t.name,f,e),De.success("Dify excluído com sucesso."),l(!1),n(),c(`/manager/instance/${t.id}/dify`)):console.error("Token ou nome da instância não encontrados.")}catch(f){console.error("Erro ao excluir dify:",f)}};return i.jsxs("div",{className:"form",children:[o&&i.jsx(Fo,{}),!o&&i.jsx(uo,{...u,children:i.jsxs("form",{onSubmit:u.handleSubmit(d),className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Dify"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:u.control,name:"enabled",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Dify Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"botType",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de Bot"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma tipo de bot"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"chatBot",children:"Chat Bot"}),i.jsx(he,{value:"textGenerator",children:"Gerador de texto"}),i.jsx(he,{value:"agent",children:"Agente"}),i.jsx(he,{value:"workflow",children:"Workflow"})]})]})]})}),i.jsx(P,{control:u.control,name:"apiUrl",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"URL da API"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"URL da API"})]})}),i.jsx(P,{control:u.control,name:"apiKey",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Chave da API"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Chave da API",type:"password"})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"triggerType",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),u.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:u.control,name:"triggerOperator",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:u.control,name:"triggerValue",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"expire",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:u.control,name:"keywordFinish",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:u.control,name:"delayMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:u.control,name:"unknownMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:u.control,name:"listeningFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:u.control,name:"stopBotFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:u.control,name:"keepOpen",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:u.control,name:"debounceTime",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})]}),i.jsx("div",{children:i.jsx(xK,{difyId:e})}),i.jsx(Te,{className:"bg-blue-400 hover:bg-blue-600 text-white",onClick:d,children:"Atualizar"}),i.jsxs(Sn,{open:a,onOpenChange:l,children:[i.jsx(Cn,{asChild:!0,children:i.jsx(Te,{variant:"secondary",className:"ml-2 bg-red-400 hover:bg-red-600",children:"Excluir"})}),i.jsx(un,{children:i.jsxs(dn,{children:[i.jsx(On,{children:"Tem certeza que deseja excluir?"}),i.jsx(Ri,{children:"Esta ação não pode ser desfeita."}),i.jsxs(wr,{children:[i.jsx(Te,{variant:"default",className:"bg-red-400 hover:bg-red-600 text-white",onClick:p,children:"Exluir"}),i.jsx(Te,{variant:"outline",onClick:()=>l(!1),children:"Cancelar"})]})]})})]})]})})]})}const SK=T.object({enabled:T.boolean(),botType:T.string(),apiUrl:T.string(),apiKey:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string()});function CK({resetTable:e}){const{instance:t}=Tt(),[n,r]=v.useState(!1),[o,s]=v.useState(!1),a=tn({resolver:nn(SK),defaultValues:{enabled:!0,botType:"chatBot",apiUrl:"",apiKey:"",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0"}}),l=async u=>{var d,p,f;try{if(!t||!t.name)throw new Error("Nome da instância não encontrado.");r(!0);const h={enabled:u.enabled,botType:u.botType,apiUrl:u.apiUrl,apiKey:u.apiKey,triggerType:u.triggerType,triggerOperator:u.triggerOperator||"",triggerValue:u.triggerValue||"",expire:parseInt(u.expire,10),keywordFinish:u.keywordFinish,delayMessage:parseInt(u.delayMessage,10),unknownMessage:u.unknownMessage,listeningFromMe:u.listeningFromMe,stopBotFromMe:u.stopBotFromMe,keepOpen:u.keepOpen,debounceTime:parseInt(u.debounceTime,10)};await fK(t.name,t.token,h),De.success("Dify criado com sucesso!"),s(!1),c(),e()}catch(h){console.error("Erro ao criar bot:",h),De.error(`Erro ao criar : ${(f=(p=(d=h==null?void 0:h.response)==null?void 0:d.data)==null?void 0:p.response)==null?void 0:f.message}`)}finally{r(!1)}};function c(){a.reset()}return i.jsxs(Sn,{open:o,onOpenChange:s,children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ou,{})," Dify"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:c,children:[i.jsx(dn,{children:i.jsx(On,{children:"Novo Dify"})}),i.jsx(Uo,{...a,children:i.jsxs("form",{onSubmit:a.handleSubmit(l),className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:a.control,name:"enabled",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Dify Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"botType",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de Bot"}),i.jsxs(St,{onValueChange:u.onChange,defaultValue:u.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma tipo de bot"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"chatBot",children:"Chat Bot"}),i.jsx(he,{value:"textGenerator",children:"Gerador de texto"}),i.jsx(he,{value:"agent",children:"Agente"}),i.jsx(he,{value:"workflow",children:"Workflow"})]})]})]})}),i.jsx(P,{control:a.control,name:"apiUrl",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"URL da API"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"URL da API"})]})}),i.jsx(P,{control:a.control,name:"apiKey",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Chave da API"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Chave da API",type:"password"})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"triggerType",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:u.onChange,defaultValue:u.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),a.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:a.control,name:"triggerOperator",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:u.onChange,defaultValue:u.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:a.control,name:"triggerValue",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"expire",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:a.control,name:"keywordFinish",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:a.control,name:"delayMessage",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:a.control,name:"unknownMessage",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:a.control,name:"listeningFromMe",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:a.control,name:"stopBotFromMe",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:a.control,name:"keepOpen",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:a.control,name:"debounceTime",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{disabled:n,variant:"default",type:"submit",children:"Salvar"})})]})})]})]})}const jK=T.object({expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string()),difyIdFallback:T.string().optional()}),gS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await gK(e.name,r);t(o);const s=await nR(e.name,r);n(s)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar configurações:",r)}};function _K(){const{instance:e}=Tt(),[t,n]=v.useState([]),[r,o]=v.useState(),[s,a]=v.useState([]),l=f=>{n(t.filter((h,g)=>g!==f))},c=f=>{n([...t,f])},u=tn({resolver:nn(jK),defaultValues:{expire:"0",keywordFinish:"#SAIR",delayMessage:"1000",unknownMessage:"Mensagem não reconhecida",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0",ignoreJids:[],difyIdFallback:void 0}});v.useEffect(()=>{gS(e,o,a)},[e]),v.useEffect(()=>{var f;r&&(u.reset({expire:r!=null&&r.expire?r.expire.toString():"0",keywordFinish:r.keywordFinish,delayMessage:r.delayMessage?r.delayMessage.toString():"0",unknownMessage:r.unknownMessage,listeningFromMe:r.listeningFromMe,stopBotFromMe:r.stopBotFromMe,keepOpen:r.keepOpen,debounceTime:r.debounceTime?r.debounceTime.toString():"0",ignoreJids:r.ignoreJids,difyIdFallback:r.difyIdFallback}),n(((f=r.ignoreJids)==null?void 0:f.map(h=>({id:h,text:h,className:""})))||[]))},[r]);const d=async()=>{var f,h,g;try{const m=u.getValues();if(!e||!e.name)throw new Error("Nome da instância não encontrado.");const w={expire:parseInt(m.expire),keywordFinish:m.keywordFinish,delayMessage:parseInt(m.delayMessage),unknownMessage:m.unknownMessage,listeningFromMe:m.listeningFromMe,stopBotFromMe:m.stopBotFromMe,keepOpen:m.keepOpen,debounceTime:parseInt(m.debounceTime),difyIdFallback:m.difyIdFallback||void 0,ignoreJids:t.map(x=>x.text)};await mK(e.name,e.token,w),De.success("Configuração salva com sucesso!")}catch(m){console.error("Erro ao criar bot:",m),De.error(`Erro ao criar : ${(g=(h=(f=m==null?void 0:m.response)==null?void 0:f.data)==null?void 0:h.response)==null?void 0:g.message}`)}};function p(){gS(e,o,a)}return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ru,{})," Configurações Padrão"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:p,children:[i.jsx(dn,{children:i.jsx(On,{children:"Configurações Padrão"})}),i.jsx(Uo,{...u,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:u.control,name:"difyIdFallback",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Bot Fallback"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um bot"})})}),i.jsx(vt,{className:"border border-gray-600",children:s&&s.length>0&&s.map(h=>i.jsx(he,{value:`${h.id}`,children:h.id},h.id))})]})]})}),i.jsx(P,{control:u.control,name:"expire",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:u.control,name:"keywordFinish",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:u.control,name:"delayMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:u.control,name:"unknownMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:u.control,name:"listeningFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:u.control,name:"stopBotFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:u.control,name:"keepOpen",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:u.control,name:"debounceTime",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})}),i.jsx(P,{control:u.control,name:"ignoreJids",render:({field:f})=>i.jsxs("div",{className:"pb-4",children:[i.jsx("label",{className:"block text-sm font-medium",children:"Ignorar JIDs"}),i.jsx(sx,{tags:t,handleDelete:l,handleAddition:c,inputFieldPosition:"bottom",placeholder:"Adicionar JIDs ex: 1234567890@s.whatsapp.net",autoFocus:!1,classNames:{tags:"tagsClass",tagInput:"tagInputClass",tagInputField:"tagInputFieldClass",selected:"selectedClass",tag:"tagClass",remove:"removeClass",suggestions:"suggestionsClass",activeSuggestion:"activeSuggestionClass",editTagInput:"editTagInputClass",editTagInputField:"editTagInputFieldClass",clearAll:"clearAllClass"}}),i.jsx("input",{type:"hidden",...f,value:t.map(h=>h.text).join(",")})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{variant:"default",type:"button",onClick:d,children:"Salvar"})})]})})]})]})}const mS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await nR(e.name,r);t(o)}else console.error("Token ou nome da instância não encontrados.");n(!1)}catch(r){console.error("Erro ao carregar configurações:",r),n(!1)}};function vS(){const{instance:e}=Tt(),{difyId:t}=Vi(),[n,r]=v.useState(!0),[o,s]=v.useState([]),a=ir();v.useEffect(()=>{mS(e,s,r)},[e]);const l=u=>{e&&a(`/manager/instance/${e.id}/dify/${u}`)},c=()=>{mS(e,s,r)};return i.jsxs("main",{className:"main-table pt-5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"ml-5 mb-1 text-lg font-medium",children:"Dify Bots"}),i.jsxs("div",{children:[i.jsx(_K,{}),i.jsx(CK,{resetTable:c})]})]}),i.jsx(Dt,{className:"mt-4 border border-black"}),i.jsxs(su,{direction:"horizontal",children:[i.jsx(ro,{defaultSize:35,className:"p-5",children:i.jsx("div",{className:"table",children:n?i.jsx(Fo,{}):i.jsx(i.Fragment,{children:o&&o.length>0?o.map(u=>i.jsxs("div",{className:`table-item ${u.id===t?"selected":""}`,onClick:()=>l(`${u.id}`),children:[i.jsx("h3",{className:"table-item-title",children:u.id}),i.jsx("p",{className:"table-item-description",children:u.botType})]})):i.jsx("p",{children:"Nenhum bot encontrado."})})})}),i.jsx(au,{withHandle:!0,className:"border border-black"}),i.jsx(ro,{className:"",children:t&&i.jsx(bK,{difyId:t,instance:e,resetTable:c})})]})]})}const rR=new zr,EK=async(e,t)=>(await rR.getInstance().get(`/webhook/find/${e}`,{headers:{apikey:t}})).data,TK=async(e,t,n)=>(await rR.getInstance().post(`/webhook/set/${e}`,n,{headers:{apikey:t}})).data,kK=T.object({enabled:T.boolean(),url:T.string().url("Invalid URL format"),events:T.array(T.string()),webhookBase64:T.boolean(),webhookByEvents:T.boolean()});function NK(){const{instance:e}=Tt(),[t,n]=v.useState(!1),r=tn({resolver:nn(kK),defaultValues:{enabled:!1,url:"",events:[],webhookBase64:!1,webhookByEvents:!1}});v.useEffect(()=>{(async()=>{if(e){n(!0);try{const l=await EK(e.name,e.token);r.reset(l)}catch(l){console.error("Erro ao buscar dados do webhook:",l)}finally{n(!1)}}})()},[e,r]);const o=async()=>{var l,c,u;if(!e)return;const a=r.getValues();n(!0);try{const d={enabled:a.enabled,url:a.url,events:a.events,webhookBase64:a.webhookBase64,webhookByEvents:a.webhookByEvents};await TK(e.name,e.token,d),De.success("Webhook criado com sucesso")}catch(d){console.error("Erro ao criar webhook:",d),De.error(`Erro ao criar : ${(u=(c=(l=d==null?void 0:d.response)==null?void 0:l.data)==null?void 0:c.response)==null?void 0:u.message}`)}finally{n(!1)}},s=["APPLICATION_STARTUP","QRCODE_UPDATED","MESSAGES_SET","MESSAGES_UPSERT","MESSAGES_UPDATE","MESSAGES_DELETE","SEND_MESSAGE","CONTACTS_SET","CONTACTS_UPSERT","CONTACTS_UPDATE","PRESENCE_UPDATE","CHATS_SET","CHATS_UPSERT","CHATS_UPDATE","CHATS_DELETE","GROUPS_UPSERT","GROUP_UPDATE","GROUP_PARTICIPANTS_UPDATE","CONNECTION_UPDATE","LABELS_EDIT","LABELS_ASSOCIATION","CALL","TYPEBOT_START","TYPEBOT_CHANGE_STATUS"];return i.jsx("main",{className:"main-content",children:i.jsx(uo,{...r,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Webhook"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:r.control,name:"enabled",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o webhook"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"url",render:({field:a})=>i.jsx(se,{...a,className:"border border-gray-600 w-full",placeholder:"URL"})}),i.jsx(P,{control:r.control,name:"webhookByEvents",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Webhook por Eventos"}),i.jsx($t,{children:"Cria uma rota para cada evento adicionando o nome do evento no final da URL"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"webhookBase64",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Base64 no Webhook"}),i.jsx($t,{children:"Envie os dados do base64 das mídias no webhook"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"events",render:({field:a})=>i.jsxs(M,{className:"flex flex-col",children:[i.jsx(A,{children:"Eventos"}),i.jsx(ae,{children:i.jsx(i.Fragment,{children:s.map(l=>i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsx("span",{children:l}),i.jsx(je,{checked:a.value.includes(l),onCheckedChange:c=>{c?a.onChange([...a.value,l]):a.onChange(a.value.filter(u=>u!==l))}})]},l))})})]})})]})]}),i.jsx(Te,{disabled:t,onClick:o,children:t?"Salvando...":"Salvar"})]})})})}const oR=new zr,RK=async(e,t)=>(await oR.getInstance().get(`/websocket/find/${e}`,{headers:{apikey:t}})).data,PK=async(e,t,n)=>(await oR.getInstance().post(`/websocket/set/${e}`,n,{headers:{apikey:t}})).data,IK=T.object({enabled:T.boolean(),events:T.array(T.string())});function DK(){const{instance:e}=Tt(),[t,n]=v.useState(!1),r=tn({resolver:nn(IK),defaultValues:{enabled:!1,events:[]}});v.useEffect(()=>{(async()=>{if(e){n(!0);try{const l=await RK(e.name,e.token);r.reset(l)}catch(l){console.error("Erro ao buscar dados do websocket:",l)}finally{n(!1)}}})()},[e,r]);const o=async()=>{var l,c,u;if(!e)return;const a=r.getValues();n(!0);try{const d={enabled:a.enabled,events:a.events};await PK(e.name,e.token,d),De.success("Websocket criado com sucesso")}catch(d){console.error("Erro ao criar websocket:",d),De.error(`Erro ao criar : ${(u=(c=(l=d==null?void 0:d.response)==null?void 0:l.data)==null?void 0:c.response)==null?void 0:u.message}`)}finally{n(!1)}},s=["APPLICATION_STARTUP","QRCODE_UPDATED","MESSAGES_SET","MESSAGES_UPSERT","MESSAGES_UPDATE","MESSAGES_DELETE","SEND_MESSAGE","CONTACTS_SET","CONTACTS_UPSERT","CONTACTS_UPDATE","PRESENCE_UPDATE","CHATS_SET","CHATS_UPSERT","CHATS_UPDATE","CHATS_DELETE","GROUPS_UPSERT","GROUP_UPDATE","GROUP_PARTICIPANTS_UPDATE","CONNECTION_UPDATE","LABELS_EDIT","LABELS_ASSOCIATION","CALL","TYPEBOT_START","TYPEBOT_CHANGE_STATUS"];return i.jsx("main",{className:"main-content",children:i.jsx(uo,{...r,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Websocket"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:r.control,name:"enabled",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o websocket"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"events",render:({field:a})=>i.jsxs(M,{className:"flex flex-col",children:[i.jsx(A,{children:"Eventos"}),i.jsx(ae,{children:i.jsx(i.Fragment,{children:s.map(l=>i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsx("span",{children:l}),i.jsx(je,{checked:a.value.includes(l),onCheckedChange:c=>{c?a.onChange([...a.value,l]):a.onChange(a.value.filter(u=>u!==l))}})]},l))})})]})})]})]}),i.jsx(Te,{disabled:t,onClick:o,children:t?"Salvando...":"Salvar"})]})})})}function OK(){const e=ir(),[t,n]=v.useState(window.location.protocol+"//"+window.location.host),[r,o]=v.useState(""),s=async()=>{if(!t||!r){De.error("Credenciais inválidas");return}const a=await UM(t);if(console.log("server",a),!a||!a.version){y_(),De.error("Servidor inválido");return}if(!await VM(t,r)){De.error("Credenciais inválidas");return}localStorage.setItem("version",a.version),e("/manager/")};return i.jsxs("div",{children:[i.jsx("div",{className:"pt-2",children:i.jsx("img",{className:"logo",src:"/assets/images/evolution-logo.png",alt:"logo"})}),i.jsx("div",{className:"root",children:i.jsxs(gi,{className:"w-[350px] no-border",children:[i.jsxs(ql,{children:[i.jsx(Zl,{className:"text-center",children:"Evolution Manager"}),i.jsx(u1,{className:"text-center",children:"Login to your evolution api server"})]}),i.jsx(Jl,{children:i.jsxs("div",{className:"grid w-full items-center gap-4",children:[i.jsxs("div",{className:"flex flex-col space-y-1.5",children:[i.jsx(fs,{className:"text-center",htmlFor:"serverUrl",children:"Server URL"}),i.jsx(se,{className:"border border-gray-300",id:"serverUrl",placeholder:"Server URL",value:t,onChange:a=>n(a.target.value)})]}),i.jsxs("div",{className:"flex flex-col space-y-1.5",children:[i.jsx(fs,{className:"text-center",htmlFor:"apiKey",children:"Global ApiKey"}),i.jsx(se,{id:"apiKey",className:"border border-gray-300",placeholder:"Global ApiKey",type:"password",value:r,onChange:a=>o(a.target.value)})]})]})}),i.jsx(d1,{className:"flex justify-center",children:i.jsx(Te,{className:"w-full",onClick:s,children:"Login"})})]})}),i.jsx(c1,{})]})}const MK=QD([{path:"/manager/login",element:i.jsx(hO,{children:i.jsx(OK,{})})},{path:"/manager/",element:i.jsx(sn,{children:i.jsx(JF,{children:i.jsx(Pz,{})})})},{path:"/manager/instance/:instanceId/dashboard",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(y3,{})})})},{path:"/manager/instance/:instanceId/chat",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(J0,{})})})},{path:"/manager/instance/:instanceId/chat/:remoteJid",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(J0,{})})})},{path:"/manager/instance/:instanceId/settings",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(GW,{})})})},{path:"/manager/instance/:instanceId/openai",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(cS,{})})})},{path:"/manager/instance/:instanceId/openai/:openaiBotId",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(cS,{})})})},{path:"/manager/instance/:instanceId/webhook",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(NK,{})})})},{path:"/manager/instance/:instanceId/websocket",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(DK,{})})})},{path:"/manager/instance/:instanceId/rabbitmq",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(BW,{})})})},{path:"/manager/instance/:instanceId/sqs",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(ZW,{})})})},{path:"/manager/instance/:instanceId/chatwoot",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(m3,{})})})},{path:"/manager/instance/:instanceId/typebot",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(pS,{})})})},{path:"/manager/instance/:instanceId/typebot/:typebotId",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(pS,{})})})},{path:"/manager/instance/:instanceId/dify",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(vS,{})})})},{path:"/manager/instance/:instanceId/dify/:difyId",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(vS,{})})})},{path:"/manager/instance/:instanceId/proxy",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx($W,{})})})}]),AK={theme:"system",setTheme:()=>null},FK=v.createContext(AK);function LK({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,s]=v.useState(()=>localStorage.getItem(n)||t);v.useEffect(()=>{const l=window.document.documentElement;if(l.classList.remove("light","dark"),o==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";l.classList.add(c);return}l.classList.add(o)},[o]);const a={theme:o,setTheme:l=>{localStorage.setItem(n,l),s(l)}};return i.jsx(FK.Provider,{...r,value:a,children:e})}ig.createRoot(document.getElementById("root")).render(i.jsxs(Se.StrictMode,{children:[i.jsx(LK,{defaultTheme:"dark",storageKey:"vite-ui-theme",children:i.jsx(lO,{router:MK})}),i.jsx(S4,{})]}))});export default $K(); +*/const OW=T.object({openaiCredsId:T.string(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string()),openaiIdFallback:T.string().optional()}),iS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await k3(e.name,r);t(o);const s=await nN(e.name,r);n(s)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar configurações:",r)}};function MW({creds:e}){const{instance:t}=Tt(),[n,r]=v.useState([]),[o,s]=v.useState(),[a,l]=v.useState([]),c=h=>{r(n.filter((g,m)=>m!==h))},u=h=>{r([...n,h])},d=tn({resolver:nn(OW),defaultValues:{openaiCredsId:"",expire:"0",keywordFinish:"#SAIR",delayMessage:"1000",unknownMessage:"Mensagem não reconhecida",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0",ignoreJids:[],openaiIdFallback:void 0}});v.useEffect(()=>{iS(t,s,l)},[t]),v.useEffect(()=>{var h;o&&(d.reset({openaiCredsId:o.openaiCredsId,expire:o!=null&&o.expire?o.expire.toString():"0",keywordFinish:o.keywordFinish,delayMessage:o.delayMessage?o.delayMessage.toString():"0",unknownMessage:o.unknownMessage,listeningFromMe:o.listeningFromMe,stopBotFromMe:o.stopBotFromMe,keepOpen:o.keepOpen,debounceTime:o.debounceTime?o.debounceTime.toString():"0",ignoreJids:o.ignoreJids,openaiIdFallback:o.openaiIdFallback}),r(((h=o.ignoreJids)==null?void 0:h.map(g=>({id:g,text:g,className:""})))||[]))},[o]);const p=async()=>{var h,g,m;try{const w=d.getValues();if(!t||!t.name)throw new Error("Nome da instância não encontrado.");const x={openaiCredsId:w.openaiCredsId,expire:parseInt(w.expire),keywordFinish:w.keywordFinish,delayMessage:parseInt(w.delayMessage),unknownMessage:w.unknownMessage,listeningFromMe:w.listeningFromMe,stopBotFromMe:w.stopBotFromMe,keepOpen:w.keepOpen,debounceTime:parseInt(w.debounceTime),openaiIdFallback:w.openaiIdFallback||void 0,ignoreJids:n.map(y=>y.text)};await N3(t.name,t.token,x),De.success("Configuração salva com sucesso!")}catch(w){console.error("Erro ao criar bot:",w),De.error(`Erro ao criar : ${(m=(g=(h=w==null?void 0:w.response)==null?void 0:h.data)==null?void 0:g.response)==null?void 0:m.message}`)}};function f(){iS(t,s,l)}return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ru,{})," Configurações Padrão"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:f,children:[i.jsx(dn,{children:i.jsx(On,{children:"Configurações Padrão"})}),i.jsx(Uo,{...d,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:d.control,name:"openaiCredsId",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Credencial"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma credencial"})})}),i.jsx(vt,{className:"border border-gray-600",children:e.map(g=>i.jsx(he,{value:`${g.id}`,children:g.name?g.name:g.apiKey.substring(0,15)+"..."},g.id))})]})]})}),i.jsx(P,{control:d.control,name:"openaiIdFallback",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Bot Fallback"}),i.jsxs(St,{onValueChange:h.onChange,defaultValue:h.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um bot"})})}),i.jsx(vt,{className:"border border-gray-600",children:a&&a.length>0&&a.map(g=>i.jsx(he,{value:`${g.id}`,children:g.id},g.id))})]})]})}),i.jsx(P,{control:d.control,name:"expire",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:d.control,name:"keywordFinish",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:d.control,name:"delayMessage",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:d.control,name:"unknownMessage",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:d.control,name:"listeningFromMe",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:d.control,name:"stopBotFromMe",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:d.control,name:"keepOpen",render:({field:h})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:h.value,onCheckedChange:h.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:d.control,name:"debounceTime",render:({field:h})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...h,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})}),i.jsx(P,{control:d.control,name:"ignoreJids",render:({field:h})=>i.jsxs("div",{className:"pb-4",children:[i.jsx("label",{className:"block text-sm font-medium",children:"Ignorar JIDs"}),i.jsx(sx,{tags:n,handleDelete:c,handleAddition:u,inputFieldPosition:"bottom",placeholder:"Adicionar JIDs ex: 1234567890@s.whatsapp.net",autoFocus:!1,classNames:{tags:"tagsClass",tagInput:"tagInputClass",tagInputField:"tagInputFieldClass",selected:"selectedClass",tag:"tagClass",remove:"removeClass",suggestions:"suggestionsClass",activeSuggestion:"activeSuggestionClass",editTagInput:"editTagInputClass",editTagInputField:"editTagInputFieldClass",clearAll:"clearAllClass"}}),i.jsx("input",{type:"hidden",...h,value:n.map(g=>g.text).join(",")})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{variant:"default",type:"button",onClick:p,children:"Salvar"})})]})})]})]})}const lS=async(e,t,n,r)=>{try{const o=localStorage.getItem("token");if(o&&e&&e.name){const s=await nN(e.name,o);t(s);const a=await tN(e.name,o);n(a)}else console.error("Token ou nome da instância não encontrados.");r(!1)}catch(o){console.error("Erro ao carregar configurações:",o),r(!1)}};function cS(){const{instance:e}=Tt(),{openaiBotId:t}=Ta(),[n,r]=v.useState(!0),[o,s]=v.useState([]),[a,l]=v.useState([]),c=ir();v.useEffect(()=>{lS(e,s,l,r)},[e]);const u=p=>{e&&c(`/manager/instance/${e.id}/openai/${p}`)},d=()=>{lS(e,s,l,r)};return i.jsxs("main",{className:"main-table pt-5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"ml-5 mb-1 text-lg font-medium",children:"Openai Bots"}),i.jsxs("div",{children:[i.jsx(MW,{creds:a}),i.jsx(PU,{}),i.jsx(NU,{resetTable:d,creds:a})]})]}),i.jsx(Dt,{className:"mt-4 border border-black"}),i.jsxs(su,{direction:"horizontal",children:[i.jsx(ro,{defaultSize:35,className:"p-5",children:i.jsx("div",{className:"table",children:n?i.jsx(Fo,{}):i.jsx(i.Fragment,{children:o&&o.length>0?o.map(p=>i.jsxs("div",{className:`table-item ${p.id===t?"selected":""}`,onClick:()=>u(`${p.id}`),children:[i.jsx("h3",{className:"table-item-title",children:p.id}),i.jsx("p",{className:"table-item-description",children:p.botType})]})):i.jsx("p",{children:"Nenhum bot encontrado."})})})}),i.jsx(au,{withHandle:!0,className:"border border-black"}),i.jsx(ro,{className:"",children:t&&i.jsx(TU,{creds:a,openaiBotId:t,instance:e,resetTable:d})})]})]})}const QN=new zr,AW=async(e,t)=>(await QN.getInstance().get(`/proxy/find/${e}`,{headers:{apikey:t}})).data,FW=async(e,t,n)=>(await QN.getInstance().post(`/proxy/set/${e}`,n,{headers:{apikey:t}})).data,LW=T.object({enabled:T.boolean(),host:T.string(),port:T.string(),protocol:T.string(),username:T.string(),password:T.string()});function $W(){const{instance:e}=Tt(),[t,n]=v.useState(!1),r=tn({resolver:nn(LW),defaultValues:{enabled:!1,host:"",port:"",protocol:"http",username:"",password:""}});v.useEffect(()=>{(async()=>{if(e){n(!0);try{const a=await AW(e.name,e.token);r.reset(a)}catch(a){console.error("Erro ao buscar dados do proxy:",a)}finally{n(!1)}}})()},[e,r]);const o=async()=>{var a,l,c;if(!e)return;const s=r.getValues();n(!0);try{const u={enabled:s.enabled,host:s.host,port:s.port,protocol:s.protocol,username:s.username,password:s.password};await FW(e.name,e.token,u),De.success("Proxy criado com sucesso")}catch(u){console.error("Erro ao criar proxy:",u),De.error(`Erro ao criar : ${(c=(l=(a=u==null?void 0:u.response)==null?void 0:a.data)==null?void 0:l.response)==null?void 0:c.message}`)}finally{n(!1)}};return i.jsx("main",{className:"main-content",children:i.jsx(uo,{...r,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Proxy"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:r.control,name:"enabled",render:({field:s})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o proxy"})]}),i.jsx(ae,{children:i.jsx(je,{checked:s.value,onCheckedChange:s.onChange})})]})}),i.jsx(P,{control:r.control,name:"host",render:({field:s})=>i.jsx(se,{...s,className:"border border-gray-600 w-full",placeholder:"Host"})}),i.jsx(P,{control:r.control,name:"port",render:({field:s})=>i.jsx(se,{...s,className:"border border-gray-600 w-full",placeholder:"Porta",type:"number"})}),i.jsx(P,{control:r.control,name:"protocol",render:({field:s})=>i.jsx(se,{...s,className:"border border-gray-600 w-full",placeholder:"Protocolo"})}),i.jsx(P,{control:r.control,name:"username",render:({field:s})=>i.jsx(se,{...s,className:"border border-gray-600 w-full",placeholder:"Usuário"})}),i.jsx(P,{control:r.control,name:"password",render:({field:s})=>i.jsx(se,{...s,className:"border border-gray-600 w-full",placeholder:"Senha",type:"password"})})]})]}),i.jsx(Te,{disabled:t,onClick:o,children:t?"Salvando...":"Salvar"})]})})})}const eR=new zr,zW=async(e,t)=>(await eR.getInstance().get(`/rabbitmq/find/${e}`,{headers:{apikey:t}})).data,VW=async(e,t,n)=>(await eR.getInstance().post(`/rabbitmq/set/${e}`,n,{headers:{apikey:t}})).data,UW=T.object({enabled:T.boolean(),events:T.array(T.string())});function BW(){const{instance:e}=Tt(),[t,n]=v.useState(!1),r=tn({resolver:nn(UW),defaultValues:{enabled:!1,events:[]}});v.useEffect(()=>{(async()=>{if(e){n(!0);try{const l=await zW(e.name,e.token);r.reset(l)}catch(l){console.error("Erro ao buscar dados do rabbitmq:",l)}finally{n(!1)}}})()},[e,r]);const o=async()=>{var l,c,u;if(!e)return;const a=r.getValues();n(!0);try{const d={enabled:a.enabled,events:a.events};await VW(e.name,e.token,d),De.success("Rabbitmq criado com sucesso")}catch(d){console.error("Erro ao criar rabbitmq:",d),De.error(`Erro ao criar : ${(u=(c=(l=d==null?void 0:d.response)==null?void 0:l.data)==null?void 0:c.response)==null?void 0:u.message}`)}finally{n(!1)}},s=["APPLICATION_STARTUP","QRCODE_UPDATED","MESSAGES_SET","MESSAGES_UPSERT","MESSAGES_UPDATE","MESSAGES_DELETE","SEND_MESSAGE","CONTACTS_SET","CONTACTS_UPSERT","CONTACTS_UPDATE","PRESENCE_UPDATE","CHATS_SET","CHATS_UPSERT","CHATS_UPDATE","CHATS_DELETE","GROUPS_UPSERT","GROUP_UPDATE","GROUP_PARTICIPANTS_UPDATE","CONNECTION_UPDATE","LABELS_EDIT","LABELS_ASSOCIATION","CALL","TYPEBOT_START","TYPEBOT_CHANGE_STATUS"];return i.jsx("main",{className:"main-content",children:i.jsx(uo,{...r,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Rabbitmq"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:r.control,name:"enabled",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o rabbitmq"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"events",render:({field:a})=>i.jsxs(M,{className:"flex flex-col",children:[i.jsx(A,{children:"Eventos"}),i.jsx(ae,{children:i.jsx(i.Fragment,{children:s.map(l=>i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsx("span",{children:l}),i.jsx(je,{checked:a.value.includes(l),onCheckedChange:c=>{c?a.onChange([...a.value,l]):a.onChange(a.value.filter(u=>u!==l))}})]},l))})})]})})]})]}),i.jsx(Te,{disabled:t,onClick:o,children:t?"Salvando...":"Salvar"})]})})})}const HW=T.object({rejectCall:T.boolean(),msgCall:T.string().optional(),groupsIgnore:T.boolean(),alwaysOnline:T.boolean(),readMessages:T.boolean(),syncFullHistory:T.boolean(),readStatus:T.boolean()});function GW(){const[e,t]=v.useState(!0),[n,r]=v.useState(!1),[o,s]=v.useState(""),{instance:a}=Tt(),l=tn({resolver:nn(HW),defaultValues:{rejectCall:!1,msgCall:"",groupsIgnore:!1,alwaysOnline:!1,readMessages:!1,syncFullHistory:!1,readStatus:!1}});v.useEffect(()=>{(async()=>{try{if(a&&a.name&&a.token){s(a.token);const d=await qM(a.name,a.token);l.reset({rejectCall:d.rejectCall,msgCall:d.msgCall||"",groupsIgnore:d.groupsIgnore,alwaysOnline:d.alwaysOnline,readMessages:d.readMessages,syncFullHistory:d.syncFullHistory,readStatus:d.readStatus})}else console.error("Token ou nome da instância não encontrados.");t(!1)}catch(d){console.error("Erro ao carregar configurações:",d),t(!1)}})()},[l,a]);const c=async u=>{try{if(!a||!a.name)throw new Error("Nome da instância não encontrado.");r(!0);const d={rejectCall:u.rejectCall,msgCall:u.msgCall,groupsIgnore:u.groupsIgnore,alwaysOnline:u.alwaysOnline,readMessages:u.readMessages,syncFullHistory:u.syncFullHistory,readStatus:u.readStatus};await ZM(a.name,o,d),De.success("Configurações atualizadas com sucesso!")}catch(d){console.error("Erro ao atualizar configurações:",d),De.error("Erro ao atualizar configurações.")}finally{r(!1)}};return e?i.jsx(Fo,{}):i.jsx("main",{className:"main-content",children:i.jsx(uo,{...l,children:i.jsxs("form",{onSubmit:l.handleSubmit(c),className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Comportamento"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:l.control,name:"rejectCall",render:({field:u})=>i.jsxs(M,{className:"flex flex-col items-start rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"flex flex-row items-center justify-between w-full",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Rejeitar Chamadas"}),i.jsx($t,{children:"Rejeitas chamadas de voz e vídeo no Whatsapp"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]}),u.value&&i.jsx("div",{className:"w-full mt-4",children:i.jsx(P,{control:l.control,name:"msgCall",render:({field:d})=>i.jsx(ae,{children:i.jsx(ko,{...d,placeholder:"Mensagem ao rejeitar chamada",className:"border border-gray-600 w-full"})})})})]})}),i.jsx(P,{control:l.control,name:"groupsIgnore",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ignorar Grupos"}),i.jsx($t,{children:"Ignora eventos de grupos no Whatsapp"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]})}),i.jsx(P,{control:l.control,name:"alwaysOnline",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Sempre Online"}),i.jsx($t,{children:"Mantém o Whatsapp sempre online"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]})}),i.jsx(P,{control:l.control,name:"readMessages",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Visualizar Mensagens"}),i.jsx($t,{children:"Visualiza mensagens automaticamente"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]})}),i.jsx(P,{control:l.control,name:"syncFullHistory",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Sincronizar Histórico Completo"}),i.jsx($t,{children:"Sincroniza o histórico completo de mensagens ao ler o qrcode"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]})}),i.jsx(P,{control:l.control,name:"readStatus",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Visualizar Status"}),i.jsx($t,{children:"Recebe eventos dos broadcasts e visualiza todos os status"})]}),i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})})]})})]})]}),i.jsx(Te,{type:"submit",disabled:n,children:n?"Salvando...":"Salvar"})]})})})}const tR=new zr,WW=async(e,t)=>(await tR.getInstance().get(`/sqs/find/${e}`,{headers:{apikey:t}})).data,KW=async(e,t,n)=>(await tR.getInstance().post(`/sqs/set/${e}`,n,{headers:{apikey:t}})).data,qW=T.object({enabled:T.boolean(),events:T.array(T.string())});function ZW(){const{instance:e}=Tt(),[t,n]=v.useState(!1),r=tn({resolver:nn(qW),defaultValues:{enabled:!1,events:[]}});v.useEffect(()=>{(async()=>{if(e){n(!0);try{const l=await WW(e.name,e.token);r.reset(l)}catch(l){console.error("Erro ao buscar dados do sqs:",l)}finally{n(!1)}}})()},[e,r]);const o=async()=>{var l,c,u;if(!e)return;const a=r.getValues();n(!0);try{const d={enabled:a.enabled,events:a.events};await KW(e.name,e.token,d),De.success("Sqs criado com sucesso")}catch(d){console.error("Erro ao criar sqs:",d),De.error(`Erro ao criar : ${(u=(c=(l=d==null?void 0:d.response)==null?void 0:l.data)==null?void 0:c.response)==null?void 0:u.message}`)}finally{n(!1)}},s=["APPLICATION_STARTUP","QRCODE_UPDATED","MESSAGES_SET","MESSAGES_UPSERT","MESSAGES_UPDATE","MESSAGES_DELETE","SEND_MESSAGE","CONTACTS_SET","CONTACTS_UPSERT","CONTACTS_UPDATE","PRESENCE_UPDATE","CHATS_SET","CHATS_UPSERT","CHATS_UPDATE","CHATS_DELETE","GROUPS_UPSERT","GROUP_UPDATE","GROUP_PARTICIPANTS_UPDATE","CONNECTION_UPDATE","LABELS_EDIT","LABELS_ASSOCIATION","CALL","TYPEBOT_START","TYPEBOT_CHANGE_STATUS"];return i.jsx("main",{className:"main-content",children:i.jsx(uo,{...r,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Sqs"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:r.control,name:"enabled",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o sqs"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"events",render:({field:a})=>i.jsxs(M,{className:"flex flex-col",children:[i.jsx(A,{children:"Eventos"}),i.jsx(ae,{children:i.jsx(i.Fragment,{children:s.map(l=>i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsx("span",{children:l}),i.jsx(je,{checked:a.value.includes(l),onCheckedChange:c=>{c?a.onChange([...a.value,l]):a.onChange(a.value.filter(u=>u!==l))}})]},l))})})]})})]})]}),i.jsx(Te,{disabled:t,onClick:o,children:t?"Salvando...":"Salvar"})]})})})}const Wo=new zr,nR=async(e,t)=>(await Wo.getInstance().get(`/typebot/find/${e}`,{headers:{apikey:t}})).data,JW=async(e,t,n)=>(await Wo.getInstance().get(`/typebot/fetch/${n}/${e}`,{headers:{apikey:t}})).data,YW=async(e,t,n)=>(await Wo.getInstance().post(`/typebot/create/${e}`,n,{headers:{apikey:t}})).data,XW=async(e,t,n,r)=>(await Wo.getInstance().put(`/typebot/update/${n}/${e}`,r,{headers:{apikey:t}})).data,QW=async(e,t,n)=>(await Wo.getInstance().delete(`/typebot/delete/${n}/${e}`,{headers:{apikey:t}})).data,eK=async(e,t)=>(await Wo.getInstance().get(`/typebot/fetchSettings/${e}`,{headers:{apikey:t}})).data,tK=async(e,t,n)=>(await Wo.getInstance().post(`/typebot/settings/${e}`,n,{headers:{apikey:t}})).data,nK=async(e,t,n)=>(await Wo.getInstance().get(`/typebot/fetchSessions/${n}/${e}`,{headers:{apikey:t}})).data,rK=async(e,t,n,r)=>(await Wo.getInstance().post(`/typebot/changeStatus/${e}`,{remoteJid:n,status:r},{headers:{apikey:t}})).data,oK=T.object({enabled:T.boolean(),url:T.string().url(),typebot:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string())});function sK({resetTable:e}){const{instance:t}=Tt(),[n,r]=v.useState(!1),[o,s]=v.useState(!1),a=tn({resolver:nn(oK),defaultValues:{enabled:!0,url:"",typebot:"",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0",ignoreJids:[]}}),l=async u=>{var d,p,f;try{if(!t||!t.name)throw new Error("Nome da instância não encontrado.");r(!0);const h={enabled:u.enabled,url:u.url,typebot:u.typebot,triggerType:u.triggerType,triggerOperator:u.triggerOperator||"",triggerValue:u.triggerValue||"",expire:parseInt(u.expire,10),keywordFinish:u.keywordFinish,delayMessage:parseInt(u.delayMessage,10),unknownMessage:u.unknownMessage,listeningFromMe:u.listeningFromMe,stopBotFromMe:u.stopBotFromMe,keepOpen:u.keepOpen,debounceTime:parseInt(u.debounceTime,10)};await YW(t.name,t.token,h),De.success("Typebot criado com sucesso!"),s(!1),c(),e()}catch(h){console.error("Erro ao criar typebot:",h),De.error(`Erro ao criar : ${(f=(p=(d=h==null?void 0:h.response)==null?void 0:d.data)==null?void 0:p.response)==null?void 0:f.message}`)}finally{r(!1)}};function c(){a.reset()}return i.jsxs(Sn,{open:o,onOpenChange:s,children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ou,{})," Typebot"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:c,children:[i.jsx(dn,{children:i.jsx(On,{children:"Novo Typebot"})}),i.jsx(Uo,{...a,children:i.jsxs("form",{onSubmit:a.handleSubmit(l),className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:a.control,name:"enabled",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Typebot Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"url",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"URL da API do Typebot"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"URL da API do Typebot"})]})}),i.jsx(P,{control:a.control,name:"typebot",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Nome do Typebot"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Nome do Typebot"})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"triggerType",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:u.onChange,defaultValue:u.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),a.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:a.control,name:"triggerOperator",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:u.onChange,defaultValue:u.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:a.control,name:"triggerValue",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"expire",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:a.control,name:"keywordFinish",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:a.control,name:"delayMessage",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:a.control,name:"unknownMessage",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:a.control,name:"listeningFromMe",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:a.control,name:"stopBotFromMe",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:a.control,name:"keepOpen",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:a.control,name:"debounceTime",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{disabled:n,variant:"default",type:"submit",children:"Salvar"})})]})})]})]})}const uS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await nK(e.name,r,t);n(o)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar sessões:",r)}};function aK({typebotId:e}){var d,p;const{instance:t}=Tt(),[n,r]=v.useState([]),[o,s]=v.useState([]);v.useEffect(()=>{uS(t,e,s)},[t,e]);function a(){uS(t,e,s)}const l=async(f,h)=>{var g,m,w;try{if(!t)return;await rK(t.name,t.token,f,h),De.success("Status alterado com sucesso."),a()}catch(x){console.error("Erro ao atualizar:",x),De.error(`Erro ao atualizar : ${(w=(m=(g=x==null?void 0:x.response)==null?void 0:g.data)==null?void 0:m.response)==null?void 0:w.message}`)}},c=[{accessorKey:"remoteJid",header:()=>i.jsx("div",{className:"text-center",children:"Remote Jid"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("remoteJid")})},{accessorKey:"pushName",header:()=>i.jsx("div",{className:"text-center",children:"Push Name"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("pushName")})},{accessorKey:"sessionId",header:()=>i.jsx("div",{className:"text-center",children:"Session ID"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("sessionId")})},{accessorKey:"status",header:()=>i.jsx("div",{className:"text-center",children:"Status"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("status")})},{id:"actions",enableHiding:!1,cell:({row:f})=>{const h=f.original;return i.jsxs(kp,{children:[i.jsx(Np,{asChild:!0,children:i.jsxs(Te,{variant:"ghost",className:"h-8 w-8 p-0",children:[i.jsx("span",{className:"sr-only",children:"Open menu"}),i.jsx(ep,{className:"h-4 w-4"})]})}),i.jsxs(qi,{align:"end",children:[i.jsx(pu,{children:"Actions"}),i.jsx(Zi,{}),h.status!=="opened"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"opened"),children:[i.jsx(ny,{className:"w-4 h-4 mr-2"}),"Abrir"]}),h.status!=="paused"&&h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"paused"),children:[i.jsx(ty,{className:"w-4 h-4 mr-2"}),"Pausar"]}),h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"closed"),children:[i.jsx(Yv,{className:"w-4 h-4 mr-2"}),"Fechar"]}),i.jsxs(xn,{onClick:()=>l(h.remoteJid,"delete"),children:[i.jsx(Xv,{className:"w-4 h-4 mr-2"}),"Excluir"]})]})]})}}],u=Mp({data:o,columns:c,onSortingChange:r,getCoreRowModel:Pp(),getPaginationRowModel:Dp(),getSortedRowModel:Op(),getFilteredRowModel:Ip(),state:{sorting:n}});return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5 text-white",children:[i.jsx(Qv,{})," Sessões"]})}),i.jsxs(un,{className:"sm:max-w-[950px] overflow-y-auto",onCloseAutoFocus:a,children:[i.jsx(dn,{children:i.jsx(On,{children:"Sessões"})}),i.jsxs("div",{children:[i.jsx(se,{placeholder:"Search by remoteJid...",value:((d=u.getColumn("remoteJid"))==null?void 0:d.getFilterValue())??"",onChange:f=>{var h;return(h=u.getColumn("remoteJid"))==null?void 0:h.setFilterValue(f.target.value)},className:"max-w-sm border border-gray-300 rounded-md"}),i.jsxs(hu,{children:[i.jsx(gu,{children:u.getHeaderGroups().map(f=>i.jsx(nr,{children:f.headers.map(h=>i.jsx(vu,{children:h.isPlaceholder?null:Ds(h.column.columnDef.header,h.getContext())},h.id))},f.id))}),i.jsx(mu,{children:(p=u.getRowModel().rows)!=null&&p.length?u.getRowModel().rows.map(f=>i.jsx(nr,{"data-state":f.getIsSelected()&&"selected",children:f.getVisibleCells().map(h=>i.jsx(Lo,{children:Ds(h.column.columnDef.cell,h.getContext())},h.id))},f.id)):i.jsx(nr,{children:i.jsx(Lo,{colSpan:c.length,className:"h-24 text-center",children:"No results."})})})]})]})]})]})}const iK=T.object({enabled:T.boolean(),url:T.string().url(),typebot:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string())});function lK({typebotId:e,instance:t,resetTable:n}){const[,r]=v.useState(""),[o,s]=v.useState(!0),[a,l]=v.useState(!1),c=ir(),u=tn({resolver:nn(iK),defaultValues:{enabled:!0,url:"",typebot:"",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0",ignoreJids:[]}});v.useEffect(()=>{(async()=>{try{const h=localStorage.getItem("token");if(h&&t&&t.name&&e){r(h);const g=await JW(t.name,h,e);u.reset({enabled:g.enabled,url:g.url,typebot:g.typebot,triggerType:g.triggerType,triggerOperator:g.triggerOperator,triggerValue:g.triggerValue,expire:g.expire.toString(),keywordFinish:g.keywordFinish,delayMessage:g.delayMessage.toString(),unknownMessage:g.unknownMessage,listeningFromMe:g.listeningFromMe,stopBotFromMe:g.stopBotFromMe,keepOpen:g.keepOpen,debounceTime:g.debounceTime.toString()})}else console.error("Token ou nome da instância não encontrados.");s(!1)}catch(h){console.error("Erro ao carregar configurações:",h),s(!1)}})()},[u,t,e]);const d=async()=>{var f,h,g;try{const m=u.getValues(),w=localStorage.getItem("token");if(w&&t&&t.name&&e){const x={enabled:m.enabled,url:m.url,typebot:m.typebot,triggerType:m.triggerType,triggerOperator:m.triggerOperator||"",triggerValue:m.triggerValue||"",expire:parseInt(m.expire,10),keywordFinish:m.keywordFinish,delayMessage:parseInt(m.delayMessage,10),unknownMessage:m.unknownMessage,listeningFromMe:m.listeningFromMe,stopBotFromMe:m.stopBotFromMe,keepOpen:m.keepOpen,debounceTime:parseInt(m.debounceTime,10)};await XW(t.name,w,e,x),De.success("Typebot atualizado com sucesso.")}else console.error("Token ou nome da instância não encontrados.")}catch(m){console.error("Erro ao atualizar typebot:",m),De.error(`Erro ao atualizar : ${(g=(h=(f=m==null?void 0:m.response)==null?void 0:f.data)==null?void 0:h.response)==null?void 0:g.message}`)}},p=async()=>{try{const f=localStorage.getItem("token");f&&t&&t.name&&e?(await QW(t.name,f,e),De.success("Typebot excluído com sucesso."),l(!1),n(),c(`/manager/instance/${t.id}/typebot`)):console.error("Token ou nome da instância não encontrados.")}catch(f){console.error("Erro ao excluir typebot:",f)}};return i.jsxs("div",{className:"form",children:[o&&i.jsx(Fo,{}),!o&&i.jsx(uo,{...u,children:i.jsxs("form",{onSubmit:u.handleSubmit(d),className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Typebot"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:u.control,name:"enabled",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Typebot Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"url",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"URL da API do Typebot"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"URL da API do Typebot"})]})}),i.jsx(P,{control:u.control,name:"typebot",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Nome do Typebot"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Nome do Typebot"})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"triggerType",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),u.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:u.control,name:"triggerOperator",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:u.control,name:"triggerValue",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"expire",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:u.control,name:"keywordFinish",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:u.control,name:"delayMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:u.control,name:"unknownMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:u.control,name:"listeningFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:u.control,name:"stopBotFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:u.control,name:"keepOpen",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:u.control,name:"debounceTime",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})]}),i.jsx("div",{children:i.jsx(aK,{typebotId:e})}),i.jsx(Te,{className:"bg-blue-400 hover:bg-blue-600 text-white",onClick:d,children:"Atualizar"}),i.jsxs(Sn,{open:a,onOpenChange:l,children:[i.jsx(Cn,{asChild:!0,children:i.jsx(Te,{variant:"secondary",className:"ml-2 bg-red-400 hover:bg-red-600",children:"Excluir"})}),i.jsx(un,{children:i.jsxs(dn,{children:[i.jsx(On,{children:"Tem certeza que deseja excluir?"}),i.jsx(Pi,{children:"Esta ação não pode ser desfeita."}),i.jsxs(wr,{children:[i.jsx(Te,{variant:"default",className:"bg-red-400 hover:bg-red-600 text-white",onClick:p,children:"Exluir"}),i.jsx(Te,{variant:"outline",onClick:()=>l(!1),children:"Cancelar"})]})]})})]})]})})]})}const cK=T.object({expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string()),typebotIdFallback:T.string().optional()}),dS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await eK(e.name,r);t(o);const s=await nR(e.name,r);n(s)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar configurações:",r)}};function uK(){const{instance:e}=Tt(),[t,n]=v.useState([]),[r,o]=v.useState(),[s,a]=v.useState([]),l=f=>{n(t.filter((h,g)=>g!==f))},c=f=>{n([...t,f])},u=tn({resolver:nn(cK),defaultValues:{expire:"0",keywordFinish:"#SAIR",delayMessage:"1000",unknownMessage:"Mensagem não reconhecida",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0",ignoreJids:[],typebotIdFallback:void 0}});v.useEffect(()=>{dS(e,o,a)},[e]),v.useEffect(()=>{var f;r&&(u.reset({expire:r!=null&&r.expire?r.expire.toString():"0",keywordFinish:r.keywordFinish,delayMessage:r.delayMessage?r.delayMessage.toString():"0",unknownMessage:r.unknownMessage,listeningFromMe:r.listeningFromMe,stopBotFromMe:r.stopBotFromMe,keepOpen:r.keepOpen,debounceTime:r.debounceTime?r.debounceTime.toString():"0",ignoreJids:r.ignoreJids,typebotIdFallback:r.typebotIdFallback}),n(((f=r.ignoreJids)==null?void 0:f.map(h=>({id:h,text:h,className:""})))||[]))},[r]);const d=async()=>{var f,h,g;try{const m=u.getValues();if(!e||!e.name)throw new Error("Nome da instância não encontrado.");const w={expire:parseInt(m.expire),keywordFinish:m.keywordFinish,delayMessage:parseInt(m.delayMessage),unknownMessage:m.unknownMessage,listeningFromMe:m.listeningFromMe,stopBotFromMe:m.stopBotFromMe,keepOpen:m.keepOpen,debounceTime:parseInt(m.debounceTime),typebotIdFallback:m.typebotIdFallback||void 0,ignoreJids:t.map(x=>x.text)};await tK(e.name,e.token,w),De.success("Configuração salva com sucesso!")}catch(m){console.error("Erro ao criar bot:",m),De.error(`Erro ao criar : ${(g=(h=(f=m==null?void 0:m.response)==null?void 0:f.data)==null?void 0:h.response)==null?void 0:g.message}`)}};function p(){dS(e,o,a)}return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ru,{})," Configurações Padrão"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:p,children:[i.jsx(dn,{children:i.jsx(On,{children:"Configurações Padrão"})}),i.jsx(Uo,{...u,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:u.control,name:"typebotIdFallback",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Typebot Fallback"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um typebot"})})}),i.jsx(vt,{className:"border border-gray-600",children:s.map(h=>i.jsx(he,{value:`${h.id}`,children:h.typebot},h.id))})]})]})}),i.jsx(P,{control:u.control,name:"expire",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:u.control,name:"keywordFinish",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:u.control,name:"delayMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:u.control,name:"unknownMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:u.control,name:"listeningFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:u.control,name:"stopBotFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:u.control,name:"keepOpen",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:u.control,name:"debounceTime",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})}),i.jsx(P,{control:u.control,name:"ignoreJids",render:({field:f})=>i.jsxs("div",{className:"pb-4",children:[i.jsx("label",{className:"block text-sm font-medium",children:"Ignorar JIDs"}),i.jsx(sx,{tags:t,handleDelete:l,handleAddition:c,inputFieldPosition:"bottom",placeholder:"Adicionar JIDs ex: 1234567890@s.whatsapp.net",autoFocus:!1,classNames:{tags:"tagsClass",tagInput:"tagInputClass",tagInputField:"tagInputFieldClass",selected:"selectedClass",tag:"tagClass",remove:"removeClass",suggestions:"suggestionsClass",activeSuggestion:"activeSuggestionClass",editTagInput:"editTagInputClass",editTagInputField:"editTagInputFieldClass",clearAll:"clearAllClass"}}),i.jsx("input",{type:"hidden",...f,value:t.map(h=>h.text).join(",")})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{variant:"default",type:"button",onClick:d,children:"Salvar"})})]})})]})]})}const fS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await nR(e.name,r);t(o)}else console.error("Token ou nome da instância não encontrados.");n(!1)}catch(r){console.error("Erro ao carregar configurações:",r),n(!1)}};function pS(){const{instance:e}=Tt(),{typebotId:t}=Ta(),[n,r]=v.useState(!0),[o,s]=v.useState([]),a=ir();v.useEffect(()=>{fS(e,s,r)},[e]);const l=u=>{e&&a(`/manager/instance/${e.id}/typebot/${u}`)},c=()=>{fS(e,s,r)};return i.jsxs("main",{className:"main-table pt-5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"ml-5 mb-1 text-lg font-medium",children:"Typebots"}),i.jsxs("div",{children:[i.jsx(uK,{}),i.jsx(sK,{resetTable:c})]})]}),i.jsx(Dt,{className:"mt-4 border border-black"}),i.jsxs(su,{direction:"horizontal",children:[i.jsx(ro,{defaultSize:35,className:"p-5",children:i.jsx("div",{className:"table",children:n?i.jsx(Fo,{}):i.jsx(i.Fragment,{children:o&&o.length>0?o.map(u=>i.jsxs("div",{className:`table-item ${u.id===t?"selected":""}`,onClick:()=>l(`${u.id}`),children:[i.jsx("h3",{className:"table-item-title",children:u.url}),i.jsx("p",{className:"table-item-description",children:u.typebot})]})):i.jsx("p",{children:"Nenhum typebot encontrado."})})})}),i.jsx(au,{withHandle:!0,className:"border border-black"}),i.jsx(ro,{className:"",children:t&&i.jsx(lK,{typebotId:t,instance:e,resetTable:c})})]})]})}const Ko=new zr,rR=async(e,t)=>(await Ko.getInstance().get(`/dify/find/${e}`,{headers:{apikey:t}})).data,dK=async(e,t,n)=>(await Ko.getInstance().get(`/dify/fetch/${n}/${e}`,{headers:{apikey:t}})).data,fK=async(e,t,n)=>(await Ko.getInstance().post(`/dify/create/${e}`,n,{headers:{apikey:t}})).data,pK=async(e,t,n,r)=>(await Ko.getInstance().put(`/dify/update/${n}/${e}`,r,{headers:{apikey:t}})).data,hK=async(e,t,n)=>(await Ko.getInstance().delete(`/dify/delete/${n}/${e}`,{headers:{apikey:t}})).data,gK=async(e,t)=>(await Ko.getInstance().get(`/dify/fetchSettings/${e}`,{headers:{apikey:t}})).data,mK=async(e,t,n)=>(await Ko.getInstance().post(`/dify/settings/${e}`,n,{headers:{apikey:t}})).data,vK=async(e,t,n)=>(await Ko.getInstance().get(`/dify/fetchSessions/${n}/${e}`,{headers:{apikey:t}})).data,yK=async(e,t,n,r)=>(await Ko.getInstance().post(`/dify/changeStatus/${e}`,{remoteJid:n,status:r},{headers:{apikey:t}})).data,hS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await vK(e.name,r,t);n(o)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar sessões:",r)}};function xK({difyId:e}){var d,p;const{instance:t}=Tt(),[n,r]=v.useState([]),[o,s]=v.useState([]);v.useEffect(()=>{hS(t,e,s)},[t,e]);function a(){hS(t,e,s)}const l=async(f,h)=>{var g,m,w;try{if(!t)return;await yK(t.name,t.token,f,h),De.success("Status alterado com sucesso."),a()}catch(x){console.error("Erro ao atualizar:",x),De.error(`Erro ao atualizar : ${(w=(m=(g=x==null?void 0:x.response)==null?void 0:g.data)==null?void 0:m.response)==null?void 0:w.message}`)}},c=[{accessorKey:"remoteJid",header:()=>i.jsx("div",{className:"text-center",children:"Remote Jid"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("remoteJid")})},{accessorKey:"sessionId",header:()=>i.jsx("div",{className:"text-center",children:"Session ID"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("sessionId")})},{accessorKey:"status",header:()=>i.jsx("div",{className:"text-center",children:"Status"}),cell:({row:f})=>i.jsx("div",{children:f.getValue("status")})},{id:"actions",enableHiding:!1,cell:({row:f})=>{const h=f.original;return i.jsxs(kp,{children:[i.jsx(Np,{asChild:!0,children:i.jsxs(Te,{variant:"ghost",className:"h-8 w-8 p-0",children:[i.jsx("span",{className:"sr-only",children:"Open menu"}),i.jsx(ep,{className:"h-4 w-4"})]})}),i.jsxs(qi,{align:"end",children:[i.jsx(pu,{children:"Actions"}),i.jsx(Zi,{}),h.status!=="opened"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"opened"),children:[i.jsx(ny,{className:"w-4 h-4 mr-2"}),"Abrir"]}),h.status!=="paused"&&h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"paused"),children:[i.jsx(ty,{className:"w-4 h-4 mr-2"}),"Pausar"]}),h.status!=="closed"&&i.jsxs(xn,{onClick:()=>l(h.remoteJid,"closed"),children:[i.jsx(Yv,{className:"w-4 h-4 mr-2"}),"Fechar"]}),i.jsxs(xn,{onClick:()=>l(h.remoteJid,"delete"),children:[i.jsx(Xv,{className:"w-4 h-4 mr-2"}),"Excluir"]})]})]})}}],u=Mp({data:o,columns:c,onSortingChange:r,getCoreRowModel:Pp(),getPaginationRowModel:Dp(),getSortedRowModel:Op(),getFilteredRowModel:Ip(),state:{sorting:n}});return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5 text-white",children:[i.jsx(Qv,{})," Sessões"]})}),i.jsxs(un,{className:"sm:max-w-[950px] overflow-y-auto",onCloseAutoFocus:a,children:[i.jsx(dn,{children:i.jsx(On,{children:"Sessões"})}),i.jsxs("div",{children:[i.jsx(se,{placeholder:"Search by remoteJid...",value:((d=u.getColumn("remoteJid"))==null?void 0:d.getFilterValue())??"",onChange:f=>{var h;return(h=u.getColumn("remoteJid"))==null?void 0:h.setFilterValue(f.target.value)},className:"max-w-sm border border-gray-300 rounded-md"}),i.jsxs(hu,{children:[i.jsx(gu,{children:u.getHeaderGroups().map(f=>i.jsx(nr,{children:f.headers.map(h=>i.jsx(vu,{children:h.isPlaceholder?null:Ds(h.column.columnDef.header,h.getContext())},h.id))},f.id))}),i.jsx(mu,{children:(p=u.getRowModel().rows)!=null&&p.length?u.getRowModel().rows.map(f=>i.jsx(nr,{"data-state":f.getIsSelected()&&"selected",children:f.getVisibleCells().map(h=>i.jsx(Lo,{children:Ds(h.column.columnDef.cell,h.getContext())},h.id))},f.id)):i.jsx(nr,{children:i.jsx(Lo,{colSpan:c.length,className:"h-24 text-center",children:"No results."})})})]})]})]})]})}const wK=T.object({enabled:T.boolean(),botType:T.string(),apiUrl:T.string(),apiKey:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string()});function bK({difyId:e,instance:t,resetTable:n}){const[,r]=v.useState(""),[o,s]=v.useState(!0),[a,l]=v.useState(!1),c=ir(),u=tn({resolver:nn(wK),defaultValues:{enabled:!0,botType:"chatBot",apiUrl:"",apiKey:"",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0"}});v.useEffect(()=>{(async()=>{try{const h=localStorage.getItem("token");if(h&&t&&t.name&&e){r(h);const g=await dK(t.name,h,e);u.reset({enabled:g.enabled,botType:g.botType,apiUrl:g.apiUrl,apiKey:g.apiKey,triggerType:g.triggerType,triggerOperator:g.triggerOperator,triggerValue:g.triggerValue,expire:g.expire.toString(),keywordFinish:g.keywordFinish,delayMessage:g.delayMessage.toString(),unknownMessage:g.unknownMessage,listeningFromMe:g.listeningFromMe,stopBotFromMe:g.stopBotFromMe,keepOpen:g.keepOpen,debounceTime:g.debounceTime.toString()})}else console.error("Token ou nome da instância não encontrados.");s(!1)}catch(h){console.error("Erro ao carregar configurações:",h),s(!1)}})()},[u,t,e]);const d=async()=>{var f,h,g;try{const m=u.getValues(),w=localStorage.getItem("token");if(w&&t&&t.name&&e){const x={enabled:m.enabled,botType:m.botType,apiUrl:m.apiUrl,apiKey:m.apiKey,triggerType:m.triggerType,triggerOperator:m.triggerOperator||"",triggerValue:m.triggerValue||"",expire:parseInt(m.expire,10),keywordFinish:m.keywordFinish,delayMessage:parseInt(m.delayMessage,10),unknownMessage:m.unknownMessage,listeningFromMe:m.listeningFromMe,stopBotFromMe:m.stopBotFromMe,keepOpen:m.keepOpen,debounceTime:parseInt(m.debounceTime,10)};await pK(t.name,w,e,x),De.success("Dify atualizado com sucesso.")}else console.error("Token ou nome da instância não encontrados.")}catch(m){console.error("Erro ao atualizar bot:",m),De.error(`Erro ao atualizar : ${(g=(h=(f=m==null?void 0:m.response)==null?void 0:f.data)==null?void 0:h.response)==null?void 0:g.message}`)}},p=async()=>{try{const f=localStorage.getItem("token");f&&t&&t.name&&e?(await hK(t.name,f,e),De.success("Dify excluído com sucesso."),l(!1),n(),c(`/manager/instance/${t.id}/dify`)):console.error("Token ou nome da instância não encontrados.")}catch(f){console.error("Erro ao excluir dify:",f)}};return i.jsxs("div",{className:"form",children:[o&&i.jsx(Fo,{}),!o&&i.jsx(uo,{...u,children:i.jsxs("form",{onSubmit:u.handleSubmit(d),className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Dify"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:u.control,name:"enabled",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Dify Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"botType",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de Bot"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma tipo de bot"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"chatBot",children:"Chat Bot"}),i.jsx(he,{value:"textGenerator",children:"Gerador de texto"}),i.jsx(he,{value:"agent",children:"Agente"}),i.jsx(he,{value:"workflow",children:"Workflow"})]})]})]})}),i.jsx(P,{control:u.control,name:"apiUrl",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"URL da API"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"URL da API"})]})}),i.jsx(P,{control:u.control,name:"apiKey",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Chave da API"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Chave da API",type:"password"})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"triggerType",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),u.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:u.control,name:"triggerOperator",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:u.control,name:"triggerValue",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:u.control,name:"expire",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:u.control,name:"keywordFinish",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:u.control,name:"delayMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:u.control,name:"unknownMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:u.control,name:"listeningFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:u.control,name:"stopBotFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:u.control,name:"keepOpen",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:u.control,name:"debounceTime",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})]}),i.jsx("div",{children:i.jsx(xK,{difyId:e})}),i.jsx(Te,{className:"bg-blue-400 hover:bg-blue-600 text-white",onClick:d,children:"Atualizar"}),i.jsxs(Sn,{open:a,onOpenChange:l,children:[i.jsx(Cn,{asChild:!0,children:i.jsx(Te,{variant:"secondary",className:"ml-2 bg-red-400 hover:bg-red-600",children:"Excluir"})}),i.jsx(un,{children:i.jsxs(dn,{children:[i.jsx(On,{children:"Tem certeza que deseja excluir?"}),i.jsx(Pi,{children:"Esta ação não pode ser desfeita."}),i.jsxs(wr,{children:[i.jsx(Te,{variant:"default",className:"bg-red-400 hover:bg-red-600 text-white",onClick:p,children:"Exluir"}),i.jsx(Te,{variant:"outline",onClick:()=>l(!1),children:"Cancelar"})]})]})})]})]})})]})}const SK=T.object({enabled:T.boolean(),botType:T.string(),apiUrl:T.string(),apiKey:T.string(),triggerType:T.string(),triggerOperator:T.string().optional(),triggerValue:T.string().optional(),expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string()});function CK({resetTable:e}){const{instance:t}=Tt(),[n,r]=v.useState(!1),[o,s]=v.useState(!1),a=tn({resolver:nn(SK),defaultValues:{enabled:!0,botType:"chatBot",apiUrl:"",apiKey:"",triggerType:"keyword",triggerOperator:"contains",triggerValue:"",expire:"0",keywordFinish:"",delayMessage:"0",unknownMessage:"",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0"}}),l=async u=>{var d,p,f;try{if(!t||!t.name)throw new Error("Nome da instância não encontrado.");r(!0);const h={enabled:u.enabled,botType:u.botType,apiUrl:u.apiUrl,apiKey:u.apiKey,triggerType:u.triggerType,triggerOperator:u.triggerOperator||"",triggerValue:u.triggerValue||"",expire:parseInt(u.expire,10),keywordFinish:u.keywordFinish,delayMessage:parseInt(u.delayMessage,10),unknownMessage:u.unknownMessage,listeningFromMe:u.listeningFromMe,stopBotFromMe:u.stopBotFromMe,keepOpen:u.keepOpen,debounceTime:parseInt(u.debounceTime,10)};await fK(t.name,t.token,h),De.success("Dify criado com sucesso!"),s(!1),c(),e()}catch(h){console.error("Erro ao criar bot:",h),De.error(`Erro ao criar : ${(f=(p=(d=h==null?void 0:h.response)==null?void 0:d.data)==null?void 0:p.response)==null?void 0:f.message}`)}finally{r(!1)}};function c(){a.reset()}return i.jsxs(Sn,{open:o,onOpenChange:s,children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ou,{})," Dify"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:c,children:[i.jsx(dn,{children:i.jsx(On,{children:"Novo Dify"})}),i.jsx(Uo,{...a,children:i.jsxs("form",{onSubmit:a.handleSubmit(l),className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:a.control,name:"enabled",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Ativo"})})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Dify Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"botType",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de Bot"}),i.jsxs(St,{onValueChange:u.onChange,defaultValue:u.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione uma tipo de bot"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"chatBot",children:"Chat Bot"}),i.jsx(he,{value:"textGenerator",children:"Gerador de texto"}),i.jsx(he,{value:"agent",children:"Agente"}),i.jsx(he,{value:"workflow",children:"Workflow"})]})]})]})}),i.jsx(P,{control:a.control,name:"apiUrl",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"URL da API"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"URL da API"})]})}),i.jsx(P,{control:a.control,name:"apiKey",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Chave da API"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Chave da API",type:"password"})]})}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Trigger Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"triggerType",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tipo de gatilho"}),i.jsxs(St,{onValueChange:u.onChange,defaultValue:u.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um tipo"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"keyword",children:"Palavra Chave"}),i.jsx(he,{value:"all",children:"Todos"}),i.jsx(he,{value:"none",children:"Nenhum"})]})]})]})}),a.watch("triggerType")==="keyword"&&i.jsxs(i.Fragment,{children:[i.jsx(P,{control:a.control,name:"triggerOperator",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Operador do gatilho"}),i.jsxs(St,{onValueChange:u.onChange,defaultValue:u.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um operador"})})}),i.jsxs(vt,{className:"border border-gray-600",children:[i.jsx(he,{value:"contains",children:"Contém"}),i.jsx(he,{value:"equals",children:"Igual à"}),i.jsx(he,{value:"startsWith",children:"Começa com"}),i.jsx(he,{value:"endsWith",children:"Termina com"}),i.jsx(he,{value:"regex",children:"Regex"})]})]})]})}),i.jsx(P,{control:a.control,name:"triggerValue",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Gatilho"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Gatilho"})]})})]}),i.jsx("h3",{className:"mb-4 text-lg font-medium",children:"Options Settings"}),i.jsx(Dt,{className:"border border-gray-700"}),i.jsx(P,{control:a.control,name:"expire",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:a.control,name:"keywordFinish",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:a.control,name:"delayMessage",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:a.control,name:"unknownMessage",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:a.control,name:"listeningFromMe",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:a.control,name:"stopBotFromMe",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:a.control,name:"keepOpen",render:({field:u})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:u.value,onCheckedChange:u.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:a.control,name:"debounceTime",render:({field:u})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...u,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{disabled:n,variant:"default",type:"submit",children:"Salvar"})})]})})]})]})}const jK=T.object({expire:T.string(),keywordFinish:T.string(),delayMessage:T.string(),unknownMessage:T.string(),listeningFromMe:T.boolean(),stopBotFromMe:T.boolean(),keepOpen:T.boolean(),debounceTime:T.string(),ignoreJids:T.array(T.string()),difyIdFallback:T.string().optional()}),gS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await gK(e.name,r);t(o);const s=await rR(e.name,r);n(s)}else console.error("Token ou nome da instância não encontrados.")}catch(r){console.error("Erro ao carregar configurações:",r)}};function _K(){const{instance:e}=Tt(),[t,n]=v.useState([]),[r,o]=v.useState(),[s,a]=v.useState([]),l=f=>{n(t.filter((h,g)=>g!==f))},c=f=>{n([...t,f])},u=tn({resolver:nn(jK),defaultValues:{expire:"0",keywordFinish:"#SAIR",delayMessage:"1000",unknownMessage:"Mensagem não reconhecida",listeningFromMe:!1,stopBotFromMe:!1,keepOpen:!1,debounceTime:"0",ignoreJids:[],difyIdFallback:void 0}});v.useEffect(()=>{gS(e,o,a)},[e]),v.useEffect(()=>{var f;r&&(u.reset({expire:r!=null&&r.expire?r.expire.toString():"0",keywordFinish:r.keywordFinish,delayMessage:r.delayMessage?r.delayMessage.toString():"0",unknownMessage:r.unknownMessage,listeningFromMe:r.listeningFromMe,stopBotFromMe:r.stopBotFromMe,keepOpen:r.keepOpen,debounceTime:r.debounceTime?r.debounceTime.toString():"0",ignoreJids:r.ignoreJids,difyIdFallback:r.difyIdFallback}),n(((f=r.ignoreJids)==null?void 0:f.map(h=>({id:h,text:h,className:""})))||[]))},[r]);const d=async()=>{var f,h,g;try{const m=u.getValues();if(!e||!e.name)throw new Error("Nome da instância não encontrado.");const w={expire:parseInt(m.expire),keywordFinish:m.keywordFinish,delayMessage:parseInt(m.delayMessage),unknownMessage:m.unknownMessage,listeningFromMe:m.listeningFromMe,stopBotFromMe:m.stopBotFromMe,keepOpen:m.keepOpen,debounceTime:parseInt(m.debounceTime),difyIdFallback:m.difyIdFallback||void 0,ignoreJids:t.map(x=>x.text)};await mK(e.name,e.token,w),De.success("Configuração salva com sucesso!")}catch(m){console.error("Erro ao criar bot:",m),De.error(`Erro ao criar : ${(g=(h=(f=m==null?void 0:m.response)==null?void 0:f.data)==null?void 0:h.response)==null?void 0:g.message}`)}};function p(){gS(e,o,a)}return i.jsxs(Sn,{children:[i.jsx(Cn,{asChild:!0,children:i.jsxs(Te,{variant:"default",className:"mr-5",children:[i.jsx(ru,{})," Configurações Padrão"]})}),i.jsxs(un,{className:"sm:max-w-[740px] sm:max-h-[600px] overflow-y-auto",onCloseAutoFocus:p,children:[i.jsx(dn,{children:i.jsx(On,{children:"Configurações Padrão"})}),i.jsx(Uo,{...u,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsx("div",{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:u.control,name:"difyIdFallback",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Bot Fallback"}),i.jsxs(St,{onValueChange:f.onChange,defaultValue:f.value,children:[i.jsx(ae,{className:"border border-gray-600",children:i.jsx(mt,{children:i.jsx(Ct,{placeholder:"Selecione um bot"})})}),i.jsx(vt,{className:"border border-gray-600",children:s&&s.length>0&&s.map(h=>i.jsx(he,{value:`${h.id}`,children:h.id},h.id))})]})]})}),i.jsx(P,{control:u.control,name:"expire",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Expira em (minitos)"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Expira em (minitos)",type:"number"})]})}),i.jsx(P,{control:u.control,name:"keywordFinish",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Palavra Chave de Finalização"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Palavra Chave de Finalização"})]})}),i.jsx(P,{control:u.control,name:"delayMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Delay padrão da mensagem"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Delay padrão da mensagem",type:"number"})]})}),i.jsx(P,{control:u.control,name:"unknownMessage",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Mensagem para tipo de mensagem desconhecida"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Mensagem para tipo de mensagem desconhecida"})]})}),i.jsx(P,{control:u.control,name:"listeningFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Escuta mensagens enviadas por mim"})})]})}),i.jsx(P,{control:u.control,name:"stopBotFromMe",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Pausa o bot quando eu enviar uma mensagem"})})]})}),i.jsx(P,{control:u.control,name:"keepOpen",render:({field:f})=>i.jsxs(M,{className:"flex flex-row items-center justify-start py-4",children:[i.jsx(ae,{children:i.jsx(je,{checked:f.value,onCheckedChange:f.onChange})}),i.jsx("div",{className:"ml-4 space-y-0.5",children:i.jsx(A,{className:"text-sm",children:"Mantem a sessão do bot aberta"})})]})}),i.jsx(P,{control:u.control,name:"debounceTime",render:({field:f})=>i.jsxs(M,{className:"pb-4",children:[i.jsx(A,{children:"Tempo de espera"}),i.jsx(se,{...f,className:"border border-gray-600 w-full",placeholder:"Tempo de espera",type:"number"})]})}),i.jsx(P,{control:u.control,name:"ignoreJids",render:({field:f})=>i.jsxs("div",{className:"pb-4",children:[i.jsx("label",{className:"block text-sm font-medium",children:"Ignorar JIDs"}),i.jsx(sx,{tags:t,handleDelete:l,handleAddition:c,inputFieldPosition:"bottom",placeholder:"Adicionar JIDs ex: 1234567890@s.whatsapp.net",autoFocus:!1,classNames:{tags:"tagsClass",tagInput:"tagInputClass",tagInputField:"tagInputFieldClass",selected:"selectedClass",tag:"tagClass",remove:"removeClass",suggestions:"suggestionsClass",activeSuggestion:"activeSuggestionClass",editTagInput:"editTagInputClass",editTagInputField:"editTagInputFieldClass",clearAll:"clearAllClass"}}),i.jsx("input",{type:"hidden",...f,value:t.map(h=>h.text).join(",")})]})})]})}),i.jsx(wr,{children:i.jsx(Te,{variant:"default",type:"button",onClick:d,children:"Salvar"})})]})})]})]})}const mS=async(e,t,n)=>{try{const r=localStorage.getItem("token");if(r&&e&&e.name){const o=await rR(e.name,r);t(o)}else console.error("Token ou nome da instância não encontrados.");n(!1)}catch(r){console.error("Erro ao carregar configurações:",r),n(!1)}};function vS(){const{instance:e}=Tt(),{difyId:t}=Ta(),[n,r]=v.useState(!0),[o,s]=v.useState([]),a=ir();v.useEffect(()=>{mS(e,s,r)},[e]);const l=u=>{e&&a(`/manager/instance/${e.id}/dify/${u}`)},c=()=>{mS(e,s,r)};return i.jsxs("main",{className:"main-table pt-5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"ml-5 mb-1 text-lg font-medium",children:"Dify Bots"}),i.jsxs("div",{children:[i.jsx(_K,{}),i.jsx(CK,{resetTable:c})]})]}),i.jsx(Dt,{className:"mt-4 border border-black"}),i.jsxs(su,{direction:"horizontal",children:[i.jsx(ro,{defaultSize:35,className:"p-5",children:i.jsx("div",{className:"table",children:n?i.jsx(Fo,{}):i.jsx(i.Fragment,{children:o&&o.length>0?o.map(u=>i.jsxs("div",{className:`table-item ${u.id===t?"selected":""}`,onClick:()=>l(`${u.id}`),children:[i.jsx("h3",{className:"table-item-title",children:u.id}),i.jsx("p",{className:"table-item-description",children:u.botType})]})):i.jsx("p",{children:"Nenhum bot encontrado."})})})}),i.jsx(au,{withHandle:!0,className:"border border-black"}),i.jsx(ro,{className:"",children:t&&i.jsx(bK,{difyId:t,instance:e,resetTable:c})})]})]})}const oR=new zr,EK=async(e,t)=>(await oR.getInstance().get(`/webhook/find/${e}`,{headers:{apikey:t}})).data,TK=async(e,t,n)=>(await oR.getInstance().post(`/webhook/set/${e}`,n,{headers:{apikey:t}})).data,kK=T.object({enabled:T.boolean(),url:T.string().url("Invalid URL format"),events:T.array(T.string()),webhookBase64:T.boolean(),webhookByEvents:T.boolean()});function NK(){const{instance:e}=Tt(),[t,n]=v.useState(!1),r=tn({resolver:nn(kK),defaultValues:{enabled:!1,url:"",events:[],webhookBase64:!1,webhookByEvents:!1}});v.useEffect(()=>{(async()=>{if(e){n(!0);try{const l=await EK(e.name,e.token);r.reset(l)}catch(l){console.error("Erro ao buscar dados do webhook:",l)}finally{n(!1)}}})()},[e,r]);const o=async()=>{var l,c,u;if(!e)return;const a=r.getValues();n(!0);try{const d={enabled:a.enabled,url:a.url,events:a.events,webhookBase64:a.webhookBase64,webhookByEvents:a.webhookByEvents};await TK(e.name,e.token,d),De.success("Webhook criado com sucesso")}catch(d){console.error("Erro ao criar webhook:",d),De.error(`Erro ao criar : ${(u=(c=(l=d==null?void 0:d.response)==null?void 0:l.data)==null?void 0:c.response)==null?void 0:u.message}`)}finally{n(!1)}},s=["APPLICATION_STARTUP","QRCODE_UPDATED","MESSAGES_SET","MESSAGES_UPSERT","MESSAGES_UPDATE","MESSAGES_DELETE","SEND_MESSAGE","CONTACTS_SET","CONTACTS_UPSERT","CONTACTS_UPDATE","PRESENCE_UPDATE","CHATS_SET","CHATS_UPSERT","CHATS_UPDATE","CHATS_DELETE","GROUPS_UPSERT","GROUP_UPDATE","GROUP_PARTICIPANTS_UPDATE","CONNECTION_UPDATE","LABELS_EDIT","LABELS_ASSOCIATION","CALL","TYPEBOT_START","TYPEBOT_CHANGE_STATUS"];return i.jsx("main",{className:"main-content",children:i.jsx(uo,{...r,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Webhook"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:r.control,name:"enabled",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o webhook"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"url",render:({field:a})=>i.jsx(se,{...a,className:"border border-gray-600 w-full",placeholder:"URL"})}),i.jsx(P,{control:r.control,name:"webhookByEvents",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Webhook por Eventos"}),i.jsx($t,{children:"Cria uma rota para cada evento adicionando o nome do evento no final da URL"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"webhookBase64",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Base64 no Webhook"}),i.jsx($t,{children:"Envie os dados do base64 das mídias no webhook"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"events",render:({field:a})=>i.jsxs(M,{className:"flex flex-col",children:[i.jsx(A,{children:"Eventos"}),i.jsx(ae,{children:i.jsx(i.Fragment,{children:s.map(l=>i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsx("span",{children:l}),i.jsx(je,{checked:a.value.includes(l),onCheckedChange:c=>{c?a.onChange([...a.value,l]):a.onChange(a.value.filter(u=>u!==l))}})]},l))})})]})})]})]}),i.jsx(Te,{disabled:t,onClick:o,children:t?"Salvando...":"Salvar"})]})})})}const sR=new zr,RK=async(e,t)=>(await sR.getInstance().get(`/websocket/find/${e}`,{headers:{apikey:t}})).data,PK=async(e,t,n)=>(await sR.getInstance().post(`/websocket/set/${e}`,n,{headers:{apikey:t}})).data,IK=T.object({enabled:T.boolean(),events:T.array(T.string())});function DK(){const{instance:e}=Tt(),[t,n]=v.useState(!1),r=tn({resolver:nn(IK),defaultValues:{enabled:!1,events:[]}});v.useEffect(()=>{(async()=>{if(e){n(!0);try{const l=await RK(e.name,e.token);r.reset(l)}catch(l){console.error("Erro ao buscar dados do websocket:",l)}finally{n(!1)}}})()},[e,r]);const o=async()=>{var l,c,u;if(!e)return;const a=r.getValues();n(!0);try{const d={enabled:a.enabled,events:a.events};await PK(e.name,e.token,d),De.success("Websocket criado com sucesso")}catch(d){console.error("Erro ao criar websocket:",d),De.error(`Erro ao criar : ${(u=(c=(l=d==null?void 0:d.response)==null?void 0:l.data)==null?void 0:c.response)==null?void 0:u.message}`)}finally{n(!1)}},s=["APPLICATION_STARTUP","QRCODE_UPDATED","MESSAGES_SET","MESSAGES_UPSERT","MESSAGES_UPDATE","MESSAGES_DELETE","SEND_MESSAGE","CONTACTS_SET","CONTACTS_UPSERT","CONTACTS_UPDATE","PRESENCE_UPDATE","CHATS_SET","CHATS_UPSERT","CHATS_UPDATE","CHATS_DELETE","GROUPS_UPSERT","GROUP_UPDATE","GROUP_PARTICIPANTS_UPDATE","CONNECTION_UPDATE","LABELS_EDIT","LABELS_ASSOCIATION","CALL","TYPEBOT_START","TYPEBOT_CHANGE_STATUS"];return i.jsx("main",{className:"main-content",children:i.jsx(uo,{...r,children:i.jsxs("form",{className:"w-full space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-lg font-medium",children:"Websocket"}),i.jsx(Ho,{className:"my-4 border-t border-gray-600"}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(P,{control:r.control,name:"enabled",render:({field:a})=>i.jsxs(M,{className:"flex flex-row items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(A,{className:"text-sm",children:"Ativo"}),i.jsx($t,{children:"Ativa ou desativa o websocket"})]}),i.jsx(ae,{children:i.jsx(je,{checked:a.value,onCheckedChange:a.onChange})})]})}),i.jsx(P,{control:r.control,name:"events",render:({field:a})=>i.jsxs(M,{className:"flex flex-col",children:[i.jsx(A,{children:"Eventos"}),i.jsx(ae,{children:i.jsx(i.Fragment,{children:s.map(l=>i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-600 p-4",children:[i.jsx("span",{children:l}),i.jsx(je,{checked:a.value.includes(l),onCheckedChange:c=>{c?a.onChange([...a.value,l]):a.onChange(a.value.filter(u=>u!==l))}})]},l))})})]})})]})]}),i.jsx(Te,{disabled:t,onClick:o,children:t?"Salvando...":"Salvar"})]})})})}function OK(){const e=ir(),[t,n]=v.useState(window.location.protocol+"//"+window.location.host),[r,o]=v.useState(""),s=async()=>{if(!t||!r){De.error("Credenciais inválidas");return}const a=await BM(t);if(!a||!a.version){y_(),De.error("Servidor inválido");return}if(!await UM(t,r)){De.error("Credenciais inválidas");return}localStorage.setItem("version",a.version),localStorage.setItem("clientName",a.clientName),e("/manager/")};return i.jsxs("div",{children:[i.jsx("div",{className:"pt-2",children:i.jsx("img",{className:"logo",src:"/assets/images/evolution-logo.png",alt:"logo"})}),i.jsx("div",{className:"root",children:i.jsxs(mi,{className:"w-[350px] no-border",children:[i.jsxs(ql,{children:[i.jsx(Zl,{className:"text-center",children:"Evolution Manager"}),i.jsx(d1,{className:"text-center",children:"Login to your evolution api server"})]}),i.jsx(Jl,{children:i.jsxs("div",{className:"grid w-full items-center gap-4",children:[i.jsxs("div",{className:"flex flex-col space-y-1.5",children:[i.jsx(fs,{className:"text-center",htmlFor:"serverUrl",children:"Server URL"}),i.jsx(se,{className:"border border-gray-300",id:"serverUrl",placeholder:"Server URL",value:t,onChange:a=>n(a.target.value)})]}),i.jsxs("div",{className:"flex flex-col space-y-1.5",children:[i.jsx(fs,{className:"text-center",htmlFor:"apiKey",children:"Global ApiKey"}),i.jsx(se,{id:"apiKey",className:"border border-gray-300",placeholder:"Global ApiKey",type:"password",value:r,onChange:a=>o(a.target.value)})]})]})}),i.jsx(f1,{className:"flex justify-center",children:i.jsx(Te,{className:"w-full",onClick:s,children:"Login"})})]})}),i.jsx(u1,{})]})}const MK=eO([{path:"/manager/login",element:i.jsx(gO,{children:i.jsx(OK,{})})},{path:"/manager/",element:i.jsx(sn,{children:i.jsx(JF,{children:i.jsx(Pz,{})})})},{path:"/manager/instance/:instanceId/dashboard",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(y3,{})})})},{path:"/manager/instance/:instanceId/chat",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(J0,{})})})},{path:"/manager/instance/:instanceId/chat/:remoteJid",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(J0,{})})})},{path:"/manager/instance/:instanceId/settings",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(GW,{})})})},{path:"/manager/instance/:instanceId/openai",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(cS,{})})})},{path:"/manager/instance/:instanceId/openai/:openaiBotId",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(cS,{})})})},{path:"/manager/instance/:instanceId/webhook",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(NK,{})})})},{path:"/manager/instance/:instanceId/websocket",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(DK,{})})})},{path:"/manager/instance/:instanceId/rabbitmq",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(BW,{})})})},{path:"/manager/instance/:instanceId/sqs",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(ZW,{})})})},{path:"/manager/instance/:instanceId/chatwoot",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(m3,{})})})},{path:"/manager/instance/:instanceId/typebot",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(pS,{})})})},{path:"/manager/instance/:instanceId/typebot/:typebotId",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(pS,{})})})},{path:"/manager/instance/:instanceId/dify",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(vS,{})})})},{path:"/manager/instance/:instanceId/dify/:difyId",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx(vS,{})})})},{path:"/manager/instance/:instanceId/proxy",element:i.jsx(sn,{children:i.jsx(gn,{children:i.jsx($W,{})})})}]),AK={theme:"system",setTheme:()=>null},FK=v.createContext(AK);function LK({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,s]=v.useState(()=>localStorage.getItem(n)||t);v.useEffect(()=>{const l=window.document.documentElement;if(l.classList.remove("light","dark"),o==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";l.classList.add(c);return}l.classList.add(o)},[o]);const a={theme:o,setTheme:l=>{localStorage.setItem(n,l),s(l)}};return i.jsx(FK.Provider,{...r,value:a,children:e})}ig.createRoot(document.getElementById("root")).render(i.jsxs(Se.StrictMode,{children:[i.jsx(LK,{defaultTheme:"dark",storageKey:"vite-ui-theme",children:i.jsx(cO,{router:MK})}),i.jsx(S4,{})]}))});export default $K(); diff --git a/manager/dist/index.html b/manager/dist/index.html index 8b30ea3e..0a6e03d2 100644 --- a/manager/dist/index.html +++ b/manager/dist/index.html @@ -5,7 +5,7 @@ Evolution Manager - +